From 49cb978aa46af0d86ab609013d7883c8105a6d1d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Sep 2010 18:41:05 -0600 Subject: gallium: better docs for pipe_rasterizer_state::sprite_coord_enable --- src/gallium/docs/source/cso/rasterizer.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst index ee3419ccfca..d547055096f 100644 --- a/src/gallium/docs/source/cso/rasterizer.rst +++ b/src/gallium/docs/source/cso/rasterizer.rst @@ -124,17 +124,24 @@ Points sprite_coord_enable ^^^^^^^^^^^^^^^^^^^ -Specifies if a texture unit has its texture coordinates replaced or not. This -is a packed bitfield containing the enable for all texcoords -- if all bits -are zero, point sprites are effectively disabled. +Controls automatic texture coordinate generation for rendering sprite points. + +When bit k in the sprite_coord_enable bitfield is set, then generic +input k to the fragment shader will get an automatically computed +texture coordinate. + +The texture coordinate will be of the form (s, t, 0, 1) where s varies +from 0 to 1 from left to right while t varies from 0 to 1 according to +the state of 'sprite_coord_mode' (see below). If any bit is set, then point_smooth MUST be disabled (there are no round sprites) and point_quad_rasterization MUST be true (sprites are always rasterized as quads). Any mismatch between these states should be considered a bug in the state-tracker. -If enabled, the four vertices of the resulting quad will be assigned -texture coordinates, according to sprite_coord_mode. +This feature is implemented in the :ref:`Draw` module but may also be +implemented natively by GPUs or implemented with a geometry shader. + sprite_coord_mode ^^^^^^^^^^^^^^^^^ @@ -145,6 +152,7 @@ have coordinates (0,0,0,1). For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left vertex will have coordinates (0,0,0,1). This state is used by :ref:`Draw` to generate texcoords. + point_quad_rasterization ^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From e22e3927b056806e9bbb089734132ad0bcb98df1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Sep 2010 18:41:30 -0600 Subject: gallium: rework handling of sprite_coord_enable state Implement the pipe_rasterizer_state::sprite_coord_enable field in the draw module (and softpipe) according to what's specified in the documentation. The draw module can now add any number of extra vertex attributes to a post-transformed vertex and generate texcoords for those attributes per sprite_coord_enable. Auto-generated texcoords for sprites only worked for one texcoord unit before. The frag shader gl_PointCoord input is now implemented like any other generic/texcoord attribute. The draw module now needs to be informed about fragment shaders since we need to look at the fragment shader's inputs to know which ones need auto-generated texcoords. Only softpipe has been updated so far. --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/draw/draw_context.c | 56 +++++++++-- src/gallium/auxiliary/draw/draw_context.h | 12 +++ src/gallium/auxiliary/draw/draw_pipe_aaline.c | 9 +- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 8 +- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 114 ++++++++++------------ src/gallium/auxiliary/draw/draw_private.h | 17 +++- src/gallium/drivers/softpipe/sp_state.h | 2 + src/gallium/drivers/softpipe/sp_state_fs.c | 15 ++- src/mesa/state_tracker/st_atom_rasterizer.c | 14 +++ src/mesa/state_tracker/st_program.c | 17 +--- 12 files changed, 172 insertions(+), 94 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 2de764c4ee3..f05538bbac4 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -8,6 +8,7 @@ C_SOURCES = \ cso_cache/cso_context.c \ cso_cache/cso_hash.c \ draw/draw_context.c \ + draw/draw_fs.c \ draw/draw_gs.c \ draw/draw_pipe.c \ draw/draw_pipe_aaline.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 294df300947..baaa26fea92 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -54,6 +54,7 @@ source = [ 'cso_cache/cso_context.c', 'cso_cache/cso_hash.c', 'draw/draw_context.c', + 'draw/draw_fs.c', 'draw/draw_gs.c', 'draw/draw_pipe.c', 'draw/draw_pipe_aaline.c', diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 937b0934798..b07de76a498 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -413,6 +413,42 @@ draw_set_force_passthrough( struct draw_context *draw, boolean enable ) } + +/** + * Allocate an extra vertex/geometry shader vertex attribute. + * This is used by some of the optional draw module stages such + * as wide_point which may need to allocate additional generic/texcoord + * attributes. + */ +int +draw_alloc_extra_vertex_attrib(struct draw_context *draw, + uint semantic_name, uint semantic_index) +{ + const int num_outputs = draw_current_shader_outputs(draw); + const int n = draw->extra_shader_outputs.num; + + assert(n < Elements(draw->extra_shader_outputs.semantic_name)); + + draw->extra_shader_outputs.semantic_name[n] = semantic_name; + draw->extra_shader_outputs.semantic_index[n] = semantic_index; + draw->extra_shader_outputs.slot[n] = num_outputs + n; + draw->extra_shader_outputs.num++; + + return draw->extra_shader_outputs.slot[n]; +} + + +/** + * Remove all extra vertex attributes that were allocated with + * draw_alloc_extra_vertex_attrib(). + */ +void +draw_remove_extra_vertex_attribs(struct draw_context *draw) +{ + draw->extra_shader_outputs.num = 0; +} + + /** * Ask the draw module for the location/slot of the given vertex attribute in * a post-transformed vertex. @@ -446,12 +482,12 @@ draw_find_shader_output(const struct draw_context *draw, return i; } - /* XXX there may be more than one extra vertex attrib. - * For example, simulated gl_FragCoord and gl_PointCoord. - */ - if (draw->extra_shader_outputs.semantic_name == semantic_name && - draw->extra_shader_outputs.semantic_index == semantic_index) { - return draw->extra_shader_outputs.slot; + /* Search the extra vertex attributes */ + for (i = 0; i < draw->extra_shader_outputs.num; i++) { + if (draw->extra_shader_outputs.semantic_name[i] == semantic_name && + draw->extra_shader_outputs.semantic_index[i] == semantic_index) { + return draw->extra_shader_outputs.slot[i]; + } } return 0; @@ -470,16 +506,18 @@ draw_find_shader_output(const struct draw_context *draw, uint draw_num_shader_outputs(const struct draw_context *draw) { - uint count = draw->vs.vertex_shader->info.num_outputs; + uint count; /* If a geometry shader is present, its outputs go to the * driver, else the vertex shader's outputs. */ if (draw->gs.geometry_shader) count = draw->gs.geometry_shader->info.num_outputs; + else + count = draw->vs.vertex_shader->info.num_outputs; + + count += draw->extra_shader_outputs.num; - if (draw->extra_shader_outputs.slot > 0) - count++; return count; } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 4f0d30123a4..1f27cbf488a 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -46,6 +46,7 @@ struct draw_context; struct draw_stage; struct draw_vertex_shader; struct draw_geometry_shader; +struct draw_fragment_shader; struct tgsi_sampler; #define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */ @@ -137,6 +138,17 @@ void draw_delete_vertex_shader(struct draw_context *draw, struct draw_vertex_shader *dvs); +/* + * Fragment shader functions + */ +struct draw_fragment_shader * +draw_create_fragment_shader(struct draw_context *draw, + const struct pipe_shader_state *shader); +void draw_bind_fragment_shader(struct draw_context *draw, + struct draw_fragment_shader *dvs); +void draw_delete_fragment_shader(struct draw_context *draw, + struct draw_fragment_shader *dvs); + /* * Geometry shader functions */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index eac21110be4..d1aba763098 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -688,10 +688,9 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header) aaline->tex_slot = draw_current_shader_outputs(draw); aaline->pos_slot = draw_current_shader_position_output(draw);; - /* advertise the extra post-transformed vertex attribute */ - draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC; - draw->extra_shader_outputs.semantic_index = aaline->fs->generic_attrib; - draw->extra_shader_outputs.slot = aaline->tex_slot; + /* allocate the extra post-transformed vertex attribute */ + (void) draw_alloc_extra_vertex_attrib(draw, TGSI_SEMANTIC_GENERIC, + aaline->fs->generic_attrib); /* how many samplers? */ /* we'll use sampler/texture[pstip->sampler_unit] for the stipple */ @@ -744,7 +743,7 @@ aaline_flush(struct draw_stage *stage, unsigned flags) draw->suspend_flushing = FALSE; - draw->extra_shader_outputs.slot = 0; + draw_remove_extra_vertex_attribs(draw); } diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index d406a86ccb5..5ea552f51c1 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -701,9 +701,9 @@ aapoint_first_point(struct draw_stage *stage, struct prim_header *header) aapoint->pos_slot = draw_current_shader_position_output(draw); - draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC; - draw->extra_shader_outputs.semantic_index = aapoint->fs->generic_attrib; - draw->extra_shader_outputs.slot = aapoint->tex_slot; + /* allocate the extra post-transformed vertex attribute */ + (void) draw_alloc_extra_vertex_attrib(draw, TGSI_SEMANTIC_GENERIC, + aapoint->fs->generic_attrib); /* find psize slot in post-transform vertex */ aapoint->psize_slot = -1; @@ -754,7 +754,7 @@ aapoint_flush(struct draw_stage *stage, unsigned flags) draw->suspend_flushing = FALSE; - draw->extra_shader_outputs.slot = 0; + draw_remove_extra_vertex_attribs(draw); } diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index ee2945c7c97..40843c58c20 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -57,26 +57,24 @@ #include "util/u_memory.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" +#include "draw_fs.h" #include "draw_vs.h" #include "draw_pipe.h" struct widepoint_stage { - struct draw_stage stage; + struct draw_stage stage; /**< base class */ float half_point_size; float xbias; float ybias; - uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS]; - uint texcoord_enable[PIPE_MAX_SHADER_OUTPUTS]; - uint num_texcoords; - uint texcoord_mode; + /** for automatic texcoord generation/replacement */ + uint num_texcoord_gen; + uint texcoord_gen_slot[PIPE_MAX_SHADER_OUTPUTS]; int psize_slot; - - int point_coord_fs_input; /**< input for pointcoord */ }; @@ -96,30 +94,20 @@ widepoint_stage( struct draw_stage *stage ) static void set_texcoords(const struct widepoint_stage *wide, struct vertex_header *v, const float tc[4]) { + const struct draw_context *draw = wide->stage.draw; + const struct pipe_rasterizer_state *rast = draw->rasterizer; + const uint texcoord_mode = rast->sprite_coord_mode; uint i; - for (i = 0; i < wide->num_texcoords; i++) { - if (wide->texcoord_enable[i]) { - uint j = wide->texcoord_slot[i]; - v->data[j][0] = tc[0]; - if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT) - v->data[j][1] = 1.0f - tc[1]; - else - v->data[j][1] = tc[1]; - v->data[j][2] = tc[2]; - v->data[j][3] = tc[3]; - } - } - if (wide->point_coord_fs_input >= 0) { - /* put gl_PointCoord into the extra vertex slot */ - uint slot = wide->stage.draw->extra_shader_outputs.slot; + for (i = 0; i < wide->num_texcoord_gen; i++) { + const uint slot = wide->texcoord_gen_slot[i]; v->data[slot][0] = tc[0]; - if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT) + if (texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT) v->data[slot][1] = 1.0f - tc[1]; else v->data[slot][1] = tc[1]; - v->data[slot][2] = 0.0F; - v->data[slot][3] = 1.0F; + v->data[slot][2] = tc[2]; + v->data[slot][3] = tc[3]; } } @@ -201,18 +189,9 @@ static void widepoint_point( struct draw_stage *stage, } -static int -find_pntc_input_attrib(struct draw_context *draw) -{ - /* Scan the fragment program's input decls to find the pointcoord - * attribute. The xy components will store the point coord. - */ - return 0; /* XXX fix this */ -} - - -static void widepoint_first_point( struct draw_stage *stage, - struct prim_header *header ) +static void +widepoint_first_point(struct draw_stage *stage, + struct prim_header *header) { struct widepoint_stage *wide = widepoint_stage(stage); struct draw_context *draw = stage->draw; @@ -244,31 +223,45 @@ static void widepoint_first_point( struct draw_stage *stage, stage->point = draw_pipe_passthrough_point; } + draw_remove_extra_vertex_attribs(draw); + if (rast->point_quad_rasterization) { - /* find vertex shader texcoord outputs */ - const struct draw_vertex_shader *vs = draw->vs.vertex_shader; - uint i, j = 0; - wide->texcoord_mode = rast->sprite_coord_mode; - for (i = 0; i < vs->info.num_outputs; i++) { - if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) { - wide->texcoord_slot[j] = i; - wide->texcoord_enable[j] = (rast->sprite_coord_enable >> j) & 1; - j++; + const struct draw_fragment_shader *fs = draw->fs.fragment_shader; + uint i; + + wide->num_texcoord_gen = 0; + + /* Loop over fragment shader inputs looking for generic inputs + * for which bit 'k' in sprite_coord_enable is set. + */ + for (i = 0; i < fs->info.num_inputs; i++) { + if (fs->info.input_semantic_name[i] == TGSI_SEMANTIC_GENERIC) { + const int generic_index = fs->info.input_semantic_index[i]; + if (rast->sprite_coord_enable & (1 << generic_index)) { + /* OK, this generic attribute needs to be replaced with a + * texcoord (see above). + */ + int slot = draw_find_shader_output(draw, + TGSI_SEMANTIC_GENERIC, + generic_index); + + if (slot > 0) { + /* there's already a post-vertex shader attribute + * for this fragment shader input attribute. + */ + } + else { + /* need to allocate a new post-vertex shader attribute */ + slot = draw_alloc_extra_vertex_attrib(draw, + TGSI_SEMANTIC_GENERIC, + generic_index); + } + + /* add this slot to the texcoord-gen list */ + wide->texcoord_gen_slot[wide->num_texcoord_gen++] = slot; + } } } - wide->num_texcoords = j; - - /* find fragment shader PointCoord input */ - wide->point_coord_fs_input = find_pntc_input_attrib(draw); - - /* setup extra vp output (point coord implemented as a texcoord) */ - draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC; - draw->extra_shader_outputs.semantic_index = 0; - draw->extra_shader_outputs.slot = draw_current_shader_outputs(draw); - } - else { - wide->point_coord_fs_input = -1; - draw->extra_shader_outputs.slot = 0; } wide->psize_slot = -1; @@ -295,7 +288,8 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags ) stage->point = widepoint_first_point; stage->next->flush( stage->next, flags ); - stage->draw->extra_shader_outputs.slot = 0; + + draw_remove_extra_vertex_attribs(draw); /* restore original rasterizer state */ if (draw->rast_handle) { diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 362f563ba6a..d417f825a0f 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -250,6 +250,11 @@ struct draw_context struct tgsi_sampler **samplers; } gs; + /** Fragment shader state */ + struct { + struct draw_fragment_shader *fragment_shader; + } fs; + /** Stream output (vertex feedback) state */ struct { struct pipe_stream_output_state state; @@ -266,9 +271,10 @@ struct draw_context /* If a prim stage introduces new vertex attributes, they'll be stored here */ struct { - uint semantic_name; - uint semantic_index; - int slot; + uint num; + uint semantic_name[10]; + uint semantic_index[10]; + uint slot[10]; } extra_shader_outputs; unsigned reduced_prim; @@ -362,6 +368,11 @@ void draw_gs_destroy( struct draw_context *draw ); uint draw_current_shader_outputs(const struct draw_context *draw); uint draw_current_shader_position_output(const struct draw_context *draw); +int draw_alloc_extra_vertex_attrib(struct draw_context *draw, + uint semantic_name, uint semantic_index); +void draw_remove_extra_vertex_attribs(struct draw_context *draw); + + /******************************************************************************* * Vertex processing (was passthrough) code: */ diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 39d204de8a9..c5d61f840f2 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -70,6 +70,8 @@ struct sp_fragment_shader { struct tgsi_shader_info info; + struct draw_fragment_shader *draw_shader; + boolean origin_lower_left; /**< fragment shader uses lower left position origin? */ boolean pixel_center_integer; /**< fragment shader uses integer pixel center? */ diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index ded242d3dc5..50bc2eea5ff 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -60,7 +60,15 @@ softpipe_create_fs_state(struct pipe_context *pipe, state = softpipe_create_fs_exec( softpipe, templ ); } - assert(state); + if (!state) + return NULL; + + /* draw's fs state */ + state->draw_shader = draw_create_fragment_shader(softpipe->draw, templ); + if (!state->draw_shader) { + state->delete( state ); + return NULL; + } /* get/save the summary info for this shader */ tgsi_scan_shader(templ->tokens, &state->info); @@ -90,6 +98,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) softpipe->fs = fs; + draw_bind_fragment_shader(softpipe->draw, + (softpipe->fs ? softpipe->fs->draw_shader : NULL)); + softpipe->dirty |= SP_NEW_FS; } @@ -109,6 +120,8 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs) tgsi_exec_machine_bind_shader(softpipe->fs_machine, NULL, 0, NULL); } + draw_delete_fragment_shader(softpipe->draw, state->draw_shader); + state->delete( state ); } diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 2599bd5ca03..0fe333ae8aa 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -60,6 +60,7 @@ static void update_raster_state( struct st_context *st ) GLcontext *ctx = st->ctx; struct pipe_rasterizer_state *raster = &st->state.rasterizer; const struct gl_vertex_program *vertProg = ctx->VertexProgram._Current; + const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current; uint i; memset(raster, 0, sizeof(*raster)); @@ -175,17 +176,30 @@ static void update_raster_state( struct st_context *st ) if (!ctx->Point.PointSprite && ctx->Point.SmoothFlag) raster->point_smooth = 1; + /* _NEW_POINT | _NEW_PROGRAM + */ if (ctx->Point.PointSprite) { + /* origin */ if ((ctx->Point.SpriteOrigin == GL_UPPER_LEFT) ^ (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM)) raster->sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT; else raster->sprite_coord_mode = PIPE_SPRITE_COORD_LOWER_LEFT; + + /* Coord replacement flags. If bit 'k' is set that means + * that we need to replace GENERIC[k] attrib with an automatically + * computed texture coord. + */ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (ctx->Point.CoordReplace[i]) { raster->sprite_coord_enable |= 1 << i; } } + if (fragProg->Base.InputsRead & FRAG_BIT_PNTC) { + raster->sprite_coord_enable |= + 1 << (FRAG_ATTRIB_PNTC - FRAG_ATTRIB_TEX0); + } + raster->point_quad_rasterization = 1; } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 8c2d8b6154b..18a7bbe0f90 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -338,17 +338,6 @@ st_translate_fragment_program(struct st_context *st, input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; break; - case FRAG_ATTRIB_PNTC: - /* This is a hack. We really need a new semantic label for - * point coord. The draw module needs to know which fragment - * shader input is the point coord attribute so that it can set - * up the right vertex attribute values. - */ - input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - break; - /* In most cases, there is nothing special about these * inputs, so adopt a convention to use the generic * semantic name and the mesa FRAG_ATTRIB_ number as the @@ -364,6 +353,7 @@ st_translate_fragment_program(struct st_context *st, * zero or be restricted to a particular range -- nobody * should be building tables based on semantic index. */ + case FRAG_ATTRIB_PNTC: case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: case FRAG_ATTRIB_TEX2: @@ -380,7 +370,10 @@ st_translate_fragment_program(struct st_context *st, assert(attr >= FRAG_ATTRIB_TEX0); input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; + if (attr == FRAG_ATTRIB_PNTC) + interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + else + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; } } -- cgit v1.2.3 From f964f92bcc7d4fbbceb16ea972fbbdd278953d75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Sep 2010 18:48:50 -0600 Subject: gallium/docs: added new pipeline.txt diagram This diagram shows the rendering pipeline with an emphasis on the inputs/outputs for each stage. Some stages emit new vertex attributes and others consume some attributes. --- src/gallium/docs/source/pipeline.txt | 128 +++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 src/gallium/docs/source/pipeline.txt (limited to 'src') diff --git a/src/gallium/docs/source/pipeline.txt b/src/gallium/docs/source/pipeline.txt new file mode 100644 index 00000000000..fd1fbe9c76f --- /dev/null +++ b/src/gallium/docs/source/pipeline.txt @@ -0,0 +1,128 @@ +XXX this could be converted/formatted for Sphinx someday. +XXX do not use tabs in this file. + + + + position ] + primary/secondary colors ] + generics (normals, ] + texcoords, fog) ] User vertices / arrays + point size ] + edge flag ] + primitive ID } System-generated values + vertex ID } + | | | + V V V + +-------------------+ + | Vertex shader | + +-------------------+ + | | | + V V V + position + clip distance + generics + front/back & primary/secondary colors + point size + edge flag + primitive ID + | | | + V V V + +------------------------+ + | Geometry shader | + | (consume vertex ID) | + | (may change prim type) | + +------------------------+ + | | | + V V V + [...] + fb layer + | | | + V V V + +--------------------------+ + | Clipper | + | (consume clip distances) | + +--------------------------+ + | | | + V V V + +-------------------+ + | Polygon Culling | + +-------------------+ + | | | + V V V + +-----------------------+ + | Choose front or | + | back face color | + | (consume other color) | + +-----------------------+ + | | | + V V V + [...] + primary/secondary colors only + | | | + V V V + +-------------------+ + | Polygon Offset | + +-------------------+ + | | | + V V V + +----------------------+ + | Unfilled polygons | + | (consume edge flags) | + | (change prim type) | + +----------------------+ + | | | + V V V + position + generics + primary/secondary colors + point size + primitive ID + fb layer + | | | + V V V + +---------------------------------+ + | Optional Draw module helpers | + | * Polygon Stipple | + | * Line Stipple | + | * Line AA/smooth (as tris) | + | * Wide lines (as tris) | + | * Wide points/sprites (as tris) | + | * Point AA/smooth (as tris) | + | (NOTE: these stages may emit | + | new/extra generic attributes | + | such as texcoords) | + +---------------------------------+ + | | | + V V V + position ] + generics (+ new/extra ones) ] + primary/secondary colors ] Software rast vertices + point size ] + primitive ID ] + fb layer ] + | | | + V V V + +---------------------+ + | Triangle/Line/Point | + | Rasterization | + +---------------------+ + | | | + V V V + generic attribs + primary/secondary colors + primitive ID + fragment win coord pos } System-generated values + front/back face flag } + | | | + V V V + +-------------------+ + | Fragment shader | + +-------------------+ + | | | + V V V + zero or more colors + zero or one Z value + + +NOTE: The instance ID is not shown. It can be imagined to be a global variable +accessible to all shader stages. -- cgit v1.2.3 From 013e4cca9f9c74e52f8372b500fb3ff07c692a61 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Sep 2010 00:47:36 -0700 Subject: nvfx: Remove const qualifer from nvfx_vertprog_translate. Silences this GCC warning. nvfx_vertprog.c: In function 'nvfx_vertprog_translate': nvfx_vertprog.c:998: warning: assignment discards qualifiers from pointer target type --- src/gallium/drivers/nvfx/nvfx_vertprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 23f045ecf6c..db352de939a 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -973,7 +973,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc) DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_vp, "NVFX_DUMP_VP", FALSE) static struct nvfx_vertex_program* -nvfx_vertprog_translate(struct nvfx_context *nvfx, const struct pipe_shader_state* vps, const struct tgsi_shader_info* info) +nvfx_vertprog_translate(struct nvfx_context *nvfx, const struct pipe_shader_state* vps, struct tgsi_shader_info* info) { struct tgsi_parse_context parse; struct nvfx_vertex_program* vp = NULL; -- cgit v1.2.3 From b1a5c63467b01265c8652862053b7f2f90dc8044 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Sep 2010 00:51:07 -0700 Subject: nvfx: Silence uninitialized variable warnings. --- src/gallium/drivers/nvfx/nvfx_vertprog.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index db352de939a..e543fda50ef 100644 --- a/src/gallium/drivers/nvfx/nvfx_vertprog.c +++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c @@ -377,6 +377,8 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) { src.swz[2] = fsrc->Register.SwizzleZ; src.swz[3] = fsrc->Register.SwizzleW; src.indirect = 0; + src.indirect_reg = 0; + src.indirect_swz = 0; if(fsrc->Register.Indirect) { if(fsrc->Indirect.File == TGSI_FILE_ADDRESS && -- cgit v1.2.3 From cef42f925cc8b38df741c4571676dab4bd3fd14e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Sep 2010 00:59:16 -0700 Subject: r600g: Remove unused variable. --- src/gallium/drivers/r600/r600_draw.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 5480ca002d2..cbfa44868e8 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -40,7 +40,6 @@ static int r600_draw_common(struct r600_draw *draw) { struct r600_context *rctx = r600_context(draw->ctx); - struct r600_screen *rscreen = rctx->screen; /* FIXME vs_resource */ struct radeon_state *vs_resource; struct r600_resource *rbuffer; -- cgit v1.2.3 From ca92ae2699c4aad21c0811b9a5562b9223816caf Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 18 Sep 2010 11:11:09 +0200 Subject: glsl: Properly handle nested structure types. Fixes piglit test CorrectFull.frag. --- src/glsl/ast_to_hir.cpp | 31 ++++++------------------------- src/glsl/glsl_parser_extras.cpp | 5 +++++ 2 files changed, 11 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 96385449bd6..0cbb4315ac0 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1534,17 +1534,12 @@ ast_type_specifier::glsl_type(const char **name, { const struct glsl_type *type; - if ((this->type_specifier == ast_struct) && (this->type_name == NULL)) { - /* FINISHME: Handle annonymous structures. */ - type = NULL; - } else { - type = state->symbols->get_type(this->type_name); - *name = this->type_name; + type = state->symbols->get_type(this->type_name); + *name = this->type_name; - if (this->is_array) { - YYLTYPE loc = this->get_location(); - type = process_array_type(&loc, type, this->array_size, state); - } + if (this->is_array) { + YYLTYPE loc = this->get_location(); + type = process_array_type(&loc, type, this->array_size, state); } return type; @@ -2705,7 +2700,6 @@ ast_struct_specifier::hir(exec_list *instructions, } } - /* Allocate storage for the structure fields and process the field * declarations. As the declarations are processed, try to also convert * the types to HIR. This ensures that structure definitions embedded in @@ -2750,21 +2744,8 @@ ast_struct_specifier::hir(exec_list *instructions, assert(i == decl_count); - const char *name; - if (this->name == NULL) { - static unsigned anon_count = 1; - char buf[32]; - - snprintf(buf, sizeof(buf), "#anon_struct_%04x", anon_count); - anon_count++; - - name = strdup(buf); - } else { - name = this->name; - } - const glsl_type *t = - glsl_type::get_record_instance(fields, decl_count, name); + glsl_type::get_record_instance(fields, decl_count, this->name); YYLTYPE loc = this->get_location(); if (!state->symbols->add_type(name, t)) { diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 4ac062b42c1..33ea664bcd8 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -680,6 +680,11 @@ ast_struct_specifier::print(void) const ast_struct_specifier::ast_struct_specifier(char *identifier, ast_node *declarator_list) { + if (identifier == NULL) { + static unsigned anon_count = 1; + identifier = talloc_asprintf(this, "#anon_struct_%04x", anon_count); + anon_count++; + } name = identifier; this->declarations.push_degenerate_list_at_head(&declarator_list->link); } -- cgit v1.2.3 From 275a81af13624be70566e190d4dd1f457ea1ff33 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 18 Sep 2010 13:40:10 +0200 Subject: nv50: add relocs for stack and local mem buffers --- src/gallium/drivers/nv50/nv50_context.h | 1 + src/gallium/drivers/nv50/nv50_pc.c | 2 ++ src/gallium/drivers/nv50/nv50_program.h | 1 + src/gallium/drivers/nv50/nv50_screen.c | 13 +++++++++++++ src/gallium/drivers/nv50/nv50_shader_state.c | 17 ++++++++++++++--- 5 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 6ec9095a741..ac69c7848e9 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -157,6 +157,7 @@ struct nv50_context { unsigned sampler_view_nr[3]; unsigned vbo_fifo; + unsigned req_lmem; }; static INLINE struct nv50_context * diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index 676540538e5..42127a138aa 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -547,6 +547,8 @@ nv50_generate_code(struct nv50_translation_info *ti) ti->p->fixups = pc->fixups; ti->p->num_fixups = pc->num_fixups; + ti->p->uses_lmem = ti->store_to_memory; + NV50_DBGMSG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success"); out: diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h index 37b02bbec7c..33c4c8ca6df 100644 --- a/src/gallium/drivers/nv50/nv50_program.h +++ b/src/gallium/drivers/nv50/nv50_program.h @@ -45,6 +45,7 @@ struct nv50_program { ubyte type; boolean translated; + boolean uses_lmem; struct nouveau_bo *bo; struct nouveau_stateobj *so; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 49af9b59beb..a8f77213372 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -265,6 +265,19 @@ nv50_screen_relocs(struct nv50_screen *screen) OUT_RELOC (chan, screen->constbuf_parm[i], ((NV50_CB_PVP + i) << 16) | 0x0000, rl, 0, 0); } + + BGN_RELOC (chan, screen->stack_bo, + tesla, NV50TCL_STACK_ADDRESS_HIGH, 2, rl); + OUT_RELOCh(chan, screen->stack_bo, 0, rl); + OUT_RELOCl(chan, screen->stack_bo, 0, rl); + + if (!screen->cur_ctx->req_lmem) + return; + + BGN_RELOC (chan, screen->local_bo, + tesla, NV50TCL_LOCAL_ADDRESS_HIGH, 2, rl); + OUT_RELOCh(chan, screen->local_bo, 0, rl); + OUT_RELOCl(chan, screen->local_bo, 0, rl); } #ifndef NOUVEAU_GETPARAM_GRAPH_UNITS diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index 8c1a5999cfe..8057ec9fcf5 100644 --- a/src/gallium/drivers/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nv50/nv50_shader_state.c @@ -281,6 +281,17 @@ nv50_program_validate(struct nv50_program *p) return p->translated; } +static INLINE void +nv50_program_validate_common(struct nv50_context *nv50, struct nv50_program *p) +{ + nv50_program_validate_code(nv50, p); + + if (p->uses_lmem) + nv50->req_lmem |= 1 << p->type; + else + nv50->req_lmem &= ~(1 << p->type); +} + struct nouveau_stateobj * nv50_vertprog_validate(struct nv50_context *nv50) { @@ -300,7 +311,7 @@ nv50_vertprog_validate(struct nv50_context *nv50) if (!(nv50->dirty & NV50_NEW_VERTPROG)) return NULL; - nv50_program_validate_code(nv50, p); + nv50_program_validate_common(nv50, p); so_ref(p->so, &so); return so; @@ -325,7 +336,7 @@ nv50_fragprog_validate(struct nv50_context *nv50) if (!(nv50->dirty & NV50_NEW_FRAGPROG)) return NULL; - nv50_program_validate_code(nv50, p); + nv50_program_validate_common(nv50, p); so_ref(p->so, &so); return so; @@ -350,7 +361,7 @@ nv50_geomprog_validate(struct nv50_context *nv50) if (!(nv50->dirty & NV50_NEW_GEOMPROG)) return NULL; - nv50_program_validate_code(nv50, p); + nv50_program_validate_common(nv50, p); so_ref(p->so, &so); return so; -- cgit v1.2.3 From 4c1e7d931dd6e5676297bee23932cc6d66c93cac Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 18 Sep 2010 15:19:34 +0200 Subject: nv50: emit constbuf relocs before uploading constants --- src/gallium/drivers/nv50/nv50_screen.c | 47 +++++++++++++++++++--------- src/gallium/drivers/nv50/nv50_screen.h | 2 ++ src/gallium/drivers/nv50/nv50_shader_state.c | 28 ++++++++++++----- 3 files changed, 56 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index a8f77213372..7c9342b7471 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -221,6 +221,36 @@ nv50_screen_destroy(struct pipe_screen *pscreen) #define BGN_RELOC(ch, bo, gr, m, n, fl) \ OUT_RELOC(ch, bo, (n << 18) | (gr->subc << 13) | m, fl, 0, 0) +void +nv50_screen_reloc_constbuf(struct nv50_screen *screen, unsigned cbi) +{ + struct nouveau_bo *bo; + struct nouveau_channel *chan = screen->base.channel; + struct nouveau_grobj *tesla = screen->tesla; + unsigned size; + const unsigned rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY; + + switch (cbi) { + case NV50_CB_PMISC: + bo = screen->constbuf_misc[0]; + size = 0x200; + break; + case NV50_CB_PVP: + case NV50_CB_PFP: + case NV50_CB_PGP: + bo = screen->constbuf_parm[cbi - NV50_CB_PVP]; + size = 0; + break; + default: + return; + } + + BGN_RELOC (chan, bo, tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl); + OUT_RELOCh(chan, bo, 0, rl); + OUT_RELOCl(chan, bo, 0, rl); + OUT_RELOC (chan, bo, (cbi << 16) | size, rl, 0, 0); +} + void nv50_screen_relocs(struct nv50_screen *screen) { @@ -243,12 +273,7 @@ nv50_screen_relocs(struct nv50_screen *screen) OUT_RELOCh(chan, screen->tsc, 0, rl); OUT_RELOCl(chan, screen->tsc, 0, rl); - BGN_RELOC (chan, screen->constbuf_misc[0], - tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl); - OUT_RELOCh(chan, screen->constbuf_misc[0], 0, rl); - OUT_RELOCl(chan, screen->constbuf_misc[0], 0, rl); - OUT_RELOC (chan, screen->constbuf_misc[0], - (NV50_CB_PMISC << 16) | 0x0200, rl, 0, 0); + nv50_screen_reloc_constbuf(screen, NV50_CB_PMISC); BGN_RELOC (chan, screen->constbuf_misc[0], tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl); @@ -257,14 +282,8 @@ nv50_screen_relocs(struct nv50_screen *screen) OUT_RELOC (chan, screen->constbuf_misc[0], (NV50_CB_AUX << 16) | 0x0200, rl, 0, 0); - for (i = 0; i < 3; ++i) { - BGN_RELOC (chan, screen->constbuf_parm[i], - tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl); - OUT_RELOCh(chan, screen->constbuf_parm[i], 0, rl); - OUT_RELOCl(chan, screen->constbuf_parm[i], 0, rl); - OUT_RELOC (chan, screen->constbuf_parm[i], - ((NV50_CB_PVP + i) << 16) | 0x0000, rl, 0, 0); - } + for (i = 0; i < 3; ++i) + nv50_screen_reloc_constbuf(screen, NV50_CB_PVP + i); BGN_RELOC (chan, screen->stack_bo, tesla, NV50TCL_STACK_ADDRESS_HIGH, 2, rl); diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h index ad6bdeb27c8..6e15230b486 100644 --- a/src/gallium/drivers/nv50/nv50_screen.h +++ b/src/gallium/drivers/nv50/nv50_screen.h @@ -39,6 +39,8 @@ nv50_screen(struct pipe_screen *screen) extern void nv50_screen_relocs(struct nv50_screen *); +extern void nv50_screen_reloc_constbuf(struct nv50_screen *, unsigned cbi); + struct nv50_format { uint32_t rt; uint32_t tic; diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index 8057ec9fcf5..7d2989da05b 100644 --- a/src/gallium/drivers/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nv50/nv50_shader_state.c @@ -47,10 +47,17 @@ nv50_transfer_constbuf(struct nv50_context *nv50, start = 0; while (count) { - unsigned nr = count; - nr = MIN2(nr, 2047); + unsigned nr = AVAIL_RING(chan); + + if (nr < 8) { + FIRE_RING(chan); + continue; + } + nr = MIN2(count, nr - 7); + nr = MIN2(nr, 2074); + + nv50_screen_reloc_constbuf(nv50->screen, cbi); - /* FIXME: emit relocs for unsuiTed MM */ BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 1); OUT_RING (chan, (start << 8) | cbi); BEGIN_RING_NI(chan, tesla, NV50TCL_CB_DATA(0), nr); @@ -77,8 +84,16 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) unsigned start = 0; while (count) { - unsigned nr = count; - nr = MIN2(nr, 2047); + unsigned nr = AVAIL_RING(chan); + + if (nr < 8) { + FIRE_RING(chan); + continue; + } + nr = MIN2(count, nr - 7); + nr = MIN2(nr, 2074); + + nv50_screen_reloc_constbuf(nv50->screen, NV50_CB_PMISC); BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 1); OUT_RING (chan, (start << 8) | NV50_CB_PMISC); @@ -111,8 +126,7 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) break; default: assert(0); - cbi = 0; - break; + return; } nv50_transfer_constbuf(nv50, nv50->constbuf[p->type], p->parm_size, cbi); -- cgit v1.2.3 From 52f9156e88d87a528996f01795203feba3f789f1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 18 Sep 2010 14:44:18 +0200 Subject: glsl/builtins: Fix equal and notEqual builtins. Commit 309cd4115b7cba669a0bf858e7809cb6dae90ddf incorrectly converted these to all_equal and any_nequal, which is the wrong operation. --- src/glsl/builtin_function.cpp | 48 +++++++++++++++++++++---------------------- src/glsl/builtins/ir/equal | 24 +++++++++++----------- src/glsl/builtins/ir/notEqual | 24 +++++++++++----------- 3 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 1e633e3f3a8..e7f00701a2d 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -787,73 +787,73 @@ static const char *builtin_equal = " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) bvec2 arg0)\n" " (declare (in) bvec2 arg1))\n" - " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) bvec3 arg0)\n" " (declare (in) bvec3 arg1))\n" - " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) bvec4 arg0)\n" " (declare (in) bvec4 arg1))\n" - " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" - " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" - " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" - " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" - " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" - " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" - " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; @@ -2311,73 +2311,73 @@ static const char *builtin_notEqual = " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) bvec2 arg0)\n" " (declare (in) bvec2 arg1))\n" - " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) bvec3 arg0)\n" " (declare (in) bvec3 arg1))\n" - " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) bvec4 arg0)\n" " (declare (in) bvec4 arg1))\n" - " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" - " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" - " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" - " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" - " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" - " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" - " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; diff --git a/src/glsl/builtins/ir/equal b/src/glsl/builtins/ir/equal index f6578dc1e32..a414b3e535f 100644 --- a/src/glsl/builtins/ir/equal +++ b/src/glsl/builtins/ir/equal @@ -3,71 +3,71 @@ (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1)) - ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 == (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 == (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1)) - ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 == (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) bvec2 arg0) (declare (in) bvec2 arg1)) - ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 == (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) bvec3 arg0) (declare (in) bvec3 arg1)) - ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 == (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) bvec4 arg0) (declare (in) bvec4 arg1)) - ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 == (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) - ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 == (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) - ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 == (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) - ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 == (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) uvec2 arg0) (declare (in) uvec2 arg1)) - ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 == (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uvec3 arg1)) - ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 == (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uvec4 arg1)) - ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 == (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/ir/notEqual b/src/glsl/builtins/ir/notEqual index d07cdbf41f1..abaf1914c9f 100644 --- a/src/glsl/builtins/ir/notEqual +++ b/src/glsl/builtins/ir/notEqual @@ -3,71 +3,71 @@ (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1)) - ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 != (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 != (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1)) - ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 != (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) bvec2 arg0) (declare (in) bvec2 arg1)) - ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 != (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) bvec3 arg0) (declare (in) bvec3 arg1)) - ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 != (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) bvec4 arg0) (declare (in) bvec4 arg1)) - ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 != (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) - ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 != (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) - ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 != (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) - ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 != (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) uvec2 arg0) (declare (in) uvec2 arg1)) - ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec2 != (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uvec3 arg1)) - ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec3 != (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uvec4 arg1)) - ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1))))) + ((return (expression bvec4 != (var_ref arg0) (var_ref arg1))))) )) -- cgit v1.2.3 From dbd24805071332a06828bd92ed0f6e49c897c146 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 18 Sep 2010 15:56:28 +0200 Subject: glsl/builtins: Switch comparison functions to just return an expression. --- src/glsl/builtin_function.cpp | 216 ++++++---------------------------- src/glsl/builtins/ir/greaterThan | 54 ++------- src/glsl/builtins/ir/greaterThanEqual | 54 ++------- src/glsl/builtins/ir/lessThan | 54 ++------- src/glsl/builtins/ir/lessThanEqual | 54 ++------- 5 files changed, 72 insertions(+), 360 deletions(-) (limited to 'src') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index e7f00701a2d..c904f4629f2 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1044,91 +1044,55 @@ static const char *builtin_greaterThan = " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; @@ -1138,91 +1102,55 @@ static const char *builtin_greaterThanEqual = " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; @@ -1280,91 +1208,55 @@ static const char *builtin_lessThan = " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; @@ -1374,91 +1266,55 @@ static const char *builtin_lessThanEqual = " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature bvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n" "))\n" "" ; diff --git a/src/glsl/builtins/ir/greaterThan b/src/glsl/builtins/ir/greaterThan index f5489008ed2..18af865288f 100644 --- a/src/glsl/builtins/ir/greaterThan +++ b/src/glsl/builtins/ir/greaterThan @@ -3,89 +3,53 @@ (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 > (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 > (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 > (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 > (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 > (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 > (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) uvec2 arg0) (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 > (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 > (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 > (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/ir/greaterThanEqual b/src/glsl/builtins/ir/greaterThanEqual index d00354042a8..6d3bc892cb7 100644 --- a/src/glsl/builtins/ir/greaterThanEqual +++ b/src/glsl/builtins/ir/greaterThanEqual @@ -3,89 +3,53 @@ (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) uvec2 arg0) (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/ir/lessThan b/src/glsl/builtins/ir/lessThan index e29288a972f..8401fe9db60 100644 --- a/src/glsl/builtins/ir/lessThan +++ b/src/glsl/builtins/ir/lessThan @@ -3,89 +3,53 @@ (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 < (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 < (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 < (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 < (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 < (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 < (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) uvec2 arg0) (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 < (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 < (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 < (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/ir/lessThanEqual b/src/glsl/builtins/ir/lessThanEqual index 669f2341d44..c1cdd3fb605 100644 --- a/src/glsl/builtins/ir/lessThanEqual +++ b/src/glsl/builtins/ir/lessThanEqual @@ -3,89 +3,53 @@ (parameters (declare (in) vec2 arg0) (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1))))) (signature bvec2 (parameters (declare (in) uvec2 arg0) (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1))))) (signature bvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1))))) (signature bvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) + ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1))))) )) -- cgit v1.2.3 From 613c3901c3cb748d7ef0bc3162ce3fcb986e9047 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 18 Sep 2010 20:52:44 +0200 Subject: nv50: fix typo in fifo packet length limit --- src/gallium/drivers/nouveau/nouveau_winsys.h | 4 ++++ src/gallium/drivers/nv50/nv50_shader_state.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index c9003c97f5d..ab480cabd09 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -12,6 +12,10 @@ #include "nouveau/nouveau_resource.h" #include "nouveau/nouveau_pushbuf.h" +#ifndef NV04_PFIFO_MAX_PACKET_LEN +#define NV04_PFIFO_MAX_PACKET_LEN 2047 +#endif + static INLINE uint32_t nouveau_screen_transfer_flags(unsigned pipe) { diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index 7d2989da05b..1a2fe758a85 100644 --- a/src/gallium/drivers/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nv50/nv50_shader_state.c @@ -54,7 +54,7 @@ nv50_transfer_constbuf(struct nv50_context *nv50, continue; } nr = MIN2(count, nr - 7); - nr = MIN2(nr, 2074); + nr = MIN2(nr, NV04_PFIFO_MAX_PACKET_LEN); nv50_screen_reloc_constbuf(nv50->screen, cbi); @@ -91,7 +91,7 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) continue; } nr = MIN2(count, nr - 7); - nr = MIN2(nr, 2074); + nr = MIN2(nr, NV04_PFIFO_MAX_PACKET_LEN); nv50_screen_reloc_constbuf(nv50->screen, NV50_CB_PMISC); -- cgit v1.2.3 From ef715b866b6858b79530b44ec7be61f271591adc Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Sep 2010 15:59:00 -0700 Subject: nv50: Silence missing initializer warning. Fixes this GCC warning. nv50_state_validate.c:336: warning: missing initializer nv50_state_validate.c:336: error: (near initialization for 'validate_list[20].func') --- src/gallium/drivers/nv50/nv50_state_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index f1d8202dffa..16c2dab9af6 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -333,7 +333,7 @@ struct state_validate { { validate_vtxbuf , NV50_NEW_ARRAYS }, { validate_vtxattr , NV50_NEW_ARRAYS }, { validate_clip , NV50_NEW_CLIP }, - {} + { NULL , 0 } }; #define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0])) -- cgit v1.2.3 From 03cf572598a1eb593ecebf8c72759bab41588c44 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Sep 2010 23:06:29 -0700 Subject: nv50: Remove dead initialization. --- src/gallium/drivers/nv50/nv50_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index 42127a138aa..c88e7ba742e 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -328,7 +328,7 @@ nv_pc_pass_in_order(struct nv_basic_block *root, nv_pc_pass_func f, void *priv) static void nv_do_print_function(void *priv, struct nv_basic_block *b) { - struct nv_instruction *i = b->phi; + struct nv_instruction *i; debug_printf("=== BB %i ", b->id); if (b->out[0]) -- cgit v1.2.3 From fa1056190897719d9ae7410965abb187392ef520 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Sep 2010 23:07:41 -0700 Subject: nv50: Remove dead initialization. --- src/gallium/drivers/nv50/nv50_pc_regalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_pc_regalloc.c b/src/gallium/drivers/nv50/nv50_pc_regalloc.c index b9d5ba5ef67..39ae36681c0 100644 --- a/src/gallium/drivers/nv50/nv50_pc_regalloc.c +++ b/src/gallium/drivers/nv50/nv50_pc_regalloc.c @@ -767,7 +767,7 @@ nv50_ctor_register_set(struct nv_pc *pc, struct register_set *set) static void insert_ordered_tail(struct nv_value *list, struct nv_value *nval) { - struct nv_value *elem = list->prev; + struct nv_value *elem; for (elem = list->prev; elem != list && elem->livei->bgn > nval->livei->bgn; -- cgit v1.2.3 From 8861727c9190c35f7391ad848fefc6a401872007 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sat, 18 Sep 2010 16:42:22 +0200 Subject: r600g: Added support for TGSI_SEMANTIC_FACE. This makes the 'glsl1-gl_FrontFacing var (1)' piglit test pass. Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/eg_hw_states.c | 9 ++++++++- src/gallium/drivers/r600/r600_hw_states.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index d6f417e1e37..ad8aa4ca9a6 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -930,7 +930,7 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp const struct pipe_rasterizer_state *rasterizer; struct r600_shader *rshader = &rpshader->shader; unsigned i, tmp, exports_ps, num_cout; - boolean have_pos = FALSE; + boolean have_pos = FALSE, have_face = FALSE; rasterizer = &rctx->rasterizer->state.rasterizer; @@ -945,6 +945,10 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp rshader->input[i].name == TGSI_SEMANTIC_POSITION) { tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); } + + if (rshader->input[i].name == TGSI_SEMANTIC_FACE) + have_face = TRUE; + if (rasterizer->sprite_coord_enable & (1 << i)) { tmp |= S_028644_PT_SPRITE_TEX(1); } @@ -971,7 +975,10 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1); state->states[EG_PS_SHADER__SPI_INPUT_Z] |= 1; } + state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; + state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face); + state->states[EG_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) | S_028844_STACK_SIZE(rshader->bc.nstack); state->states[EG_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index bca78ee8deb..25344c6f82a 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -943,7 +943,7 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * const struct pipe_rasterizer_state *rasterizer; struct r600_shader *rshader = &rpshader->shader; unsigned i, tmp, exports_ps, num_cout; - boolean have_pos = FALSE; + boolean have_pos = FALSE, have_face = FALSE; rasterizer = &rctx->rasterizer->state.rasterizer; @@ -958,6 +958,10 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * rshader->input[i].name == TGSI_SEMANTIC_POSITION) { tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); } + + if (rshader->input[i].name == TGSI_SEMANTIC_FACE) + have_face = TRUE; + if (rasterizer->sprite_coord_enable & (1 << i)) { tmp |= S_028644_PT_SPRITE_TEX(1); } @@ -985,7 +989,10 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * S_0286CC_BARYC_SAMPLE_CNTL(1); state->states[R600_PS_SHADER__SPI_INPUT_Z] |= 1; } + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face); + state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack); state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; -- cgit v1.2.3 From c5edfcc410bdf3dbe4f37418de8f0009746c9578 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 19 Sep 2010 17:14:57 +1000 Subject: r600g; add uses waterfall to asm cf for r6xx. On r6xx if an MOVA instruction is emitted we should set this bit. --- src/gallium/drivers/r600/r600_asm.c | 1 + src/gallium/drivers/r600/r600_asm.h | 1 + src/gallium/drivers/r600/r600_shader.c | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 0d17f75da7e..93dc1420111 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -696,6 +696,7 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) | S_SQ_CF_ALU_WORD1_BARRIER(1) | + S_SQ_CF_ALU_WORD1_USES_WATERFALL(cf->r6xx_uses_waterfall) | S_SQ_CF_ALU_WORD1_COUNT((cf->ndw / 2) - 1); break; case V_SQ_CF_WORD1_SQ_CF_INST_TEX: diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index 62a46cb0e1e..6aadf72957b 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -127,6 +127,7 @@ struct r600_bc_cf { unsigned pop_count; unsigned cf_addr; /* control flow addr */ unsigned kcache0_mode; + unsigned r6xx_uses_waterfall; struct list_head alu; struct list_head tex; struct list_head vtx; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 4da6850b0a9..eac46a7ae60 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -2313,6 +2313,7 @@ static int tgsi_arl(struct r600_shader_ctx *ctx) r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU)); if (r) return r; + ctx->bc->cf_last->r6xx_uses_waterfall = 1; return 0; } -- cgit v1.2.3 From ed4f740127d6896506a91c8c5b9c527a971e982b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 19 Sep 2010 17:25:50 +1000 Subject: r600g: only emit uses waterfall on r6xx hw. --- src/gallium/drivers/r600/r600_asm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 93dc1420111..8c01987318a 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -696,7 +696,7 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) | S_SQ_CF_ALU_WORD1_BARRIER(1) | - S_SQ_CF_ALU_WORD1_USES_WATERFALL(cf->r6xx_uses_waterfall) | + S_SQ_CF_ALU_WORD1_USES_WATERFALL(bc->chiprev == 0 ? cf->r6xx_uses_waterfall : 0) | S_SQ_CF_ALU_WORD1_COUNT((cf->ndw / 2) - 1); break; case V_SQ_CF_WORD1_SQ_CF_INST_TEX: -- cgit v1.2.3 From c7c2e7d0ce97b1586219be2ba742758f23f5c7aa Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 19 Sep 2010 16:32:06 +0800 Subject: st/egl: Split modeset code support to modeset.c. The modeset code supports now obsolete EGL_MESA_screen_surface. Move it to a file of its own. --- src/gallium/state_trackers/egl/kms/modeset.c | 619 ++++++++++++++++++++++++ src/gallium/state_trackers/egl/kms/native_kms.c | 572 +--------------------- src/gallium/state_trackers/egl/kms/native_kms.h | 43 +- 3 files changed, 647 insertions(+), 587 deletions(-) create mode 100644 src/gallium/state_trackers/egl/kms/modeset.c (limited to 'src') diff --git a/src/gallium/state_trackers/egl/kms/modeset.c b/src/gallium/state_trackers/egl/kms/modeset.c new file mode 100644 index 00000000000..9473a0e5f4c --- /dev/null +++ b/src/gallium/state_trackers/egl/kms/modeset.c @@ -0,0 +1,619 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + * Chia-I Wu + */ + +#include "util/u_memory.h" +#include "util/u_inlines.h" +#include "egllog.h" + +#include "native_kms.h" + +static boolean +kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, + unsigned int *seq_num, struct pipe_resource **textures, + int *width, int *height) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + + if (!resource_surface_add_resources(ksurf->rsurf, attachment_mask)) + return FALSE; + if (textures) + resource_surface_get_resources(ksurf->rsurf, textures, attachment_mask); + + if (seq_num) + *seq_num = ksurf->sequence_number; + if (width) + *width = ksurf->width; + if (height) + *height = ksurf->height; + + return TRUE; +} + +/** + * Add textures as DRM framebuffers. + */ +static boolean +kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + struct kms_display *kdpy = ksurf->kdpy; + int num_framebuffers = (need_back) ? 2 : 1; + int i, err; + + for (i = 0; i < num_framebuffers; i++) { + struct kms_framebuffer *fb; + enum native_attachment natt; + struct winsys_handle whandle; + uint block_bits; + + if (i == 0) { + fb = &ksurf->front_fb; + natt = NATIVE_ATTACHMENT_FRONT_LEFT; + } + else { + fb = &ksurf->back_fb; + natt = NATIVE_ATTACHMENT_BACK_LEFT; + } + + if (!fb->texture) { + /* make sure the texture has been allocated */ + resource_surface_add_resources(ksurf->rsurf, 1 << natt); + fb->texture = + resource_surface_get_single_resource(ksurf->rsurf, natt); + if (!fb->texture) + return FALSE; + } + + /* already initialized */ + if (fb->buffer_id) + continue; + + /* TODO detect the real value */ + fb->is_passive = TRUE; + + memset(&whandle, 0, sizeof(whandle)); + whandle.type = DRM_API_HANDLE_TYPE_KMS; + + if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen, + fb->texture, &whandle)) + return FALSE; + + block_bits = util_format_get_blocksizebits(ksurf->color_format); + err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height, + block_bits, block_bits, whandle.stride, whandle.handle, + &fb->buffer_id); + if (err) { + fb->buffer_id = 0; + return FALSE; + } + } + + return TRUE; +} + +static boolean +kms_surface_flush_frontbuffer(struct native_surface *nsurf) +{ +#ifdef DRM_MODE_FEATURE_DIRTYFB + struct kms_surface *ksurf = kms_surface(nsurf); + struct kms_display *kdpy = ksurf->kdpy; + + if (ksurf->front_fb.is_passive) + drmModeDirtyFB(kdpy->fd, ksurf->front_fb.buffer_id, NULL, 0); +#endif + + return TRUE; +} + +static boolean +kms_surface_swap_buffers(struct native_surface *nsurf) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + struct kms_crtc *kcrtc = &ksurf->current_crtc; + struct kms_display *kdpy = ksurf->kdpy; + struct kms_framebuffer tmp_fb; + int err; + + if (!ksurf->back_fb.buffer_id) { + if (!kms_surface_init_framebuffers(&ksurf->base, TRUE)) + return FALSE; + } + + if (ksurf->is_shown && kcrtc->crtc) { + err = drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, + ksurf->back_fb.buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, + kcrtc->connectors, kcrtc->num_connectors, &kcrtc->crtc->mode); + if (err) + return FALSE; + } + + /* swap the buffers */ + tmp_fb = ksurf->front_fb; + ksurf->front_fb = ksurf->back_fb; + ksurf->back_fb = tmp_fb; + + resource_surface_swap_buffers(ksurf->rsurf, + NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); + /* the front/back textures are swapped */ + ksurf->sequence_number++; + kdpy->event_handler->invalid_surface(&kdpy->base, + &ksurf->base, ksurf->sequence_number); + + return TRUE; +} + +static void +kms_surface_wait(struct native_surface *nsurf) +{ + /* no-op */ +} + +static void +kms_surface_destroy(struct native_surface *nsurf) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + + if (ksurf->current_crtc.crtc) + drmModeFreeCrtc(ksurf->current_crtc.crtc); + + if (ksurf->front_fb.buffer_id) + drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id); + pipe_resource_reference(&ksurf->front_fb.texture, NULL); + + if (ksurf->back_fb.buffer_id) + drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id); + pipe_resource_reference(&ksurf->back_fb.texture, NULL); + + resource_surface_destroy(ksurf->rsurf); + FREE(ksurf); +} + +static struct kms_surface * +kms_display_create_surface(struct native_display *ndpy, + const struct native_config *nconf, + uint width, uint height) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_config *kconf = kms_config(nconf); + struct kms_surface *ksurf; + + ksurf = CALLOC_STRUCT(kms_surface); + if (!ksurf) + return NULL; + + ksurf->kdpy = kdpy; + ksurf->color_format = kconf->base.color_format; + ksurf->width = width; + ksurf->height = height; + + ksurf->rsurf = resource_surface_create(kdpy->base.screen, + ksurf->color_format, + PIPE_BIND_RENDER_TARGET | + PIPE_BIND_SAMPLER_VIEW | + PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_SCANOUT); + if (!ksurf->rsurf) { + FREE(ksurf); + return NULL; + } + + resource_surface_set_size(ksurf->rsurf, ksurf->width, ksurf->height); + + ksurf->base.destroy = kms_surface_destroy; + ksurf->base.swap_buffers = kms_surface_swap_buffers; + ksurf->base.flush_frontbuffer = kms_surface_flush_frontbuffer; + ksurf->base.validate = kms_surface_validate; + ksurf->base.wait = kms_surface_wait; + + return ksurf; +} + +/** + * Choose a CRTC that supports all given connectors. + */ +static uint32_t +kms_display_choose_crtc(struct native_display *ndpy, + uint32_t *connectors, int num_connectors) +{ + struct kms_display *kdpy = kms_display(ndpy); + int idx; + + for (idx = 0; idx < kdpy->resources->count_crtcs; idx++) { + boolean found_crtc = TRUE; + int i, j; + + for (i = 0; i < num_connectors; i++) { + drmModeConnectorPtr connector; + int encoder_idx = -1; + + connector = drmModeGetConnector(kdpy->fd, connectors[i]); + if (!connector) { + found_crtc = FALSE; + break; + } + + /* find an encoder the CRTC supports */ + for (j = 0; j < connector->count_encoders; j++) { + drmModeEncoderPtr encoder = + drmModeGetEncoder(kdpy->fd, connector->encoders[j]); + if (encoder->possible_crtcs & (1 << idx)) { + encoder_idx = j; + break; + } + drmModeFreeEncoder(encoder); + } + + drmModeFreeConnector(connector); + if (encoder_idx < 0) { + found_crtc = FALSE; + break; + } + } + + if (found_crtc) + break; + } + + if (idx >= kdpy->resources->count_crtcs) { + _eglLog(_EGL_WARNING, + "failed to find a CRTC that supports the given %d connectors", + num_connectors); + return 0; + } + + return kdpy->resources->crtcs[idx]; +} + +/** + * Remember the original CRTC status and set the CRTC + */ +static boolean +kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, + uint32_t buffer_id, uint32_t x, uint32_t y, + uint32_t *connectors, int num_connectors, + drmModeModeInfoPtr mode) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_crtc *kcrtc = &kdpy->saved_crtcs[crtc_idx]; + uint32_t crtc_id; + int err; + + if (kcrtc->crtc) { + crtc_id = kcrtc->crtc->crtc_id; + } + else { + int count = 0, i; + + /* + * Choose the CRTC once. It could be more dynamic, but let's keep it + * simple for now. + */ + crtc_id = kms_display_choose_crtc(&kdpy->base, + connectors, num_connectors); + + /* save the original CRTC status */ + kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); + if (!kcrtc->crtc) + return FALSE; + + for (i = 0; i < kdpy->num_connectors; i++) { + struct kms_connector *kconn = &kdpy->connectors[i]; + drmModeConnectorPtr connector = kconn->connector; + drmModeEncoderPtr encoder; + + encoder = drmModeGetEncoder(kdpy->fd, connector->encoder_id); + if (encoder) { + if (encoder->crtc_id == crtc_id) { + kcrtc->connectors[count++] = connector->connector_id; + if (count >= Elements(kcrtc->connectors)) + break; + } + drmModeFreeEncoder(encoder); + } + } + + kcrtc->num_connectors = count; + } + + err = drmModeSetCrtc(kdpy->fd, crtc_id, buffer_id, x, y, + connectors, num_connectors, mode); + if (err) { + drmModeFreeCrtc(kcrtc->crtc); + kcrtc->crtc = NULL; + kcrtc->num_connectors = 0; + + return FALSE; + } + + return TRUE; +} + +static boolean +kms_display_program(struct native_display *ndpy, int crtc_idx, + struct native_surface *nsurf, uint x, uint y, + const struct native_connector **nconns, int num_nconns, + const struct native_mode *nmode) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_surface *ksurf = kms_surface(nsurf); + const struct kms_mode *kmode = kms_mode(nmode); + uint32_t connector_ids[32]; + uint32_t buffer_id; + drmModeModeInfo mode_tmp, *mode; + int i; + + if (num_nconns > Elements(connector_ids)) { + _eglLog(_EGL_WARNING, "too many connectors (%d)", num_nconns); + num_nconns = Elements(connector_ids); + } + + if (ksurf) { + if (!kms_surface_init_framebuffers(&ksurf->base, FALSE)) + return FALSE; + + buffer_id = ksurf->front_fb.buffer_id; + /* the mode argument of drmModeSetCrtc is not constified */ + mode_tmp = kmode->mode; + mode = &mode_tmp; + } + else { + /* disable the CRTC */ + buffer_id = 0; + mode = NULL; + num_nconns = 0; + } + + for (i = 0; i < num_nconns; i++) { + struct kms_connector *kconn = kms_connector(nconns[i]); + connector_ids[i] = kconn->connector->connector_id; + } + + if (!kms_display_set_crtc(&kdpy->base, crtc_idx, buffer_id, x, y, + connector_ids, num_nconns, mode)) { + _eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx); + + return FALSE; + } + + if (kdpy->shown_surfaces[crtc_idx]) + kdpy->shown_surfaces[crtc_idx]->is_shown = FALSE; + kdpy->shown_surfaces[crtc_idx] = ksurf; + + /* remember the settings for buffer swapping */ + if (ksurf) { + uint32_t crtc_id = kdpy->saved_crtcs[crtc_idx].crtc->crtc_id; + struct kms_crtc *kcrtc = &ksurf->current_crtc; + + if (kcrtc->crtc) + drmModeFreeCrtc(kcrtc->crtc); + kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); + + assert(num_nconns < Elements(kcrtc->connectors)); + memcpy(kcrtc->connectors, connector_ids, + sizeof(*connector_ids) * num_nconns); + kcrtc->num_connectors = num_nconns; + + ksurf->is_shown = TRUE; + } + + return TRUE; +} + +static const struct native_mode ** +kms_display_get_modes(struct native_display *ndpy, + const struct native_connector *nconn, + int *num_modes) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_connector *kconn = kms_connector(nconn); + const struct native_mode **nmodes_return; + int count, i; + + /* delete old data */ + if (kconn->connector) { + drmModeFreeConnector(kconn->connector); + FREE(kconn->kms_modes); + + kconn->connector = NULL; + kconn->kms_modes = NULL; + kconn->num_modes = 0; + } + + /* detect again */ + kconn->connector = drmModeGetConnector(kdpy->fd, kconn->connector_id); + if (!kconn->connector) + return NULL; + + count = kconn->connector->count_modes; + kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes)); + if (!kconn->kms_modes) { + drmModeFreeConnector(kconn->connector); + kconn->connector = NULL; + + return NULL; + } + + for (i = 0; i < count; i++) { + struct kms_mode *kmode = &kconn->kms_modes[i]; + drmModeModeInfoPtr mode = &kconn->connector->modes[i]; + + kmode->mode = *mode; + + kmode->base.desc = kmode->mode.name; + kmode->base.width = kmode->mode.hdisplay; + kmode->base.height = kmode->mode.vdisplay; + kmode->base.refresh_rate = kmode->mode.vrefresh; + /* not all kernels have vrefresh = refresh_rate * 1000 */ + if (kmode->base.refresh_rate > 1000) + kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000; + } + + nmodes_return = MALLOC(count * sizeof(*nmodes_return)); + if (nmodes_return) { + for (i = 0; i < count; i++) + nmodes_return[i] = &kconn->kms_modes[i].base; + if (num_modes) + *num_modes = count; + } + + return nmodes_return; +} + +static const struct native_connector ** +kms_display_get_connectors(struct native_display *ndpy, int *num_connectors, + int *num_crtc) +{ + struct kms_display *kdpy = kms_display(ndpy); + const struct native_connector **connectors; + int i; + + if (!kdpy->connectors) { + kdpy->connectors = + CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors)); + if (!kdpy->connectors) + return NULL; + + for (i = 0; i < kdpy->resources->count_connectors; i++) { + struct kms_connector *kconn = &kdpy->connectors[i]; + + kconn->connector_id = kdpy->resources->connectors[i]; + /* kconn->connector is allocated when the modes are asked */ + } + + kdpy->num_connectors = kdpy->resources->count_connectors; + } + + connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors)); + if (connectors) { + for (i = 0; i < kdpy->num_connectors; i++) + connectors[i] = &kdpy->connectors[i].base; + if (num_connectors) + *num_connectors = kdpy->num_connectors; + } + + if (num_crtc) + *num_crtc = kdpy->resources->count_crtcs; + + return connectors; +} + +static struct native_surface * +kms_display_create_scanout_surface(struct native_display *ndpy, + const struct native_config *nconf, + uint width, uint height) +{ + struct kms_surface *ksurf; + + ksurf = kms_display_create_surface(ndpy, nconf, width, height); + return &ksurf->base; +} + +static struct native_display_modeset kms_display_modeset = { + .get_connectors = kms_display_get_connectors, + .get_modes = kms_display_get_modes, + .create_scanout_surface = kms_display_create_scanout_surface, + .program = kms_display_program +}; + +void +kms_display_fini_modeset(struct native_display *ndpy) +{ + struct kms_display *kdpy = kms_display(ndpy); + int i; + + if (kdpy->connectors) { + for (i = 0; i < kdpy->num_connectors; i++) { + struct kms_connector *kconn = &kdpy->connectors[i]; + if (kconn->connector) { + drmModeFreeConnector(kconn->connector); + FREE(kconn->kms_modes); + } + } + FREE(kdpy->connectors); + } + + if (kdpy->shown_surfaces) { + FREE(kdpy->shown_surfaces); + kdpy->shown_surfaces = NULL; + } + + if (kdpy->saved_crtcs) { + for (i = 0; i < kdpy->resources->count_crtcs; i++) { + struct kms_crtc *kcrtc = &kdpy->saved_crtcs[i]; + + if (kcrtc->crtc) { + /* restore crtc */ + drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, + kcrtc->crtc->buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, + kcrtc->connectors, kcrtc->num_connectors, + &kcrtc->crtc->mode); + + drmModeFreeCrtc(kcrtc->crtc); + } + } + FREE(kdpy->saved_crtcs); + } + + if (kdpy->resources) { + drmModeFreeResources(kdpy->resources); + kdpy->resources = NULL; + } + + kdpy->base.modeset = NULL; +} + +boolean +kms_display_init_modeset(struct native_display *ndpy) +{ + struct kms_display *kdpy = kms_display(ndpy); + + /* resources are fixed, unlike crtc, connector, or encoder */ + kdpy->resources = drmModeGetResources(kdpy->fd); + if (!kdpy->resources) { + _eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset."); + return FALSE; + } + + kdpy->saved_crtcs = + CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); + if (!kdpy->saved_crtcs) { + kms_display_fini_modeset(&kdpy->base); + return FALSE; + } + + kdpy->shown_surfaces = + CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); + if (!kdpy->shown_surfaces) { + kms_display_fini_modeset(&kdpy->base); + return FALSE; + } + + kdpy->base.modeset = &kms_display_modeset; + + return TRUE; +} diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index 208f73306cb..94880c36965 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -27,13 +27,7 @@ #include #include -#include "pipe/p_screen.h" -#include "pipe/p_context.h" -#include "util/u_debug.h" #include "util/u_memory.h" -#include "util/u_inlines.h" -#include "util/u_pointer.h" -#include "util/u_string.h" #include "egllog.h" #include "native_kms.h" @@ -42,507 +36,6 @@ #include #include "radeon/drm/radeon_drm.h" -static boolean -kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, - unsigned int *seq_num, struct pipe_resource **textures, - int *width, int *height) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - - if (!resource_surface_add_resources(ksurf->rsurf, attachment_mask)) - return FALSE; - if (textures) - resource_surface_get_resources(ksurf->rsurf, textures, attachment_mask); - - if (seq_num) - *seq_num = ksurf->sequence_number; - if (width) - *width = ksurf->width; - if (height) - *height = ksurf->height; - - return TRUE; -} - -/** - * Add textures as DRM framebuffers. - */ -static boolean -kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_display *kdpy = ksurf->kdpy; - int num_framebuffers = (need_back) ? 2 : 1; - int i, err; - - for (i = 0; i < num_framebuffers; i++) { - struct kms_framebuffer *fb; - enum native_attachment natt; - struct winsys_handle whandle; - uint block_bits; - - if (i == 0) { - fb = &ksurf->front_fb; - natt = NATIVE_ATTACHMENT_FRONT_LEFT; - } - else { - fb = &ksurf->back_fb; - natt = NATIVE_ATTACHMENT_BACK_LEFT; - } - - if (!fb->texture) { - /* make sure the texture has been allocated */ - resource_surface_add_resources(ksurf->rsurf, 1 << natt); - fb->texture = - resource_surface_get_single_resource(ksurf->rsurf, natt); - if (!fb->texture) - return FALSE; - } - - /* already initialized */ - if (fb->buffer_id) - continue; - - /* TODO detect the real value */ - fb->is_passive = TRUE; - - memset(&whandle, 0, sizeof(whandle)); - whandle.type = DRM_API_HANDLE_TYPE_KMS; - - if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen, - fb->texture, &whandle)) - return FALSE; - - block_bits = util_format_get_blocksizebits(ksurf->color_format); - err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height, - block_bits, block_bits, whandle.stride, whandle.handle, - &fb->buffer_id); - if (err) { - fb->buffer_id = 0; - return FALSE; - } - } - - return TRUE; -} - -static boolean -kms_surface_flush_frontbuffer(struct native_surface *nsurf) -{ -#ifdef DRM_MODE_FEATURE_DIRTYFB - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_display *kdpy = ksurf->kdpy; - - if (ksurf->front_fb.is_passive) - drmModeDirtyFB(kdpy->fd, ksurf->front_fb.buffer_id, NULL, 0); -#endif - - return TRUE; -} - -static boolean -kms_surface_swap_buffers(struct native_surface *nsurf) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_crtc *kcrtc = &ksurf->current_crtc; - struct kms_display *kdpy = ksurf->kdpy; - struct kms_framebuffer tmp_fb; - int err; - - if (!ksurf->back_fb.buffer_id) { - if (!kms_surface_init_framebuffers(&ksurf->base, TRUE)) - return FALSE; - } - - if (ksurf->is_shown && kcrtc->crtc) { - err = drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, - ksurf->back_fb.buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, - kcrtc->connectors, kcrtc->num_connectors, &kcrtc->crtc->mode); - if (err) - return FALSE; - } - - /* swap the buffers */ - tmp_fb = ksurf->front_fb; - ksurf->front_fb = ksurf->back_fb; - ksurf->back_fb = tmp_fb; - - resource_surface_swap_buffers(ksurf->rsurf, - NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); - /* the front/back textures are swapped */ - ksurf->sequence_number++; - kdpy->event_handler->invalid_surface(&kdpy->base, - &ksurf->base, ksurf->sequence_number); - - return TRUE; -} - -static void -kms_surface_wait(struct native_surface *nsurf) -{ - /* no-op */ -} - -static void -kms_surface_destroy(struct native_surface *nsurf) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - - if (ksurf->current_crtc.crtc) - drmModeFreeCrtc(ksurf->current_crtc.crtc); - - if (ksurf->front_fb.buffer_id) - drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id); - pipe_resource_reference(&ksurf->front_fb.texture, NULL); - - if (ksurf->back_fb.buffer_id) - drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id); - pipe_resource_reference(&ksurf->back_fb.texture, NULL); - - resource_surface_destroy(ksurf->rsurf); - FREE(ksurf); -} - -static struct kms_surface * -kms_display_create_surface(struct native_display *ndpy, - const struct native_config *nconf, - uint width, uint height) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_config *kconf = kms_config(nconf); - struct kms_surface *ksurf; - - ksurf = CALLOC_STRUCT(kms_surface); - if (!ksurf) - return NULL; - - ksurf->kdpy = kdpy; - ksurf->color_format = kconf->base.color_format; - ksurf->width = width; - ksurf->height = height; - - ksurf->rsurf = resource_surface_create(kdpy->base.screen, - ksurf->color_format, - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_SAMPLER_VIEW | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT); - if (!ksurf->rsurf) { - FREE(ksurf); - return NULL; - } - - resource_surface_set_size(ksurf->rsurf, ksurf->width, ksurf->height); - - ksurf->base.destroy = kms_surface_destroy; - ksurf->base.swap_buffers = kms_surface_swap_buffers; - ksurf->base.flush_frontbuffer = kms_surface_flush_frontbuffer; - ksurf->base.validate = kms_surface_validate; - ksurf->base.wait = kms_surface_wait; - - return ksurf; -} - -/** - * Choose a CRTC that supports all given connectors. - */ -static uint32_t -kms_display_choose_crtc(struct native_display *ndpy, - uint32_t *connectors, int num_connectors) -{ - struct kms_display *kdpy = kms_display(ndpy); - int idx; - - for (idx = 0; idx < kdpy->resources->count_crtcs; idx++) { - boolean found_crtc = TRUE; - int i, j; - - for (i = 0; i < num_connectors; i++) { - drmModeConnectorPtr connector; - int encoder_idx = -1; - - connector = drmModeGetConnector(kdpy->fd, connectors[i]); - if (!connector) { - found_crtc = FALSE; - break; - } - - /* find an encoder the CRTC supports */ - for (j = 0; j < connector->count_encoders; j++) { - drmModeEncoderPtr encoder = - drmModeGetEncoder(kdpy->fd, connector->encoders[j]); - if (encoder->possible_crtcs & (1 << idx)) { - encoder_idx = j; - break; - } - drmModeFreeEncoder(encoder); - } - - drmModeFreeConnector(connector); - if (encoder_idx < 0) { - found_crtc = FALSE; - break; - } - } - - if (found_crtc) - break; - } - - if (idx >= kdpy->resources->count_crtcs) { - _eglLog(_EGL_WARNING, - "failed to find a CRTC that supports the given %d connectors", - num_connectors); - return 0; - } - - return kdpy->resources->crtcs[idx]; -} - -/** - * Remember the original CRTC status and set the CRTC - */ -static boolean -kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, - uint32_t buffer_id, uint32_t x, uint32_t y, - uint32_t *connectors, int num_connectors, - drmModeModeInfoPtr mode) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_crtc *kcrtc = &kdpy->saved_crtcs[crtc_idx]; - uint32_t crtc_id; - int err; - - if (kcrtc->crtc) { - crtc_id = kcrtc->crtc->crtc_id; - } - else { - int count = 0, i; - - /* - * Choose the CRTC once. It could be more dynamic, but let's keep it - * simple for now. - */ - crtc_id = kms_display_choose_crtc(&kdpy->base, - connectors, num_connectors); - - /* save the original CRTC status */ - kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); - if (!kcrtc->crtc) - return FALSE; - - for (i = 0; i < kdpy->num_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - drmModeConnectorPtr connector = kconn->connector; - drmModeEncoderPtr encoder; - - encoder = drmModeGetEncoder(kdpy->fd, connector->encoder_id); - if (encoder) { - if (encoder->crtc_id == crtc_id) { - kcrtc->connectors[count++] = connector->connector_id; - if (count >= Elements(kcrtc->connectors)) - break; - } - drmModeFreeEncoder(encoder); - } - } - - kcrtc->num_connectors = count; - } - - err = drmModeSetCrtc(kdpy->fd, crtc_id, buffer_id, x, y, - connectors, num_connectors, mode); - if (err) { - drmModeFreeCrtc(kcrtc->crtc); - kcrtc->crtc = NULL; - kcrtc->num_connectors = 0; - - return FALSE; - } - - return TRUE; -} - -static boolean -kms_display_program(struct native_display *ndpy, int crtc_idx, - struct native_surface *nsurf, uint x, uint y, - const struct native_connector **nconns, int num_nconns, - const struct native_mode *nmode) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_surface *ksurf = kms_surface(nsurf); - const struct kms_mode *kmode = kms_mode(nmode); - uint32_t connector_ids[32]; - uint32_t buffer_id; - drmModeModeInfo mode_tmp, *mode; - int i; - - if (num_nconns > Elements(connector_ids)) { - _eglLog(_EGL_WARNING, "too many connectors (%d)", num_nconns); - num_nconns = Elements(connector_ids); - } - - if (ksurf) { - if (!kms_surface_init_framebuffers(&ksurf->base, FALSE)) - return FALSE; - - buffer_id = ksurf->front_fb.buffer_id; - /* the mode argument of drmModeSetCrtc is not constified */ - mode_tmp = kmode->mode; - mode = &mode_tmp; - } - else { - /* disable the CRTC */ - buffer_id = 0; - mode = NULL; - num_nconns = 0; - } - - for (i = 0; i < num_nconns; i++) { - struct kms_connector *kconn = kms_connector(nconns[i]); - connector_ids[i] = kconn->connector->connector_id; - } - - if (!kms_display_set_crtc(&kdpy->base, crtc_idx, buffer_id, x, y, - connector_ids, num_nconns, mode)) { - _eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx); - - return FALSE; - } - - if (kdpy->shown_surfaces[crtc_idx]) - kdpy->shown_surfaces[crtc_idx]->is_shown = FALSE; - kdpy->shown_surfaces[crtc_idx] = ksurf; - - /* remember the settings for buffer swapping */ - if (ksurf) { - uint32_t crtc_id = kdpy->saved_crtcs[crtc_idx].crtc->crtc_id; - struct kms_crtc *kcrtc = &ksurf->current_crtc; - - if (kcrtc->crtc) - drmModeFreeCrtc(kcrtc->crtc); - kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); - - assert(num_nconns < Elements(kcrtc->connectors)); - memcpy(kcrtc->connectors, connector_ids, - sizeof(*connector_ids) * num_nconns); - kcrtc->num_connectors = num_nconns; - - ksurf->is_shown = TRUE; - } - - return TRUE; -} - -static const struct native_mode ** -kms_display_get_modes(struct native_display *ndpy, - const struct native_connector *nconn, - int *num_modes) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_connector *kconn = kms_connector(nconn); - const struct native_mode **nmodes_return; - int count, i; - - /* delete old data */ - if (kconn->connector) { - drmModeFreeConnector(kconn->connector); - FREE(kconn->kms_modes); - - kconn->connector = NULL; - kconn->kms_modes = NULL; - kconn->num_modes = 0; - } - - /* detect again */ - kconn->connector = drmModeGetConnector(kdpy->fd, kconn->connector_id); - if (!kconn->connector) - return NULL; - - count = kconn->connector->count_modes; - kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes)); - if (!kconn->kms_modes) { - drmModeFreeConnector(kconn->connector); - kconn->connector = NULL; - - return NULL; - } - - for (i = 0; i < count; i++) { - struct kms_mode *kmode = &kconn->kms_modes[i]; - drmModeModeInfoPtr mode = &kconn->connector->modes[i]; - - kmode->mode = *mode; - - kmode->base.desc = kmode->mode.name; - kmode->base.width = kmode->mode.hdisplay; - kmode->base.height = kmode->mode.vdisplay; - kmode->base.refresh_rate = kmode->mode.vrefresh; - /* not all kernels have vrefresh = refresh_rate * 1000 */ - if (kmode->base.refresh_rate > 1000) - kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000; - } - - nmodes_return = MALLOC(count * sizeof(*nmodes_return)); - if (nmodes_return) { - for (i = 0; i < count; i++) - nmodes_return[i] = &kconn->kms_modes[i].base; - if (num_modes) - *num_modes = count; - } - - return nmodes_return; -} - -static const struct native_connector ** -kms_display_get_connectors(struct native_display *ndpy, int *num_connectors, - int *num_crtc) -{ - struct kms_display *kdpy = kms_display(ndpy); - const struct native_connector **connectors; - int i; - - if (!kdpy->connectors) { - kdpy->connectors = - CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors)); - if (!kdpy->connectors) - return NULL; - - for (i = 0; i < kdpy->resources->count_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - - kconn->connector_id = kdpy->resources->connectors[i]; - /* kconn->connector is allocated when the modes are asked */ - } - - kdpy->num_connectors = kdpy->resources->count_connectors; - } - - connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors)); - if (connectors) { - for (i = 0; i < kdpy->num_connectors; i++) - connectors[i] = &kdpy->connectors[i].base; - if (num_connectors) - *num_connectors = kdpy->num_connectors; - } - - if (num_crtc) - *num_crtc = kdpy->resources->count_crtcs; - - return connectors; -} - -static struct native_surface * -kms_display_create_scanout_surface(struct native_display *ndpy, - const struct native_config *nconf, - uint width, uint height) -{ - struct kms_surface *ksurf; - - ksurf = kms_display_create_surface(ndpy, nconf, width, height); - return &ksurf->base; -} - static boolean kms_display_is_format_supported(struct native_display *ndpy, enum pipe_format fmt, boolean is_color) @@ -622,44 +115,11 @@ static void kms_display_destroy(struct native_display *ndpy) { struct kms_display *kdpy = kms_display(ndpy); - int i; if (kdpy->config) FREE(kdpy->config); - if (kdpy->connectors) { - for (i = 0; i < kdpy->num_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - if (kconn->connector) { - drmModeFreeConnector(kconn->connector); - FREE(kconn->kms_modes); - } - } - FREE(kdpy->connectors); - } - - if (kdpy->shown_surfaces) - FREE(kdpy->shown_surfaces); - - if (kdpy->saved_crtcs) { - for (i = 0; i < kdpy->resources->count_crtcs; i++) { - struct kms_crtc *kcrtc = &kdpy->saved_crtcs[i]; - - if (kcrtc->crtc) { - /* restore crtc */ - drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, - kcrtc->crtc->buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, - kcrtc->connectors, kcrtc->num_connectors, - &kcrtc->crtc->mode); - - drmModeFreeCrtc(kcrtc->crtc); - } - } - FREE(kdpy->saved_crtcs); - } - - if (kdpy->resources) - drmModeFreeResources(kdpy->resources); + kms_display_fini_modeset(&kdpy->base); if (kdpy->base.screen) kdpy->base.screen->destroy(kdpy->base.screen); @@ -722,13 +182,6 @@ kms_display_init_screen(struct native_display *ndpy) return TRUE; } -static struct native_display_modeset kms_display_modeset = { - .get_connectors = kms_display_get_connectors, - .get_modes = kms_display_get_modes, - .create_scanout_surface = kms_display_create_scanout_surface, - .program = kms_display_program -}; - static struct native_display * kms_create_display(int fd, struct native_event_handler *event_handler, void *user_data) @@ -752,28 +205,7 @@ kms_create_display(int fd, struct native_event_handler *event_handler, kdpy->base.get_param = kms_display_get_param; kdpy->base.get_configs = kms_display_get_configs; - /* resources are fixed, unlike crtc, connector, or encoder */ - kdpy->resources = drmModeGetResources(kdpy->fd); - if (kdpy->resources) { - kdpy->saved_crtcs = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); - if (!kdpy->saved_crtcs) { - kms_display_destroy(&kdpy->base); - return NULL; - } - - kdpy->shown_surfaces = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); - if (!kdpy->shown_surfaces) { - kms_display_destroy(&kdpy->base); - return NULL; - } - - kdpy->base.modeset = &kms_display_modeset; - } - else { - _eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset."); - } + kms_display_init_modeset(&kdpy->base); return &kdpy->base; } diff --git a/src/gallium/state_trackers/egl/kms/native_kms.h b/src/gallium/state_trackers/egl/kms/native_kms.h index cd8e4ff0b2d..3a9b1a67887 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.h +++ b/src/gallium/state_trackers/egl/kms/native_kms.h @@ -38,14 +38,10 @@ #include "common/native_helper.h" struct kms_config; +struct kms_crtc; struct kms_connector; struct kms_mode; - -struct kms_crtc { - drmModeCrtcPtr crtc; - uint32_t connectors[32]; - int num_connectors; -}; +struct kms_surface; struct kms_display { struct native_display base; @@ -53,9 +49,10 @@ struct kms_display { struct native_event_handler *event_handler; int fd; - drmModeResPtr resources; struct kms_config *config; + /* for modesetting */ + drmModeResPtr resources; struct kms_connector *connectors; int num_connectors; @@ -64,6 +61,16 @@ struct kms_display { struct kms_crtc *saved_crtcs; }; +struct kms_config { + struct native_config base; +}; + +struct kms_crtc { + drmModeCrtcPtr crtc; + uint32_t connectors[32]; + int num_connectors; +}; + struct kms_framebuffer { struct pipe_resource *texture; boolean is_passive; @@ -86,10 +93,6 @@ struct kms_surface { struct kms_crtc current_crtc; }; -struct kms_config { - struct native_config base; -}; - struct kms_connector { struct native_connector base; @@ -110,18 +113,18 @@ kms_display(const struct native_display *ndpy) return (struct kms_display *) ndpy; } -static INLINE struct kms_surface * -kms_surface(const struct native_surface *nsurf) -{ - return (struct kms_surface *) nsurf; -} - static INLINE struct kms_config * kms_config(const struct native_config *nconf) { return (struct kms_config *) nconf; } +static INLINE struct kms_surface * +kms_surface(const struct native_surface *nsurf) +{ + return (struct kms_surface *) nsurf; +} + static INLINE struct kms_connector * kms_connector(const struct native_connector *nconn) { @@ -134,4 +137,10 @@ kms_mode(const struct native_mode *nmode) return (struct kms_mode *) nmode; } +boolean +kms_display_init_modeset(struct native_display *ndpy); + +void +kms_display_fini_modeset(struct native_display *ndpy); + #endif /* _NATIVE_KMS_H_ */ -- cgit v1.2.3 From e7424d72405a1cb1fb5ac625b340043aaa9f88be Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 19 Sep 2010 16:54:39 +0800 Subject: st/egl: Rename kms backend to drm. The main use of the backend is to support EGL_MESA_drm_display. drm should be a better name. --- configure.ac | 2 +- docs/egl.html | 4 +- src/egl/main/Makefile | 2 +- src/egl/main/egldisplay.c | 2 +- src/gallium/state_trackers/egl/Makefile | 20 +- src/gallium/state_trackers/egl/common/egl_g3d.c | 4 +- src/gallium/state_trackers/egl/common/native.h | 2 +- src/gallium/state_trackers/egl/drm/modeset.c | 619 ++++++++++++++++++++++++ src/gallium/state_trackers/egl/drm/native_drm.c | 240 +++++++++ src/gallium/state_trackers/egl/drm/native_drm.h | 146 ++++++ src/gallium/state_trackers/egl/kms/modeset.c | 619 ------------------------ src/gallium/state_trackers/egl/kms/native_kms.c | 240 --------- src/gallium/state_trackers/egl/kms/native_kms.h | 146 ------ 13 files changed, 1023 insertions(+), 1023 deletions(-) create mode 100644 src/gallium/state_trackers/egl/drm/modeset.c create mode 100644 src/gallium/state_trackers/egl/drm/native_drm.c create mode 100644 src/gallium/state_trackers/egl/drm/native_drm.h delete mode 100644 src/gallium/state_trackers/egl/kms/modeset.c delete mode 100644 src/gallium/state_trackers/egl/kms/native_kms.c delete mode 100644 src/gallium/state_trackers/egl/kms/native_kms.h (limited to 'src') diff --git a/configure.ac b/configure.ac index bf8feb63528..b19bf8fdf20 100644 --- a/configure.ac +++ b/configure.ac @@ -1363,7 +1363,7 @@ fi AC_ARG_WITH([egl-platforms], [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@], [comma delimited native platforms libEGL supports, e.g. - "x11,kms" @<:@default=auto@:>@])], + "x11,drm" @<:@default=auto@:>@])], [with_egl_platforms="$withval"], [with_egl_platforms=yes]) AC_ARG_WITH([egl-displays], diff --git a/docs/egl.html b/docs/egl.html index 47582672944..d38f2dd7b7d 100644 --- a/docs/egl.html +++ b/docs/egl.html @@ -72,13 +72,13 @@ drivers will be installed to ${libdir}/egl.

  • --with-egl-platforms

    List the platforms (window systems) to support. Its argument is a comma -seprated string such as --with-egl-platforms=x11,kms. It decides +seprated string such as --with-egl-platforms=x11,drm. It decides the platforms a driver may support. The first listed platform is also used by the main library to decide the native platform: the platform the EGL native types such as EGLNativeDisplayType or EGLNativeWindowType defined for.

    -

    The available platforms are x11, kms, +

    The available platforms are x11, drm, fbdev, and gdi. The gdi platform can only be built with SCons.

    diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index baee1a2f9dd..19085a31f18 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -57,7 +57,7 @@ EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM ifeq ($(firstword $(EGL_PLATFORMS)),x11) EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11 endif -ifeq ($(firstword $(EGL_PLATFORMS)),kms) +ifeq ($(firstword $(EGL_PLATFORMS)),drm) EGL_NATIVE_PLATFORM=_EGL_PLATFORM_DRM endif ifeq ($(firstword $(EGL_PLATFORMS)),fbdev) diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 31ff090484c..cc0f03e01ba 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -27,7 +27,7 @@ _eglGetNativePlatformFromEnv(void) } egl_platforms[_EGL_NUM_PLATFORMS] = { { _EGL_PLATFORM_WINDOWS, "gdi" }, { _EGL_PLATFORM_X11, "x11" }, - { _EGL_PLATFORM_DRM, "kms" }, + { _EGL_PLATFORM_DRM, "drm" }, { _EGL_PLATFORM_FBDEV, "fbdev" } }; _EGLPlatformType plat = _EGL_INVALID_PLATFORM; diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile index 4199d7c6baa..8dbfc5b8e56 100644 --- a/src/gallium/state_trackers/egl/Makefile +++ b/src/gallium/state_trackers/egl/Makefile @@ -24,9 +24,9 @@ x11_SOURCES = $(wildcard x11/*.c) \ x11_OBJECTS = $(x11_SOURCES:.c=.o) -kms_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I libdrm) -kms_SOURCES = $(wildcard kms/*.c) -kms_OBJECTS = $(kms_SOURCES:.c=.o) +drm_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I libdrm) +drm_SOURCES = $(wildcard drm/*.c) +drm_OBJECTS = $(drm_SOURCES:.c=.o) fbdev_INCLUDES = -I$(TOP)/src/gallium/winsys/sw @@ -34,8 +34,8 @@ fbdev_SOURCES = $(wildcard fbdev/*.c) fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o) -ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES) $(fbdev_INCLUDES) -ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES) $(fbdev_SOURCES) +ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(drm_INCLUDES) $(fbdev_INCLUDES) +ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(drm_SOURCES) $(fbdev_SOURCES) EGL_OBJECTS = $(common_OBJECTS) EGL_CPPFLAGS = $(common_INCLUDES) @@ -45,9 +45,9 @@ ifneq ($(findstring x11, $(EGL_PLATFORMS)),) EGL_OBJECTS += $(x11_OBJECTS) EGL_CPPFLAGS += -DHAVE_X11_BACKEND endif -ifneq ($(findstring kms, $(EGL_PLATFORMS)),) -EGL_OBJECTS += $(kms_OBJECTS) -EGL_CPPFLAGS += -DHAVE_KMS_BACKEND +ifneq ($(findstring drm, $(EGL_PLATFORMS)),) +EGL_OBJECTS += $(drm_OBJECTS) +EGL_CPPFLAGS += -DHAVE_DRM_BACKEND endif ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) EGL_OBJECTS += $(fbdev_OBJECTS) @@ -87,8 +87,8 @@ $(common_OBJECTS): %.o: %.c $(x11_OBJECTS): %.o: %.c $(call egl-cc,x11) -$(kms_OBJECTS): %.o: %.c - $(call egl-cc,kms) +$(drm_OBJECTS): %.o: %.c + $(call egl-cc,drm) $(fbdev_OBJECTS): %.o: %.c $(call egl-cc,fbdev) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 33a838fb798..ce2b1f7bb94 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -65,8 +65,8 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat) break; case _EGL_PLATFORM_DRM: plat_name = "DRM"; -#ifdef HAVE_KMS_BACKEND - nplat = native_get_kms_platform(); +#ifdef HAVE_DRM_BACKEND + nplat = native_get_drm_platform(); #endif break; case _EGL_PLATFORM_FBDEV: diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 9f34c517ef8..3c3f57e2670 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -227,7 +227,7 @@ const struct native_platform * native_get_x11_platform(void); const struct native_platform * -native_get_kms_platform(void); +native_get_drm_platform(void); const struct native_platform * native_get_fbdev_platform(void); diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c new file mode 100644 index 00000000000..5d6a07e2fdd --- /dev/null +++ b/src/gallium/state_trackers/egl/drm/modeset.c @@ -0,0 +1,619 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + * Chia-I Wu + */ + +#include "util/u_memory.h" +#include "util/u_inlines.h" +#include "egllog.h" + +#include "native_drm.h" + +static boolean +kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, + unsigned int *seq_num, struct pipe_resource **textures, + int *width, int *height) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + + if (!resource_surface_add_resources(ksurf->rsurf, attachment_mask)) + return FALSE; + if (textures) + resource_surface_get_resources(ksurf->rsurf, textures, attachment_mask); + + if (seq_num) + *seq_num = ksurf->sequence_number; + if (width) + *width = ksurf->width; + if (height) + *height = ksurf->height; + + return TRUE; +} + +/** + * Add textures as DRM framebuffers. + */ +static boolean +kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + struct kms_display *kdpy = ksurf->kdpy; + int num_framebuffers = (need_back) ? 2 : 1; + int i, err; + + for (i = 0; i < num_framebuffers; i++) { + struct kms_framebuffer *fb; + enum native_attachment natt; + struct winsys_handle whandle; + uint block_bits; + + if (i == 0) { + fb = &ksurf->front_fb; + natt = NATIVE_ATTACHMENT_FRONT_LEFT; + } + else { + fb = &ksurf->back_fb; + natt = NATIVE_ATTACHMENT_BACK_LEFT; + } + + if (!fb->texture) { + /* make sure the texture has been allocated */ + resource_surface_add_resources(ksurf->rsurf, 1 << natt); + fb->texture = + resource_surface_get_single_resource(ksurf->rsurf, natt); + if (!fb->texture) + return FALSE; + } + + /* already initialized */ + if (fb->buffer_id) + continue; + + /* TODO detect the real value */ + fb->is_passive = TRUE; + + memset(&whandle, 0, sizeof(whandle)); + whandle.type = DRM_API_HANDLE_TYPE_KMS; + + if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen, + fb->texture, &whandle)) + return FALSE; + + block_bits = util_format_get_blocksizebits(ksurf->color_format); + err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height, + block_bits, block_bits, whandle.stride, whandle.handle, + &fb->buffer_id); + if (err) { + fb->buffer_id = 0; + return FALSE; + } + } + + return TRUE; +} + +static boolean +kms_surface_flush_frontbuffer(struct native_surface *nsurf) +{ +#ifdef DRM_MODE_FEATURE_DIRTYFB + struct kms_surface *ksurf = kms_surface(nsurf); + struct kms_display *kdpy = ksurf->kdpy; + + if (ksurf->front_fb.is_passive) + drmModeDirtyFB(kdpy->fd, ksurf->front_fb.buffer_id, NULL, 0); +#endif + + return TRUE; +} + +static boolean +kms_surface_swap_buffers(struct native_surface *nsurf) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + struct kms_crtc *kcrtc = &ksurf->current_crtc; + struct kms_display *kdpy = ksurf->kdpy; + struct kms_framebuffer tmp_fb; + int err; + + if (!ksurf->back_fb.buffer_id) { + if (!kms_surface_init_framebuffers(&ksurf->base, TRUE)) + return FALSE; + } + + if (ksurf->is_shown && kcrtc->crtc) { + err = drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, + ksurf->back_fb.buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, + kcrtc->connectors, kcrtc->num_connectors, &kcrtc->crtc->mode); + if (err) + return FALSE; + } + + /* swap the buffers */ + tmp_fb = ksurf->front_fb; + ksurf->front_fb = ksurf->back_fb; + ksurf->back_fb = tmp_fb; + + resource_surface_swap_buffers(ksurf->rsurf, + NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); + /* the front/back textures are swapped */ + ksurf->sequence_number++; + kdpy->event_handler->invalid_surface(&kdpy->base, + &ksurf->base, ksurf->sequence_number); + + return TRUE; +} + +static void +kms_surface_wait(struct native_surface *nsurf) +{ + /* no-op */ +} + +static void +kms_surface_destroy(struct native_surface *nsurf) +{ + struct kms_surface *ksurf = kms_surface(nsurf); + + if (ksurf->current_crtc.crtc) + drmModeFreeCrtc(ksurf->current_crtc.crtc); + + if (ksurf->front_fb.buffer_id) + drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id); + pipe_resource_reference(&ksurf->front_fb.texture, NULL); + + if (ksurf->back_fb.buffer_id) + drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id); + pipe_resource_reference(&ksurf->back_fb.texture, NULL); + + resource_surface_destroy(ksurf->rsurf); + FREE(ksurf); +} + +static struct kms_surface * +kms_display_create_surface(struct native_display *ndpy, + const struct native_config *nconf, + uint width, uint height) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_config *kconf = kms_config(nconf); + struct kms_surface *ksurf; + + ksurf = CALLOC_STRUCT(kms_surface); + if (!ksurf) + return NULL; + + ksurf->kdpy = kdpy; + ksurf->color_format = kconf->base.color_format; + ksurf->width = width; + ksurf->height = height; + + ksurf->rsurf = resource_surface_create(kdpy->base.screen, + ksurf->color_format, + PIPE_BIND_RENDER_TARGET | + PIPE_BIND_SAMPLER_VIEW | + PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_SCANOUT); + if (!ksurf->rsurf) { + FREE(ksurf); + return NULL; + } + + resource_surface_set_size(ksurf->rsurf, ksurf->width, ksurf->height); + + ksurf->base.destroy = kms_surface_destroy; + ksurf->base.swap_buffers = kms_surface_swap_buffers; + ksurf->base.flush_frontbuffer = kms_surface_flush_frontbuffer; + ksurf->base.validate = kms_surface_validate; + ksurf->base.wait = kms_surface_wait; + + return ksurf; +} + +/** + * Choose a CRTC that supports all given connectors. + */ +static uint32_t +kms_display_choose_crtc(struct native_display *ndpy, + uint32_t *connectors, int num_connectors) +{ + struct kms_display *kdpy = kms_display(ndpy); + int idx; + + for (idx = 0; idx < kdpy->resources->count_crtcs; idx++) { + boolean found_crtc = TRUE; + int i, j; + + for (i = 0; i < num_connectors; i++) { + drmModeConnectorPtr connector; + int encoder_idx = -1; + + connector = drmModeGetConnector(kdpy->fd, connectors[i]); + if (!connector) { + found_crtc = FALSE; + break; + } + + /* find an encoder the CRTC supports */ + for (j = 0; j < connector->count_encoders; j++) { + drmModeEncoderPtr encoder = + drmModeGetEncoder(kdpy->fd, connector->encoders[j]); + if (encoder->possible_crtcs & (1 << idx)) { + encoder_idx = j; + break; + } + drmModeFreeEncoder(encoder); + } + + drmModeFreeConnector(connector); + if (encoder_idx < 0) { + found_crtc = FALSE; + break; + } + } + + if (found_crtc) + break; + } + + if (idx >= kdpy->resources->count_crtcs) { + _eglLog(_EGL_WARNING, + "failed to find a CRTC that supports the given %d connectors", + num_connectors); + return 0; + } + + return kdpy->resources->crtcs[idx]; +} + +/** + * Remember the original CRTC status and set the CRTC + */ +static boolean +kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, + uint32_t buffer_id, uint32_t x, uint32_t y, + uint32_t *connectors, int num_connectors, + drmModeModeInfoPtr mode) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_crtc *kcrtc = &kdpy->saved_crtcs[crtc_idx]; + uint32_t crtc_id; + int err; + + if (kcrtc->crtc) { + crtc_id = kcrtc->crtc->crtc_id; + } + else { + int count = 0, i; + + /* + * Choose the CRTC once. It could be more dynamic, but let's keep it + * simple for now. + */ + crtc_id = kms_display_choose_crtc(&kdpy->base, + connectors, num_connectors); + + /* save the original CRTC status */ + kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); + if (!kcrtc->crtc) + return FALSE; + + for (i = 0; i < kdpy->num_connectors; i++) { + struct kms_connector *kconn = &kdpy->connectors[i]; + drmModeConnectorPtr connector = kconn->connector; + drmModeEncoderPtr encoder; + + encoder = drmModeGetEncoder(kdpy->fd, connector->encoder_id); + if (encoder) { + if (encoder->crtc_id == crtc_id) { + kcrtc->connectors[count++] = connector->connector_id; + if (count >= Elements(kcrtc->connectors)) + break; + } + drmModeFreeEncoder(encoder); + } + } + + kcrtc->num_connectors = count; + } + + err = drmModeSetCrtc(kdpy->fd, crtc_id, buffer_id, x, y, + connectors, num_connectors, mode); + if (err) { + drmModeFreeCrtc(kcrtc->crtc); + kcrtc->crtc = NULL; + kcrtc->num_connectors = 0; + + return FALSE; + } + + return TRUE; +} + +static boolean +kms_display_program(struct native_display *ndpy, int crtc_idx, + struct native_surface *nsurf, uint x, uint y, + const struct native_connector **nconns, int num_nconns, + const struct native_mode *nmode) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_surface *ksurf = kms_surface(nsurf); + const struct kms_mode *kmode = kms_mode(nmode); + uint32_t connector_ids[32]; + uint32_t buffer_id; + drmModeModeInfo mode_tmp, *mode; + int i; + + if (num_nconns > Elements(connector_ids)) { + _eglLog(_EGL_WARNING, "too many connectors (%d)", num_nconns); + num_nconns = Elements(connector_ids); + } + + if (ksurf) { + if (!kms_surface_init_framebuffers(&ksurf->base, FALSE)) + return FALSE; + + buffer_id = ksurf->front_fb.buffer_id; + /* the mode argument of drmModeSetCrtc is not constified */ + mode_tmp = kmode->mode; + mode = &mode_tmp; + } + else { + /* disable the CRTC */ + buffer_id = 0; + mode = NULL; + num_nconns = 0; + } + + for (i = 0; i < num_nconns; i++) { + struct kms_connector *kconn = kms_connector(nconns[i]); + connector_ids[i] = kconn->connector->connector_id; + } + + if (!kms_display_set_crtc(&kdpy->base, crtc_idx, buffer_id, x, y, + connector_ids, num_nconns, mode)) { + _eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx); + + return FALSE; + } + + if (kdpy->shown_surfaces[crtc_idx]) + kdpy->shown_surfaces[crtc_idx]->is_shown = FALSE; + kdpy->shown_surfaces[crtc_idx] = ksurf; + + /* remember the settings for buffer swapping */ + if (ksurf) { + uint32_t crtc_id = kdpy->saved_crtcs[crtc_idx].crtc->crtc_id; + struct kms_crtc *kcrtc = &ksurf->current_crtc; + + if (kcrtc->crtc) + drmModeFreeCrtc(kcrtc->crtc); + kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); + + assert(num_nconns < Elements(kcrtc->connectors)); + memcpy(kcrtc->connectors, connector_ids, + sizeof(*connector_ids) * num_nconns); + kcrtc->num_connectors = num_nconns; + + ksurf->is_shown = TRUE; + } + + return TRUE; +} + +static const struct native_mode ** +kms_display_get_modes(struct native_display *ndpy, + const struct native_connector *nconn, + int *num_modes) +{ + struct kms_display *kdpy = kms_display(ndpy); + struct kms_connector *kconn = kms_connector(nconn); + const struct native_mode **nmodes_return; + int count, i; + + /* delete old data */ + if (kconn->connector) { + drmModeFreeConnector(kconn->connector); + FREE(kconn->kms_modes); + + kconn->connector = NULL; + kconn->kms_modes = NULL; + kconn->num_modes = 0; + } + + /* detect again */ + kconn->connector = drmModeGetConnector(kdpy->fd, kconn->connector_id); + if (!kconn->connector) + return NULL; + + count = kconn->connector->count_modes; + kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes)); + if (!kconn->kms_modes) { + drmModeFreeConnector(kconn->connector); + kconn->connector = NULL; + + return NULL; + } + + for (i = 0; i < count; i++) { + struct kms_mode *kmode = &kconn->kms_modes[i]; + drmModeModeInfoPtr mode = &kconn->connector->modes[i]; + + kmode->mode = *mode; + + kmode->base.desc = kmode->mode.name; + kmode->base.width = kmode->mode.hdisplay; + kmode->base.height = kmode->mode.vdisplay; + kmode->base.refresh_rate = kmode->mode.vrefresh; + /* not all kernels have vrefresh = refresh_rate * 1000 */ + if (kmode->base.refresh_rate > 1000) + kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000; + } + + nmodes_return = MALLOC(count * sizeof(*nmodes_return)); + if (nmodes_return) { + for (i = 0; i < count; i++) + nmodes_return[i] = &kconn->kms_modes[i].base; + if (num_modes) + *num_modes = count; + } + + return nmodes_return; +} + +static const struct native_connector ** +kms_display_get_connectors(struct native_display *ndpy, int *num_connectors, + int *num_crtc) +{ + struct kms_display *kdpy = kms_display(ndpy); + const struct native_connector **connectors; + int i; + + if (!kdpy->connectors) { + kdpy->connectors = + CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors)); + if (!kdpy->connectors) + return NULL; + + for (i = 0; i < kdpy->resources->count_connectors; i++) { + struct kms_connector *kconn = &kdpy->connectors[i]; + + kconn->connector_id = kdpy->resources->connectors[i]; + /* kconn->connector is allocated when the modes are asked */ + } + + kdpy->num_connectors = kdpy->resources->count_connectors; + } + + connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors)); + if (connectors) { + for (i = 0; i < kdpy->num_connectors; i++) + connectors[i] = &kdpy->connectors[i].base; + if (num_connectors) + *num_connectors = kdpy->num_connectors; + } + + if (num_crtc) + *num_crtc = kdpy->resources->count_crtcs; + + return connectors; +} + +static struct native_surface * +kms_display_create_scanout_surface(struct native_display *ndpy, + const struct native_config *nconf, + uint width, uint height) +{ + struct kms_surface *ksurf; + + ksurf = kms_display_create_surface(ndpy, nconf, width, height); + return &ksurf->base; +} + +static struct native_display_modeset kms_display_modeset = { + .get_connectors = kms_display_get_connectors, + .get_modes = kms_display_get_modes, + .create_scanout_surface = kms_display_create_scanout_surface, + .program = kms_display_program +}; + +void +kms_display_fini_modeset(struct native_display *ndpy) +{ + struct kms_display *kdpy = kms_display(ndpy); + int i; + + if (kdpy->connectors) { + for (i = 0; i < kdpy->num_connectors; i++) { + struct kms_connector *kconn = &kdpy->connectors[i]; + if (kconn->connector) { + drmModeFreeConnector(kconn->connector); + FREE(kconn->kms_modes); + } + } + FREE(kdpy->connectors); + } + + if (kdpy->shown_surfaces) { + FREE(kdpy->shown_surfaces); + kdpy->shown_surfaces = NULL; + } + + if (kdpy->saved_crtcs) { + for (i = 0; i < kdpy->resources->count_crtcs; i++) { + struct kms_crtc *kcrtc = &kdpy->saved_crtcs[i]; + + if (kcrtc->crtc) { + /* restore crtc */ + drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, + kcrtc->crtc->buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, + kcrtc->connectors, kcrtc->num_connectors, + &kcrtc->crtc->mode); + + drmModeFreeCrtc(kcrtc->crtc); + } + } + FREE(kdpy->saved_crtcs); + } + + if (kdpy->resources) { + drmModeFreeResources(kdpy->resources); + kdpy->resources = NULL; + } + + kdpy->base.modeset = NULL; +} + +boolean +kms_display_init_modeset(struct native_display *ndpy) +{ + struct kms_display *kdpy = kms_display(ndpy); + + /* resources are fixed, unlike crtc, connector, or encoder */ + kdpy->resources = drmModeGetResources(kdpy->fd); + if (!kdpy->resources) { + _eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset."); + return FALSE; + } + + kdpy->saved_crtcs = + CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); + if (!kdpy->saved_crtcs) { + kms_display_fini_modeset(&kdpy->base); + return FALSE; + } + + kdpy->shown_surfaces = + CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); + if (!kdpy->shown_surfaces) { + kms_display_fini_modeset(&kdpy->base); + return FALSE; + } + + kdpy->base.modeset = &kms_display_modeset; + + return TRUE; +} diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c new file mode 100644 index 00000000000..8ffdde66ba8 --- /dev/null +++ b/src/gallium/state_trackers/egl/drm/native_drm.c @@ -0,0 +1,240 @@ +/* + * Mesa 3-D graphics library + * Version: 7.8 + * + * Copyright (C) 2010 Chia-I Wu + * + * 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#include +#include +#include + +#include "util/u_memory.h" +#include "egllog.h" + +#include "native_drm.h" + +/* see get_drm_screen_name */ +#include +#include "radeon/drm/radeon_drm.h" + +static boolean +kms_display_is_format_supported(struct native_display *ndpy, + enum pipe_format fmt, boolean is_color) +{ + return ndpy->screen->is_format_supported(ndpy->screen, + fmt, PIPE_TEXTURE_2D, 0, + (is_color) ? PIPE_BIND_RENDER_TARGET : + PIPE_BIND_DEPTH_STENCIL, 0); +} + +static const struct native_config ** +kms_display_get_configs(struct native_display *ndpy, int *num_configs) +{ + struct kms_display *kdpy = kms_display(ndpy); + const struct native_config **configs; + + /* first time */ + if (!kdpy->config) { + struct native_config *nconf; + enum pipe_format format; + + kdpy->config = CALLOC(1, sizeof(*kdpy->config)); + if (!kdpy->config) + return NULL; + + nconf = &kdpy->config->base; + + nconf->buffer_mask = + (1 << NATIVE_ATTACHMENT_FRONT_LEFT) | + (1 << NATIVE_ATTACHMENT_BACK_LEFT); + + format = PIPE_FORMAT_B8G8R8A8_UNORM; + if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) { + format = PIPE_FORMAT_A8R8G8B8_UNORM; + if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) + format = PIPE_FORMAT_NONE; + } + if (format == PIPE_FORMAT_NONE) { + FREE(kdpy->config); + kdpy->config = NULL; + return NULL; + } + + nconf->color_format = format; + + /* support KMS */ + if (kdpy->resources) + nconf->scanout_bit = TRUE; + } + + configs = MALLOC(sizeof(*configs)); + if (configs) { + configs[0] = &kdpy->config->base; + if (num_configs) + *num_configs = 1; + } + + return configs; +} + +static int +kms_display_get_param(struct native_display *ndpy, + enum native_param_type param) +{ + int val; + + switch (param) { + default: + val = 0; + break; + } + + return val; +} + +static void +kms_display_destroy(struct native_display *ndpy) +{ + struct kms_display *kdpy = kms_display(ndpy); + + if (kdpy->config) + FREE(kdpy->config); + + kms_display_fini_modeset(&kdpy->base); + + if (kdpy->base.screen) + kdpy->base.screen->destroy(kdpy->base.screen); + + if (kdpy->fd >= 0) + close(kdpy->fd); + + FREE(kdpy); +} + +static const char * +get_drm_screen_name(int fd, drmVersionPtr version) +{ + const char *name = version->name; + + if (name && !strcmp(name, "radeon")) { + int chip_id; + struct drm_radeon_info info; + + memset(&info, 0, sizeof(info)); + info.request = RADEON_INFO_DEVICE_ID; + info.value = pointer_to_intptr(&chip_id); + if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0) + return NULL; + + name = is_r3xx(chip_id) ? "r300" : "r600"; + } + + return name; +} + +/** + * Initialize KMS and pipe screen. + */ +static boolean +kms_display_init_screen(struct native_display *ndpy) +{ + struct kms_display *kdpy = kms_display(ndpy); + drmVersionPtr version; + const char *name; + + version = drmGetVersion(kdpy->fd); + if (!version) { + _eglLog(_EGL_WARNING, "invalid fd %d", kdpy->fd); + return FALSE; + } + + name = get_drm_screen_name(kdpy->fd, version); + if (name) { + kdpy->base.screen = + kdpy->event_handler->new_drm_screen(&kdpy->base, name, kdpy->fd); + } + drmFreeVersion(version); + + if (!kdpy->base.screen) { + _eglLog(_EGL_WARNING, "failed to create DRM screen"); + return FALSE; + } + + return TRUE; +} + +static struct native_display * +kms_create_display(int fd, struct native_event_handler *event_handler, + void *user_data) +{ + struct kms_display *kdpy; + + kdpy = CALLOC_STRUCT(kms_display); + if (!kdpy) + return NULL; + + kdpy->fd = fd; + kdpy->event_handler = event_handler; + kdpy->base.user_data = user_data; + + if (!kms_display_init_screen(&kdpy->base)) { + kms_display_destroy(&kdpy->base); + return NULL; + } + + kdpy->base.destroy = kms_display_destroy; + kdpy->base.get_param = kms_display_get_param; + kdpy->base.get_configs = kms_display_get_configs; + + kms_display_init_modeset(&kdpy->base); + + return &kdpy->base; +} + +static struct native_display * +native_create_display(void *dpy, struct native_event_handler *event_handler, + void *user_data) +{ + int fd; + + if (dpy) { + fd = dup((int) pointer_to_intptr(dpy)); + } + else { + fd = open("/dev/dri/card0", O_RDWR); + } + if (fd < 0) + return NULL; + + return kms_create_display(fd, event_handler, user_data); +} + +static const struct native_platform drm_platform = { + "DRM", /* name */ + native_create_display +}; + +const struct native_platform * +native_get_drm_platform(void) +{ + return &drm_platform; +} diff --git a/src/gallium/state_trackers/egl/drm/native_drm.h b/src/gallium/state_trackers/egl/drm/native_drm.h new file mode 100644 index 00000000000..3a9b1a67887 --- /dev/null +++ b/src/gallium/state_trackers/egl/drm/native_drm.h @@ -0,0 +1,146 @@ +/* + * Mesa 3-D graphics library + * Version: 7.8 + * + * Copyright (C) 2010 Chia-I Wu + * + * 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifndef _NATIVE_KMS_H_ +#define _NATIVE_KMS_H_ + +#include +#include + +#include "pipe/p_compiler.h" +#include "util/u_format.h" +#include "pipe/p_state.h" +#include "state_tracker/drm_driver.h" + +#include "common/native.h" +#include "common/native_helper.h" + +struct kms_config; +struct kms_crtc; +struct kms_connector; +struct kms_mode; +struct kms_surface; + +struct kms_display { + struct native_display base; + + struct native_event_handler *event_handler; + + int fd; + struct kms_config *config; + + /* for modesetting */ + drmModeResPtr resources; + struct kms_connector *connectors; + int num_connectors; + + struct kms_surface **shown_surfaces; + /* save the original settings of the CRTCs */ + struct kms_crtc *saved_crtcs; +}; + +struct kms_config { + struct native_config base; +}; + +struct kms_crtc { + drmModeCrtcPtr crtc; + uint32_t connectors[32]; + int num_connectors; +}; + +struct kms_framebuffer { + struct pipe_resource *texture; + boolean is_passive; + + uint32_t buffer_id; +}; + +struct kms_surface { + struct native_surface base; + struct kms_display *kdpy; + + struct resource_surface *rsurf; + enum pipe_format color_format; + int width, height; + + unsigned int sequence_number; + struct kms_framebuffer front_fb, back_fb; + + boolean is_shown; + struct kms_crtc current_crtc; +}; + +struct kms_connector { + struct native_connector base; + + uint32_t connector_id; + drmModeConnectorPtr connector; + struct kms_mode *kms_modes; + int num_modes; +}; + +struct kms_mode { + struct native_mode base; + drmModeModeInfo mode; +}; + +static INLINE struct kms_display * +kms_display(const struct native_display *ndpy) +{ + return (struct kms_display *) ndpy; +} + +static INLINE struct kms_config * +kms_config(const struct native_config *nconf) +{ + return (struct kms_config *) nconf; +} + +static INLINE struct kms_surface * +kms_surface(const struct native_surface *nsurf) +{ + return (struct kms_surface *) nsurf; +} + +static INLINE struct kms_connector * +kms_connector(const struct native_connector *nconn) +{ + return (struct kms_connector *) nconn; +} + +static INLINE struct kms_mode * +kms_mode(const struct native_mode *nmode) +{ + return (struct kms_mode *) nmode; +} + +boolean +kms_display_init_modeset(struct native_display *ndpy); + +void +kms_display_fini_modeset(struct native_display *ndpy); + +#endif /* _NATIVE_KMS_H_ */ diff --git a/src/gallium/state_trackers/egl/kms/modeset.c b/src/gallium/state_trackers/egl/kms/modeset.c deleted file mode 100644 index 9473a0e5f4c..00000000000 --- a/src/gallium/state_trackers/egl/kms/modeset.c +++ /dev/null @@ -1,619 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - * - * Authors: - * Chia-I Wu - */ - -#include "util/u_memory.h" -#include "util/u_inlines.h" -#include "egllog.h" - -#include "native_kms.h" - -static boolean -kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, - unsigned int *seq_num, struct pipe_resource **textures, - int *width, int *height) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - - if (!resource_surface_add_resources(ksurf->rsurf, attachment_mask)) - return FALSE; - if (textures) - resource_surface_get_resources(ksurf->rsurf, textures, attachment_mask); - - if (seq_num) - *seq_num = ksurf->sequence_number; - if (width) - *width = ksurf->width; - if (height) - *height = ksurf->height; - - return TRUE; -} - -/** - * Add textures as DRM framebuffers. - */ -static boolean -kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_display *kdpy = ksurf->kdpy; - int num_framebuffers = (need_back) ? 2 : 1; - int i, err; - - for (i = 0; i < num_framebuffers; i++) { - struct kms_framebuffer *fb; - enum native_attachment natt; - struct winsys_handle whandle; - uint block_bits; - - if (i == 0) { - fb = &ksurf->front_fb; - natt = NATIVE_ATTACHMENT_FRONT_LEFT; - } - else { - fb = &ksurf->back_fb; - natt = NATIVE_ATTACHMENT_BACK_LEFT; - } - - if (!fb->texture) { - /* make sure the texture has been allocated */ - resource_surface_add_resources(ksurf->rsurf, 1 << natt); - fb->texture = - resource_surface_get_single_resource(ksurf->rsurf, natt); - if (!fb->texture) - return FALSE; - } - - /* already initialized */ - if (fb->buffer_id) - continue; - - /* TODO detect the real value */ - fb->is_passive = TRUE; - - memset(&whandle, 0, sizeof(whandle)); - whandle.type = DRM_API_HANDLE_TYPE_KMS; - - if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen, - fb->texture, &whandle)) - return FALSE; - - block_bits = util_format_get_blocksizebits(ksurf->color_format); - err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height, - block_bits, block_bits, whandle.stride, whandle.handle, - &fb->buffer_id); - if (err) { - fb->buffer_id = 0; - return FALSE; - } - } - - return TRUE; -} - -static boolean -kms_surface_flush_frontbuffer(struct native_surface *nsurf) -{ -#ifdef DRM_MODE_FEATURE_DIRTYFB - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_display *kdpy = ksurf->kdpy; - - if (ksurf->front_fb.is_passive) - drmModeDirtyFB(kdpy->fd, ksurf->front_fb.buffer_id, NULL, 0); -#endif - - return TRUE; -} - -static boolean -kms_surface_swap_buffers(struct native_surface *nsurf) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_crtc *kcrtc = &ksurf->current_crtc; - struct kms_display *kdpy = ksurf->kdpy; - struct kms_framebuffer tmp_fb; - int err; - - if (!ksurf->back_fb.buffer_id) { - if (!kms_surface_init_framebuffers(&ksurf->base, TRUE)) - return FALSE; - } - - if (ksurf->is_shown && kcrtc->crtc) { - err = drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, - ksurf->back_fb.buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, - kcrtc->connectors, kcrtc->num_connectors, &kcrtc->crtc->mode); - if (err) - return FALSE; - } - - /* swap the buffers */ - tmp_fb = ksurf->front_fb; - ksurf->front_fb = ksurf->back_fb; - ksurf->back_fb = tmp_fb; - - resource_surface_swap_buffers(ksurf->rsurf, - NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); - /* the front/back textures are swapped */ - ksurf->sequence_number++; - kdpy->event_handler->invalid_surface(&kdpy->base, - &ksurf->base, ksurf->sequence_number); - - return TRUE; -} - -static void -kms_surface_wait(struct native_surface *nsurf) -{ - /* no-op */ -} - -static void -kms_surface_destroy(struct native_surface *nsurf) -{ - struct kms_surface *ksurf = kms_surface(nsurf); - - if (ksurf->current_crtc.crtc) - drmModeFreeCrtc(ksurf->current_crtc.crtc); - - if (ksurf->front_fb.buffer_id) - drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id); - pipe_resource_reference(&ksurf->front_fb.texture, NULL); - - if (ksurf->back_fb.buffer_id) - drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id); - pipe_resource_reference(&ksurf->back_fb.texture, NULL); - - resource_surface_destroy(ksurf->rsurf); - FREE(ksurf); -} - -static struct kms_surface * -kms_display_create_surface(struct native_display *ndpy, - const struct native_config *nconf, - uint width, uint height) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_config *kconf = kms_config(nconf); - struct kms_surface *ksurf; - - ksurf = CALLOC_STRUCT(kms_surface); - if (!ksurf) - return NULL; - - ksurf->kdpy = kdpy; - ksurf->color_format = kconf->base.color_format; - ksurf->width = width; - ksurf->height = height; - - ksurf->rsurf = resource_surface_create(kdpy->base.screen, - ksurf->color_format, - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_SAMPLER_VIEW | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT); - if (!ksurf->rsurf) { - FREE(ksurf); - return NULL; - } - - resource_surface_set_size(ksurf->rsurf, ksurf->width, ksurf->height); - - ksurf->base.destroy = kms_surface_destroy; - ksurf->base.swap_buffers = kms_surface_swap_buffers; - ksurf->base.flush_frontbuffer = kms_surface_flush_frontbuffer; - ksurf->base.validate = kms_surface_validate; - ksurf->base.wait = kms_surface_wait; - - return ksurf; -} - -/** - * Choose a CRTC that supports all given connectors. - */ -static uint32_t -kms_display_choose_crtc(struct native_display *ndpy, - uint32_t *connectors, int num_connectors) -{ - struct kms_display *kdpy = kms_display(ndpy); - int idx; - - for (idx = 0; idx < kdpy->resources->count_crtcs; idx++) { - boolean found_crtc = TRUE; - int i, j; - - for (i = 0; i < num_connectors; i++) { - drmModeConnectorPtr connector; - int encoder_idx = -1; - - connector = drmModeGetConnector(kdpy->fd, connectors[i]); - if (!connector) { - found_crtc = FALSE; - break; - } - - /* find an encoder the CRTC supports */ - for (j = 0; j < connector->count_encoders; j++) { - drmModeEncoderPtr encoder = - drmModeGetEncoder(kdpy->fd, connector->encoders[j]); - if (encoder->possible_crtcs & (1 << idx)) { - encoder_idx = j; - break; - } - drmModeFreeEncoder(encoder); - } - - drmModeFreeConnector(connector); - if (encoder_idx < 0) { - found_crtc = FALSE; - break; - } - } - - if (found_crtc) - break; - } - - if (idx >= kdpy->resources->count_crtcs) { - _eglLog(_EGL_WARNING, - "failed to find a CRTC that supports the given %d connectors", - num_connectors); - return 0; - } - - return kdpy->resources->crtcs[idx]; -} - -/** - * Remember the original CRTC status and set the CRTC - */ -static boolean -kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, - uint32_t buffer_id, uint32_t x, uint32_t y, - uint32_t *connectors, int num_connectors, - drmModeModeInfoPtr mode) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_crtc *kcrtc = &kdpy->saved_crtcs[crtc_idx]; - uint32_t crtc_id; - int err; - - if (kcrtc->crtc) { - crtc_id = kcrtc->crtc->crtc_id; - } - else { - int count = 0, i; - - /* - * Choose the CRTC once. It could be more dynamic, but let's keep it - * simple for now. - */ - crtc_id = kms_display_choose_crtc(&kdpy->base, - connectors, num_connectors); - - /* save the original CRTC status */ - kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); - if (!kcrtc->crtc) - return FALSE; - - for (i = 0; i < kdpy->num_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - drmModeConnectorPtr connector = kconn->connector; - drmModeEncoderPtr encoder; - - encoder = drmModeGetEncoder(kdpy->fd, connector->encoder_id); - if (encoder) { - if (encoder->crtc_id == crtc_id) { - kcrtc->connectors[count++] = connector->connector_id; - if (count >= Elements(kcrtc->connectors)) - break; - } - drmModeFreeEncoder(encoder); - } - } - - kcrtc->num_connectors = count; - } - - err = drmModeSetCrtc(kdpy->fd, crtc_id, buffer_id, x, y, - connectors, num_connectors, mode); - if (err) { - drmModeFreeCrtc(kcrtc->crtc); - kcrtc->crtc = NULL; - kcrtc->num_connectors = 0; - - return FALSE; - } - - return TRUE; -} - -static boolean -kms_display_program(struct native_display *ndpy, int crtc_idx, - struct native_surface *nsurf, uint x, uint y, - const struct native_connector **nconns, int num_nconns, - const struct native_mode *nmode) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_surface *ksurf = kms_surface(nsurf); - const struct kms_mode *kmode = kms_mode(nmode); - uint32_t connector_ids[32]; - uint32_t buffer_id; - drmModeModeInfo mode_tmp, *mode; - int i; - - if (num_nconns > Elements(connector_ids)) { - _eglLog(_EGL_WARNING, "too many connectors (%d)", num_nconns); - num_nconns = Elements(connector_ids); - } - - if (ksurf) { - if (!kms_surface_init_framebuffers(&ksurf->base, FALSE)) - return FALSE; - - buffer_id = ksurf->front_fb.buffer_id; - /* the mode argument of drmModeSetCrtc is not constified */ - mode_tmp = kmode->mode; - mode = &mode_tmp; - } - else { - /* disable the CRTC */ - buffer_id = 0; - mode = NULL; - num_nconns = 0; - } - - for (i = 0; i < num_nconns; i++) { - struct kms_connector *kconn = kms_connector(nconns[i]); - connector_ids[i] = kconn->connector->connector_id; - } - - if (!kms_display_set_crtc(&kdpy->base, crtc_idx, buffer_id, x, y, - connector_ids, num_nconns, mode)) { - _eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx); - - return FALSE; - } - - if (kdpy->shown_surfaces[crtc_idx]) - kdpy->shown_surfaces[crtc_idx]->is_shown = FALSE; - kdpy->shown_surfaces[crtc_idx] = ksurf; - - /* remember the settings for buffer swapping */ - if (ksurf) { - uint32_t crtc_id = kdpy->saved_crtcs[crtc_idx].crtc->crtc_id; - struct kms_crtc *kcrtc = &ksurf->current_crtc; - - if (kcrtc->crtc) - drmModeFreeCrtc(kcrtc->crtc); - kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); - - assert(num_nconns < Elements(kcrtc->connectors)); - memcpy(kcrtc->connectors, connector_ids, - sizeof(*connector_ids) * num_nconns); - kcrtc->num_connectors = num_nconns; - - ksurf->is_shown = TRUE; - } - - return TRUE; -} - -static const struct native_mode ** -kms_display_get_modes(struct native_display *ndpy, - const struct native_connector *nconn, - int *num_modes) -{ - struct kms_display *kdpy = kms_display(ndpy); - struct kms_connector *kconn = kms_connector(nconn); - const struct native_mode **nmodes_return; - int count, i; - - /* delete old data */ - if (kconn->connector) { - drmModeFreeConnector(kconn->connector); - FREE(kconn->kms_modes); - - kconn->connector = NULL; - kconn->kms_modes = NULL; - kconn->num_modes = 0; - } - - /* detect again */ - kconn->connector = drmModeGetConnector(kdpy->fd, kconn->connector_id); - if (!kconn->connector) - return NULL; - - count = kconn->connector->count_modes; - kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes)); - if (!kconn->kms_modes) { - drmModeFreeConnector(kconn->connector); - kconn->connector = NULL; - - return NULL; - } - - for (i = 0; i < count; i++) { - struct kms_mode *kmode = &kconn->kms_modes[i]; - drmModeModeInfoPtr mode = &kconn->connector->modes[i]; - - kmode->mode = *mode; - - kmode->base.desc = kmode->mode.name; - kmode->base.width = kmode->mode.hdisplay; - kmode->base.height = kmode->mode.vdisplay; - kmode->base.refresh_rate = kmode->mode.vrefresh; - /* not all kernels have vrefresh = refresh_rate * 1000 */ - if (kmode->base.refresh_rate > 1000) - kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000; - } - - nmodes_return = MALLOC(count * sizeof(*nmodes_return)); - if (nmodes_return) { - for (i = 0; i < count; i++) - nmodes_return[i] = &kconn->kms_modes[i].base; - if (num_modes) - *num_modes = count; - } - - return nmodes_return; -} - -static const struct native_connector ** -kms_display_get_connectors(struct native_display *ndpy, int *num_connectors, - int *num_crtc) -{ - struct kms_display *kdpy = kms_display(ndpy); - const struct native_connector **connectors; - int i; - - if (!kdpy->connectors) { - kdpy->connectors = - CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors)); - if (!kdpy->connectors) - return NULL; - - for (i = 0; i < kdpy->resources->count_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - - kconn->connector_id = kdpy->resources->connectors[i]; - /* kconn->connector is allocated when the modes are asked */ - } - - kdpy->num_connectors = kdpy->resources->count_connectors; - } - - connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors)); - if (connectors) { - for (i = 0; i < kdpy->num_connectors; i++) - connectors[i] = &kdpy->connectors[i].base; - if (num_connectors) - *num_connectors = kdpy->num_connectors; - } - - if (num_crtc) - *num_crtc = kdpy->resources->count_crtcs; - - return connectors; -} - -static struct native_surface * -kms_display_create_scanout_surface(struct native_display *ndpy, - const struct native_config *nconf, - uint width, uint height) -{ - struct kms_surface *ksurf; - - ksurf = kms_display_create_surface(ndpy, nconf, width, height); - return &ksurf->base; -} - -static struct native_display_modeset kms_display_modeset = { - .get_connectors = kms_display_get_connectors, - .get_modes = kms_display_get_modes, - .create_scanout_surface = kms_display_create_scanout_surface, - .program = kms_display_program -}; - -void -kms_display_fini_modeset(struct native_display *ndpy) -{ - struct kms_display *kdpy = kms_display(ndpy); - int i; - - if (kdpy->connectors) { - for (i = 0; i < kdpy->num_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - if (kconn->connector) { - drmModeFreeConnector(kconn->connector); - FREE(kconn->kms_modes); - } - } - FREE(kdpy->connectors); - } - - if (kdpy->shown_surfaces) { - FREE(kdpy->shown_surfaces); - kdpy->shown_surfaces = NULL; - } - - if (kdpy->saved_crtcs) { - for (i = 0; i < kdpy->resources->count_crtcs; i++) { - struct kms_crtc *kcrtc = &kdpy->saved_crtcs[i]; - - if (kcrtc->crtc) { - /* restore crtc */ - drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, - kcrtc->crtc->buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, - kcrtc->connectors, kcrtc->num_connectors, - &kcrtc->crtc->mode); - - drmModeFreeCrtc(kcrtc->crtc); - } - } - FREE(kdpy->saved_crtcs); - } - - if (kdpy->resources) { - drmModeFreeResources(kdpy->resources); - kdpy->resources = NULL; - } - - kdpy->base.modeset = NULL; -} - -boolean -kms_display_init_modeset(struct native_display *ndpy) -{ - struct kms_display *kdpy = kms_display(ndpy); - - /* resources are fixed, unlike crtc, connector, or encoder */ - kdpy->resources = drmModeGetResources(kdpy->fd); - if (!kdpy->resources) { - _eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset."); - return FALSE; - } - - kdpy->saved_crtcs = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); - if (!kdpy->saved_crtcs) { - kms_display_fini_modeset(&kdpy->base); - return FALSE; - } - - kdpy->shown_surfaces = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); - if (!kdpy->shown_surfaces) { - kms_display_fini_modeset(&kdpy->base); - return FALSE; - } - - kdpy->base.modeset = &kms_display_modeset; - - return TRUE; -} diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c deleted file mode 100644 index 94880c36965..00000000000 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.8 - * - * Copyright (C) 2010 Chia-I Wu - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -#include -#include -#include - -#include "util/u_memory.h" -#include "egllog.h" - -#include "native_kms.h" - -/* see get_drm_screen_name */ -#include -#include "radeon/drm/radeon_drm.h" - -static boolean -kms_display_is_format_supported(struct native_display *ndpy, - enum pipe_format fmt, boolean is_color) -{ - return ndpy->screen->is_format_supported(ndpy->screen, - fmt, PIPE_TEXTURE_2D, 0, - (is_color) ? PIPE_BIND_RENDER_TARGET : - PIPE_BIND_DEPTH_STENCIL, 0); -} - -static const struct native_config ** -kms_display_get_configs(struct native_display *ndpy, int *num_configs) -{ - struct kms_display *kdpy = kms_display(ndpy); - const struct native_config **configs; - - /* first time */ - if (!kdpy->config) { - struct native_config *nconf; - enum pipe_format format; - - kdpy->config = CALLOC(1, sizeof(*kdpy->config)); - if (!kdpy->config) - return NULL; - - nconf = &kdpy->config->base; - - nconf->buffer_mask = - (1 << NATIVE_ATTACHMENT_FRONT_LEFT) | - (1 << NATIVE_ATTACHMENT_BACK_LEFT); - - format = PIPE_FORMAT_B8G8R8A8_UNORM; - if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) { - format = PIPE_FORMAT_A8R8G8B8_UNORM; - if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) - format = PIPE_FORMAT_NONE; - } - if (format == PIPE_FORMAT_NONE) { - FREE(kdpy->config); - kdpy->config = NULL; - return NULL; - } - - nconf->color_format = format; - - /* support KMS */ - if (kdpy->resources) - nconf->scanout_bit = TRUE; - } - - configs = MALLOC(sizeof(*configs)); - if (configs) { - configs[0] = &kdpy->config->base; - if (num_configs) - *num_configs = 1; - } - - return configs; -} - -static int -kms_display_get_param(struct native_display *ndpy, - enum native_param_type param) -{ - int val; - - switch (param) { - default: - val = 0; - break; - } - - return val; -} - -static void -kms_display_destroy(struct native_display *ndpy) -{ - struct kms_display *kdpy = kms_display(ndpy); - - if (kdpy->config) - FREE(kdpy->config); - - kms_display_fini_modeset(&kdpy->base); - - if (kdpy->base.screen) - kdpy->base.screen->destroy(kdpy->base.screen); - - if (kdpy->fd >= 0) - close(kdpy->fd); - - FREE(kdpy); -} - -static const char * -get_drm_screen_name(int fd, drmVersionPtr version) -{ - const char *name = version->name; - - if (name && !strcmp(name, "radeon")) { - int chip_id; - struct drm_radeon_info info; - - memset(&info, 0, sizeof(info)); - info.request = RADEON_INFO_DEVICE_ID; - info.value = pointer_to_intptr(&chip_id); - if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0) - return NULL; - - name = is_r3xx(chip_id) ? "r300" : "r600"; - } - - return name; -} - -/** - * Initialize KMS and pipe screen. - */ -static boolean -kms_display_init_screen(struct native_display *ndpy) -{ - struct kms_display *kdpy = kms_display(ndpy); - drmVersionPtr version; - const char *name; - - version = drmGetVersion(kdpy->fd); - if (!version) { - _eglLog(_EGL_WARNING, "invalid fd %d", kdpy->fd); - return FALSE; - } - - name = get_drm_screen_name(kdpy->fd, version); - if (name) { - kdpy->base.screen = - kdpy->event_handler->new_drm_screen(&kdpy->base, name, kdpy->fd); - } - drmFreeVersion(version); - - if (!kdpy->base.screen) { - _eglLog(_EGL_WARNING, "failed to create DRM screen"); - return FALSE; - } - - return TRUE; -} - -static struct native_display * -kms_create_display(int fd, struct native_event_handler *event_handler, - void *user_data) -{ - struct kms_display *kdpy; - - kdpy = CALLOC_STRUCT(kms_display); - if (!kdpy) - return NULL; - - kdpy->fd = fd; - kdpy->event_handler = event_handler; - kdpy->base.user_data = user_data; - - if (!kms_display_init_screen(&kdpy->base)) { - kms_display_destroy(&kdpy->base); - return NULL; - } - - kdpy->base.destroy = kms_display_destroy; - kdpy->base.get_param = kms_display_get_param; - kdpy->base.get_configs = kms_display_get_configs; - - kms_display_init_modeset(&kdpy->base); - - return &kdpy->base; -} - -static struct native_display * -native_create_display(void *dpy, struct native_event_handler *event_handler, - void *user_data) -{ - int fd; - - if (dpy) { - fd = dup((int) pointer_to_intptr(dpy)); - } - else { - fd = open("/dev/dri/card0", O_RDWR); - } - if (fd < 0) - return NULL; - - return kms_create_display(fd, event_handler, user_data); -} - -static const struct native_platform kms_platform = { - "KMS", /* name */ - native_create_display -}; - -const struct native_platform * -native_get_kms_platform(void) -{ - return &kms_platform; -} diff --git a/src/gallium/state_trackers/egl/kms/native_kms.h b/src/gallium/state_trackers/egl/kms/native_kms.h deleted file mode 100644 index 3a9b1a67887..00000000000 --- a/src/gallium/state_trackers/egl/kms/native_kms.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.8 - * - * Copyright (C) 2010 Chia-I Wu - * - * 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -#ifndef _NATIVE_KMS_H_ -#define _NATIVE_KMS_H_ - -#include -#include - -#include "pipe/p_compiler.h" -#include "util/u_format.h" -#include "pipe/p_state.h" -#include "state_tracker/drm_driver.h" - -#include "common/native.h" -#include "common/native_helper.h" - -struct kms_config; -struct kms_crtc; -struct kms_connector; -struct kms_mode; -struct kms_surface; - -struct kms_display { - struct native_display base; - - struct native_event_handler *event_handler; - - int fd; - struct kms_config *config; - - /* for modesetting */ - drmModeResPtr resources; - struct kms_connector *connectors; - int num_connectors; - - struct kms_surface **shown_surfaces; - /* save the original settings of the CRTCs */ - struct kms_crtc *saved_crtcs; -}; - -struct kms_config { - struct native_config base; -}; - -struct kms_crtc { - drmModeCrtcPtr crtc; - uint32_t connectors[32]; - int num_connectors; -}; - -struct kms_framebuffer { - struct pipe_resource *texture; - boolean is_passive; - - uint32_t buffer_id; -}; - -struct kms_surface { - struct native_surface base; - struct kms_display *kdpy; - - struct resource_surface *rsurf; - enum pipe_format color_format; - int width, height; - - unsigned int sequence_number; - struct kms_framebuffer front_fb, back_fb; - - boolean is_shown; - struct kms_crtc current_crtc; -}; - -struct kms_connector { - struct native_connector base; - - uint32_t connector_id; - drmModeConnectorPtr connector; - struct kms_mode *kms_modes; - int num_modes; -}; - -struct kms_mode { - struct native_mode base; - drmModeModeInfo mode; -}; - -static INLINE struct kms_display * -kms_display(const struct native_display *ndpy) -{ - return (struct kms_display *) ndpy; -} - -static INLINE struct kms_config * -kms_config(const struct native_config *nconf) -{ - return (struct kms_config *) nconf; -} - -static INLINE struct kms_surface * -kms_surface(const struct native_surface *nsurf) -{ - return (struct kms_surface *) nsurf; -} - -static INLINE struct kms_connector * -kms_connector(const struct native_connector *nconn) -{ - return (struct kms_connector *) nconn; -} - -static INLINE struct kms_mode * -kms_mode(const struct native_mode *nmode) -{ - return (struct kms_mode *) nmode; -} - -boolean -kms_display_init_modeset(struct native_display *ndpy); - -void -kms_display_fini_modeset(struct native_display *ndpy); - -#endif /* _NATIVE_KMS_H_ */ -- cgit v1.2.3 From e4513e7fb96c6336d8c7fcdadfaddb6b335a736e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 19 Sep 2010 17:11:07 +0800 Subject: st/egl: s/kms/drm/ on the drm backend. s/kms/drm/, s/kdpy/drmdpy/, and so forth. --- src/gallium/state_trackers/egl/drm/modeset.c | 432 ++++++++++++------------ src/gallium/state_trackers/egl/drm/native_drm.c | 94 +++--- src/gallium/state_trackers/egl/drm/native_drm.h | 80 ++--- 3 files changed, 303 insertions(+), 303 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c index 5d6a07e2fdd..06a60770537 100644 --- a/src/gallium/state_trackers/egl/drm/modeset.c +++ b/src/gallium/state_trackers/egl/drm/modeset.c @@ -33,23 +33,23 @@ #include "native_drm.h" static boolean -kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, +drm_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, int *width, int *height) { - struct kms_surface *ksurf = kms_surface(nsurf); + struct drm_surface *drmsurf = drm_surface(nsurf); - if (!resource_surface_add_resources(ksurf->rsurf, attachment_mask)) + if (!resource_surface_add_resources(drmsurf->rsurf, attachment_mask)) return FALSE; if (textures) - resource_surface_get_resources(ksurf->rsurf, textures, attachment_mask); + resource_surface_get_resources(drmsurf->rsurf, textures, attachment_mask); if (seq_num) - *seq_num = ksurf->sequence_number; + *seq_num = drmsurf->sequence_number; if (width) - *width = ksurf->width; + *width = drmsurf->width; if (height) - *height = ksurf->height; + *height = drmsurf->height; return TRUE; } @@ -58,33 +58,33 @@ kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, * Add textures as DRM framebuffers. */ static boolean -kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) +drm_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) { - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_display *kdpy = ksurf->kdpy; + struct drm_surface *drmsurf = drm_surface(nsurf); + struct drm_display *drmdpy = drmsurf->drmdpy; int num_framebuffers = (need_back) ? 2 : 1; int i, err; for (i = 0; i < num_framebuffers; i++) { - struct kms_framebuffer *fb; + struct drm_framebuffer *fb; enum native_attachment natt; struct winsys_handle whandle; uint block_bits; if (i == 0) { - fb = &ksurf->front_fb; + fb = &drmsurf->front_fb; natt = NATIVE_ATTACHMENT_FRONT_LEFT; } else { - fb = &ksurf->back_fb; + fb = &drmsurf->back_fb; natt = NATIVE_ATTACHMENT_BACK_LEFT; } if (!fb->texture) { /* make sure the texture has been allocated */ - resource_surface_add_resources(ksurf->rsurf, 1 << natt); + resource_surface_add_resources(drmsurf->rsurf, 1 << natt); fb->texture = - resource_surface_get_single_resource(ksurf->rsurf, natt); + resource_surface_get_single_resource(drmsurf->rsurf, natt); if (!fb->texture) return FALSE; } @@ -99,12 +99,12 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_KMS; - if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen, + if (!drmdpy->base.screen->resource_get_handle(drmdpy->base.screen, fb->texture, &whandle)) return FALSE; - block_bits = util_format_get_blocksizebits(ksurf->color_format); - err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height, + block_bits = util_format_get_blocksizebits(drmsurf->color_format); + err = drmModeAddFB(drmdpy->fd, drmsurf->width, drmsurf->height, block_bits, block_bits, whandle.stride, whandle.handle, &fb->buffer_id); if (err) { @@ -117,133 +117,133 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) } static boolean -kms_surface_flush_frontbuffer(struct native_surface *nsurf) +drm_surface_flush_frontbuffer(struct native_surface *nsurf) { #ifdef DRM_MODE_FEATURE_DIRTYFB - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_display *kdpy = ksurf->kdpy; + struct drm_surface *drmsurf = drm_surface(nsurf); + struct drm_display *drmdpy = drmsurf->drmdpy; - if (ksurf->front_fb.is_passive) - drmModeDirtyFB(kdpy->fd, ksurf->front_fb.buffer_id, NULL, 0); + if (drmsurf->front_fb.is_passive) + drmModeDirtyFB(drmdpy->fd, drmsurf->front_fb.buffer_id, NULL, 0); #endif return TRUE; } static boolean -kms_surface_swap_buffers(struct native_surface *nsurf) +drm_surface_swap_buffers(struct native_surface *nsurf) { - struct kms_surface *ksurf = kms_surface(nsurf); - struct kms_crtc *kcrtc = &ksurf->current_crtc; - struct kms_display *kdpy = ksurf->kdpy; - struct kms_framebuffer tmp_fb; + struct drm_surface *drmsurf = drm_surface(nsurf); + struct drm_crtc *drmcrtc = &drmsurf->current_crtc; + struct drm_display *drmdpy = drmsurf->drmdpy; + struct drm_framebuffer tmp_fb; int err; - if (!ksurf->back_fb.buffer_id) { - if (!kms_surface_init_framebuffers(&ksurf->base, TRUE)) + if (!drmsurf->back_fb.buffer_id) { + if (!drm_surface_init_framebuffers(&drmsurf->base, TRUE)) return FALSE; } - if (ksurf->is_shown && kcrtc->crtc) { - err = drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, - ksurf->back_fb.buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, - kcrtc->connectors, kcrtc->num_connectors, &kcrtc->crtc->mode); + if (drmsurf->is_shown && drmcrtc->crtc) { + err = drmModeSetCrtc(drmdpy->fd, drmcrtc->crtc->crtc_id, + drmsurf->back_fb.buffer_id, drmcrtc->crtc->x, drmcrtc->crtc->y, + drmcrtc->connectors, drmcrtc->num_connectors, &drmcrtc->crtc->mode); if (err) return FALSE; } /* swap the buffers */ - tmp_fb = ksurf->front_fb; - ksurf->front_fb = ksurf->back_fb; - ksurf->back_fb = tmp_fb; + tmp_fb = drmsurf->front_fb; + drmsurf->front_fb = drmsurf->back_fb; + drmsurf->back_fb = tmp_fb; - resource_surface_swap_buffers(ksurf->rsurf, + resource_surface_swap_buffers(drmsurf->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); /* the front/back textures are swapped */ - ksurf->sequence_number++; - kdpy->event_handler->invalid_surface(&kdpy->base, - &ksurf->base, ksurf->sequence_number); + drmsurf->sequence_number++; + drmdpy->event_handler->invalid_surface(&drmdpy->base, + &drmsurf->base, drmsurf->sequence_number); return TRUE; } static void -kms_surface_wait(struct native_surface *nsurf) +drm_surface_wait(struct native_surface *nsurf) { /* no-op */ } static void -kms_surface_destroy(struct native_surface *nsurf) +drm_surface_destroy(struct native_surface *nsurf) { - struct kms_surface *ksurf = kms_surface(nsurf); + struct drm_surface *drmsurf = drm_surface(nsurf); - if (ksurf->current_crtc.crtc) - drmModeFreeCrtc(ksurf->current_crtc.crtc); + if (drmsurf->current_crtc.crtc) + drmModeFreeCrtc(drmsurf->current_crtc.crtc); - if (ksurf->front_fb.buffer_id) - drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id); - pipe_resource_reference(&ksurf->front_fb.texture, NULL); + if (drmsurf->front_fb.buffer_id) + drmModeRmFB(drmsurf->drmdpy->fd, drmsurf->front_fb.buffer_id); + pipe_resource_reference(&drmsurf->front_fb.texture, NULL); - if (ksurf->back_fb.buffer_id) - drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id); - pipe_resource_reference(&ksurf->back_fb.texture, NULL); + if (drmsurf->back_fb.buffer_id) + drmModeRmFB(drmsurf->drmdpy->fd, drmsurf->back_fb.buffer_id); + pipe_resource_reference(&drmsurf->back_fb.texture, NULL); - resource_surface_destroy(ksurf->rsurf); - FREE(ksurf); + resource_surface_destroy(drmsurf->rsurf); + FREE(drmsurf); } -static struct kms_surface * -kms_display_create_surface(struct native_display *ndpy, +static struct drm_surface * +drm_display_create_surface(struct native_display *ndpy, const struct native_config *nconf, uint width, uint height) { - struct kms_display *kdpy = kms_display(ndpy); - struct kms_config *kconf = kms_config(nconf); - struct kms_surface *ksurf; + struct drm_display *drmdpy = drm_display(ndpy); + struct drm_config *drmconf = drm_config(nconf); + struct drm_surface *drmsurf; - ksurf = CALLOC_STRUCT(kms_surface); - if (!ksurf) + drmsurf = CALLOC_STRUCT(drm_surface); + if (!drmsurf) return NULL; - ksurf->kdpy = kdpy; - ksurf->color_format = kconf->base.color_format; - ksurf->width = width; - ksurf->height = height; + drmsurf->drmdpy = drmdpy; + drmsurf->color_format = drmconf->base.color_format; + drmsurf->width = width; + drmsurf->height = height; - ksurf->rsurf = resource_surface_create(kdpy->base.screen, - ksurf->color_format, + drmsurf->rsurf = resource_surface_create(drmdpy->base.screen, + drmsurf->color_format, PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT); - if (!ksurf->rsurf) { - FREE(ksurf); + if (!drmsurf->rsurf) { + FREE(drmsurf); return NULL; } - resource_surface_set_size(ksurf->rsurf, ksurf->width, ksurf->height); + resource_surface_set_size(drmsurf->rsurf, drmsurf->width, drmsurf->height); - ksurf->base.destroy = kms_surface_destroy; - ksurf->base.swap_buffers = kms_surface_swap_buffers; - ksurf->base.flush_frontbuffer = kms_surface_flush_frontbuffer; - ksurf->base.validate = kms_surface_validate; - ksurf->base.wait = kms_surface_wait; + drmsurf->base.destroy = drm_surface_destroy; + drmsurf->base.swap_buffers = drm_surface_swap_buffers; + drmsurf->base.flush_frontbuffer = drm_surface_flush_frontbuffer; + drmsurf->base.validate = drm_surface_validate; + drmsurf->base.wait = drm_surface_wait; - return ksurf; + return drmsurf; } /** * Choose a CRTC that supports all given connectors. */ static uint32_t -kms_display_choose_crtc(struct native_display *ndpy, +drm_display_choose_crtc(struct native_display *ndpy, uint32_t *connectors, int num_connectors) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); int idx; - for (idx = 0; idx < kdpy->resources->count_crtcs; idx++) { + for (idx = 0; idx < drmdpy->resources->count_crtcs; idx++) { boolean found_crtc = TRUE; int i, j; @@ -251,7 +251,7 @@ kms_display_choose_crtc(struct native_display *ndpy, drmModeConnectorPtr connector; int encoder_idx = -1; - connector = drmModeGetConnector(kdpy->fd, connectors[i]); + connector = drmModeGetConnector(drmdpy->fd, connectors[i]); if (!connector) { found_crtc = FALSE; break; @@ -260,7 +260,7 @@ kms_display_choose_crtc(struct native_display *ndpy, /* find an encoder the CRTC supports */ for (j = 0; j < connector->count_encoders; j++) { drmModeEncoderPtr encoder = - drmModeGetEncoder(kdpy->fd, connector->encoders[j]); + drmModeGetEncoder(drmdpy->fd, connector->encoders[j]); if (encoder->possible_crtcs & (1 << idx)) { encoder_idx = j; break; @@ -279,32 +279,32 @@ kms_display_choose_crtc(struct native_display *ndpy, break; } - if (idx >= kdpy->resources->count_crtcs) { + if (idx >= drmdpy->resources->count_crtcs) { _eglLog(_EGL_WARNING, "failed to find a CRTC that supports the given %d connectors", num_connectors); return 0; } - return kdpy->resources->crtcs[idx]; + return drmdpy->resources->crtcs[idx]; } /** * Remember the original CRTC status and set the CRTC */ static boolean -kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, +drm_display_set_crtc(struct native_display *ndpy, int crtc_idx, uint32_t buffer_id, uint32_t x, uint32_t y, uint32_t *connectors, int num_connectors, drmModeModeInfoPtr mode) { - struct kms_display *kdpy = kms_display(ndpy); - struct kms_crtc *kcrtc = &kdpy->saved_crtcs[crtc_idx]; + struct drm_display *drmdpy = drm_display(ndpy); + struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[crtc_idx]; uint32_t crtc_id; int err; - if (kcrtc->crtc) { - crtc_id = kcrtc->crtc->crtc_id; + if (drmcrtc->crtc) { + crtc_id = drmcrtc->crtc->crtc_id; } else { int count = 0, i; @@ -313,39 +313,39 @@ kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, * Choose the CRTC once. It could be more dynamic, but let's keep it * simple for now. */ - crtc_id = kms_display_choose_crtc(&kdpy->base, + crtc_id = drm_display_choose_crtc(&drmdpy->base, connectors, num_connectors); /* save the original CRTC status */ - kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); - if (!kcrtc->crtc) + drmcrtc->crtc = drmModeGetCrtc(drmdpy->fd, crtc_id); + if (!drmcrtc->crtc) return FALSE; - for (i = 0; i < kdpy->num_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - drmModeConnectorPtr connector = kconn->connector; + for (i = 0; i < drmdpy->num_connectors; i++) { + struct drm_connector *drmconn = &drmdpy->connectors[i]; + drmModeConnectorPtr connector = drmconn->connector; drmModeEncoderPtr encoder; - encoder = drmModeGetEncoder(kdpy->fd, connector->encoder_id); + encoder = drmModeGetEncoder(drmdpy->fd, connector->encoder_id); if (encoder) { if (encoder->crtc_id == crtc_id) { - kcrtc->connectors[count++] = connector->connector_id; - if (count >= Elements(kcrtc->connectors)) + drmcrtc->connectors[count++] = connector->connector_id; + if (count >= Elements(drmcrtc->connectors)) break; } drmModeFreeEncoder(encoder); } } - kcrtc->num_connectors = count; + drmcrtc->num_connectors = count; } - err = drmModeSetCrtc(kdpy->fd, crtc_id, buffer_id, x, y, + err = drmModeSetCrtc(drmdpy->fd, crtc_id, buffer_id, x, y, connectors, num_connectors, mode); if (err) { - drmModeFreeCrtc(kcrtc->crtc); - kcrtc->crtc = NULL; - kcrtc->num_connectors = 0; + drmModeFreeCrtc(drmcrtc->crtc); + drmcrtc->crtc = NULL; + drmcrtc->num_connectors = 0; return FALSE; } @@ -354,14 +354,14 @@ kms_display_set_crtc(struct native_display *ndpy, int crtc_idx, } static boolean -kms_display_program(struct native_display *ndpy, int crtc_idx, +drm_display_program(struct native_display *ndpy, int crtc_idx, struct native_surface *nsurf, uint x, uint y, const struct native_connector **nconns, int num_nconns, const struct native_mode *nmode) { - struct kms_display *kdpy = kms_display(ndpy); - struct kms_surface *ksurf = kms_surface(nsurf); - const struct kms_mode *kmode = kms_mode(nmode); + struct drm_display *drmdpy = drm_display(ndpy); + struct drm_surface *drmsurf = drm_surface(nsurf); + const struct drm_mode *drmmode = drm_mode(nmode); uint32_t connector_ids[32]; uint32_t buffer_id; drmModeModeInfo mode_tmp, *mode; @@ -372,13 +372,13 @@ kms_display_program(struct native_display *ndpy, int crtc_idx, num_nconns = Elements(connector_ids); } - if (ksurf) { - if (!kms_surface_init_framebuffers(&ksurf->base, FALSE)) + if (drmsurf) { + if (!drm_surface_init_framebuffers(&drmsurf->base, FALSE)) return FALSE; - buffer_id = ksurf->front_fb.buffer_id; + buffer_id = drmsurf->front_fb.buffer_id; /* the mode argument of drmModeSetCrtc is not constified */ - mode_tmp = kmode->mode; + mode_tmp = drmmode->mode; mode = &mode_tmp; } else { @@ -389,94 +389,94 @@ kms_display_program(struct native_display *ndpy, int crtc_idx, } for (i = 0; i < num_nconns; i++) { - struct kms_connector *kconn = kms_connector(nconns[i]); - connector_ids[i] = kconn->connector->connector_id; + struct drm_connector *drmconn = drm_connector(nconns[i]); + connector_ids[i] = drmconn->connector->connector_id; } - if (!kms_display_set_crtc(&kdpy->base, crtc_idx, buffer_id, x, y, + if (!drm_display_set_crtc(&drmdpy->base, crtc_idx, buffer_id, x, y, connector_ids, num_nconns, mode)) { _eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx); return FALSE; } - if (kdpy->shown_surfaces[crtc_idx]) - kdpy->shown_surfaces[crtc_idx]->is_shown = FALSE; - kdpy->shown_surfaces[crtc_idx] = ksurf; + if (drmdpy->shown_surfaces[crtc_idx]) + drmdpy->shown_surfaces[crtc_idx]->is_shown = FALSE; + drmdpy->shown_surfaces[crtc_idx] = drmsurf; /* remember the settings for buffer swapping */ - if (ksurf) { - uint32_t crtc_id = kdpy->saved_crtcs[crtc_idx].crtc->crtc_id; - struct kms_crtc *kcrtc = &ksurf->current_crtc; + if (drmsurf) { + uint32_t crtc_id = drmdpy->saved_crtcs[crtc_idx].crtc->crtc_id; + struct drm_crtc *drmcrtc = &drmsurf->current_crtc; - if (kcrtc->crtc) - drmModeFreeCrtc(kcrtc->crtc); - kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id); + if (drmcrtc->crtc) + drmModeFreeCrtc(drmcrtc->crtc); + drmcrtc->crtc = drmModeGetCrtc(drmdpy->fd, crtc_id); - assert(num_nconns < Elements(kcrtc->connectors)); - memcpy(kcrtc->connectors, connector_ids, + assert(num_nconns < Elements(drmcrtc->connectors)); + memcpy(drmcrtc->connectors, connector_ids, sizeof(*connector_ids) * num_nconns); - kcrtc->num_connectors = num_nconns; + drmcrtc->num_connectors = num_nconns; - ksurf->is_shown = TRUE; + drmsurf->is_shown = TRUE; } return TRUE; } static const struct native_mode ** -kms_display_get_modes(struct native_display *ndpy, +drm_display_get_modes(struct native_display *ndpy, const struct native_connector *nconn, int *num_modes) { - struct kms_display *kdpy = kms_display(ndpy); - struct kms_connector *kconn = kms_connector(nconn); + struct drm_display *drmdpy = drm_display(ndpy); + struct drm_connector *drmconn = drm_connector(nconn); const struct native_mode **nmodes_return; int count, i; /* delete old data */ - if (kconn->connector) { - drmModeFreeConnector(kconn->connector); - FREE(kconn->kms_modes); + if (drmconn->connector) { + drmModeFreeConnector(drmconn->connector); + FREE(drmconn->drm_modes); - kconn->connector = NULL; - kconn->kms_modes = NULL; - kconn->num_modes = 0; + drmconn->connector = NULL; + drmconn->drm_modes = NULL; + drmconn->num_modes = 0; } /* detect again */ - kconn->connector = drmModeGetConnector(kdpy->fd, kconn->connector_id); - if (!kconn->connector) + drmconn->connector = drmModeGetConnector(drmdpy->fd, drmconn->connector_id); + if (!drmconn->connector) return NULL; - count = kconn->connector->count_modes; - kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes)); - if (!kconn->kms_modes) { - drmModeFreeConnector(kconn->connector); - kconn->connector = NULL; + count = drmconn->connector->count_modes; + drmconn->drm_modes = CALLOC(count, sizeof(*drmconn->drm_modes)); + if (!drmconn->drm_modes) { + drmModeFreeConnector(drmconn->connector); + drmconn->connector = NULL; return NULL; } for (i = 0; i < count; i++) { - struct kms_mode *kmode = &kconn->kms_modes[i]; - drmModeModeInfoPtr mode = &kconn->connector->modes[i]; + struct drm_mode *drmmode = &drmconn->drm_modes[i]; + drmModeModeInfoPtr mode = &drmconn->connector->modes[i]; - kmode->mode = *mode; + drmmode->mode = *mode; - kmode->base.desc = kmode->mode.name; - kmode->base.width = kmode->mode.hdisplay; - kmode->base.height = kmode->mode.vdisplay; - kmode->base.refresh_rate = kmode->mode.vrefresh; + drmmode->base.desc = drmmode->mode.name; + drmmode->base.width = drmmode->mode.hdisplay; + drmmode->base.height = drmmode->mode.vdisplay; + drmmode->base.refresh_rate = drmmode->mode.vrefresh; /* not all kernels have vrefresh = refresh_rate * 1000 */ - if (kmode->base.refresh_rate > 1000) - kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000; + if (drmmode->base.refresh_rate > 1000) + drmmode->base.refresh_rate = (drmmode->base.refresh_rate + 500) / 1000; } nmodes_return = MALLOC(count * sizeof(*nmodes_return)); if (nmodes_return) { for (i = 0; i < count; i++) - nmodes_return[i] = &kconn->kms_modes[i].base; + nmodes_return[i] = &drmconn->drm_modes[i].base; if (num_modes) *num_modes = count; } @@ -485,135 +485,135 @@ kms_display_get_modes(struct native_display *ndpy, } static const struct native_connector ** -kms_display_get_connectors(struct native_display *ndpy, int *num_connectors, +drm_display_get_connectors(struct native_display *ndpy, int *num_connectors, int *num_crtc) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); const struct native_connector **connectors; int i; - if (!kdpy->connectors) { - kdpy->connectors = - CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors)); - if (!kdpy->connectors) + if (!drmdpy->connectors) { + drmdpy->connectors = + CALLOC(drmdpy->resources->count_connectors, sizeof(*drmdpy->connectors)); + if (!drmdpy->connectors) return NULL; - for (i = 0; i < kdpy->resources->count_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; + for (i = 0; i < drmdpy->resources->count_connectors; i++) { + struct drm_connector *drmconn = &drmdpy->connectors[i]; - kconn->connector_id = kdpy->resources->connectors[i]; - /* kconn->connector is allocated when the modes are asked */ + drmconn->connector_id = drmdpy->resources->connectors[i]; + /* drmconn->connector is allocated when the modes are asked */ } - kdpy->num_connectors = kdpy->resources->count_connectors; + drmdpy->num_connectors = drmdpy->resources->count_connectors; } - connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors)); + connectors = MALLOC(drmdpy->num_connectors * sizeof(*connectors)); if (connectors) { - for (i = 0; i < kdpy->num_connectors; i++) - connectors[i] = &kdpy->connectors[i].base; + for (i = 0; i < drmdpy->num_connectors; i++) + connectors[i] = &drmdpy->connectors[i].base; if (num_connectors) - *num_connectors = kdpy->num_connectors; + *num_connectors = drmdpy->num_connectors; } if (num_crtc) - *num_crtc = kdpy->resources->count_crtcs; + *num_crtc = drmdpy->resources->count_crtcs; return connectors; } static struct native_surface * -kms_display_create_scanout_surface(struct native_display *ndpy, +drm_display_create_scanout_surface(struct native_display *ndpy, const struct native_config *nconf, uint width, uint height) { - struct kms_surface *ksurf; + struct drm_surface *drmsurf; - ksurf = kms_display_create_surface(ndpy, nconf, width, height); - return &ksurf->base; + drmsurf = drm_display_create_surface(ndpy, nconf, width, height); + return &drmsurf->base; } -static struct native_display_modeset kms_display_modeset = { - .get_connectors = kms_display_get_connectors, - .get_modes = kms_display_get_modes, - .create_scanout_surface = kms_display_create_scanout_surface, - .program = kms_display_program +static struct native_display_modeset drm_display_modeset = { + .get_connectors = drm_display_get_connectors, + .get_modes = drm_display_get_modes, + .create_scanout_surface = drm_display_create_scanout_surface, + .program = drm_display_program }; void -kms_display_fini_modeset(struct native_display *ndpy) +drm_display_fini_modeset(struct native_display *ndpy) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); int i; - if (kdpy->connectors) { - for (i = 0; i < kdpy->num_connectors; i++) { - struct kms_connector *kconn = &kdpy->connectors[i]; - if (kconn->connector) { - drmModeFreeConnector(kconn->connector); - FREE(kconn->kms_modes); + if (drmdpy->connectors) { + for (i = 0; i < drmdpy->num_connectors; i++) { + struct drm_connector *drmconn = &drmdpy->connectors[i]; + if (drmconn->connector) { + drmModeFreeConnector(drmconn->connector); + FREE(drmconn->drm_modes); } } - FREE(kdpy->connectors); + FREE(drmdpy->connectors); } - if (kdpy->shown_surfaces) { - FREE(kdpy->shown_surfaces); - kdpy->shown_surfaces = NULL; + if (drmdpy->shown_surfaces) { + FREE(drmdpy->shown_surfaces); + drmdpy->shown_surfaces = NULL; } - if (kdpy->saved_crtcs) { - for (i = 0; i < kdpy->resources->count_crtcs; i++) { - struct kms_crtc *kcrtc = &kdpy->saved_crtcs[i]; + if (drmdpy->saved_crtcs) { + for (i = 0; i < drmdpy->resources->count_crtcs; i++) { + struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[i]; - if (kcrtc->crtc) { + if (drmcrtc->crtc) { /* restore crtc */ - drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id, - kcrtc->crtc->buffer_id, kcrtc->crtc->x, kcrtc->crtc->y, - kcrtc->connectors, kcrtc->num_connectors, - &kcrtc->crtc->mode); + drmModeSetCrtc(drmdpy->fd, drmcrtc->crtc->crtc_id, + drmcrtc->crtc->buffer_id, drmcrtc->crtc->x, drmcrtc->crtc->y, + drmcrtc->connectors, drmcrtc->num_connectors, + &drmcrtc->crtc->mode); - drmModeFreeCrtc(kcrtc->crtc); + drmModeFreeCrtc(drmcrtc->crtc); } } - FREE(kdpy->saved_crtcs); + FREE(drmdpy->saved_crtcs); } - if (kdpy->resources) { - drmModeFreeResources(kdpy->resources); - kdpy->resources = NULL; + if (drmdpy->resources) { + drmModeFreeResources(drmdpy->resources); + drmdpy->resources = NULL; } - kdpy->base.modeset = NULL; + drmdpy->base.modeset = NULL; } boolean -kms_display_init_modeset(struct native_display *ndpy) +drm_display_init_modeset(struct native_display *ndpy) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); /* resources are fixed, unlike crtc, connector, or encoder */ - kdpy->resources = drmModeGetResources(kdpy->fd); - if (!kdpy->resources) { + drmdpy->resources = drmModeGetResources(drmdpy->fd); + if (!drmdpy->resources) { _eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset."); return FALSE; } - kdpy->saved_crtcs = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs)); - if (!kdpy->saved_crtcs) { - kms_display_fini_modeset(&kdpy->base); + drmdpy->saved_crtcs = + CALLOC(drmdpy->resources->count_crtcs, sizeof(*drmdpy->saved_crtcs)); + if (!drmdpy->saved_crtcs) { + drm_display_fini_modeset(&drmdpy->base); return FALSE; } - kdpy->shown_surfaces = - CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces)); - if (!kdpy->shown_surfaces) { - kms_display_fini_modeset(&kdpy->base); + drmdpy->shown_surfaces = + CALLOC(drmdpy->resources->count_crtcs, sizeof(*drmdpy->shown_surfaces)); + if (!drmdpy->shown_surfaces) { + drm_display_fini_modeset(&drmdpy->base); return FALSE; } - kdpy->base.modeset = &kms_display_modeset; + drmdpy->base.modeset = &drm_display_modeset; return TRUE; } diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c index 8ffdde66ba8..f6dc5584370 100644 --- a/src/gallium/state_trackers/egl/drm/native_drm.c +++ b/src/gallium/state_trackers/egl/drm/native_drm.c @@ -37,7 +37,7 @@ #include "radeon/drm/radeon_drm.h" static boolean -kms_display_is_format_supported(struct native_display *ndpy, +drm_display_is_format_supported(struct native_display *ndpy, enum pipe_format fmt, boolean is_color) { return ndpy->screen->is_format_supported(ndpy->screen, @@ -47,48 +47,48 @@ kms_display_is_format_supported(struct native_display *ndpy, } static const struct native_config ** -kms_display_get_configs(struct native_display *ndpy, int *num_configs) +drm_display_get_configs(struct native_display *ndpy, int *num_configs) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); const struct native_config **configs; /* first time */ - if (!kdpy->config) { + if (!drmdpy->config) { struct native_config *nconf; enum pipe_format format; - kdpy->config = CALLOC(1, sizeof(*kdpy->config)); - if (!kdpy->config) + drmdpy->config = CALLOC(1, sizeof(*drmdpy->config)); + if (!drmdpy->config) return NULL; - nconf = &kdpy->config->base; + nconf = &drmdpy->config->base; nconf->buffer_mask = (1 << NATIVE_ATTACHMENT_FRONT_LEFT) | (1 << NATIVE_ATTACHMENT_BACK_LEFT); format = PIPE_FORMAT_B8G8R8A8_UNORM; - if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) { + if (!drm_display_is_format_supported(&drmdpy->base, format, TRUE)) { format = PIPE_FORMAT_A8R8G8B8_UNORM; - if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) + if (!drm_display_is_format_supported(&drmdpy->base, format, TRUE)) format = PIPE_FORMAT_NONE; } if (format == PIPE_FORMAT_NONE) { - FREE(kdpy->config); - kdpy->config = NULL; + FREE(drmdpy->config); + drmdpy->config = NULL; return NULL; } nconf->color_format = format; /* support KMS */ - if (kdpy->resources) + if (drmdpy->resources) nconf->scanout_bit = TRUE; } configs = MALLOC(sizeof(*configs)); if (configs) { - configs[0] = &kdpy->config->base; + configs[0] = &drmdpy->config->base; if (num_configs) *num_configs = 1; } @@ -97,7 +97,7 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs) } static int -kms_display_get_param(struct native_display *ndpy, +drm_display_get_param(struct native_display *ndpy, enum native_param_type param) { int val; @@ -112,22 +112,22 @@ kms_display_get_param(struct native_display *ndpy, } static void -kms_display_destroy(struct native_display *ndpy) +drm_display_destroy(struct native_display *ndpy) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); - if (kdpy->config) - FREE(kdpy->config); + if (drmdpy->config) + FREE(drmdpy->config); - kms_display_fini_modeset(&kdpy->base); + drm_display_fini_modeset(&drmdpy->base); - if (kdpy->base.screen) - kdpy->base.screen->destroy(kdpy->base.screen); + if (drmdpy->base.screen) + drmdpy->base.screen->destroy(drmdpy->base.screen); - if (kdpy->fd >= 0) - close(kdpy->fd); + if (drmdpy->fd >= 0) + close(drmdpy->fd); - FREE(kdpy); + FREE(drmdpy); } static const char * @@ -155,26 +155,26 @@ get_drm_screen_name(int fd, drmVersionPtr version) * Initialize KMS and pipe screen. */ static boolean -kms_display_init_screen(struct native_display *ndpy) +drm_display_init_screen(struct native_display *ndpy) { - struct kms_display *kdpy = kms_display(ndpy); + struct drm_display *drmdpy = drm_display(ndpy); drmVersionPtr version; const char *name; - version = drmGetVersion(kdpy->fd); + version = drmGetVersion(drmdpy->fd); if (!version) { - _eglLog(_EGL_WARNING, "invalid fd %d", kdpy->fd); + _eglLog(_EGL_WARNING, "invalid fd %d", drmdpy->fd); return FALSE; } - name = get_drm_screen_name(kdpy->fd, version); + name = get_drm_screen_name(drmdpy->fd, version); if (name) { - kdpy->base.screen = - kdpy->event_handler->new_drm_screen(&kdpy->base, name, kdpy->fd); + drmdpy->base.screen = + drmdpy->event_handler->new_drm_screen(&drmdpy->base, name, drmdpy->fd); } drmFreeVersion(version); - if (!kdpy->base.screen) { + if (!drmdpy->base.screen) { _eglLog(_EGL_WARNING, "failed to create DRM screen"); return FALSE; } @@ -183,31 +183,31 @@ kms_display_init_screen(struct native_display *ndpy) } static struct native_display * -kms_create_display(int fd, struct native_event_handler *event_handler, +drm_create_display(int fd, struct native_event_handler *event_handler, void *user_data) { - struct kms_display *kdpy; + struct drm_display *drmdpy; - kdpy = CALLOC_STRUCT(kms_display); - if (!kdpy) + drmdpy = CALLOC_STRUCT(drm_display); + if (!drmdpy) return NULL; - kdpy->fd = fd; - kdpy->event_handler = event_handler; - kdpy->base.user_data = user_data; + drmdpy->fd = fd; + drmdpy->event_handler = event_handler; + drmdpy->base.user_data = user_data; - if (!kms_display_init_screen(&kdpy->base)) { - kms_display_destroy(&kdpy->base); + if (!drm_display_init_screen(&drmdpy->base)) { + drm_display_destroy(&drmdpy->base); return NULL; } - kdpy->base.destroy = kms_display_destroy; - kdpy->base.get_param = kms_display_get_param; - kdpy->base.get_configs = kms_display_get_configs; + drmdpy->base.destroy = drm_display_destroy; + drmdpy->base.get_param = drm_display_get_param; + drmdpy->base.get_configs = drm_display_get_configs; - kms_display_init_modeset(&kdpy->base); + drm_display_init_modeset(&drmdpy->base); - return &kdpy->base; + return &drmdpy->base; } static struct native_display * @@ -225,7 +225,7 @@ native_create_display(void *dpy, struct native_event_handler *event_handler, if (fd < 0) return NULL; - return kms_create_display(fd, event_handler, user_data); + return drm_create_display(fd, event_handler, user_data); } static const struct native_platform drm_platform = { diff --git a/src/gallium/state_trackers/egl/drm/native_drm.h b/src/gallium/state_trackers/egl/drm/native_drm.h index 3a9b1a67887..03c4fe01dc1 100644 --- a/src/gallium/state_trackers/egl/drm/native_drm.h +++ b/src/gallium/state_trackers/egl/drm/native_drm.h @@ -23,8 +23,8 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef _NATIVE_KMS_H_ -#define _NATIVE_KMS_H_ +#ifndef _NATIVE_DRM_H_ +#define _NATIVE_DRM_H_ #include #include @@ -37,110 +37,110 @@ #include "common/native.h" #include "common/native_helper.h" -struct kms_config; -struct kms_crtc; -struct kms_connector; -struct kms_mode; -struct kms_surface; +struct drm_config; +struct drm_crtc; +struct drm_connector; +struct drm_mode; +struct drm_surface; -struct kms_display { +struct drm_display { struct native_display base; struct native_event_handler *event_handler; int fd; - struct kms_config *config; + struct drm_config *config; /* for modesetting */ drmModeResPtr resources; - struct kms_connector *connectors; + struct drm_connector *connectors; int num_connectors; - struct kms_surface **shown_surfaces; + struct drm_surface **shown_surfaces; /* save the original settings of the CRTCs */ - struct kms_crtc *saved_crtcs; + struct drm_crtc *saved_crtcs; }; -struct kms_config { +struct drm_config { struct native_config base; }; -struct kms_crtc { +struct drm_crtc { drmModeCrtcPtr crtc; uint32_t connectors[32]; int num_connectors; }; -struct kms_framebuffer { +struct drm_framebuffer { struct pipe_resource *texture; boolean is_passive; uint32_t buffer_id; }; -struct kms_surface { +struct drm_surface { struct native_surface base; - struct kms_display *kdpy; + struct drm_display *drmdpy; struct resource_surface *rsurf; enum pipe_format color_format; int width, height; unsigned int sequence_number; - struct kms_framebuffer front_fb, back_fb; + struct drm_framebuffer front_fb, back_fb; boolean is_shown; - struct kms_crtc current_crtc; + struct drm_crtc current_crtc; }; -struct kms_connector { +struct drm_connector { struct native_connector base; uint32_t connector_id; drmModeConnectorPtr connector; - struct kms_mode *kms_modes; + struct drm_mode *drm_modes; int num_modes; }; -struct kms_mode { +struct drm_mode { struct native_mode base; drmModeModeInfo mode; }; -static INLINE struct kms_display * -kms_display(const struct native_display *ndpy) +static INLINE struct drm_display * +drm_display(const struct native_display *ndpy) { - return (struct kms_display *) ndpy; + return (struct drm_display *) ndpy; } -static INLINE struct kms_config * -kms_config(const struct native_config *nconf) +static INLINE struct drm_config * +drm_config(const struct native_config *nconf) { - return (struct kms_config *) nconf; + return (struct drm_config *) nconf; } -static INLINE struct kms_surface * -kms_surface(const struct native_surface *nsurf) +static INLINE struct drm_surface * +drm_surface(const struct native_surface *nsurf) { - return (struct kms_surface *) nsurf; + return (struct drm_surface *) nsurf; } -static INLINE struct kms_connector * -kms_connector(const struct native_connector *nconn) +static INLINE struct drm_connector * +drm_connector(const struct native_connector *nconn) { - return (struct kms_connector *) nconn; + return (struct drm_connector *) nconn; } -static INLINE struct kms_mode * -kms_mode(const struct native_mode *nmode) +static INLINE struct drm_mode * +drm_mode(const struct native_mode *nmode) { - return (struct kms_mode *) nmode; + return (struct drm_mode *) nmode; } boolean -kms_display_init_modeset(struct native_display *ndpy); +drm_display_init_modeset(struct native_display *ndpy); void -kms_display_fini_modeset(struct native_display *ndpy); +drm_display_fini_modeset(struct native_display *ndpy); -#endif /* _NATIVE_KMS_H_ */ +#endif /* _NATIVE_DRM_H_ */ -- cgit v1.2.3 From a1d9a58b825825723f1c5f7705f2ed3ef834038a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 19:27:30 +0200 Subject: r600g: Flush upload buffers before draws instead of before flushes. If a upload buffer is used by a previous draw that's still in the CS, accessing it would need a context flush. However, doing a context flush when mapping the upload buffer would then flush/destroy the same buffer we're trying to map there. Flushing the upload buffers before a draw avoids both the CS flush and the upload buffer going away while it's being used. Note that u_upload_data() could e.g. use a pool of buffers instead of allocating new ones all the time if that turns out to be a significant issue. --- src/gallium/drivers/r600/r600_context.c | 4 ---- src/gallium/drivers/r600/r600_draw.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 776dc24569b..f07cbfc2ccf 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -70,10 +70,6 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; - /* flush upload buffers */ - u_upload_flush(rctx->upload_vb); - u_upload_flush(rctx->upload_ib); - /* suspend queries */ r600_queries_suspend(ctx); diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index cbfa44868e8..00a6aeaef25 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "radeon.h" #include "r600_screen.h" #include "r600_context.h" @@ -125,6 +126,10 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) memset(&draw, 0, sizeof(draw)); + /* flush upload buffers */ + u_upload_flush(rctx->upload_vb); + u_upload_flush(rctx->upload_ib); + if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); rctx->any_user_vbs = false; -- cgit v1.2.3 From b68030e9f8211e5905c81b4c7f8de5780f48b655 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 19:27:30 +0200 Subject: r600g: Check for other references before checking for existing mappings in radeon_bo_pb_map_internal(). Having a non-NULL data pointer doesn't imply it's safe to reuse that mapping, it may have been unmapped but not flushed yet. --- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 65ba96233d5..8cf6a781306 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -53,11 +53,16 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, unsigned flags, void *ctx) { struct radeon_bo_pb *buf = radeon_bo_pb(_buf); - - if (flags & PB_USAGE_DONTBLOCK) { - if (p_atomic_read(&buf->bo->reference.count) > 1) + + if (p_atomic_read(&buf->bo->reference.count) > 1) { + if (flags & PB_USAGE_DONTBLOCK) { return NULL; + } + if (ctx) { + r600_flush_ctx(ctx); + } } + if (buf->bo->data != NULL) { LIST_DELINIT(&buf->maplist); return buf->bo->data; @@ -69,9 +74,6 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, return NULL; } - if (p_atomic_read(&buf->bo->reference.count) > 1 && ctx) { - r600_flush_ctx(ctx); - } if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { return NULL; } -- cgit v1.2.3 From de9c8015eb30bf8a7e8571e7ca85e985173b0695 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 19:27:30 +0200 Subject: r600g: Remove a redundant flush in r600_texture_transfer_map(). radeon_ws_bo_map() will already take care of that if needed. --- src/gallium/drivers/r600/r600_texture.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 274679d1274..b7a12edc20b 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -325,7 +325,6 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, char *map; int r; - ctx->flush(ctx, 0, NULL); if (rtransfer->linear_texture) { bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; } else { -- cgit v1.2.3 From affd46cc2bb327490fbc6a96f936dccf82d4996d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 19:27:30 +0200 Subject: r600g: Buffer object maps imply a wait. Unless e.g. PB_USAGE_DONTBLOCK or PB_USAGE_UNSYNCHRONIZED would be specified. --- src/gallium/drivers/r600/r600.h | 21 --------------------- src/gallium/drivers/r600/r600_query.c | 1 - src/gallium/drivers/r600/r600_texture.c | 1 - src/gallium/drivers/r600/radeon.h | 1 - src/gallium/winsys/r600/drm/radeon_bo_pb.c | 20 +++++++++++++------- src/gallium/winsys/r600/drm/radeon_ws_bo.c | 11 ----------- 6 files changed, 13 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index bce2707e770..7cbacea89a1 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -92,26 +92,6 @@ enum radeon_family { enum radeon_family r600_get_family(struct radeon *rw); -/* - * radeon object functions - */ -#if 0 -struct radeon_bo { - unsigned refcount; - unsigned handle; - unsigned size; - unsigned alignment; - unsigned map_count; - void *data; -}; -struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, - unsigned size, unsigned alignment, void *ptr); -int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); -struct radeon_bo *radeon_bo_incref(struct radeon *radeon, struct radeon_bo *bo); -struct radeon_bo *radeon_bo_decref(struct radeon *radeon, struct radeon_bo *bo); -int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); -#endif /* lowlevel WS bo */ struct radeon_ws_bo; struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon, @@ -122,7 +102,6 @@ void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo); void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, struct radeon_ws_bo *src); -int radeon_ws_bo_wait(struct radeon *radeon, struct radeon_ws_bo *bo); /* R600/R700 STATES */ #define R600_GROUP_MAX 16 diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 12900cce114..298cc4eadd5 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -108,7 +108,6 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer u32 *results; int i; - radeon_ws_bo_wait(rscreen->rw, rquery->buffer); results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, r600_context(ctx)); for (i = 0; i < rquery->num_results; i += 4) { start = (u64)results[i] | (u64)results[i + 1] << 32; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index b7a12edc20b..d41150c9384 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -347,7 +347,6 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, if (!map) { return NULL; } - radeon_ws_bo_wait(radeon, bo); return map + offset; } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 5f9f21db1b4..5249194eb19 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -100,7 +100,6 @@ void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo); void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, struct radeon_ws_bo *src); -int radeon_ws_bo_wait(struct radeon *radeon, struct radeon_ws_bo *bo); struct radeon_stype_info; /* diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 8cf6a781306..b8744b00eb4 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -63,20 +63,26 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, } } - if (buf->bo->data != NULL) { - LIST_DELINIT(&buf->maplist); - return buf->bo->data; - } - if (flags & PB_USAGE_DONTBLOCK) { uint32_t domain; if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain)) return NULL; } - if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { - return NULL; + if (buf->bo->data != NULL) { + if (radeon_bo_wait(buf->mgr->radeon, buf->bo)) { + return NULL; + } + } else { + if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { + return NULL; + } + if (radeon_bo_wait(buf->mgr->radeon, buf->bo)) { + radeon_bo_unmap(buf->mgr->radeon, buf->bo); + return NULL; + } } + LIST_DELINIT(&buf->maplist); return buf->bo->data; } diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c index 8114526a14a..daaf2cbc51a 100644 --- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c @@ -72,17 +72,6 @@ void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, *dst = src; } -int radeon_ws_bo_wait(struct radeon *radeon, struct radeon_ws_bo *pb_bo) -{ - /* TODO */ - struct radeon_bo *bo; - bo = radeon_bo_pb_get_bo(pb_bo->pb); - if (!bo) - return 0; - radeon_bo_wait(radeon, bo); - return 0; -} - unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo) { struct radeon_bo *bo; -- cgit v1.2.3 From a01578c84ffcc03a98b3c3f20d05cdb0e0e4ada7 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 19 Sep 2010 21:48:28 +0200 Subject: auxiliary: fix depth-only and stencil-only clears Depth-only and stencil-only clears should mask out depth/stencil from the output, mask out stencil/input from input, and OR or ADD them together. However, due to a typo they were being ANDed, resulting in zeroing the buffer. --- src/gallium/auxiliary/util/u_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index af99163b2ed..f78b6838a72 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -332,7 +332,7 @@ util_clear_depth_stencil(struct pipe_context *pipe, uint32_t *row = (uint32_t *)dst_map; for (j = 0; j < width; j++) { uint32_t tmp = *row & dst_mask; - *row++ = tmp & (zstencil & ~dst_mask); + *row++ = tmp | (zstencil & ~dst_mask); } dst_map += dst_stride; } -- cgit v1.2.3 From d323118c3ef1ed197e61e7a80e0ddafbe9e70ecb Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 19 Sep 2010 09:03:11 +0200 Subject: gallium/docs: Fixed a typo in the SCS opcode description. Signed-off-by: Tilman Sauerbeck --- src/gallium/docs/source/tgsi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index e588c5b7bd8..4c1f47ac670 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -726,7 +726,7 @@ This instruction replicates its result. dst.z = 0 - dst.y = 1 + dst.w = 1 .. opcode:: TXB - Texture Lookup With Bias -- cgit v1.2.3 From 0f9181811fc0e2943b156acc4d43f2da8a4846d1 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 22:58:42 +0200 Subject: r600g: Respect PB_USAGE_UNSYNCHRONIZED in radeon_bo_pb_map_internal(). --- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index b8744b00eb4..93dc927aba4 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -54,6 +54,14 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, { struct radeon_bo_pb *buf = radeon_bo_pb(_buf); + if (flags & PB_USAGE_UNSYNCHRONIZED) { + if (!buf->bo->data && radeon_bo_map(buf->mgr->radeon, buf->bo)) { + return NULL; + } + LIST_DELINIT(&buf->maplist); + return buf->bo->data; + } + if (p_atomic_read(&buf->bo->reference.count) > 1) { if (flags & PB_USAGE_DONTBLOCK) { return NULL; -- cgit v1.2.3 From 1934ade18309d44f6e98f571674404ecb19d6364 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 22:59:14 +0200 Subject: Revert "r600g: Flush upload buffers before draws instead of before flushes." This reverts commit a1d9a58b825825723f1c5f7705f2ed3ef834038a. Flushing the upload buffers on draw is wrong, uploads aren't supposed to cause flushes in the first place. The real issue was radeon_bo_pb_map_internal() not respecting PB_USAGE_UNSYNCHRONIZED. --- src/gallium/drivers/r600/r600_context.c | 4 ++++ src/gallium/drivers/r600/r600_draw.c | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index f07cbfc2ccf..776dc24569b 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -70,6 +70,10 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; + /* flush upload buffers */ + u_upload_flush(rctx->upload_vb); + u_upload_flush(rctx->upload_ib); + /* suspend queries */ r600_queries_suspend(ctx); diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 00a6aeaef25..cbfa44868e8 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "radeon.h" #include "r600_screen.h" #include "r600_context.h" @@ -126,10 +125,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) memset(&draw, 0, sizeof(draw)); - /* flush upload buffers */ - u_upload_flush(rctx->upload_vb); - u_upload_flush(rctx->upload_ib); - if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); rctx->any_user_vbs = false; -- cgit v1.2.3 From 7faa37adf84c7fdc393a0e795c924ea9b047f235 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 10 Sep 2010 02:15:11 +0200 Subject: rbug: Cast opcode to corrent int size --- src/gallium/auxiliary/rbug/rbug_context.c | 20 ++++++++++---------- src/gallium/auxiliary/rbug/rbug_core.c | 10 +++++----- src/gallium/auxiliary/rbug/rbug_shader.c | 12 ++++++------ src/gallium/auxiliary/rbug/rbug_texture.c | 14 +++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c index 1832425658f..a3fd7e8430e 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.c +++ b/src/gallium/auxiliary/rbug/rbug_context.c @@ -480,7 +480,7 @@ struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_h if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_LIST) return NULL; pos = 0; @@ -506,7 +506,7 @@ struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_h if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_INFO) return NULL; pos = 0; @@ -533,7 +533,7 @@ struct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_BLOCK) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_DRAW_BLOCK) return NULL; pos = 0; @@ -561,7 +561,7 @@ struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rb if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_STEP) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_DRAW_STEP) return NULL; pos = 0; @@ -589,7 +589,7 @@ struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(str if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_UNBLOCK) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_DRAW_UNBLOCK) return NULL; pos = 0; @@ -617,7 +617,7 @@ struct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rb if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_RULE) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_DRAW_RULE) return NULL; pos = 0; @@ -649,7 +649,7 @@ struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_FLUSH) return NULL; pos = 0; @@ -677,7 +677,7 @@ struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST_REPLY) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_LIST_REPLY) return NULL; pos = 0; @@ -705,7 +705,7 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO_REPLY) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_INFO_REPLY) return NULL; pos = 0; @@ -739,7 +739,7 @@ struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(str if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_BLOCKED) + if (header->opcode != (int32_t)RBUG_OP_CONTEXT_DRAW_BLOCKED) return NULL; pos = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_core.c b/src/gallium/auxiliary/rbug/rbug_core.c index 876ae5a0ce6..1d47d13c9f3 100644 --- a/src/gallium/auxiliary/rbug/rbug_core.c +++ b/src/gallium/auxiliary/rbug/rbug_core.c @@ -233,7 +233,7 @@ struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header) if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_NOOP) + if (header->opcode != (int32_t)RBUG_OP_NOOP) return NULL; pos = 0; @@ -259,7 +259,7 @@ struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header) if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_PING) + if (header->opcode != (int32_t)RBUG_OP_PING) return NULL; pos = 0; @@ -285,7 +285,7 @@ struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header) if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_ERROR) + if (header->opcode != (int32_t)RBUG_OP_ERROR) return NULL; pos = 0; @@ -312,7 +312,7 @@ struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_heade if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_PING_REPLY) + if (header->opcode != (int32_t)RBUG_OP_PING_REPLY) return NULL; pos = 0; @@ -339,7 +339,7 @@ struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_hea if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_ERROR_REPLY) + if (header->opcode != (int32_t)RBUG_OP_ERROR_REPLY) return NULL; pos = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_shader.c b/src/gallium/auxiliary/rbug/rbug_shader.c index fccd2f55efd..1742941cc17 100644 --- a/src/gallium/auxiliary/rbug/rbug_shader.c +++ b/src/gallium/auxiliary/rbug/rbug_shader.c @@ -305,7 +305,7 @@ struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_hea if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST) + if (header->opcode != (int32_t)RBUG_OP_SHADER_LIST) return NULL; pos = 0; @@ -332,7 +332,7 @@ struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_hea if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO) + if (header->opcode != (int32_t)RBUG_OP_SHADER_INFO) return NULL; pos = 0; @@ -360,7 +360,7 @@ struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_pro if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_SHADER_DISABLE) + if (header->opcode != (int32_t)RBUG_OP_SHADER_DISABLE) return NULL; pos = 0; @@ -389,7 +389,7 @@ struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_pro if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_SHADER_REPLACE) + if (header->opcode != (int32_t)RBUG_OP_SHADER_REPLACE) return NULL; pos = 0; @@ -418,7 +418,7 @@ struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rb if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST_REPLY) + if (header->opcode != (int32_t)RBUG_OP_SHADER_LIST_REPLY) return NULL; pos = 0; @@ -446,7 +446,7 @@ struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rb if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO_REPLY) + if (header->opcode != (int32_t)RBUG_OP_SHADER_INFO_REPLY) return NULL; pos = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_texture.c b/src/gallium/auxiliary/rbug/rbug_texture.c index 5a918fe6bc0..2ad577915e8 100644 --- a/src/gallium/auxiliary/rbug/rbug_texture.c +++ b/src/gallium/auxiliary/rbug/rbug_texture.c @@ -417,7 +417,7 @@ struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_h if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_LIST) return NULL; pos = 0; @@ -443,7 +443,7 @@ struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_h if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_INFO) return NULL; pos = 0; @@ -470,7 +470,7 @@ struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_WRITE) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_WRITE) return NULL; pos = 0; @@ -506,7 +506,7 @@ struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_h if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_READ) return NULL; pos = 0; @@ -540,7 +540,7 @@ struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST_REPLY) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_LIST_REPLY) return NULL; pos = 0; @@ -568,7 +568,7 @@ struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO_REPLY) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_INFO_REPLY) return NULL; pos = 0; @@ -606,7 +606,7 @@ struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ_REPLY) + if (header->opcode != (int32_t)RBUG_OP_TEXTURE_READ_REPLY) return NULL; pos = 0; -- cgit v1.2.3 From 00272e9e0991c7dab111cbea0acfd6adadece994 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 10 Sep 2010 04:39:26 +0200 Subject: rbug: Add function to get opcode name string --- src/gallium/auxiliary/rbug/rbug_demarshal.c | 64 +++++++++++++++++++++++++++++ src/gallium/auxiliary/rbug/rbug_proto.h | 5 +++ 2 files changed, 69 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c index 47390fbcee7..06caa45469d 100644 --- a/src/gallium/auxiliary/rbug/rbug_demarshal.c +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c @@ -91,3 +91,67 @@ struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) return NULL; } } + +const char* rbug_proto_get_name(enum rbug_opcode opcode) +{ + switch(opcode) { + case RBUG_OP_NOOP: + return "RBUG_OP_NOOP"; + case RBUG_OP_PING: + return "RBUG_OP_PING"; + case RBUG_OP_ERROR: + return "RBUG_OP_ERROR"; + case RBUG_OP_PING_REPLY: + return "RBUG_OP_PING_REPLY"; + case RBUG_OP_ERROR_REPLY: + return "RBUG_OP_ERROR_REPLY"; + case RBUG_OP_TEXTURE_LIST: + return "RBUG_OP_TEXTURE_LIST"; + case RBUG_OP_TEXTURE_INFO: + return "RBUG_OP_TEXTURE_INFO"; + case RBUG_OP_TEXTURE_WRITE: + return "RBUG_OP_TEXTURE_WRITE"; + case RBUG_OP_TEXTURE_READ: + return "RBUG_OP_TEXTURE_READ"; + case RBUG_OP_TEXTURE_LIST_REPLY: + return "RBUG_OP_TEXTURE_LIST_REPLY"; + case RBUG_OP_TEXTURE_INFO_REPLY: + return "RBUG_OP_TEXTURE_INFO_REPLY"; + case RBUG_OP_TEXTURE_READ_REPLY: + return "RBUG_OP_TEXTURE_READ_REPLY"; + case RBUG_OP_CONTEXT_LIST: + return "RBUG_OP_CONTEXT_LIST"; + case RBUG_OP_CONTEXT_INFO: + return "RBUG_OP_CONTEXT_INFO"; + case RBUG_OP_CONTEXT_DRAW_BLOCK: + return "RBUG_OP_CONTEXT_DRAW_BLOCK"; + case RBUG_OP_CONTEXT_DRAW_STEP: + return "RBUG_OP_CONTEXT_DRAW_STEP"; + case RBUG_OP_CONTEXT_DRAW_UNBLOCK: + return "RBUG_OP_CONTEXT_DRAW_UNBLOCK"; + case RBUG_OP_CONTEXT_DRAW_RULE: + return "RBUG_OP_CONTEXT_DRAW_RULE"; + case RBUG_OP_CONTEXT_FLUSH: + return "RBUG_OP_CONTEXT_FLUSH"; + case RBUG_OP_CONTEXT_LIST_REPLY: + return "RBUG_OP_CONTEXT_LIST_REPLY"; + case RBUG_OP_CONTEXT_INFO_REPLY: + return "RBUG_OP_CONTEXT_INFO_REPLY"; + case RBUG_OP_CONTEXT_DRAW_BLOCKED: + return "RBUG_OP_CONTEXT_DRAW_BLOCKED"; + case RBUG_OP_SHADER_LIST: + return "RBUG_OP_SHADER_LIST"; + case RBUG_OP_SHADER_INFO: + return "RBUG_OP_SHADER_INFO"; + case RBUG_OP_SHADER_DISABLE: + return "RBUG_OP_SHADER_DISABLE"; + case RBUG_OP_SHADER_REPLACE: + return "RBUG_OP_SHADER_REPLACE"; + case RBUG_OP_SHADER_LIST_REPLY: + return "RBUG_OP_SHADER_LIST_REPLY"; + case RBUG_OP_SHADER_INFO_REPLY: + return "RBUG_OP_SHADER_INFO_REPLY"; + default: + return NULL; + } +} diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h index 4f3eb75dc4d..2fce725bc9e 100644 --- a/src/gallium/auxiliary/rbug/rbug_proto.h +++ b/src/gallium/auxiliary/rbug/rbug_proto.h @@ -91,4 +91,9 @@ struct rbug_proto_header */ struct rbug_connection; +/** + * Get printable string for opcode. + */ +const char* rbug_proto_get_name(enum rbug_opcode opcode); + #endif -- cgit v1.2.3 From b83156d42fc0230fdbe0a566cc57ed87792ca887 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 19 Sep 2010 22:08:47 +0200 Subject: scons: Link against talloc in the Gallium DRI drivers --- src/gallium/targets/SConscript.dri | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/targets/SConscript.dri b/src/gallium/targets/SConscript.dri index e5981c2461e..bc8d179e3d9 100644 --- a/src/gallium/targets/SConscript.dri +++ b/src/gallium/targets/SConscript.dri @@ -69,6 +69,7 @@ COMMON_DRI_DRM_OBJECTS = [ drienv.AppendUnique(LIBS = [ 'expat', + 'talloc', ]) Export([ -- cgit v1.2.3 From f1cf04dbc0549d1520159be6b4811d6d37ddb5bf Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 20 Sep 2010 09:29:43 +1000 Subject: r600g: fix exports_ps to export a number not a mask. --- src/gallium/drivers/r600/eg_hw_states.c | 2 +- src/gallium/drivers/r600/r600_hw_states.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index ad8aa4ca9a6..65a5c6434b3 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -961,10 +961,10 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) exports_ps |= 1; else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { - exports_ps |= (1 << (num_cout+1)); num_cout++; } } + exports_ps |= (1 << num_cout); if (!exports_ps) { /* always at least export 1 component per pixel */ exports_ps = 2; diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 25344c6f82a..5e43085c620 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -974,10 +974,10 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) exports_ps |= 1; else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { - exports_ps |= (1 << (num_cout+1)); num_cout++; } } + exports_ps |= (num_cout << 1); if (!exports_ps) { /* always at least export 1 component per pixel */ exports_ps = 2; -- cgit v1.2.3 From 91b70d84087967f65aba0ce4f9976d5e2c107f09 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 12 Aug 2010 20:20:23 +1000 Subject: util/r300g: split the r300 index buffer modifier functions out to util These can be used by other drivers, like r600g. Signed-off-by: Dave Airlie --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/util/u_index_modify.c | 127 +++++++++++++++++++++++ src/gallium/auxiliary/util/u_index_modify.h | 41 ++++++++ src/gallium/drivers/r300/r300_render_translate.c | 112 +------------------- 5 files changed, 174 insertions(+), 108 deletions(-) create mode 100644 src/gallium/auxiliary/util/u_index_modify.c create mode 100644 src/gallium/auxiliary/util/u_index_modify.h (limited to 'src') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 2de764c4ee3..c339f72fe29 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -121,6 +121,7 @@ C_SOURCES = \ util/u_handle_table.c \ util/u_hash.c \ util/u_hash_table.c \ + util/u_index_modify.c \ util/u_keymap.c \ util/u_linear.c \ util/u_linkage.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 294df300947..144d929f68c 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -170,6 +170,7 @@ source = [ 'util/u_handle_table.c', 'util/u_hash.c', 'util/u_hash_table.c', + 'util/u_index_modify.c', 'util/u_keymap.c', 'util/u_linear.c', 'util/u_linkage.c', diff --git a/src/gallium/auxiliary/util/u_index_modify.c b/src/gallium/auxiliary/util/u_index_modify.c new file mode 100644 index 00000000000..65b079ed537 --- /dev/null +++ b/src/gallium/auxiliary/util/u_index_modify.c @@ -0,0 +1,127 @@ +/* + * Copyright 2010 Marek Olšák + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. */ + +#include "pipe/p_context.h" +#include "util/u_index_modify.h" +#include "util/u_inlines.h" + +void util_shorten_ubyte_elts(struct pipe_context *context, + struct pipe_resource **elts, + int index_bias, + unsigned start, + unsigned count) +{ + struct pipe_screen* screen = context->screen; + struct pipe_resource* new_elts; + unsigned char *in_map; + unsigned short *out_map; + struct pipe_transfer *src_transfer, *dst_transfer; + unsigned i; + + new_elts = pipe_buffer_create(screen, + PIPE_BIND_INDEX_BUFFER, + 2 * count); + + in_map = pipe_buffer_map(context, *elts, PIPE_TRANSFER_READ, &src_transfer); + out_map = pipe_buffer_map(context, new_elts, PIPE_TRANSFER_WRITE, &dst_transfer); + + in_map += start; + + for (i = 0; i < count; i++) { + *out_map = (unsigned short)(*in_map + index_bias); + in_map++; + out_map++; + } + + pipe_buffer_unmap(context, *elts, src_transfer); + pipe_buffer_unmap(context, new_elts, dst_transfer); + + *elts = new_elts; +} + +void util_rebuild_ushort_elts(struct pipe_context *context, + struct pipe_resource **elts, + int index_bias, + unsigned start, unsigned count) +{ + struct pipe_transfer *in_transfer = NULL; + struct pipe_transfer *out_transfer = NULL; + struct pipe_resource *new_elts; + unsigned short *in_map; + unsigned short *out_map; + unsigned i; + + new_elts = pipe_buffer_create(context->screen, + PIPE_BIND_INDEX_BUFFER, + 2 * count); + + in_map = pipe_buffer_map(context, *elts, + PIPE_TRANSFER_READ, &in_transfer); + out_map = pipe_buffer_map(context, new_elts, + PIPE_TRANSFER_WRITE, &out_transfer); + + in_map += start; + for (i = 0; i < count; i++) { + *out_map = (unsigned short)(*in_map + index_bias); + in_map++; + out_map++; + } + + pipe_buffer_unmap(context, *elts, in_transfer); + pipe_buffer_unmap(context, new_elts, out_transfer); + + *elts = new_elts; +} + +void util_rebuild_uint_elts(struct pipe_context *context, + struct pipe_resource **elts, + int index_bias, + unsigned start, unsigned count) +{ + struct pipe_transfer *in_transfer = NULL; + struct pipe_transfer *out_transfer = NULL; + struct pipe_resource *new_elts; + unsigned int *in_map; + unsigned int *out_map; + unsigned i; + + new_elts = pipe_buffer_create(context->screen, + PIPE_BIND_INDEX_BUFFER, + 2 * count); + + in_map = pipe_buffer_map(context, *elts, + PIPE_TRANSFER_READ, &in_transfer); + out_map = pipe_buffer_map(context, new_elts, + PIPE_TRANSFER_WRITE, &out_transfer); + + in_map += start; + for (i = 0; i < count; i++) { + *out_map = (unsigned int)(*in_map + index_bias); + in_map++; + out_map++; + } + + pipe_buffer_unmap(context, *elts, in_transfer); + pipe_buffer_unmap(context, new_elts, out_transfer); + + *elts = new_elts; +} diff --git a/src/gallium/auxiliary/util/u_index_modify.h b/src/gallium/auxiliary/util/u_index_modify.h new file mode 100644 index 00000000000..01a6cae94fc --- /dev/null +++ b/src/gallium/auxiliary/util/u_index_modify.h @@ -0,0 +1,41 @@ +/* + * Copyright 2010 Marek Olšák + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. */ + +#ifndef UTIL_INDEX_MODIFY_H +#define UTIL_INDEX_MODIFY_H + +void util_shorten_ubyte_elts(struct pipe_context *context, + struct pipe_resource **elts, + int index_bias, + unsigned start, + unsigned count); + +void util_rebuild_ushort_elts(struct pipe_context *context, + struct pipe_resource **elts, + int index_bias, + unsigned start, unsigned count); + +void util_rebuild_uint_elts(struct pipe_context *context, + struct pipe_resource **elts, + int index_bias, + unsigned start, unsigned count); +#endif diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index 0ea11e5bfc2..9247064508f 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -29,6 +29,7 @@ #include "r300_context.h" #include "translate/translate.h" +#include "util/u_index_modify.h" void r300_begin_vertex_translate(struct r300_context *r300) { @@ -188,111 +189,6 @@ void r300_end_vertex_translate(struct r300_context *r300) NULL); } -static void r300_shorten_ubyte_elts(struct r300_context* r300, - struct pipe_resource** elts, - int index_bias, - unsigned start, - unsigned count) -{ - struct pipe_context* context = &r300->context; - struct pipe_screen* screen = r300->context.screen; - struct pipe_resource* new_elts; - unsigned char *in_map; - unsigned short *out_map; - struct pipe_transfer *src_transfer, *dst_transfer; - unsigned i; - - new_elts = pipe_buffer_create(screen, - PIPE_BIND_INDEX_BUFFER, - 2 * count); - - in_map = pipe_buffer_map(context, *elts, PIPE_TRANSFER_READ, &src_transfer); - out_map = pipe_buffer_map(context, new_elts, PIPE_TRANSFER_WRITE, &dst_transfer); - - in_map += start; - - for (i = 0; i < count; i++) { - *out_map = (unsigned short)(*in_map + index_bias); - in_map++; - out_map++; - } - - pipe_buffer_unmap(context, *elts, src_transfer); - pipe_buffer_unmap(context, new_elts, dst_transfer); - - *elts = new_elts; -} - -static void r300_rebuild_ushort_elts(struct r300_context *r300, - struct pipe_resource **elts, - int index_bias, - unsigned start, unsigned count) -{ - struct pipe_context *context = &r300->context; - struct pipe_transfer *in_transfer = NULL; - struct pipe_transfer *out_transfer = NULL; - struct pipe_resource *new_elts; - unsigned short *in_map; - unsigned short *out_map; - unsigned i; - - new_elts = pipe_buffer_create(context->screen, - PIPE_BIND_INDEX_BUFFER, - 2 * count); - - in_map = pipe_buffer_map(context, *elts, - PIPE_TRANSFER_READ, &in_transfer); - out_map = pipe_buffer_map(context, new_elts, - PIPE_TRANSFER_WRITE, &out_transfer); - - in_map += start; - for (i = 0; i < count; i++) { - *out_map = (unsigned short)(*in_map + index_bias); - in_map++; - out_map++; - } - - pipe_buffer_unmap(context, *elts, in_transfer); - pipe_buffer_unmap(context, new_elts, out_transfer); - - *elts = new_elts; -} - -static void r300_rebuild_uint_elts(struct r300_context *r300, - struct pipe_resource **elts, - int index_bias, - unsigned start, unsigned count) -{ - struct pipe_context *context = &r300->context; - struct pipe_transfer *in_transfer = NULL; - struct pipe_transfer *out_transfer = NULL; - struct pipe_resource *new_elts; - unsigned int *in_map; - unsigned int *out_map; - unsigned i; - - new_elts = pipe_buffer_create(context->screen, - PIPE_BIND_INDEX_BUFFER, - 2 * count); - - in_map = pipe_buffer_map(context, *elts, - PIPE_TRANSFER_READ, &in_transfer); - out_map = pipe_buffer_map(context, new_elts, - PIPE_TRANSFER_WRITE, &out_transfer); - - in_map += start; - for (i = 0; i < count; i++) { - *out_map = (unsigned int)(*in_map + index_bias); - in_map++; - out_map++; - } - - pipe_buffer_unmap(context, *elts, in_transfer); - pipe_buffer_unmap(context, new_elts, out_transfer); - - *elts = new_elts; -} - void r300_translate_index_buffer(struct r300_context *r300, struct pipe_resource **index_buffer, unsigned *index_size, unsigned index_offset, @@ -300,21 +196,21 @@ void r300_translate_index_buffer(struct r300_context *r300, { switch (*index_size) { case 1: - r300_shorten_ubyte_elts(r300, index_buffer, index_offset, *start, count); + util_shorten_ubyte_elts(&r300->context, index_buffer, index_offset, *start, count); *index_size = 2; *start = 0; break; case 2: if (*start % 2 != 0 || index_offset) { - r300_rebuild_ushort_elts(r300, index_buffer, index_offset, *start, count); + util_rebuild_ushort_elts(&r300->context, index_buffer, index_offset, *start, count); *start = 0; } break; case 4: if (index_offset) { - r300_rebuild_uint_elts(r300, index_buffer, index_offset, *start, count); + util_rebuild_uint_elts(&r300->context, index_buffer, index_offset, *start, count); *start = 0; } break; -- cgit v1.2.3 From f59fe9671f29f37b02540c21957a673f8dfedc1a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 09:57:47 +1000 Subject: r600g: modify index buffers for sizes the hw can't deal with. this just uses the common code from r300g now in util to do translations on r600g. --- src/gallium/drivers/r600/r600_draw.c | 39 ++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index cbfa44868e8..5cebf67b070 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -31,12 +31,41 @@ #include #include #include +#include #include "radeon.h" #include "r600_screen.h" #include "r600_context.h" #include "r600_resource.h" #include "r600_state_inlines.h" +static void r600_translate_index_buffer(struct r600_context *r600, + struct pipe_resource **index_buffer, + unsigned *index_size, unsigned index_offset, + unsigned *start, unsigned count) +{ + switch (*index_size) { + case 1: + util_shorten_ubyte_elts(&r600->context, index_buffer, index_offset, *start, count); + *index_size = 2; + *start = 0; + break; + + case 2: + if (*start % 2 != 0 || index_offset) { + util_rebuild_ushort_elts(&r600->context, index_buffer, index_offset, *start, count); + *start = 0; + } + break; + + case 4: + if (index_offset) { + util_rebuild_uint_elts(&r600->context, index_buffer, index_offset, *start, count); + *start = 0; + } + break; + } +} + static int r600_draw_common(struct r600_draw *draw) { struct r600_context *rctx = r600_context(draw->ctx); @@ -135,14 +164,20 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; draw.min_index = info->min_index; draw.max_index = info->max_index; + + r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer, + &rctx->index_buffer.index_size, + rctx->index_buffer.offset, &draw.start, + info->count); + + fprintf(stderr,"draw start is %d\n", draw.start); draw.index_size = rctx->index_buffer.index_size; draw.index_buffer = rctx->index_buffer.buffer; draw.index_buffer_offset = rctx->index_buffer.offset; - assert(rctx->index_buffer.offset % - rctx->index_buffer.index_size == 0); r600_upload_index_buffer(rctx, &draw); } else { -- cgit v1.2.3 From 3d12c207d7f9f1d25a0ee7f1bf94ce9a7f70dff3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 10:15:26 +1000 Subject: r600g: send correct surface base update for multi-cbufs --- src/gallium/winsys/r600/drm/r600_state.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index b04885a85f7..57fc12ccf1a 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -335,12 +335,14 @@ static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int static int r600_state_pm4_cb0(struct radeon_state *state) { int r; - + uint32_t sbu; r = r600_state_pm4_generic(state); if (r) return r; + + sbu = (2 << (state->stype->stype - R600_STATE_CB0)); state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); - state->pm4[state->cpm4++] = 0x00000002; + state->pm4[state->cpm4++] = sbu; return 0; } -- cgit v1.2.3 From 4af55364ccb50e4f19cbb59ac6f51d86f58dedba Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 10:34:42 +1000 Subject: r600g: fix fbo-drawbuffers-maxtargets we were leaking buffers since the flush code was added, it wasn't dropping references. move setting up flush to the set_framebuffer_state. clean up the flush state object. make more space in the BOs array for flushing. --- src/gallium/drivers/r600/r600_state.c | 29 ++++++++++++++++++++++------- src/gallium/drivers/r600/radeon.h | 5 ++++- 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 4dcdc492fc1..e347943873c 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -33,6 +33,10 @@ #include "r600_context.h" #include "r600_resource.h" +static void clean_flush(struct r600_context *rctx, struct radeon_state *flush); +static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush); +static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush); + static struct r600_context_state *r600_new_context_state(unsigned type) { struct r600_context_state *rstate = CALLOC_STRUCT(r600_context_state); @@ -379,6 +383,8 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, int i; r600_context_state_decref(rctx->framebuffer); + clean_flush(rctx, &rctx->hw_states.cb_flush); + clean_flush(rctx, &rctx->hw_states.db_flush); rstate = r600_new_context_state(pipe_framebuffer_type); rstate->state.framebuffer = *state; @@ -393,6 +399,10 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, if (state->zsbuf) { rctx->vtbl->db(rctx, &rstate->rstate[0], state); } + /* setup flush states */ + setup_cb_flush(rctx, &rctx->hw_states.cb_flush); + setup_db_flush(rctx, &rctx->hw_states.db_flush); + return; } @@ -554,6 +564,7 @@ struct r600_context_state *r600_context_state_decref(struct r600_context_state * case pipe_framebuffer_type: for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) { pipe_surface_reference(&rstate->state.framebuffer.cbufs[i], NULL); + radeon_state_fini(&rstate->rstate[i+1]); } pipe_surface_reference(&rstate->state.framebuffer.zsbuf, NULL); break; @@ -600,6 +611,17 @@ static void r600_bind_shader_sampler(struct r600_context *rctx, struct r600_shad } } +static void clean_flush(struct r600_context *rctx, struct radeon_state *flush) +{ + struct r600_screen *rscreen = rctx->screen; + int i; + + for (i = 0 ; i < flush->nbo; i++) { + radeon_ws_bo_reference(rscreen->rw, &flush->bo[i], NULL); + } + flush->nbo = 0; + radeon_state_fini(flush); +} static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush) { @@ -658,10 +680,6 @@ int r600_context_hw_states(struct pipe_context *ctx) rctx->vtbl->dsa(rctx, &rctx->hw_states.dsa); rctx->vtbl->cb_cntl(rctx, &rctx->hw_states.cb_cntl); - /* setup flushes */ - setup_db_flush(rctx, &rctx->hw_states.db_flush); - setup_cb_flush(rctx, &rctx->hw_states.cb_flush); - /* bind states */ radeon_draw_bind(&rctx->draw, &rctx->config); @@ -673,9 +691,6 @@ int r600_context_hw_states(struct pipe_context *ctx) radeon_draw_bind(&rctx->draw, &rctx->hw_states.db_flush); radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_flush); - radeon_draw_bind(&rctx->draw, &rctx->hw_states.db_flush); - radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_flush); - if (rctx->viewport) { radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate[0]); } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 5249194eb19..06b5cec5a6e 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -102,6 +102,9 @@ void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, struct radeon_ws_bo *src); struct radeon_stype_info; + +/* currently limited to max buffers in a cb flush */ +#define RADEON_STATE_MAX_BO 8 /* * states functions */ @@ -119,7 +122,7 @@ struct radeon_state { u32 pm4_crc; u32 pm4[128]; unsigned nbo; - struct radeon_ws_bo *bo[4]; + struct radeon_ws_bo *bo[RADEON_STATE_MAX_BO]; unsigned nreloc; unsigned reloc_pm4_id[8]; unsigned reloc_bo_id[8]; -- cgit v1.2.3 From 040411de267bd6b0d82a621430cbbbb943fd455a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 10:44:44 +1000 Subject: r600g: clean up valgrind issues on maxtargets test. --- src/gallium/drivers/r600/r600_state.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e347943873c..2b97c2a94e3 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -382,10 +382,16 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, struct r600_context_state *rstate; int i; - r600_context_state_decref(rctx->framebuffer); + if (rctx->framebuffer) { + for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) + radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[i+1]); + radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[0]); + } clean_flush(rctx, &rctx->hw_states.cb_flush); clean_flush(rctx, &rctx->hw_states.db_flush); + r600_context_state_decref(rctx->framebuffer); + rstate = r600_new_context_state(pipe_framebuffer_type); rstate->state.framebuffer = *state; for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) { -- cgit v1.2.3 From 8d1ec80319bad197665f42b77786b94c3e9337f1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 10:45:18 +1000 Subject: r600g: drop debugging that snuck in --- src/gallium/drivers/r600/r600_draw.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 5cebf67b070..ca205932bd9 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -173,7 +173,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) rctx->index_buffer.offset, &draw.start, info->count); - fprintf(stderr,"draw start is %d\n", draw.start); draw.index_size = rctx->index_buffer.index_size; draw.index_buffer = rctx->index_buffer.buffer; draw.index_buffer_offset = rctx->index_buffer.offset; -- cgit v1.2.3 From 5f5bf25af5c4abeeb2f47f46e9efeeb4f8353b28 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 16:42:29 -0700 Subject: r600g: Use align() instead of handrolled code. --- src/gallium/drivers/r600/eg_hw_states.c | 3 +-- src/gallium/drivers/r600/r600_hw_states.c | 3 +-- src/gallium/drivers/r600/r600_state2.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 65a5c6434b3..e8cf577c76f 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -559,8 +559,7 @@ static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate, rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; - pitch = (tmp->pitch[0] / tmp->bpt); - pitch = (pitch + 0x7) & ~0x7; + pitch = align(tmp->pitch[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD0] = diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 5e43085c620..627a820d59a 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -558,8 +558,7 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; - pitch = (tmp->pitch[0] / tmp->bpt); - pitch = (pitch + 0x7) & ~0x7; + pitch = align(tmp->pitch[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 86c10a877dd..38fab4bbb6d 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -1218,8 +1218,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c bo[1] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); #endif } - pitch = (tmp->pitch[0] / tmp->bpt); - pitch = (pitch + 0x7) & ~0x7; + pitch = align(tmp->pitch[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0, -- cgit v1.2.3 From f76b81423e2ec178edf08df787b8241dae044484 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 17:12:26 -0700 Subject: r600g: Trivially deobfuscate r600_hw_states. --- src/gallium/drivers/r600/r600_hw_states.c | 60 ++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 627a820d59a..17851a9b6e8 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -232,7 +232,8 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta rctx->flat_shade = state->flatshade; radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0); - rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; + rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = + S_0286D4_FLAT_SHADE_ENA(1); if (state->sprite_coord_enable) { rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |= S_0286D4_PNT_SPRITE_ENA(1) | @@ -271,10 +272,10 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005; rstate->states[R600_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000; rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400; - rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000; + rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = fui(1); + rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = fui(1); + rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = fui(1); + rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = fui(1); rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl; rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000; rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale); @@ -314,7 +315,8 @@ static void r600_scissor(struct r600_context *rctx, struct radeon_state *rstate) rstate->states[R600_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000; rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl; rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF; + rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = + S_02820C_CLIP_RULE(0xFFFF); rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl; rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = br; rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl; @@ -339,8 +341,8 @@ static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate struct r600_screen *rscreen = rctx->screen; radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000; - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; + rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = fui(0); + rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = fui(1); rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]); rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]); rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]); @@ -437,7 +439,7 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) } rstate->states[R600_DSA__DB_STENCIL_CLEAR] = 0x00000000; - rstate->states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F800000; + rstate->states[R600_DSA__DB_DEPTH_CLEAR] = fui(1); rstate->states[R600_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control; rstate->states[R600_DSA__DB_STENCILREFMASK] = stencil_ref_mask; rstate->states[R600_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf; @@ -830,21 +832,38 @@ static void r600_init_config(struct r600_context *rctx) rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000; if (family >= CHIP_RV770) { - rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000; + rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = + S_008D8C_VS_PC_LIMIT_ENABLE(1); rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002; rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000; - rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x00420204; + rctx->config.states[R600_CONFIG__DB_WATERMARKS] = + S_009838_DEPTH_FREE(4) | + S_009838_DEPTH_FLUSH(16) | + S_009838_DEPTH_PENDING_FREE(4) | + S_009838_DEPTH_CACHELINE_FREE(4); rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000000; - rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000; + rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00500000 | + S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1) | + S_028A4C_FORCE_EOV_REZ_ENABLE(1); } else { rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000; - rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000003; + rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002 | + S_009508_DISABLE_CUBE_WRAP(1); rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x82000000; - rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x01020204; - rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001; - rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00004010; + rctx->config.states[R600_CONFIG__DB_WATERMARKS] = + S_009838_DEPTH_FREE(4) | + S_009838_DEPTH_FLUSH(16) | + S_009838_DEPTH_PENDING_FREE(4) | + S_009838_DEPTH_CACHELINE_FREE(16); + rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = + S_0286C8_PS_GROUPING(1); + rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = + S_028A4C_WALK_ORDER_ENABLE(1) | + S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1); } - rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = 0x00000003; + rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = + S_0287A0_RT0_ENABLE(1) | + S_0287A0_RT1_ENABLE(1); rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000; @@ -868,7 +887,7 @@ static void r600_init_config(struct r600_context *rctx) rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000; rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000; rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = 0x00000001; + rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = S_028AB4_REUSE_OFF(1); rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000; rctx->config.states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000; radeon_state_pm4(&rctx->config); @@ -986,7 +1005,8 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * if (have_pos) { state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1) | S_0286CC_BARYC_SAMPLE_CNTL(1); - state->states[R600_PS_SHADER__SPI_INPUT_Z] |= 1; + state->states[R600_PS_SHADER__SPI_INPUT_Z] |= + S_0286D8_PROVIDE_Z_TO_SPI(1); } state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; @@ -1170,7 +1190,7 @@ static void r600_texture_state_viewport(struct r600_screen *rscreen, struct r600 rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = 0x3F000000; rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = 0x3F000000; rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; + rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = fui(1); radeon_state_pm4(rstate); } -- cgit v1.2.3 From 7ee9b0b951eed3e1a553b2d8cda6b52dad39f027 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 18:04:41 -0700 Subject: r600g: Deobfuscate and comment a few more functions in r600_hw_states. --- src/gallium/drivers/r600/r600_hw_states.c | 44 +++++++++++++++++++++++-------- src/gallium/drivers/r600/r600d.h | 33 +++++++++++++++++++++++ 2 files changed, 66 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 17851a9b6e8..5ad396dc152 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -197,7 +197,7 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta float offset_units = 0, offset_scale = 0; char depth = 0; unsigned offset_db_fmt_cntl = 0; - unsigned tmp; + unsigned point_size; unsigned prov_vtx = 1; if (rctx->clip) @@ -248,9 +248,18 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta } rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0; if (clip) { - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1); - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp); - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); + /* Clip plane enable bits are stashed in the lower six bits of + * PA_CL_CLIP_CNTL, so just set all of the corresponding bits with a + * pinch of bit twiddling. + * + * PS_UCP_MODE 3 is "expand and clip as trifan," which is the same + * setting that we use on r300-r500. I believe that fglrx always uses + * this mode as well. */ + rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = + ((1 << clip->nr) - 1) | + S_028810_PS_UCP_MODE(3) | + S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp) | + S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); } rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = S_028814_PROVOKING_VTX_LAST(prov_vtx) | @@ -264,14 +273,20 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex); rstate->states[R600_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000; - /* point size 12.4 fixed point */ - tmp = (unsigned)(state->point_size * 8.0); - rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp); - rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000; - rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008; + /* Point size for PA_SU_POINT_SIZE and PA_SU_POINT_MINMAX is fixed-point, + * 12.4. + * + * For some reason, maximum point size is set to 0x8000 (2048.0) instead + * of the maximum value 0xFFF0 (4095.0). */ + point_size = (unsigned)(state->point_size * 8.0); + rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] = + S_028A00_HEIGHT(point_size) | S_028A00_WIDTH(point_size); + rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = + S_028A04_MIN_SIZE(0) | S_028A04_MAX_SIZE(0x8000); + rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = S_028A08_WIDTH(8); rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005; rstate->states[R600_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000; - rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400; + rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = S_028C00_LAST_PIXEL(1); rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = fui(1); rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = fui(1); rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = fui(1); @@ -349,7 +364,14 @@ static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]); rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]); rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]); - rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; + rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = + S_028818_VPORT_X_SCALE_ENA(1) | + S_028818_VPORT_X_OFFSET_ENA(1) | + S_028818_VPORT_Y_SCALE_ENA(1) | + S_028818_VPORT_Y_OFFSET_ENA(1) | + S_028818_VPORT_Z_SCALE_ENA(1) | + S_028818_VPORT_Z_OFFSET_ENA(1) | + S_028818_VTX_W0_FMT(1); radeon_state_pm4(rstate); } diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 07bfc0593e9..3ca3cc764b6 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -2112,6 +2112,9 @@ #define R_0286D4_SPI_INTERP_CONTROL_0 0x0286D4 #define R_028A48_PA_SC_MPASS_PS_CNTL 0x028A48 #define R_028C00_PA_SC_LINE_CNTL 0x028C00 +#define S_028C00_LAST_PIXEL(x) (((x) & 0x1) << 10) +#define G_028C00_LAST_PIXEL(x) (((x) >> 10) & 0x1) +#define C_028C00_LAST_PIXEL 0xFFFFFBFF #define R_028C04_PA_SC_AA_CONFIG 0x028C04 #define R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX 0x028C1C #define R_028C48_PA_SC_AA_MASK 0x028C48 @@ -2125,7 +2128,16 @@ #define R_028814_PA_SU_SC_MODE_CNTL 0x028814 #define R_028A00_PA_SU_POINT_SIZE 0x028A00 #define R_028A04_PA_SU_POINT_MINMAX 0x028A04 +#define S_028A04_MIN_SIZE(x) (((x) & 0xFFFF) << 0) +#define G_028A04_MIN_SIZE(x) (((x) >> 0) & 0xFFFF) +#define C_028A04_MIN_SIZE 0xFFFF0000 +#define S_028A04_MAX_SIZE(x) (((x) & 0xFFFF) << 16) +#define G_028A04_MAX_SIZE(x) (((x) >> 16) & 0xFFFF) +#define C_028A04_MAX_SIZE 0x0000FFFF #define R_028A08_PA_SU_LINE_CNTL 0x028A08 +#define S_028A08_WIDTH(x) (((x) & 0xFFFF) << 0) +#define G_028A08_WIDTH(x) (((x) >> 0) & 0xFFFF) +#define C_028A08_WIDTH 0xFFFF0000 #define R_028A0C_PA_SC_LINE_STIPPLE 0x028A0C #define R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL 0x028DF8 #define R_028DFC_PA_SU_POLY_OFFSET_CLAMP 0x028DFC @@ -2134,6 +2146,27 @@ #define R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE 0x028E08 #define R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET 0x028E0C #define R_028818_PA_CL_VTE_CNTL 0x028818 +#define S_028818_VPORT_X_SCALE_ENA(x) (((x) & 0x1) << 0) +#define G_028818_VPORT_X_SCALE_ENA(x) (((x) >> 0 & 0x1) +#define C_028818_VPORT_X_SCALE_ENA 0xFFFFFFFE +#define S_028818_VPORT_X_OFFSET_ENA(x) (((x) & 0x1) << 1) +#define G_028818_VPORT_X_OFFSET_ENA(x) (((x) >> 1 & 0x1) +#define C_028818_VPORT_X_OFFSET_ENA 0xFFFFFFFD +#define S_028818_VPORT_Y_SCALE_ENA(x) (((x) & 0x1) << 2) +#define G_028818_VPORT_Y_SCALE_ENA(x) (((x) >> 2 & 0x1) +#define C_028818_VPORT_Y_SCALE_ENA 0xFFFFFFFB +#define S_028818_VPORT_Y_OFFSET_ENA(x) (((x) & 0x1) << 3) +#define G_028818_VPORT_Y_OFFSET_ENA(x) (((x) >> 3 & 0x1) +#define C_028818_VPORT_Y_OFFSET_ENA 0xFFFFFFF7 +#define S_028818_VPORT_Z_SCALE_ENA(x) (((x) & 0x1) << 4) +#define G_028818_VPORT_Z_SCALE_ENA(x) (((x) >> 4 & 0x1) +#define C_028818_VPORT_Z_SCALE_ENA 0xFFFFFFEF +#define S_028818_VPORT_Z_OFFSET_ENA(x) (((x) & 0x1) << 5) +#define G_028818_VPORT_Z_OFFSET_ENA(x) (((x) >> 5 & 0x1) +#define C_028818_VPORT_Z_OFFSET_ENA 0xFFFFFFDF +#define S_028818_VTX_W0_FMT(x) (((x) & 0x1) << 10) +#define G_028818_VTX_W0_FMT(x) (((x) >> 10) & 0x1) +#define C_028818_VTX_W0_FMT 0xFFFFFBFF #define R_02843C_PA_CL_VPORT_XSCALE_0 0x02843C #define R_028444_PA_CL_VPORT_YSCALE_0 0x028444 #define R_02844C_PA_CL_VPORT_ZSCALE_0 0x02844C -- cgit v1.2.3 From eb347c7ef06a39b86c6de7c93417b6b90baf0300 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 18:13:41 -0700 Subject: r600g: Clean up some indentation and |= vs. | usage. --- src/gallium/drivers/r600/r600_hw_states.c | 43 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 5ad396dc152..1aefc705a89 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -392,9 +392,8 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) } radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); - db_shader_control = 0; - db_shader_control |= S_02880C_DUAL_EXPORT_ENABLE(1); - db_shader_control |= S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); + db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(1) | + S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); rshader = &rctx->ps_shader->shader; if (rshader->uses_kill) @@ -408,35 +407,37 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | S_028800_Z_WRITE_ENABLE(state->depth.writemask) | S_028800_ZFUNC(state->depth.func); - /* set stencil enable */ + /* set stencil enable */ if (state->stencil[0].enabled) { - db_depth_control |= S_028800_STENCIL_ENABLE(1); - db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)); - db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)); - db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)); - db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); + db_depth_control |= S_028800_STENCIL_ENABLE(1) | + S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)) | + S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)) | + S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)) | + S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) | - S_028430_STENCILWRITEMASK(state->stencil[0].writemask); - stencil_ref_mask |= S_028430_STENCILREF(stencil_ref->ref_value[0]); + S_028430_STENCILWRITEMASK(state->stencil[0].writemask) | + S_028430_STENCILREF(stencil_ref->ref_value[0]); + if (state->stencil[1].enabled) { - db_depth_control |= S_028800_BACKFACE_ENABLE(1); - db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)); - db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)); - db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)); - db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); - stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | - S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask); - stencil_ref_mask_bf |= S_028430_STENCILREF(stencil_ref->ref_value[1]); + db_depth_control |= S_028800_BACKFACE_ENABLE(1) | + S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)) | + S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)) | + S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)) | + S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); + stencil_ref_mask_bf = + S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | + S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask) | + S_028430_STENCILREF(stencil_ref->ref_value[1]); } } alpha_test_control = 0; alpha_ref = 0; if (state->alpha.enabled) { - alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func); - alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1); + alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func) | + S_028410_ALPHA_TEST_ENABLE(1); alpha_ref = fui(state->alpha.ref_value); } -- cgit v1.2.3 From 07b9e22a1f587026672a00a31cebaef5aae964c6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 18:14:41 -0700 Subject: r600g: Fix false and true. --- src/gallium/drivers/r600/eg_hw_states.c | 4 ++-- src/gallium/drivers/r600/r600_context.c | 2 +- src/gallium/drivers/r600/r600_draw.c | 2 +- src/gallium/drivers/r600/r600_hw_states.c | 4 ++-- src/gallium/drivers/r600/r600_query.c | 6 +++--- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_shader.c | 4 ++-- src/gallium/drivers/r600/r600_state2.c | 10 +++++----- 8 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index e8cf577c76f..1d3a3e11c10 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -422,11 +422,11 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); - query_running = false; + query_running = FALSE; LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { if (rquery->state & R600_QUERY_STATE_STARTED) { - query_running = true; + query_running = TRUE; } } diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 776dc24569b..97b21d5e31d 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -80,7 +80,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, radeon_ctx_submit(rctx->ctx); LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { - rquery->flushed = true; + rquery->flushed = TRUE; } radeon_ctx_clear(rctx->ctx); diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index ca205932bd9..51c9b065494 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -156,7 +156,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); - rctx->any_user_vbs = false; + rctx->any_user_vbs = FALSE; } draw.ctx = ctx; diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 1aefc705a89..86bcec727cf 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -447,11 +447,11 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); - query_running = false; + query_running = FALSE; LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { if (rquery->state & R600_QUERY_STATE_STARTED) { - query_running = true; + query_running = TRUE; } } diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 298cc4eadd5..023b09ef657 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -132,7 +132,7 @@ static void r600_query_resume(struct pipe_context *ctx, struct r600_query *rquer r600_query_result(ctx, rquery); } r600_query_begin(rctx, rquery); - rquery->flushed = false; + rquery->flushed = FALSE; } static void r600_query_suspend(struct pipe_context *ctx, struct r600_query *rquery) @@ -151,7 +151,7 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) rquery->state = R600_QUERY_STATE_STARTED; rquery->num_results = 0; - rquery->flushed = false; + rquery->flushed = FALSE; r600_query_resume(ctx, rquery); r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); if (r == -EBUSY) { @@ -231,7 +231,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx, if (!rquery->flushed) { ctx->flush(ctx, 0, NULL); - rquery->flushed = true; + rquery->flushed = TRUE; } r600_query_result(ctx, rquery); *result = rquery->result; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 6ddb1ad32a7..cd1c31e82d0 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -103,7 +103,7 @@ static INLINE struct r600_resource_buffer *r600_buffer(struct pipe_resource *buf static INLINE boolean r600_buffer_is_user_buffer(struct pipe_resource *buffer) { - return r600_buffer(buffer)->user_buffer ? true : false; + return r600_buffer(buffer)->user_buffer ? TRUE : FALSE; } #endif diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index eac46a7ae60..773e5f6cb1c 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1530,7 +1530,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; - src_not_temp = false; + src_not_temp = FALSE; src_gpr = ctx->temp_reg; } @@ -1641,7 +1641,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) r = r600_bc_add_literal(ctx->bc, lit_vals); if (r) return r; - src_not_temp = false; + src_not_temp = FALSE; src_gpr = ctx->temp_reg; } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 38fab4bbb6d..a190204ef47 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -205,7 +205,7 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028894_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); - rctx->vs_rebuild = false; + rctx->vs_rebuild = FALSE; } static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) @@ -275,7 +275,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0x00000000, 0xFFFFFFFF, NULL); - rctx->ps_rebuild = false; + rctx->ps_rebuild = FALSE; } static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) @@ -1082,10 +1082,10 @@ static void r600_bind_rs_state(struct pipe_context *ctx, void *state) return; if (rctx->flatshade != rs->flatshade) { - rctx->ps_rebuild = true; + rctx->ps_rebuild = TRUE; } if (rctx->sprite_coord_enable != rs->sprite_coord_enable) { - rctx->ps_rebuild = true; + rctx->ps_rebuild = TRUE; } rctx->flatshade = rs->flatshade; rctx->sprite_coord_enable = rs->sprite_coord_enable; @@ -1371,7 +1371,7 @@ static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) rctx->vertex_elements = v; if (v) { v->refcount++; - rctx->vs_rebuild = true; + rctx->vs_rebuild = TRUE; } } -- cgit v1.2.3 From c2ba729321b1e36f50027382bb825f3152ecd1d1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 18:20:05 -0700 Subject: r600g: "tmp" is such a bad name for a texture. --- src/gallium/drivers/r600/r600_hw_states.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 86bcec727cf..ed7c6b40a43 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -540,7 +540,7 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, struct r600_context *rctx = r600_context(ctx); struct r600_screen *rscreen = rctx->screen; const struct util_format_description *desc; - struct r600_resource_texture *tmp; + struct r600_resource_texture *texture; struct r600_resource *rbuffer; unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; @@ -564,15 +564,15 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, return; } radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); - tmp = (struct r600_resource_texture*)view->texture; - rbuffer = &tmp->resource; - if (tmp->depth) { - r = r600_texture_from_depth(ctx, tmp, view->first_level); + texture = (struct r600_resource_texture*)view->texture; + rbuffer = &texture->resource; + if (texture->depth) { + r = r600_texture_from_depth(ctx, texture, view->first_level); if (r) { return; } - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], tmp->uncompressed); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], tmp->uncompressed); + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], texture->uncompressed); + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], texture->uncompressed); } else { radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); @@ -583,7 +583,7 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; - pitch = align(tmp->pitch[0] / tmp->bpt, 8); + pitch = align(texture->pitch[0] / texture->bpt, 8); /* FIXME properly handle first level != 0 */ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = @@ -596,8 +596,8 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, S_038004_TEX_HEIGHT(view->texture->height0 - 1) | S_038004_TEX_DEPTH(view->texture->depth0 - 1) | S_038004_DATA_FORMAT(format); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8; - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8; + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = texture->offset[0] >> 8; + rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = texture->offset[1] >> 8; rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | -- cgit v1.2.3 From 9b146eae2521d8e5f6d3cbefa4f6f7737666313a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 11:39:14 +1000 Subject: r600g: fix tiling support for ddx supplied buffers needed to emit some more relocs to the kernel. --- src/gallium/winsys/r600/drm/r600_states.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 50b25a99404..f7ef266f7dc 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -401,7 +401,7 @@ static const struct radeon_register R600_names_GS_SAMPLER_BORDER[] = { static const struct radeon_register R600_names_CB0[] = { {0x00028040, 1, 0, "CB_COLOR0_BASE"}, - {0x000280A0, 0, 0, "CB_COLOR0_INFO"}, + {0x000280A0, 1, 0, "CB_COLOR0_INFO"}, {0x00028060, 0, 0, "CB_COLOR0_SIZE"}, {0x00028080, 0, 0, "CB_COLOR0_VIEW"}, {0x000280E0, 1, 0, "CB_COLOR0_FRAG"}, @@ -411,7 +411,7 @@ static const struct radeon_register R600_names_CB0[] = { static const struct radeon_register R600_names_CB1[] = { {0x00028044, 1, 0, "CB_COLOR1_BASE"}, - {0x000280A4, 0, 0, "CB_COLOR1_INFO"}, + {0x000280A4, 1, 0, "CB_COLOR1_INFO"}, {0x00028064, 0, 0, "CB_COLOR1_SIZE"}, {0x00028084, 0, 0, "CB_COLOR1_VIEW"}, {0x000280E4, 1, 0, "CB_COLOR1_FRAG"}, @@ -421,7 +421,7 @@ static const struct radeon_register R600_names_CB1[] = { static const struct radeon_register R600_names_CB2[] = { {0x00028048, 1, 0, "CB_COLOR2_BASE"}, - {0x000280A8, 0, 0, "CB_COLOR2_INFO"}, + {0x000280A8, 1, 0, "CB_COLOR2_INFO"}, {0x00028068, 0, 0, "CB_COLOR2_SIZE"}, {0x00028088, 0, 0, "CB_COLOR2_VIEW"}, {0x000280E8, 1, 0, "CB_COLOR2_FRAG"}, @@ -431,7 +431,7 @@ static const struct radeon_register R600_names_CB2[] = { static const struct radeon_register R600_names_CB3[] = { {0x0002804C, 1, 0, "CB_COLOR3_BASE"}, - {0x000280AC, 0, 0, "CB_COLOR3_INFO"}, + {0x000280AC, 1, 0, "CB_COLOR3_INFO"}, {0x0002806C, 0, 0, "CB_COLOR3_SIZE"}, {0x0002808C, 0, 0, "CB_COLOR3_VIEW"}, {0x000280EC, 1, 0, "CB_COLOR3_FRAG"}, @@ -441,7 +441,7 @@ static const struct radeon_register R600_names_CB3[] = { static const struct radeon_register R600_names_CB4[] = { {0x00028050, 1, 0, "CB_COLOR4_BASE"}, - {0x000280B0, 0, 0, "CB_COLOR4_INFO"}, + {0x000280B0, 1, 0, "CB_COLOR4_INFO"}, {0x00028070, 0, 0, "CB_COLOR4_SIZE"}, {0x00028090, 0, 0, "CB_COLOR4_VIEW"}, {0x000280F0, 1, 0, "CB_COLOR4_FRAG"}, @@ -451,7 +451,7 @@ static const struct radeon_register R600_names_CB4[] = { static const struct radeon_register R600_names_CB5[] = { {0x00028054, 1, 0, "CB_COLOR5_BASE"}, - {0x000280B4, 0, 0, "CB_COLOR5_INFO"}, + {0x000280B4, 1, 0, "CB_COLOR5_INFO"}, {0x00028074, 0, 0, "CB_COLOR5_SIZE"}, {0x00028094, 0, 0, "CB_COLOR5_VIEW"}, {0x000280F4, 1, 0, "CB_COLOR5_FRAG"}, @@ -461,7 +461,7 @@ static const struct radeon_register R600_names_CB5[] = { static const struct radeon_register R600_names_CB6[] = { {0x00028058, 1, 0, "CB_COLOR6_BASE"}, - {0x000280B8, 0, 0, "CB_COLOR6_INFO"}, + {0x000280B8, 1, 0, "CB_COLOR6_INFO"}, {0x00028078, 0, 0, "CB_COLOR6_SIZE"}, {0x00028098, 0, 0, "CB_COLOR6_VIEW"}, {0x000280F8, 1, 0, "CB_COLOR6_FRAG"}, @@ -471,7 +471,7 @@ static const struct radeon_register R600_names_CB6[] = { static const struct radeon_register R600_names_CB7[] = { {0x0002805C, 1, 0, "CB_COLOR7_BASE"}, - {0x000280BC, 0, 0, "CB_COLOR7_INFO"}, + {0x000280BC, 1, 0, "CB_COLOR7_INFO"}, {0x0002807C, 0, 0, "CB_COLOR7_SIZE"}, {0x0002809C, 0, 0, "CB_COLOR7_VIEW"}, {0x000280FC, 1, 0, "CB_COLOR7_FRAG"}, @@ -483,7 +483,7 @@ static const struct radeon_register R600_names_DB[] = { {0x0002800C, 1, 0, "DB_DEPTH_BASE"}, {0x00028000, 0, 0, "DB_DEPTH_SIZE"}, {0x00028004, 0, 0, "DB_DEPTH_VIEW"}, - {0x00028010, 0, 0, "DB_DEPTH_INFO"}, + {0x00028010, 1, 0, "DB_DEPTH_INFO"}, {0x00028D24, 0, 0, "DB_HTILE_SURFACE"}, {0x00028D34, 0, 0, "DB_PREFETCH_LIMIT"}, }; -- cgit v1.2.3 From 2cabbb290f07dae98fc969725028fdfde0b14b81 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 12:04:52 +1000 Subject: r600g: add z16 to color setup --- src/gallium/drivers/r600/eg_state_inlines.h | 6 ++++++ src/gallium/drivers/r600/r600_state_inlines.h | 7 +++++++ 2 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 4e3514638b7..bee2a8adcff 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -283,6 +283,9 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_B4G4R4A4_UNORM: case PIPE_FORMAT_B4G4R4X4_UNORM: return V_028C70_SWAP_ALT; + + case PIPE_FORMAT_Z16_UNORM: + return V_028C70_SWAP_STD; /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: @@ -357,6 +360,9 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_B4G4R4X4_UNORM: return V_028C70_COLOR_4_4_4_4; + case PIPE_FORMAT_Z16_UNORM: + return V_028C70_COLOR_16; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: case PIPE_FORMAT_A8B8G8R8_UNORM: diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index b4c21d9e126..9ffdd755828 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -283,6 +283,10 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_B4G4R4A4_UNORM: case PIPE_FORMAT_B4G4R4X4_UNORM: return V_0280A0_SWAP_ALT; + + case PIPE_FORMAT_Z16_UNORM: + return V_0280A0_SWAP_STD; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: @@ -357,6 +361,9 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_B4G4R4X4_UNORM: return V_0280A0_COLOR_4_4_4_4; + case PIPE_FORMAT_Z16_UNORM: + return V_0280A0_COLOR_16; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: case PIPE_FORMAT_A8B8G8R8_UNORM: -- cgit v1.2.3 From 3a1defa5e88cc846d8f5ba73ef475af95e7bc4ae Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 12:21:35 +1000 Subject: r600g: add color/texture support for more depth formats. --- src/gallium/drivers/r600/eg_state_inlines.h | 8 ++++++++ src/gallium/drivers/r600/r600_state_inlines.h | 8 ++++++++ src/gallium/drivers/r600/r600_texture.c | 6 ++++-- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index bee2a8adcff..0a42abcdf2b 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -313,6 +313,10 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_Z24_UNORM_S8_USCALED: return V_028C70_SWAP_STD; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + return V_028C70_SWAP_STD; + case PIPE_FORMAT_R10G10B10A2_UNORM: case PIPE_FORMAT_R10G10B10X2_SNORM: case PIPE_FORMAT_B10G10R10A2_UNORM: @@ -389,6 +393,10 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_Z24_UNORM_S8_USCALED: return V_028C70_COLOR_8_24; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + return V_028C70_COLOR_24_8; + case PIPE_FORMAT_R32_FLOAT: return V_028C70_COLOR_32_FLOAT; diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 9ffdd755828..283f1e59b33 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -314,6 +314,10 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_Z24_UNORM_S8_USCALED: return V_0280A0_SWAP_STD; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + return V_0280A0_SWAP_STD; + case PIPE_FORMAT_R10G10B10A2_UNORM: case PIPE_FORMAT_R10G10B10X2_SNORM: case PIPE_FORMAT_B10G10R10A2_UNORM: @@ -390,6 +394,10 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_Z24_UNORM_S8_USCALED: return V_0280A0_COLOR_8_24; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + return V_0280A0_COLOR_24_8; + case PIPE_FORMAT_R32_FLOAT: return V_0280A0_COLOR_32_FLOAT; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index d41150c9384..369e5d28d0c 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -467,11 +467,13 @@ uint32_t r600_translate_texformat(enum pipe_format format, result = V_0280A0_COLOR_16; goto out_word4; case PIPE_FORMAT_Z24X8_UNORM: - result = V_0280A0_COLOR_8_24; - goto out_word4; case PIPE_FORMAT_Z24_UNORM_S8_USCALED: result = V_0280A0_COLOR_8_24; goto out_word4; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + result = V_0280A0_COLOR_24_8; + goto out_word4; default: goto out_unknown; } -- cgit v1.2.3 From d172ef31383112ca6967341c4007eac7ac75961e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 15:30:52 +1000 Subject: r600g: fix r700 cube map sizing. this fixes fbo-cubemap on r700. --- src/gallium/drivers/r600/r600_texture.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 369e5d28d0c..0d24f6ab0d1 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -73,7 +73,7 @@ static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex, } } -static void r600_setup_miptree(struct r600_resource_texture *rtex) +static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_class chipc) { struct pipe_resource *ptex = &rtex->resource.base.b; unsigned long w, h, pitch, size, layer_size, i, offset; @@ -86,8 +86,12 @@ static void r600_setup_miptree(struct r600_resource_texture *rtex) pitch = util_format_get_stride(ptex->format, align(w, 64)); pitch = align(pitch, 256); layer_size = pitch * h; - if (ptex->target == PIPE_TEXTURE_CUBE) - size = layer_size * 6; + if (ptex->target == PIPE_TEXTURE_CUBE) { + if (chipc == R700) + size = layer_size * 8; + else + size = layer_size * 6; + } else size = layer_size * u_minify(ptex->depth0, i); rtex->offset[i] = offset; @@ -103,6 +107,7 @@ static void r600_setup_miptree(struct r600_resource_texture *rtex) struct pipe_resource *r600_texture_create(struct pipe_screen *screen, const struct pipe_resource *templ) { + struct r600_screen *rscreen = r600_screen(screen); struct r600_resource_texture *rtex; struct r600_resource *resource; struct radeon *radeon = (struct radeon *)screen->winsys; @@ -116,7 +121,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, resource->base.vtbl = &r600_texture_vtbl; pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; - r600_setup_miptree(rtex); + r600_setup_miptree(rtex, rscreen->chip_class); /* FIXME alignment 4096 enought ? too much ? */ resource->domain = r600_domain_from_usage(resource->base.b.bind); -- cgit v1.2.3 From b110ddd9a95cfcd910900154af6f58e32e419f40 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 15:36:52 +1000 Subject: r600g: fixup r700 CB_SHADER_CONTROL register. r600c emits this with a mask of each written output. --- src/gallium/drivers/r600/r600_hw_states.c | 9 +++-- src/gallium/drivers/r600/r600_states_inc.h | 60 +++++++++++++++--------------- src/gallium/winsys/r600/drm/r600_states.h | 2 +- 3 files changed, 36 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index ed7c6b40a43..020d16287f2 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -618,15 +618,17 @@ static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) struct r600_screen *rscreen = rctx->screen; const struct pipe_blend_state *pbs = &rctx->blend->state.blend; int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; - uint32_t color_control, target_mask, shader_mask; + uint32_t color_control, target_mask, shader_mask, shader_control; int i; target_mask = 0; shader_mask = 0; + shader_control = 0; color_control = S_028808_PER_MRT_BLEND(1); for (i = 0; i < nr_cbufs; i++) { shader_mask |= 0xf << (i * 4); + shader_control |= (1 << i); } if (pbs->logicop_enable) { @@ -654,6 +656,8 @@ static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; + if (rscreen->chip_class == R700) + rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = shader_control; rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000; rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000; rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX] = 0x00000000; @@ -884,9 +888,6 @@ static void r600_init_config(struct r600_context *rctx) S_028A4C_WALK_ORDER_ENABLE(1) | S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1); } - rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = - S_0287A0_RT0_ENABLE(1) | - S_0287A0_RT1_ENABLE(1); rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000; diff --git a/src/gallium/drivers/r600/r600_states_inc.h b/src/gallium/drivers/r600/r600_states_inc.h index de717f35368..1c8075ebdb5 100644 --- a/src/gallium/drivers/r600/r600_states_inc.h +++ b/src/gallium/drivers/r600/r600_states_inc.h @@ -15,35 +15,34 @@ #define R600_CONFIG__DB_WATERMARKS 10 #define R600_CONFIG__SX_MISC 11 #define R600_CONFIG__SPI_THREAD_GROUPING 12 -#define R600_CONFIG__CB_SHADER_CONTROL 13 -#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 14 -#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 15 -#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 16 -#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 17 -#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 18 -#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 19 -#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 20 -#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 21 -#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 22 -#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 23 -#define R600_CONFIG__VGT_HOS_CNTL 24 -#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 25 -#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 26 -#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 27 -#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 28 -#define R600_CONFIG__VGT_GROUP_FIRST_DECR 29 -#define R600_CONFIG__VGT_GROUP_DECR 30 -#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 31 -#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 32 -#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 33 -#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 34 -#define R600_CONFIG__VGT_GS_MODE 35 -#define R600_CONFIG__PA_SC_MODE_CNTL 36 -#define R600_CONFIG__VGT_STRMOUT_EN 37 -#define R600_CONFIG__VGT_REUSE_OFF 38 -#define R600_CONFIG__VGT_VTX_CNT_EN 39 -#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 40 -#define R600_CONFIG_SIZE 41 +#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 13 +#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 14 +#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 15 +#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 16 +#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 17 +#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 18 +#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 19 +#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 20 +#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 21 +#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 22 +#define R600_CONFIG__VGT_HOS_CNTL 23 +#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 24 +#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 25 +#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 26 +#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 27 +#define R600_CONFIG__VGT_GROUP_FIRST_DECR 28 +#define R600_CONFIG__VGT_GROUP_DECR 29 +#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 30 +#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 31 +#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 32 +#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 33 +#define R600_CONFIG__VGT_GS_MODE 34 +#define R600_CONFIG__PA_SC_MODE_CNTL 35 +#define R600_CONFIG__VGT_STRMOUT_EN 36 +#define R600_CONFIG__VGT_REUSE_OFF 37 +#define R600_CONFIG__VGT_VTX_CNT_EN 38 +#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 39 +#define R600_CONFIG_SIZE 40 #define R600_CONFIG_PM4 128 /* R600_CB_CNTL */ @@ -65,7 +64,8 @@ #define R600_CB_CNTL__CB_CLRCMP_DST 15 #define R600_CB_CNTL__CB_CLRCMP_MSK 16 #define R600_CB_CNTL__PA_SC_AA_MASK 17 -#define R600_CB_CNTL_SIZE 18 +#define R600_CB_CNTL__CB_SHADER_CONTROL 18 +#define R600_CB_CNTL_SIZE 19 #define R600_CB_CNTL_PM4 128 /* R600_RASTERIZER */ diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index f7ef266f7dc..76e185ac035 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -31,7 +31,6 @@ static const struct radeon_register R600_names_CONFIG[] = { {0x00009838, 0, 0, "DB_WATERMARKS"}, {0x00028350, 0, 0, "SX_MISC"}, {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"}, - {0x000287A0, 0, 0, "CB_SHADER_CONTROL"}, {0x000288A8, 0, 0, "SQ_ESGS_RING_ITEMSIZE"}, {0x000288AC, 0, 0, "SQ_GSVS_RING_ITEMSIZE"}, {0x000288B0, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"}, @@ -80,6 +79,7 @@ static const struct radeon_register R600_names_CB_CNTL[] = { {0x00028C38, 0, 0, "CB_CLRCMP_DST"}, {0x00028C3C, 0, 0, "CB_CLRCMP_MSK"}, {0x00028C48, 0, 0, "PA_SC_AA_MASK"}, + {0x000287A0, 0, 0, "CB_SHADER_CONTROL"}, }; static const struct radeon_register R600_names_RASTERIZER[] = { -- cgit v1.2.3 From 7e5173d065f0da450cf553e3e3084a0f774919a3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 15:38:40 +1000 Subject: r600g: add missing BC_INST wrapper for evergreen --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 773e5f6cb1c..bce52973136 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -514,7 +514,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s output[i].barrier = 1; output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM; output[i].array_base = 0; - output[i].inst = V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT; + output[i].inst = BC_INST(ctx.bc, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT); noutput++; } } -- cgit v1.2.3 From f4020c66fd4ad28f27077238c7080c12bd5fa733 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Sep 2010 15:39:03 +1000 Subject: r600g: only flush for the correct colorbuffer, not all of them. --- src/gallium/winsys/r600/drm/r600_state.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 57fc12ccf1a..a4739021c4c 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -304,6 +304,7 @@ static int r600_state_pm4_generic(struct radeon_state *state) static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int bufs_are_cbs) { unsigned i, j, add, size; + uint32_t flags_cb; state->nreloc = 0; for (i = 0; i < state->nbo; i++) { @@ -318,11 +319,12 @@ static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int } } for (i = 0; i < state->nreloc; i++) { + flags_cb = flags; size = (radeon_ws_bo_get_size(state->bo[state->reloc_bo_id[i]]) + 255) >> 8; state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3); if (bufs_are_cbs) - flags |= S_0085F0_CB0_DEST_BASE_ENA(1 << i); - state->pm4[state->cpm4++] = flags; + flags_cb |= S_0085F0_CB0_DEST_BASE_ENA(1 << i); + state->pm4[state->cpm4++] = flags_cb; state->pm4[state->cpm4++] = size; state->pm4[state->cpm4++] = 0x00000000; state->pm4[state->cpm4++] = 0x0000000A; -- cgit v1.2.3 From e98062673e20109e4f95b4636a4695e50ba4b8cc Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 22:54:18 -0700 Subject: r600g: Clean up PS setup. I didn't do r600d according to the docs; I split EXPORT_MODE to be a bit more useful and obvious. Hope this is okay. --- src/gallium/drivers/r600/r600_hw_states.c | 35 +++++++++++++++++-------------- src/gallium/drivers/r600/r600d.h | 6 ++++++ 2 files changed, 25 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 020d16287f2..fe6635df944 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -991,13 +991,12 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i); - tmp |= S_028644_SEL_CENTROID(1); + tmp = S_028644_SEMANTIC(i) | S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || - rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || - rshader->input[i].name == TGSI_SEMANTIC_POSITION) { + rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || + rshader->input[i].name == TGSI_SEMANTIC_POSITION) { tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); } @@ -1014,29 +1013,33 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * num_cout = 0; for (i = 0; i < rshader->noutput; i++) { if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) - exports_ps |= 1; + exports_ps |= S_028854_EXPORT_Z(1); else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { num_cout++; } } - exports_ps |= (num_cout << 1); - if (!exports_ps) { - /* always at least export 1 component per pixel */ - exports_ps = 2; + exports_ps |= S_028854_EXPORT_COLORS(num_cout); + if (exports_ps == 0) { + /* Always at least export 1 color component per pixel. */ + exports_ps = S_028854_EXPORT_COLORS(1); } - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) | - S_0286CC_PERSP_GRADIENT_ENA(1); + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = + S_0286CC_NUM_INTERP(rshader->ninput) | + S_0286CC_PERSP_GRADIENT_ENA(1); + if (have_pos) { - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1) | - S_0286CC_BARYC_SAMPLE_CNTL(1); + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= + S_0286CC_POSITION_ENA(1) | + S_0286CC_BARYC_SAMPLE_CNTL(1); state->states[R600_PS_SHADER__SPI_INPUT_Z] |= S_0286D8_PROVIDE_Z_TO_SPI(1); } - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face); + state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = + S_0286D0_FRONT_FACE_ENA(have_face); - state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | + state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = + S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack); state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo); diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 3ca3cc764b6..f1aa49c0f78 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -2232,6 +2232,12 @@ #define R_0286C0_SPI_PS_INPUT_CNTL_31 0x0286C0 #define R_028850_SQ_PGM_RESOURCES_PS 0x028850 #define R_028854_SQ_PGM_EXPORTS_PS 0x028854 +#define S_028854_EXPORT_COLORS(x) (((x) & 0xF) << 1) +#define G_028854_EXPORT_COLORS(x) (((x) >> 1) & 0xF) +#define C_028854_EXPORT_COLORS 0xFFFFFFE1 +#define S_028854_EXPORT_Z(x) (((x) & 0x1) << 0) +#define G_028854_EXPORT_Z(x) (((x) >> 0) & 0x1) +#define C_028854_EXPORT_Z 0xFFFFFFFE #define R_008958_VGT_PRIMITIVE_TYPE 0x008958 #define R_028A7C_VGT_DMA_INDEX_TYPE 0x028A7C #define R_028A88_VGT_DMA_NUM_INSTANCES 0x028A88 -- cgit v1.2.3 From 0d53dfa3c5bdac3a04187a93d916b84c1ad9e8d2 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 19 Sep 2010 23:02:19 -0700 Subject: r600g: Cleanup viewport floats. --- src/gallium/drivers/r600/r600_hw_states.c | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index fe6635df944..a4cd1bf1a1d 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -1064,8 +1064,10 @@ static int r600_vs_shader(struct r600_context *rctx, struct r600_context_state * tmp = i << ((i & 3) * 8); state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp; } - state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2); - state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028868_NUM_GPRS(rshader->bc.ngpr) | + state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = + S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2); + state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = + S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack); radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo); radeon_ws_bo_reference(rscreen->rw, &state->bo[1], rpshader->bo); @@ -1204,19 +1206,30 @@ static void r600_texture_state_db(struct r600_screen *rscreen, struct r600_resou static void r600_texture_state_viewport(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) { struct radeon_state *rstate = &rtexture->viewport[level]; + float width, height; radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); + width = rtexture->width[level] * 0.5; + height = rtexture->height[level] * 0.5; + /* set states (most default value are 0 and struct already * initialized to 0, thus avoid resetting them) */ - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui((float)rtexture->width[level]/2.0); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui((float)rtexture->width[level]/2.0); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui((float)rtexture->height[level]/2.0); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui((float)-rtexture->height[level]/2.0); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = 0x3F000000; - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = 0x3F000000; - rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; + rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(width); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(width); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(height); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(height); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(0.5); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(0.5); + rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = + S_028818_VPORT_X_SCALE_ENA(1) | + S_028818_VPORT_X_OFFSET_ENA(1) | + S_028818_VPORT_Y_SCALE_ENA(1) | + S_028818_VPORT_Y_OFFSET_ENA(1) | + S_028818_VPORT_Z_SCALE_ENA(1) | + S_028818_VPORT_Z_OFFSET_ENA(1) | + S_028818_VTX_W0_FMT(1); rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = fui(1); radeon_state_pm4(rstate); @@ -1325,7 +1338,7 @@ void r600_set_constant_buffer_mem(struct pipe_context *ctx, nconstant = buffer->width0 / 16; size = ALIGN_DIVUP(nconstant, 16); - + radeon_state_init(rstate, rscreen->rw, type, 0, shader_class); rstate->states[R600_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size; rstate->states[R600_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0; -- cgit v1.2.3 From 0742e0b3767072fe664ca9f39fc31d86d8d314ed Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 16 Sep 2010 16:48:00 +0000 Subject: svga: Fix relative addressing translation for pixel shaders. Pixel shaders do not have address registers a#, only one loop register aL. Our only hope is to assume the address register is in fact a loop counter and replace it with aL. Do not translate ARL instruction for pixel shaders -- MOVA instruction is only valid for vertex saders. Make it more explicit relative addressing of inputs is only valid for pixel shaders and constants for vertex shaders. --- src/gallium/drivers/svga/svga_tgsi_insn.c | 51 ++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 72dccdf1502..ad7d27acbb0 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -197,22 +197,37 @@ translate_src_register( const struct svga_shader_emitter *emit, break; } - /* Indirect addressing (for coninstant buffer lookups only) + /* Indirect addressing. */ - if (reg->Register.Indirect) - { - /* we shift the offset towards the minimum */ - if (svga_arl_needs_adjustment( emit )) { - src.base.num -= svga_arl_adjustment( emit ); + if (reg->Register.Indirect) { + if (emit->unit == PIPE_SHADER_FRAGMENT) { + /* Pixel shaders have only loop registers for relative + * addressing into inputs. Ignore the redundant address + * register, the contents of aL should be in sync with it. + */ + if (reg->Register.File == TGSI_FILE_INPUT) { + src.base.relAddr = 1; + src.indirect = src_token(SVGA3DREG_LOOP, 0); + } + } + else { + /* Constant buffers only. + */ + if (reg->Register.File == TGSI_FILE_CONSTANT) { + /* we shift the offset towards the minimum */ + if (svga_arl_needs_adjustment( emit )) { + src.base.num -= svga_arl_adjustment( emit ); + } + src.base.relAddr = 1; + + /* Not really sure what should go in the second token: + */ + src.indirect = src_token( SVGA3DREG_ADDR, + reg->Indirect.Index ); + + src.indirect.swizzle = SWIZZLE_XXXX; + } } - src.base.relAddr = 1; - - /* Not really sure what should go in the second token: - */ - src.indirect = src_token( SVGA3DREG_ADDR, - reg->Indirect.Index ); - - src.indirect.swizzle = SWIZZLE_XXXX; } src = swizzle( src, @@ -1593,6 +1608,14 @@ static boolean emit_arl(struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn) { ++emit->current_arl; + if (emit->unit == PIPE_SHADER_FRAGMENT) { + /* MOVA not present in pixel shader instruction set. + * Ignore this instruction altogether since it is + * only used for loop counters -- and for that + * we reference aL directly. + */ + return TRUE; + } if (svga_arl_needs_adjustment( emit )) { return emit_fake_arl( emit, insn ); } else { -- cgit v1.2.3 From 279492386ffe741c2f5b91919b37068562b6a282 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 16 Sep 2010 16:51:03 +0000 Subject: svga: Integer constant register file has a separate namespace. Count int and float constants independently. Since there are only few i# constants available and hundreds of c# constants, it would be too easy to end up with an i# declaration out of its range. --- src/gallium/drivers/svga/svga_tgsi.c | 2 +- src/gallium/drivers/svga/svga_tgsi_emit.h | 3 ++- src/gallium/drivers/svga/svga_tgsi_insn.c | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c index 0cd620189b7..781fe6334a5 100644 --- a/src/gallium/drivers/svga/svga_tgsi.c +++ b/src/gallium/drivers/svga/svga_tgsi.c @@ -203,7 +203,7 @@ svga_tgsi_translate( const struct svga_shader *shader, emit.imm_start += key.vkey.num_zero_stride_vertex_elements; } - emit.nr_hw_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1); + emit.nr_hw_float_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1); emit.nr_hw_temp = emit.info.file_max[TGSI_FILE_TEMPORARY] + 1; emit.in_main_func = TRUE; diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h index b4e90a957d0..63ef7f867a6 100644 --- a/src/gallium/drivers/svga/svga_tgsi_emit.h +++ b/src/gallium/drivers/svga/svga_tgsi_emit.h @@ -62,7 +62,8 @@ struct svga_shader_emitter int imm_start; - int nr_hw_const; + int nr_hw_float_const; + int nr_hw_int_const; int nr_hw_temp; int insn_offset; diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index ad7d27acbb0..f2591c5721a 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -553,7 +553,7 @@ static boolean emit_def_const( struct svga_shader_emitter *emit, static INLINE boolean create_zero_immediate( struct svga_shader_emitter *emit ) { - unsigned idx = emit->nr_hw_const++; + unsigned idx = emit->nr_hw_float_const++; if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, 0, 0, 0, 1 )) @@ -568,7 +568,7 @@ create_zero_immediate( struct svga_shader_emitter *emit ) static INLINE boolean create_loop_const( struct svga_shader_emitter *emit ) { - unsigned idx = emit->nr_hw_const++; + unsigned idx = emit->nr_hw_int_const++; if (!emit_def_const( emit, SVGA3D_CONST_TYPE_INT, idx, 255, /* iteration count */ @@ -586,7 +586,7 @@ create_loop_const( struct svga_shader_emitter *emit ) static INLINE boolean create_sincos_consts( struct svga_shader_emitter *emit ) { - unsigned idx = emit->nr_hw_const++; + unsigned idx = emit->nr_hw_float_const++; if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, -1.5500992e-006f, @@ -596,7 +596,7 @@ create_sincos_consts( struct svga_shader_emitter *emit ) return FALSE; emit->sincos_consts_idx = idx; - idx = emit->nr_hw_const++; + idx = emit->nr_hw_float_const++; if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, -0.020833334f, @@ -617,7 +617,7 @@ create_arl_consts( struct svga_shader_emitter *emit ) for (i = 0; i < emit->num_arl_consts; i += 4) { int j; - unsigned idx = emit->nr_hw_const++; + unsigned idx = emit->nr_hw_float_const++; float vals[4]; for (j = 0; j < 4 && (j + i) < emit->num_arl_consts; ++j) { vals[j] = emit->arl_consts[i + j].number; @@ -2407,7 +2407,7 @@ static boolean make_immediate( struct svga_shader_emitter *emit, float d, struct src_register *out ) { - unsigned idx = emit->nr_hw_const++; + unsigned idx = emit->nr_hw_float_const++; if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, a, b, c, d )) -- cgit v1.2.3 From 208f1f381076560cb76aac753d6da2287f53ddb5 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 20 Sep 2010 15:25:18 +0200 Subject: i915g: Link with wrapper sw winsys with scons --- src/gallium/targets/dri-i915/SConscript | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript index 6f9336b5ac1..172f92d6b82 100644 --- a/src/gallium/targets/dri-i915/SConscript +++ b/src/gallium/targets/dri-i915/SConscript @@ -11,6 +11,7 @@ env.ParseConfig('pkg-config --cflags --libs libdrm_intel') env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE', 'GALLIUM_GALAHAD']) env.Prepend(LIBS = [ + ws_wrapper, st_dri, i915drm, i915, -- cgit v1.2.3 From e053d62aa573651abdd78666d299272c8219a3aa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 18 Sep 2010 16:08:38 +0200 Subject: glsl: Add doxygen comments --- src/glsl/ast.h | 42 ++++++++++++++++++++++++--- src/glsl/ir.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 121 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 44c31b6e627..d7bf90925cc 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -33,6 +33,20 @@ struct _mesa_glsl_parse_state; struct YYLTYPE; +/** + * \defgroup AST Abstract syntax tree node definitions + * + * An abstract syntax tree is generated by the parser. This is a fairly + * direct representation of the gramma derivation for the source program. + * No symantic checking is done during the generation of the AST. Only + * syntactic checking is done. Symantic checking is performed by a later + * stage that converts the AST to a more generic intermediate representation. + * + *@{ + */ +/** + * Base class of all abstract syntax tree nodes + */ class ast_node { public: /* Callers of this talloc-based new need not call delete. It's @@ -54,7 +68,14 @@ public: talloc_free(table); } + /** + * Print an AST node in something approximating the original GLSL code + */ virtual void print(void) const; + + /** + * Convert the AST node to the high-level intermediate representation + */ virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); @@ -91,19 +112,29 @@ public: this->location.column = locp.first_column; } + /** + * Source location of the AST node. + */ struct { - unsigned source; - unsigned line; - unsigned column; + unsigned source; /**< GLSL source number. */ + unsigned line; /**< Line number within the source string. */ + unsigned column; /**< Column in the line. */ } location; exec_node link; protected: + /** + * The only constructor is protected so that only derived class objects can + * be created. + */ ast_node(void); }; +/** + * Operators for AST expression nodes. + */ enum ast_operators { ast_assign, ast_plus, /**< Unary + operator. */ @@ -161,6 +192,9 @@ enum ast_operators { ast_sequence }; +/** + * Representation of any sort of expression. + */ class ast_expression : public ast_node { public: ast_expression(int oper, ast_expression *, @@ -651,7 +685,7 @@ public: ast_function *prototype; ast_compound_statement *body; }; - +/*@}*/ extern void _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); diff --git a/src/glsl/ir.h b/src/glsl/ir.h index b3b15bb08ed..909f8242a78 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -41,7 +41,31 @@ extern "C" { #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #endif +/** + * \defgroup IR Intermediate representation nodes + * + * @{ + */ + +/** + * Class tags + * + * Each concrete class derived from \c ir_instruction has a value in this + * enumerant. The value for the type is stored in \c ir_instruction::ir_type + * by the constructor. While using type tags is not very C++, it is extremely + * convenient. For example, during debugging you can simply inspect + * \c ir_instruction::ir_type to find out the actual type of the object. + * + * In addition, it is possible to use a switch-statement based on \c + * \c ir_instruction::ir_type to select different behavior for different object + * types. For functions that have only slight differences for several object + * types, this allows writing very straightforward, readable code. + */ enum ir_node_type { + /** + * Zero is unused so that the IR validator can detect cases where + * \c ir_instruction::ir_type has not been initialized. + */ ir_type_unset, ir_type_variable, ir_type_assignment, @@ -156,9 +180,12 @@ protected: }; +/** + * Variable storage classes + */ enum ir_variable_mode { - ir_var_auto = 0, - ir_var_uniform, + ir_var_auto = 0, /**< Function local variables and globals. */ + ir_var_uniform, /**< Variable declared as a uniform. */ ir_var_in, ir_var_out, ir_var_inout, @@ -209,6 +236,9 @@ public: */ unsigned component_slots() const; + /** + * Delcared name of the variable + */ const char *name; /** @@ -218,11 +248,28 @@ public: */ unsigned max_array_access; + /** + * Is the variable read-only? + * + * This is set for variables declared as \c const, shader inputs, + * and uniforms. + */ unsigned read_only:1; unsigned centroid:1; unsigned invariant:1; + /** + * Storage class of the variable. + * + * \sa ir_variable_mode + */ unsigned mode:3; + + /** + * Interpolation mode for shader inputs / outputs + * + * \sa ir_variable_interpolation + */ unsigned interpolation:2; /** @@ -233,9 +280,13 @@ public: */ unsigned array_lvalue:1; - /* ARB_fragment_coord_conventions */ + /** + * \name ARB_fragment_coord_conventions + * @{ + */ unsigned origin_upper_left:1; unsigned pixel_center_integer:1; + /*@}*/ /** * Storage location of the base of this variable @@ -724,9 +775,22 @@ public: virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const; + /** + * Attempt to constant-fold the expression + * + * If the expression cannot be constant folded, this method will return + * \c NULL. + */ virtual ir_constant *constant_expression_value(); + /** + * Determine the number of operands used by an expression + */ static unsigned int get_num_operands(ir_expression_operation); + + /** + * Determine the number of operands used by an expression + */ unsigned int get_num_operands() const { return get_num_operands(operation); @@ -813,6 +877,9 @@ public: return callee->function_name(); } + /** + * Get the function signature bound to this function call + */ ir_function_signature *get_callee() { return callee; @@ -977,11 +1044,11 @@ public: * Texture sampling opcodes used in ir_texture */ enum ir_texture_opcode { - ir_tex, /* Regular texture look-up */ - ir_txb, /* Texture look-up with LOD bias */ - ir_txl, /* Texture look-up with explicit LOD */ - ir_txd, /* Texture look-up with partial derivatvies */ - ir_txf /* Texel fetch with explicit LOD */ + ir_tex, /**< Regular texture look-up */ + ir_txb, /**< Texture look-up with LOD bias */ + ir_txl, /**< Texture look-up with explicit LOD */ + ir_txd, /**< Texture look-up with partial derivatvies */ + ir_txf /**< Texel fetch with explicit LOD */ }; @@ -1384,9 +1451,17 @@ private: ir_constant(void); }; +/*@}*/ + +/** + * Apply a visitor to each IR node in a list + */ void visit_exec_list(exec_list *list, ir_visitor *visitor); +/** + * Validate invariants on each IR node in a list + */ void validate_ir_tree(exec_list *instructions); /** -- cgit v1.2.3 From 55228878420733e77a09c67d5175e90e4b2e7245 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 08:19:08 -0600 Subject: mesa: don't call valid_texture_object() in non-debug builds This reverts commit c32bac57ed445e48856d74113364287ed6e5cdd4 and silences the warning differently. The _mesa_reference_texobj() function is called quite a bit and we don't want to call valid_texture_object() all the time in non- debug builds. --- src/mesa/main/texobj.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index c96226df597..1fedc870285 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -330,11 +330,8 @@ _mesa_reference_texobj(struct gl_texture_object **ptr, GLboolean deleteFlag = GL_FALSE; struct gl_texture_object *oldTex = *ptr; - { - GLboolean valid = valid_texture_object(oldTex); - ASSERT(valid); - (void) valid; - } + ASSERT(valid_texture_object(oldTex)); + (void) valid_texture_object; /* silence warning in release builds */ _glthread_LOCK_MUTEX(oldTex->Mutex); ASSERT(oldTex->RefCount > 0); -- cgit v1.2.3 From 17391241599137b9729e9ee6c5487d05e04d8aee Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 08:22:51 -0600 Subject: glsl2: silence compiler warnings in printf() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Such as: "ir_validate.cpp:143: warning: format ‘%p’ expects type ‘void*’, but argument 2 has type ‘ir_variable*’" --- src/glsl/ir_validate.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 58ab8aa58f8..912d1c0d709 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -124,7 +124,8 @@ ir_validate::visit_leave(ir_loop *ir) " from: %p\n" " to: %p\n" " increment: %p\n", - ir->counter, ir->from, ir->to, ir->increment); + (void *) ir->counter, (void *) ir->from, (void *) ir->to, + (void *) ir->increment); abort(); } @@ -139,7 +140,8 @@ ir_validate::visit_leave(ir_loop *ir) " from: %p\n" " to: %p\n" " increment: %p\n", - ir->counter, ir->from, ir->to, ir->increment); + (void *) ir->counter, (void *) ir->from, (void *) ir->to, + (void *) ir->increment); abort(); } } -- cgit v1.2.3 From 14eea268284491d64ff92b37723bff1e9ff14b40 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 19 Sep 2010 04:50:28 +0200 Subject: glsl: Add comments to clarify the types of comparison binops. --- src/glsl/ir.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 909f8242a78..240e7cd49af 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -719,7 +719,8 @@ enum ir_expression_operation { ir_binop_mod, /** - * \name Binary comparison operators + * \name Binary comparison operators which return a boolean vector. + * The type of both operands must be equal. */ /*@{*/ ir_binop_less, -- cgit v1.2.3 From 6ea16b6c510ee7f0e68505838a99562f0852f8e4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 19 Sep 2010 04:51:07 +0200 Subject: glsl: Fix broken handling of ir_binop_equal and ir_binop_nequal. When ir_binop_all_equal and ir_binop_any_nequal were introduced, the meaning of these two opcodes changed to return vectors rather than a single scalar, but the constant expression handling code was incorrectly written and only worked for scalars. As a result, only the first component of the returned vector would be properly initialized. --- src/glsl/ir_constant_expression.cpp | 55 ++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ec0e26de185..61a708f6e2d 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -623,36 +623,41 @@ ir_expression::constant_expression_value() } break; case ir_binop_equal: - switch (op[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.b[0] = op[0]->value.u[0] == op[1]->value.u[0]; - break; - case GLSL_TYPE_INT: - data.b[0] = op[0]->value.i[0] == op[1]->value.i[0]; - break; - case GLSL_TYPE_FLOAT: - data.b[0] = op[0]->value.f[0] == op[1]->value.f[0]; - break; - default: - assert(0); + assert(op[0]->type == op[1]->type); + for (unsigned c = 0; c < components; c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] == op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] == op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; + break; + default: + assert(0); + } } break; case ir_binop_nequal: - switch (op[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.b[0] = op[0]->value.u[0] != op[1]->value.u[0]; - break; - case GLSL_TYPE_INT: - data.b[0] = op[0]->value.i[0] != op[1]->value.i[0]; - break; - case GLSL_TYPE_FLOAT: - data.b[0] = op[0]->value.f[0] != op[1]->value.f[0]; - break; - default: - assert(0); + assert(op[0]->type != op[1]->type); + for (unsigned c = 0; c < components; c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] != op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] != op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; + break; + default: + assert(0); + } } break; - case ir_binop_all_equal: data.b[0] = op[0]->has_value(op[1]); break; -- cgit v1.2.3 From 363dfb83f1ca7f1ab09eec30aeb89732c5ce3e02 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 20 Sep 2010 11:58:00 -0400 Subject: r600g: move chip class to radeon common structure So texture code can be shared btw new state design & old one. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 7 ++++++ src/gallium/drivers/r600/r600_blit.c | 4 ++-- src/gallium/drivers/r600/r600_context.c | 2 +- src/gallium/drivers/r600/r600_hw_states.c | 4 ++-- src/gallium/drivers/r600/r600_screen.c | 32 +++------------------------ src/gallium/drivers/r600/r600_screen.h | 9 +------- src/gallium/drivers/r600/r600_state.c | 2 +- src/gallium/drivers/r600/r600_state2.c | 28 ------------------------ src/gallium/drivers/r600/r600_texture.c | 6 ++---- src/gallium/drivers/r600/radeon.h | 7 ++++++ src/gallium/winsys/r600/drm/r600.c | 36 +++++++++++++++++++++++++++++++ src/gallium/winsys/r600/drm/r600_priv.h | 1 + src/gallium/winsys/r600/drm/radeon.c | 36 +++++++++++++++++++++++++++++++ src/gallium/winsys/r600/drm/radeon_priv.h | 1 + 14 files changed, 100 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 7cbacea89a1..a123eb62e0f 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -90,7 +90,14 @@ enum radeon_family { CHIP_LAST, }; +enum chip_class { + R600, + R700, + EVERGREEN, +}; + enum radeon_family r600_get_family(struct radeon *rw); +enum chip_class r600_get_family_class(struct radeon *radeon); /* lowlevel WS bo */ struct radeon_ws_bo; diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 54fbc50bbc4..0506e8280af 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -283,7 +283,7 @@ static void r600_blit_state_vs_shader(struct r600_screen *rscreen, struct radeon radeon_ws_bo_reference(rscreen->rw, &bo, NULL); return; } - switch (rscreen->chip_class) { + switch (radeon_get_family_class(rscreen->rw)) { case R600: memcpy(data, shader_bc_r600, 128); break; @@ -347,7 +347,7 @@ static void r600_blit_state_ps_shader(struct r600_screen *rscreen, struct radeon radeon_ws_bo_reference(rscreen->rw, &bo, NULL); return; } - switch (rscreen->chip_class) { + switch (radeon_get_family_class(rscreen->rw)) { case R600: memcpy(data, shader_bc_r600, 48); break; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 97b21d5e31d..72aab91d04e 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -113,7 +113,7 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) rctx->screen = rscreen; rctx->rw = rscreen->rw; - if (rscreen->chip_class == EVERGREEN) + if (radeon_get_family_class(rscreen->rw) == EVERGREEN) rctx->vtbl = &eg_hw_state_vtbl; else rctx->vtbl = &r600_hw_state_vtbl; diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index a4cd1bf1a1d..271bd1ac506 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -457,7 +457,7 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) if (query_running) { db_render_override |= S_028D10_NOOP_CULL_DISABLE(1); - if (rscreen->chip_class == R700) + if (radeon_get_family_class(rscreen->rw) == R700) db_render_control |= S_028D0C_R700_PERFECT_ZPASS_COUNTS(1); } @@ -656,7 +656,7 @@ static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; - if (rscreen->chip_class == R700) + if (radeon_get_family_class(rscreen->rw) == R700) rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = shader_control; rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000; rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000; diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c index 1711fabfc7a..d280a45bab7 100644 --- a/src/gallium/drivers/r600/r600_screen.c +++ b/src/gallium/drivers/r600/r600_screen.c @@ -242,39 +242,13 @@ struct pipe_screen *r600_screen_create(struct radeon *rw) if (rscreen == NULL) { return NULL; } - + /* don't enable mem constant for r600 yet */ rscreen->use_mem_constant = FALSE; - - switch (family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - rscreen->chip_class = R600; - break; - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - rscreen->chip_class = R700; - break; - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - rscreen->chip_class = EVERGREEN; + if (radeon_get_family_class(rw) == EVERGREEN) { rscreen->use_mem_constant = TRUE; - break; - default: - FREE(rscreen); - return NULL; } + radeon_set_mem_constant(rw, rscreen->use_mem_constant); rscreen->rw = rw; rscreen->screen.winsys = (struct pipe_winsys*)rw; diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 4be77865fbd..502444f03ac 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -42,17 +42,10 @@ struct r600_transfer { struct pipe_resource *linear_texture; }; -enum chip_class { - R600, - R700, - EVERGREEN, -}; - struct r600_screen { struct pipe_screen screen; struct radeon *rw; - enum chip_class chip_class; - boolean use_mem_constant; + boolean use_mem_constant; }; static INLINE struct r600_screen *r600_screen(struct pipe_screen *screen) diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 2b97c2a94e3..424f7a8913f 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -527,7 +527,7 @@ void r600_init_state_functions(struct r600_context *rctx) rctx->context.set_blend_color = r600_set_blend_color; rctx->context.set_clip_state = r600_set_clip_state; - if (rctx->screen->chip_class == EVERGREEN) + if (radeon_get_family_class(rctx->rw) == EVERGREEN) rctx->context.set_constant_buffer = eg_set_constant_buffer; else if (rctx->screen->use_mem_constant) rctx->context.set_constant_buffer = r600_set_constant_buffer_mem; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index a190204ef47..ffb18ab7fb3 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -56,12 +56,6 @@ uint32_t r600_translate_texformat(enum pipe_format format, #include "r600_state_inlines.h" -enum chip_class { - R600, - R700, - EVERGREEN, -}; - enum r600_pipe_state_id { R600_PIPE_STATE_BLEND = 0, R600_PIPE_STATE_BLEND_COLOR, @@ -85,7 +79,6 @@ enum r600_pipe_state_id { struct r600_screen { struct pipe_screen screen; struct radeon *radeon; - unsigned chip_class; }; struct r600_pipe_sampler_view { @@ -2189,27 +2182,6 @@ struct pipe_screen *r600_screen_create2(struct radeon *radeon) return NULL; } - switch (family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - rscreen->chip_class = R600; - break; - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - rscreen->chip_class = R700; - break; - default: - FREE(rscreen); - return NULL; - } rscreen->radeon = radeon; rscreen->screen.winsys = (struct pipe_winsys*)radeon; rscreen->screen.destroy = r600_destroy_screen; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 0d24f6ab0d1..66332580908 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -107,7 +107,6 @@ static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_cla struct pipe_resource *r600_texture_create(struct pipe_screen *screen, const struct pipe_resource *templ) { - struct r600_screen *rscreen = r600_screen(screen); struct r600_resource_texture *rtex; struct r600_resource *resource; struct radeon *radeon = (struct radeon *)screen->winsys; @@ -121,7 +120,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, resource->base.vtbl = &r600_texture_vtbl; pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; - r600_setup_miptree(rtex, rscreen->chip_class); + r600_setup_miptree(rtex, radeon_get_family_class(radeon)); /* FIXME alignment 4096 enought ? too much ? */ resource->domain = r600_domain_from_usage(resource->base.b.bind); @@ -320,7 +319,6 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx, void* r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer) { - struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct radeon_ws_bo *bo; enum pipe_format format = transfer->resource->format; @@ -334,7 +332,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; } else { rtex = (struct r600_resource_texture*)transfer->resource; - if (rtex->depth && rscreen->chip_class != EVERGREEN) { + if (rtex->depth && radeon_get_family_class(radeon) != EVERGREEN) { r = r600_texture_from_depth(ctx, rtex, transfer->sr.level); if (r) { return NULL; diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 06b5cec5a6e..e52dcb4a341 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -79,6 +79,12 @@ enum radeon_family { CHIP_LAST, }; +enum chip_class { + R600, + R700, + EVERGREEN, +}; + enum { R600_SHADER_PS = 1, R600_SHADER_VS, @@ -88,6 +94,7 @@ enum { }; enum radeon_family radeon_get_family(struct radeon *rw); +enum chip_class radeon_get_family_class(struct radeon *radeon); void radeon_set_mem_constant(struct radeon *radeon, boolean state); /* lowlevel WS bo */ diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c index af9b9187ab1..fdcadffc532 100644 --- a/src/gallium/winsys/r600/drm/r600.c +++ b/src/gallium/winsys/r600/drm/r600.c @@ -32,6 +32,11 @@ enum radeon_family r600_get_family(struct radeon *r600) return r600->family; } +enum chip_class r600_get_family_class(struct radeon *radeon) +{ + return radeon->chip_class; +} + static int r600_get_device(struct radeon *r600) { struct drm_radeon_info info; @@ -117,6 +122,37 @@ struct radeon *r600_new(int fd, unsigned device) R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device); break; } + + /* setup class */ + switch (r600->family) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + r600->chip_class = R600; + break; + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + r600->chip_class = R700; + break; + case CHIP_CEDAR: + case CHIP_REDWOOD: + case CHIP_JUNIPER: + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + r600->chip_class = EVERGREEN; + break; + default: + R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device); + break; + } + return r600; } diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 7a9025ad3c2..d02562f17f3 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -38,6 +38,7 @@ struct radeon { int refcount; unsigned device; unsigned family; + enum chip_class chip_class; }; struct radeon *r600_new(int fd, unsigned device); diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index f39d020559c..c3d345fef92 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -30,6 +30,11 @@ enum radeon_family radeon_get_family(struct radeon *radeon) return radeon->family; } +enum chip_class radeon_get_family_class(struct radeon *radeon) +{ + return radeon->chip_class; +} + void radeon_set_mem_constant(struct radeon *radeon, boolean state) { radeon->use_mem_constant = state; @@ -127,6 +132,37 @@ struct radeon *radeon_new(int fd, unsigned device) break; } + /* setup class */ + switch (radeon->family) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + radeon->chip_class = R600; + break; + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + radeon->chip_class = R700; + break; + case CHIP_CEDAR: + case CHIP_REDWOOD: + case CHIP_JUNIPER: + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + radeon->chip_class = EVERGREEN; + break; + default: + fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", + __func__, radeon->device); + break; + } + radeon->mman = pb_malloc_bufmgr_create(); if (!radeon->mman) return NULL; diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index c284f6aa7d1..85aea89c700 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -83,6 +83,7 @@ struct radeon { int refcount; unsigned device; unsigned family; + enum chip_class chip_class; unsigned nstype; struct radeon_stype_info *stype; unsigned max_states; -- cgit v1.2.3 From 168554904bc079650124fbd026d9b75834eabc92 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 17 Sep 2010 02:43:38 +0200 Subject: st/mesa: fix assertion failure in GetTexImage for cubemaps Can be reproduced with mesa/demos/src/tests/blitfb. NOTE: This is a candidate for the 7.9 branch. --- src/mesa/state_tracker/st_cb_texture.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 124cd32e13e..cd5001475c9 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -240,6 +240,12 @@ get_texture_dims(GLenum target) return 1; case GL_TEXTURE_2D: case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_2D_ARRAY_EXT: return 2; -- cgit v1.2.3 From 7888a2f82200738ac03c78d9900eb028d48725a1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 10:50:15 -0600 Subject: llvmpipe: fix query bug when no there's no scene --- src/gallium/drivers/llvmpipe/lp_query.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index ff0e207a54b..84c66dd36e8 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -92,8 +92,9 @@ llvmpipe_get_query_result(struct pipe_context *pipe, int i; if (!pq->fence) { - assert(0); /* query not in issued state */ - return FALSE; + /* no fence because there was no scene, so results is zero */ + *result = 0; + return TRUE; } if (!lp_fence_signalled(pq->fence)) { -- cgit v1.2.3 From b2ad8b5c221da0a7fd0d12c718d13b9a903179cc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 11:21:44 -0600 Subject: gallivm: remove debug code --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 2d80db6dc9f..f86d0553c7d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1195,7 +1195,6 @@ lp_build_sample_soa(LLVMBuilderRef builder, lp_is_simple_wrap_mode(static_state->wrap_s) && lp_is_simple_wrap_mode(static_state->wrap_t)) { /* do sampling/filtering with fixed pt arithmetic */ - printf("new sample\n"); lp_build_sample_aos(&bld, unit, s, t, r, ddx, ddy, lod_bias, explicit_lod, width, height, depth, @@ -1217,7 +1216,6 @@ lp_build_sample_soa(LLVMBuilderRef builder, static_state->wrap_t); } - printf("old sample\n"); lp_build_sample_general(&bld, unit, s, t, r, ddx, ddy, lod_bias, explicit_lod, width, height, depth, -- cgit v1.2.3 From 6d0b695fa7fa521c5e815f185841732163dfbb3e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 20 Sep 2010 20:13:30 +0200 Subject: gallium: avoid the C++ keyword "template" in sw_winsys.h --- src/gallium/include/state_tracker/sw_winsys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/include/state_tracker/sw_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h index d461dedb90e..0b11fe3beb9 100644 --- a/src/gallium/include/state_tracker/sw_winsys.h +++ b/src/gallium/include/state_tracker/sw_winsys.h @@ -97,7 +97,7 @@ struct sw_winsys */ struct sw_displaytarget * (*displaytarget_from_handle)( struct sw_winsys *ws, - const struct pipe_resource *template, + const struct pipe_resource *templat, struct winsys_handle *whandle, unsigned *stride ); -- cgit v1.2.3 From 2e7d1c2c86014d8bdd615d587fb9e98bc8eda605 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 20 Sep 2010 19:22:44 +0200 Subject: softpipe: make z/s test always pass if no zsbuf, instead of crashing D3D10 specifies this. --- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 5590d408929..425fecd5da1 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -695,8 +695,9 @@ depth_test_quads_fallback(struct quad_stage *qs, nr = alpha_test_quads(qs, quads, nr); } - if (qs->softpipe->depth_stencil->depth.enabled || - qs->softpipe->depth_stencil->stencil[0].enabled) { + if (qs->softpipe->framebuffer.zsbuf && + (qs->softpipe->depth_stencil->depth.enabled || + qs->softpipe->depth_stencil->stencil[0].enabled)) { data.ps = qs->softpipe->framebuffer.zsbuf; data.format = data.ps->format; @@ -805,6 +806,9 @@ choose_depth_test(struct quad_stage *qs, boolean occlusion = qs->softpipe->active_query_count; + if(!qs->softpipe->framebuffer.zsbuf) + depth = depthwrite = stencil = FALSE; + /* default */ qs->run = depth_test_quads_fallback; -- cgit v1.2.3 From de71e7a4c96e513beacb94eccbb8e5241a71aaf3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 20 Sep 2010 19:19:50 +0200 Subject: tgsi: add switch/case opcodes to tgsi_opcode_tmp.h --- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index e472947507d..b3123ed016d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -163,6 +163,10 @@ OP12(USGE) OP12(USHR) OP12(USLT) OP12(USNE) +OP01(SWITCH) +OP01(CASE) +OP00(DEFAULT) +OP00(ENDSWITCH) #undef OP00 -- cgit v1.2.3 From 86d5ec70d1a7bccdc26325d07c18f2a4d532dc81 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 20 Sep 2010 20:49:03 +0200 Subject: softpipe: fix whitespace --- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 425fecd5da1..e9b92626176 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -696,8 +696,8 @@ depth_test_quads_fallback(struct quad_stage *qs, } if (qs->softpipe->framebuffer.zsbuf && - (qs->softpipe->depth_stencil->depth.enabled || - qs->softpipe->depth_stencil->stencil[0].enabled)) { + (qs->softpipe->depth_stencil->depth.enabled || + qs->softpipe->depth_stencil->stencil[0].enabled)) { data.ps = qs->softpipe->framebuffer.zsbuf; data.format = data.ps->format; -- cgit v1.2.3 From 955d76c3d2004c058c326d68eddc5a06d1611a41 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 12:52:16 -0600 Subject: llvmpipe: maintain fragment shader state for draw module --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 12 ++++++++++++ src/gallium/drivers/llvmpipe/lp_state_fs.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index e54dd9f0a3c..fb673db6d0f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -886,6 +886,7 @@ static void * llvmpipe_create_fs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { + struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); struct lp_fragment_shader *shader; int nr_samplers; @@ -902,6 +903,12 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, /* we need to keep a local copy of the tokens */ shader->base.tokens = tgsi_dup_tokens(templ->tokens); + shader->draw_data = draw_create_fragment_shader(llvmpipe->draw, templ); + if (shader->draw_data == NULL) { + FREE((void *) shader->base.tokens); + return NULL; + } + nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1; shader->variant_key_size = Offset(struct lp_fragment_shader_variant_key, @@ -938,6 +945,9 @@ llvmpipe_bind_fs_state(struct pipe_context *pipe, void *fs) draw_flush(llvmpipe->draw); + draw_bind_fragment_shader(llvmpipe->draw, + (llvmpipe->fs ? llvmpipe->fs->draw_data : NULL)); + llvmpipe->fs = fs; llvmpipe->dirty |= LP_NEW_FS; @@ -995,6 +1005,8 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs) li = next; } + draw_delete_fragment_shader(llvmpipe->draw, shader->draw_data); + assert(shader->variants_cached == 0); FREE((void *) shader->base.tokens); FREE(shader); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index 2914e7d7efd..4999b8dca1a 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -100,6 +100,8 @@ struct lp_fragment_shader struct lp_fs_variant_list_item variants; + struct draw_fragment_shader *draw_data; + /* For debugging/profiling purposes */ unsigned variant_key_size; unsigned no; -- cgit v1.2.3 From ebba92875aca586b661f6547888a2ed95e70e0ff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 12:55:29 -0600 Subject: llvmpipe: indentation fix --- src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index 0bad7320f3e..b81c2cfd15d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -79,7 +79,7 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) llvmpipe->rasterizer->point_size, llvmpipe->rasterizer->point_size_per_vertex, llvmpipe->rasterizer->sprite_coord_enable); - } + } llvmpipe->dirty |= LP_NEW_RASTERIZER; } -- cgit v1.2.3 From 924c18da95bbc62492f8e54bd8273a4981a919dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 13:07:59 -0600 Subject: llvmpipe: reformatting, remove trailing whitespace, etc --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 44 ++++++++++++++------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 55389871518..5521cbbe876 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -52,26 +52,29 @@ struct point_info { /** * Compute a0 for a constant-valued coefficient (GL_FLAT shading). */ -static void constant_coef( struct lp_setup_context *setup, - struct lp_rast_triangle *point, - unsigned slot, - const float value, - unsigned i ) +static void +constant_coef(struct lp_setup_context *setup, + struct lp_rast_triangle *point, + unsigned slot, + const float value, + unsigned i) { point->inputs.a0[slot][i] = value; point->inputs.dadx[slot][i] = 0.0f; point->inputs.dady[slot][i] = 0.0f; } -static void perspective_coef( struct lp_setup_context *setup, - struct lp_rast_triangle *point, - const struct point_info *info, - unsigned slot, - unsigned vert_attr, - unsigned i) + +static void +perspective_coef(struct lp_setup_context *setup, + struct lp_rast_triangle *point, + const struct point_info *info, + unsigned slot, + unsigned vert_attr, + unsigned i) { - if (i == 0) { - float dadx = FIXED_ONE / (float)info->dx12; + if (i == 0) { + float dadx = FIXED_ONE / (float)info->dx12; float dady = 0.0f; point->inputs.dadx[slot][i] = dadx; point->inputs.dady[slot][i] = dady; @@ -79,30 +82,26 @@ static void perspective_coef( struct lp_setup_context *setup, (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + dady * ((float)info->v0[0][1] - setup->pixel_offset))); } - else if (i == 1) { - float dadx = 0.0f; + float dadx = 0.0f; float dady = FIXED_ONE / (float)info->dx12; - + point->inputs.dadx[slot][i] = dadx; point->inputs.dady[slot][i] = dady; point->inputs.a0[slot][i] = (0.5 - (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + dady * ((float)info->v0[0][1] - setup->pixel_offset))); } - else if (i == 2) { point->inputs.a0[slot][i] = 0.0f; point->inputs.dadx[slot][i] = 0.0f; point->inputs.dady[slot][i] = 0.0f; } - else if (i == 3) { point->inputs.a0[slot][i] = 1.0f; point->inputs.dadx[slot][i] = 0.0f; point->inputs.dady[slot][i] = 0.0f; } - } @@ -144,6 +143,7 @@ setup_point_fragcoord_coef(struct lp_setup_context *setup, } } + /** * Compute the point->coef[] array dadx, dady, a0 values. */ @@ -203,6 +203,7 @@ setup_point_coefficients( struct lp_setup_context *setup, fragcoord_usage_mask); } + static INLINE int subpixel_snap(float a) { @@ -322,8 +323,9 @@ try_setup_point( struct lp_setup_context *setup, } -static void lp_setup_point( struct lp_setup_context *setup, - const float (*v0)[4] ) +static void +lp_setup_point(struct lp_setup_context *setup, + const float (*v0)[4]) { if (!try_setup_point( setup, v0 )) { -- cgit v1.2.3 From 57bf96b43be2abcbadc387d7b5466b772125a093 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 19 Sep 2010 10:06:34 +0200 Subject: r600g: Honour destination operand's writemask in the SCS implementation. If we are not going to write to the X or Y components of the destination vector we also don't need to prepare to compute SIN or COS. Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/r600_shader.c | 61 +++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bce52973136..523b6d24515 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -926,38 +926,47 @@ static int tgsi_scs(struct r600_shader_ctx *ctx) struct r600_bc_alu alu; int r; - r = tgsi_setup_trig(ctx, r600_src); - if (r) - return r; - + /* We'll only need the trig stuff if we are going to write to the + * X or Y components of the destination vector. + */ + if (likely(inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_XY)) { + r = tgsi_setup_trig(ctx, r600_src); + if (r) + return r; + } /* dst.x = COS */ - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS); - r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst); - if (r) - return r; + if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS); + r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst); + if (r) + return r; - alu.src[0].sel = ctx->temp_reg; - alu.src[0].chan = 0; - alu.last = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } /* dst.y = SIN */ - memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN); - r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); - if (r) - return r; + if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN); + r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst); + if (r) + return r; + + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + } - alu.src[0].sel = ctx->temp_reg; - alu.src[0].chan = 0; - alu.last = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; return 0; } -- cgit v1.2.3 From b7a5eac1f3723a369885bad369a04c456bdf1565 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 13:26:27 -0600 Subject: llvmpipe: clean-up, comments in setup_point_coefficient() --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 5521cbbe876..fb4fb2c436b 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -152,6 +152,7 @@ setup_point_coefficients( struct lp_setup_context *setup, struct lp_rast_triangle *point, const struct point_info *info) { + const struct lp_fragment_shader *shader = setup->fs.current.variant->shader; unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; unsigned slot; @@ -172,12 +173,16 @@ setup_point_coefficients( struct lp_setup_context *setup, fragcoord_usage_mask |= usage_mask; break; + case LP_INTERP_LINEAR: + /* Sprite tex coords may use linear interpolation someday */ + /* fall-through */ + case LP_INTERP_PERSPECTIVE: - /* For point sprite textures */ - if (setup->fs.current.variant->shader->info.input_semantic_name[slot] - == TGSI_SEMANTIC_GENERIC) - { - int index = setup->fs.current.variant->shader->info.input_semantic_index[slot]; + /* check if the sprite coord flag is set for this attribute. + * If so, set it up so it up so x any y vary from 0 to 1. + */ + if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { + const int index = shader->info.input_semantic_index[slot]; if (setup->sprite & (1 << index)) { for (i = 0; i < NUM_CHANNELS; i++) -- cgit v1.2.3 From ef419599d9b18de2a9077c5f0a7f02bfc11d1762 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 20 Sep 2010 21:27:59 +0200 Subject: r600g: Implemented the Z and W component write for the SCS opcode. Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/r600_shader.c | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 523b6d24515..1702475fa35 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -967,6 +967,55 @@ static int tgsi_scs(struct r600_shader_ctx *ctx) return r; } + /* dst.z = 0.0; */ + if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) { + fprintf(stderr, "writing z\n"); + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV); + + r = tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst); + if (r) + return r; + + alu.src[0].sel = V_SQ_ALU_SRC_0; + alu.src[0].chan = 0; + + alu.last = 1; + + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; + } + + /* dst.w = 1.0; */ + if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) { + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV); + + r = tgsi_dst(ctx, &inst->Dst[0], 3, &alu.dst); + if (r) + return r; + + alu.src[0].sel = V_SQ_ALU_SRC_1; + alu.src[0].chan = 0; + + alu.last = 1; + + r = r600_bc_add_alu(ctx->bc, &alu); + if (r) + return r; + + r = r600_bc_add_literal(ctx->bc, ctx->value); + if (r) + return r; + } + return 0; } -- cgit v1.2.3 From c3982c6bcdeb88f7fb1b20f8bd300db31cd7288d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 13:29:55 -0600 Subject: llvmpipe: rename sprite field, add sprite_coord_origin --- src/gallium/drivers/llvmpipe/lp_setup.c | 6 ++++-- src/gallium/drivers/llvmpipe/lp_setup.h | 3 ++- src/gallium/drivers/llvmpipe/lp_setup_context.h | 2 +- src/gallium/drivers/llvmpipe/lp_setup_point.c | 2 +- src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 6674d281d1e..ea7002aafcf 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -490,12 +490,14 @@ void lp_setup_set_point_state( struct lp_setup_context *setup, float point_size, boolean point_size_per_vertex, - uint sprite) + uint sprite_coord_enable, + uint sprite_coord_origin) { LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); setup->point_size = point_size; - setup->sprite = sprite; + setup->sprite_coord_enable = sprite_coord_enable; + setup->sprite_coord_origin = sprite_coord_origin; setup->point_size_per_vertex = point_size_per_vertex; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index b94061b7d49..81ff43f8adc 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -107,7 +107,8 @@ void lp_setup_set_point_state( struct lp_setup_context *setup, float point_size, boolean point_size_per_vertex, - uint sprite); + uint sprite_coord_enable, + uint sprite_coord_origin); void lp_setup_set_fs_inputs( struct lp_setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 80b356476ab..8506ed2dc9e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -73,7 +73,7 @@ struct lp_setup_context uint prim; uint vertex_size; uint nr_vertices; - uint sprite; + uint sprite_coord_enable, sprite_coord_origin; uint vertex_buffer_size; void *vertex_buffer; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index fb4fb2c436b..f8f411f4f16 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -184,7 +184,7 @@ setup_point_coefficients( struct lp_setup_context *setup, if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { const int index = shader->info.input_semantic_index[slot]; - if (setup->sprite & (1 << index)) { + if (setup->sprite_coord_enable & (1 << index)) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) perspective_coef(setup, point, info, slot+1, vert_attr, i); diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index b81c2cfd15d..dbd73812e45 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -78,7 +78,8 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) lp_setup_set_point_state( llvmpipe->setup, llvmpipe->rasterizer->point_size, llvmpipe->rasterizer->point_size_per_vertex, - llvmpipe->rasterizer->sprite_coord_enable); + llvmpipe->rasterizer->sprite_coord_enable, + llvmpipe->rasterizer->sprite_coord_mode); } llvmpipe->dirty |= LP_NEW_RASTERIZER; -- cgit v1.2.3 From 021e68b2cdc9a675887dac33689d5ffe244d8f9a Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 19 Sep 2010 19:25:21 +0200 Subject: python/tests: Fixed tri.py for API and TGSI syntax changes. Signed-off-by: Tilman Sauerbeck --- src/gallium/tests/python/samples/tri.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/tests/python/samples/tri.py b/src/gallium/tests/python/samples/tri.py index fed929d4200..6d17c88c057 100644 --- a/src/gallium/tests/python/samples/tri.py +++ b/src/gallium/tests/python/samples/tri.py @@ -88,8 +88,8 @@ def test(dev): # rasterizer rasterizer = Rasterizer() - rasterizer.front_winding = PIPE_WINDING_CW - rasterizer.cull_mode = PIPE_WINDING_NONE + rasterizer.front_ccw = False + rasterizer.cull_face = PIPE_FACE_NONE rasterizer.scissor = 1 ctx.set_rasterizer(rasterizer) @@ -161,8 +161,8 @@ def test(dev): # vertex shader vs = Shader(''' VERT - DCL IN[0], POSITION, CONSTANT - DCL IN[1], COLOR, CONSTANT + DCL IN[0] + DCL IN[1] DCL OUT[0], POSITION, CONSTANT DCL OUT[1], COLOR, CONSTANT 0:MOV OUT[0], IN[0] -- cgit v1.2.3 From 61fcd9aaa2bf91eb400eeb4df2ab2c7e48b3bb6c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 13:48:02 -0600 Subject: llvmpipe: implement sprite coord origin modes --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index f8f411f4f16..bb6b88069bf 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -71,7 +71,8 @@ perspective_coef(struct lp_setup_context *setup, const struct point_info *info, unsigned slot, unsigned vert_attr, - unsigned i) + unsigned i, + unsigned sprite_coord_origin) { if (i == 0) { float dadx = FIXED_ONE / (float)info->dx12; @@ -83,14 +84,18 @@ perspective_coef(struct lp_setup_context *setup, dady * ((float)info->v0[0][1] - setup->pixel_offset))); } else if (i == 1) { - float dadx = 0.0f; - float dady = FIXED_ONE / (float)info->dx12; + float dadx = 0.0f; + float dady = FIXED_ONE / (float)info->dx12; + + if (sprite_coord_origin == PIPE_SPRITE_COORD_LOWER_LEFT) { + dady = -dady; + } point->inputs.dadx[slot][i] = dadx; point->inputs.dady[slot][i] = dady; point->inputs.a0[slot][i] = (0.5 - - (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + - dady * ((float)info->v0[0][1] - setup->pixel_offset))); + (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + + dady * ((float)info->v0[0][1] - setup->pixel_offset))); } else if (i == 2) { point->inputs.a0[slot][i] = 0.0f; @@ -187,7 +192,8 @@ setup_point_coefficients( struct lp_setup_context *setup, if (setup->sprite_coord_enable & (1 << index)) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - perspective_coef(setup, point, info, slot+1, vert_attr, i); + perspective_coef(setup, point, info, slot+1, vert_attr, i, + setup->sprite_coord_origin); fragcoord_usage_mask |= TGSI_WRITEMASK_W; break; } -- cgit v1.2.3 From 0f099f2906773690210661fb533e207626dc8e40 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 20 Sep 2010 15:35:19 -0400 Subject: r600g: use pipe context for flushing inside map This allow to share code path btw old & new, also remove check on reference this might make things a little slower but new design doesn't use reference stuff. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_buffer.c | 2 +- src/gallium/drivers/r600/r600_context.c | 21 ++++++++++++++------- src/gallium/drivers/r600/r600_query.c | 2 +- src/gallium/drivers/r600/r600_shader.c | 2 +- src/gallium/drivers/r600/r600_state2.c | 3 +++ src/gallium/drivers/r600/r600_texture.c | 2 +- src/gallium/drivers/r600/radeon.h | 1 - src/gallium/winsys/r600/drm/radeon_bo_pb.c | 14 +++++++------- 8 files changed, 28 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index dc3fc812e1a..ea370782fdb 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -171,7 +171,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, if (transfer->usage & PIPE_TRANSFER_WRITE) { write = 1; } - data = radeon_ws_bo_map(rscreen->rw, rbuffer->r.bo, transfer->usage, rctx); + data = radeon_ws_bo_map(rscreen->rw, rbuffer->r.bo, transfer->usage, pipe); if (!data) return NULL; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 72aab91d04e..7a63d966eb5 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -69,6 +69,10 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, { struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; +#if 0 + static int dc = 0; + char dname[256]; +#endif /* flush upload buffers */ u_upload_flush(rctx->upload_vb); @@ -77,6 +81,16 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, /* suspend queries */ r600_queries_suspend(ctx); + +#if 0 + sprintf(dname, "gallium-%08d.bof", dc); + if (dc < 2) { + radeon_ctx_dump_bof(rctx->ctx, dname); + R600_ERR("dumped %s\n", dname); + } + dc++; +#endif + radeon_ctx_submit(rctx->ctx); LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { @@ -88,13 +102,6 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, r600_queries_resume(ctx); } -void r600_flush_ctx(void *data) -{ - struct r600_context *rctx = data; - - rctx->context.flush(&rctx->context, 0, NULL); -} - struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) { struct r600_context *rctx = CALLOC_STRUCT(r600_context); diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 023b09ef657..6e50701de66 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -108,7 +108,7 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer u32 *results; int i; - results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, r600_context(ctx)); + results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, ctx); for (i = 0; i < rquery->num_results; i += 4) { start = (u64)results[i] | (u64)results[i + 1] << 32; end = (u64)results[i + 2] | (u64)results[i + 3] << 32; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1702475fa35..e1e2891b6e9 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -167,7 +167,7 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_context_state if (rpshader->bo == NULL) { return -ENOMEM; } - data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, rctx); + data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, ctx); memcpy(data, rshader->bc.bytecode, rshader->bc.ndw * 4); radeon_ws_bo_unmap(rscreen->rw, rpshader->bo); /* build state */ diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index ffb18ab7fb3..5269e6db912 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -1600,6 +1600,9 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, /* unreference old buffer and reference new one */ rstate->id = R600_PIPE_STATE_FRAMEBUFFER; for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { + pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL); + } + for (int i = 0; i < state->nr_cbufs; i++) { pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]); } pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf); diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 66332580908..abfe406402a 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -346,7 +346,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, transfer->box.y / util_format_get_blockheight(format) * transfer->stride + transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } - map = radeon_ws_bo_map(radeon, bo, 0, r600_context(ctx)); + map = radeon_ws_bo_map(radeon, bo, 0, ctx); if (!map) { return NULL; } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index e52dcb4a341..a7e7982c195 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -221,5 +221,4 @@ enum r600_stype { #define R600_QUERY_SIZE 1 #define R600_QUERY_PM4 128 -void r600_flush_ctx(void *data); #endif diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 93dc927aba4..148cf6d81d2 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -53,7 +53,9 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, unsigned flags, void *ctx) { struct radeon_bo_pb *buf = radeon_bo_pb(_buf); + struct pipe_context *pctx = ctx; +//printf("%s:%d ************************************************\n", __func__, __LINE__); if (flags & PB_USAGE_UNSYNCHRONIZED) { if (!buf->bo->data && radeon_bo_map(buf->mgr->radeon, buf->bo)) { return NULL; @@ -62,13 +64,11 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, return buf->bo->data; } - if (p_atomic_read(&buf->bo->reference.count) > 1) { - if (flags & PB_USAGE_DONTBLOCK) { - return NULL; - } - if (ctx) { - r600_flush_ctx(ctx); - } + if (flags & PB_USAGE_DONTBLOCK) { + return NULL; + } + if (ctx) { + pctx->flush(pctx, 0, NULL); } if (flags & PB_USAGE_DONTBLOCK) { -- cgit v1.2.3 From a7ea4d11fb5a2a39daaad8752706291ac93013f7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 13:48:29 -0600 Subject: draw: fix test for using the wide-point stage As it was, we weren't obeying the draw->pipeline.point_sprite state. Fixes point sprites in llvmpipe driver. --- src/gallium/auxiliary/draw/draw_pipe_validate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 8b925439876..c575a8ac7ca 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -172,7 +172,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) wide_lines = (rast->line_width > draw->pipeline.wide_line_threshold && !rast->line_smooth); - /* drawing large points? */ + /* drawing large/sprite points (but not AA points)? */ if (rast->sprite_coord_enable && draw->pipeline.point_sprite) wide_points = TRUE; else if (rast->point_smooth && draw->pipeline.aapoint) @@ -207,7 +207,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) precalc_flat = TRUE; } - if (wide_points || rast->sprite_coord_enable) { + if (wide_points) { draw->pipeline.wide_point->next = next; next = draw->pipeline.wide_point; } -- cgit v1.2.3 From 4fc5050f82a6b59a86370f44c64e7592ff621f6f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 20 Sep 2010 17:21:37 -0400 Subject: r600g: add back reference check when mapping buffer Signed-off-by: Jerome Glisse --- src/gallium/targets/dri-r600/target.c | 2 +- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index eb268d5bc01..2c1b2f5be45 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -4,7 +4,7 @@ #include "r600/drm/r600_drm_public.h" #include "r600/r600_public.h" -#if 1 +#if 0 static struct pipe_screen * create_screen(int fd) { diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 148cf6d81d2..897938c2caf 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -55,7 +55,6 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, struct radeon_bo_pb *buf = radeon_bo_pb(_buf); struct pipe_context *pctx = ctx; -//printf("%s:%d ************************************************\n", __func__, __LINE__); if (flags & PB_USAGE_UNSYNCHRONIZED) { if (!buf->bo->data && radeon_bo_map(buf->mgr->radeon, buf->bo)) { return NULL; @@ -64,11 +63,13 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, return buf->bo->data; } - if (flags & PB_USAGE_DONTBLOCK) { - return NULL; - } - if (ctx) { - pctx->flush(pctx, 0, NULL); + if (p_atomic_read(&buf->bo->reference.count) > 1) { + if (flags & PB_USAGE_DONTBLOCK) { + return NULL; + } + if (ctx) { + pctx->flush(pctx, 0, NULL); + } } if (flags & PB_USAGE_DONTBLOCK) { -- cgit v1.2.3 From 1662c317032cf280701d7e55b028b7f0dc8afc65 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 15:33:49 -0600 Subject: llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index bb6b88069bf..774a3c80dad 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -188,8 +188,11 @@ setup_point_coefficients( struct lp_setup_context *setup, */ if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { const int index = shader->info.input_semantic_index[slot]; - - if (setup->sprite_coord_enable & (1 << index)) { + /* Note that sprite_coord enable is a bitfield of + * PIPE_MAX_SHADER_OUTPUTS bits. + */ + if (index < PIPE_MAX_SHADER_OUTPUTS && + (setup->sprite_coord_enable & (1 << index))) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) perspective_coef(setup, point, info, slot+1, vert_attr, i, -- cgit v1.2.3 From 77af10955462819d973a395270777c5b8217f6ae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Sep 2010 15:34:02 -0600 Subject: draw: check bitshift against PIPE_MAX_SHADER_OUTPUS --- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index 40843c58c20..3646c6a7145 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -237,7 +237,11 @@ widepoint_first_point(struct draw_stage *stage, for (i = 0; i < fs->info.num_inputs; i++) { if (fs->info.input_semantic_name[i] == TGSI_SEMANTIC_GENERIC) { const int generic_index = fs->info.input_semantic_index[i]; - if (rast->sprite_coord_enable & (1 << generic_index)) { + /* Note that sprite_coord enable is a bitfield of + * PIPE_MAX_SHADER_OUTPUTS bits. + */ + if (generic_index < PIPE_MAX_SHADER_OUTPUTS && + (rast->sprite_coord_enable & (1 << generic_index))) { /* OK, this generic attribute needs to be replaced with a * texcoord (see above). */ -- cgit v1.2.3 From 99907303f6a1e9abe02977664ad8457c122213ce Mon Sep 17 00:00:00 2001 From: Timo Wiren Date: Mon, 20 Sep 2010 15:27:34 -0700 Subject: Fix typos in comments and debug output strings. Bug #30208. --- src/mesa/drivers/dri/common/vblank.c | 2 +- src/mesa/drivers/dri/common/xmlconfig.c | 8 ++++---- src/mesa/drivers/dri/intel/intel_context.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index 49b22a2dc72..cb98dd0b3a3 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -241,7 +241,7 @@ GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ) * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is * successful, \c vbl_seq will be set the sequence value in the reply. * - * \param vbl Pointer to drmVBlank packet desribing how to wait. + * \param vbl Pointer to drmVBlank packet describing how to wait. * \param vbl_seq Location to store the current refresh counter. * \param fd File descriptor use to call into the DRM. * \return Zero on success or -1 on failure. diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index 738b1ae97fd..bde6b23c7cf 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -206,7 +206,7 @@ static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) { * * Works similar to strtod. Leading space is NOT skipped. The input * number may have an optional sign. '.' is interpreted as decimal - * point and may occor at most once. Optionally the number may end in + * point and may occur at most once. Optionally the number may end in * [eE], where is an integer as recognized by * strToI. In that case the result is number * 10^exponent. After * returning tail points to the first character that is not part of @@ -728,7 +728,7 @@ static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) { for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "driver")) driver = attr[i+1]; else if (!strcmp (attr[i], "screen")) screen = attr[i+1]; - else XML_WARNING("unkown device attribute: %s.", attr[i]); + else XML_WARNING("unknown device attribute: %s.", attr[i]); } if (driver && strcmp (driver, data->driverName)) data->ignoringDevice = data->inDevice; @@ -748,7 +748,7 @@ static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) { for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "name")) name = attr[i+1]; else if (!strcmp (attr[i], "executable")) exec = attr[i+1]; - else XML_WARNING("unkown application attribute: %s.", attr[i]); + else XML_WARNING("unknown application attribute: %s.", attr[i]); } if (exec && strcmp (exec, data->execName)) data->ignoringApp = data->inApp; @@ -761,7 +761,7 @@ static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) { for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "name")) name = attr[i+1]; else if (!strcmp (attr[i], "value")) value = attr[i+1]; - else XML_WARNING("unkown option attribute: %s.", attr[i]); + else XML_WARNING("unknown option attribute: %s.", attr[i]); } if (!name) XML_WARNING1 ("name attribute missing in option."); if (!value) XML_WARNING1 ("value attribute missing in option."); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 08069d71dd1..109c670c144 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -354,7 +354,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) case __DRI_BUFFER_ACCUM: default: fprintf(stderr, - "unhandled buffer attach event, attacment type %d\n", + "unhandled buffer attach event, attachment type %d\n", buffers[i].attachment); return; } -- cgit v1.2.3 From c66f0c46297996613fa8271925e37e594cf5d16b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 21 Sep 2010 02:16:19 +0200 Subject: tgsi: Don't ignore indirect registers in tgsi_check_soa_dependencies NOTE: This is a candidate for the 7.9 branch. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 0757f05dfab..3a71540506d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -605,8 +605,10 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { if ((inst->Src[i].Register.File == inst->Dst[0].Register.File) && - (inst->Src[i].Register.Index == - inst->Dst[0].Register.Index)) { + ((inst->Src[i].Register.Index == + inst->Dst[0].Register.Index) || + inst->Src[i].Register.Indirect || + inst->Dst[0].Register.Indirect)) { /* loop over dest channels */ uint channelsWritten = 0x0; FOR_EACH_ENABLED_CHANNEL(*inst, chan) { -- cgit v1.2.3 From d21301675c249602e19310d5b62fad424f2f2ac2 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 21 Sep 2010 02:16:31 +0200 Subject: tgsi: Actually care what check_soa_dependencies says MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to José for the more complete list of supported opcodes. NOTE: This is a candidate for the 7.9 branch. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 56 +++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 13e2e8eb995..83a6d758966 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2830,31 +2830,53 @@ static void soa_to_aos( struct x86_function *func, * Check if the instructions dst register is the same as any src * register and warn if there's a posible SOA dependency. */ -static void +static boolean check_soa_dependencies(const struct tgsi_full_instruction *inst) { - switch (inst->Instruction.Opcode) { + uint opcode = inst->Instruction.Opcode; + + /* XXX: we only handle src/dst aliasing in a few opcodes currently. + * Need to use an additional temporay to hold the result in the + * cases where the code is too opaque to fix. + */ + + switch (opcode) { case TGSI_OPCODE_ADD: case TGSI_OPCODE_MOV: case TGSI_OPCODE_MUL: case TGSI_OPCODE_XPD: + case TGSI_OPCODE_RCP: + case TGSI_OPCODE_RSQ: + case TGSI_OPCODE_EXP: + case TGSI_OPCODE_LOG: + case TGSI_OPCODE_DP3: + case TGSI_OPCODE_DP4: + case TGSI_OPCODE_DP2A: + case TGSI_OPCODE_EX2: + case TGSI_OPCODE_LG2: + case TGSI_OPCODE_POW: + case TGSI_OPCODE_XPD: + case TGSI_OPCODE_DPH: + case TGSI_OPCODE_COS: + case TGSI_OPCODE_SIN: + case TGSI_OPCODE_TEX: + case TGSI_OPCODE_TXB: + case TGSI_OPCODE_TXP: + case TGSI_OPCODE_NRM: + case TGSI_OPCODE_NRM4: + case TGSI_OPCODE_DP2: /* OK - these opcodes correctly handle SOA dependencies */ - break; + return TRUE; default: - if (tgsi_check_soa_dependencies(inst)) { - uint opcode = inst->Instruction.Opcode; + if (!tgsi_check_soa_dependencies(inst)) + return TRUE; - /* XXX: we only handle src/dst aliasing in a few opcodes - * currently. Need to use an additional temporay to hold - * the result in the cases where the code is too opaque to - * fix. - */ - if (opcode != TGSI_OPCODE_MOV) { - debug_printf("Warning: src/dst aliasing in instruction" - " is not handled:\n"); - tgsi_dump_instruction(inst, 1); - } - } + debug_printf("Warning: src/dst aliasing in instruction" + " is not handled:\n"); + debug_printf("Warning: "); + tgsi_dump_instruction(inst, 1); + + return FALSE; } } @@ -2954,7 +2976,7 @@ tgsi_emit_sse2( tgsi_get_processor_name(proc)); } - check_soa_dependencies(&parse.FullToken.FullInstruction); + ok = check_soa_dependencies(&parse.FullToken.FullInstruction); break; case TGSI_TOKEN_TYPE_IMMEDIATE: -- cgit v1.2.3 From 72e5fd5c02cb745d95f11573e7119ad1ba4bc1a8 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 17 Sep 2010 15:03:14 +0200 Subject: dri/nv04: Use nvgl_wrap_mode(). --- src/mesa/drivers/dri/nouveau/nv04_state_tex.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c index 4ac8327b871..b720089fbf0 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c @@ -55,24 +55,6 @@ get_tex_format(struct gl_texture_image *ti) } } -static inline unsigned -get_wrap_mode(unsigned wrap) -{ - switch (wrap) { - case GL_REPEAT: - return 0x1; - case GL_MIRRORED_REPEAT: - return 0x2; - case GL_CLAMP: - case GL_CLAMP_TO_EDGE: - return 0x3; - case GL_CLAMP_TO_BORDER: - return 0x4; - default: - assert(0); - } -} - void nv04_emit_tex_obj(GLcontext *ctx, int emit) { @@ -106,8 +88,8 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit) t->LodBias, -16, 15) * 8; } - format |= get_wrap_mode(t->WrapT) << 28 | - get_wrap_mode(t->WrapS) << 24 | + format |= nvgl_wrap_mode(t->WrapT) << 28 | + nvgl_wrap_mode(t->WrapS) << 24 | ti->HeightLog2 << 20 | ti->WidthLog2 << 16 | lod_max << 12 | -- cgit v1.2.3 From 13c246bceafd356959daff3d9872ffb0549c531a Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 17 Sep 2010 15:25:03 +0200 Subject: dri/nouveau: Remove unnecessary assertion. --- src/mesa/drivers/dri/nouveau/nv04_surface.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c index 9e7dcf0a88f..ce0103604c2 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_surface.c +++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c @@ -214,11 +214,6 @@ nv04_surface_copy_swizzle(GLcontext *ctx, assert(_mesa_is_pow_two(dst->width) && _mesa_is_pow_two(dst->height)); - /* If area is too large to copy in one shot we must copy it in - * POT chunks to meet alignment requirements */ - assert(sub_w == w || _mesa_is_pow_two(w)); - assert(sub_h == h || _mesa_is_pow_two(h)); - nouveau_bo_marko(bctx, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, src->bo, bo_flags | NOUVEAU_BO_RD); nouveau_bo_marko(bctx, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, -- cgit v1.2.3 From 22c83ac47a50ed1fdab59476886a7e56910a653a Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 17 Sep 2010 16:35:49 +0200 Subject: dri/nouveau: Cleanup more references to old FBOs and VBOs. --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 7 +++---- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index eff1016c070..0fecdee66e2 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -262,7 +262,10 @@ update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw, nouveau_update_renderbuffers(dri_ctx, draw); _mesa_resize_framebuffer(ctx, fb, draw->w, draw->h); + /* Clean up references to the old framebuffer objects. */ context_dirty(ctx, FRAMEBUFFER); + context_bctx(ctx, FRAMEBUFFER); + FIRE_RING(context_chan(ctx)); } GLboolean @@ -283,10 +286,6 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw, update_framebuffer(dri_ctx, dri_read, &dri_ctx->dri2.read_stamp); - /* Clean up references to the old framebuffer objects. */ - context_bctx(ctx, FRAMEBUFFER); - FIRE_RING(context_chan(ctx)); - /* Pass it down to mesa. */ _mesa_make_current(ctx, dri_draw->driverPrivate, dri_read->driverPrivate); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index e5858f82684..e4415cbedb5 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -143,6 +143,7 @@ vbo_deinit_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, } render->attr_count = 0; + context_bctx(ctx, VERTEX); } /* Make some rendering decisions from the GL context. */ -- cgit v1.2.3 From 98add55fffc29e0c40859fd5e9cec47fa1e352f5 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 17 Sep 2010 20:56:48 +0200 Subject: dri/nv10-nv20: Fix texturing in some cases after a base level change. --- src/mesa/drivers/dri/nouveau/nouveau_texture.c | 17 ++++++++--------- src/mesa/drivers/dri/nouveau/nv10_state_tex.c | 2 +- src/mesa/drivers/dri/nouveau/nv20_state_tex.c | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index d86f78b4371..b2f6faf1e12 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -178,7 +178,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat, } static GLboolean -teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level) +teximage_fits(struct gl_texture_object *t, int level) { struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level]; struct gl_texture_image *ti = t->Image[0][level]; @@ -186,8 +186,7 @@ teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level) if (!ti || !to_nouveau_teximage(ti)->surface.bo) return GL_FALSE; - if (context_chipset(ctx) < 0x10 && - level == t->BaseLevel && (s->offset & 0x7f)) + if (level == t->BaseLevel && (s->offset & 0x7f)) return GL_FALSE; return t->Target == GL_TEXTURE_RECTANGLE || @@ -202,7 +201,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object *t, { struct gl_texture_image *ti = t->Image[0][level]; - if (teximage_fits(ctx, t, level)) { + if (teximage_fits(t, level)) { struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces; struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; @@ -290,8 +289,8 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t) struct nouveau_texture *nt = to_nouveau_texture(t); int i, last = get_last_level(t); - if (!teximage_fits(ctx, t, t->BaseLevel) || - !teximage_fits(ctx, t, last)) + if (!teximage_fits(t, t->BaseLevel) || + !teximage_fits(t, last)) return GL_FALSE; if (nt->dirty) { @@ -314,8 +313,8 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t) void nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t) { - if (!teximage_fits(ctx, t, t->BaseLevel) || - !teximage_fits(ctx, t, get_last_level(t))) { + if (!teximage_fits(t, t->BaseLevel) || + !teximage_fits(t, get_last_level(t))) { texture_dirty(t); relayout_texture(ctx, t); nouveau_texture_validate(ctx, t); @@ -377,7 +376,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } if (level == t->BaseLevel) { - if (!teximage_fits(ctx, t, level)) + if (!teximage_fits(t, level)) relayout_texture(ctx, t); nouveau_texture_validate(ctx, t); } diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c index 6dedb18c72b..6961ccbb450 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c @@ -225,7 +225,7 @@ nv10_emit_tex_obj(GLcontext *ctx, int emit) bo_flags | NOUVEAU_BO_OR); nouveau_bo_markl(bctx, celsius, NV10TCL_TX_OFFSET(i), - s->bo, 0, bo_flags); + s->bo, s->offset, bo_flags); BEGIN_RING(chan, celsius, NV10TCL_TX_FILTER(i), 1); OUT_RING(chan, tx_filter); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index 2d45513bb4c..ea6b9b96db3 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -236,7 +236,7 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit) bo_flags | NOUVEAU_BO_OR); nouveau_bo_markl(bctx, kelvin, NV20TCL_TX_OFFSET(i), - s->bo, 0, bo_flags); + s->bo, s->offset, bo_flags); BEGIN_RING(chan, kelvin, NV20TCL_TX_WRAP(i), 1); OUT_RING(chan, tx_wrap); -- cgit v1.2.3 From bf8f24c1c84ab39207301ae5d298850d72e11876 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 17 Sep 2010 20:58:43 +0200 Subject: dri/nouveau: Fix software mipmap generation on 1x1 textures. --- src/mesa/drivers/dri/nouveau/nouveau_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index b2f6faf1e12..14c7b5f64b7 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -603,7 +603,7 @@ store_mipmap(GLcontext *ctx, GLenum target, int first, int last, .BufferObj = ctx->Shared->NullBufferObj, .Alignment = 1 }; - GLenum format = t->Image[0][first]->TexFormat; + GLenum format = t->Image[0][t->BaseLevel]->TexFormat; unsigned base_format, type, comps; int i; -- cgit v1.2.3 From 2491258436a9c404f177c861101f7bcefc8fffb3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 20 Sep 2010 18:20:04 -0700 Subject: tgsi: Remove duplicate case value. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 83a6d758966..67deffbd119 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2844,7 +2844,6 @@ check_soa_dependencies(const struct tgsi_full_instruction *inst) case TGSI_OPCODE_ADD: case TGSI_OPCODE_MOV: case TGSI_OPCODE_MUL: - case TGSI_OPCODE_XPD: case TGSI_OPCODE_RCP: case TGSI_OPCODE_RSQ: case TGSI_OPCODE_EXP: -- cgit v1.2.3 From 8e8b60588b37e2d9cce7c0c04cdae73ce8206d09 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 21 Sep 2010 11:24:49 +1000 Subject: r600g: deal with overflow of VTX/TEX CF clauses. running piglit's texrect-many caused the vtx to overflow. --- src/gallium/drivers/r600/r600_asm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 8c01987318a..dcb1b4fcccb 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -531,7 +531,8 @@ int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx) /* cf can contains only alu or only vtx or only tex */ if (bc->cf_last == NULL || (bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_VTX && - bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC)) { + bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC) || + bc->force_add_cf) { r = r600_bc_add_cf(bc); if (r) { free(nvtx); @@ -543,6 +544,8 @@ int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx) /* each fetch use 4 dwords */ bc->cf_last->ndw += 4; bc->ndw += 4; + if ((bc->ndw / 4) > 7) + bc->force_add_cf = 1; return 0; } @@ -557,7 +560,8 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex) /* cf can contains only alu or only vtx or only tex */ if (bc->cf_last == NULL || - bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_TEX) { + bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_TEX || + bc->force_add_cf) { r = r600_bc_add_cf(bc); if (r) { free(ntex); @@ -569,6 +573,8 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex) /* each texture fetch use 4 dwords */ bc->cf_last->ndw += 4; bc->ndw += 4; + if ((bc->ndw / 4) > 7) + bc->force_add_cf = 1; return 0; } -- cgit v1.2.3 From 84997cd5663a2f528c1c8b2c1f7329d546c087be Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 21 Sep 2010 11:32:15 +1000 Subject: r600g: set back to correct codepaths. Jerome please use git diff and git show before pushing. --- src/gallium/targets/dri-r600/target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index 2c1b2f5be45..eb268d5bc01 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -4,7 +4,7 @@ #include "r600/drm/r600_drm_public.h" #include "r600/r600_public.h" -#if 0 +#if 1 static struct pipe_screen * create_screen(int fd) { -- cgit v1.2.3 From 610aed81dbaee73bc2a1fb9a030d7ec0e49e73cb Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 16 Sep 2010 10:31:19 -0700 Subject: r300/compiler: Refactor the pair instruction data structures Use rc_pair_ prefix for all pair instruction structs Create a named struct for pair instruction args Replace structs radeon_pair_instruction_{rgb,alpha} with struct radeon_pair_sub_instruction. These two structs were nearly identical and were creating a lot of cut and paste code. These changes are the first step towards removing some of that code. --- .../drivers/dri/r300/compiler/r300_fragprog_emit.c | 2 +- .../drivers/dri/r300/compiler/r500_fragprog_emit.c | 2 +- .../dri/r300/compiler/radeon_pair_schedule.c | 8 ++-- .../dri/r300/compiler/radeon_program_pair.h | 47 +++++++--------------- 4 files changed, 21 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 3b2b06fc2bd..4f13e51bccd 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -74,7 +74,7 @@ static void use_temporary(struct r300_fragment_program_code *code, unsigned int code->pixsize = index; } -static unsigned int use_source(struct r300_fragment_program_code* code, struct radeon_pair_instruction_source src) +static unsigned int use_source(struct r300_fragment_program_code* code, struct rc_pair_instruction_source src) { if (src.File == RC_FILE_CONSTANT) { return src.Index | (1 << 5); diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 54cff9169a4..bad16846964 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -198,7 +198,7 @@ static void use_temporary(struct r500_fragment_program_code* code, unsigned int code->max_temp_idx = index; } -static unsigned int use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src) +static unsigned int use_source(struct r500_fragment_program_code* code, struct rc_pair_instruction_source src) { if (src.File == RC_FILE_CONSTANT) { return src.Index | 0x100; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index 5269d659851..a33b2fde7b5 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -301,9 +301,9 @@ static int destructive_merge_instructions( unsigned int arg; int free_source; unsigned int one_way = 0; - struct radeon_pair_instruction_source srcp = + struct rc_pair_instruction_source srcp = alpha->RGB.Src[srcp_src]; - struct radeon_pair_instruction_source temp; + struct rc_pair_instruction_source temp; /* 2nd arg of 1 means this is an rgb source. * 3rd arg of 0 means this is not an alpha source. */ free_source = rc_pair_alloc_source(rgb, 1, 0, @@ -366,9 +366,9 @@ static int destructive_merge_instructions( unsigned int arg; int free_source; unsigned int one_way = 0; - struct radeon_pair_instruction_source srcp = + struct rc_pair_instruction_source srcp = alpha->Alpha.Src[srcp_src]; - struct radeon_pair_instruction_source temp; + struct rc_pair_instruction_source temp; /* 2nd arg of 0 means this is not an rgb source. * 3rd arg of 1 means this is an alpha source. */ free_source = rc_pair_alloc_source(rgb, 0, 1, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index e0061e454bf..01cdb154240 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -55,52 +55,35 @@ struct radeon_compiler; */ #define RC_PAIR_PRESUB_SRC 3 -struct radeon_pair_instruction_source { +struct rc_pair_instruction_source { unsigned int Used:1; unsigned int File:3; unsigned int Index:RC_REGISTER_INDEX_BITS; }; -struct radeon_pair_instruction_rgb { - unsigned int Opcode:8; - unsigned int DestIndex:RC_REGISTER_INDEX_BITS; - unsigned int WriteMask:3; - unsigned int Target:2; - unsigned int OutputWriteMask:3; - unsigned int Saturate:1; - - struct radeon_pair_instruction_source Src[4]; - - struct { - unsigned int Source:2; - unsigned int Swizzle:9; - unsigned int Abs:1; - unsigned int Negate:1; - } Arg[3]; +struct rc_pair_instruction_arg { + unsigned int Source:2; + unsigned int Swizzle:9; + unsigned int Abs:1; + unsigned int Negate:1; }; -struct radeon_pair_instruction_alpha { +struct rc_pair_sub_instruction { unsigned int Opcode:8; unsigned int DestIndex:RC_REGISTER_INDEX_BITS; - unsigned int WriteMask:1; - unsigned int Target:2; - unsigned int OutputWriteMask:1; + unsigned int WriteMask:3; + unsigned int Target:2; + unsigned int OutputWriteMask:3; unsigned int DepthWriteMask:1; unsigned int Saturate:1; - struct radeon_pair_instruction_source Src[4]; - - struct { - unsigned int Source:2; - unsigned int Swizzle:3; - unsigned int Abs:1; - unsigned int Negate:1; - } Arg[3]; + struct rc_pair_instruction_source Src[4]; + struct rc_pair_instruction_arg Arg[3]; }; struct rc_pair_instruction { - struct radeon_pair_instruction_rgb RGB; - struct radeon_pair_instruction_alpha Alpha; + struct rc_pair_sub_instruction RGB; + struct rc_pair_sub_instruction Alpha; unsigned int WriteALUResult:2; unsigned int ALUResultCompare:3; @@ -108,7 +91,7 @@ struct rc_pair_instruction { }; typedef void (*rc_pair_foreach_src_fn) - (void *, struct radeon_pair_instruction_source *); + (void *, struct rc_pair_instruction_source *); typedef enum { RC_PAIR_SOURCE_NONE = 0, -- cgit v1.2.3 From b6ced8ee7b2c86e94fd7467d12aca5e322048ba4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 21 Sep 2010 19:57:15 +1000 Subject: r600g: fixup evergreen miptree setup. eg seems to have a higher pitch aligmment requirement and uses r700 cube setup this fixes a couple of piglit tests here. --- src/gallium/drivers/r600/r600_texture.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index abfe406402a..f60fe9f3169 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -84,10 +84,13 @@ static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_cla h = u_minify(ptex->height0, i); h = util_next_power_of_two(h); pitch = util_format_get_stride(ptex->format, align(w, 64)); - pitch = align(pitch, 256); + if (chipc == EVERGREEN) + pitch = align(pitch, 512); + else + pitch = align(pitch, 256); layer_size = pitch * h; if (ptex->target == PIPE_TEXTURE_CUBE) { - if (chipc == R700) + if (chipc >= R700) size = layer_size * 8; else size = layer_size * 6; -- cgit v1.2.3 From 88934273776242878dbaabdae25a7027fdeaff05 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 21 Sep 2010 19:57:58 +1000 Subject: r600g: fix eg texture borders. texture border regs are indexed on evergreen. --- src/gallium/drivers/r600/eg_hw_states.c | 1 + src/gallium/drivers/r600/eg_states_inc.h | 33 +++++++++++++++++--------------- src/gallium/winsys/r600/drm/eg_states.h | 27 ++++++++++++++------------ src/gallium/winsys/r600/drm/r600_state.c | 2 +- 4 files changed, 35 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 1d3a3e11c10..3d10095919a 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -471,6 +471,7 @@ static void eg_sampler_border(struct r600_context *rctx, struct radeon_state *rs radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS); if (uc.ui) { + rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_INDEX] = id; rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]); rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]); rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]); diff --git a/src/gallium/drivers/r600/eg_states_inc.h b/src/gallium/drivers/r600/eg_states_inc.h index 462f31cc798..9f8007c8e91 100644 --- a/src/gallium/drivers/r600/eg_states_inc.h +++ b/src/gallium/drivers/r600/eg_states_inc.h @@ -368,27 +368,30 @@ #define EG_GS_SAMPLER_PM4 128 /* EG_PS_SAMPLER_BORDER */ -#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0 -#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1 -#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2 -#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3 -#define EG_PS_SAMPLER_BORDER_SIZE 4 +#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_INDEX 0 +#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 1 +#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 2 +#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 3 +#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 4 +#define EG_PS_SAMPLER_BORDER_SIZE 5 #define EG_PS_SAMPLER_BORDER_PM4 128 /* EG_VS_SAMPLER_BORDER */ -#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0 -#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1 -#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2 -#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3 -#define EG_VS_SAMPLER_BORDER_SIZE 4 +#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_INDEX 0 +#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 1 +#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 2 +#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 3 +#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 4 +#define EG_VS_SAMPLER_BORDER_SIZE 5 #define EG_VS_SAMPLER_BORDER_PM4 128 /* EG_GS_SAMPLER_BORDER */ -#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0 -#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1 -#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2 -#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3 -#define EG_GS_SAMPLER_BORDER_SIZE 4 +#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_INDEX 0 +#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 1 +#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 2 +#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 3 +#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 4 +#define EG_GS_SAMPLER_BORDER_SIZE 5 #define EG_GS_SAMPLER_BORDER_PM4 128 /* EG_CB */ diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h index c26ba6c6cd0..518e05fefbb 100644 --- a/src/gallium/winsys/r600/drm/eg_states.h +++ b/src/gallium/winsys/r600/drm/eg_states.h @@ -371,24 +371,27 @@ static const struct radeon_register EG_names_GS_SAMPLER[] = { }; static const struct radeon_register EG_names_PS_SAMPLER_BORDER[] = { - {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, - {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, - {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, - {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, + {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_INDEX"}, + {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, + {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, + {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, + {0x0000A410, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, }; static const struct radeon_register EG_names_VS_SAMPLER_BORDER[] = { - {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, - {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, - {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, - {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, + {0x0000A414, 0, 0, "TD_VS_SAMPLER0_BORDER_INDEX"}, + {0x0000A418, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, + {0x0000A41C, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, + {0x0000A420, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, + {0x0000A424, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, }; static const struct radeon_register EG_names_GS_SAMPLER_BORDER[] = { - {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, - {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, - {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, - {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, + {0x0000A428, 0, 0, "TD_GS_SAMPLER0_BORDER_INDEX"}, + {0x0000A42C, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, + {0x0000A430, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, + {0x0000A434, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, + {0x0000A438, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, }; static const struct radeon_register EG_names_CB[] = { diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index a4739021c4c..25dd8fe7d81 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -110,7 +110,7 @@ struct radeon_stype_info eg_stypes[] = { { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_CBUF), EG_SUB_VS(VS_CBUF) } }, { R600_STATE_RESOURCE, 176, 0x20, r600_state_pm4_resource, { EG_SUB_PS(PS_RESOURCE), EG_SUB_VS(VS_RESOURCE), EG_SUB_GS(GS_RESOURCE), EG_SUB_FS(FS_RESOURCE)} }, { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER), EG_SUB_VS(VS_SAMPLER), EG_SUB_GS(GS_SAMPLER) } }, - { R600_STATE_SAMPLER_BORDER, 18, 0x10, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER_BORDER), EG_SUB_VS(VS_SAMPLER_BORDER), EG_SUB_GS(GS_SAMPLER_BORDER) } }, + { R600_STATE_SAMPLER_BORDER, 18, 0, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER_BORDER), EG_SUB_VS(VS_SAMPLER_BORDER), EG_SUB_GS(GS_SAMPLER_BORDER) } }, { R600_STATE_CB0, 11, 0x3c, r600_state_pm4_generic, EG_SUB_NONE(CB) }, { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, EG_SUB_NONE(VGT_EVENT) }, { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, EG_SUB_NONE(VGT_EVENT) }, -- cgit v1.2.3 From 894a307a91d6437ec418800952da2ec174e092f5 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Tue, 21 Sep 2010 08:13:03 +0200 Subject: r600g: Removed debug code. Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/r600_shader.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e1e2891b6e9..e18c6ce6052 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -969,7 +969,6 @@ static int tgsi_scs(struct r600_shader_ctx *ctx) /* dst.z = 0.0; */ if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) { - fprintf(stderr, "writing z\n"); memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV); -- cgit v1.2.3 From 92617aeac109481258f0c3863d09c1b8903d438b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 12 Sep 2010 02:49:36 +0200 Subject: d3d1x: add new Direct3D 10/11 COM state tracker for Gallium This is a new implementation of the Direct3D 11 COM API for Gallium. Direct3D 10 and 10.1 implementations are also provided, which are automatically generated with s/D3D11/D3D10/g plus a bunch of #ifs. While this is an initial version, most of the code is there (limited to what Gallium can express), and tri, gears and texturing demos are working. The primary goal is to realize Gallium's promise of multiple API support, and provide an API that can be easily implemented with just a very thin wrapper over Gallium, instead of the enormous amount of complex code needed for OpenGL. The secondary goal is to run Windows Direct3D 10/11 games on Linux using Wine. Wine dlls are currently not provided, but adding them should be quite easy. Fglrx and nvidia drivers can also be supported by writing a Gallium driver that talks to them using OpenGL, which is a relatively easy task. Thanks to the great design of Direct3D 10/11 and closeness to Gallium, this approach should not result in detectable overhead, and is the most maintainable way to do it, providing a path to switch to the open Gallium drivers once they are on par with the proprietary ones. Currently Wine has a very limited Direct3D 10 implementation, and completely lacks a Direct3D 11 implementation. Note that Direct3D 10/11 are completely different from Direct3D 9 and earlier, and thus warrant a fully separate implementation. The third goal is to provide a superior alternative to OpenGL for graphics programming on non-Windows systems, particularly Linux and other free and open systems. Thanks to a very clean and well-though design done from scratch, the Direct3D 10/11 APIs are vastly better than OpenGL and can be supported with orders of magnitude less code and development time, as you can see by comparing the lines of code of this commit and those in the existing Mesa OpenGL implementation. This would have been true for the Longs Peak proposal as well, but unfortunately it was abandoned by Khronos, leaving the OpenGL ecosystem without a graphics API with a modern design. A binding of Direct3D 10/11 to EGL would solve this issue in the most economical way possible, and this would be great to provide in Mesa, since DXGI, the API used to bind Direct3D 10/11 to Windows, is a bit suboptimal, especially on non-Windows platforms. Finally, a mature Direct3D 10/11 implementation is intrinsically going to be faster and more reliable than an OpenGL implementation, thanks to the dramatically smaller API and the segregation of all nontrivial work to object creation that the application must perform ahead of time. Currently, this commit contains: - Independently created headers for Direct3D 10, 10.1, 11 and DXGI 1.1, partially based on the existing Wine headers for D3D10 and DXGI 1.0 - A parser for Direct3D 10/11 DXBC and TokenizedProgramFormat (TPF) - A shader translator from TokenizedProgramFormat to TGSI - Implementation of the Direct3D 11 core interfaces - Automatically generated implementation of Direct3D 10 and 10.1 - Implementation of DXGI using the "native" framework of the EGL st - Demos, usable either on Windows or on this implementation - d3d11tri, a clone of tri - d3d11tex, a (multi)texturing demo - d3d11gears, an improved version of glxgears - d3d11spikysphere, a D3D11 tessellation demo (currently Windows-only) - A downloader for the Microsoft HLSL compiler, needed to recompile the shaders (compiled shader bytecode is also included) To compile this, configure at least with these options: --with-state-trackers=egl,d3d1x --with-egl-platforms=x11 plus some gallium drivers (such as softpipe with --enable-gallium-swrast) The Wine headers (usually from a wine-dev or wine-devel package) must be installed. Only x86-32 has been tested. You may need to run "make" in the subdirectories of src/gallium/winsys/sw and you may need to manually run "sudo make install" in src/gallium/targets/egl To test it, run the demos in the "progs" directory. Windows binaries are included to find out how demos should work, and to test Wine integration when it will be done. Enjoy, and let me know if you manage to compile and run this, or which issues you are facing if not. Using softpipe is recommended for now, and your mileage with hardware drivers may vary. However, getting this to work on hardware drivers is also obviously very important. Note that currently llvmpipe is buggy and causes all 3 gears to be drawn with the same color. Use export GALLIUM_DRIVER=softpipe to avoid this. Thanks to all the Gallium contributors and especially the VMware team, whose work made it possible to implement Direct3D 10/11 much more easily than it would have been otherwise. --- src/gallium/state_trackers/d3d1x/Makefile | 11 + src/gallium/state_trackers/d3d1x/Makefile.inc | 19 + .../state_trackers/d3d1x/d3d1xshader/Makefile | 7 + .../d3d1x/d3d1xshader/include/dxbc.h | 101 + .../d3d1x/d3d1xshader/include/le32.h | 45 + .../state_trackers/d3d1x/d3d1xshader/include/tpf.h | 808 +++++++ .../d3d1x/d3d1xshader/src/dxbc_dump.cpp | 43 + .../d3d1x/d3d1xshader/src/dxbc_parse.cpp | 93 + .../d3d1x/d3d1xshader/src/tpf_analyze.cpp | 186 ++ .../d3d1x/d3d1xshader/src/tpf_dump.cpp | 222 ++ .../d3d1x/d3d1xshader/src/tpf_parse.cpp | 424 ++++ .../d3d1x/d3d1xshader/src/tpf_text.cpp | 385 +++ .../state_trackers/d3d1x/d3d1xshader/src/utils.h | 45 + .../d3d1x/d3d1xshader/tools/fxdis.cpp | 75 + .../state_trackers/d3d1x/d3d1xstutil/Makefile | 5 + .../d3d1x/d3d1xstutil/include/d3d1xstutil.h | 1038 ++++++++ .../d3d1x/d3d1xstutil/src/dxgi_enums.cpp | 147 ++ src/gallium/state_trackers/d3d1x/d3dapi/Makefile | 4 + src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl | 1554 ++++++++++++ .../state_trackers/d3d1x/d3dapi/d3d10_1.idl | 191 ++ .../state_trackers/d3d1x/d3dapi/d3d10misc.h | 47 + .../state_trackers/d3d1x/d3dapi/d3d10shader.idl | 269 +++ src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl | 2492 ++++++++++++++++++++ .../state_trackers/d3d1x/d3dapi/d3d11shader.idl | 287 +++ .../state_trackers/d3d1x/d3dapi/d3dcommon.idl | 700 ++++++ src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl | 470 ++++ .../state_trackers/d3d1x/d3dapi/dxgiformat.idl | 129 + .../state_trackers/d3d1x/d3dapi/dxgitype.idl | 84 + .../state_trackers/d3d1x/d3dapi/specstrings.h | 25 + src/gallium/state_trackers/d3d1x/docs/Makefile | 4 + .../state_trackers/d3d1x/docs/coding_style.txt | 85 + .../d3d1x/docs/module_dependencies.dot | 25 + .../state_trackers/d3d1x/docs/source_layout.txt | 17 + src/gallium/state_trackers/d3d1x/dxgi/Makefile | 17 + .../state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp | 206 ++ .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 1314 +++++++++++ .../state_trackers/d3d1x/dxgi/src/dxgi_private.h | 50 + .../state_trackers/d3d1x/dxgid3d10/Makefile | 4 + .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp | 149 ++ .../state_trackers/d3d1x/dxgid3d11/Makefile | 4 + .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp | 135 ++ src/gallium/state_trackers/d3d1x/gd3d10/Makefile | 19 + src/gallium/state_trackers/d3d1x/gd3d10/d3d10.pl | 12 + src/gallium/state_trackers/d3d1x/gd3d11/Makefile | 6 + src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 236 ++ .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 2033 ++++++++++++++++ .../state_trackers/d3d1x/gd3d11/d3d11_objects.h | 715 ++++++ .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 1447 ++++++++++++ src/gallium/state_trackers/d3d1x/gd3d1x/Makefile | 6 + .../state_trackers/d3d1x/gd3d1x/d3d1x_private.h | 101 + .../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp | 147 ++ .../d3d1x/gd3d1x/tools/dxbc2tgsi.cpp | 82 + .../state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp | 832 +++++++ .../state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h | 34 + src/gallium/state_trackers/d3d1x/gd3dapi/Makefile | 4 + .../state_trackers/d3d1x/gd3dapi/galliumcom.idl | 76 + .../d3d1x/gd3dapi/galliumd3d10_1.idl | 30 + .../state_trackers/d3d1x/gd3dapi/galliumd3d11.idl | 31 + .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl | 77 + .../state_trackers/d3d1x/mstools/download-mstools | 73 + src/gallium/state_trackers/d3d1x/progs/Makefile | 32 + .../state_trackers/d3d1x/progs/bin/d3d10tri.exe | Bin 0 -> 11776 bytes .../state_trackers/d3d1x/progs/bin/d3d11gears.exe | Bin 0 -> 27136 bytes .../d3d1x/progs/bin/d3d11spikysphere.exe | Bin 0 -> 17408 bytes .../state_trackers/d3d1x/progs/bin/d3d11tex.exe | Bin 0 -> 22016 bytes .../state_trackers/d3d1x/progs/bin/d3d11tri.exe | Bin 0 -> 11776 bytes .../state_trackers/d3d1x/progs/d3d10app/d3d10app.h | 51 + .../d3d1x/progs/d3d10app/d3d10winmain.cpp | 188 ++ .../d3d1x/progs/d3d10app/d3d10x11main.cpp | 164 ++ .../d3d1x/progs/d3d10tri/d3d10tri.cpp | 118 + .../d3d1x/progs/d3d10tri/d3d10tri.hlsl | 50 + .../d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h | 112 + .../d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h | 128 + .../d3d1x/progs/d3d10tri/d3d10tri.vcxproj | 98 + .../state_trackers/d3d1x/progs/d3d11app/d3d11app.h | 51 + .../d3d1x/progs/d3d11app/d3d11blit.hlsl | 53 + .../d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h | 142 ++ .../d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h | 130 + .../state_trackers/d3d1x/progs/d3d11app/d3d11u.h | 424 ++++ .../d3d1x/progs/d3d11app/d3d11winmain.cpp | 172 ++ .../d3d1x/progs/d3d11app/d3d11x11main.cpp | 124 + .../d3d1x/progs/d3d11gears/d3d11gears.cpp | 573 +++++ .../d3d1x/progs/d3d11gears/d3d11gears.hlsl | 75 + .../d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h | 309 +++ .../d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h | 308 +++ .../d3d1x/progs/d3d11gears/d3d11gears.vcxproj | 100 + .../progs/d3d11spikysphere/d3d11spikysphere.cpp | 227 ++ .../progs/d3d11spikysphere/d3d11spikysphere.hlsl | 193 ++ .../d3d11spikysphere/d3d11spikysphere.hlsl.ds.h | 623 +++++ .../d3d11spikysphere/d3d11spikysphere.hlsl.hs.h | 297 +++ .../d3d11spikysphere/d3d11spikysphere.hlsl.ps.h | 211 ++ .../d3d11spikysphere/d3d11spikysphere.hlsl.vs.h | 105 + .../d3d11spikysphere/d3d11spikysphere.vcxproj | 102 + .../d3d1x/progs/d3d11tex/d3d11tex.cpp | 116 + .../d3d1x/progs/d3d11tex/d3d11tex.hlsl | 66 + .../d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h | 234 ++ .../d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h | 153 ++ .../d3d1x/progs/d3d11tex/d3d11tex.vcxproj | 98 + .../d3d1x/progs/d3d11tri/d3d11tri.cpp | 120 + .../d3d1x/progs/d3d11tri/d3d11tri.hlsl | 50 + .../d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h | 112 + .../d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h | 128 + .../d3d1x/progs/d3d11tri/d3d11tri.vcxproj | 99 + .../d3d1x/progs/data/cornell_box_image.h | 1028 ++++++++ .../state_trackers/d3d1x/progs/data/tux_image.h | 1028 ++++++++ src/gallium/state_trackers/d3d1x/progs/progs.sln | 49 + src/gallium/state_trackers/d3d1x/tools/fxc | 16 + src/gallium/state_trackers/d3d1x/w32api | 1 + 108 files changed, 26335 insertions(+) create mode 100644 src/gallium/state_trackers/d3d1x/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/Makefile.inc create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/include/le32.h create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_dump.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/utils.h create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xstutil/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xstutil/src/dxgi_enums.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3d10misc.h create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/dxgiformat.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/dxgitype.idl create mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/specstrings.h create mode 100644 src/gallium/state_trackers/d3d1x/docs/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/docs/coding_style.txt create mode 100644 src/gallium/state_trackers/d3d1x/docs/module_dependencies.dot create mode 100644 src/gallium/state_trackers/d3d1x/docs/source_layout.txt create mode 100644 src/gallium/state_trackers/d3d1x/dxgi/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp create mode 100644 src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp create mode 100644 src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h create mode 100644 src/gallium/state_trackers/d3d1x/dxgid3d10/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp create mode 100644 src/gallium/state_trackers/d3d1x/dxgid3d11/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d10/Makefile create mode 100755 src/gallium/state_trackers/d3d1x/gd3d10/d3d10.pl create mode 100644 src/gallium/state_trackers/d3d1x/gd3d11/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h create mode 100644 src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h create mode 100644 src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h create mode 100644 src/gallium/state_trackers/d3d1x/gd3dapi/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl create mode 100644 src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl create mode 100644 src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl create mode 100644 src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl create mode 100755 src/gallium/state_trackers/d3d1x/mstools/download-mstools create mode 100644 src/gallium/state_trackers/d3d1x/progs/Makefile create mode 100755 src/gallium/state_trackers/d3d1x/progs/bin/d3d10tri.exe create mode 100755 src/gallium/state_trackers/d3d1x/progs/bin/d3d11gears.exe create mode 100755 src/gallium/state_trackers/d3d1x/progs/bin/d3d11spikysphere.exe create mode 100755 src/gallium/state_trackers/d3d1x/progs/bin/d3d11tex.exe create mode 100755 src/gallium/state_trackers/d3d1x/progs/bin/d3d11tri.exe create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.vcxproj create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.vcxproj create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.vcxproj create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.vcxproj create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.vcxproj create mode 100755 src/gallium/state_trackers/d3d1x/progs/data/cornell_box_image.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/data/tux_image.h create mode 100755 src/gallium/state_trackers/d3d1x/progs/progs.sln create mode 100755 src/gallium/state_trackers/d3d1x/tools/fxc create mode 120000 src/gallium/state_trackers/d3d1x/w32api (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/Makefile b/src/gallium/state_trackers/d3d1x/Makefile new file mode 100644 index 00000000000..6d55376be1d --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/Makefile @@ -0,0 +1,11 @@ +SUBDIRS=d3dapi gd3dapi docs d3d1xstutil d3d1xshader gd3d1x gd3d11 gd3d10 dxgi dxgid3d11 dxgid3d10 progs + +all: + @for dir in $(SUBDIRS) ; do $(MAKE) -C "$$dir" || exit $?; done + +clean: + rm -f `find . -name \*.[oa]` + rm -f `find . -name depend` + +install: + diff --git a/src/gallium/state_trackers/d3d1x/Makefile.inc b/src/gallium/state_trackers/d3d1x/Makefile.inc new file mode 100644 index 00000000000..1b9423b9d63 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/Makefile.inc @@ -0,0 +1,19 @@ +TOP=../../../../.. +include $(TOP)/configs/current + +IDL=$(wildcard *.idl include/*.idl) +IDL_H=$(IDL:.idl=.h) +LD=$(CXX) + +include ../../../Makefile.template + +idl: $(IDL_H) + +%.h: %.idl + widl -I../gd3dapi -I../d3dapi -I../w32api -U /dev/null -H $@ $^ + +%.svg: %.dot + dot -Tsvg -o $@ $< + +%.pdf: %.dot + dot -Tpdf -o $@ $< diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile new file mode 100644 index 00000000000..6ac74d1895f --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile @@ -0,0 +1,7 @@ +LIBNAME=d3d1xshader +CPP_SOURCES=$(wildcard src/*.cpp) +LIBRARY_INCLUDES=-Iinclude -I../w32api -I../d3dapi +PROGS=tools/fxdis +LIBS=libd3d1xshader.a + +include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h new file mode 100644 index 00000000000..44fce810795 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h @@ -0,0 +1,101 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef DXBC_H_ +#define DXBC_H_ + +#include +#include +#include +#include +#include "le32.h" + +#define FOURCC(a, b, c, d) ((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 )) +#define FOURCC_DXBC FOURCC('D', 'X', 'B', 'C') +#define FOURCC_RDEF FOURCC('R', 'D', 'E', 'F') +#define FOURCC_ISGN FOURCC('I', 'S', 'G', 'N') +#define FOURCC_OSGN FOURCC('O', 'S', 'G', 'N') +#define FOURCC_SHDR FOURCC('S', 'H', 'D', 'R') +#define FOURCC_SHEX FOURCC('S', 'H', 'E', 'X') +#define FOURCC_STAT FOURCC('S', 'T', 'A', 'T') + +/* this is always little-endian! */ +struct dxbc_chunk_header +{ + unsigned fourcc; + unsigned size; +}; + +/* this is always little-endian! */ +struct dxbc_chunk_signature : public dxbc_chunk_header +{ + uint32_t count; + uint32_t unk; + struct + { + uint32_t name_offset; + uint32_t semantic_index; + uint32_t system_value_type; + uint32_t component_type; + uint32_t register_num; + uint8_t mask; + uint8_t read_write_mask; + uint8_t stream; /* TODO: guess! */ + uint8_t unused; + } elements[]; +}; + +struct dxbc_container +{ + const void* data; + std::vector chunks; + std::map chunk_map; +}; + +dxbc_container* dxbc_parse(const void* data, int size); +std::ostream& operator <<(std::ostream& out, const dxbc_container& container); + +dxbc_chunk_header* dxbc_find_chunk(const void* data, int size, unsigned fourcc); + +static inline dxbc_chunk_header* dxbc_find_shader_bytecode(const void* data, int size) +{ + dxbc_chunk_header* chunk; + chunk = dxbc_find_chunk(data, size, FOURCC_SHDR); + if(!chunk) + chunk = dxbc_find_chunk(data, size, FOURCC_SHEX); + return chunk; +} + +static inline dxbc_chunk_signature* dxbc_find_signature(const void* data, int size, bool output) +{ + return (dxbc_chunk_signature*)dxbc_find_chunk(data, size, output ? FOURCC_OSGN : FOURCC_ISGN); +} + +struct _D3D11_SIGNATURE_PARAMETER_DESC; +typedef struct _D3D11_SIGNATURE_PARAMETER_DESC D3D11_SIGNATURE_PARAMETER_DESC; +int dxbc_parse_signature(dxbc_chunk_signature* sig, D3D11_SIGNATURE_PARAMETER_DESC** params); + +#endif /* DXBC_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/le32.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/le32.h new file mode 100644 index 00000000000..923942a7786 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/le32.h @@ -0,0 +1,45 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef LE32_H_ +#define LE32_H_ + +#include +#include + +#ifdef WORDS_BIGENDIAN +static inline uint32_t bswap_le32(uint32_t v) +{ + return ((v & 0xff) << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | ((v & 0xff000000) >> 24); +} +#else +static inline uint32_t bswap_le32(uint32_t v) +{ + return v; +} +#endif + +#endif /* LE32_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h new file mode 100644 index 00000000000..2761b794d59 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h @@ -0,0 +1,808 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef TPF_H_ +#define TPF_H_ + +#include +#include +#include +#include +#include +#include +#include +#include "le32.h" + +/* This is an independent implementation of definitions and tools for the + * "tokenized program format" (TPF) bytecode documented in the + * d3d11TokenizedProgramFormat.hpp header in the Windows Driver Development kit + */ + +enum tpf_opcode { + // Shader Model 4.0 (Direct3D 10.0) + + TPF_OPCODE_ADD, + TPF_OPCODE_AND, + TPF_OPCODE_BREAK, + TPF_OPCODE_BREAKC, + TPF_OPCODE_CALL, + TPF_OPCODE_CALLC, + TPF_OPCODE_CASE, + TPF_OPCODE_CONTINUE, + TPF_OPCODE_CONTINUEC, + TPF_OPCODE_CUT, + TPF_OPCODE_DEFAULT, + TPF_OPCODE_DERIV_RTX, + TPF_OPCODE_DERIV_RTY, + TPF_OPCODE_DISCARD, + TPF_OPCODE_DIV, + TPF_OPCODE_DP2, + TPF_OPCODE_DP3, + TPF_OPCODE_DP4, + TPF_OPCODE_ELSE, + TPF_OPCODE_EMIT, + TPF_OPCODE_EMITTHENCUT, + TPF_OPCODE_ENDIF, + TPF_OPCODE_ENDLOOP, + TPF_OPCODE_ENDSWITCH, + TPF_OPCODE_EQ, + TPF_OPCODE_EXP, + TPF_OPCODE_FRC, + TPF_OPCODE_FTOI, + TPF_OPCODE_FTOU, + TPF_OPCODE_GE, + TPF_OPCODE_IADD, + TPF_OPCODE_IF, + TPF_OPCODE_IEQ, + TPF_OPCODE_IGE, + TPF_OPCODE_ILT, + TPF_OPCODE_IMAD, + TPF_OPCODE_IMAX, + TPF_OPCODE_IMIN, + TPF_OPCODE_IMUL, + TPF_OPCODE_INE, + TPF_OPCODE_INEG, + TPF_OPCODE_ISHL, + TPF_OPCODE_ISHR, + TPF_OPCODE_ITOF, + TPF_OPCODE_LABEL, + TPF_OPCODE_LD, + TPF_OPCODE_LD_MS, + TPF_OPCODE_LOG, + TPF_OPCODE_LOOP, + TPF_OPCODE_LT, + TPF_OPCODE_MAD, + TPF_OPCODE_MIN, + TPF_OPCODE_MAX, + TPF_OPCODE_CUSTOMDATA, + TPF_OPCODE_MOV, + TPF_OPCODE_MOVC, + TPF_OPCODE_MUL, + TPF_OPCODE_NE, + TPF_OPCODE_NOP, + TPF_OPCODE_NOT, + TPF_OPCODE_OR, + TPF_OPCODE_RESINFO, + TPF_OPCODE_RET, + TPF_OPCODE_RETC, + TPF_OPCODE_ROUND_NE, + TPF_OPCODE_ROUND_NI, + TPF_OPCODE_ROUND_PI, + TPF_OPCODE_ROUND_Z, + TPF_OPCODE_RSQ, + TPF_OPCODE_SAMPLE, + TPF_OPCODE_SAMPLE_C, + TPF_OPCODE_SAMPLE_C_LZ, + TPF_OPCODE_SAMPLE_L, + TPF_OPCODE_SAMPLE_D, + TPF_OPCODE_SAMPLE_B, + TPF_OPCODE_SQRT, + TPF_OPCODE_SWITCH, + TPF_OPCODE_SINCOS, + TPF_OPCODE_UDIV, + TPF_OPCODE_ULT, + TPF_OPCODE_UGE, + TPF_OPCODE_UMUL, + TPF_OPCODE_UMAD, + TPF_OPCODE_UMAX, + TPF_OPCODE_UMIN, + TPF_OPCODE_USHR, + TPF_OPCODE_UTOF, + TPF_OPCODE_XOR, + + // these have custom formats + TPF_OPCODE_DCL_RESOURCE, + TPF_OPCODE_DCL_CONSTANT_BUFFER, + TPF_OPCODE_DCL_SAMPLER, + TPF_OPCODE_DCL_INDEX_RANGE, + TPF_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY, + TPF_OPCODE_DCL_GS_INPUT_PRIMITIVE, + TPF_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT, + TPF_OPCODE_DCL_INPUT, + TPF_OPCODE_DCL_INPUT_SGV, + TPF_OPCODE_DCL_INPUT_SIV, + TPF_OPCODE_DCL_INPUT_PS, + TPF_OPCODE_DCL_INPUT_PS_SGV, + TPF_OPCODE_DCL_INPUT_PS_SIV, + TPF_OPCODE_DCL_OUTPUT, + TPF_OPCODE_DCL_OUTPUT_SGV, + TPF_OPCODE_DCL_OUTPUT_SIV, + TPF_OPCODE_DCL_TEMPS, + TPF_OPCODE_DCL_INDEXABLE_TEMP, + TPF_OPCODE_DCL_GLOBAL_FLAGS, + + TPF_OPCODE_D3D10_COUNT, // this is really a reserved opcode... + + // Shader Model 4.1 (Direct3D 10.1) + + TPF_OPCODE_LOD, + TPF_OPCODE_GATHER4, + TPF_OPCODE_SAMPLE_POS, + TPF_OPCODE_SAMPLE_INFO, + + TPF_OPCODE_D3D10_1_COUNT, // this is really a reserved opcode... + + // Shader Model 5.0 (Direct3D 11) + + // HS subshader beginning markers + TPF_OPCODE_HS_DECLS, + TPF_OPCODE_HS_CONTROL_POINT_PHASE, + TPF_OPCODE_HS_FORK_PHASE, + TPF_OPCODE_HS_JOIN_PHASE, + + TPF_OPCODE_EMIT_STREAM, + TPF_OPCODE_CUT_STREAM, + TPF_OPCODE_EMITTHENCUT_STREAM, + TPF_OPCODE_INTERFACE_CALL, + + TPF_OPCODE_BUFINFO, + TPF_OPCODE_DERIV_RTX_COARSE, + TPF_OPCODE_DERIV_RTX_FINE, + TPF_OPCODE_DERIV_RTY_COARSE, + TPF_OPCODE_DERIV_RTY_FINE, + TPF_OPCODE_GATHER4_C, + TPF_OPCODE_GATHER4_PO, + TPF_OPCODE_GATHER4_PO_C, + TPF_OPCODE_RCP, + TPF_OPCODE_F32TOF16, + TPF_OPCODE_F16TOF32, + TPF_OPCODE_UADDC, + TPF_OPCODE_USUBB, + TPF_OPCODE_COUNTBITS, + TPF_OPCODE_FIRSTBIT_HI, + TPF_OPCODE_FIRSTBIT_LO, + TPF_OPCODE_FIRSTBIT_SHI, + TPF_OPCODE_UBFE, + TPF_OPCODE_IBFE, + TPF_OPCODE_BFI, + TPF_OPCODE_BFREV, + TPF_OPCODE_SWAPC, + + // these have custom formats + TPF_OPCODE_DCL_STREAM, + TPF_OPCODE_DCL_FUNCTION_BODY, + TPF_OPCODE_DCL_FUNCTION_TABLE, + TPF_OPCODE_DCL_INTERFACE, + + // these have custom formats + TPF_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT, + TPF_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT, + TPF_OPCODE_DCL_TESS_DOMAIN, + TPF_OPCODE_DCL_TESS_PARTITIONING, + TPF_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE, + TPF_OPCODE_DCL_HS_MAX_TESSFACTOR, + TPF_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT, + TPF_OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT, + + // these have custom formats + TPF_OPCODE_DCL_THREAD_GROUP, + TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED, + TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW, + TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED, + TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW, + TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED, + TPF_OPCODE_DCL_RESOURCE_RAW, + TPF_OPCODE_DCL_RESOURCE_STRUCTURED, + + TPF_OPCODE_LD_UAV_TYPED, + TPF_OPCODE_STORE_UAV_TYPED, + TPF_OPCODE_LD_RAW, + TPF_OPCODE_STORE_RAW, + TPF_OPCODE_LD_STRUCTURED, + TPF_OPCODE_STORE_STRUCTURED, + + TPF_OPCODE_ATOMIC_AND, + TPF_OPCODE_ATOMIC_OR, + TPF_OPCODE_ATOMIC_XOR, + TPF_OPCODE_ATOMIC_CMP_STORE, + TPF_OPCODE_ATOMIC_IADD, + TPF_OPCODE_ATOMIC_IMAX, + TPF_OPCODE_ATOMIC_IMIN, + TPF_OPCODE_ATOMIC_UMAX, + TPF_OPCODE_ATOMIC_UMIN, + + TPF_OPCODE_IMM_ATOMIC_ALLOC, + TPF_OPCODE_IMM_ATOMIC_CONSUME, + TPF_OPCODE_IMM_ATOMIC_IADD, + TPF_OPCODE_IMM_ATOMIC_AND, + TPF_OPCODE_IMM_ATOMIC_OR, + TPF_OPCODE_IMM_ATOMIC_XOR, + TPF_OPCODE_IMM_ATOMIC_EXCH, + TPF_OPCODE_IMM_ATOMIC_CMP_EXCH, + TPF_OPCODE_IMM_ATOMIC_IMAX, + TPF_OPCODE_IMM_ATOMIC_IMIN, + TPF_OPCODE_IMM_ATOMIC_UMAX, + TPF_OPCODE_IMM_ATOMIC_UMIN, + + TPF_OPCODE_SYNC, + + TPF_OPCODE_DADD, + TPF_OPCODE_DMAX, + TPF_OPCODE_DMIN, + TPF_OPCODE_DMUL, + TPF_OPCODE_DEQ, + TPF_OPCODE_DGE, + TPF_OPCODE_DLT, + TPF_OPCODE_DNE, + TPF_OPCODE_DMOV, + TPF_OPCODE_DMOVC, + + TPF_OPCODE_DTOF, + TPF_OPCODE_FTOD, + + TPF_OPCODE_EVAL_SNAPPED, + TPF_OPCODE_EVAL_SAMPLE_INDEX, + TPF_OPCODE_EVAL_CENTROID, + + TPF_OPCODE_DCL_GS_INSTANCE_COUNT, + + TPF_OPCODE_D3D11_COUNT +}; + +extern const char* tpf_opcode_names[]; + +enum tpf_file +{ + TPF_FILE_TEMP = 0, + TPF_FILE_INPUT = 1, + TPF_FILE_OUTPUT = 2, + TPF_FILE_INDEXABLE_TEMP = 3, + TPF_FILE_IMMEDIATE32 = 4, // one 32-bit value for each component follows + TPF_FILE_IMMEDIATE64 = 5, // one 64-bit value for each component follows + TPF_FILE_SAMPLER = 6, + TPF_FILE_RESOURCE = 7, + TPF_FILE_CONSTANT_BUFFER= 8, + TPF_FILE_IMMEDIATE_CONSTANT_BUFFER= 9, + TPF_FILE_LABEL = 10, + TPF_FILE_INPUT_PRIMITIVEID = 11, + TPF_FILE_OUTPUT_DEPTH = 12, + TPF_FILE_NULL = 13, + + // Added in D3D10.1 + + TPF_FILE_RASTERIZER = 14, + TPF_FILE_OUTPUT_COVERAGE_MASK = 15, + + // Added in D3D11 + + TPF_FILE_STREAM = 16, + TPF_FILE_FUNCTION_BODY = 17, + TPF_FILE_FUNCTION_TABLE = 18, + TPF_FILE_INTERFACE = 19, + TPF_FILE_FUNCTION_INPUT = 20, + TPF_FILE_FUNCTION_OUTPUT = 21, + TPF_FILE_OUTPUT_CONTROL_POINT_ID = 22, + TPF_FILE_INPUT_FORK_INSTANCE_ID = 23, + TPF_FILE_INPUT_JOIN_INSTANCE_ID = 24, + TPF_FILE_INPUT_CONTROL_POINT = 25, + TPF_FILE_OUTPUT_CONTROL_POINT = 26, + TPF_FILE_INPUT_PATCH_CONSTANT = 27, + TPF_FILE_INPUT_DOMAIN_POINT = 28, + TPF_FILE_THIS_POINTER = 29, + TPF_FILE_UNORDERED_ACCESS_VIEW = 30, + TPF_FILE_THREAD_GROUP_SHARED_MEMORY = 31, + TPF_FILE_INPUT_THREAD_ID = 32, + TPF_FILE_INPUT_THREAD_GROUP_ID = 33, + TPF_FILE_INPUT_THREAD_ID_IN_GROUP = 34, + TPF_FILE_INPUT_COVERAGE_MASK = 35, + TPF_FILE_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36, + TPF_FILE_INPUT_GS_INSTANCE_ID = 37, + TPF_FILE_OUTPUT_DEPTH_GREATER_EQUAL = 38, + TPF_FILE_OUTPUT_DEPTH_LESS_EQUAL = 39, + TPF_FILE_CYCLE_COUNTER = 40, + + TPF_FILE_COUNT = 41, +}; + +extern const char* tpf_file_names[]; +extern const char* tpf_file_ms_names[]; + +enum tpf_target +{ + TPF_TARGET_UNKNOWN = 0, + TPF_TARGET_BUFFER = 1, + TPF_TARGET_TEXTURE1D = 2, + TPF_TARGET_TEXTURE2D = 3, + TPF_TARGET_TEXTURE2DMS = 4, + TPF_TARGET_TEXTURE3D = 5, + TPF_TARGET_TEXTURECUBE = 6, + TPF_TARGET_TEXTURE1DARRAY = 7, + TPF_TARGET_TEXTURE2DARRAY = 8, + TPF_TARGET_TEXTURE2DMSARRAY = 9, + TPF_TARGET_TEXTURECUBEARRAY = 10, + + // Added in D3D11 + TPF_TARGET_RAW_BUFFER = 11, + TPF_TARGET_STRUCTURED_BUFFER = 12, +}; + +extern const char* tpf_target_names[]; + +enum tpf_interpolation +{ + TPF_INTERPOLATION_UNDEFINED = 0, + TPF_INTERPOLATION_CONSTANT = 1, + TPF_INTERPOLATION_LINEAR = 2, + TPF_INTERPOLATION_LINEAR_CENTROID = 3, + TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4, + TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5, + + // Added in D3D10.1 + TPF_INTERPOLATION_LINEAR_SAMPLE = 6, + TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, +}; + +extern const char* tpf_interpolation_names[]; + +enum tpf_sv +{ + TPF_SV_UNDEFINED, + TPF_SV_POSITION, + TPF_SV_CLIP_DISTANCE, + TPF_SV_CULL_DISTANCE, + TPF_SV_RENDER_TARGET_ARRAY_INDEX, + TPF_SV_VIEWPORT_ARRAY_INDEX, + TPF_SV_VERTEX_ID, + TPF_SV_PRIMITIVE_ID, + TPF_SV_INSTANCE_ID, + TPF_SV_IS_FRONT_FACE, + TPF_SV_SAMPLE_INDEX, + + // Added in D3D11 + TPF_SV_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR, + TPF_SV_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR, + TPF_SV_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR, + TPF_SV_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR, + TPF_SV_FINAL_QUAD_U_INSIDE_TESSFACTOR, + TPF_SV_FINAL_QUAD_V_INSIDE_TESSFACTOR, + TPF_SV_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR, + TPF_SV_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR, + TPF_SV_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR, + TPF_SV_FINAL_TRI_INSIDE_TESSFACTOR, + TPF_SV_FINAL_LINE_DETAIL_TESSFACTOR, + TPF_SV_FINAL_LINE_DENSITY_TESSFACTOR, +}; + +extern const char* tpf_sv_names[]; + +struct tpf_token_version +{ + unsigned minor : 4; + unsigned major : 4; + unsigned format : 8; + unsigned type : 16; +}; + +struct tpf_token_instruction +{ + // we don't make it an union directly because unions can't be inherited from + union + { + // length and extended are always present, but they are only here to reduce duplication + struct + { + unsigned opcode : 11; + unsigned _11_23 : 13; + unsigned length : 7; + unsigned extended : 1; + }; + struct + { + unsigned opcode : 11; + unsigned resinfo_return_type : 2; + unsigned sat : 1; + unsigned _14_17 : 4; + unsigned test_nz : 1; // bit 18 + unsigned precise_mask : 4; + unsigned _23 : 1; + unsigned length : 7; + unsigned extended : 1; + } insn; + struct + { + unsigned opcode : 11; + unsigned threads_in_group : 1; + unsigned shared_memory : 1; + unsigned uav_group : 1; + unsigned uav_global : 1; + unsigned _15_17 : 3; + } sync; + struct + { + unsigned opcode : 11; + unsigned allow_refactoring : 1; + unsigned fp64 : 1; + unsigned early_depth_stencil : 1; + unsigned enable_raw_and_structured_in_non_cs : 1; + } dcl_global_flags; + struct + { + unsigned opcode : 11; + unsigned target : 5; + unsigned nr_samples : 7; + } dcl_resource; + struct + { + unsigned opcode : 11; + unsigned shadow : 1; + unsigned mono : 1; + } dcl_sampler; + struct + { + unsigned opcode : 11; + unsigned interpolation : 5; + } dcl_input_ps; + struct + { + unsigned opcode : 11; + unsigned dynamic : 1; + } dcl_constant_buffer; + struct + { + unsigned opcode : 11; + unsigned primitive : 6; + } dcl_gs_input_primitive; + struct + { + unsigned opcode : 11; + unsigned primitive_topology : 7; + } dcl_gs_output_primitive_topology; + struct + { + unsigned opcode : 11; + unsigned control_points : 6; + } dcl_input_control_point_count; + struct + { + unsigned opcode : 11; + unsigned control_points : 6; + } dcl_output_control_point_count; + struct + { + unsigned opcode : 11; + unsigned domain : 3; /* D3D_TESSELLATOR_DOMAIN */ + } dcl_tess_domain; + struct + { + unsigned opcode : 11; + unsigned partitioning : 3; /* D3D_TESSELLATOR_PARTITIONING */ + } dcl_tess_partitioning; + struct + { + unsigned opcode : 11; + unsigned primitive : 3; /* D3D_TESSELLATOR_OUTPUT_PRIMITIVE */ + } dcl_tess_output_primitive; + }; +}; + +enum tpf_token_instruction_extended_type +{ + TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_EMPTY = 0, + TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_SAMPLE_CONTROLS = 1, + TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_DIM = 2, + TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_RETURN_TYPE = 3, +}; + +union tpf_token_instruction_extended +{ + struct + { + unsigned type : 6; + unsigned _6_30 : 25; + unsigned extended :1; + }; + struct + { + unsigned type : 6; + unsigned _6_8 : 3; + int offset_u : 4; + int offset_v : 4; + int offset_w : 4; + } sample_controls; + struct + { + unsigned type : 6; + unsigned target : 5; + } resource_target; + struct + { + unsigned type : 6; + unsigned x : 4; + unsigned y : 4; + unsigned z : 4; + unsigned w : 4; + } resource_return_type; +}; + +struct tpf_token_resource_return_type +{ + unsigned x : 4; + unsigned y : 4; + unsigned z : 4; + unsigned w : 4; +}; + +enum tpf_operand_comps +{ + TPF_OPERAND_COMPS_0 = 0, + TPF_OPERAND_COMPS_1 = 1, + TPF_OPERAND_COMPS_4 = 2, + TPF_OPERAND_COMPS_N = 3 +}; + +enum tpf_operand_mode +{ + TPF_OPERAND_MODE_MASK = 0, + TPF_OPERAND_MODE_SWIZZLE = 1, + TPF_OPERAND_MODE_SCALAR = 2 +}; + +enum tpf_operand_index_repr +{ + TPF_OPERAND_INDEX_REPR_IMM32 = 0, + TPF_OPERAND_INDEX_REPR_IMM64 = 1, + TPF_OPERAND_INDEX_REPR_REG = 2, + TPF_OPERAND_INDEX_REPR_REG_IMM32 = 3, + TPF_OPERAND_INDEX_REPR_REG_IMM64 = 4, +}; + +struct tpf_token_operand +{ + unsigned comps_enum : 2; /* tpf_operands_comps */ + unsigned mode : 2; /* tpf_operand_mode */ + unsigned sel : 8; + unsigned file : 8; /* tpf_file */ + unsigned num_indices : 2; + unsigned index0_repr : 3; /* tpf_operand_index_repr */ + unsigned index1_repr : 3; /* tpf_operand_index_repr */ + unsigned index2_repr : 3; /* tpf_operand_index_repr */ + unsigned extended : 1; +}; + +#define TPF_OPERAND_SEL_MASK(sel) ((sel) & 0xf) +#define TPF_OPERAND_SEL_SWZ(sel, i) (((sel) >> ((i) * 2)) & 3) +#define TPF_OPERAND_SEL_SCALAR(sel) ((sel) & 3) + +enum tpf_token_operand_extended_type +{ + TPF_TOKEN_OPERAND_EXTENDED_TYPE_EMPTY = 0, + TPF_TOKEN_OPERAND_EXTENDED_TYPE_MODIFIER = 1, +}; + +struct tpf_token_operand_extended +{ + unsigned type : 6; + unsigned neg : 1; + unsigned abs : 1; +}; + +union tpf_any +{ + double f64; + float f32; + int64_t i64; + int32_t i32; + uint64_t u64; + int64_t u32; +}; + +struct tpf_op; +struct tpf_insn; +struct tpf_dcl; +struct tpf_program; +std::ostream& operator <<(std::ostream& out, const tpf_op& op); +std::ostream& operator <<(std::ostream& out, const tpf_insn& op); +std::ostream& operator <<(std::ostream& out, const tpf_dcl& op); +std::ostream& operator <<(std::ostream& out, const tpf_program& op); + +struct tpf_op +{ + uint8_t mode; + uint8_t comps; + uint8_t mask; + uint8_t num_indices; + uint8_t swizzle[4]; + tpf_file file; + tpf_any imm_values[4]; + bool neg; + bool abs; + struct + { + int64_t disp; + std::auto_ptr reg; + } indices[3]; + + bool is_index_simple(unsigned i) const + { + return !indices[i].reg.get() && indices[i].disp >= 0 && (int64_t)(int32_t)indices[i].disp == indices[i].disp; + } + + bool has_simple_index() const + { + return num_indices == 1 && is_index_simple(0); + } + + tpf_op() + { + memset(this, 0, sizeof(*this)); + } + + void dump(); + +private: + tpf_op(const tpf_op& op) + {} +}; + +/* for sample_d */ +#define TPF_MAX_OPS 6 + +struct tpf_insn : public tpf_token_instruction +{ + int8_t sample_offset[3]; + uint8_t resource_target; + uint8_t resource_return_type[4]; + + unsigned num; + unsigned num_ops; + std::auto_ptr ops[TPF_MAX_OPS]; + + tpf_insn() + { + memset(this, 0, sizeof(*this)); + } + + void dump(); + +private: + tpf_insn(const tpf_insn& op) + {} +}; + +struct tpf_dcl : public tpf_token_instruction +{ + std::auto_ptr op; + union + { + unsigned num; + float f32; + tpf_sv sv; + struct + { + unsigned id; + unsigned expected_function_table_length; + unsigned table_length; + unsigned array_length; + } intf; + unsigned thread_group_size[3]; + tpf_token_resource_return_type rrt; + struct + { + unsigned num; + unsigned comps; + } indexable_temp; + struct + { + unsigned stride; + unsigned count; + } structured; + }; + + void* data; + + tpf_dcl() + { + memset(this, 0, sizeof(*this)); + } + + ~tpf_dcl() + { + free(data); + } + + void dump(); + +private: + tpf_dcl(const tpf_dcl& op) + {} +}; + +struct tpf_program +{ + tpf_token_version version; + std::vector dcls; + std::vector insns; + + /* for ifs, the insn number of the else or endif if there is no else + * for elses, the insn number of the endif + * for endifs, the insn number of the if + * for loops, the insn number of the endloop + * for endloops, the insn number of the loop + * for all others, -1 + */ + std::vector cf_insn_linked; + + /* NOTE: sampler 0 is the unnormalized nearest sampler for LD/LD_MS, while + * sampler 1 is user-specified sampler 0 + */ + bool resource_sampler_slots_assigned; + std::vector slot_to_resource; + std::vector slot_to_sampler; + std::map, int> resource_sampler_to_slot; + std::map resource_to_slot; + + bool labels_found; + std::vector label_to_insn_num; + + tpf_program() + { + memset(&version, 0, sizeof(version)); + labels_found = false; + resource_sampler_slots_assigned = false; + } + + ~tpf_program() + { + for(std::vector::iterator i = dcls.begin(), e = dcls.end(); i != e; ++i) + delete *i; + for(std::vector::iterator i = insns.begin(), e = insns.end(); i != e; ++i) + delete *i; + } + + void dump(); + +private: + tpf_program(const tpf_dcl& op) + {} +}; + +tpf_program* tpf_parse(void* tokens, int size); + +bool tpf_link_cf_insns(tpf_program& program); +bool tpf_find_labels(tpf_program& program); +bool tpf_allocate_resource_sampler_pairs(tpf_program& program); + +#endif /* TPF_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_dump.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_dump.cpp new file mode 100644 index 00000000000..a3feec74463 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_dump.cpp @@ -0,0 +1,43 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include +#include +#include +#include "dxbc.h" + +std::ostream& operator <<(std::ostream& out, const dxbc_container& container) +{ + for(unsigned i = 0; i < container.chunks.size(); ++i) + { + struct dxbc_chunk_header* chunk = container.chunks[i]; + char fourcc_str[5]; + memcpy(fourcc_str, &chunk->fourcc, 4); + fourcc_str[4] = 0; + out << "# DXBC chunk " << std::setw(2) << i << ": " << fourcc_str << " offset " << ((char*)chunk - (char*)container.data) << " size " << bswap_le32(chunk->size) << "\n"; + } + return out; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp new file mode 100644 index 00000000000..6b696ae1afe --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp @@ -0,0 +1,93 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include +#include "dxbc.h" +#include +#include + +struct dxbc_container_header +{ + unsigned fourcc; + uint32_t unk[5]; + uint32_t total_size; + uint32_t chunk_count; + uint32_t chunk_offsets[]; +}; + +dxbc_container* dxbc_parse(const void* data, int size) +{ + std::auto_ptr container(new dxbc_container()); + container->data = data; + dxbc_container_header* header = (dxbc_container_header*)data; + if(bswap_le32(header->fourcc) != FOURCC_DXBC) + return 0; + unsigned num_chunks = bswap_le32(header->chunk_count); + for(unsigned i = 0; i < num_chunks; ++i) + { + unsigned offset = bswap_le32(header->chunk_offsets[i]); + dxbc_chunk_header* chunk = (dxbc_chunk_header*)((char*)data + offset); + unsigned fourcc = bswap_le32(chunk->fourcc); + container->chunk_map[fourcc] = i; + container->chunks.push_back(chunk); + } + return container.release(); +} + +dxbc_chunk_header* dxbc_find_chunk(const void* data, int size, unsigned fourcc) +{ + dxbc_container_header* header = (dxbc_container_header*)data; + if(bswap_le32(header->fourcc) != FOURCC_DXBC) + return 0; + unsigned num_chunks = bswap_le32(header->chunk_count); + for(unsigned i = 0; i < num_chunks; ++i) + { + unsigned offset = bswap_le32(header->chunk_offsets[i]); + dxbc_chunk_header* chunk = (dxbc_chunk_header*)((char*)data + offset); + if(bswap_le32(chunk->fourcc) == fourcc) + return chunk; + } + return 0; +} + +int dxbc_parse_signature(dxbc_chunk_signature* sig, D3D11_SIGNATURE_PARAMETER_DESC** params) +{ + unsigned count = bswap_le32(sig->count); + *params = (D3D11_SIGNATURE_PARAMETER_DESC*)malloc(sizeof(D3D11_SIGNATURE_PARAMETER_DESC) * count); + + for (unsigned i = 0; i < count; ++i) + { + D3D11_SIGNATURE_PARAMETER_DESC& param = (*params)[i]; + param.SemanticName = (char*)&sig->count + bswap_le32(sig->elements[i].name_offset); + param.SemanticIndex = bswap_le32(sig->elements[i].semantic_index); + param.SystemValueType = (D3D_NAME)bswap_le32(sig->elements[i].system_value_type); + param.ComponentType = (D3D_REGISTER_COMPONENT_TYPE)bswap_le32(sig->elements[i].component_type); + param.Mask = sig->elements[i].mask; + param.ReadWriteMask = sig->elements[i].read_write_mask; + param.Stream = sig->elements[i].stream; + } + return count; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp new file mode 100644 index 00000000000..a100ee5c3f5 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp @@ -0,0 +1,186 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include +#include +#include "tpf.h" + +#define check(x) do {if(!(x)) return false;} while(0) + +bool tpf_link_cf_insns(tpf_program& program) +{ + if(program.cf_insn_linked.size()) + return true; + + program.cf_insn_linked.resize(program.insns.size()); + std::vector cf_insn_linked; + memset(&cf_insn_linked[0], 0xff, cf_insn_linked.size() * sizeof(int)); + std::vector cf_stack; + for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) + { + unsigned v; + switch(program.insns[insn_num]->opcode) + { + case TPF_OPCODE_LOOP: + cf_stack.push_back(insn_num); + break; + case TPF_OPCODE_ENDLOOP: + check(!cf_stack.empty()); + v = cf_stack.back(); + check(program.insns[v]->opcode == TPF_OPCODE_LOOP); + cf_insn_linked[v] = insn_num; + cf_insn_linked[insn_num] = v; + cf_stack.pop_back(); + break; + case TPF_OPCODE_IF: + case TPF_OPCODE_SWITCH: + cf_insn_linked[insn_num] = insn_num; // later changed + cf_stack.push_back(insn_num); + break; + case TPF_OPCODE_ELSE: + case TPF_OPCODE_CASE: + check(!cf_stack.empty()); + v = cf_stack.back(); + if(program.insns[insn_num]->opcode == TPF_OPCODE_ELSE) + check(program.insns[v]->opcode == TPF_OPCODE_IF); + else + check(program.insns[v]->opcode == TPF_OPCODE_SWITCH || program.insns[v]->opcode == TPF_OPCODE_CASE); + cf_insn_linked[insn_num] = cf_insn_linked[v]; // later changed + cf_insn_linked[v] = insn_num; + cf_stack.back() = insn_num; + break; + case TPF_OPCODE_ENDSWITCH: + case TPF_OPCODE_ENDIF: + check(!cf_stack.empty()); + v = cf_stack.back(); + if(program.insns[insn_num]->opcode == TPF_OPCODE_ENDIF) + check(program.insns[v]->opcode == TPF_OPCODE_IF || program.insns[v]->opcode == TPF_OPCODE_ELSE); + else + check(program.insns[v]->opcode == TPF_OPCODE_SWITCH || program.insns[v]->opcode == TPF_OPCODE_CASE); + cf_insn_linked[insn_num] = cf_insn_linked[v]; + cf_insn_linked[v] = insn_num; + cf_stack.pop_back(); + break; + } + } + check(cf_stack.empty()); + program.cf_insn_linked.swap(cf_insn_linked); + return true; +} + +bool tpf_find_labels(tpf_program& program) +{ + if(program.labels_found) + return true; + + std::vector labels; + for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) + { + switch(program.insns[insn_num]->opcode) + { + case TPF_OPCODE_LABEL: + if(program.insns[insn_num]->num_ops > 0) + { + tpf_op& op = *program.insns[insn_num]->ops[0]; + if(op.file == TPF_FILE_LABEL && op.has_simple_index()) + { + unsigned idx = (unsigned)op.indices[0].disp; + if(idx >= labels.size()) + labels.resize(idx + 1); + labels[idx] = insn_num; + } + } + break; + } + } + program.label_to_insn_num.swap(labels); + program.labels_found = true; + return true; +} + +bool tpf_allocate_resource_sampler_pairs(tpf_program& program) +{ + if(program.resource_sampler_slots_assigned) + return true; + + std::set > pairs; + std::set resinfos; + + for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) + { + int resource = -1; + int sampler = -2; + for(unsigned i = 0; i < program.insns[insn_num]->num_ops; ++i) + { + tpf_op* op = program.insns[insn_num]->ops[i].get(); + if(op) + { + if(op->file == TPF_FILE_RESOURCE) + { + if(!op->has_simple_index() || resource >= 0) + return false; + resource = (int)op->indices[0].disp; + } + if(op->file == TPF_FILE_SAMPLER) + { + if(!op->has_simple_index() || sampler >= 0) + return false; + sampler = (int)op->indices[0].disp; + } + } + } + + unsigned opcode = program.insns[insn_num]->opcode; + if(opcode == TPF_OPCODE_LD || opcode == TPF_OPCODE_LD_MS) + sampler = -1; + if(sampler >= -1 && resource >= 0) + pairs.insert(std::make_pair(resource, sampler)); + if(opcode == TPF_OPCODE_RESINFO) + resinfos.insert(resource); + } + + for(std::set >::iterator i = pairs.begin(); i != pairs.end(); ++i) + { + program.resource_sampler_to_slot[*i] = program.slot_to_resource.size(); + if(!program.resource_to_slot.count(i->first)) + { + program.resource_to_slot[i->first] = program.slot_to_resource.size(); + resinfos.erase(i->first); + } + program.slot_to_resource.push_back(i->first); + program.slot_to_sampler.push_back(i->second); + } + + for(std::set::iterator i = resinfos.begin(); i != resinfos.end(); ++i) + { + program.resource_sampler_to_slot[std::make_pair(*i, -1)] = program.slot_to_resource.size(); + program.resource_to_slot[*i] = program.slot_to_resource.size(); + program.slot_to_resource.push_back(*i); + program.slot_to_sampler.push_back(-1); + } + program.resource_sampler_slots_assigned = true; + return true; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp new file mode 100644 index 00000000000..2e6e0949a8a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp @@ -0,0 +1,222 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "tpf.h" + +// TODO: we should fix this to output the same syntax as fxc, if tpf_dump_ms_syntax is set + +bool tpf_dump_ms_syntax = true; + +std::ostream& operator <<(std::ostream& out, const tpf_op& op) +{ + if(op.neg) + out << '-'; + if(op.abs) + out << '|'; + if(op.file == TPF_FILE_IMMEDIATE32) + { + out << "l("; + for(unsigned i = 0; i < op.comps; ++i) + { + if(i) + out << ", "; + out << op.imm_values[i].f32; + } + out << ")"; + } + else if(op.file == TPF_FILE_IMMEDIATE64) + { + out << "d("; + for(unsigned i = 0; i < op.comps; ++i) + { + if(i) + out << ", "; + out << op.imm_values[i].f64; + } + out << ")"; + return out; + } + else + { + bool naked = false; + if(tpf_dump_ms_syntax) + { + switch(op.file) + { + case TPF_FILE_TEMP: + case TPF_FILE_INPUT: + case TPF_FILE_OUTPUT: + case TPF_FILE_CONSTANT_BUFFER: + case TPF_FILE_INDEXABLE_TEMP: + case TPF_FILE_UNORDERED_ACCESS_VIEW: + case TPF_FILE_THREAD_GROUP_SHARED_MEMORY: + naked = true; + break; + default: + naked = false; + break; + } + } + + out << (tpf_dump_ms_syntax ? tpf_file_ms_names : tpf_file_names)[op.file]; + + if(op.indices[0].reg.get()) + naked = false; + + for(unsigned i = 0; i < op.num_indices; ++i) + { + if(!naked || i) + out << '['; + if(op.indices[i].reg.get()) + { + out << *op.indices[i].reg; + if(op.indices[i].disp) + out << '+' << op.indices[i].disp; + } + else + out << op.indices[i].disp; + if(!naked || i) + out << ']'; + } + if(op.comps) + { + switch(op.mode) + { + case TPF_OPERAND_MODE_MASK: + out << (tpf_dump_ms_syntax ? '.' : '!'); + for(unsigned i = 0; i < op.comps; ++i) + { + if(op.mask & (1 << i)) + out << "xyzw"[i]; + } + break; + case TPF_OPERAND_MODE_SWIZZLE: + out << '.'; + for(unsigned i = 0; i < op.comps; ++i) + out << "xyzw"[op.swizzle[i]]; + break; + case TPF_OPERAND_MODE_SCALAR: + out << (tpf_dump_ms_syntax ? '.' : ':'); + out << "xyzw"[op.swizzle[0]]; + break; + } + } + } + if(op.abs) + out << '|'; + return out; +} + +std::ostream& operator <<(std::ostream& out, const tpf_dcl& dcl) +{ + out << tpf_opcode_names[dcl.opcode]; + switch(dcl.opcode) + { + case TPF_OPCODE_DCL_GLOBAL_FLAGS: + if(dcl.dcl_global_flags.allow_refactoring) + out << " refactoringAllowed"; + if(dcl.dcl_global_flags.early_depth_stencil) + out << " forceEarlyDepthStencil"; + if(dcl.dcl_global_flags.fp64) + out << " enableDoublePrecisionFloatOps"; + if(dcl.dcl_global_flags.enable_raw_and_structured_in_non_cs) + out << " enableRawAndStructuredBuffers"; + break; + case TPF_OPCODE_DCL_INPUT_PS: + case TPF_OPCODE_DCL_INPUT_PS_SIV: + case TPF_OPCODE_DCL_INPUT_PS_SGV: + out << ' ' << tpf_interpolation_names[dcl.dcl_input_ps.interpolation]; + break; + case TPF_OPCODE_DCL_TEMPS: + out << ' ' << dcl.num; + break; + default: + break; + } + if(dcl.op.get()) + out << ' ' << *dcl.op; + switch(dcl.opcode) + { + case TPF_OPCODE_DCL_CONSTANT_BUFFER: + out << ", " << (dcl.dcl_constant_buffer.dynamic ? "dynamicIndexed" : "immediateIndexed"); + break; + case TPF_OPCODE_DCL_INPUT_SIV: + case TPF_OPCODE_DCL_INPUT_SGV: + case TPF_OPCODE_DCL_OUTPUT_SIV: + case TPF_OPCODE_DCL_OUTPUT_SGV: + case TPF_OPCODE_DCL_INPUT_PS_SIV: + case TPF_OPCODE_DCL_INPUT_PS_SGV: + out << ", " << tpf_sv_names[dcl.num]; + break; + } + + return out; +} + +std::ostream& operator <<(std::ostream& out, const tpf_insn& insn) +{ + out << tpf_opcode_names[insn.opcode]; + if(insn.insn.sat) + out << "_sat"; + for(unsigned i = 0; i < insn.num_ops; ++i) + { + if(i) + out << ','; + out << ' ' << *insn.ops[i]; + } + return out; +} + +std::ostream& operator <<(std::ostream& out, const tpf_program& program) +{ + out << "pvghdc"[program.version.type] << "s_" << program.version.major << "_" << program.version.minor << "\n"; + for(unsigned i = 0; i < program.dcls.size(); ++i) + out << *program.dcls[i] << "\n"; + + for(unsigned i = 0; i < program.insns.size(); ++i) + out << *program.insns[i] << "\n"; + return out; +} + +void tpf_op::dump() +{ + std::cout << *this; +} + +void tpf_insn::dump() +{ + std::cout << *this; +} + +void tpf_dcl::dump() +{ + std::cout << *this; +} + +void tpf_program::dump() +{ + std::cout << *this; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp new file mode 100644 index 00000000000..a4f6cc6b661 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp @@ -0,0 +1,424 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "tpf.h" +#include "utils.h" + +#if 1 +#define check(x) assert(x) +#define fail(x) assert(0 && (x)) +#else +#define check(x) do {if(!(x)) throw(#x);} while(0) +#define fail(x) throw(x) +#endif + +struct tpf_parser +{ + unsigned* tokens; + unsigned* tokens_end; + tpf_program& program; + + tpf_parser(tpf_program& program, void* p_tokens, unsigned size) + : program(program) + { + tokens = (unsigned*)p_tokens; + tokens_end = (unsigned*)((char*)p_tokens + size); + } + + /* TODO: byteswap if machine is big endian */ + uint32_t read32() + { + check(tokens < tokens_end); + return bswap_le32(*tokens++); + } + + template + void read_token(T* tok) + { + *(unsigned*)tok = read32(); + } + + uint64_t read64() + { + unsigned a = read32(); + unsigned b = read32(); + return (uint64_t)a | ((uint64_t)b << 32); + } + + void skip(unsigned toskip) + { + tokens += toskip; + } + + void read_op(tpf_op* pop) + { + tpf_op& op = *pop; + tpf_token_operand optok; + read_token(&optok); + assert(optok.file < TPF_FILE_COUNT); + op.swizzle[0] = 0; + op.swizzle[1] = 1; + op.swizzle[2] = 2; + op.swizzle[3] = 3; + op.mask = 0xf; + switch(optok.comps_enum) + { + case TPF_OPERAND_COMPS_0: + op.comps = 0; + break; + case TPF_OPERAND_COMPS_1: + op.comps = 1; + break; + case TPF_OPERAND_COMPS_4: + op.comps = 4; + op.mode = optok.mode; + switch(optok.mode) + { + case TPF_OPERAND_MODE_MASK: + op.mask = TPF_OPERAND_SEL_MASK(optok.sel); + break; + case TPF_OPERAND_MODE_SWIZZLE: + op.swizzle[0] = TPF_OPERAND_SEL_SWZ(optok.sel, 0); + op.swizzle[1] = TPF_OPERAND_SEL_SWZ(optok.sel, 1); + op.swizzle[2] = TPF_OPERAND_SEL_SWZ(optok.sel, 2); + op.swizzle[3] = TPF_OPERAND_SEL_SWZ(optok.sel, 3); + break; + case TPF_OPERAND_MODE_SCALAR: + op.swizzle[0] = op.swizzle[1] = op.swizzle[2] = op.swizzle[3] = TPF_OPERAND_SEL_SCALAR(optok.sel); + break; + } + break; + case TPF_OPERAND_COMPS_N: + fail("Unhandled operand component type"); + } + op.file = (tpf_file)optok.file; + op.num_indices = optok.num_indices; + + if(optok.extended) + { + tpf_token_operand_extended optokext; + read_token(&optokext); + if(optokext.type == 0) + {} + else if(optokext.type == 1) + { + op.neg = optokext.neg; + op.abs= optokext.abs; + } + else + fail("Unhandled extended operand token type"); + } + + for(unsigned i = 0; i < op.num_indices; ++i) + { + unsigned repr; + if(i == 0) + repr = optok.index0_repr; + else if(i == 1) + repr = optok.index1_repr; + else if(i == 2) + repr = optok.index2_repr; + else + fail("Unhandled operand index representation"); + op.indices[0].disp = 0; + // TODO: is disp supposed to be signed here?? + switch(repr) + { + case TPF_OPERAND_INDEX_REPR_IMM32: + op.indices[i].disp = (int32_t)read32(); + break; + case TPF_OPERAND_INDEX_REPR_IMM64: + op.indices[i].disp = read64(); + break; + case TPF_OPERAND_INDEX_REPR_REG: +relative: + op.indices[i].reg.reset(new tpf_op()); + read_op(&*op.indices[0].reg); + break; + case TPF_OPERAND_INDEX_REPR_REG_IMM32: + op.indices[i].disp = (int32_t)read32(); + goto relative; + case TPF_OPERAND_INDEX_REPR_REG_IMM64: + op.indices[i].disp = read64(); + goto relative; + } + } + + if(op.file == TPF_FILE_IMMEDIATE32) + { + for(unsigned i = 0; i < op.comps; ++i) + op.imm_values[i].i32 = read32(); + } + else if(op.file == TPF_FILE_IMMEDIATE64) + { + for(unsigned i = 0; i < op.comps; ++i) + op.imm_values[i].i64 = read64(); + } + } + + void do_parse() + { + read_token(&program.version); + + unsigned lentok = read32(); + tokens_end = tokens - 2 + lentok; + + while(tokens != tokens_end) + { + tpf_token_instruction insntok; + read_token(&insntok); + unsigned* insn_end = tokens - 1 + insntok.length; + tpf_opcode opcode = (tpf_opcode)insntok.opcode; + check(opcode < TPF_OPCODE_D3D11_COUNT); + + if(opcode == TPF_OPCODE_CUSTOMDATA) + { + unsigned customlen = read32() - 2; + skip(customlen); + continue; + } + + if((opcode >= TPF_OPCODE_DCL_RESOURCE && opcode <= TPF_OPCODE_DCL_GLOBAL_FLAGS) + || (opcode >= TPF_OPCODE_DCL_STREAM && opcode <= TPF_OPCODE_DCL_RESOURCE_STRUCTURED)) + { + tpf_dcl& dcl = *new tpf_dcl; + program.dcls.push_back(&dcl); + (tpf_token_instruction&)dcl = insntok; + + tpf_token_instruction_extended exttok; + memcpy(&exttok, &insntok, sizeof(exttok)); + while(exttok.extended) + { + read_token(&exttok); + } + +#define READ_OP_ANY dcl.op.reset(new tpf_op()); read_op(&*dcl.op); +#define READ_OP(FILE) READ_OP_ANY + //check(dcl.op->file == TPF_FILE_##FILE); + + switch(opcode) + { + case TPF_OPCODE_DCL_GLOBAL_FLAGS: + break; + case TPF_OPCODE_DCL_RESOURCE: + READ_OP(RESOURCE); + read_token(&dcl.rrt); + break; + case TPF_OPCODE_DCL_SAMPLER: + READ_OP(SAMPLER); + break; + case TPF_OPCODE_DCL_INPUT: + case TPF_OPCODE_DCL_INPUT_PS: + READ_OP(INPUT); + break; + case TPF_OPCODE_DCL_INPUT_SIV: + case TPF_OPCODE_DCL_INPUT_SGV: + case TPF_OPCODE_DCL_INPUT_PS_SIV: + case TPF_OPCODE_DCL_INPUT_PS_SGV: + READ_OP(INPUT); + dcl.sv = (tpf_sv)(uint16_t)read32(); + break; + case TPF_OPCODE_DCL_OUTPUT: + READ_OP(OUTPUT); + break; + case TPF_OPCODE_DCL_OUTPUT_SIV: + case TPF_OPCODE_DCL_OUTPUT_SGV: + READ_OP(OUTPUT); + dcl.sv = (tpf_sv)(uint16_t)read32(); + break; + case TPF_OPCODE_DCL_INDEX_RANGE: + READ_OP_ANY; + check(dcl.op->file == TPF_FILE_INPUT || dcl.op->file == TPF_FILE_OUTPUT); + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_TEMPS: + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_INDEXABLE_TEMP: + READ_OP(INDEXABLE_TEMP); + dcl.indexable_temp.num = read32(); + dcl.indexable_temp.comps = read32(); + break; + case TPF_OPCODE_DCL_CONSTANT_BUFFER: + READ_OP(CONSTANT_BUFFER); + break; + case TPF_OPCODE_DCL_GS_INPUT_PRIMITIVE: + case TPF_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY: + break; + case TPF_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT: + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_GS_INSTANCE_COUNT: + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT: + case TPF_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT: + case TPF_OPCODE_DCL_TESS_DOMAIN: + case TPF_OPCODE_DCL_TESS_PARTITIONING: + case TPF_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE: + break; + case TPF_OPCODE_DCL_HS_MAX_TESSFACTOR: + dcl.f32 = read32(); + break; + case TPF_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT: + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_FUNCTION_BODY: + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_FUNCTION_TABLE: + dcl.num = read32(); + dcl.data = malloc(dcl.num * sizeof(uint32_t)); + for(unsigned i = 0; i < dcl.num; ++i) + ((uint32_t*)dcl.data)[i] = read32(); + break; + case TPF_OPCODE_DCL_INTERFACE: + dcl.intf.id = read32(); + dcl.intf.expected_function_table_length = read32(); + { + uint32_t v = read32(); + dcl.intf.table_length = v & 0xffff; + dcl.intf.array_length = v >> 16; + } + dcl.data = malloc(dcl.intf.table_length * sizeof(uint32_t)); + for(unsigned i = 0; i < dcl.intf.table_length; ++i) + ((uint32_t*)dcl.data)[i] = read32(); + break; + case TPF_OPCODE_DCL_THREAD_GROUP: + dcl.thread_group_size[0] = read32(); + dcl.thread_group_size[1] = read32(); + dcl.thread_group_size[2] = read32(); + break; + case TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED: + READ_OP(UNORDERED_ACCESS_VIEW); + read_token(&dcl.rrt); + break; + case TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW: + READ_OP(UNORDERED_ACCESS_VIEW); + break; + case TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED: + READ_OP(UNORDERED_ACCESS_VIEW); + dcl.structured.stride = read32(); + break; + case TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW: + READ_OP(THREAD_GROUP_SHARED_MEMORY); + dcl.num = read32(); + break; + case TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED: + READ_OP(THREAD_GROUP_SHARED_MEMORY); + dcl.structured.stride = read32(); + dcl.structured.count = read32(); + break; + case TPF_OPCODE_DCL_RESOURCE_RAW: + READ_OP(RESOURCE); + break; + case TPF_OPCODE_DCL_RESOURCE_STRUCTURED: + READ_OP(RESOURCE); + dcl.structured.stride = read32(); + break; + case TPF_OPCODE_DCL_STREAM: + /* TODO: dcl_stream is undocumented: what is it? */ + fail("Unhandled dcl_stream since it's undocumented"); + default: + fail("Unhandled declaration"); + } + + check(tokens == insn_end); + } + else + { + tpf_insn& insn = *new tpf_insn; + program.insns.push_back(&insn); + (tpf_token_instruction&)insn = insntok; + + tpf_token_instruction_extended exttok; + memcpy(&exttok, &insntok, sizeof(exttok)); + while(exttok.extended) + { + read_token(&exttok); + if(exttok.type == TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_SAMPLE_CONTROLS) + { + insn.sample_offset[0] = exttok.sample_controls.offset_u; + insn.sample_offset[1] = exttok.sample_controls.offset_v; + insn.sample_offset[2] = exttok.sample_controls.offset_w; + } + else if(exttok.type == TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_DIM) + insn.resource_target = exttok.resource_target.target; + else if(exttok.type == TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_RETURN_TYPE) + { + insn.resource_return_type[0] = exttok.resource_return_type.x; + insn.resource_return_type[1] = exttok.resource_return_type.y; + insn.resource_return_type[2] = exttok.resource_return_type.z; + insn.resource_return_type[3] = exttok.resource_return_type.w; + } + } + + switch(opcode) + { + case TPF_OPCODE_INTERFACE_CALL: + insn.num = read32(); + break; + default: + break; + } + + unsigned op_num = 0; + while(tokens != insn_end) + { + check(tokens < insn_end); + check(op_num < TPF_MAX_OPS); + insn.ops[op_num].reset(new tpf_op); + read_op(&*insn.ops[op_num]); + ++op_num; + } + insn.num_ops = op_num; + } + } + } + + const char* parse() + { + try + { + do_parse(); + return 0; + } + catch(const char* error) + { + return error; + } + } +}; + +tpf_program* tpf_parse(void* tokens, int size) +{ + tpf_program* program = new tpf_program; + tpf_parser parser(*program, tokens, size); + if(!parser.parse()) + return program; + delete program; + return 0; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp new file mode 100644 index 00000000000..94192c92792 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp @@ -0,0 +1,385 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +// generated with sed -re 's/TPF_WHATEVER_//; s/=.*//; s,//.*,,; s/,//; s/\s*//g;'|tr '[A-Z]' '[a-z]'|tr -s '\n'|sed -re 's/(.*)/\t"\1",/g' + +const char* tpf_opcode_names[] = +{ + "add", + "and", + "break", + "breakc", + "call", + "callc", + "case", + "continue", + "continuec", + "cut", + "default", + "deriv_rtx", + "deriv_rty", + "discard", + "div", + "dp2", + "dp3", + "dp4", + "else", + "emit", + "emitthencut", + "endif", + "endloop", + "endswitch", + "eq", + "exp", + "frc", + "ftoi", + "ftou", + "ge", + "iadd", + "if", + "ieq", + "ige", + "ilt", + "imad", + "imax", + "imin", + "imul", + "ine", + "ineg", + "ishl", + "ishr", + "itof", + "label", + "ld", + "ld_ms", + "log", + "loop", + "lt", + "mad", + "min", + "max", + "customdata", + "mov", + "movc", + "mul", + "ne", + "nop", + "not", + "or", + "resinfo", + "ret", + "retc", + "round_ne", + "round_ni", + "round_pi", + "round_z", + "rsq", + "sample", + "sample_c", + "sample_c_lz", + "sample_l", + "sample_d", + "sample_b", + "sqrt", + "switch", + "sincos", + "udiv", + "ult", + "uge", + "umul", + "umad", + "umax", + "umin", + "ushr", + "utof", + "xor", + "dcl_resource", + "dcl_constant_buffer", + "dcl_sampler", + "dcl_index_range", + "dcl_gs_output_primitive_topology", + "dcl_gs_input_primitive", + "dcl_max_output_vertex_count", + "dcl_input", + "dcl_input_sgv", + "dcl_input_siv", + "dcl_input_ps", + "dcl_input_ps_sgv", + "dcl_input_ps_siv", + "dcl_output", + "dcl_output_sgv", + "dcl_output_siv", + "dcl_temps", + "dcl_indexable_temp", + "dcl_global_flags", + "d3d10_count", + "lod", + "gather4", + "sample_pos", + "sample_info", + "d3d10_1_count", + "hs_decls", + "hs_control_point_phase", + "hs_fork_phase", + "hs_join_phase", + "emit_stream", + "cut_stream", + "emitthencut_stream", + "interface_call", + "bufinfo", + "deriv_rtx_coarse", + "deriv_rtx_fine", + "deriv_rty_coarse", + "deriv_rty_fine", + "gather4_c", + "gather4_po", + "gather4_po_c", + "rcp", + "f32tof16", + "f16tof32", + "uaddc", + "usubb", + "countbits", + "firstbit_hi", + "firstbit_lo", + "firstbit_shi", + "ubfe", + "ibfe", + "bfi", + "bfrev", + "swapc", + "dcl_stream", + "dcl_function_body", + "dcl_function_table", + "dcl_interface", + "dcl_input_control_point_count", + "dcl_output_control_point_count", + "dcl_tess_domain", + "dcl_tess_partitioning", + "dcl_tess_output_primitive", + "dcl_hs_max_tessfactor", + "dcl_hs_fork_phase_instance_count", + "dcl_hs_join_phase_instance_count", + "dcl_thread_group", + "dcl_unordered_access_view_typed", + "dcl_unordered_access_view_raw", + "dcl_unordered_access_view_structured", + "dcl_thread_group_shared_memory_raw", + "dcl_thread_group_shared_memory_structured", + "dcl_resource_raw", + "dcl_resource_structured", + "ld_uav_typed", + "store_uav_typed", + "ld_raw", + "store_raw", + "ld_structured", + "store_structured", + "atomic_and", + "atomic_or", + "atomic_xor", + "atomic_cmp_store", + "atomic_iadd", + "atomic_imax", + "atomic_imin", + "atomic_umax", + "atomic_umin", + "imm_atomic_alloc", + "imm_atomic_consume", + "imm_atomic_iadd", + "imm_atomic_and", + "imm_atomic_or", + "imm_atomic_xor", + "imm_atomic_exch", + "imm_atomic_cmp_exch", + "imm_atomic_imax", + "imm_atomic_imin", + "imm_atomic_umax", + "imm_atomic_umin", + "sync", + "dadd", + "dmax", + "dmin", + "dmul", + "deq", + "dge", + "dlt", + "dne", + "dmov", + "dmovc", + "dtof", + "ftod", + "eval_snapped", + "eval_sample_index", + "eval_centroid", + "dcl_gs_instance_count", + "d3d11_count", +}; + +const char* tpf_file_names[] = +{ + "temp", + "input", + "output", + "indexable_temp", + "immediate32", + "immediate64", + "sampler", + "resource", + "constant_buffer", + "immediate_constant_buffer", + "label", + "input_primitiveid", + "output_depth", + "null", + "rasterizer", + "output_coverage_mask", + "stream", + "function_body", + "function_table", + "interface", + "function_input", + "function_output", + "output_control_point_id", + "input_fork_instance_id", + "input_join_instance_id", + "input_control_point", + "output_control_point", + "input_patch_constant", + "input_domain_point", + "this_pointer", + "unordered_access_view", + "thread_group_shared_memory", + "input_thread_id", + "input_thread_group_id", + "input_thread_id_in_group", + "input_coverage_mask", + "input_thread_id_in_group_flattened", + "input_gs_instance_id", + "output_depth_greater_equal", + "output_depth_less_equal", + "cycle_counter", +}; + +const char* tpf_file_ms_names[] = +{ + "r", + "v", + "o", + "x", + "l", + "d", + "sampler", + "resource", + "cb", + "icb", + "label", + "vPrim", + "oDepth", + "null", + "rasterizer", + "oMask", + "stream", + "function_body", + "function_table", + "interface", + "function_input", + "function_output", + "vOutputControlPointID", + "vForkInstanceID", + "vJoinInstanceID", + "vicp", + "vocp", + "input_patch_constant", + "vDomain", + "this", + "u", + "g", + "vThreadID", + "vThreadGrouID", + "vThreadIDInGroup", + "vCoverage", + "vThreadIDInGroupFlattened", + "vGSInstanceID", + "oDepthGE", + "oDepthLE", + "vCycleCounter", +}; + +const char* tpf_target_names[] = +{ + "unknown", + "buffer", + "texture1d", + "texture2d", + "texture2dms", + "texture3d", + "texturecube", + "texture1darray", + "texture2darray", + "texture2dmsarray", + "texturecubearray", + "raw_buffer", + "structured_buffer", +}; + +const char* tpf_interpolation_names[] = +{ + "undefined", + "constant", + "linear", + "linear centroid", + "linear noperspective", + "linear noperspective centroid", + "linear sample", + "linear noperspective sample", +}; + +const char* tpf_sv_names[] = +{ + "undefined", + "position", + "clip_distance", + "cull_distance", + "render_target_array_index", + "viewport_array_index", + "vertex_id", + "primitive_id", + "instance_id", + "is_front_face", + "sample_index", + "final_quad_u_eq_0_edge_tessfactor", + "final_quad_v_eq_0_edge_tessfactor", + "final_quad_u_eq_1_edge_tessfactor", + "final_quad_v_eq_1_edge_tessfactor", + "final_quad_u_inside_tessfactor", + "final_quad_v_inside_tessfactor", + "final_tri_u_eq_0_edge_tessfactor", + "final_tri_v_eq_0_edge_tessfactor", + "final_tri_w_eq_0_edge_tessfactor", + "final_tri_inside_tessfactor", + "final_line_detail_tessfactor", + "final_line_density_tessfactor", +}; diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/utils.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/utils.h new file mode 100644 index 00000000000..6e77b51175d --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/utils.h @@ -0,0 +1,45 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef BYTESWAP_H_ +#define BYTESWAP_H_ + +#include +#include + +#ifdef WORDS_BIGENDIAN +static inline uint32_t le32_to_cpu(uint32_t v) +{ + return ((v & 0xff) << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | ((v & 0xff000000) >> 24); +} +#else +static inline uint32_t le32_to_cpu(uint32_t v) +{ + return v; +} +#endif + +#endif /* BYTESWAP_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp new file mode 100644 index 00000000000..721f95fc8ac --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp @@ -0,0 +1,75 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "dxbc.h" +#include "tpf.h" +#include +#include + +void usage() +{ + std::cerr << "Gallium Direct3D10/11 Shader Disassembler\n"; + std::cerr << "This program is free software, released under a MIT-like license\n"; + std::cerr << "Not affiliated with or endorsed by Microsoft in any way\n"; + std::cerr << "Latest version available from http://cgit.freedesktop.org/mesa/mesa/\n"; + std::cerr << "\n"; + std::cerr << "Usage: fxdis FILE\n"; + std::cerr << std::endl; +} + +int main(int argc, char** argv) +{ + if(argc < 2) + { + usage(); + return 1; + } + + std::vector data; + std::ifstream in(argv[1]); + char c; + in >> std::noskipws; + while(in >> c) + data.push_back(c); + in.close(); + + dxbc_container* dxbc = dxbc_parse(&data[0], data.size()); + if(dxbc) + { + std::cout << *dxbc; + dxbc_chunk_header* tpf_chunk = dxbc_find_shader_bytecode(&data[0], data.size()); + if(tpf_chunk) + { + tpf_program* tpf = tpf_parse(tpf_chunk + 1, bswap_le32(tpf_chunk->size)); + if(tpf) + { + std::cout << *tpf; + delete tpf; + } + } + delete dxbc; + } +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xstutil/Makefile new file mode 100644 index 00000000000..f986f8e5f19 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/Makefile @@ -0,0 +1,5 @@ +LIBNAME=d3d1xstutil +CPP_SOURCES=$(wildcard src/*.cpp) +LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../../../include -I../../../auxiliary + +include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h new file mode 100644 index 00000000000..a9260acdbab --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -0,0 +1,1038 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef D3D1XSTUTIL_H_ +#define D3D1XSTUTIL_H_ + +#ifdef _MSC_VER +#include +#include +#else +#include +#include +namespace std +{ + using namespace tr1; +} +#endif +#include +#include + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + +#ifdef __GNUC__ +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#else +#define ATTRIBUTE_UNUSED +#endif + +// just replicate GUIDs in every object file to avoid the hassle of having to pull in a library for them +#undef DEFINE_GUID +#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + static const GUID name ATTRIBUTE_UNUSED = \ + { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } + +#include "galliumdxgi.h" + +extern "C" +{ +#include +#include +#include +} + +#include +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + +/* NOTE: this _depends_ on the vtable layout of the C++ compiler to be + * binary compatible with Windows. + * Furthermore some absurd vtable layout likely won't work at all, since + * we perform some casts which are probably not safe by the C++ standard. + * + * In particular, the GNU/Linux/Itanium/clang ABI and Microsoft ABIs will work, + * but others may not. + * If in doubt, just switch to the latest version of a widely used C++ compiler. + * + * DESIGN of the Gallium COM implementation + * + * This state tracker uses somewhat unusual C++ coding patterns, + * to implement the COM interfaces required by Direct3D. + * + * While it may seem complicated, the effect is that the result + * generally behaves as intuitively as possible: in particular pointer + * casts very rarely change the pointer value (only for secondary + * DXGI/Gallium interfaces) + * + * Implementing COM is on first sight very easy: after all, it just + * consists of a reference count, and a dynamic_cast<> equivalent. + * + * However, implementing objects with multiple interfaces is actually + * quite tricky. + * The issue is that the interface pointers can't be equal, since this + * would place incompatible constraints on the vtable layout and thus + * multiple inheritance (and the subobjects the C++ compiler creates + * with it) must be correctly used. + * + * Furthermore, we must have a single reference count, which means + * that a naive implementation won't work, and it's necessary to either + * use virtual inheritance, or the "mixin inheritance" model we use. + * + * This solution aims to achieve the following object layout: + * 0: pointer to vtable for primary interface + * 1: reference count + * ... main class + * ... vtable pointers for secondary interfaces + * ... implementation of subclasses assuming secondary interfaces + * + * This allows us to cast pointers by just reinterpreting the value in + * almost all cases. + * + * To achieve this, *all* non-leaf classes must have their parent + * or the base COM interface as a template parameter, since derived + * classes may need to change that to support an interface derived + * from the one implemented by the superclass. + * + * Note however, that you can cast without regard to the template + * parameter, because only the vtable layout depends on it, since + * interfaces have no data members. + * + * For this to work, DON'T USE VIRTUAL FUNCTIONS except to implement + * interfaces, since the vtable layouts would otherwise be mismatched. + * An exception are virtual functions called only from other virtual functions, + * which is currently only used for the virtual destructor. + * + * The base class is GalliumComObject, which implements the + * IUnknown interface, and inherits IFoo. + * + * To support multiple inheritance, we insert GalliumMultiComObject, + * which redirects the secondary interfaces to the GalliumComObject + * superclass. + * + * Gallium(Multi)PrivateDataComObject is like ComObject but also + * implements the Get/SetPrivateData functions present on several + * D3D/DXGI interfaces. + * + * Example class hierarchy: + * + * IUnknown + * (pure interface) + * | + * V + * IAnimal + * (pure interface) + * | + * V + * IDuck + * (pure interface) + * | + * V + * GalliumComObject + * (non-instantiable, only implements IUnknown) + * | + * V + * GalliumAnimal + * (non-instantiable, only implements IAnimal) + * | + * V + * GalliumDuck + * (concrete) + * | + * V + * GalliumMultiComObject <- IWheeledVehicle <- IVehicle <- IUnknown (second version) + * (non-instantiable, only implements IDuck and the IUnknown of IWheeledVehicle) + * | + * V + * GalliumDuckOnWheels + * (concrete) + * + * This will produce the desired layout. + * Note that GalliumAnimal* is safely castable to GalliumAnimal* + * by reinterpreting, as long as non-interface virtual functions are not used, + * and that you only call interface functions for the superinterface of IBar + * that the object actually implements. + * + * Instead, if GalliumDuck where to inherit both from GalliumAnimal + * and IDuck, then (IDuck*)gallium_duck and (IAnimal*)gallium_duck would + * have different pointer values, which the "base class as template parameter" + * trick avoids. + * + * The price we pay is that you MUST NOT have virtual functions other than those + * implementing interfaces (except for leaf classes) since the position of these + * would depend on the base interface. + * As mentioned above, virtual functions only called from interface functions + * are an exception, currently used only for the virtual destructor. + * If you want virtual functions anyway , put them in a separate interface class, + * multiply inherit from that and cast the pointer to that interface. + * + * You CAN however have virtual functions on any class which does not specify + * his base as a template parameter, or where you don't need to change the + * template base interface parameter by casting. + * + * --- The magic QueryInterface "delete this" trick --- + * + * When the reference count drops to 0, we must delete the class. + * The problem is, that we must call the right virtual destructor (i.e. on the right class). + * However, we would like to be able to call release() and nonatomic_release() + * non-virtually for performance (also, the latter cannot be called virtually at all, since + * IUnknown does not offer it). + * + * The naive solution would be to just add a virtual destructor and rely on it. + * However, this doesn't work due to the fact that as described above we perform casets + * with are unsafe regarding vtable layout. + * In particular, consider the case where we try to delete GalliumComObject + * with a pointer to GalliumComObject. + * Since we think that this is a GalliumComObject, we'll look for the + * destructor in the vtable slot immediately after the ID3D11Resource vtable, but this is + * actually an ID3D11Texture2D function implemented by the object! + * + * So, we must put the destructor somewhere else. + * We could add it as a data member, but it would be awkward and it would bloat the + * class. + * Thus, we use this trick: we reuse the vtable slot for QueryInterface, which is always at the + * same position. + * To do so, we define a special value for the first pointer argument, that triggers a + * "delete this". + * In addition to that, we add a virtual destructor to GalliumComObject. + * That virtual destructor will be called by QueryInterface, and since that is a virtual + * function, it will know the correct place for the virtual destructor. + * + * QueryInterface is already slow due to the need to compare several GUIDs, so the + * additional pointer test should not be significant. + * + * Of course the ideal solution would be telling the C++ compiler to put the + * destructor it in a negative vtable slot, but unfortunately GCC doesn't support that + * yet, and this method is almost as good as that. + */ + +template +struct com_traits; + +#define COM_INTERFACE(intf, base) \ +template<> \ +struct com_traits \ +{ \ + static REFIID iid() {return IID_##intf;} \ + static inline bool is_self_or_ancestor(REFIID riid) {return riid == iid() || com_traits::is_self_or_ancestor(riid);} \ +}; + +template<> +struct com_traits +{ + static REFIID iid() {return IID_IUnknown;} + static inline bool is_self_or_ancestor(REFIID riid) {return riid == iid();} +}; + +#ifndef _MSC_VER +#define __uuidof(T) (com_traits::iid()) +#endif + +struct refcnt_t +{ + uint32_t refcnt; + + refcnt_t(unsigned v = 1) + : refcnt(v) + {} + + unsigned add_ref() + { + p_atomic_inc((int32_t*)&refcnt); + return refcnt; + } + + unsigned release() + { + if(p_atomic_dec_zero((int32_t*)&refcnt)) + return 0; + return refcnt; + } + + void nonatomic_add_ref() + { + p_atomic_inc((int32_t*)&refcnt); + } + + unsigned nonatomic_release() + { + if(p_atomic_dec_zero((int32_t*)&refcnt)) + return 0; + else + return 1; + } +}; + +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) +/* this should be safe because atomic ops are full memory barriers, and thus a sequence that does: + * ++one_refcnt; + * --other_refcnt; + * should never be reorderable (as seen from another CPU) to: + * --other_refcnt + * ++one_refcnt + * + * since one of the ops is atomic. + * If this weren't the case, a CPU could incorrectly destroy an object manipulated in that way by another one. + */ +struct dual_refcnt_t +{ + union + { + uint64_t refcnt; + struct + { + uint32_t atomic_refcnt; + uint32_t nonatomic_refcnt; + }; + }; + + dual_refcnt_t(unsigned v = 1) + { + atomic_refcnt = v; + nonatomic_refcnt = 0; + } + + bool is_zero() + { + if(sizeof(void*) == 8) + return *(volatile uint64_t*)&refcnt == 0ULL; + else + { + uint64_t v; + do + { + v = refcnt; + } + while(!__sync_bool_compare_and_swap(&refcnt, v, v)); + return v == 0ULL; + } + } + + unsigned add_ref() + { + //printf("%p add_ref at %u %u\n", this, atomic_refcnt, nonatomic_refcnt); + p_atomic_inc((int32_t*)&atomic_refcnt); + return atomic_refcnt + nonatomic_refcnt; + } + + unsigned release() + { + //printf("%p release at %u %u\n", this, atomic_refcnt, nonatomic_refcnt); + if(p_atomic_dec_zero((int32_t*)&atomic_refcnt) && !nonatomic_refcnt && is_zero()) + return 0; + unsigned v = atomic_refcnt + nonatomic_refcnt; + return v ? v : 1; + } + + void nonatomic_add_ref() + { + //printf("%p nonatomic_add_ref at %u %u\n", this, atomic_refcnt, nonatomic_refcnt); + ++nonatomic_refcnt; + } + + unsigned nonatomic_release() + { + //printf("%p nonatomic_release at %u %u\n", this, atomic_refcnt, nonatomic_refcnt); + if(!--nonatomic_refcnt && !atomic_refcnt && is_zero()) + return 0; + return 1; + } +}; +#else +// this will result in atomic operations being used while they could have been avoided +#ifdef __i386__ +#warning Compile for 586+ using GCC to improve the performance of the Direct3D 10/11 state tracker +#endif +typedef refcnt_t dual_refcnt_t; +#endif + +#define IID_MAGIC_DELETE_THIS (*(const IID*)((intptr_t)-(int)(sizeof(IID) - 1))) + +template +struct GalliumComObject : public Base +{ + RefCnt refcnt; + + GalliumComObject() + {} + + /* DO NOT CALL this from externally called non-virtual functions in derived classes, since + * the vtable position depends on the COM interface being implemented + */ + virtual ~GalliumComObject() + {} + + inline ULONG add_ref() + { + return refcnt.add_ref(); + } + + inline ULONG release() + { + ULONG v = refcnt.release(); + if(!v) + { + /* this will call execute "delete this", using the correct vtable slot for the destructor */ + /* see the initial comment for an explaination of this magic trick */ + this->QueryInterface(IID_MAGIC_DELETE_THIS, 0); + return 0; + } + return v; + } + + inline void nonatomic_add_ref() + { + refcnt.nonatomic_add_ref(); + } + + inline void nonatomic_release() + { + if(!refcnt.nonatomic_release()) + { + /* this will execute "delete this", using the correct vtable slot for the destructor */ + /* see the initial comment for an explaination of this magic trick */ + this->QueryInterface(IID_MAGIC_DELETE_THIS, 0); + } + } + + inline HRESULT query_interface(REFIID riid, void **ppvObject) + { + if(com_traits::is_self_or_ancestor(riid)) + { + // must be the virtual AddRef, since it is overridden by some classes + this->AddRef(); + *ppvObject = this; + return S_OK; + } + else + return E_NOINTERFACE; + } + + virtual ULONG STDMETHODCALLTYPE AddRef() + { + return add_ref(); + } + + virtual ULONG STDMETHODCALLTYPE Release() + { + return release(); + } + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void **ppvObject) + { + /* see the initial comment for an explaination of this magic trick */ + if(&riid == &IID_MAGIC_DELETE_THIS) + { + delete this; + return 0; + } + if(!this) + return E_INVALIDARG; + if(!ppvObject) + return E_POINTER; + return query_interface(riid, ppvObject); + } +}; + +template +struct GalliumMultiComObject : public BaseClass, SecondaryInterface +{ + // we could avoid this duplication, but the increased complexity to do so isn't worth it + virtual ULONG STDMETHODCALLTYPE AddRef() + { + return BaseClass::add_ref(); + } + + virtual ULONG STDMETHODCALLTYPE Release() + { + return BaseClass::release(); + } + + inline HRESULT query_interface(REFIID riid, void **ppvObject) + { + HRESULT hr = BaseClass::query_interface(riid, ppvObject); + if(SUCCEEDED(hr)) + return hr; + if(com_traits::is_self_or_ancestor(riid)) + { + // must be the virtual AddRef, since it is overridden by some classes + this->AddRef(); + *ppvObject = (SecondaryInterface*)this; + return S_OK; + } + else + return E_NOINTERFACE; + } + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void **ppvObject) + { + /* see the initial comment for an explaination of this magic trick */ + if(&riid == &IID_MAGIC_DELETE_THIS) + { + delete this; + return 0; + } + if(!this) + return E_INVALIDARG; + if(!ppvObject) + return E_POINTER; + return query_interface(riid, ppvObject); + } +}; + +template +struct refcnt_ptr +{ + T* p; + + refcnt_ptr() + : p(0) + {} + + void add_ref() {Traits::add_ref(p);} + void release() {Traits::release(p);} + + template + refcnt_ptr(const refcnt_ptr& c) + { + *this = static_cast(c.ref()); + } + + ~refcnt_ptr() + { + release(); + } + + void reset(T* q) + { + release(); + p = q; + } + + template + refcnt_ptr& operator =(const refcnt_ptr& q) + { + return *this = q.p; + } + + template + refcnt_ptr& operator =(U* q) + { + release(); + p = static_cast(q); + add_ref(); + return *this; + } + + T* ref() + { + add_ref(); + return p; + } + + T* steal() + { + T* ret = p; + p = 0; + return ret; + } + + T* operator ->() + { + return p; + } + + const T* operator ->() const + { + return p; + } + + T** operator &() + { + assert(!p); + return &p; + } + + bool operator !() const + { + return !p; + } + + typedef T* refcnt_ptr::*unspecified_bool_type; + + operator unspecified_bool_type() const + { + return p ? &refcnt_ptr::p : 0; + } +}; + +struct simple_ptr_traits +{ + static void add_ref(void* p) {} + static void release(void* p) {} +}; + +struct com_ptr_traits +{ + static void add_ref(void* p) + { + if(p) + ((IUnknown*)p)->AddRef(); + } + + static void release(void* p) + { + if(p) + ((IUnknown*)p)->Release(); + } +}; + +template +struct ComPtr : public refcnt_ptr +{ + template + ComPtr& operator =(const refcnt_ptr& q) + { + return *this = q.p; + } + + template + ComPtr& operator =(U* q) + { + this->release(); + this->p = static_cast(q); + this->add_ref(); + return *this; + } +}; + +template +bool operator ==(const refcnt_ptr& a, const refcnt_ptr& b) +{ + return a.p == b.p; +} + +template +bool operator ==(const refcnt_ptr& a, U* b) +{ + return a.p == b; +} + +template +bool operator ==(U* b, const refcnt_ptr& a) +{ + return a.p == b; +} + +template +bool operator !=(const refcnt_ptr& a, const refcnt_ptr& b) +{ + return a.p != b.p; +} + +template +bool operator !=(const refcnt_ptr& a, U* b) +{ + return a.p != b; +} + +template +bool operator !=(U* b, const refcnt_ptr& a) +{ + return a.p != b; +} + +template +struct maybe_mutex_t; + +template<> +struct maybe_mutex_t +{ + pipe_mutex mutex; + + void lock() + { + pipe_mutex_lock(mutex); + } + + void unlock() + { + pipe_mutex_unlock(mutex); + } +}; + +template<> +struct maybe_mutex_t +{ + void lock() + { + } + + void unlock() + { + } +}; + +typedef maybe_mutex_t mutex_t; + +template +struct lock_t +{ + T& mutex; + lock_t(T& mutex) + : mutex(mutex) + { + mutex.lock(); + } + + ~lock_t() + { + mutex.unlock(); + } +}; + +struct c_string +{ + const char* p; + c_string(const char* p) + : p(p) + {} + + operator const char*() const + { + return p; + } +}; + +static inline bool operator ==(const c_string& a, const c_string& b) +{ + return !strcmp(a.p, b.p); +} + +static inline bool operator !=(const c_string& a, const c_string& b) +{ + return strcmp(a.p, b.p); +} + +#ifdef __GLIBCXX__ +namespace std +{ + namespace tr1 + { + template<> + inline size_t hash::operator()(GUID __val) const + { + return _Fnv_hash::hash(__val); + } + + template<> + inline size_t hash::operator()(c_string __val) const + { + return _Fnv_hash::hash(__val.p, strlen(__val.p)); + } + + template + struct hash > : public std::unary_function, size_t> + { + size_t operator()(std::pair __val) const; + }; + + template + inline size_t hash >::operator()(std::pair __val) const + { + std::pair p; + p.first = hash()(__val.first); + p.second = hash()(__val.second); + return _Fnv_hash::hash(p); + } + } +} +#else +#warning "You probably need to add a pair, C string and GUID hash implementation for your C++ library" +#endif + +template +struct GalliumPrivateDataComObject : public GalliumComObject +{ + typedef std::unordered_map > private_data_map_t; + private_data_map_t private_data_map; + mutex_t private_data_mutex; + + ~GalliumPrivateDataComObject() + { + for(private_data_map_t::iterator i = private_data_map.begin(), e = private_data_map.end(); i != e; ++i) + { + if(i->second.second == ~0u) + ((IUnknown*)i->second.first)->Release(); + else + free(i->second.first); + } + } + + HRESULT get_private_data( + __in REFGUID guid, + __inout UINT *pDataSize, + __out_bcount_opt(*pDataSize) void *pData) + { + lock_t lock(private_data_mutex); + private_data_map_t::iterator i = private_data_map.find(guid); + *pDataSize = 0; + if(i == private_data_map.end()) + return DXGI_ERROR_NOT_FOUND; + if(i->second.second == ~0u) + { + /* TODO: is GetPrivateData on interface data supposed to do this? */ + if(*pDataSize < sizeof(void*)) + return E_INVALIDARG; + if(pData) + { + memcpy(pData, &i->second.first, sizeof(void*)); + ((IUnknown*)i->second.first)->AddRef(); + } + *pDataSize = sizeof(void*); + } + else + { + unsigned size = std::min(*pDataSize, i->second.second); + if(pData) + memcpy(pData, i->second.first, size); + *pDataSize = size; + } + return S_OK; + } + + HRESULT set_private_data( + __in REFGUID guid, + __in UINT DataSize, + __in_bcount_opt( DataSize ) const void *pData) + { + void* p = 0; + + if(DataSize && pData) + { + p = malloc(DataSize); + if(!p) + return E_OUTOFMEMORY; + } + + lock_t lock(private_data_mutex); + std::pair& v = private_data_map[guid]; + if(v.first) + { + if(v.second == ~0u) + ((IUnknown*)v.first)->Release(); + else + free(v.first); + } + if(DataSize && pData) + { + memcpy(p, pData, DataSize); + v.first = p; + v.second = DataSize; + } + else + private_data_map.erase(guid); + return S_OK; + } + + HRESULT set_private_data_interface( + __in REFGUID guid, + __in_opt const IUnknown *pData) + { + lock_t lock(private_data_mutex); + std::pair& v = private_data_map[guid]; + if(v.first) + { + if(v.second == ~0u) + ((IUnknown*)v.first)->Release(); + else + free(v.first); + } + if(pData) + { + ((IUnknown*)pData)->AddRef(); + v.first = (void*)pData; + v.second = ~0; + } + else + private_data_map.erase(guid); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + __in REFGUID guid, + __inout UINT *pDataSize, + __out_bcount_opt(*pDataSize) void *pData) + { + return get_private_data(guid, pDataSize, pData); + } + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + __in REFGUID guid, + __in UINT DataSize, + __in_bcount_opt( DataSize ) const void *pData) + { + return set_private_data(guid, DataSize, pData); + } + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + __in REFGUID guid, + __in_opt const IUnknown *pData) + { + return set_private_data_interface(guid, pData); + } +}; + +template +struct GalliumMultiPrivateDataComObject : public GalliumMultiComObject +{ + // we could avoid this duplication, but the increased complexity to do so isn't worth it + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + __in REFGUID guid, + __inout UINT *pDataSize, + __out_bcount_opt(*pDataSize) void *pData) + { + return BaseClass::get_private_data(guid, pDataSize, pData); + } + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + __in REFGUID guid, + __in UINT DataSize, + __in_bcount_opt( DataSize ) const void *pData) + { + return BaseClass::set_private_data(guid, DataSize, pData); + } + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + __in REFGUID guid, + __in_opt const IUnknown *pData) + { + return BaseClass::set_private_data_interface(guid, pData); + } +}; + +#define DXGI_FORMAT_COUNT 100 +extern pipe_format dxgi_to_pipe_format[DXGI_FORMAT_COUNT]; +extern DXGI_FORMAT pipe_to_dxgi_format[PIPE_FORMAT_COUNT]; + +void init_pipe_to_dxgi_format(); + +COM_INTERFACE(IGalliumDevice, IUnknown); +COM_INTERFACE(IGalliumAdapter, IUnknown); +COM_INTERFACE(IGalliumResource, IUnknown); + +// used to make QueryInterface know the IIDs of the interface and its ancestors +COM_INTERFACE(IDXGIObject, IUnknown) +COM_INTERFACE(IDXGIDeviceSubObject, IDXGIObject) +COM_INTERFACE(IDXGISurface, IDXGIDeviceSubObject) +COM_INTERFACE(IDXGIOutput, IDXGIObject) +COM_INTERFACE(IDXGIAdapter, IDXGIObject) +COM_INTERFACE(IDXGISwapChain, IDXGIDeviceSubObject) +COM_INTERFACE(IDXGIFactory, IDXGIObject) +COM_INTERFACE(IDXGIDevice, IDXGIObject) +COM_INTERFACE(IDXGIResource, IDXGIDeviceSubObject) +COM_INTERFACE(IDXGISurface1, IDXGISurface) +COM_INTERFACE(IDXGIDevice1, IDXGIDevice) +COM_INTERFACE(IDXGIAdapter1, IDXGIAdapter) +COM_INTERFACE(IDXGIFactory1, IDXGIFactory) + +template +struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObject +{ + ComPtr adapter; + int priority; + unsigned max_latency; + + GalliumDXGIDevice(IDXGIAdapter* p_adapter) + { + adapter = p_adapter; + } + + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + return adapter.p->QueryInterface(riid, ppParent); + } + + virtual HRESULT STDMETHODCALLTYPE GetAdapter( + __out IDXGIAdapter **pAdapter) + { + *pAdapter = adapter.ref(); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency( + __in_ecount(NumResources) IUnknown *const *ppResources, + __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, + UINT NumResources) + { + for(unsigned i = 0; i < NumResources; ++i) + pResidencyStatus[i] = DXGI_RESIDENCY_FULLY_RESIDENT; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority( + INT Priority) + { + priority = Priority; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority( + __out INT *pPriority) + { + *pPriority = priority; + return S_OK; + } + + HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency( + UINT *pMaxLatency + ) + { + *pMaxLatency = max_latency; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency( + UINT MaxLatency) + { + max_latency = MaxLatency; + return S_OK; + } +}; + +#endif /* D3D1XSTUTIL_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/dxgi_enums.cpp b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/dxgi_enums.cpp new file mode 100644 index 00000000000..da28e643848 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/dxgi_enums.cpp @@ -0,0 +1,147 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include + +/* D3D has to keep binary compatibility, so these tables will always work + * However, Gallium -> D3D conversion must use .[PIPE_xxx] = D3D11_xxx syntax */ + +pipe_format dxgi_to_pipe_format[DXGI_FORMAT_COUNT] = +{ + PIPE_FORMAT_NONE, + PIPE_FORMAT_R32G32B32A32_FLOAT, /* TYPELESS */ + PIPE_FORMAT_R32G32B32A32_FLOAT, + PIPE_FORMAT_R32G32B32A32_USCALED, + PIPE_FORMAT_R32G32B32A32_SSCALED, + PIPE_FORMAT_R32G32B32_FLOAT, /* TYPELESS */ + PIPE_FORMAT_R32G32B32_FLOAT, + PIPE_FORMAT_R32G32B32_USCALED, + PIPE_FORMAT_R32G32B32_SSCALED, + PIPE_FORMAT_R16G16B16A16_FLOAT, /* TYPELESS */ + PIPE_FORMAT_R16G16B16A16_FLOAT, + PIPE_FORMAT_R16G16B16A16_UNORM, + PIPE_FORMAT_R16G16B16A16_USCALED, + PIPE_FORMAT_R16G16B16A16_SNORM, + PIPE_FORMAT_R16G16B16A16_SSCALED, + PIPE_FORMAT_R32G32_FLOAT, /* TYPELESS */ + PIPE_FORMAT_R32G32_FLOAT, + PIPE_FORMAT_R32G32_USCALED, + PIPE_FORMAT_R32G32_SSCALED, + PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED, /* PIPE_FORMAT_R32G8X24_FLOAT_TYPELESS */ + PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED, + PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED, /* PIPE_FORMAT_R32_FLOAT_X8X24_TYPELESS */ + PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED, /* PIPE_FORMAT_X32_TYPELESS_G8X24_USCALED */ + PIPE_FORMAT_R10G10B10A2_UNORM, /* TYPELESS */ + PIPE_FORMAT_R10G10B10A2_UNORM, + PIPE_FORMAT_R10G10B10A2_USCALED, + PIPE_FORMAT_R11G11B10_FLOAT, + PIPE_FORMAT_R8G8B8A8_UNORM, /* TYPELESS */ + PIPE_FORMAT_R8G8B8A8_UNORM, + PIPE_FORMAT_R8G8B8A8_SRGB, + PIPE_FORMAT_R8G8B8A8_USCALED, + PIPE_FORMAT_R8G8B8A8_SNORM, + PIPE_FORMAT_R8G8B8A8_SSCALED, + PIPE_FORMAT_R16G16_FLOAT, /* TYPELESS */ + PIPE_FORMAT_R16G16_FLOAT, + PIPE_FORMAT_R16G16_UNORM, + PIPE_FORMAT_R16G16_USCALED, + PIPE_FORMAT_R16G16_SNORM, + PIPE_FORMAT_R16G16_SSCALED, + PIPE_FORMAT_R32_FLOAT, /* TYPELESS */ + PIPE_FORMAT_Z32_FLOAT, + PIPE_FORMAT_R32_FLOAT, + PIPE_FORMAT_R32_USCALED, + PIPE_FORMAT_R32_SSCALED, + PIPE_FORMAT_Z24_UNORM_S8_USCALED, /* PIPE_FORMAT_R24G8_TYPELESS */ + PIPE_FORMAT_Z24_UNORM_S8_USCALED, + PIPE_FORMAT_Z24X8_UNORM, /* PIPE_FORMAT_R24_UNORM_X8_TYPELESS */ + PIPE_FORMAT_Z24_UNORM_S8_USCALED, /* PIPE_FORMAT_X24_TYPELESS_G8_USCALED */ + PIPE_FORMAT_R8G8_UNORM, /* TYPELESS */ + PIPE_FORMAT_R8G8_UNORM, + PIPE_FORMAT_R8G8_USCALED, + PIPE_FORMAT_R8G8_SNORM, + PIPE_FORMAT_R8G8_SSCALED, + PIPE_FORMAT_R16_FLOAT, /* TYPELESS */ + PIPE_FORMAT_R16_FLOAT, + PIPE_FORMAT_Z16_UNORM, + PIPE_FORMAT_R16_UNORM, + PIPE_FORMAT_R16_USCALED, + PIPE_FORMAT_R16_SNORM, + PIPE_FORMAT_R16_SSCALED, + PIPE_FORMAT_R8_UNORM, /* TYPELESS */ + PIPE_FORMAT_R8_UNORM, + PIPE_FORMAT_R8_USCALED, + PIPE_FORMAT_R8_SNORM, + PIPE_FORMAT_R8_SSCALED, + PIPE_FORMAT_A8_UNORM, + PIPE_FORMAT_R1_UNORM, + PIPE_FORMAT_R9G9B9E5_FLOAT, + PIPE_FORMAT_R8G8_B8G8_UNORM, + PIPE_FORMAT_G8R8_G8B8_UNORM, + PIPE_FORMAT_DXT1_RGBA, /* TYPELESS */ + PIPE_FORMAT_DXT1_RGBA, + PIPE_FORMAT_DXT1_SRGBA, + PIPE_FORMAT_DXT3_RGBA, /* TYPELESS */ + PIPE_FORMAT_DXT3_RGBA, + PIPE_FORMAT_DXT3_SRGBA, + PIPE_FORMAT_DXT5_RGBA, /* TYPELESS */ + PIPE_FORMAT_DXT5_RGBA, + PIPE_FORMAT_DXT5_SRGBA, + PIPE_FORMAT_RGTC1_UNORM, /* TYPELESS */ + PIPE_FORMAT_RGTC1_UNORM, + PIPE_FORMAT_RGTC1_SNORM, + PIPE_FORMAT_RGTC2_UNORM, /* TYPELESS */ + PIPE_FORMAT_RGTC2_UNORM, + PIPE_FORMAT_RGTC2_SNORM, + PIPE_FORMAT_B5G6R5_UNORM, + PIPE_FORMAT_B5G5R5A1_UNORM, + PIPE_FORMAT_B8G8R8A8_UNORM, + PIPE_FORMAT_B8G8R8X8_UNORM, + PIPE_FORMAT_R10SG10SB10SA2U_NORM, + PIPE_FORMAT_B8G8R8A8_UNORM, /* TYPELESS */ + PIPE_FORMAT_B8G8R8A8_SRGB, + PIPE_FORMAT_B8G8R8X8_UNORM, /* TYPELESS */ + PIPE_FORMAT_B8G8R8X8_SRGB, + PIPE_FORMAT_NONE, /* PIPE_FORMAT_BC6H_TYPELESS */ + PIPE_FORMAT_NONE, /* PIPE_FORMAT_BC6H_UF16 */ + PIPE_FORMAT_NONE, /* PIPE_FORMAT_BC6H_SF16 */ + PIPE_FORMAT_NONE, /* PIPE_FORMAT_BC7_TYPELESS */ + PIPE_FORMAT_NONE, /* PIPE_FORMAT_BC7_UNORM */ + PIPE_FORMAT_NONE, /* PIPE_FORMAT_BC7_UNORM_SRGB */ +}; + +DXGI_FORMAT pipe_to_dxgi_format[PIPE_FORMAT_COUNT]; +static int pipe_to_dxgi_format_initialized; +void init_pipe_to_dxgi_format() +{ + if(!pipe_to_dxgi_format_initialized) + { + for(unsigned i = 0; i < DXGI_FORMAT_COUNT; ++i) + pipe_to_dxgi_format[dxgi_to_pipe_format[i]] = (DXGI_FORMAT)i; + pipe_to_dxgi_format[PIPE_FORMAT_NONE] = DXGI_FORMAT_UNKNOWN; + pipe_to_dxgi_format_initialized = 1; + } +} diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/Makefile b/src/gallium/state_trackers/d3d1x/d3dapi/Makefile new file mode 100644 index 00000000000..8b16b1bcbcf --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/Makefile @@ -0,0 +1,4 @@ +all: idl + +include ../Makefile.inc + diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl new file mode 100644 index 00000000000..c371bbea134 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl @@ -0,0 +1,1554 @@ +/* + * Copyright 2007 Andras Kovacs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* modified by Luca Barbieri on Sep 2010 to: + * - converted to using d3dcommon.idl + * - add missing D3D10_FORMAT_SUPPORT + * - add DXGI 1.1 D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX, D3D10_RESOURCE_MISC_GDI_COMPATIBLE +*/ +import "oaidl.idl"; +import "ocidl.idl"; +import "dxgi.idl"; +import "d3dcommon.idl"; + +cpp_quote("#ifndef _D3D10_CONSTANTS") +cpp_quote("#define _D3D10_CONSTANTS") +const float D3D10_DEFAULT_BLEND_FACTOR_ALPHA = 1.0; +const float D3D10_DEFAULT_BLEND_FACTOR_BLUE = 1.0; +const float D3D10_DEFAULT_BLEND_FACTOR_GREEN = 1.0; +const float D3D10_DEFAULT_BLEND_FACTOR_RED = 1.0; +const float D3D10_DEFAULT_BORDER_COLOR_COMPONENT = 0.0; +const float D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS = 0.0; +const float D3D10_DEFAULT_DEPTH_BIAS_CLAMP = 0.0; +const float D3D10_DEFAULT_MAX_ANISOTROPY = 16.0; +const float D3D10_DEFAULT_MIP_LOD_BIAS = 0.0; +const float D3D10_DEFAULT_VIEWPORT_MAX_DEPTH = 0.0; +const float D3D10_DEFAULT_VIEWPORT_MIN_DEPTH = 0.0; +const float D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP = 0.6; +const float D3D10_FLOAT32_MAX = 3.402823466e+38; +const float D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = 0.6; +const float D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR = 2.4; +const float D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR = 1.0; +const float D3D10_FLOAT_TO_SRGB_OFFSET = 0.055; +const float D3D10_FLOAT_TO_SRGB_SCALE_1 = 12.92; +const float D3D10_FLOAT_TO_SRGB_SCALE_2 = 1.055; +const float D3D10_FLOAT_TO_SRGB_THRESHOLD = 0.0031308; +const float D3D10_FTOI_INSTRUCTION_MAX_INPUT = 2147483647.999; +const float D3D10_FTOI_INSTRUCTION_MIN_INPUT = -2147483648.999; +const float D3D10_FTOU_INSTRUCTION_MAX_INPUT = 4294967295.999; +const float D3D10_FTOU_INSTRUCTION_MIN_INPUT = 0.0; +const float D3D10_LINEAR_GAMMA = 1.0; +const float D3D10_MAX_BORDER_COLOR_COMPONENT = 1.0; +const float D3D10_MAX_DEPTH = 1.0; +const float D3D10_MAX_POSITION_VALUE = 3.402823466e+34; +const float D3D10_MIN_BORDER_COLOR_COMPONENT = 0.0; +const float D3D10_MIN_DEPTH = 0.0; +const float D3D10_MIP_LOD_BIAS_MAX = 15.99; +const float D3D10_MIP_LOD_BIAS_MIN = -16.0; +const float D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT = 0.5; +const float D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH = 1.4; +const float D3D10_SRGB_GAMMA = 2.2; +const float D3D10_SRGB_TO_FLOAT_DENOMINATOR_1 = 12.92; +const float D3D10_SRGB_TO_FLOAT_DENOMINATOR_2 = 1.055; +const float D3D10_SRGB_TO_FLOAT_EXPONENT = 2.4; +const float D3D10_SRGB_TO_FLOAT_OFFSET = 0.055; +const float D3D10_SRGB_TO_FLOAT_THRESHOLD = 0.04045; +const float D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP = 0.5; +const float D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT = 0.0; +const float D3D_SPEC_VERSION = 1.050005; +const unsigned int D3D10_16BIT_INDEX_STRIP_CUT_VALUE = 0xffff; +const unsigned int D3D10_32BIT_INDEX_STRIP_CUT_VALUE = 0xffffffff; +const unsigned int D3D10_8BIT_INDEX_STRIP_CUT_VALUE = 0xff; +const unsigned int D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = 9; +const unsigned int D3D10_CLIP_OR_CULL_DISTANCE_COUNT = 8; +const unsigned int D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT = 2; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = 14; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = 15; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = 15; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = 64; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = 1; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = 128; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = 128; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT = 16; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT = 16; +const unsigned int D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = 32; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_COUNT = 4096; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = 3; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS = 3; +const unsigned int D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = 10; +const int D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = -10; +const int D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = -8; +const unsigned int D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = 7; +const unsigned int D3D10_DEFAULT_DEPTH_BIAS = 0; +const unsigned int D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX = 0; +const unsigned int D3D10_DEFAULT_SAMPLE_MASK = 0xffffffff; +const unsigned int D3D10_DEFAULT_SCISSOR_ENDX = 0; +const unsigned int D3D10_DEFAULT_SCISSOR_ENDY = 0; +const unsigned int D3D10_DEFAULT_SCISSOR_STARTX = 0; +const unsigned int D3D10_DEFAULT_SCISSOR_STARTY = 0; +const unsigned int D3D10_DEFAULT_STENCIL_READ_MASK = 0xff; +const unsigned int D3D10_DEFAULT_STENCIL_REFERENCE = 0; +const unsigned int D3D10_DEFAULT_STENCIL_WRITE_MASK = 0xff; +const unsigned int D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_HEIGHT = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_TOPLEFTX = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_TOPLEFTY = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_WIDTH = 0; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT = 1; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_GS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT =32; +const unsigned int D3D10_GS_INPUT_REGISTER_COUNT = 16; +const unsigned int D3D10_GS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_GS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_GS_INPUT_REGISTER_VERTICES = 6; +const unsigned int D3D10_GS_OUTPUT_ELEMENTS = 32; +const unsigned int D3D10_GS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_GS_OUTPUT_REGISTER_COUNT = 32; +const unsigned int D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES = 0; +const unsigned int D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY = 0; +const unsigned int D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES = 0; +const unsigned int D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT = 1; +const unsigned int D3D10_IA_INSTANCE_ID_BIT_COUNT = 32; +const unsigned int D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT = 32; +const unsigned int D3D10_IA_PRIMITIVE_ID_BIT_COUNT = 32; +const unsigned int D3D10_IA_VERTEX_ID_BIT_COUNT = 32; +const unsigned int D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 16; +const unsigned int D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = 64; +const unsigned int D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = 16; +const unsigned int D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT = 0xffffffff; +const unsigned int D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER = 0xffffffff; +const unsigned int D3D10_MAX_MAXANISOTROPY = 16; +const unsigned int D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT = 32; +const unsigned int D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP = 17; +const unsigned int D3D10_MIN_MAXANISOTROPY = 0; +const unsigned int D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT = 6; +const unsigned int D3D10_MIP_LOD_RANGE_BIT_COUNT = 8; +const unsigned int D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT = 0; +const unsigned int D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT = 13; +const unsigned int D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = 15; +const unsigned int D3D10_PS_FRONTFACING_DEFAULT_VALUE = 0xffffffff; +const unsigned int D3D10_PS_FRONTFACING_FALSE_VALUE = 0; +const unsigned int D3D10_PS_FRONTFACING_TRUE_VALUE = 0xffffffff; +const unsigned int D3D10_PS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_PS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D10_PS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_PS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT = 1; +const unsigned int D3D10_PS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_PS_OUTPUT_REGISTER_COUNT = 8; +const unsigned int D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = 27; +const unsigned int D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const unsigned int D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 32; +const unsigned int D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = 32; +const unsigned int D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = 8192; +const unsigned int D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = 1024; +const unsigned int D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const unsigned int D3D10_REQ_MAXANISOTROPY = 16; +const unsigned int D3D10_REQ_MIP_LEVELS = 14; +const unsigned int D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = 2048; +const unsigned int D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = 8192; +const unsigned int D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES = 128; +const unsigned int D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP = 20; +const unsigned int D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = 512; +const unsigned int D3D10_REQ_TEXTURE1D_U_DIMENSION = 8192; +const unsigned int D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = 512; +const unsigned int D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION = 8192; +const unsigned int D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = 2048; +const unsigned int D3D10_REQ_TEXTURECUBE_DIMENSION = 8192; +const unsigned int D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0; +const unsigned int D3D10_SHADER_MAJOR_VERSION = 4; +const unsigned int D3D10_SHADER_MINOR_VERSION = 0; +const unsigned int D3D10_SHIFT_INSTRUCTION_PAD_VALUE = 0; +const unsigned int D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = 5; +const unsigned int D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT = 8; +const unsigned int D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; +const unsigned int D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 256; +const unsigned int D3D10_SO_BUFFER_SLOT_COUNT = 4; +const unsigned int D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP = 0xffffffff; +const unsigned int D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = 1; +const unsigned int D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT = 64; +const unsigned int D3D10_STANDARD_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED = 64; +const unsigned int D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = 4; +const unsigned int D3D10_STANDARD_PIXEL_COMPONENT_COUNT = 128; +const unsigned int D3D10_STANDARD_PIXEL_ELEMENT_COUNT = 32; +const unsigned int D3D10_STANDARD_VECTOR_SIZE = 4; +const unsigned int D3D10_STANDARD_VERTEX_ELEMENT_COUNT = 16; +const unsigned int D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT = 64; +const unsigned int D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT = 8; +const unsigned int D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT = 6; +const unsigned int D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT = 18; +const unsigned int D3D10_UNBOUND_MEMORY_ACCESS_RESULT = 0; +const unsigned int D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX = 15; +const unsigned int D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16; +const unsigned int D3D10_VIEWPORT_BOUNDS_MAX = 16383; +const int D3D10_VIEWPORT_BOUNDS_MIN = -16384; +const unsigned int D3D10_VS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_VS_INPUT_REGISTER_COUNT = 16; +const unsigned int D3D10_VS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_VS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_VS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_VS_OUTPUT_REGISTER_COUNT = 16; +const unsigned int D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT = 10; +const unsigned int D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 25; +const unsigned int D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP = 25; +const unsigned int D3D_MAJOR_VERSION = 10; +const unsigned int D3D_MINOR_VERSION = 0; +const unsigned int D3D_SPEC_DATE_DAY = 8; +const unsigned int D3D_SPEC_DATE_MONTH = 8; +const unsigned int D3D_SPEC_DATE_YEAR = 2006; +cpp_quote("#endif") + +const unsigned int D3D10_APPEND_ALIGNED_ELEMENT = 0xffffffff; +const unsigned int _FACD3D10 = 0x87; +const unsigned int _FACD3D10DEBUG = _FACD3D10 + 1; +const unsigned int D3D10_FILTER_TYPE_MASK = 0x3; +const unsigned int D3D10_SDK_VERSION = 29; + +cpp_quote("#define MAKE_D3D10_HRESULT(code) MAKE_HRESULT( 1, _FACD3D10, code)") +cpp_quote("#define MAKE_D3D10_STATUS(code) MAKE_HRESULT( 0, _FACD3D10, code)") +cpp_quote("#define D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D10_HRESULT(1)") +cpp_quote("#define D3D10_ERROR_FILE_NOT_FOUND MAKE_D3D10_HRESULT(2)") + +typedef enum D3D10_FORMAT_SUPPORT +{ + D3D10_FORMAT_SUPPORT_BUFFER = 0x1, + D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D10_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D10_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D10_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D10_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D10_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D10_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D10_FORMAT_SUPPORT_MIP = 0x1000, + D3D10_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D10_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D10_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D10_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D10_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D10_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D10_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, +} D3D10_FORMAT_SUPPORT; + + +typedef enum D3D10_BLEND { + D3D10_BLEND_ZERO = 1, + D3D10_BLEND_ONE = 2, + D3D10_BLEND_SRC_COLOR = 3, + D3D10_BLEND_INV_SRC_COLOR = 4, + D3D10_BLEND_SRC_ALPHA = 5, + D3D10_BLEND_INV_SRC_ALPHA = 6, + D3D10_BLEND_DEST_ALPHA = 7, + D3D10_BLEND_INV_DEST_ALPHA = 8, + D3D10_BLEND_DEST_COLOR = 9, + D3D10_BLEND_INV_DEST_COLOR = 10, + D3D10_BLEND_SRC_ALPHA_SAT = 11, + D3D10_BLEND_BLEND_FACTOR = 14, + D3D10_BLEND_INV_BLEND_FACTOR = 15, + D3D10_BLEND_SRC1_COLOR = 16, + D3D10_BLEND_INV_SRC1_COLOR = 17, + D3D10_BLEND_SRC1_ALPHA = 18, + D3D10_BLEND_INV_SRC1_ALPHA = 19 +} D3D10_BLEND; + +typedef enum D3D10_BLEND_OP { + D3D10_BLEND_OP_ADD = 1, + D3D10_BLEND_OP_SUBTRACT, + D3D10_BLEND_OP_REV_SUBTRACT, + D3D10_BLEND_OP_MIN, + D3D10_BLEND_OP_MAX, +} D3D10_BLEND_OP; + +typedef struct D3D10_BLEND_DESC { + BOOL AlphaToCoverageEnable; + BOOL BlendEnable[8]; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask[8]; +} D3D10_BLEND_DESC; + +typedef enum D3D10_DEPTH_WRITE_MASK { + D3D10_DEPTH_WRITE_MASK_ZERO, + D3D10_DEPTH_WRITE_MASK_ALL, +} D3D10_DEPTH_WRITE_MASK; + +typedef enum D3D10_COMPARISON_FUNC { + D3D10_COMPARISON_NEVER = 1, + D3D10_COMPARISON_LESS, + D3D10_COMPARISON_EQUAL, + D3D10_COMPARISON_LESS_EQUAL, + D3D10_COMPARISON_GREATER, + D3D10_COMPARISON_NOT_EQUAL, + D3D10_COMPARISON_GREATER_EQUAL, + D3D10_COMPARISON_ALWAYS, +} D3D10_COMPARISON_FUNC; + +typedef enum D3D10_STENCIL_OP { + D3D10_STENCIL_OP_KEEP = 1, + D3D10_STENCIL_OP_ZERO, + D3D10_STENCIL_OP_REPLACE, + D3D10_STENCIL_OP_INCR_SAT, + D3D10_STENCIL_OP_DECR_SAT, + D3D10_STENCIL_OP_INVERT, + D3D10_STENCIL_OP_INCR, + D3D10_STENCIL_OP_DECR, +} D3D10_STENCIL_OP; + +typedef struct D3D10_DEPTH_STENCILOP_DESC { + D3D10_STENCIL_OP StencilFailOp; + D3D10_STENCIL_OP StencilDepthFailOp; + D3D10_STENCIL_OP StencilPassOp; + D3D10_COMPARISON_FUNC StencilFunc; +} D3D10_DEPTH_STENCILOP_DESC; + +typedef struct D3D10_DEPTH_STENCIL_DESC { + BOOL DepthEnable; + D3D10_DEPTH_WRITE_MASK DepthWriteMask; + D3D10_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D10_DEPTH_STENCILOP_DESC FrontFace; + D3D10_DEPTH_STENCILOP_DESC BackFace; +} D3D10_DEPTH_STENCIL_DESC; + +typedef enum D3D10_FILL_MODE { + D3D10_FILL_WIREFRAME = 2, + D3D10_FILL_SOLID, +} D3D10_FILL_MODE; + +typedef enum D3D10_CULL_MODE { + D3D10_CULL_NONE = 1, + D3D10_CULL_FRONT, + D3D10_CULL_BACK, +} D3D10_CULL_MODE; + +typedef struct D3D10_RASTERIZER_DESC { + D3D10_FILL_MODE FillMode; + D3D10_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; +} D3D10_RASTERIZER_DESC; + +typedef enum D3D10_FILTER { + D3D10_FILTER_MIN_MAG_MIP_POINT = 0, + D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D10_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D10_FILTER_ANISOTROPIC = 0x55, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D10_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D10_FILTER_TEXT_1BIT = 0x80000000 +} D3D10_FILTER; + +typedef enum D3D10_TEXTURE_ADDRESS_MODE { + D3D10_TEXTURE_ADDRESS_WRAP = 1, + D3D10_TEXTURE_ADDRESS_MIRROR, + D3D10_TEXTURE_ADDRESS_CLAMP, + D3D10_TEXTURE_ADDRESS_BORDER, + D3D10_TEXTURE_ADDRESS_MIRROR_ONCE, +} D3D10_TEXTURE_ADDRESS_MODE; + +typedef struct D3D10_SAMPLER_DESC { + D3D10_FILTER Filter; + D3D10_TEXTURE_ADDRESS_MODE AddressU; + D3D10_TEXTURE_ADDRESS_MODE AddressV; + D3D10_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D10_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[4]; + FLOAT MinLOD; + FLOAT MaxLOD; +} D3D10_SAMPLER_DESC; + +typedef enum D3D10_COUNTER { + D3D10_COUNTER_GPU_IDLE, + D3D10_COUNTER_VERTEX_PROCESSING, + D3D10_COUNTER_GEOMETRY_PROCESSING, + D3D10_COUNTER_PIXEL_PROCESSING, + D3D10_COUNTER_OTHER_GPU_PROCESSING, + D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION, + D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION, + D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION, + D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION, + D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION, + D3D10_COUNTER_VS_MEMORY_LIMITED, + D3D10_COUNTER_VS_COMPUTATION_LIMITED, + D3D10_COUNTER_GS_MEMORY_LIMITED, + D3D10_COUNTER_GS_COMPUTATION_LIMITED, + D3D10_COUNTER_PS_MEMORY_LIMITED, + D3D10_COUNTER_PS_COMPUTATION_LIMITED, + D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE, + D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE, + D3D10_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 +} D3D10_COUNTER; + +typedef struct D3D10_COUNTER_DESC { + D3D10_COUNTER Counter; + UINT MiscFlags; +} D3D10_COUNTER_DESC; + +typedef enum D3D10_COUNTER_TYPE { + D3D10_COUNTER_TYPE_FLOAT32, + D3D10_COUNTER_TYPE_UINT16, + D3D10_COUNTER_TYPE_UINT32, + D3D10_COUNTER_TYPE_UINT64, +} D3D10_COUNTER_TYPE; + +typedef struct D3D10_COUNTER_INFO { + D3D10_COUNTER LastDeviceDependentCounter; + UINT NumSimultaneousCounters; + UINT8 NumDetectableParallelUnits; +} D3D10_COUNTER_INFO; + +typedef enum D3D10_RESOURCE_DIMENSION { + D3D10_RESOURCE_DIMENSION_UNKNOWN, + D3D10_RESOURCE_DIMENSION_BUFFER, + D3D10_RESOURCE_DIMENSION_TEXTURE1D, + D3D10_RESOURCE_DIMENSION_TEXTURE2D, + D3D10_RESOURCE_DIMENSION_TEXTURE3D, +} D3D10_RESOURCE_DIMENSION; + +typedef enum D3D10_USAGE { + D3D10_USAGE_DEFAULT, + D3D10_USAGE_IMMUTABLE, + D3D10_USAGE_DYNAMIC, + D3D10_USAGE_STAGING, +} D3D10_USAGE; + +typedef struct D3D10_BUFFER_DESC { + UINT ByteWidth; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_BUFFER_DESC; + +typedef enum D3D10_MAP { + D3D10_MAP_READ = 1, + D3D10_MAP_WRITE, + D3D10_MAP_READ_WRITE, + D3D10_MAP_WRITE_DISCARD, + D3D10_MAP_WRITE_NO_OVERWRITE, +} D3D10_MAP; + +typedef struct D3D10_TEXTURE1D_DESC { + UINT Width; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_TEXTURE1D_DESC; + +typedef struct D3D10_TEXTURE2D_DESC { + UINT Width; + UINT Height; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_TEXTURE2D_DESC; + +typedef struct D3D10_TEXTURE3D_DESC { + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_TEXTURE3D_DESC; + +typedef enum D3D10_DSV_DIMENSION +{ + D3D10_DSV_DIMENSION_UNKNOWN, + D3D10_DSV_DIMENSION_TEXTURE1D, + D3D10_DSV_DIMENSION_TEXTURE1DARRAY, + D3D10_DSV_DIMENSION_TEXTURE2D, + D3D10_DSV_DIMENSION_TEXTURE2DARRAY, + D3D10_DSV_DIMENSION_TEXTURE2DMS, + D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY, +} D3D10_DSV_DIMENSION; + +typedef struct D3D10_TEX1D_DSV { + UINT MipSlice; +} D3D10_TEX1D_DSV; + +typedef struct D3D10_TEX1D_ARRAY_DSV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX1D_ARRAY_DSV; + +typedef struct D3D10_TEX2D_DSV { + UINT MipSlice; +} D3D10_TEX2D_DSV; + +typedef struct D3D10_TEX2D_ARRAY_DSV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2D_ARRAY_DSV; + +typedef struct D3D10_TEX2DMS_DSV { + UINT UnusedField_NothingToDefine; +} D3D10_TEX2DMS_DSV; + +typedef struct D3D10_TEX2DMS_ARRAY_DSV { + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2DMS_ARRAY_DSV; + +typedef struct D3D10_DEPTH_STENCIL_VIEW_DESC { + DXGI_FORMAT Format; + D3D10_DSV_DIMENSION ViewDimension; + union { + D3D10_TEX1D_DSV Texture1D; + D3D10_TEX1D_ARRAY_DSV Texture1DArray; + D3D10_TEX2D_DSV Texture2D; + D3D10_TEX2D_ARRAY_DSV Texture2DArray; + D3D10_TEX2DMS_DSV Texture2DMS; + D3D10_TEX2DMS_ARRAY_DSV Texture2DMSArray; + } DUMMYUNIONNAME; +} D3D10_DEPTH_STENCIL_VIEW_DESC; + +typedef enum D3D10_RTV_DIMENSION { + D3D10_RTV_DIMENSION_UNKNOWN, + D3D10_RTV_DIMENSION_BUFFER, + D3D10_RTV_DIMENSION_TEXTURE1D, + D3D10_RTV_DIMENSION_TEXTURE1DARRAY, + D3D10_RTV_DIMENSION_TEXTURE2D, + D3D10_RTV_DIMENSION_TEXTURE2DARRAY, + D3D10_RTV_DIMENSION_TEXTURE2DMS, + D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_RTV_DIMENSION_TEXTURE3D, +} D3D10_RTV_DIMENSION; + +typedef struct D3D10_BUFFER_RTV { + UINT ElementOffset; + UINT ElementWidth; +} D3D10_BUFFER_RTV; + +typedef struct D3D10_TEX1D_RTV { + UINT MipSlice; +} D3D10_TEX1D_RTV; + +typedef struct D3D10_TEX1D_ARRAY_RTV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX1D_ARRAY_RTV; + +typedef struct D3D10_TEX2D_RTV { + UINT MipSlice; +} D3D10_TEX2D_RTV; + +typedef struct D3D10_TEX2D_ARRAY_RTV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2D_ARRAY_RTV; + +typedef struct D3D10_TEX2DMS_RTV { + UINT UnusedField_NothingToDefine; +} D3D10_TEX2DMS_RTV; + +typedef struct D3D10_TEX2DMS_ARRAY_RTV { + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2DMS_ARRAY_RTV; + +typedef struct D3D10_TEX3D_RTV { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; +} D3D10_TEX3D_RTV; + +typedef struct D3D10_RENDER_TARGET_VIEW_DESC { + DXGI_FORMAT Format; + D3D10_RTV_DIMENSION ViewDimension; + union { + D3D10_BUFFER_RTV Buffer; + D3D10_TEX1D_RTV Texture1D; + D3D10_TEX1D_ARRAY_RTV Texture1DArray; + D3D10_TEX2D_RTV Texture2D; + D3D10_TEX2D_ARRAY_RTV Texture2DArray; + D3D10_TEX2DMS_RTV Texture2DMS; + D3D10_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D10_TEX3D_RTV Texture3D; + } DUMMYUNIONNAME; +} D3D10_RENDER_TARGET_VIEW_DESC; + +typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION; + +typedef struct D3D10_BUFFER_SRV { + UINT ElementOffset; + UINT ElementWidth; +} D3D10_BUFFER_SRV; + +typedef struct D3D10_TEX1D_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEX1D_SRV; + +typedef struct D3D10_TEX1D_ARRAY_SRV { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX1D_ARRAY_SRV; + +typedef struct D3D10_TEX2D_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEX2D_SRV; + +typedef struct D3D10_TEX2D_ARRAY_SRV { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2D_ARRAY_SRV; + +typedef struct D3D10_TEX2DMS_SRV { + UINT UnusedField_NothingToDefine; +} D3D10_TEX2DMS_SRV; + +typedef struct D3D10_TEX2DMS_ARRAY_SRV { + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2DMS_ARRAY_SRV; + +typedef struct D3D10_TEX3D_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEX3D_SRV; + +typedef struct D3D10_TEXCUBE_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEXCUBE_SRV; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC { + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION ViewDimension; + union { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + } DUMMYUNIONNAME; +} D3D10_SHADER_RESOURCE_VIEW_DESC; + +typedef struct D3D10_BOX { + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; +} D3D10_BOX; + +typedef struct D3D10_SUBRESOURCE_DATA { + const void *pSysMem; + UINT SysMemPitch; + UINT SysMemSlicePitch; +} D3D10_SUBRESOURCE_DATA; + +typedef struct D3D10_SO_DECLARATION_ENTRY { + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; +} D3D10_SO_DECLARATION_ENTRY; + +typedef enum D3D10_INPUT_CLASSIFICATION { + D3D10_INPUT_PER_VERTEX_DATA, + D3D10_INPUT_PER_INSTANCE_DATA, +} D3D10_INPUT_CLASSIFICATION; + +typedef struct D3D10_INPUT_ELEMENT_DESC { + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D10_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; +} D3D10_INPUT_ELEMENT_DESC; + +typedef enum D3D10_QUERY { + D3D10_QUERY_EVENT, + D3D10_QUERY_OCCLUSION, + D3D10_QUERY_TIMESTAMP, + D3D10_QUERY_TIMESTAMP_DISJOINT, + D3D10_QUERY_PIPELINE_STATISTICS, + D3D10_QUERY_OCCLUSION_PREDICATE, + D3D10_QUERY_SO_STATISTICS, + D3D10_QUERY_SO_OVERFLOW_PREDICATE, +} D3D10_QUERY; + +typedef struct D3D10_QUERY_DESC { + D3D10_QUERY Query; + UINT MiscFlags; +} D3D10_QUERY_DESC; + +typedef D3D_PRIMITIVE_TOPOLOGY D3D10_PRIMITIVE_TOPOLOGY; + +typedef RECT D3D10_RECT; + +typedef struct D3D10_VIEWPORT { + INT TopLeftX; + INT TopLeftY; + UINT Width; + UINT Height; + FLOAT MinDepth; + FLOAT MaxDepth; +} D3D10_VIEWPORT; + +typedef struct D3D10_MAPPED_TEXTURE2D { + void *pData; + UINT RowPitch; +} D3D10_MAPPED_TEXTURE2D; + +typedef struct D3D10_MAPPED_TEXTURE3D { + void *pData; + UINT RowPitch; + UINT DepthPitch; +} D3D10_MAPPED_TEXTURE3D; + +typedef enum D3D10_BIND_FLAG { + D3D10_BIND_VERTEX_BUFFER = 0x1, + D3D10_BIND_INDEX_BUFFER = 0x2, + D3D10_BIND_CONSTANT_BUFFER = 0x4, + D3D10_BIND_SHADER_RESOURCE = 0x8, + D3D10_BIND_STREAM_OUTPUT = 0x10, + D3D10_BIND_RENDER_TARGET = 0x20, + D3D10_BIND_DEPTH_STENCIL = 0x40 +} D3D10_BIND_FLAG; + +typedef enum D3D10_CPU_ACCESS_FLAG { + D3D10_CPU_ACCESS_WRITE = 0x10000, + D3D10_CPU_ACCESS_READ = 0x20000 +} D3D10_CPU_ACCESS_FLAG; + +typedef enum D3D10_RESOURCE_MISC_FLAG { + D3D10_RESOURCE_MISC_GENERATE_MIPS = 0x1, + D3D10_RESOURCE_MISC_SHARED = 0x2, + D3D10_RESOURCE_MISC_TEXTURECUBE = 0x4, + D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x10L, + D3D10_RESOURCE_MISC_GDI_COMPATIBLE = 0x20L +} D3D10_RESOURCE_MISC_FLAG; + +typedef enum D3D10_MAP_FLAG { + D3D10_MAP_FLAG_DO_NOT_WAIT = 0x100000, +} D3D10_MAP_FLAG; + +typedef enum D3D10_CLEAR_FLAG { + D3D10_CLEAR_DEPTH = 0x1, + D3D10_CLEAR_STENCIL = 0x2 +} D3D10_CLEAR_FLAG; + +typedef enum D3D10_COLOR_WRITE_ENABLE { + D3D10_COLOR_WRITE_ENABLE_RED = 0x1, + D3D10_COLOR_WRITE_ENABLE_GREEN = 0x2, + D3D10_COLOR_WRITE_ENABLE_BLUE = 0x4, + D3D10_COLOR_WRITE_ENABLE_ALPHA = 0x8, + D3D10_COLOR_WRITE_ENABLE_ALL = (D3D10_COLOR_WRITE_ENABLE_RED | D3D10_COLOR_WRITE_ENABLE_GREEN | + D3D10_COLOR_WRITE_ENABLE_BLUE | D3D10_COLOR_WRITE_ENABLE_ALPHA) +} D3D10_COLOR_WRITE_ENABLE; + +typedef enum D3D10_TEXTURECUBE_FACE { + D3D10_TEXTURECUBE_FACE_POSITIVE_X, + D3D10_TEXTURECUBE_FACE_NEGATIVE_X, + D3D10_TEXTURECUBE_FACE_POSITIVE_Y, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Y, + D3D10_TEXTURECUBE_FACE_POSITIVE_Z, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Z, +} D3D10_TEXTURECUBE_FACE; + +typedef enum D3D10_ASYNC_GETDATA_FLAG { + D3D10_ASYNC_GETDATA_DONOTFLUSH = 0x1, +} D3D10_ASYNC_GETDATA_FLAG; + +typedef enum D3D10_FILTER_TYPE { + D3D10_FILTER_TYPE_POINT, + D3D10_FILTER_TYPE_LINEAR +} D3D10_FILTER_TYPE; + +typedef enum D3D10_QUERY_MISC_FLAG { + D3D10_QUERY_MISC_PREDICATEHINT = 0x1 +} D3D10_QUERY_MISC_FLAG; + +typedef struct D3D10_QUERY_DATA_TIMESTAMP_DISJOINT { + UINT64 Frequency; + BOOL Disjoint; +} D3D10_QUERY_DATA_TIMESTAMP_DISJOINT; + +typedef struct D3D10_QUERY_DATA_PIPELINE_STATISTICS { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; +} D3D10_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D10_QUERY_DATA_SO_STATISTICS { + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; +} D3D10_QUERY_DATA_SO_STATISTICS; + +typedef enum D3D10_CREATE_DEVICE_FLAG { + D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D10_CREATE_DEVICE_DEBUG = 0x2, + D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8 +} D3D10_CREATE_DEVICE_FLAG; + +/* Core */ + +interface ID3D10Device; + +[ + object, + local, + uuid(9b7e4c00-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10DeviceChild : IUnknown +{ + void GetDevice( + [out] ID3D10Device **ppDevice); + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *pDataSize, + [out] void *pData); + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT DataSize, + [in] const void *pData); + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *pData); +} + +/* Resource */ + +[ + object, + local, + uuid(9b7e4c01-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Resource : ID3D10DeviceChild +{ + void GetType( + [out] D3D10_RESOURCE_DIMENSION *rType); + void SetEvictionPriority( + [in] UINT EvictionPriority); + UINT GetEvictionPriority(); +} + +[ + object, + local, + uuid(9b7e4c02-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Buffer : ID3D10Resource +{ + HRESULT Map( + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] void **ppData); + void Unmap(); + void GetDesc( + [out] D3D10_BUFFER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c03-342c-4106-a19f-4f2704f689F0) +] +interface ID3D10Texture1D : ID3D10Resource +{ + HRESULT Map( + [in] UINT Subresource, + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] void **ppData); + void Unmap( + [in] UINT Subresource); + void GetDesc( + [out] D3D10_TEXTURE1D_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c04-342c-4106-a19f-4f2704f689F0) +] +interface ID3D10Texture2D : ID3D10Resource +{ + HRESULT Map( + [in] UINT Subresource, + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] D3D10_MAPPED_TEXTURE2D *pMappedTex2D); + void Unmap( + [in] UINT Subresource); + void GetDesc( + [out] D3D10_TEXTURE2D_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c05-342c-4106-a19f-4f2704f689F0) +] +interface ID3D10Texture3D : ID3D10Resource +{ + HRESULT Map( + [in] UINT Subresource, + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] D3D10_MAPPED_TEXTURE3D *pMappedTex3D); + void Unmap( + [in] UINT Subresource); + void GetDesc( + [out] D3D10_TEXTURE3D_DESC *pDesc); +} + +[ + object, + local, + uuid(c902b03f-60a7-49ba-9936-2a3ab37a7e33) +] +interface ID3D10View : ID3D10DeviceChild +{ + void GetResource( + [out] ID3D10Resource **ppResource); +} + +[ + object, + local, + uuid(9b7e4c09-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10DepthStencilView : ID3D10View +{ + void GetDesc( + [out] D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc); +} + + +[ + object, + local, + uuid(9b7e4c08-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10RenderTargetView : ID3D10View +{ + void GetDesc( + [out] D3D10_RENDER_TARGET_VIEW_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c07-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10ShaderResourceView : ID3D10View +{ + void GetDesc( + [out] D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); +} + +/* Resource End */ + +[ + object, + local, + uuid(edad8d19-8a35-4d6d-8566-2ea276cde161) +] +interface ID3D10BlendState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_BLEND_DESC *pDesc); +} + +[ + object, + local, + uuid(2b4b1cc8-a4ad-41f8-8322-ca86fc3ec675) +] +interface ID3D10DepthStencilState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_DEPTH_STENCIL_DESC *pDesc); +} + +[ + object, + local, + uuid(6316be88-54cd-4040-ab44-20461bc81f68) +] +interface ID3D10GeometryShader : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(9b7e4c0b-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10InputLayout : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(4968b601-9d00-4cde-8346-8e7f675819b6) +] +interface ID3D10PixelShader : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(a2a07292-89af-4345-be2e-c53d9fbb6e9f) +] +interface ID3D10RasterizerState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_RASTERIZER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c0c-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10SamplerState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_SAMPLER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c0a-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10VertexShader : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(9b7e4c0d-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Asynchronous : ID3D10DeviceChild +{ + void Begin(); + void End(); + HRESULT GetData( + [out] void *pData, + [in] UINT DataSize, + [in] UINT GetDataFlags); + UINT GetDataSize(); +} + +[ + object, + local, + uuid(9b7e4c11-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Counter : ID3D10Asynchronous +{ + void GetDesc( + [out] D3D10_COUNTER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4C0e-342C-4106-a19f-4f2704f689f0) +] +interface ID3D10Query : ID3D10Asynchronous +{ + void GetDesc( + [out] D3D10_QUERY_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c10-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Predicate : ID3D10Query +{ +} + +[ + object, + local, + uuid(9b7e4c0f-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Device : IUnknown +{ + void VSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppConstantBuffers); + void PSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D10ShaderResourceView *const *ppShaderResourceViews); + void PSSetShader( + [in] ID3D10PixelShader *pPixelShader); + void PSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in]ID3D10SamplerState *const *ppSamplers); + void VSSetShader( + [in] ID3D10VertexShader *pVertexShader); + void DrawIndexed( + [in] UINT IndexCount, + [in] UINT StartIndexLocation, + [in] INT BaseVertexLocation); + void Draw( + [in] UINT VertexCount, + [in] UINT StartVertexLocation); + void PSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppConstantBuffers); + void IASetInputLayout( + [in] ID3D10InputLayout *pInputLayout); + void IASetVertexBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppVertexBuffers, + [in] const UINT *pStrides, + [in] const UINT *pOffsets); + void IASetIndexBuffer( + [in] ID3D10Buffer *pIndexBuffer, + [in] DXGI_FORMAT Format, + [in] UINT Offset); + void DrawIndexedInstanced( + [in] UINT IndexCountPerInstance, + [in] UINT InstanceCount, + [in] UINT StartIndexLocation, + [in] INT BaseVertexLocation, + [in] UINT StartInstanceLocation); + void DrawInstanced( + [in] UINT VertexCountPerInstance, + [in] UINT InstanceCount, + [in] UINT StartVertexLocation, + [in] UINT StartInstanceLocation); + void GSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppConstantBuffers); + void GSSetShader( + [in] ID3D10GeometryShader *pShader); + void IASetPrimitiveTopology( + [in] D3D10_PRIMITIVE_TOPOLOGY Topology); + void VSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D10ShaderResourceView *const *ppShaderResourceViews); + void VSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D10SamplerState *const *ppSamplers); + void SetPredication( + [in] ID3D10Predicate *pPredicate, + [in] BOOL PredicateValue); + void GSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D10ShaderResourceView * const *ppShaderResourceViews); + void GSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D10SamplerState *const *ppSamplers); + void OMSetRenderTargets( + [in] UINT NumViews, + [in] ID3D10RenderTargetView *const *ppRenderTargetViews, + [in] ID3D10DepthStencilView *pDepthStencilView); + void OMSetBlendState( + [in] ID3D10BlendState *pBlendState, + [in] const FLOAT BlendFactor[4], + [in] UINT SampleMask); + void OMSetDepthStencilState( + [in] ID3D10DepthStencilState *pDepthStencilState, + [in] UINT StencilRef); + void SOSetTargets( + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppSOTargets, + [in] const UINT *pOffsets); + void DrawAuto(); + void RSSetState( + [in] ID3D10RasterizerState *pRasterizerState); + void RSSetViewports( + [in] UINT NumViewports, + [in] const D3D10_VIEWPORT *pViewports); + void RSSetScissorRects( + [in] UINT NumRects, + [in] const D3D10_RECT *pRects); + void CopySubresourceRegion( + [in] ID3D10Resource *pDstResource, + [in] UINT DstSubresource, + [in] UINT DstX, + [in] UINT DstY, + [in] UINT DstZ, + [in] ID3D10Resource *pSrcResource, + [in] UINT SrcSubresource, + [in] const D3D10_BOX *pSrcBox); + void CopyResource( + [in] ID3D10Resource *pDstResource, + [in] ID3D10Resource *pSrcResource); + void UpdateSubresource( + [in] ID3D10Resource *pDstResource, + [in] UINT DstSubresource, + [in] const D3D10_BOX *pDstBox, + [in] const void *pSrcData, + [in] UINT SrcRowPitch, + [in] UINT SrcDepthPitch); + void ClearRenderTargetView( + [in] ID3D10RenderTargetView *pRenderTargetView, + [in] const FLOAT ColorRGBA[4]); + void ClearDepthStencilView( + [in] ID3D10DepthStencilView *pDepthStencilView, + [in] UINT ClearFlags, + [in] FLOAT Depth, + [in] UINT8 Stencil); + void GenerateMips( + [in] ID3D10ShaderResourceView *pShaderResourceView); + void ResolveSubresource( + [in] ID3D10Resource *pDstResource, + [in] UINT DstSubresource, + [in] ID3D10Resource *pSrcResource, + [in] UINT SrcSubresource, + [in] DXGI_FORMAT Format); + void VSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppConstantBuffers); + void PSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D10ShaderResourceView **ppShaderResourceViews); + void PSGetShader( + [out] ID3D10PixelShader **ppPixelShader); + void PSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D10SamplerState **ppSamplers); + void VSGetShader( + [out] ID3D10VertexShader **ppVertexShader); + void PSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppConstantBuffers); + void IAGetInputLayout( + [out] ID3D10InputLayout **ppInputLayout); + void IAGetVertexBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppVertexBuffers, + [out] UINT *pStrides, + [out] UINT *pOffsets); + void IAGetIndexBuffer( + [out] ID3D10Buffer **pIndexBuffer, + [out] DXGI_FORMAT *Format, + [out] UINT *Offset); + void GSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppConstantBuffers); + void GSGetShader( + [out] ID3D10GeometryShader **ppGeometryShader); + void IAGetPrimitiveTopology( + [out] D3D10_PRIMITIVE_TOPOLOGY *pTopology); + void VSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D10ShaderResourceView **ppShaderResourceViews); + void VSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D10SamplerState **ppSamplers); + void GetPredication( + [out] ID3D10Predicate **ppPredicate, + [out] BOOL *pPredicateValue); + void GSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D10ShaderResourceView **ppShaderResourceViews); + void GSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D10SamplerState **ppSamplers); + void OMGetRenderTargets( + [in] UINT NumViews, + [out] ID3D10RenderTargetView **ppRenderTargetViews, + [out] ID3D10DepthStencilView **ppDepthStencilView); + void OMGetBlendState( + [out] ID3D10BlendState **ppBlendState, + [out] FLOAT BlendFactor[4], + [out] UINT *pSampleMask); + void OMGetDepthStencilState( + [out] ID3D10DepthStencilState **ppDepthStencilState, + [out] UINT *pStencilRef); + void SOGetTargets( + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppSOTargets, + [out] UINT *pOffsets); + void RSGetState( + [out] ID3D10RasterizerState **ppRasterizerState); + void RSGetViewports( + [in, out] UINT *NumViewports, + [out] D3D10_VIEWPORT *pViewports); + void RSGetScissorRects( + [in, out] UINT *NumRects, + [out] D3D10_RECT *pRects); + HRESULT GetDeviceRemovedReason(); + HRESULT SetExceptionMode( + [in] UINT RaiseFlags); + UINT GetExceptionMode(); + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *pDataSize, + [out] void *pData); + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT DataSize, + [in] const void *pData); + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *pData); + void ClearState(); + void Flush(); + HRESULT CreateBuffer( + [in] const D3D10_BUFFER_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Buffer **ppBuffer); + HRESULT CreateTexture1D( + [in] const D3D10_TEXTURE1D_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Texture1D **ppTexture1D); + HRESULT CreateTexture2D( + [in] const D3D10_TEXTURE2D_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Texture2D **ppTexture2D); + HRESULT CreateTexture3D( + [in] const D3D10_TEXTURE3D_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Texture3D **ppTexture3D); + HRESULT CreateShaderResourceView( + [in] ID3D10Resource *pResource, + [in] const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + [out] ID3D10ShaderResourceView **ppSRView); + HRESULT CreateRenderTargetView( + [in] ID3D10Resource *pResource, + [in] const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + [out] ID3D10RenderTargetView **ppRTView); + HRESULT CreateDepthStencilView( + [in] ID3D10Resource *pResource, + [in] const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + [out] ID3D10DepthStencilView **ppDepthStencilView); + HRESULT CreateInputLayout( + [in] const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + [in] UINT NumElements, + [in] const void *pShaderBytecodeWithInputSignature, + [in] SIZE_T BytecodeLength, + [out] ID3D10InputLayout **ppInputLayout); + HRESULT CreateVertexShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [out] ID3D10VertexShader **ppVertexShader); + HRESULT CreateGeometryShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [out] ID3D10GeometryShader **ppGeometryShader); + HRESULT CreateGeometryShaderWithStreamOutput( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + [in] UINT NumEntries, + [in] UINT OutputStreamStride, + [out] ID3D10GeometryShader **ppGeometryShader); + HRESULT CreatePixelShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [out] ID3D10PixelShader **ppPixelShader); + HRESULT CreateBlendState( + [in] const D3D10_BLEND_DESC *pBlendStateDesc, + [out] ID3D10BlendState **ppBlendState); + HRESULT CreateDepthStencilState( + [in] const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + [out] ID3D10DepthStencilState **ppDepthStencilState); + HRESULT CreateRasterizerState( + [in] const D3D10_RASTERIZER_DESC *pRasterizerDesc, + [out] ID3D10RasterizerState **ppRasterizerState); + HRESULT CreateSamplerState( + [in] const D3D10_SAMPLER_DESC *pSamplerDesc, + [out] ID3D10SamplerState **ppSamplerState); + HRESULT CreateQuery( + [in] const D3D10_QUERY_DESC *pQueryDesc, + [out] ID3D10Query **ppQuery); + HRESULT CreatePredicate( + [in] const D3D10_QUERY_DESC *pPredicateDesc, + [out] ID3D10Predicate **ppPredicate); + HRESULT CreateCounter( + [in] const D3D10_COUNTER_DESC *pCounterDesc, + [out] ID3D10Counter **ppCounter); + HRESULT CheckFormatSupport( + [in] DXGI_FORMAT Format, + [out] UINT *pFormatSupport); + HRESULT CheckMultisampleQualityLevels( + [in] DXGI_FORMAT Format, + [in] UINT SampleCount, + [out] UINT *pNumQualityLevels); + void CheckCounterInfo( + [out] D3D10_COUNTER_INFO *pCounterInfo); + HRESULT CheckCounter( + [in] const D3D10_COUNTER_DESC *pDesc, + [out] D3D10_COUNTER_TYPE *pType, + [out] UINT *pActiveCounters, + [out] LPSTR szName, + [in, out] UINT *pNameLength, + [out] LPSTR szUnits, + [in, out] UINT *pUnitsLength, + [out] LPSTR szDescription, + [in, out] UINT *pDescriptionLength); + UINT GetCreationFlags(); + HRESULT OpenSharedResource( + [in] HANDLE hResource, + [in] REFIID ReturnedInterface, + [out] void **ppResource); + void SetTextFilterSize( + [in] UINT Width, + [in] UINT Height); + void GetTextFilterSize( + [out] UINT *pWidth, + [out] UINT *pHeight); +} + +[ + object, + local, + uuid(9b7e4e00-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Multithread : IUnknown +{ + void Enter(); + void Leave(); + BOOL SetMultithreadProtected( + [in] BOOL bMTProtect); + BOOL GetMultithreadProtected(); +} + +cpp_quote("#include \"d3d10misc.h\"") +cpp_quote("#include \"d3d10shader.h\"") +cpp_quote("#include \"d3d10effect.h\"") +/* TODO: Include "d310sdklayers.h" as soon as it exists */ diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl new file mode 100644 index 00000000000..b507e098901 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl @@ -0,0 +1,191 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "oaidl.idl"; +import "ocidl.idl"; +import "d3d10.idl"; +import "d3dcommon.idl"; + +const unsigned int D3D10_1_SDK_VERSION = 0x20; + +cpp_quote("#ifndef _D3D10_1_CONSTANTS") +cpp_quote("#define _D3D10_1_CONSTANTS") +const unsigned int D3D10_1_DEFAULT_SAMPLE_MASK = 0xffffffff; +const float D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP = 0.6; +const float D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = 0.6; +const unsigned int D3D10_1_GS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32; +const unsigned int D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = 128; +const unsigned int D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = 32; +const unsigned int D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT = 1; +const unsigned int D3D10_1_SHADER_MAJOR_VERSION = 4; +const unsigned int D3D10_1_SHADER_MINOR_VERSION = 1; +const unsigned int D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; +const unsigned int D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 256; +const unsigned int D3D10_1_SO_BUFFER_SLOT_COUNT = 4; +const unsigned int D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = 1; +const unsigned int D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT = 64; +const unsigned int D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT = 32; +const unsigned int D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT = 8; +const unsigned int D3D10_1_VS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D10_1_VS_OUTPUT_REGISTER_COUNT = 32; +cpp_quote("#endif") + +typedef enum D3D10_FEATURE_LEVEL1 +{ + D3D10_FEATURE_LEVEL_10_0 = 0xa000, + D3D10_FEATURE_LEVEL_10_1 = 0xa100, + D3D10_FEATURE_LEVEL_9_1 = 0x9100, + D3D10_FEATURE_LEVEL_9_2 = 0x9200, + D3D10_FEATURE_LEVEL_9_3 = 0x9300 +} D3D10_FEATURE_LEVEL1; + +typedef struct D3D10_RENDER_TARGET_BLEND_DESC1 +{ + BOOL BlendEnable; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask; +} D3D10_RENDER_TARGET_BLEND_DESC1; + +typedef struct D3D10_BLEND_DESC1 +{ + BOOL AlphaToCoverageEnable; + BOOL IndependentBlendEnable; + D3D10_RENDER_TARGET_BLEND_DESC1 RenderTarget[8]; +} D3D10_BLEND_DESC1; + +typedef struct D3D10_TEXCUBE_ARRAY_SRV1 +{ + UINT MostDetailedMip; + UINT MipLevels; + UINT First2DArrayFace; + UINT NumCubes; +} D3D10_TEXCUBE_ARRAY_SRV1; + +typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION1; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC1 +{ + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION1 ViewDimension; + union + { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + D3D10_TEXCUBE_ARRAY_SRV1 TextureCubeArray; + } ; +} D3D10_SHADER_RESOURCE_VIEW_DESC1; + +typedef enum D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS +{ + D3D10_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D10_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe +} D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS; + +[object, local, uuid("EDAD8D99-8A35-4d6d-8566-2EA276CDE161")] +interface ID3D10BlendState1 : ID3D10BlendState +{ + void GetDesc1( + [out] D3D10_BLEND_DESC1 *pDesc + ); +}; + +[object, local, uuid("9B7E4C87-342C-4106-A19F-4F2704F689F0")] +interface ID3D10ShaderResourceView1 : ID3D10ShaderResourceView +{ + void GetDesc1( + [out] D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc + ); +}; + +[object, local, uuid("9B7E4C8F-342C-4106-A19F-4F2704F689F0")] +interface ID3D10Device1 : ID3D10Device +{ + HRESULT CreateShaderResourceView1( + [in] ID3D10Resource *pResource, + [in] const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + [out,optional] ID3D10ShaderResourceView1 **ppSRView + ); + + HRESULT CreateBlendState1( + [in] const D3D10_BLEND_DESC1 *pBlendStateDesc, + [out, optional] ID3D10BlendState1 **ppBlendState + ); + + D3D10_FEATURE_LEVEL1 GetFeatureLevel(); +}; + +//cpp_quote("#include \"d3d10_1shader.h\"") + +typedef enum D3D10_DRIVER_TYPE D3D10_DRIVER_TYPE; + +HRESULT D3D10CreateDevice1( + [in,optional] IDXGIAdapter* pAdapter, + [in] D3D10_DRIVER_TYPE DriverType, + [in] HMODULE Software, + [in] UINT Flags, + [in] D3D10_FEATURE_LEVEL1 HardwareLevel, + [in] UINT SDKVersion, + [out,optional] ID3D10Device1** ppDevice +); + +typedef HRESULT (* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)( + [in,optional] IDXGIAdapter*, + D3D10_DRIVER_TYPE, + HMODULE, + UINT, + D3D10_FEATURE_LEVEL1 HardwareLevels, + UINT, + [in, optional] DXGI_SWAP_CHAIN_DESC*, + [out,optional] IDXGISwapChain**, + [out,optional] ID3D10Device1** +); + +HRESULT D3D10CreateDeviceAndSwapChain1( + [in,optional] IDXGIAdapter* pAdapter, + [in] D3D10_DRIVER_TYPE DriverType, + [in] HMODULE Software, + [in] UINT Flags, + [in] D3D10_FEATURE_LEVEL1 HardwareLevel, + [in] UINT SDKVersion, + [in,optional] DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + [out,optional] IDXGISwapChain** ppSwapChain, + [out,optional] ID3D10Device1** ppDevice +); diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10misc.h b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10misc.h new file mode 100644 index 00000000000..d2241e643e2 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10misc.h @@ -0,0 +1,47 @@ +/* + * Copyright 2008 Henri Verbeet for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __D3D10MISC_H__ +#define __D3D10MISC_H__ + +#include "d3d10.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum D3D10_DRIVER_TYPE { + D3D10_DRIVER_TYPE_HARDWARE = 0, + D3D10_DRIVER_TYPE_REFERENCE = 1, + D3D10_DRIVER_TYPE_NULL = 2, + D3D10_DRIVER_TYPE_SOFTWARE = 3, + D3D10_DRIVER_TYPE_WARP = 5, // added by Luca Barbieri in Sep 2010 +} D3D10_DRIVER_TYPE; + +HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device); + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc, + IDXGISwapChain **swapchain, ID3D10Device **device); + +#ifdef __cplusplus +} +#endif + +#endif /* __D3D10MISC_H__ */ diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl new file mode 100644 index 00000000000..c4668a87dd2 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl @@ -0,0 +1,269 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "d3d10.idl"; + +cpp_quote("#define D3D10_TX_VERSION(a, b) (('T' << 24) | ('X' << 16) | ((a) << 8) | (b)))") + +const unsigned int D3D10_SHADER_DEBUG = (1 << 0); +const unsigned int D3D10_SHADER_SKIP_VALIDATION = (1 << 1); +const unsigned int D3D10_SHADER_SKIP_OPTIMIZATION = (1 << 2); +const unsigned int D3D10_SHADER_PACK_MATRIX_ROW_MAJOR = (1 << 3); +const unsigned int D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR = (1 << 4); +const unsigned int D3D10_SHADER_PARTIAL_PRECISION = (1 << 5); +const unsigned int D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT = (1 << 6); +const unsigned int D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT = (1 << 7); +const unsigned int D3D10_SHADER_NO_PRESHADER = (1 << 8); +const unsigned int D3D10_SHADER_AVOID_FLOW_CONTROL = (1 << 9); +const unsigned int D3D10_SHADER_PREFER_FLOW_CONTROL = (1 << 10); +const unsigned int D3D10_SHADER_ENABLE_STRICTNESS = (1 << 11); +const unsigned int D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY = (1 << 12); +const unsigned int D3D10_SHADER_IEEE_STRICTNESS = (1 << 13); +const unsigned int D3D10_SHADER_WARNINGS_ARE_ERRORS = (1 << 18); + + +const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL0 = (1 << 14); +const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL1 = 0; +const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15)); +const unsigned int D3D10_SHADER_OPTIMIZATION_LEVEL3 = (1 << 15); + +typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; +typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO; + + +typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; +typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS; +typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS; +typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS; +typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; +typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE; +typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS; +typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS; +typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; +typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE; +typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS; +typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS; +typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; +typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE; +typedef D3D_NAME D3D10_NAME; +typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; +typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; +typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; +typedef ID3DInclude* LPD3D10INCLUDE; + +cpp_quote("#define D3D10_SHVER_GET_TYPE(v) (((v) >> 16) & 0xffff)") +cpp_quote("#define D3D10_SHVER_GET_MAJOR(v) (((v) >> 4) & 0xf)") +cpp_quote("#define D3D10_SHVER_GET_MINOR(v) (((v) >> 0) & 0xf)") + +typedef struct _D3D10_SIGNATURE_PARAMETER_DESC +{ + LPCSTR SemanticName; + UINT SemanticIndex; + UINT Register; + D3D_NAME SystemValueType; + D3D_REGISTER_COMPONENT_TYPE ComponentType; + BYTE Mask; + BYTE ReadWriteMask; +} D3D10_SIGNATURE_PARAMETER_DESC; + +typedef struct _D3D10_SHADER_BUFFER_DESC +{ + LPCSTR Name; + D3D_CBUFFER_TYPE Type; + UINT Variables; + UINT Size; + UINT uFlags; +} D3D10_SHADER_BUFFER_DESC; + +typedef struct _D3D10_SHADER_VARIABLE_DESC +{ + LPCSTR Name; + UINT StartOffset; + UINT Size; + UINT uFlags; + LPVOID DefaultValue; + UINT StartTexture; + UINT TextureSize; + UINT StartSampler; + UINT SamplerSize; +} D3D10_SHADER_VARIABLE_DESC; + +typedef struct _D3D10_SHADER_TYPE_DESC +{ + D3D_SHADER_VARIABLE_CLASS Class; + D3D_SHADER_VARIABLE_TYPE Type; + UINT Rows; + UINT Columns; + UINT Elements; + UINT Members; + UINT Offset; + LPCSTR Name; +} D3D10_SHADER_TYPE_DESC; + +typedef D3D_TESSELLATOR_DOMAIN D3D10_TESSELLATOR_DOMAIN; +typedef D3D_TESSELLATOR_PARTITIONING D3D10_TESSELLATOR_PARTITIONING; +typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D10_TESSELLATOR_OUTPUT_PRIMITIVE; + +typedef struct _D3D10_SHADER_DESC +{ + UINT Version; + LPCSTR Creator; + UINT Flags; + + UINT ConstantBuffers; + UINT BoundResources; + UINT InputParameters; + UINT OutputParameters; + + UINT InstructionCount; + UINT TempRegisterCount; + UINT TempArrayCount; + UINT DefCount; + UINT DclCount; + UINT TextureNormalInstructions; + UINT TextureLoadInstructions; + UINT TextureCompInstructions; + UINT TextureBiasInstructions; + UINT TextureGradientInstructions; + UINT FloatInstructionCount; + UINT IntInstructionCount; + UINT UintInstructionCount; + UINT StaticFlowControlCount; + UINT DynamicFlowControlCount; + UINT MacroInstructionCount; + UINT ArrayInstructionCount; + UINT CutInstructionCount; + UINT EmitInstructionCount; + D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; + UINT GSMaxOutputVertexCount; +} D3D10_SHADER_DESC; + +typedef struct _D3D10_SHADER_INPUT_BIND_DESC +{ + LPCSTR Name; + D3D_SHADER_INPUT_TYPE Type; + UINT BindPoint; + UINT BindCount; + + UINT uFlags; + D3D_RESOURCE_RETURN_TYPE ReturnType; + D3D_SRV_DIMENSION Dimension; + UINT NumSamples; +} D3D10_SHADER_INPUT_BIND_DESC; + +[local, object, uuid("C530AD7D-9B16-4395-A979-BA2ECFF83ADD")] +interface ID3D10ShaderReflectionType +{ + HRESULT GetDesc( + [out] D3D10_SHADER_TYPE_DESC *pDesc + ); + + ID3D10ShaderReflectionType* GetMemberTypeByIndex( + [in] UINT Index + ); + + ID3D10ShaderReflectionType* GetMemberTypeByName( + [in] LPCSTR Name + ); + + LPCSTR GetMemberTypeName( + [in] UINT Index + ); +}; + +interface ID3D10ShaderReflectionConstantBuffer; + +[object, local, uuid("1BF63C95-2650-405d-99C1-3636BD1DA0A1")] +interface ID3D10ShaderReflectionVariable +{ + HRESULT GetDesc( + [out] D3D10_SHADER_VARIABLE_DESC *pDesc + ); + + ID3D10ShaderReflectionType* GetType(); +}; + +[object, local, uuid("66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0")] +interface ID3D10ShaderReflectionConstantBuffer +{ + HRESULT GetDesc( + [out] D3D10_SHADER_BUFFER_DESC *pDesc + ); + + ID3D10ShaderReflectionVariable* GetVariableByIndex( + [in] UINT Index + ); + + ID3D10ShaderReflectionVariable* GetVariableByName( + [in] LPCSTR Name + ); +}; + +[object,local,uuid("D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA")] +interface ID3D10ShaderReflection : IUnknown +{ + HRESULT GetDesc( + [out] D3D10_SHADER_DESC *pDesc + ); + + ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByIndex( + [in] UINT Index + ); + + ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByName( + [in] LPCSTR Name + ); + + HRESULT GetResourceBindingDesc( + [in] UINT ResourceIndex, + [out] D3D10_SHADER_INPUT_BIND_DESC *pDesc + ); + + HRESULT GetInputParameterDesc( + [in] UINT ParameterIndex, + [out] D3D10_SIGNATURE_PARAMETER_DESC *pDesc + ); + + HRESULT GetOutputParameterDesc + ( + [in] UINT ParameterIndex, + [out] D3D10_SIGNATURE_PARAMETER_DESC *pDesc + ); +}; + +HRESULT D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, const D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs); +HRESULT D3D10DisassembleShader(const void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly); +LPCSTR D3D10GetPixelShaderProfile(ID3D10Device *pDevice); +LPCSTR D3D10GetVertexShaderProfile(ID3D10Device *pDevice); +LPCSTR D3D10GetGeometryShaderProfile(ID3D10Device *pDevice); +HRESULT D3D10ReflectShader(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector); +HRESULT D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, const D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs); +HRESULT D3D10GetInputSignatureBlob(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT D3D10GetOutputSignatureBlob(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT D3D10GetInputAndOutputSignatureBlob(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT D3D10GetShaderDebugInfo(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo); diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl new file mode 100644 index 00000000000..5a57da36ee7 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl @@ -0,0 +1,2492 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "oaidl.idl"; +import "ocidl.idl"; +import "dxgi.idl"; +import "d3dcommon.idl"; + +const unsigned int D3D11_SDK_VERSION = 7; + +cpp_quote("#ifndef _D3D11_CONSTANTS") +cpp_quote("#define _D3D11_CONSTANTS") +const unsigned int D3D11_16BIT_INDEX_STRIP_CUT_VALUE = 0xffff; +const unsigned int D3D11_32BIT_INDEX_STRIP_CUT_VALUE = 0xffffffff; +const unsigned int D3D11_8BIT_INDEX_STRIP_CUT_VALUE = 0xff; +const unsigned int D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = 9; +const unsigned int D3D11_CLIP_OR_CULL_DISTANCE_COUNT = 8; +const unsigned int D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT = 2; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = 14; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = 4; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = 15; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = 15; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = 64; +const unsigned int D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = 1; +const unsigned int D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = 128; +const unsigned int D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = 1; +const unsigned int D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = 128; +const unsigned int D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT = 16; +const unsigned int D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT = 16; +const unsigned int D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = 32; +const unsigned int D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_COMMONSHADER_TEMP_REGISTER_COUNT = 4096; +const unsigned int D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS = 3; +const unsigned int D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = 3; +const unsigned int D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = 10; +const int D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = -10; +const int D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = -8; +const unsigned int D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = 7; +const unsigned int D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 256; +const unsigned int D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP = 64; +const unsigned int D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 240; +const unsigned int D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP = 68; +const unsigned int D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 224; +const unsigned int D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP = 72; +const unsigned int D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 208; +const unsigned int D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP = 76; +const unsigned int D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 192; +const unsigned int D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP = 84; +const unsigned int D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 176; +const unsigned int D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP = 92; +const unsigned int D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 160; +const unsigned int D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP = 100; +const unsigned int D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 144; +const unsigned int D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP = 112; +const unsigned int D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 128; +const unsigned int D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP = 128; +const unsigned int D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 112; +const unsigned int D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP = 144; +const unsigned int D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 96; +const unsigned int D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP = 168; +const unsigned int D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 80; +const unsigned int D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP = 204; +const unsigned int D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 64; +const unsigned int D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP = 256; +const unsigned int D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 48; +const unsigned int D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP = 340; +const unsigned int D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 32; +const unsigned int D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP = 512; +const unsigned int D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 16; +const unsigned int D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP = 768; +const unsigned int D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION = 1; +const unsigned int D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT = 256; +const unsigned int D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP = 768; +const unsigned int D3D11_CS_4_X_THREAD_GROUP_MAX_X = 768; +const unsigned int D3D11_CS_4_X_THREAD_GROUP_MAX_Y = 768; +const unsigned int D3D11_CS_4_X_UAV_REGISTER_COUNT = 1; +const unsigned int D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION = 65535; +const unsigned int D3D11_CS_TGSM_REGISTER_COUNT = 8192; +const unsigned int D3D11_CS_TGSM_REGISTER_READS_PER_INST = 1; +const unsigned int D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP = 1024; +const unsigned int D3D11_CS_THREAD_GROUP_MAX_X = 1024; +const unsigned int D3D11_CS_THREAD_GROUP_MAX_Y = 1024; +const unsigned int D3D11_CS_THREAD_GROUP_MAX_Z = 64; +const unsigned int D3D11_CS_THREAD_GROUP_MIN_X = 1; +const unsigned int D3D11_CS_THREAD_GROUP_MIN_Y = 1; +const unsigned int D3D11_CS_THREAD_GROUP_MIN_Z = 1; +const unsigned int D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL = 16384; +const float D3D11_DEFAULT_BLEND_FACTOR_ALPHA = 1.0; +const float D3D11_DEFAULT_BLEND_FACTOR_BLUE = 1.0; +const float D3D11_DEFAULT_BLEND_FACTOR_GREEN = 1.0; +const float D3D11_DEFAULT_BLEND_FACTOR_RED = 1.0; +const float D3D11_DEFAULT_BORDER_COLOR_COMPONENT = 0.0; +const unsigned int D3D11_DEFAULT_DEPTH_BIAS = 0; +const float D3D11_DEFAULT_DEPTH_BIAS_CLAMP = 0.0; +const unsigned int D3D11_DEFAULT_MAX_ANISOTROPY = 16; +const float D3D11_DEFAULT_MIP_LOD_BIAS = 0.0; +const unsigned int D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX = 0; +const unsigned int D3D11_DEFAULT_SAMPLE_MASK = 0xffffffff; +const unsigned int D3D11_DEFAULT_SCISSOR_ENDX = 0; +const unsigned int D3D11_DEFAULT_SCISSOR_ENDY = 0; +const unsigned int D3D11_DEFAULT_SCISSOR_STARTX = 0; +const unsigned int D3D11_DEFAULT_SCISSOR_STARTY = 0; +const float D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS = 0.0; +const unsigned int D3D11_DEFAULT_STENCIL_READ_MASK = 0xff; +const unsigned int D3D11_DEFAULT_STENCIL_REFERENCE = 0; +const unsigned int D3D11_DEFAULT_STENCIL_WRITE_MASK = 0xff; +const unsigned int D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX = 0; +const unsigned int D3D11_DEFAULT_VIEWPORT_HEIGHT = 0; +const float D3D11_DEFAULT_VIEWPORT_MAX_DEPTH = 0.0; +const float D3D11_DEFAULT_VIEWPORT_MIN_DEPTH = 0.0; +const unsigned int D3D11_DEFAULT_VIEWPORT_TOPLEFTX = 0; +const unsigned int D3D11_DEFAULT_VIEWPORT_TOPLEFTY = 0; +const unsigned int D3D11_DEFAULT_VIEWPORT_WIDTH = 0; +const unsigned int D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT = 32; +const unsigned int D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS = 3968; +const unsigned int D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS = 3; +const unsigned int D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT = 1; +const unsigned int D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT = 32; +const unsigned int D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_DS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_DS_OUTPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP = 0.6; +const float D3D11_FLOAT32_MAX = 3.402823466e+38; +const float D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = 0.6; +const float D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR = 2.4; +const float D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR = 1.0; +const float D3D11_FLOAT_TO_SRGB_OFFSET = 0.055; +const float D3D11_FLOAT_TO_SRGB_SCALE_1 = 12.92; +const float D3D11_FLOAT_TO_SRGB_SCALE_2 = 1.055; +const float D3D11_FLOAT_TO_SRGB_THRESHOLD = 0.0031308; +const float D3D11_FTOI_INSTRUCTION_MAX_INPUT = 2147483647.999; +const float D3D11_FTOI_INSTRUCTION_MIN_INPUT = -2147483648.999; +const float D3D11_FTOU_INSTRUCTION_MAX_INPUT = 4294967295.999; +const float D3D11_FTOU_INSTRUCTION_MIN_INPUT = 0.0; +const unsigned int D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS = 1; +const unsigned int D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST = 2; +const unsigned int D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT = 1; +const unsigned int D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT = 1; +const unsigned int D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_GS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_GS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_GS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_GS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_GS_INPUT_REGISTER_VERTICES = 32; +const unsigned int D3D11_GS_MAX_INSTANCE_COUNT = 32; +const unsigned int D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES = 1024; +const unsigned int D3D11_GS_OUTPUT_ELEMENTS = 32; +const unsigned int D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_GS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_GS_OUTPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND = 0xffffffff; +const unsigned int D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT = 1; +const unsigned int D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT = 1; +const unsigned int D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT = 1; +const unsigned int D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND = 0xffffffff; +const float D3D11_HS_MAXTESSFACTOR_LOWER_BOUND = 1.0; +const float D3D11_HS_MAXTESSFACTOR_UPPER_BOUND = 64.0; +const unsigned int D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT = 1; +const unsigned int D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS = 3968; +const unsigned int D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT = 32; +const unsigned int D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES = 0; +const unsigned int D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY = 0; +const unsigned int D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES = 0; +const unsigned int D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT = 1; +const unsigned int D3D11_IA_INSTANCE_ID_BIT_COUNT = 32; +const unsigned int D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT = 32; +const unsigned int D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT = 32; +const unsigned int D3D11_IA_PRIMITIVE_ID_BIT_COUNT = 32; +const unsigned int D3D11_IA_VERTEX_ID_BIT_COUNT = 32; +const unsigned int D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32; +const unsigned int D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = 32; +const unsigned int D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = 128; +const unsigned int D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT = 0xffffffff; +const unsigned int D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER = 0xffffffff; +const unsigned int D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL = 0xffffffff; +const unsigned int D3D11_KEEP_UNORDERED_ACCESS_VIEWS = 0xffffffff; +const float D3D11_LINEAR_GAMMA = 1.0; +const unsigned int D3D11_MAJOR_VERSION = 11; +const float D3D11_MAX_BORDER_COLOR_COMPONENT = 1.0; +const float D3D11_MAX_DEPTH = 1.0; +const unsigned int D3D11_MAX_MAXANISOTROPY = 16; +const unsigned int D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT = 32; +const float D3D11_MAX_POSITION_VALUE = 3.402823466e+34; +const unsigned int D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP = 17; +const float D3D11_MIN_BORDER_COLOR_COMPONENT = 0.0; +const float D3D11_MIN_DEPTH = 0.0; +const unsigned int D3D11_MIN_MAXANISOTROPY = 0; +const unsigned int D3D11_MINOR_VERSION = 0; +const float D3D11_MIP_LOD_BIAS_MAX = 15.99; +const float D3D11_MIP_LOD_BIAS_MIN = -16.0; +const unsigned int D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT = 8; +const unsigned int D3D11_MIP_LOD_RANGE_BIT_COUNT = 8; +const float D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH = 1.4; +const unsigned int D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT = 0; +const unsigned int D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT = 15; +const unsigned int D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = 16; +const unsigned int D3D11_PS_CS_UAV_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_PS_CS_UAV_REGISTER_COUNT = 8; +const unsigned int D3D11_PS_CS_UAV_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_PS_CS_UAV_REGISTER_READS_PER_INST = 1; +const unsigned int D3D11_PS_FRONTFACING_DEFAULT_VALUE = 0xffffffff; +const unsigned int D3D11_PS_FRONTFACING_FALSE_VALUE = 0; +const unsigned int D3D11_PS_FRONTFACING_TRUE_VALUE = 0xffffffff; +const unsigned int D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_PS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_PS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_PS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_PS_INPUT_REGISTER_READS_PER_INST = 2; +const float D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT = 0.0; +const unsigned int D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT = 1; +const unsigned int D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS = 1; +const unsigned int D3D11_PS_OUTPUT_MASK_REGISTER_COUNT = 1; +const unsigned int D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_PS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_PS_OUTPUT_REGISTER_COUNT = 8; +const float D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT = 0.5; +const unsigned int D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT = 16; +const unsigned int D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE = 4096; +const unsigned int D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = 27; +const unsigned int D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const unsigned int D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE = 4096; +const unsigned int D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 32; +const unsigned int D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = 32; +const unsigned int D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = 16384; +const unsigned int D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = 1024; +const unsigned int D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const unsigned int D3D11_REQ_MAXANISOTROPY = 16; +const unsigned int D3D11_REQ_MIP_LEVELS = 15; +const unsigned int D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = 2048; +const unsigned int D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE = 4096; +const unsigned int D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = 16384; +const unsigned int D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM = 128; +const float D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM = 0.25; +const unsigned int D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP = 20; +const unsigned int D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE = 4096; +const unsigned int D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = 2048; +const unsigned int D3D11_REQ_TEXTURE1D_U_DIMENSION = 16384; +const unsigned int D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = 2048; +const unsigned int D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION = 16384; +const unsigned int D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = 2048; +const unsigned int D3D11_REQ_TEXTURECUBE_DIMENSION = 16384; +const unsigned int D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0; +const unsigned int D3D11_SHADER_MAJOR_VERSION = 5; +const unsigned int D3D11_SHADER_MAX_INSTANCES = 65535; +const unsigned int D3D11_SHADER_MAX_INTERFACE_CALL_SITES = 4096; +const unsigned int D3D11_SHADER_MAX_INTERFACES = 253; +const unsigned int D3D11_SHADER_MAX_TYPES = 65535; +const unsigned int D3D11_SHADER_MINOR_VERSION = 0; +const unsigned int D3D11_SHIFT_INSTRUCTION_PAD_VALUE = 0; +const unsigned int D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = 5; +const unsigned int D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT = 8; +const unsigned int D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; +const unsigned int D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 512; +const unsigned int D3D11_SO_BUFFER_SLOT_COUNT = 4; +const unsigned int D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP = 0xffffffff; +const unsigned int D3D11_SO_NO_RASTERIZED_STREAM = 0xffffffff; +const unsigned int D3D11_SO_OUTPUT_COMPONENT_COUNT = 128; +const unsigned int D3D11_SO_STREAM_COUNT = 4; +const unsigned int D3D11_SPEC_DATE_DAY = 04; +const unsigned int D3D11_SPEC_DATE_MONTH = 06; +const unsigned int D3D11_SPEC_DATE_YEAR = 2009; +const unsigned int D3D11_SPEC_VERSION = 1.0; +const float D3D11_SRGB_GAMMA = 2.2; +const float D3D11_SRGB_TO_FLOAT_DENOMINATOR_1 = 12.92; +const float D3D11_SRGB_TO_FLOAT_DENOMINATOR_2 = 1.055; +const float D3D11_SRGB_TO_FLOAT_EXPONENT = 2.4; +const float D3D11_SRGB_TO_FLOAT_OFFSET = 0.055; +const float D3D11_SRGB_TO_FLOAT_THRESHOLD = 0.04045; +const float D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP = 0.5; +const unsigned int D3D11_STANDARD_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED = 64; +const unsigned int D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = 4; +const unsigned int D3D11_STANDARD_PIXEL_COMPONENT_COUNT = 128; +const unsigned int D3D11_STANDARD_PIXEL_ELEMENT_COUNT = 32; +const unsigned int D3D11_STANDARD_VECTOR_SIZE = 4; +const unsigned int D3D11_STANDARD_VERTEX_ELEMENT_COUNT = 32; +const unsigned int D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT = 64; +const unsigned int D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT = 8; +const unsigned int D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT = 8; +const unsigned int D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR = 64; +const unsigned int D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR = 64; +const unsigned int D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR = 63; +const unsigned int D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR = 64; +const unsigned int D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR = 2; +const unsigned int D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR = 1; +const unsigned int D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR = 1; +const unsigned int D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT = 16; +const unsigned int D3D11_UNBOUND_MEMORY_ACCESS_RESULT = 0; +const unsigned int D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX = 15; +const unsigned int D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16; +const unsigned int D3D11_VIEWPORT_BOUNDS_MAX = 32767; +const int D3D11_VIEWPORT_BOUNDS_MIN = -32768; +const unsigned int D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_VS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_VS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_VS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D11_VS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D11_VS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D11_VS_OUTPUT_REGISTER_COUNT = 32; +const unsigned int D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT = 10; +const unsigned int D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 25; +const unsigned int D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP = 25; +cpp_quote("#endif") + +const unsigned int _FACD3D11 = 0x87C; +const unsigned int _FACD3D11DEBUG = _FACD3D11 + 1; + +cpp_quote("#define MAKE_D3D11_HRESULT(c) MAKE_HRESULT(1, _FACD3D11, (c))") +cpp_quote("#define MAKE_D3D11_STATUS(c) MAKE_HRESULT(0, _FACD3D11, (c))") +cpp_quote("#define D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D11_HRESULT(1)") +cpp_quote("#define D3D11_ERROR_FILE_NOT_FOUND MAKE_D3D11_HRESULT(2)") +cpp_quote("#define D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS MAKE_D3D11_HRESULT(3)") +cpp_quote("#define D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD MAKE_D3D11_HRESULT(4)") + +typedef enum D3D11_INPUT_CLASSIFICATION +{ + D3D11_INPUT_PER_VERTEX_DATA, + D3D11_INPUT_PER_INSTANCE_DATA +} D3D11_INPUT_CLASSIFICATION; + +const unsigned int D3D11_APPEND_ALIGNED_ELEMENT = 0xffffffff; + +typedef struct D3D11_INPUT_ELEMENT_DESC +{ + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D11_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; +} D3D11_INPUT_ELEMENT_DESC; + +typedef enum D3D11_FILL_MODE +{ + D3D11_FILL_WIREFRAME = 2, + D3D11_FILL_SOLID = 3 +} D3D11_FILL_MODE; + +typedef D3D_PRIMITIVE_TOPOLOGY D3D11_PRIMITIVE_TOPOLOGY; + +typedef D3D_PRIMITIVE D3D11_PRIMITIVE; + +typedef enum D3D11_CULL_MODE +{ + D3D11_CULL_NONE = 1, + D3D11_CULL_FRONT = 2, + D3D11_CULL_BACK = 3 +} D3D11_CULL_MODE; + +typedef struct D3D11_SO_DECLARATION_ENTRY +{ + UINT Stream; + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; +} D3D11_SO_DECLARATION_ENTRY; + +typedef struct D3D11_VIEWPORT +{ + FLOAT TopLeftX; + FLOAT TopLeftY; + FLOAT Width; + FLOAT Height; + FLOAT MinDepth; + FLOAT MaxDepth; +} D3D11_VIEWPORT; + +typedef enum D3D11_RESOURCE_DIMENSION +{ + D3D11_RESOURCE_DIMENSION_UNKNOWN, + D3D11_RESOURCE_DIMENSION_BUFFER, + D3D11_RESOURCE_DIMENSION_TEXTURE1D, + D3D11_RESOURCE_DIMENSION_TEXTURE2D, + D3D11_RESOURCE_DIMENSION_TEXTURE3D, +} D3D11_RESOURCE_DIMENSION; + +typedef D3D_SRV_DIMENSION D3D11_SRV_DIMENSION; + +typedef enum D3D11_DSV_DIMENSION +{ + D3D11_DSV_DIMENSION_UNKNOWN, + D3D11_DSV_DIMENSION_TEXTURE1D, + D3D11_DSV_DIMENSION_TEXTURE1DARRAY, + D3D11_DSV_DIMENSION_TEXTURE2D, + D3D11_DSV_DIMENSION_TEXTURE2DARRAY, + D3D11_DSV_DIMENSION_TEXTURE2DMS, + D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY, +} D3D11_DSV_DIMENSION; + + +typedef enum D3D11_RTV_DIMENSION +{ + D3D11_RTV_DIMENSION_UNKNOWN, + D3D11_RTV_DIMENSION_BUFFER, + D3D11_RTV_DIMENSION_TEXTURE1D, + D3D11_RTV_DIMENSION_TEXTURE1DARRAY, + D3D11_RTV_DIMENSION_TEXTURE2D, + D3D11_RTV_DIMENSION_TEXTURE2DARRAY, + D3D11_RTV_DIMENSION_TEXTURE2DMS, + D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY, + D3D11_RTV_DIMENSION_TEXTURE3D +} D3D11_RTV_DIMENSION; + +typedef enum D3D11_UAV_DIMENSION +{ + D3D11_UAV_DIMENSION_UNKNOWN, + D3D11_UAV_DIMENSION_BUFFER, + D3D11_UAV_DIMENSION_TEXTURE1D, + D3D11_UAV_DIMENSION_TEXTURE1DARRAY, + D3D11_UAV_DIMENSION_TEXTURE2D, + D3D11_UAV_DIMENSION_TEXTURE2DARRAY, + D3D11_UAV_DIMENSION_TEXTURE3D = 8 +} D3D11_UAV_DIMENSION; + +typedef enum D3D11_USAGE +{ + D3D11_USAGE_DEFAULT, + D3D11_USAGE_IMMUTABLE, + D3D11_USAGE_DYNAMIC, + D3D11_USAGE_STAGING +} D3D11_USAGE; + +typedef enum D3D11_BIND_FLAG +{ + D3D11_BIND_VERTEX_BUFFER = 1, + D3D11_BIND_INDEX_BUFFER = 2, + D3D11_BIND_CONSTANT_BUFFER = 4, + D3D11_BIND_SHADER_RESOURCE = 8, + D3D11_BIND_STREAM_OUTPUT = 0x10, + D3D11_BIND_RENDER_TARGET = 0x20, + D3D11_BIND_DEPTH_STENCIL = 0x40, + D3D11_BIND_UNORDERED_ACCESS = 0x80 +} D3D11_BIND_FLAG; + +typedef enum D3D11_CPU_ACCESS_FLAG +{ + D3D11_CPU_ACCESS_WRITE = 0x10000, + D3D11_CPU_ACCESS_READ = 0x20000 +} D3D11_CPU_ACCESS_FLAG; + +typedef enum D3D11_RESOURCE_MISC_FLAG +{ + D3D11_RESOURCE_MISC_GENERATE_MIPS = 1, + D3D11_RESOURCE_MISC_SHARED = 2, + D3D11_RESOURCE_MISC_TEXTURECUBE = 4, + D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10, + D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20, + D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40, + D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80, + D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100, + D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200 +} D3D11_RESOURCE_MISC_FLAG; + +typedef enum D3D11_MAP +{ + D3D11_MAP_READ = 1, + D3D11_MAP_WRITE, + D3D11_MAP_READ_WRITE, + D3D11_MAP_WRITE_DISCARD, + D3D11_MAP_WRITE_NO_OVERWRITE +} D3D11_MAP; + +typedef enum D3D11_MAP_FLAG +{ + D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000 +} D3D11_MAP_FLAG; + +typedef enum D3D11_RAISE_FLAG +{ + D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 1 +} D3D11_RAISE_FLAG; + +typedef +enum D3D11_CLEAR_FLAG +{ + D3D11_CLEAR_DEPTH = 1, + D3D11_CLEAR_STENCIL = 2 +} D3D11_CLEAR_FLAG; + +typedef RECT D3D11_RECT; + +typedef struct D3D11_BOX +{ + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; +} D3D11_BOX; + +typedef enum D3D11_COMPARISON_FUNC +{ + D3D11_COMPARISON_NEVER = 1, + D3D11_COMPARISON_LESS, + D3D11_COMPARISON_EQUAL, + D3D11_COMPARISON_LESS_EQUAL, + D3D11_COMPARISON_GREATER, + D3D11_COMPARISON_NOT_EQUAL, + D3D11_COMPARISON_GREATER_EQUAL, + D3D11_COMPARISON_ALWAYS +} D3D11_COMPARISON_FUNC; + +typedef enum D3D11_DEPTH_WRITE_MASK +{ + D3D11_DEPTH_WRITE_MASK_ZERO, + D3D11_DEPTH_WRITE_MASK_ALL +} D3D11_DEPTH_WRITE_MASK; + +typedef enum D3D11_STENCIL_OP +{ + D3D11_STENCIL_OP_KEEP = 1, + D3D11_STENCIL_OP_ZERO, + D3D11_STENCIL_OP_REPLACE, + D3D11_STENCIL_OP_INCR_SAT, + D3D11_STENCIL_OP_DECR_SAT, + D3D11_STENCIL_OP_INVERT, + D3D11_STENCIL_OP_INCR, + D3D11_STENCIL_OP_DECR +} D3D11_STENCIL_OP; + +typedef struct D3D11_DEPTH_STENCILOP_DESC +{ + D3D11_STENCIL_OP StencilFailOp; + D3D11_STENCIL_OP StencilDepthFailOp; + D3D11_STENCIL_OP StencilPassOp; + D3D11_COMPARISON_FUNC StencilFunc; +} D3D11_DEPTH_STENCILOP_DESC; + +typedef struct D3D11_DEPTH_STENCIL_DESC +{ + BOOL DepthEnable; + D3D11_DEPTH_WRITE_MASK DepthWriteMask; + D3D11_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D11_DEPTH_STENCILOP_DESC FrontFace; + D3D11_DEPTH_STENCILOP_DESC BackFace; +} D3D11_DEPTH_STENCIL_DESC; + + +typedef enum D3D11_BLEND +{ + D3D11_BLEND_ZERO = 1, + D3D11_BLEND_ONE, + D3D11_BLEND_SRC_COLOR, + D3D11_BLEND_INV_SRC_COLOR, + D3D11_BLEND_SRC_ALPHA, + D3D11_BLEND_INV_SRC_ALPHA, + D3D11_BLEND_DEST_ALPHA, + D3D11_BLEND_INV_DEST_ALPHA, + D3D11_BLEND_DEST_COLOR, + D3D11_BLEND_INV_DEST_COLOR , + D3D11_BLEND_SRC_ALPHA_SAT, + + D3D11_BLEND_BLEND_FACTOR = 14, + D3D11_BLEND_INV_BLEND_FACTOR, + D3D11_BLEND_SRC1_COLOR, + D3D11_BLEND_INV_SRC1_COLOR , + D3D11_BLEND_SRC1_ALPHA, + D3D11_BLEND_INV_SRC1_ALPHA +} D3D11_BLEND; + +typedef enum D3D11_BLEND_OP +{ + D3D11_BLEND_OP_ADD = 1, + D3D11_BLEND_OP_SUBTRACT, + D3D11_BLEND_OP_REV_SUBTRACT, + D3D11_BLEND_OP_MIN, + D3D11_BLEND_OP_MAX +} D3D11_BLEND_OP; + +typedef enum D3D11_COLOR_WRITE_ENABLE +{ + D3D11_COLOR_WRITE_ENABLE_RED = 1, + D3D11_COLOR_WRITE_ENABLE_GREEN = 2, + D3D11_COLOR_WRITE_ENABLE_BLUE = 4, + D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D11_COLOR_WRITE_ENABLE_ALL = 0xf +} D3D11_COLOR_WRITE_ENABLE; + +typedef struct D3D11_RENDER_TARGET_BLEND_DESC +{ + BOOL BlendEnable; + D3D11_BLEND SrcBlend; + D3D11_BLEND DestBlend; + D3D11_BLEND_OP BlendOp; + D3D11_BLEND SrcBlendAlpha; + D3D11_BLEND DestBlendAlpha; + D3D11_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask; +} D3D11_RENDER_TARGET_BLEND_DESC; + +typedef struct D3D11_BLEND_DESC +{ + BOOL AlphaToCoverageEnable; + BOOL IndependentBlendEnable; + D3D11_RENDER_TARGET_BLEND_DESC RenderTarget[8]; +} D3D11_BLEND_DESC; + +typedef struct D3D11_RASTERIZER_DESC +{ + D3D11_FILL_MODE FillMode; + D3D11_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; +} D3D11_RASTERIZER_DESC; + +typedef struct D3D11_SUBRESOURCE_DATA +{ + const void *pSysMem; + UINT SysMemPitch; + UINT SysMemSlicePitch; +} D3D11_SUBRESOURCE_DATA; + +typedef struct D3D11_MAPPED_SUBRESOURCE +{ + void *pData; + UINT RowPitch; + UINT DepthPitch; +} D3D11_MAPPED_SUBRESOURCE; + +typedef struct D3D11_BUFFER_DESC +{ + UINT ByteWidth; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + UINT StructureByteStride; +} D3D11_BUFFER_DESC; + +typedef struct D3D11_TEXTURE1D_DESC +{ + UINT Width; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D11_TEXTURE1D_DESC; + +typedef struct D3D11_TEXTURE2D_DESC +{ + UINT Width; + UINT Height; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D11_TEXTURE2D_DESC; + +typedef struct D3D11_TEXTURE3D_DESC +{ + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + DXGI_FORMAT Format; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D11_TEXTURE3D_DESC; + +typedef enum D3D11_TEXTURECUBE_FACE +{ + D3D11_TEXTURECUBE_FACE_POSITIVE_X, + D3D11_TEXTURECUBE_FACE_NEGATIVE_X, + D3D11_TEXTURECUBE_FACE_POSITIVE_Y, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Y, + D3D11_TEXTURECUBE_FACE_POSITIVE_Z, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Z +} D3D11_TEXTURECUBE_FACE; + +typedef struct D3D11_BUFFER_SRV +{ + union + { + UINT FirstElement; + UINT ElementOffset; + }; + union + { + UINT NumElements; + UINT ElementWidth; + }; +} D3D11_BUFFER_SRV; + +typedef enum D3D11_BUFFEREX_SRV_FLAG +{ + D3D11_BUFFEREX_SRV_FLAG_RAW = 1 +} D3D11_BUFFEREX_SRV_FLAG; + +typedef struct D3D11_BUFFEREX_SRV +{ + UINT FirstElement; + UINT NumElements; + UINT Flags; +} D3D11_BUFFEREX_SRV; + +typedef struct D3D11_TEX1D_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; +} D3D11_TEX1D_SRV; + +typedef struct D3D11_TEX1D_ARRAY_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX1D_ARRAY_SRV; + +typedef struct D3D11_TEX2D_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; +} D3D11_TEX2D_SRV; + +typedef struct D3D11_TEX2D_ARRAY_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2D_ARRAY_SRV; + +typedef struct D3D11_TEX3D_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; +} D3D11_TEX3D_SRV; + +typedef struct D3D11_TEXCUBE_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; +} D3D11_TEXCUBE_SRV; + +typedef struct D3D11_TEXCUBE_ARRAY_SRV +{ + UINT MostDetailedMip; + UINT MipLevels; + UINT First2DArrayFace; + UINT NumCubes; +} D3D11_TEXCUBE_ARRAY_SRV; + +typedef struct D3D11_TEX2DMS_SRV +{ + UINT UnusedField_NothingToDefine; +} D3D11_TEX2DMS_SRV; + +typedef struct D3D11_TEX2DMS_ARRAY_SRV +{ + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2DMS_ARRAY_SRV; + +typedef struct D3D11_SHADER_RESOURCE_VIEW_DESC +{ + DXGI_FORMAT Format; + D3D11_SRV_DIMENSION ViewDimension; + union + { + D3D11_BUFFER_SRV Buffer; + D3D11_TEX1D_SRV Texture1D; + D3D11_TEX1D_ARRAY_SRV Texture1DArray; + D3D11_TEX2D_SRV Texture2D; + D3D11_TEX2D_ARRAY_SRV Texture2DArray; + D3D11_TEX2DMS_SRV Texture2DMS; + D3D11_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D11_TEX3D_SRV Texture3D; + D3D11_TEXCUBE_SRV TextureCube; + D3D11_TEXCUBE_ARRAY_SRV TextureCubeArray; + D3D11_BUFFEREX_SRV BufferEx; + }; +} D3D11_SHADER_RESOURCE_VIEW_DESC; + + +typedef struct D3D11_BUFFER_RTV +{ + union + { + UINT FirstElement; + UINT ElementOffset; + }; + union + { + UINT NumElements; + UINT ElementWidth; + }; +} D3D11_BUFFER_RTV; + +typedef struct D3D11_TEX1D_RTV +{ + UINT MipSlice; +} D3D11_TEX1D_RTV; + +typedef struct D3D11_TEX1D_ARRAY_RTV +{ + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX1D_ARRAY_RTV; + +typedef struct D3D11_TEX2D_RTV +{ + UINT MipSlice; +} D3D11_TEX2D_RTV; + +typedef struct D3D11_TEX2DMS_RTV +{ + UINT UnusedField_NothingToDefine; +} D3D11_TEX2DMS_RTV; + +typedef struct D3D11_TEX2D_ARRAY_RTV +{ + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2D_ARRAY_RTV; + +typedef struct D3D11_TEX2DMS_ARRAY_RTV +{ + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2DMS_ARRAY_RTV; + +typedef struct D3D11_TEX3D_RTV +{ + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; +} D3D11_TEX3D_RTV; + +typedef struct D3D11_RENDER_TARGET_VIEW_DESC +{ + DXGI_FORMAT Format; + D3D11_RTV_DIMENSION ViewDimension; + union + { + D3D11_BUFFER_RTV Buffer; + D3D11_TEX1D_RTV Texture1D; + D3D11_TEX1D_ARRAY_RTV Texture1DArray; + D3D11_TEX2D_RTV Texture2D; + D3D11_TEX2D_ARRAY_RTV Texture2DArray; + D3D11_TEX2DMS_RTV Texture2DMS; + D3D11_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D11_TEX3D_RTV Texture3D; + }; +} D3D11_RENDER_TARGET_VIEW_DESC; + +typedef struct D3D11_TEX1D_DSV +{ + UINT MipSlice; +} D3D11_TEX1D_DSV; + +typedef struct D3D11_TEX1D_ARRAY_DSV +{ + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX1D_ARRAY_DSV; + +typedef struct D3D11_TEX2D_DSV +{ + UINT MipSlice; +} D3D11_TEX2D_DSV; + +typedef struct D3D11_TEX2D_ARRAY_DSV +{ + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2D_ARRAY_DSV; + +typedef struct D3D11_TEX2DMS_DSV +{ + UINT UnusedField_NothingToDefine; +} D3D11_TEX2DMS_DSV; + +typedef struct D3D11_TEX2DMS_ARRAY_DSV +{ + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2DMS_ARRAY_DSV; + +typedef enum D3D11_DSV_FLAG +{ + D3D11_DSV_READ_ONLY_DEPTH = 1L, + D3D11_DSV_READ_ONLY_STENCIL = 2L +} D3D11_DSV_FLAG; + +typedef struct D3D11_DEPTH_STENCIL_VIEW_DESC +{ + DXGI_FORMAT Format; + D3D11_DSV_DIMENSION ViewDimension; + UINT Flags; + union + { + D3D11_TEX1D_DSV Texture1D; + D3D11_TEX1D_ARRAY_DSV Texture1DArray; + D3D11_TEX2D_DSV Texture2D; + D3D11_TEX2D_ARRAY_DSV Texture2DArray; + D3D11_TEX2DMS_DSV Texture2DMS; + D3D11_TEX2DMS_ARRAY_DSV Texture2DMSArray; + }; +} D3D11_DEPTH_STENCIL_VIEW_DESC; + +typedef enum D3D11_BUFFER_UAV_FLAG +{ + D3D11_BUFFER_UAV_FLAG_RAW = 1, + D3D11_BUFFER_UAV_FLAG_APPEND = 2, + D3D11_BUFFER_UAV_FLAG_COUNTER = 4 +} D3D11_BUFFER_UAV_FLAG; + +typedef struct D3D11_BUFFER_UAV +{ + UINT FirstElement; + UINT NumElements; + UINT Flags; +} D3D11_BUFFER_UAV; + +typedef struct D3D11_TEX1D_UAV +{ + UINT MipSlice; +} D3D11_TEX1D_UAV; + +typedef struct D3D11_TEX1D_ARRAY_UAV +{ + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX1D_ARRAY_UAV; + +typedef struct D3D11_TEX2D_UAV +{ + UINT MipSlice; +} D3D11_TEX2D_UAV; + +typedef struct D3D11_TEX2D_ARRAY_UAV +{ + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D11_TEX2D_ARRAY_UAV; + +typedef struct D3D11_TEX3D_UAV +{ + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; +} D3D11_TEX3D_UAV; + +typedef struct D3D11_UNORDERED_ACCESS_VIEW_DESC +{ + DXGI_FORMAT Format; + D3D11_UAV_DIMENSION ViewDimension; + union + { + D3D11_BUFFER_UAV Buffer; + D3D11_TEX1D_UAV Texture1D; + D3D11_TEX1D_ARRAY_UAV Texture1DArray; + D3D11_TEX2D_UAV Texture2D; + D3D11_TEX2D_ARRAY_UAV Texture2DArray; + D3D11_TEX3D_UAV Texture3D; + }; +} D3D11_UNORDERED_ACCESS_VIEW_DESC; + +typedef enum D3D11_FILTER +{ + D3D11_FILTER_MIN_MAG_MIP_POINT = 0, + D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 1, + D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 4, + D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 5, + D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D11_FILTER_ANISOTROPIC = 0x55, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5 +} D3D11_FILTER; + +typedef enum D3D11_FILTER_TYPE +{ + D3D11_FILTER_TYPE_POINT, + D3D11_FILTER_TYPE_LINEAR +} D3D11_FILTER_TYPE; + +const unsigned int D3D11_FILTER_TYPE_MASK = 3; +const unsigned int D3D11_MIN_FILTER_SHIFT = 4; +const unsigned int D3D11_MAG_FILTER_SHIFT = 2; +const unsigned int D3D11_MIP_FILTER_SHIFT = 0; +const unsigned int D3D11_COMPARISON_FILTERING_BIT = 0x80; +const unsigned int D3D11_ANISOTROPIC_FILTERING_BIT = 0x40; + +cpp_quote("#define D3D11_ENCODE_BASIC_FILTER(min, mag, mip, comp) ((D3D11_FILTER) (((comp) ? D3D11_COMPARISON_FILTERING_BIT : 0 ) | (((min) & D3D11_FILTER_TYPE_MASK ) << D3D11_MIN_FILTER_SHIFT ) | (((mag) & D3D11_FILTER_TYPE_MASK ) << D3D11_MAG_FILTER_SHIFT ) | (((mip) & D3D11_FILTER_TYPE_MASK) << D3D11_MIP_FILTER_SHIFT)))") +cpp_quote("#define D3D11_ENCODE_ANISOTROPIC_FILTER(comp) ((D3D11_FILTER)(D3D11_ANISOTROPIC_FILTERING_BIT | D3D11_ENCODE_BASIC_FILTER(D3D11_FILTER_TYPE_LINEAR, D3D11_FILTER_TYPE_LINEAR, D3D11_FILTER_TYPE_LINEAR, comp)))") +cpp_quote("#define D3D11_DECODE_MIN_FILTER(f) ((D3D11_FILTER_TYPE)(((f) >> D3D11_MIN_FILTER_SHIFT) & D3D11_FILTER_TYPE_MASK))") +cpp_quote("#define D3D11_DECODE_MAG_FILTER(f) ((D3D11_FILTER_TYPE)(((f) >> D3D11_MAG_FILTER_SHIFT) & D3D11_FILTER_TYPE_MASK))") +cpp_quote("#define D3D11_DECODE_MIP_FILTER(f) ((D3D11_FILTER_TYPE)(((f) >> D3D11_MIP_FILTER_SHIFT) & D3D11_FILTER_TYPE_MASK))") +cpp_quote("#define D3D11_DECODE_IS_COMPARISON_FILTER(f) ((f) & D3D11_COMPARISON_FILTERING_BIT)") +cpp_quote("#define D3D11_DECODE_IS_ANISOTROPIC_FILTER(f) (((f) & D3D11_ANISOTROPIC_FILTERING_BIT) && (D3D11_DECODE_MIN_FILTER(f) == D3D11_FILTER_TYPE_LINEAR) && (D3D11_DECODE_MAG_FILTER(f) == D3D11_FILTER_TYPE_LINEAR) && (D3D11_DECODE_MIP_FILTER( f ) == D3D11_FILTER_TYPE_LINEAR))") + +typedef enum D3D11_TEXTURE_ADDRESS_MODE +{ + D3D11_TEXTURE_ADDRESS_WRAP = 1, + D3D11_TEXTURE_ADDRESS_MIRROR = 2, + D3D11_TEXTURE_ADDRESS_CLAMP = 3, + D3D11_TEXTURE_ADDRESS_BORDER = 4, + D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5 +} D3D11_TEXTURE_ADDRESS_MODE; + +typedef struct D3D11_SAMPLER_DESC +{ + D3D11_FILTER Filter; + D3D11_TEXTURE_ADDRESS_MODE AddressU; + D3D11_TEXTURE_ADDRESS_MODE AddressV; + D3D11_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D11_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[ 4 ]; + FLOAT MinLOD; + FLOAT MaxLOD; +} D3D11_SAMPLER_DESC; + +typedef enum D3D11_FORMAT_SUPPORT +{ + D3D11_FORMAT_SUPPORT_BUFFER = 0x1, + D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D11_FORMAT_SUPPORT_MIP = 0x1000, + D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, + D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, + D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000 +} D3D11_FORMAT_SUPPORT; + +typedef enum D3D11_FORMAT_SUPPORT2 +{ + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 1, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 2, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 4, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 8, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80 +} D3D11_FORMAT_SUPPORT2; + +typedef enum D3D11_ASYNC_GETDATA_FLAG +{ + D3D11_ASYNC_GETDATA_DONOTFLUSH = 1 +} D3D11_ASYNC_GETDATA_FLAG; + +typedef enum D3D11_QUERY +{ + D3D11_QUERY_EVENT, + D3D11_QUERY_OCCLUSION, + D3D11_QUERY_TIMESTAMP, + D3D11_QUERY_TIMESTAMP_DISJOINT, + D3D11_QUERY_PIPELINE_STATISTICS, + D3D11_QUERY_OCCLUSION_PREDICATE, + D3D11_QUERY_SO_STATISTICS, + D3D11_QUERY_SO_OVERFLOW_PREDICATE, + D3D11_QUERY_SO_STATISTICS_STREAM0, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0, + D3D11_QUERY_SO_STATISTICS_STREAM1, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1, + D3D11_QUERY_SO_STATISTICS_STREAM2, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2, + D3D11_QUERY_SO_STATISTICS_STREAM3, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3, +} D3D11_QUERY; + +typedef enum D3D11_QUERY_MISC_FLAG +{ + D3D11_QUERY_MISC_PREDICATEHINT = 1 +} D3D11_QUERY_MISC_FLAG; + +typedef struct D3D11_QUERY_DESC +{ + D3D11_QUERY Query; + UINT MiscFlags; +} D3D11_QUERY_DESC; + +typedef struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT +{ + UINT64 Frequency; + BOOL Disjoint; +} D3D11_QUERY_DATA_TIMESTAMP_DISJOINT; + +typedef struct D3D11_QUERY_DATA_PIPELINE_STATISTICS +{ + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; + UINT64 HSInvocations; + UINT64 DSInvocations; + UINT64 CSInvocations; +} D3D11_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D11_QUERY_DATA_SO_STATISTICS +{ + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; +} D3D11_QUERY_DATA_SO_STATISTICS; + +typedef enum D3D11_COUNTER +{ + D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 +} D3D11_COUNTER; + +typedef enum D3D11_COUNTER_TYPE +{ + D3D11_COUNTER_TYPE_FLOAT32, + D3D11_COUNTER_TYPE_UINT16, + D3D11_COUNTER_TYPE_UINT32, + D3D11_COUNTER_TYPE_UINT64, +} D3D11_COUNTER_TYPE; + +typedef struct D3D11_COUNTER_DESC +{ + D3D11_COUNTER Counter; + UINT MiscFlags; +} D3D11_COUNTER_DESC; + +typedef struct D3D11_COUNTER_INFO +{ + D3D11_COUNTER LastDeviceDependentCounter; + UINT NumSimultaneousCounters; + UINT8 NumDetectableParallelUnits; +} D3D11_COUNTER_INFO; + +typedef enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS +{ + D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D11_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe +} D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS; + +typedef enum D3D11_DEVICE_CONTEXT_TYPE +{ + D3D11_DEVICE_CONTEXT_IMMEDIATE, + D3D11_DEVICE_CONTEXT_DEFERRED, +} D3D11_DEVICE_CONTEXT_TYPE; + +typedef struct D3D11_CLASS_INSTANCE_DESC +{ + UINT InstanceId; + UINT InstanceIndex; + UINT TypeId; + UINT ConstantBuffer; + UINT BaseConstantBufferOffset; + UINT BaseTexture; + UINT BaseSampler; + BOOL Created; +} D3D11_CLASS_INSTANCE_DESC; + +typedef enum D3D11_FEATURE +{ + D3D11_FEATURE_THREADING, + D3D11_FEATURE_DOUBLES, + D3D11_FEATURE_FORMAT_SUPPORT, + D3D11_FEATURE_FORMAT_SUPPORT2, + D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, +} D3D11_FEATURE; + +typedef struct D3D11_FEATURE_DATA_THREADING +{ + BOOL DriverConcurrentCreates; + BOOL DriverCommandLists; +} D3D11_FEATURE_DATA_THREADING; + +typedef struct D3D11_FEATURE_DATA_DOUBLES +{ + BOOL DoublePrecisionFloatShaderOps; +} D3D11_FEATURE_DATA_DOUBLES; + +typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT +{ + DXGI_FORMAT InFormat; + UINT OutFormatSupport; +} D3D11_FEATURE_DATA_FORMAT_SUPPORT; + +typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 +{ + DXGI_FORMAT InFormat; + UINT OutFormatSupport2; +} D3D11_FEATURE_DATA_FORMAT_SUPPORT2; + +typedef struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS +{ + BOOL ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x; +} D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS; + +interface ID3D11Device; + +[object, local, uuid("1841e5c8-16b0-489b-bcc8-44cfb0d5deae")] +interface ID3D11DeviceChild : IUnknown { + void GetDevice( + [out] ID3D11Device **ppDevice + ); + + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *pDataSize, + [out] void *pData + ); + + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT DataSize, + [in] const void *pData + ); + + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *pData + ); +}; + +[object, local, uuid("e4819ddc-4cf0-4025-bd26-5de82a3e07b7")] +interface ID3D11InputLayout : ID3D11DeviceChild +{ +}; + +[object, local, uuid("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1")] +interface ID3D11DepthStencilState : ID3D11DeviceChild { + void GetDesc( + [out] D3D11_DEPTH_STENCIL_DESC *pDesc + ); +}; + +[object, local, uuid("75b68faa-347d-4159-8f45-a0640f01cd9a")] +interface ID3D11BlendState : ID3D11DeviceChild { + void GetDesc( + [out] D3D11_BLEND_DESC *pDesc + ); +}; + +[object, local, uuid("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7")] +interface ID3D11RasterizerState : ID3D11DeviceChild { + void GetDesc( + [out] D3D11_RASTERIZER_DESC *pDesc + ); +}; + +[object, local, uuid("da6fea51-564c-4487-9810-f0d0f9b4e3a5")] +interface ID3D11SamplerState : ID3D11DeviceChild +{ + void GetDesc( + [out] D3D11_SAMPLER_DESC *pDesc + ); + +}; + +[object, local, uuid("dc8e63f3-d12b-4952-b47b-5e45026a862d")] +interface ID3D11Resource : ID3D11DeviceChild { + void GetType( + [out] D3D11_RESOURCE_DIMENSION *pResourceDimension + ); + + void SetEvictionPriority( + [in] UINT EvictionPriority + ); + + UINT GetEvictionPriority( + ); +}; + +[object, local, uuid("48570b85-d1ee-4fcd-a250-eb350722b037")] +interface ID3D11Buffer : ID3D11Resource { + void GetDesc( + [out] D3D11_BUFFER_DESC *pDesc + ); + +}; + +[object, local, uuid("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c")] +interface ID3D11Texture1D : ID3D11Resource { + void GetDesc( + [out] D3D11_TEXTURE1D_DESC *pDesc + ); +}; + +[object, local, uuid("6f15aaf2-d208-4e89-9ab4-489535d34f9c")] +interface ID3D11Texture2D : ID3D11Resource { + void GetDesc( + [out] D3D11_TEXTURE2D_DESC *pDesc + ); +}; + +[object, local, uuid("037e866e-f56d-4357-a8af-9dabbe6e250e")] +interface ID3D11Texture3D : ID3D11Resource { + void GetDesc( + [out] D3D11_TEXTURE3D_DESC *pDesc + ); +}; + +[object, local, uuid("839d1216-bb2e-412b-b7f4-a9dbebe08ed1")] +interface ID3D11View : ID3D11DeviceChild { + void GetResource( + [out] ID3D11Resource **ppResource + ); + +}; + +[object, local, uuid("b0e06fe0-8192-4e1a-b1ca-36d7414710b2")] +interface ID3D11ShaderResourceView : ID3D11View { + void GetDesc( + [out] D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc + ); +}; + +[object, local, uuid("dfdba067-0b8d-4865-875b-d7b4516cc164")] +interface ID3D11RenderTargetView : ID3D11View +{ + void GetDesc( + [out] D3D11_RENDER_TARGET_VIEW_DESC *pDesc + ); +}; + +[object, local, uuid("9fdac92a-1876-48c3-afad-25b94f84a9b6")] +interface ID3D11DepthStencilView : ID3D11View +{ + void GetDesc( + [out] D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc + ); +}; + +[object, local, uuid("28acf509-7f5c-48f6-8611-f316010a6380")] +interface ID3D11UnorderedAccessView : ID3D11View +{ + void GetDesc( + [out] D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc + ); +}; + +[object, local, uuid("3b301d64-d678-4289-8897-22f8928b72f3")] +interface ID3D11VertexShader : ID3D11DeviceChild +{ +}; + +[object, local, uuid("8e5c6061-628a-4c8e-8264-bbe45cb3d5dd")] +interface ID3D11HullShader : ID3D11DeviceChild +{ +}; + +[object, local, uuid("f582c508-0f36-490c-9977-31eece268cfa")] +interface ID3D11DomainShader : ID3D11DeviceChild +{ +}; + + +[object, local, uuid("38325b96-effb-4022-ba02-2e795b70275c")] +interface ID3D11GeometryShader : ID3D11DeviceChild +{ +}; + +[object, local, uuid("ea82e40d-51dc-4f33-93d4-db7c9125ae8c")] +interface ID3D11PixelShader : ID3D11DeviceChild +{ +}; + +[object, local, uuid("4f5b196e-c2bd-495e-bd01-1fded38e4969")] +interface ID3D11ComputeShader : ID3D11DeviceChild +{ +}; + +[object, local, uuid("4b35d0cd-1e15-4258-9c98-1b1333f6dd3b")] +interface ID3D11Asynchronous : ID3D11DeviceChild +{ + UINT GetDataSize(); +}; + +[object, local, uuid("d6c00747-87b7-425e-b84d-44d108560afd")] +interface ID3D11Query : ID3D11Asynchronous +{ + void GetDesc( + [out] D3D11_QUERY_DESC *pDesc + ); +}; + +[object, local, uuid("9eb576dd-9f77-4d86-81aa-8bab5fe490e2")] +interface ID3D11Predicate : ID3D11Query +{ +}; + +[object, local, uuid("6e8c49fb-a371-4770-b440-29086022b741")] +interface ID3D11Counter : ID3D11Asynchronous +{ + void GetDesc( + [out] D3D11_COUNTER_DESC *pDesc + ); +}; + +interface ID3D11ClassLinkage; + +[object, local, uuid("a6cd7faa-b0b7-4a2f-9436-8662a65797cb")] +interface ID3D11ClassInstance : ID3D11DeviceChild +{ + void GetClassLinkage( + [out] ID3D11ClassLinkage **ppLinkage + ); + + void GetDesc( + [out] D3D11_CLASS_INSTANCE_DESC *pDesc + ); + + void GetInstanceName( + [out] LPSTR pInstanceName, + [in, out] SIZE_T *pBufferLength + ); + + void GetTypeName( + [out] LPSTR pTypeName, + [in, out] SIZE_T *pBufferLength + ); +}; + +[object, local, uuid("ddf57cba-9543-46e4-a12b-f207a0fe7fed")] +interface ID3D11ClassLinkage : ID3D11DeviceChild +{ + HRESULT GetClassInstance( + [in] LPCSTR pClassInstanceName, + [in] UINT InstanceIndex, + [out] ID3D11ClassInstance **ppInstance + ); + + HRESULT CreateClassInstance( + [in] LPCSTR pClassTypeName, + [in] UINT ConstantBufferOffset, + [in] UINT ConstantVectorOffset, + [in] UINT TextureOffset, + [in] UINT SamplerOffset, + [out] ID3D11ClassInstance **ppInstance + ); +}; + +[object, local, uuid("a24bc4d1-769e-43f7-8013-98ff566c18e2")] +interface ID3D11CommandList : ID3D11DeviceChild +{ + UINT GetContextFlags(); +}; + +interface ID3D11DeviceContext; + +[object, local, uuid("db6f6ddb-ac77-4e88-8253-819df9bbf140")] +interface ID3D11Device : IUnknown +{ + HRESULT CreateBuffer( + [in] const D3D11_BUFFER_DESC *pDesc, + [in] const D3D11_SUBRESOURCE_DATA *pInitialData, + [out] ID3D11Buffer **ppBuffer + ); + + HRESULT CreateTexture1D( + [in] const D3D11_TEXTURE1D_DESC *pDesc, + [in] const D3D11_SUBRESOURCE_DATA *pInitialData, + [out] ID3D11Texture1D **ppTexture1D + ); + + HRESULT CreateTexture2D( + [in] const D3D11_TEXTURE2D_DESC *pDesc, + [in] const D3D11_SUBRESOURCE_DATA *pInitialData, + [out] ID3D11Texture2D **ppTexture2D + ); + + HRESULT CreateTexture3D( + [in] const D3D11_TEXTURE3D_DESC *pDesc, + [in] const D3D11_SUBRESOURCE_DATA *pInitialData, + [out] ID3D11Texture3D **ppTexture3D + ); + + HRESULT CreateShaderResourceView( + [in] ID3D11Resource *pResource, + [in] const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + [out] ID3D11ShaderResourceView **ppSRView + ); + + HRESULT CreateUnorderedAccessView( + [in] ID3D11Resource *pResource, + [in] const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + [out] ID3D11UnorderedAccessView **ppUAView + ); + + HRESULT CreateRenderTargetView( + [in] ID3D11Resource *pResource, + [in] const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + [out] ID3D11RenderTargetView **ppRTView + ); + + HRESULT CreateDepthStencilView( + [in] ID3D11Resource *pResource, + [in] const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + [out] ID3D11DepthStencilView **ppDepthStencilView + ); + + HRESULT CreateInputLayout( + [in] const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + [in] UINT NumElements, + [in] const void *pShaderBytecodeWithInputSignature, + [in] SIZE_T BytecodeLength, + [out] ID3D11InputLayout **ppInputLayout + ); + + HRESULT CreateVertexShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11VertexShader **ppVertexShader + ); + + HRESULT CreateGeometryShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11GeometryShader **ppGeometryShader + ); + + HRESULT CreateGeometryShaderWithStreamOutput( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + [in] UINT NumEntries, + [in] const UINT *pBufferStrides, + [in] UINT NumStrides, + [in] UINT RasterizedStream, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11GeometryShader **ppGeometryShader + ); + + HRESULT CreatePixelShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11PixelShader **ppPixelShader + ); + + HRESULT CreateHullShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11HullShader **ppHullShader + ); + + HRESULT CreateDomainShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11DomainShader **ppDomainShader + ); + + HRESULT CreateComputeShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] ID3D11ClassLinkage *pClassLinkage, + [out] ID3D11ComputeShader **ppComputeShader + ); + + HRESULT CreateClassLinkage( + [out] ID3D11ClassLinkage **ppLinkage + ); + + HRESULT CreateBlendState( + [in] const D3D11_BLEND_DESC *pBlendStateDesc, + [out] ID3D11BlendState **ppBlendState + ); + + HRESULT CreateDepthStencilState( + [in] const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, + [out] ID3D11DepthStencilState **ppDepthStencilState + ); + + HRESULT CreateRasterizerState( + [in] const D3D11_RASTERIZER_DESC *pRasterizerDesc, + [out] ID3D11RasterizerState **ppRasterizerState + ); + + HRESULT CreateSamplerState( + [in] const D3D11_SAMPLER_DESC *pSamplerDesc, + [out] ID3D11SamplerState **ppSamplerState + ); + + HRESULT CreateQuery( + [in] const D3D11_QUERY_DESC *pQueryDesc, + [out] ID3D11Query **ppQuery + ); + + HRESULT CreatePredicate( + [in] const D3D11_QUERY_DESC *pPredicateDesc, + [out] ID3D11Predicate **ppPredicate + ); + + HRESULT CreateCounter( + [in] const D3D11_COUNTER_DESC *pCounterDesc, + [out] ID3D11Counter **ppCounter + ); + + HRESULT CreateDeferredContext( + [in] UINT ContextFlags, + [out] ID3D11DeviceContext **ppDeferredContext + ); + + HRESULT OpenSharedResource( + [in] HANDLE hResource, + [in] REFIID ReturnedInterface, + [out] void **ppResource + ); + + HRESULT CheckFormatSupport( + [in] DXGI_FORMAT Format, + [out] UINT *pFormatSupport + ); + + HRESULT CheckMultisampleQualityLevels( + [in] DXGI_FORMAT Format, + [in] UINT SampleCount, + [out] UINT *pNumQualityLevels + ); + + void CheckCounterInfo( + [out] D3D11_COUNTER_INFO *pCounterInfo + ); + + HRESULT CheckCounter( + [in] const D3D11_COUNTER_DESC *pDesc, + [out] D3D11_COUNTER_TYPE *pType, + [out] UINT *pActiveCounters, + [out] LPSTR szName, + [in, out, optional] UINT *pNameLength, + [out] LPSTR szUnits, + [in, out, optional] UINT *pUnitsLength, + [out] LPSTR szDescription, + [in, out, optional] UINT *pDescriptionLength + ); + + HRESULT CheckFeatureSupport( + [in] D3D11_FEATURE Feature, + [out] void *pFeatureSupportData, + [in] UINT FeatureSupportDataSize + ); + + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *pDataSize, + [out] void *pData + ); + + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT DataSize, + [in] const void *pData + ); + + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *pData + ); + + D3D_FEATURE_LEVEL GetFeatureLevel(); + + UINT GetCreationFlags(); + + HRESULT GetDeviceRemovedReason(); + + void GetImmediateContext( + [out] ID3D11DeviceContext **ppImmediateContext + ); + + HRESULT SetExceptionMode( + [in] UINT RaiseFlags + ); + + UINT GetExceptionMode(); +}; + +[object, local, uuid("c0bfa96c-e089-44fb-8eaf-26f8796190da")] +interface ID3D11DeviceContext : ID3D11DeviceChild +{ + void VSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppConstantBuffers + ); + + void PSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + ); + + void PSSetShader( + [in] ID3D11PixelShader *pPixelShader, + [in] ID3D11ClassInstance *const *ppClassInstances, + [in] UINT NumClassInstances + ); + + void PSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D11SamplerState *const *ppSamplers + ); + + void VSSetShader( + [in] ID3D11VertexShader *pVertexShader, + [in] ID3D11ClassInstance *const *ppClassInstances, + [in] UINT NumClassInstances + ); + + void DrawIndexed( + [in] UINT IndexCount, + [in] UINT StartIndexLocation, + [in] INT BaseVertexLocation + ); + + void Draw( + [in] UINT VertexCount, + [in] UINT StartVertexLocation + ); + + HRESULT Map( + [in] ID3D11Resource *pResource, + [in] UINT Subresource, + [in] D3D11_MAP MapType, + [in] UINT MapFlags, + [out] D3D11_MAPPED_SUBRESOURCE *pMappedResource + ); + + void Unmap( + [in] ID3D11Resource *pResource, + [in] UINT Subresource + ); + + void PSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppConstantBuffers + ); + + void IASetInputLayout( + [in] ID3D11InputLayout *pInputLayout + ); + + void IASetVertexBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppVertexBuffers, + [in] const UINT *pStrides, + [in] const UINT *pOffsets + ); + + void IASetIndexBuffer( + [in] ID3D11Buffer *pIndexBuffer, + [in] DXGI_FORMAT Format, + [in] UINT Offset + ); + + void DrawIndexedInstanced( + [in] UINT IndexCountPerInstance, + [in] UINT InstanceCount, + [in] UINT StartIndexLocation, + [in] INT BaseVertexLocation, + [in] UINT StartInstanceLocation + ); + + void DrawInstanced( + [in] UINT VertexCountPerInstance, + [in] UINT InstanceCount, + [in] UINT StartVertexLocation, + [in] UINT StartInstanceLocation + ); + + void GSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppConstantBuffers + ); + + void GSSetShader( + [in] ID3D11GeometryShader *pShader, + [in] ID3D11ClassInstance *const *ppClassInstances, + [in] UINT NumClassInstances + ); + + void IASetPrimitiveTopology( + [in] D3D11_PRIMITIVE_TOPOLOGY Topology + ); + + void VSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + ); + + void VSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D11SamplerState *const *ppSamplers + ); + + void Begin( + [in] ID3D11Asynchronous *pAsync + ); + + void End( + [in] ID3D11Asynchronous *pAsync + ); + + HRESULT GetData( + [in] ID3D11Asynchronous *pAsync, + [out] void *pData, + [in] UINT DataSize, + [in] UINT GetDataFlags + ); + + void SetPredication( + [in] ID3D11Predicate *pPredicate, + [in] BOOL PredicateValue + ); + + void GSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + ); + + void GSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D11SamplerState *const *ppSamplers + ); + + void OMSetRenderTargets( + [in] UINT NumViews, + [in] ID3D11RenderTargetView *const *ppRenderTargetViews, + [in] ID3D11DepthStencilView *pDepthStencilView + ); + + void OMSetRenderTargetsAndUnorderedAccessViews( + [in] UINT NumRTVs, + [in] ID3D11RenderTargetView *const *ppRenderTargetViews, + [in] ID3D11DepthStencilView *pDepthStencilView, + [in] UINT UAVStartSlot, + [in] UINT NumUAVs, + [in] ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + [in] const UINT *pUAVInitialCounts + ); + + void OMSetBlendState( + [in] ID3D11BlendState *pBlendState, + [in] const FLOAT BlendFactor[ 4 ], + [in] UINT SampleMask + ); + + void OMSetDepthStencilState( + [in] ID3D11DepthStencilState *pDepthStencilState, + [in] UINT StencilRef + ); + + void SOSetTargets( + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppSOTargets, + [in] const UINT *pOffsets + ); + + void DrawAuto( + ); + + void DrawIndexedInstancedIndirect( + [in] ID3D11Buffer *pBufferForArgs, + [in] UINT AlignedByteOffsetForArgs + ); + + void DrawInstancedIndirect( + [in] ID3D11Buffer *pBufferForArgs, + [in] UINT AlignedByteOffsetForArgs + ); + + void Dispatch( + [in] UINT ThreadGroupCountX, + [in] UINT ThreadGroupCountY, + [in] UINT ThreadGroupCountZ + ); + + void DispatchIndirect( + [in] ID3D11Buffer *pBufferForArgs, + [in] UINT AlignedByteOffsetForArgs + ); + + void RSSetState( + [in] ID3D11RasterizerState *pRasterizerState + ); + + void RSSetViewports( + [in] UINT NumViewports, + [in] const D3D11_VIEWPORT *pViewports + ); + + void RSSetScissorRects( + [in] UINT NumRects, + [in] const D3D11_RECT *pRects + ); + + void CopySubresourceRegion( + [in] ID3D11Resource *pDstResource, + [in] UINT DstSubresource, + [in] UINT DstX, + [in] UINT DstY, + [in] UINT DstZ, + [in] ID3D11Resource *pSrcResource, + [in] UINT SrcSubresource, + [in] const D3D11_BOX *pSrcBox + ); + + void CopyResource( + [in] ID3D11Resource *pDstResource, + [in] ID3D11Resource *pSrcResource + ); + + void UpdateSubresource( + [in] ID3D11Resource *pDstResource, + [in] UINT DstSubresource, + [in] const D3D11_BOX *pDstBox, + [in] const void *pSrcData, + [in] UINT SrcRowPitch, + [in] UINT SrcDepthPitch + ); + + void CopyStructureCount( + [in] ID3D11Buffer *pDstBuffer, + [in] UINT DstAlignedByteOffset, + [in] ID3D11UnorderedAccessView *pSrcView + ); + + void ClearRenderTargetView( + [in] ID3D11RenderTargetView *pRenderTargetView, + [in] const FLOAT ColorRGBA[ 4 ] + ); + + void ClearUnorderedAccessViewUint( + [in] ID3D11UnorderedAccessView *pUnorderedAccessView, + [in] const UINT Values[ 4 ] + ); + + void ClearUnorderedAccessViewFloat( + [in] ID3D11UnorderedAccessView *pUnorderedAccessView, + [in] const FLOAT Values[ 4 ] + ); + + void ClearDepthStencilView( + [in] ID3D11DepthStencilView *pDepthStencilView, + [in] UINT ClearFlags, + [in] FLOAT Depth, + [in] UINT8 Stencil + ); + + void GenerateMips( + [in] ID3D11ShaderResourceView *pShaderResourceView + ); + + void SetResourceMinLOD( + [in] ID3D11Resource *pResource, + [in] FLOAT MinLOD + ); + + FLOAT GetResourceMinLOD( + [in] ID3D11Resource *pResource + ); + + void ResolveSubresource( + [in] ID3D11Resource *pDstResource, + [in] UINT DstSubresource, + [in] ID3D11Resource *pSrcResource, + [in] UINT SrcSubresource, + [in] DXGI_FORMAT Format + ); + + void ExecuteCommandList( + [in] ID3D11CommandList *pCommandList, + [in] BOOL RestoreContextState + ); + + void HSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + ); + + void HSSetShader( + [in] ID3D11HullShader *pHullShader, + [in] ID3D11ClassInstance *const *ppClassInstances, + [in] UINT NumClassInstances + ); + + void HSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D11SamplerState *const *ppSamplers + ); + + void HSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppConstantBuffers + ); + + void DSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + ); + + void DSSetShader( + [in] ID3D11DomainShader *pDomainShader, + [in] ID3D11ClassInstance *const *ppClassInstances, + [in] UINT NumClassInstances + ); + + void DSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D11SamplerState *const *ppSamplers + ); + + void DSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppConstantBuffers + ); + + void CSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + ); + + void CSSetUnorderedAccessViews( + [in] UINT StartSlot, + [in] UINT NumUAVs, + [in] ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + [in] const UINT *pUAVInitialCounts + ); + + void CSSetShader( + [in] ID3D11ComputeShader *pComputeShader, + [in] ID3D11ClassInstance *const *ppClassInstances, + [in] UINT NumClassInstances + ); + + void CSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D11SamplerState *const *ppSamplers + ); + + void CSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D11Buffer *const *ppConstantBuffers + ); + + void VSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppConstantBuffers + ); + + void PSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D11ShaderResourceView **ppShaderResourceViews + ); + + void PSGetShader( + [out] ID3D11PixelShader **ppPixelShader, + [out] ID3D11ClassInstance **ppClassInstances, + [in, out, optional] UINT *pNumClassInstances + ); + + void PSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D11SamplerState **ppSamplers + ); + + void VSGetShader( + [out] ID3D11VertexShader **ppVertexShader, + [out] ID3D11ClassInstance **ppClassInstances, + [in, out, optional] UINT *pNumClassInstances + ); + + void PSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppConstantBuffers + ); + + void IAGetInputLayout( + [out] ID3D11InputLayout **ppInputLayout + ); + + void IAGetVertexBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppVertexBuffers, + [out] UINT *pStrides, + [out] UINT *pOffsets + ); + + void IAGetIndexBuffer( + [out] ID3D11Buffer **pIndexBuffer, + [out] DXGI_FORMAT *Format, + [out] UINT *Offset + ); + + void GSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppConstantBuffers + ); + + void GSGetShader( + [out] ID3D11GeometryShader **ppGeometryShader, + [out] ID3D11ClassInstance **ppClassInstances, + [in, out, optional] UINT *pNumClassInstances + ); + + void IAGetPrimitiveTopology( + [out] D3D11_PRIMITIVE_TOPOLOGY *pTopology + ); + + void VSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D11ShaderResourceView **ppShaderResourceViews + ); + + void VSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D11SamplerState **ppSamplers + ); + + void GetPredication( + [out] ID3D11Predicate **ppPredicate, + [out] BOOL *pPredicateValue + ); + + void GSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D11ShaderResourceView **ppShaderResourceViews + ); + + void GSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D11SamplerState **ppSamplers + ); + + void OMGetRenderTargets( + [in] UINT NumViews, + [out] ID3D11RenderTargetView **ppRenderTargetViews, + [out] ID3D11DepthStencilView **ppDepthStencilView + ); + + void OMGetRenderTargetsAndUnorderedAccessViews( + [in] UINT NumRTVs, + [out] ID3D11RenderTargetView **ppRenderTargetViews, + [out] ID3D11DepthStencilView **ppDepthStencilView, + [in] UINT UAVStartSlot, + [in] UINT NumUAVs, + [out] ID3D11UnorderedAccessView **ppUnorderedAccessViews + ); + + void OMGetBlendState( + [out] ID3D11BlendState **ppBlendState, + [out] FLOAT BlendFactor[ 4 ], + [out] UINT *pSampleMask + ); + + void OMGetDepthStencilState( + [out] ID3D11DepthStencilState **ppDepthStencilState, + [out] UINT *pStencilRef + ); + + void SOGetTargets( + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppSOTargets + ); + + void RSGetState( + [out] ID3D11RasterizerState **ppRasterizerState + ); + + void RSGetViewports( + [in, out] /*_range*/ UINT *pNumViewports, + [out] D3D11_VIEWPORT *pViewports + ); + + void RSGetScissorRects( + [in, out] /*_range*/ UINT *pNumRects, + [out] D3D11_RECT *pRects + ); + + void HSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D11ShaderResourceView **ppShaderResourceViews + ); + + void HSGetShader( + [out] ID3D11HullShader **ppHullShader, + [out] ID3D11ClassInstance **ppClassInstances, + [in, out, optional] UINT *pNumClassInstances + ); + + void HSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D11SamplerState **ppSamplers + ); + + void HSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppConstantBuffers + ); + + void DSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D11ShaderResourceView **ppShaderResourceViews + ); + + void DSGetShader( + [out] ID3D11DomainShader **ppDomainShader, + [out] ID3D11ClassInstance **ppClassInstances, + [in, out, optional] UINT *pNumClassInstances + ); + + void DSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D11SamplerState **ppSamplers + ); + + void DSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppConstantBuffers + ); + + void CSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D11ShaderResourceView **ppShaderResourceViews + ); + + void CSGetUnorderedAccessViews( + [in] UINT StartSlot, + [in] UINT NumUAVs, + [out] ID3D11UnorderedAccessView **ppUnorderedAccessViews + ); + + void CSGetShader( + [out] ID3D11ComputeShader **ppComputeShader, + [out] ID3D11ClassInstance **ppClassInstances, + [in, out, optional] UINT *pNumClassInstances + ); + + void CSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D11SamplerState **ppSamplers + ); + + void CSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D11Buffer **ppConstantBuffers + ); + + void ClearState(); + + void Flush(); + + D3D11_DEVICE_CONTEXT_TYPE GetType(); + + UINT GetContextFlags(); + + HRESULT FinishCommandList( + [in] BOOL RestoreDeferredContextState, + [out] ID3D11CommandList **ppCommandList + ); +}; + +cpp_quote("#include \"d3d10_1.h\"") +cpp_quote("#include \"d3d10shader.h\"") +cpp_quote("#include \"d3d10effect.h\"") +/*cpp_quote("#include \"d3d10_1shader.h\"") */ + +typedef enum D3D11_CREATE_DEVICE_FLAG +{ + D3D11_CREATE_DEVICE_SINGLETHREADED = 1, + D3D11_CREATE_DEVICE_DEBUG = 2, + D3D11_CREATE_DEVICE_SWITCH_TO_REF = 4, + D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 8, + D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20 +} D3D11_CREATE_DEVICE_FLAG; + + +HRESULT D3D11CreateDevice( + [in,optional] IDXGIAdapter* pAdapter, + [in] D3D_DRIVER_TYPE DriverType, + [in] HMODULE Software, + [in] UINT Flags, + [in,optional] const D3D_FEATURE_LEVEL* pFeatureLevels, + [in] UINT FeatureLevels, + [in] UINT SDKVersion, + [out,optional] ID3D11Device** ppDevice, + [out,optional] D3D_FEATURE_LEVEL* pFeatureLevel, + [out,optional] ID3D11DeviceContext** ppImmediateContext +); + +typedef HRESULT (* PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)( + [in,optional] IDXGIAdapter*, + D3D_DRIVER_TYPE, + HMODULE, + UINT, + [in,optional] const D3D_FEATURE_LEVEL*, + UINT FeatureLevels, + UINT, + [in, optional] const DXGI_SWAP_CHAIN_DESC*, + [out,optional] IDXGISwapChain**, + [out,optional] ID3D11Device**, + [out,optional] D3D_FEATURE_LEVEL*, + [out,optional] ID3D11DeviceContext** +); + +HRESULT D3D11CreateDeviceAndSwapChain( + [in,optional] IDXGIAdapter* pAdapter, + [in] D3D_DRIVER_TYPE DriverType, + [in] HMODULE Software, + [in] UINT Flags, + [in,optional] const D3D_FEATURE_LEVEL* pFeatureLevels, + [in] UINT FeatureLevels, + [in] UINT SDKVersion, + [in,optional] const DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + [out,optional] IDXGISwapChain** ppSwapChain, + [out,optional] ID3D11Device** ppDevice, + [out,optional] D3D_FEATURE_LEVEL* pFeatureLevel, + [out,optional] ID3D11DeviceContext** ppImmediateContext +); diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl new file mode 100644 index 00000000000..09588a02f5a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl @@ -0,0 +1,287 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "d3dcommon.idl"; + +typedef enum D3D11_SHADER_VERSION_TYPE +{ + D3D11_SHVER_PIXEL_SHADER, + D3D11_SHVER_VERTEX_SHADER, + D3D11_SHVER_GEOMETRY_SHADER, + + D3D11_SHVER_HULL_SHADER, + D3D11_SHVER_DOMAIN_SHADER, + D3D11_SHVER_COMPUTE_SHADER, +} D3D11_SHADER_VERSION_TYPE; + +cpp_quote("#define D3D11_SHVER_GET_TYPE(v) (((v) >> 16) & 0xffff)") +cpp_quote("#define D3D11_SHVER_GET_MAJOR(v) (((v) >> 4) & 0xf)") +cpp_quote("#define D3D11_SHVER_GET_MINOR(v) (((v) >> 0) & 0xf)") + +typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE; +typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE; + +typedef struct _D3D11_SIGNATURE_PARAMETER_DESC +{ + LPCSTR SemanticName; + UINT SemanticIndex; + UINT Register; + D3D_NAME SystemValueType; + D3D_REGISTER_COMPONENT_TYPE ComponentType; + BYTE Mask; + BYTE ReadWriteMask; + UINT Stream; +} D3D11_SIGNATURE_PARAMETER_DESC; + +typedef struct _D3D11_SHADER_BUFFER_DESC +{ + LPCSTR Name; + D3D_CBUFFER_TYPE Type; + UINT Variables; + UINT Size; + UINT uFlags; +} D3D11_SHADER_BUFFER_DESC; + +typedef struct _D3D11_SHADER_VARIABLE_DESC +{ + LPCSTR Name; + UINT StartOffset; + UINT Size; + UINT uFlags; + LPVOID DefaultValue; + UINT StartTexture; + UINT TextureSize; + UINT StartSampler; + UINT SamplerSize; +} D3D11_SHADER_VARIABLE_DESC; + +typedef struct _D3D11_SHADER_TYPE_DESC +{ + D3D_SHADER_VARIABLE_CLASS Class; + D3D_SHADER_VARIABLE_TYPE Type; + UINT Rows; + UINT Columns; + UINT Elements; + UINT Members; + UINT Offset; + LPCSTR Name; +} D3D11_SHADER_TYPE_DESC; + +typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN; +typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING; +typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE; + +typedef struct _D3D11_SHADER_DESC +{ + UINT Version; + LPCSTR Creator; + UINT Flags; + + UINT ConstantBuffers; + UINT BoundResources; + UINT InputParameters; + UINT OutputParameters; + + UINT InstructionCount; + UINT TempRegisterCount; + UINT TempArrayCount; + UINT DefCount; + UINT DclCount; + UINT TextureNormalInstructions; + UINT TextureLoadInstructions; + UINT TextureCompInstructions; + UINT TextureBiasInstructions; + UINT TextureGradientInstructions; + UINT FloatInstructionCount; + UINT IntInstructionCount; + UINT UintInstructionCount; + UINT StaticFlowControlCount; + UINT DynamicFlowControlCount; + UINT MacroInstructionCount; + UINT ArrayInstructionCount; + UINT CutInstructionCount; + UINT EmitInstructionCount; + D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; + UINT GSMaxOutputVertexCount; + D3D_PRIMITIVE InputPrimitive; + UINT PatchConstantParameters; + UINT cGSInstanceCount; + UINT cControlPoints; + D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; + D3D_TESSELLATOR_PARTITIONING HSPartitioning; + D3D_TESSELLATOR_DOMAIN TessellatorDomain; + + UINT cBarrierInstructions; + UINT cInterlockedInstructions; + UINT cTextureStoreInstructions; +} D3D11_SHADER_DESC; + +typedef struct _D3D11_SHADER_INPUT_BIND_DESC +{ + LPCSTR Name; + D3D_SHADER_INPUT_TYPE Type; + UINT BindPoint; + UINT BindCount; + + UINT uFlags; + D3D_RESOURCE_RETURN_TYPE ReturnType; + D3D_SRV_DIMENSION Dimension; + UINT NumSamples; +} D3D11_SHADER_INPUT_BIND_DESC; + +[local, object, uuid("6e6ffa6a-9bae-4613-a51e-91652d508c21")] +interface ID3D11ShaderReflectionType +{ + HRESULT GetDesc( + [out] D3D11_SHADER_TYPE_DESC *pDesc + ); + + ID3D11ShaderReflectionType* GetMemberTypeByIndex( + [in] UINT Index + ); + + ID3D11ShaderReflectionType* GetMemberTypeByName( + [in] LPCSTR Name + ); + + LPCSTR GetMemberTypeName( + [in] UINT Index + ); + + HRESULT IsEqual( + [in] ID3D11ShaderReflectionType* pType + ); + ID3D11ShaderReflectionType* GetSubType(); + ID3D11ShaderReflectionType* GetBaseClass(); + UINT GetNumInterfaces(); + ID3D11ShaderReflectionType* GetInterfaceByIndex( + [in] UINT uIndex + ); + HRESULT IsOfType( + [in] ID3D11ShaderReflectionType* pType + ); + HRESULT ImplementsInterface( + [in] ID3D11ShaderReflectionType* pBase + ); +}; + +interface ID3D11ShaderReflectionConstantBuffer; + +[object, local, uuid("51f23923-f3e5-4bd1-91cb-606177d8db4c")] +interface ID3D11ShaderReflectionVariable +{ + HRESULT GetDesc( + [out] D3D11_SHADER_VARIABLE_DESC *pDesc + ); + + ID3D11ShaderReflectionType* GetType(); + ID3D11ShaderReflectionConstantBuffer* GetBuffer(); + + UINT GetInterfaceSlot( + [in] UINT uArrayIndex + ); +}; + +[object, local, uuid("eb62d63d-93dd-4318-8ae8-c6f83ad371b8")] +interface ID3D11ShaderReflectionConstantBuffer +{ + HRESULT GetDesc( + [out] D3D11_SHADER_BUFFER_DESC *pDesc + ); + + ID3D11ShaderReflectionVariable* GetVariableByIndex( + [in] UINT Index + ); + + ID3D11ShaderReflectionVariable* GetVariableByName( + [in] LPCSTR Name + ); +}; + +[object,local,uuid("0a233719-3960-4578-9d7c-203b8b1d9cc1")] +interface ID3D11ShaderReflection +{ + HRESULT GetDesc( + [out] D3D11_SHADER_DESC *pDesc + ); + + ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByIndex( + [in] UINT Index + ); + + ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByName( + [in] LPCSTR Name + ); + + HRESULT GetResourceBindingDesc( + [in] UINT ResourceIndex, + [out] D3D11_SHADER_INPUT_BIND_DESC *pDesc + ); + + HRESULT GetInputParameterDesc( + [in] UINT ParameterIndex, + [out] D3D11_SIGNATURE_PARAMETER_DESC *pDesc + ); + + HRESULT GetOutputParameterDesc + ( + [in] UINT ParameterIndex, + [out] D3D11_SIGNATURE_PARAMETER_DESC *pDesc + ); + + HRESULT GetPatchConstantParameterDesc( + [in] UINT ParameterIndex, + [out] D3D11_SIGNATURE_PARAMETER_DESC *pDesc + ); + + ID3D11ShaderReflectionVariable* GetVariableByName( + [in] LPCSTR Name + ); + + HRESULT GetResourceBindingDescByName( + [in] LPCSTR Name, + [out] D3D11_SHADER_INPUT_BIND_DESC *pDesc + ); + + UINT GetMovInstructionCount(); + UINT GetMovcInstructionCount(); + UINT GetConversionInstructionCount(); + UINT GetBitwiseInstructionCount(); + D3D_PRIMITIVE GetGSInputPrimitive(); + BOOL IsSampleFrequencyShader(); + UINT GetNumInterfaceSlots(); + + HRESULT GetMinFeatureLevel( + [out] D3D_FEATURE_LEVEL* pLevel + ); + + UINT GetThreadGroupSize( + [out,optional] UINT* pSizeX, + [out,optional] UINT* pSizeY, + [out,optional] UINT* pSizeZ + ); +}; + diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl new file mode 100644 index 00000000000..3594bf58f8c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl @@ -0,0 +1,700 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "oaidl.idl"; +import "ocidl.idl"; + +typedef const void* LPCVOID; + +typedef enum D3D_DRIVER_TYPE +{ + D3D_DRIVER_TYPE_UNKNOWN, + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_REFERENCE, + D3D_DRIVER_TYPE_NULL, + D3D_DRIVER_TYPE_SOFTWARE, + D3D_DRIVER_TYPE_WARP, +} D3D_DRIVER_TYPE; + +typedef enum D3D_FEATURE_LEVEL +{ + D3D_FEATURE_LEVEL_9_1 = 0x9100, + D3D_FEATURE_LEVEL_9_2 = 0x9200, + D3D_FEATURE_LEVEL_9_3 = 0x9300, + D3D_FEATURE_LEVEL_10_0 = 0xa000, + D3D_FEATURE_LEVEL_10_1 = 0xa100, + D3D_FEATURE_LEVEL_11_0 = 0xb000 +} D3D_FEATURE_LEVEL; + +typedef enum D3D_PRIMITIVE_TOPOLOGY +{ + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D_PRIMITIVE_TOPOLOGY_LINELIST, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, + + D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D10_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + + D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + + D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D11_PRIMITIVE_TOPOLOGY_LINELIST, + D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + + D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + + D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, +} D3D_PRIMITIVE_TOPOLOGY; + +typedef enum D3D_PRIMITIVE +{ + D3D_PRIMITIVE_UNDEFINED = 0, + D3D_PRIMITIVE_POINT, + D3D_PRIMITIVE_LINE, + D3D_PRIMITIVE_TRIANGLE, + + D3D_PRIMITIVE_LINE_ADJ = 6, + D3D_PRIMITIVE_TRIANGLE_ADJ, + + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH, + + D3D10_PRIMITIVE_UNDEFINED = 0, + D3D10_PRIMITIVE_POINT, + D3D10_PRIMITIVE_LINE, + D3D10_PRIMITIVE_TRIANGLE, + + D3D10_PRIMITIVE_LINE_ADJ = 6, + D3D10_PRIMITIVE_TRIANGLE_ADJ, + + D3D11_PRIMITIVE_UNDEFINED = 0, + D3D11_PRIMITIVE_POINT, + D3D11_PRIMITIVE_LINE, + D3D11_PRIMITIVE_TRIANGLE, + + D3D11_PRIMITIVE_LINE_ADJ = 6, + D3D11_PRIMITIVE_TRIANGLE_ADJ, + + D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, + D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH, +} D3D_PRIMITIVE; + +typedef enum D3D_SRV_DIMENSION +{ + D3D_SRV_DIMENSION_UNKNOWN = 0, + D3D_SRV_DIMENSION_BUFFER, + D3D_SRV_DIMENSION_TEXTURE1D, + D3D_SRV_DIMENSION_TEXTURE1DARRAY, + D3D_SRV_DIMENSION_TEXTURE2D, + D3D_SRV_DIMENSION_TEXTURE2DARRAY, + D3D_SRV_DIMENSION_TEXTURE2DMS, + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D_SRV_DIMENSION_TEXTURE3D, + D3D_SRV_DIMENSION_TEXTURECUBE, + D3D_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D_SRV_DIMENSION_BUFFEREX, + + D3D10_SRV_DIMENSION_UNKNOWN = 0, + D3D10_SRV_DIMENSION_BUFFER, + D3D10_SRV_DIMENSION_TEXTURE1D, + D3D10_SRV_DIMENSION_TEXTURE1DARRAY, + D3D10_SRV_DIMENSION_TEXTURE2D, + D3D10_SRV_DIMENSION_TEXTURE2DARRAY, + D3D10_SRV_DIMENSION_TEXTURE2DMS, + D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_SRV_DIMENSION_TEXTURE3D, + D3D10_SRV_DIMENSION_TEXTURECUBE, + + D3D10_1_SRV_DIMENSION_UNKNOWN = 0, + D3D10_1_SRV_DIMENSION_BUFFER, + D3D10_1_SRV_DIMENSION_TEXTURE1D, + D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE2D, + D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE2DMS, + D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE3D, + D3D10_1_SRV_DIMENSION_TEXTURECUBE, + D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY, + + D3D11_SRV_DIMENSION_UNKNOWN = 0, + D3D11_SRV_DIMENSION_BUFFER, + D3D11_SRV_DIMENSION_TEXTURE1D, + D3D11_SRV_DIMENSION_TEXTURE1DARRAY, + D3D11_SRV_DIMENSION_TEXTURE2D, + D3D11_SRV_DIMENSION_TEXTURE2DARRAY, + D3D11_SRV_DIMENSION_TEXTURE2DMS, + D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D11_SRV_DIMENSION_TEXTURE3D, + D3D11_SRV_DIMENSION_TEXTURECUBE, + D3D11_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D11_SRV_DIMENSION_BUFFEREX, +} D3D_SRV_DIMENSION; + +typedef struct _D3D_SHADER_MACRO +{ + LPCSTR Name; + LPCSTR Definition; +} D3D_SHADER_MACRO; + +typedef struct _D3D_SHADER_MACRO *LPD3D_SHADER_MACRO; + +[object, local, uuid(8ba5fb08-5195-40e2-ac58-0d989c3a0102)] +interface ID3D10Blob : IUnknown +{ + LPVOID GetBufferPointer(); + SIZE_T GetBufferSize(); +}; + +typedef enum _D3D_INCLUDE_TYPE +{ + D3D_INCLUDE_LOCAL = 0, + D3D_INCLUDE_SYSTEM, + + D3D10_INCLUDE_LOCAL = 0, + D3D10_INCLUDE_SYSTEM, + + D3D_INCLUDE_FORCE_DWORD = 0x7fffffff, +} D3D_INCLUDE_TYPE; + +[object, local] +interface ID3DInclude : IUnknown +{ + HRESULT Open( + [in] D3D_INCLUDE_TYPE IncludeType, + [in] LPCSTR pFileName, + [in] LPCVOID pParentData, + [out] LPCVOID *ppData, + [in] UINT *pBytes + ); + HRESULT Close( + [in] LPCVOID pData + ); +}; + +typedef enum _D3D_SHADER_VARIABLE_CLASS +{ + D3D_SVC_SCALAR = 0, + D3D_SVC_VECTOR, + D3D_SVC_MATRIX_ROWS, + D3D_SVC_MATRIX_COLUMNS, + D3D_SVC_OBJECT, + D3D_SVC_STRUCT, + D3D_SVC_INTERFACE_CLASS, + D3D_SVC_INTERFACE_POINTER, + + D3D10_SVC_SCALAR = 0, + D3D10_SVC_VECTOR, + D3D10_SVC_MATRIX_ROWS, + D3D10_SVC_MATRIX_COLUMNS, + D3D10_SVC_OBJECT, + D3D10_SVC_STRUCT, + D3D11_SVC_INTERFACE_CLASS, + D3D11_SVC_INTERFACE_POINTER, + D3D_SVC_FORCE_DWORD = 0x7fffffff +} D3D_SHADER_VARIABLE_CLASS; + +typedef enum _D3D_SHADER_VARIABLE_FLAGS +{ + D3D_SVF_USERPACKED = 1, + D3D_SVF_USED = 2, + D3D_SVF_INTERFACE_POINTER = 4, + D3D_SVF_INTERFACE_PARAMETER = 8, + + D3D10_SVF_USERPACKED = 1, + D3D10_SVF_USED = 2, + D3D10_SVF_INTERFACE_POINTER = 4, + D3D10_SVF_INTERFACE_PARAMETER = 8, + + D3D_SVF_FORCE_DWORD = 0x7fffffff +} D3D_SHADER_VARIABLE_FLAGS; + +typedef enum _D3D_SHADER_VARIABLE_TYPE +{ + D3D_SVT_VOID = 0, + D3D_SVT_BOOL, + D3D_SVT_INT, + D3D_SVT_FLOAT, + D3D_SVT_STRING, + D3D_SVT_TEXTURE, + D3D_SVT_TEXTURE1D, + D3D_SVT_TEXTURE2D, + D3D_SVT_TEXTURE3D, + D3D_SVT_TEXTURECUBE, + D3D_SVT_SAMPLER, + D3D_SVT_SAMPLER1D, + D3D_SVT_SAMPLER2D, + D3D_SVT_SAMPLER3D, + D3D_SVT_SAMPLERCUBE, + D3D_SVT_PIXELSHADER, + D3D_SVT_VERTEXSHADER, + D3D_SVT_PIXELFRAGMENT, + D3D_SVT_VERTEXFRAGMENT, + D3D_SVT_UINT, + D3D_SVT_UINT8, + D3D_SVT_GEOMETRYSHADER, + D3D_SVT_RASTERIZER, + D3D_SVT_DEPTHSTENCIL, + D3D_SVT_BLEND, + D3D_SVT_BUFFER, + D3D_SVT_CBUFFER, + D3D_SVT_TBUFFER, + D3D_SVT_TEXTURE1DARRAY, + D3D_SVT_TEXTURE2DARRAY, + D3D_SVT_RENDERTARGETVIEW, + D3D_SVT_DEPTHSTENCILVIEW, + D3D_SVT_TEXTURE2DMS, + D3D_SVT_TEXTURE2DMSARRAY, + D3D_SVT_TEXTURECUBEARRAY, + D3D_SVT_HULLSHADER, + D3D_SVT_DOMAINSHADER, + D3D_SVT_INTERFACE_POINTER, + D3D_SVT_COMPUTESHADER, + D3D_SVT_DOUBLE, + D3D_SVT_RWTEXTURE1D, + D3D_SVT_RWTEXTURE1DARRAY, + D3D_SVT_RWTEXTURE2D, + D3D_SVT_RWTEXTURE2DARRAY, + D3D_SVT_RWTEXTURE3D, + D3D_SVT_RWBUFFER, + D3D_SVT_BYTEADDRESS_BUFFER, + D3D_SVT_RWBYTEADDRESS_BUFFER, + D3D_SVT_STRUCTURED_BUFFER, + D3D_SVT_RWSTRUCTURED_BUFFER, + D3D_SVT_APPEND_STRUCTURED_BUFFER, + D3D_SVT_CONSUME_STRUCTURED_BUFFER, + + D3D10_SVT_VOID = 0, + D3D10_SVT_BOOL, + D3D10_SVT_INT, + D3D10_SVT_FLOAT, + D3D10_SVT_STRING, + D3D10_SVT_TEXTURE, + D3D10_SVT_TEXTURE1D, + D3D10_SVT_TEXTURE2D, + D3D10_SVT_TEXTURE3D, + D3D10_SVT_TEXTURECUBE, + D3D10_SVT_SAMPLER, + D3D10_SVT_SAMPLER1D, + D3D10_SVT_SAMPLER2D, + D3D10_SVT_SAMPLER3D, + D3D10_SVT_SAMPLERCUBE, + D3D10_SVT_PIXELSHADER, + D3D10_SVT_VERTEXSHADER, + D3D10_SVT_PIXELFRAGMENT, + D3D10_SVT_VERTEXFRAGMENT, + D3D10_SVT_UINT, + D3D10_SVT_UINT8, + D3D10_SVT_GEOMETRYSHADER, + D3D10_SVT_RASTERIZER, + D3D10_SVT_DEPTHSTENCIL, + D3D10_SVT_BLEND, + D3D10_SVT_BUFFER, + D3D10_SVT_CBUFFER, + D3D10_SVT_TBUFFER, + D3D10_SVT_TEXTURE1DARRAY, + D3D10_SVT_TEXTURE2DARRAY, + D3D10_SVT_RENDERTARGETVIEW, + D3D10_SVT_DEPTHSTENCILVIEW, + D3D10_SVT_TEXTURE2DMS, + D3D10_SVT_TEXTURE2DMSARRAY, + D3D10_SVT_TEXTURECUBEARRAY, + + D3D11_SVT_HULLSHADER, + D3D11_SVT_DOMAINSHADER, + D3D11_SVT_INTERFACE_POINTER, + D3D11_SVT_COMPUTESHADER, + D3D11_SVT_DOUBLE, + D3D11_SVT_RWTEXTURE1D, + D3D11_SVT_RWTEXTURE1DARRAY, + D3D11_SVT_RWTEXTURE2D, + D3D11_SVT_RWTEXTURE2DARRAY, + D3D11_SVT_RWTEXTURE3D, + D3D11_SVT_RWBUFFER, + D3D11_SVT_BYTEADDRESS_BUFFER, + D3D11_SVT_RWBYTEADDRESS_BUFFER, + D3D11_SVT_STRUCTURED_BUFFER, + D3D11_SVT_RWSTRUCTURED_BUFFER, + D3D11_SVT_APPEND_STRUCTURED_BUFFER, + D3D11_SVT_CONSUME_STRUCTURED_BUFFER, + + D3D_SVT_FORCE_DWORD = 0x7fffffff +} D3D_SHADER_VARIABLE_TYPE; + +typedef enum _D3D_SHADER_INPUT_FLAGS +{ + D3D_SIF_USERPACKED = 1, + D3D_SIF_COMPARISON_SAMPLER = 2, + D3D_SIF_TEXTURE_COMPONENT_0 = 4, + D3D_SIF_TEXTURE_COMPONENT_1 = 8, + D3D_SIF_TEXTURE_COMPONENTS = 12, + + D3D10_SIF_USERPACKED = 1, + D3D10_SIF_COMPARISON_SAMPLER = 2, + D3D10_SIF_TEXTURE_COMPONENT_0 = 4, + D3D10_SIF_TEXTURE_COMPONENT_1 = 8, + D3D10_SIF_TEXTURE_COMPONENTS = 12, + + D3D_SIF_FORCE_DWORD = 0x7fffffff + } D3D_SHADER_INPUT_FLAGS; + +typedef enum _D3D_SHADER_INPUT_TYPE +{ + D3D_SIT_CBUFFER = 0, + D3D_SIT_TBUFFER, + D3D_SIT_TEXTURE, + D3D_SIT_SAMPLER, + D3D_SIT_UAV_RWTYPED, + D3D_SIT_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED, + D3D_SIT_BYTEADDRESS, + D3D_SIT_UAV_RWBYTEADDRESS, + D3D_SIT_UAV_APPEND_STRUCTURED, + D3D_SIT_UAV_CONSUME_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, + + D3D10_SIT_CBUFFER = 0, + D3D10_SIT_TBUFFER, + D3D10_SIT_TEXTURE, + D3D10_SIT_SAMPLER, + + D3D11_SIT_UAV_RWTYPED, + D3D11_SIT_STRUCTURED, + D3D11_SIT_UAV_RWSTRUCTURED, + D3D11_SIT_BYTEADDRESS, + D3D11_SIT_UAV_RWBYTEADDRESS, + D3D11_SIT_UAV_APPEND_STRUCTURED, + D3D11_SIT_UAV_CONSUME_STRUCTURED, + D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, + } D3D_SHADER_INPUT_TYPE; + +typedef enum _D3D_SHADER_CBUFFER_FLAGS +{ + D3D_CBF_USERPACKED = 1, + + D3D10_CBF_USERPACKED = 1, + + D3D_CBF_FORCE_DWORD = 0x7fffffff +} D3D_SHADER_CBUFFER_FLAGS; + +typedef enum _D3D_CBUFFER_TYPE +{ + D3D_CT_CBUFFER = 0, + D3D_CT_TBUFFER, + D3D_CT_INTERFACE_POINTERS, + D3D_CT_RESOURCE_BIND_INFO, + + D3D10_CT_CBUFFER = 0, + D3D10_CT_TBUFFER, + + D3D11_CT_CBUFFER = 0, + D3D11_CT_TBUFFER, + D3D11_CT_INTERFACE_POINTERS, + D3D11_CT_RESOURCE_BIND_INFO, +} D3D_CBUFFER_TYPE; + +typedef enum D3D_NAME +{ + D3D_NAME_UNDEFINED = 0, + D3D_NAME_POSITION, + D3D_NAME_CLIP_DISTANCE, + D3D_NAME_CULL_DISTANCE, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX, + D3D_NAME_VIEWPORT_ARRAY_INDEX, + D3D_NAME_VERTEX_ID, + D3D_NAME_PRIMITIVE_ID, + D3D_NAME_INSTANCE_ID, + D3D_NAME_IS_FRONT_FACE, + D3D_NAME_SAMPLE_INDEX, + D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR, + D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, + D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR, + D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR, + D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR, + D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR, + + D3D_NAME_TARGET = 64, + D3D_NAME_DEPTH, + D3D_NAME_COVERAGE, + D3D_NAME_DEPTH_GREATER_EQUAL, + D3D_NAME_DEPTH_LESS_EQUAL, + + D3D10_NAME_UNDEFINED = 0, + D3D10_NAME_POSITION, + D3D10_NAME_CLIP_DISTANCE, + D3D10_NAME_CULL_DISTANCE, + D3D10_NAME_RENDER_TARGET_ARRAY_INDEX, + D3D10_NAME_VIEWPORT_ARRAY_INDEX, + D3D10_NAME_VERTEX_ID, + D3D10_NAME_PRIMITIVE_ID, + D3D10_NAME_INSTANCE_ID, + D3D10_NAME_IS_FRONT_FACE, + D3D10_NAME_SAMPLE_INDEX, + + D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR, + D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, + D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR, + D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR, + D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR, + D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR, + + D3D10_NAME_TARGET = 64, + D3D10_NAME_DEPTH , + D3D10_NAME_COVERAGE, + + D3D11_NAME_DEPTH_GREATER_EQUAL, + D3D11_NAME_DEPTH_LESS_EQUAL, +} D3D_NAME; + +typedef enum D3D_RESOURCE_RETURN_TYPE +{ + D3D_RETURN_TYPE_UNORM = 1, + D3D_RETURN_TYPE_SNORM, + D3D_RETURN_TYPE_SINT, + D3D_RETURN_TYPE_UINT, + D3D_RETURN_TYPE_FLOAT, + D3D_RETURN_TYPE_MIXED, + D3D_RETURN_TYPE_DOUBLE, + D3D_RETURN_TYPE_CONTINUED, + + D3D10_RETURN_TYPE_UNORM = 1, + D3D10_RETURN_TYPE_SNORM, + D3D10_RETURN_TYPE_SINT, + D3D10_RETURN_TYPE_UINT, + D3D10_RETURN_TYPE_FLOAT, + D3D10_RETURN_TYPE_MIXED, + + D3D11_RETURN_TYPE_UNORM = 1, + D3D11_RETURN_TYPE_SNORM, + D3D11_RETURN_TYPE_SINT, + D3D11_RETURN_TYPE_UINT, + D3D11_RETURN_TYPE_FLOAT, + D3D11_RETURN_TYPE_MIXED, + D3D11_RETURN_TYPE_DOUBLE, + D3D11_RETURN_TYPE_CONTINUED, +} D3D_RESOURCE_RETURN_TYPE; + +typedef enum D3D_REGISTER_COMPONENT_TYPE +{ + D3D_REGISTER_COMPONENT_UNKNOWN = 0, + D3D_REGISTER_COMPONENT_UINT32, + D3D_REGISTER_COMPONENT_SINT32, + D3D_REGISTER_COMPONENT_FLOAT32, + + D3D10_REGISTER_COMPONENT_UNKNOWN = 0, + D3D10_REGISTER_COMPONENT_UINT32, + D3D10_REGISTER_COMPONENT_SINT32, + D3D10_REGISTER_COMPONENT_FLOAT32, +} D3D_REGISTER_COMPONENT_TYPE; + +typedef enum D3D_TESSELLATOR_DOMAIN +{ + D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0, + D3D_TESSELLATOR_DOMAIN_ISOLINE, + D3D_TESSELLATOR_DOMAIN_TRI, + D3D_TESSELLATOR_DOMAIN_QUAD, + + D3D11_TESSELLATOR_DOMAIN_UNDEFINED = 0, + D3D11_TESSELLATOR_DOMAIN_ISOLINE, + D3D11_TESSELLATOR_DOMAIN_TRI, + D3D11_TESSELLATOR_DOMAIN_QUAD, +} D3D_TESSELLATOR_DOMAIN; + +typedef enum D3D_TESSELLATOR_PARTITIONING +{ + D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0, + D3D_TESSELLATOR_PARTITIONING_INTEGER, + D3D_TESSELLATOR_PARTITIONING_POW2, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, + + D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = 0, + D3D11_TESSELLATOR_PARTITIONING_INTEGER, + D3D11_TESSELLATOR_PARTITIONING_POW2, + D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, +} D3D_TESSELLATOR_PARTITIONING; + +typedef enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE +{ + D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0, + D3D_TESSELLATOR_OUTPUT_POINT, + D3D_TESSELLATOR_OUTPUT_LINE, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, + + D3D11_TESSELLATOR_OUTPUT_UNDEFINED = 0, + D3D11_TESSELLATOR_OUTPUT_POINT, + D3D11_TESSELLATOR_OUTPUT_LINE, + D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW, +} D3D_TESSELLATOR_OUTPUT_PRIMITIVE; + diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl b/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl new file mode 100644 index 00000000000..d268e43c0dd --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl @@ -0,0 +1,470 @@ +/* + * Copyright 2007 Andras Kovacs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/*DXGI 1.1 IDL, and missing DXGI 1.0 parts added by Luca Barbieri on Sep 2010 */ + +import "dxgitype.idl"; + +const UINT _FACDXGI = 0x87a; + +cpp_quote("#define MAKE_DXGI_STATUS(x) MAKE_HRESULT(0, _FACDXGI, x)") +cpp_quote("#define DXGI_STATUS_OCCLUDED MAKE_DXGI_STATUS(1)") +cpp_quote("#define DXGI_STATUS_CLIPPED MAKE_DXGI_STATUS(2)") +cpp_quote("#define DXGI_STATUS_NO_REDIRECTION MAKE_DXGI_STATUS(4)") +cpp_quote("#define DXGI_STATUS_NO_DESKTOP_ACCESS MAKE_DXGI_STATUS(5)") +cpp_quote("#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_STATUS(6)") +cpp_quote("#define DXGI_STATUS_MODE_CHANGED MAKE_DXGI_STATUS(7)") +cpp_quote("#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS MAKE_DXGI_STATUS(8)") + +cpp_quote("#define MAKE_DXGI_HRESULT(x) MAKE_HRESULT(1, _FACDXGI, x)") +cpp_quote("#define DXGI_ERROR_INVALID_CALL MAKE_DXGI_HRESULT(1)") +cpp_quote("#define DXGI_ERROR_NOT_FOUND MAKE_DXGI_HRESULT(2)") +cpp_quote("#define DXGI_ERROR_MORE_DATA MAKE_DXGI_HRESULT(3)") +cpp_quote("#define DXGI_ERROR_UNSUPPORTED MAKE_DXGI_HRESULT(4)") +cpp_quote("#define DXGI_ERROR_DEVICE_REMOVED MAKE_DXGI_HRESULT(5)") +cpp_quote("#define DXGI_ERROR_DEVICE_HUNG MAKE_DXGI_HRESULT(6)") +cpp_quote("#define DXGI_ERROR_DEVICE_RESET MAKE_DXGI_HRESULT(7)") +cpp_quote("#define DXGI_ERROR_WAS_STILL_DRAWING MAKE_DXGI_HRESULT(10)") +cpp_quote("#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT MAKE_DXGI_HRESULT(11)") +cpp_quote("#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_HRESULT(12)") +cpp_quote("#define DXGI_ERROR_DRIVER_INTERNAL_ERROR MAKE_DXGI_HRESULT(32)") +cpp_quote("#define DXGI_ERROR_NONEXCLUSIVE MAKE_DXGI_HRESULT(33)") +cpp_quote("#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT(34)") + +cpp_quote("#if 0") +typedef HANDLE HMONITOR; +typedef struct _LUID { + DWORD LowPart; + LONG HighPart; +} LUID, *PLUID; +cpp_quote("#endif") + +typedef UINT DXGI_USAGE; +const DXGI_USAGE DXGI_USAGE_SHADER_INPUT = 0x10L; +const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT = 0x20L; +const DXGI_USAGE DXGI_USAGE_BACK_BUFFER = 0x40L; +const DXGI_USAGE DXGI_USAGE_SHARED = 0x80L; +const DXGI_USAGE DXGI_USAGE_READ_ONLY = 0x100L; + +typedef enum DXGI_SWAP_EFFECT { + DXGI_SWAP_EFFECT_DISCARD = 0, + DXGI_SWAP_EFFECT_SEQUENTIAL = 1, +} DXGI_SWAP_EFFECT; + +typedef enum DXGI_RESIDENCY { + DXGI_RESIDENCY_FULLY_RESIDENT = 1, + DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, + DXGI_RESIDENCY_EVICTED_TO_DISK = 3, +} DXGI_RESIDENCY; + +typedef struct DXGI_SURFACE_DESC { + UINT Width; + UINT Height; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; +} DXGI_SURFACE_DESC; + +typedef struct DXGI_MAPPED_RECT { + INT Pitch; + BYTE *pBits; +} DXGI_MAPPED_RECT; + +typedef struct DXGI_OUTPUT_DESC { + WCHAR DeviceName[32]; + RECT DesktopCoordinates; + BOOL AttachedToDesktop; + DXGI_MODE_ROTATION Rotation; + HMONITOR Monitor; +} DXGI_OUTPUT_DESC; + +typedef struct DXGI_FRAME_STATISTICS { + UINT PresentCount; + UINT PresentRefreshCount; + UINT SyncRefreshCount; + LARGE_INTEGER SyncQPCTime; + LARGE_INTEGER SyncGPUTime; +} DXGI_FRAME_STATISTICS; + +typedef struct DXGI_ADAPTER_DESC { + WCHAR Description[128]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; +} DXGI_ADAPTER_DESC; + +typedef struct DXGI_SWAP_CHAIN_DESC { + DXGI_MODE_DESC BufferDesc; + DXGI_SAMPLE_DESC SampleDesc; + DXGI_USAGE BufferUsage; + UINT BufferCount; + HWND OutputWindow; + BOOL Windowed; + DXGI_SWAP_EFFECT SwapEffect; + UINT Flags; +} DXGI_SWAP_CHAIN_DESC; + +typedef struct DXGI_SHARED_RESOURCE { + HANDLE Handle; +} DXGI_SHARED_RESOURCE; + +[ + object, + local, + uuid(aec22fb8-76f3-4639-9be0-28eb43a67a2e) +] +interface IDXGIObject : IUnknown +{ + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT data_size, + [in] const void *data + ); + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *object + ); + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *data_size, + [out] void *data + ); + HRESULT GetParent( + [in] REFIID riid, + [out] void **parent + ); +} + +[ + object, + local, + uuid(3d3e0379-f9de-4d58-bb6c-18d62992f1a6) +] +interface IDXGIDeviceSubObject : IDXGIObject +{ + HRESULT GetDevice( + [in] REFIID riid, + [out] void **device + ); +} + +[ + object, + local, + uuid(cafcb56c-6ac3-4889-bf47-9e23bbd260ec) +] +interface IDXGISurface : IDXGIDeviceSubObject +{ + HRESULT GetDesc( + [out] DXGI_SURFACE_DESC *desc + ); + HRESULT Map( + [out] DXGI_MAPPED_RECT *mapped_rect, + [in] UINT flags + ); + HRESULT Unmap( + ); +} + +[ + object, + local, + uuid(ae02eedb-c735-4690-8d52-5a8dc20213aa) +] +interface IDXGIOutput : IDXGIObject +{ + HRESULT GetDesc( + [out] DXGI_OUTPUT_DESC *desc + ); + HRESULT GetDisplayModeList( + [in] DXGI_FORMAT format, + [in] UINT flags, + [in, out] UINT *mode_count, + [out] DXGI_MODE_DESC *desc + ); + HRESULT FindClosestMatchingMode( + [in] const DXGI_MODE_DESC *mode, + [out] DXGI_MODE_DESC *closest_match, + [in] IUnknown *device + ); + HRESULT WaitForVBlank( + ); + HRESULT TakeOwnership( + [in] IUnknown *device, + [in] BOOL exclusive + ); + void ReleaseOwnership( + ); + HRESULT GetGammaControlCapabilities( + [out] DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps + ); + HRESULT SetGammaControl( + [in] const DXGI_GAMMA_CONTROL *gamma_control + ); + HRESULT GetGammaControl( + [out] DXGI_GAMMA_CONTROL *gamma_control + ); + HRESULT SetDisplaySurface( + [in] IDXGISurface *surface + ); + HRESULT GetDisplaySurfaceData( + [in] IDXGISurface *surface + ); + HRESULT GetFrameStatistics( + [out] DXGI_FRAME_STATISTICS *stats + ); +} + +[ + object, + local, + uuid(2411e7e1-12ac-4ccf-bd14-9798e8534dc0) +] +interface IDXGIAdapter : IDXGIObject +{ + HRESULT EnumOutputs( + [in] UINT output_idx, + [in, out] IDXGIOutput **output + ); + HRESULT GetDesc( + [out] DXGI_ADAPTER_DESC *desc + ); + HRESULT CheckInterfaceSupport( + [in] REFGUID guid, + [out] LARGE_INTEGER *umd_version + ); +} + +[ + object, + local, + uuid(310d36a0-d2e7-4c0a-aa04-6a9d23b8886a) +] +interface IDXGISwapChain : IDXGIDeviceSubObject +{ + HRESULT Present( + [in] UINT sync_interval, + [in] UINT flags + ); + HRESULT GetBuffer( + [in] UINT buffer_idx, + [in] REFIID riid, + [in, out] void **surface + ); + HRESULT SetFullscreenState( + [in] BOOL fullscreen, + [in] IDXGIOutput *target + ); + HRESULT GetFullscreenState( + [out] BOOL *fullscreen, + [out] IDXGIOutput **target + ); + HRESULT GetDesc( + [out] DXGI_SWAP_CHAIN_DESC *desc + ); + HRESULT ResizeBuffers( + [in] UINT buffer_count, + [in] UINT width, + [in] UINT height, + [in] DXGI_FORMAT format, + [in] UINT flags + ); + HRESULT ResizeTarget( + [in] const DXGI_MODE_DESC *target_mode_desc + ); + HRESULT GetContainingOutput( + [out] IDXGIOutput **output + ); + HRESULT GetFrameStatistics( + [out] DXGI_FRAME_STATISTICS *stats + ); + HRESULT GetLastPresentCount( + [out] UINT *last_present_count + ); +} + +[ + object, + local, + uuid(7b7166ec-21c7-44ae-b21a-c9ae321ae369) +] +interface IDXGIFactory : IDXGIObject +{ + HRESULT EnumAdapters( + [in] UINT adapter_idx, + [out] IDXGIAdapter **adapter + ); + HRESULT MakeWindowAssociation( + [in] HWND window, + [in] UINT flags + ); + HRESULT GetWindowAssociation( + [in] HWND *window + ); + HRESULT CreateSwapChain( + [in] IUnknown *device, + [in] DXGI_SWAP_CHAIN_DESC *desc, + [out] IDXGISwapChain **swapchain + ); + HRESULT CreateSoftwareAdapter( + [in] HMODULE swrast, + [out] IDXGIAdapter **adapter + ); +} + +[local] HRESULT CreateDXGIFactory(REFIID riid, void **factory); + +[ + object, + local, + uuid(54ec77fa-1377-44e6-8c32-88fd5f44c84c) +] +interface IDXGIDevice : IDXGIObject +{ + HRESULT GetAdapter( + [out] IDXGIAdapter **adapter + ); + HRESULT CreateSurface( + [in] const DXGI_SURFACE_DESC *desc, + [in] UINT surface_count, + [in] DXGI_USAGE usage, + [in] const DXGI_SHARED_RESOURCE *shared_resource, + [out] IDXGISurface **surface + ); + HRESULT QueryResourceResidency( + [in] IUnknown *const *resources, + [out] DXGI_RESIDENCY *residency, + [in] UINT resource_count + ); + HRESULT SetGPUThreadPriority( + [in] INT priority + ); + HRESULT GetGPUThreadPriority( + [out] INT *priority + ); +} + + +// BEGIN parts added for Gallium + +const unsigned int DXGI_MAP_READ = 1; +const unsigned int DXGI_MAP_WRITE = 2; +const unsigned int DXGI_MAP_DISCARD = 4; + +const unsigned int DXGI_CPU_ACCESS_NONE = 0; +const unsigned int DXGI_CPU_ACCESS_DYNAMIC = 1; +const unsigned int DXGI_CPU_ACCESS_READ_WRITE = 2; +const unsigned int DXGI_CPU_ACCESS_SCRATCH = 3; +const unsigned int DXGI_CPU_ACCESS_FIELD = 15; +const unsigned int DXGI_USAGE_DISCARD_ON_PRESENT = 0x200; +const unsigned int DXGI_USAGE_UNORDERED_ACCESS = 0x400; + +const unsigned int DXGI_PRESENT_TEST = 1; +const unsigned int DXGI_PRESENT_DO_NOT_SEQUENCE = 2; +const unsigned int DXGI_PRESENT_RESTART = 4; + +typedef enum DXGI_SWAP_CHAIN_FLAG +{ + DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, + DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, + DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4 +} DXGI_SWAP_CHAIN_FLAG; + +typedef struct DXGI_ADAPTER_DESC1 +{ + WCHAR Description[128]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; + UINT Flags; +} DXGI_ADAPTER_DESC1; + +[object, local, uuid("035f3ab4-482e-4e50-b41f-8a7f8bd8960b")] +interface IDXGIResource : IDXGIDeviceSubObject +{ + HRESULT GetSharedHandle( + [out] HANDLE *pSharedHandle + ); + + HRESULT GetUsage( + [out] DXGI_USAGE *pUsage + ); + + HRESULT SetEvictionPriority( + [in] UINT EvictionPriority + ); + + HRESULT GetEvictionPriority( + [out] UINT *pEvictionPriority + ); +}; + +[object, local, uuid("4AE63092-6327-4c1b-80AE-BFE12EA32B86")] +interface IDXGISurface1 : IDXGISurface +{ + HRESULT GetDC( + [in] BOOL Discard, + [out] HDC *phdc + ); + + HRESULT ReleaseDC( + [in, optional] RECT *pDirtyRect + ); + }; + +[object, local, uuid("77db970f-6276-48ba-ba28-070143b4392c")] +interface IDXGIDevice1 : IDXGIDevice +{ + HRESULT SetMaximumFrameLatency( + [in] UINT MaxLatency + ); + + HRESULT GetMaximumFrameLatency( + [out] UINT *pMaxLatency + ); +}; + +[object, local, uuid("29038f61-3839-4626-91fd-086879011a05")] +interface IDXGIAdapter1 : IDXGIAdapter +{ + HRESULT GetDesc1( + [out] DXGI_ADAPTER_DESC1 *pDesc + ); +}; + +[object, local, uuid("770aae78-f26f-4dba-a829-253c83d1b387")] +interface IDXGIFactory1 : IDXGIFactory +{ + HRESULT EnumAdapters1( + [in] UINT Adapter, + [out] IDXGIAdapter1 **ppAdapter + ); + + BOOL IsCurrent(); +}; + +[local] HRESULT CreateDXGIFactory1(REFIID riid, void **factory); diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/dxgiformat.idl b/src/gallium/state_trackers/d3d1x/d3dapi/dxgiformat.idl new file mode 100644 index 00000000000..28846e96014 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/dxgiformat.idl @@ -0,0 +1,129 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +typedef enum DXGI_FORMAT { + DXGI_FORMAT_UNKNOWN, + DXGI_FORMAT_R32G32B32A32_TYPELESS, + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_R32G32B32_TYPELESS, + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT, + DXGI_FORMAT_R16G16B16A16_TYPELESS, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R16G16B16A16_SNORM, + DXGI_FORMAT_R16G16B16A16_SINT, + DXGI_FORMAT_R32G32_TYPELESS, + DXGI_FORMAT_R32G32_FLOAT, + DXGI_FORMAT_R32G32_UINT, + DXGI_FORMAT_R32G32_SINT, + DXGI_FORMAT_R32G8X24_TYPELESS, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, + DXGI_FORMAT_R10G10B10A2_TYPELESS, + DXGI_FORMAT_R10G10B10A2_UNORM, + DXGI_FORMAT_R10G10B10A2_UINT, + DXGI_FORMAT_R11G11B10_FLOAT, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UINT, + DXGI_FORMAT_R8G8B8A8_SNORM, + DXGI_FORMAT_R8G8B8A8_SINT, + DXGI_FORMAT_R16G16_TYPELESS, + DXGI_FORMAT_R16G16_FLOAT, + DXGI_FORMAT_R16G16_UNORM, + DXGI_FORMAT_R16G16_UINT, + DXGI_FORMAT_R16G16_SNORM, + DXGI_FORMAT_R16G16_SINT, + DXGI_FORMAT_R32_TYPELESS, + DXGI_FORMAT_D32_FLOAT, + DXGI_FORMAT_R32_FLOAT, + DXGI_FORMAT_R32_UINT, + DXGI_FORMAT_R32_SINT, + DXGI_FORMAT_R24G8_TYPELESS, + DXGI_FORMAT_D24_UNORM_S8_UINT, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS, + DXGI_FORMAT_X24_TYPELESS_G8_UINT, + DXGI_FORMAT_R8G8_TYPELESS, + DXGI_FORMAT_R8G8_UNORM, + DXGI_FORMAT_R8G8_UINT, + DXGI_FORMAT_R8G8_SNORM, + DXGI_FORMAT_R8G8_SINT, + DXGI_FORMAT_R16_TYPELESS, + DXGI_FORMAT_R16_FLOAT, + DXGI_FORMAT_D16_UNORM, + DXGI_FORMAT_R16_UNORM, + DXGI_FORMAT_R16_UINT, + DXGI_FORMAT_R16_SNORM, + DXGI_FORMAT_R16_SINT, + DXGI_FORMAT_R8_TYPELESS, + DXGI_FORMAT_R8_UNORM, + DXGI_FORMAT_R8_UINT, + DXGI_FORMAT_R8_SNORM, + DXGI_FORMAT_R8_SINT, + DXGI_FORMAT_A8_UNORM, + DXGI_FORMAT_R1_UNORM, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP, + DXGI_FORMAT_R8G8_B8G8_UNORM, + DXGI_FORMAT_G8R8_G8B8_UNORM, + DXGI_FORMAT_BC1_TYPELESS, + DXGI_FORMAT_BC1_UNORM, + DXGI_FORMAT_BC1_UNORM_SRGB, + DXGI_FORMAT_BC2_TYPELESS, + DXGI_FORMAT_BC2_UNORM, + DXGI_FORMAT_BC2_UNORM_SRGB, + DXGI_FORMAT_BC3_TYPELESS, + DXGI_FORMAT_BC3_UNORM, + DXGI_FORMAT_BC3_UNORM_SRGB, + DXGI_FORMAT_BC4_TYPELESS, + DXGI_FORMAT_BC4_UNORM, + DXGI_FORMAT_BC4_SNORM, + DXGI_FORMAT_BC5_TYPELESS, + DXGI_FORMAT_BC5_UNORM, + DXGI_FORMAT_BC5_SNORM, + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT_B8G8R8X8_UNORM, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, + DXGI_FORMAT_B8G8R8A8_TYPELESS, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, + DXGI_FORMAT_B8G8R8X8_TYPELESS, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, + DXGI_FORMAT_BC6H_TYPELESS, + DXGI_FORMAT_BC6H_UF16, + DXGI_FORMAT_BC6H_SF16, + DXGI_FORMAT_BC7_TYPELESS, + DXGI_FORMAT_BC7_UNORM, + DXGI_FORMAT_BC7_UNORM_SRGB, + DXGI_FORMAT_FORCE_UINT = 0xffffffff +} DXGI_FORMAT; diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/dxgitype.idl b/src/gallium/state_trackers/d3d1x/d3dapi/dxgitype.idl new file mode 100644 index 00000000000..95844076936 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/dxgitype.idl @@ -0,0 +1,84 @@ +/* + * Copyright 2007 Andras Kovacs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* DXGI 1.1 IDL, and missing DXGI 1.0 parts added by Luca Barbieri on Sep 2010 */ + +import "oaidl.idl"; +import "ocidl.idl"; + +import "dxgiformat.idl"; + +typedef struct DXGI_SAMPLE_DESC { + UINT Count; + UINT Quality; +} DXGI_SAMPLE_DESC; + +typedef enum DXGI_MODE_ROTATION { + DXGI_MODE_ROTATION_UNSPECIFIED = 0, + DXGI_MODE_ROTATION_IDENTITY = 1, + DXGI_MODE_ROTATION_ROTATE90 = 2, + DXGI_MODE_ROTATION_ROTATE180 = 3, + DXGI_MODE_ROTATION_ROTATE270 = 4, +} DXGI_MODE_ROTATION; + +typedef enum DXGI_MODE_SCANLINE_ORDER { + DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3, +} DXGI_MODE_SCANLINE_ORDER; + +typedef enum DXGI_MODE_SCALING { + DXGI_MODE_SCALING_UNSPECIFIED = 0, + DXGI_MODE_SCALING_CENTERED = 1, + DXGI_MODE_SCALING_STRETCHED = 2, +} DXGI_MODE_SCALING; + +typedef struct DXGI_RATIONAL { + UINT Numerator; + UINT Denominator; +} DXGI_RATIONAL; + +typedef struct DXGI_MODE_DESC { + UINT Width; + UINT Height; + DXGI_RATIONAL RefreshRate; + DXGI_FORMAT Format; + DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; + DXGI_MODE_SCALING Scaling; +} DXGI_MODE_DESC; + +typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES { + BOOL ScaleAndOffsetSupported; + float MaxConvertedValue; + float MinConvertedValue; + UINT NumGammaControlPoints; + float ControlPointPositions[1025]; +} DXGI_GAMMA_CONTROL_CAPABILITIES; + +typedef struct DXGI_RGB { + float Red; + float Green; + float Blue; +} DXGI_RGB; + +typedef struct DXGI_GAMMA_CONTROL { + DXGI_RGB Scale; + DXGI_RGB Offset; + DXGI_RGB GammaCurve[1025]; +} DXGI_GAMMA_CONTROL; diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/specstrings.h b/src/gallium/state_trackers/d3d1x/d3dapi/specstrings.h new file mode 100644 index 00000000000..fbd390fbd39 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3dapi/specstrings.h @@ -0,0 +1,25 @@ +#ifndef SPECSTRINGS_H +#define SPECSTRINGS_H + +#define __in +#define __in_opt +#define __out +#define __out_opt +#define __inout +#define __inout_opt +#define __in_bcount(...) +#define __in_bcount_opt(...) +#define __in_ecount(...) +#define __in_ecount_opt(...) +#define __in_xcount(...) +#define __in_xcount_opt(...) +#define __out_bcount(...) +#define __out_bcount_opt(...) +#define __out_ecount(...) +#define __out_ecount_opt(...) +#define __out_ecount_part_opt(...) +#define __in_range(...) +#define __inout_range(...) +#define __out_range(...) + +#endif diff --git a/src/gallium/state_trackers/d3d1x/docs/Makefile b/src/gallium/state_trackers/d3d1x/docs/Makefile new file mode 100644 index 00000000000..ca1e3ce05dd --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/docs/Makefile @@ -0,0 +1,4 @@ +all: module_dependencies.svg module_dependencies.pdf + +include ../Makefile.inc + diff --git a/src/gallium/state_trackers/d3d1x/docs/coding_style.txt b/src/gallium/state_trackers/d3d1x/docs/coding_style.txt new file mode 100644 index 00000000000..a644a1323f3 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/docs/coding_style.txt @@ -0,0 +1,85 @@ +The goal of these guidelines is to allow as much freedom as possible, while keeping the code buildable and pleasant to read. + +* Formatting + +- Indent with a single tab character. This is the best choice, since anyone can use the visual indentation he prefers by adjust the tab width setting in his editor. +- Align multiline statements with an additional extra tab before each continuation line +- Keep in mind that people can program with proportional fonts: hence, don't attempt to align anything not at the start of the line, since it's impossible +- In general, there should never be two consecutive spaces in the source code +- As a special exception, [in] and __in annotations are followed by two spaces to align them with [out] and __out if displayed with a fixed size font. This may be revisited. +- There is no strict limit on line length, but try to not make lines too long, and insert a line break where it looks good + +* Language/platform features + +All language features of C++03 with TR1 and all the STL library may be used. +Obviously, try to keep the code simple, readable and intuitive, code size small, and compilation time short where possible. +Platform/compiler-specific extensions can be used if beneficial, protected by #ifs. + +C++0x is currently not used since it's unreleased and currently not well supported by clang. +Once GCC, clang and Visual C++ all have very good or complete support, and ideally the standard is finalized, we can start taking advantage of it. +Change this document once that happens. + +Boost is currently not used because it hasn't been necessary and it's best to keep things simple. +If really necessary, add a dependency on it, but use it judiciously. + +C should be used only for old code, and preferably completely avoided. + +You can freely assume that char is 8-bit, short 16-bit and int 32-bit, that long and pointers are 32-bit or 64-bit, that long long is at least 64-bit, that float is 32-bit and that double is 64-bit. +However, when you intend a specific size, int8_t, etc. are preferred. + +* Naming style + + Code implementing public parts of Windows interfaces (and derived ones) should follow Windows naming conventions: + - Classes are like GalliumD3D11VertexShader + - Functions are like CreateVertexShader + - Variables are like ppVertexShader + + Other code should follow Gallium/Linux/POSIX/STL/Boost naming conventions: + - Classes are like maybe_mutex_t + - Functions are like xs_create_shader + - Variables are like sampler_view + + Template parameters are named accordingly to what looks best for the specific case. + Typically it will be FooBar for typename parameters and foo_bar for non-typename ones. + + * Implementation style + +See the comments in d3d1xstutil.h for the COM implementation method. +In particular, avoid multiple/virtual inheritance in favor of mixins where possible. + +Try to limit or avoid preprocessor magic and multiline macros and use templates instead where possible. +Often, you can lessen the preprocessor magic by putting some of it in a template instantiated by the remaining magic. + +Forward declarations should not be used unless necessary. +In particular C++ classes should be implemented "inline" and should you should almost never have a forward declaration of a class. +To achieve this, you can opt to create an "interface class", which goes into an header or earlier in the C++ file, and an "implementation class" with goes in the C++ file. +Alternatively, use global helpers with forward declaration. + +Order definitions so that forward declarations are not necessary (e.g. put main at the end of the file). + +Choose between "struct" or "class" depending on whether the first declared member is public or private, to save the explicit specifier. + +Try to use const appropriately, esp. as a qualifier for member functions. + +Try to avoid Microsoft-style TYPES like FLOAT, UINT, etc. in favor of the usual C types like float, unsigned. + +Where feasible, if a platform is missing a function/keyword, add a definition of it with the standard name, rather than inventing an "abstraction layer". + +Try to use typedefs for STL maps on which you need to declare iterations, as well as function pointers or other "weird" C types. + + To iterate, use the following idiom from LLVM, which is optimal, unless end() is trivial: + for(iterator_type i = begin(), e = end(); i != e; ++i) + {} + + Otherwise, you risk the compiler evaluating end() for each loop iteration. + If end() is trivial, use this: + for(iterator_type i = begin(); i != end(); ++i) + {} + + Note the "++i" instead of the "i++" to avoid creating an unnecessary copy (esp. with overloaded operators). + + Declare variables just before they are needed, and inside the for() header. + Usually, you should initialize variable in the declaration if that's the only assignment or if it is a default value, and as a separate assignment if not. + +Try to use C++ references (with const if appropriate) when the pointer must be non-null, and that type is not already customarily passed with a pointer. + diff --git a/src/gallium/state_trackers/d3d1x/docs/module_dependencies.dot b/src/gallium/state_trackers/d3d1x/docs/module_dependencies.dot new file mode 100644 index 00000000000..3db6fb2167a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/docs/module_dependencies.dot @@ -0,0 +1,25 @@ +digraph module_dependencies +{ + d3dapi -> w32api; + gd3dapi -> d3dapi; + progs -> d3dapi [style="dotted"]; + progs -> gd3dapi [style="dotted"]; + progs -> microsoft_directx_sdk [style="dotted"]; + d3d1xstutil -> gd3dapi + d3d1xshader -> d3dapi + gd3d1x -> d3d1xshader; + gd3d1x -> d3d1xstutil; + gd3d10 -> gd3d1x; + gd3d11 -> gd3d1x; + dxgi -> d3d1xstutil; + dxgi -> gd3dapi; + dxgid3d10 -> gd3dapi; + dxgid3d11 -> gd3dapi; + "d3d11.dll" -> gd3d11; + "d3d11.dll" -> dxgid3d11; + "d3d10.dll" -> gd3d10; + "d3d10.dll" -> dxgid3d10; + "dxgi.dll" -> dxgi; + tools -> mstools + mstools -> microsoft_directx_sdk +}; diff --git a/src/gallium/state_trackers/d3d1x/docs/source_layout.txt b/src/gallium/state_trackers/d3d1x/docs/source_layout.txt new file mode 100644 index 00000000000..46e9f2d9832 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/docs/source_layout.txt @@ -0,0 +1,17 @@ +Source layout and architecture of the Gallium D3D state tracker + +w32api is a link to Wine's include files for the Windows API +d3dapi contains the headers for Direct3D 10.0, 10.1 and 11.0 (independently created, except d3d10 which is based on Wine) +gd3dapi contains the Gallium COM state tracker API and extensions to the DXGI and Direct3D APIs, both for internal and external usage +d3d1xshader is a standalone module with a parser, disassembler and utility routines for Direct3D 10/11 shaders using Shader Model 4/5 instructions encoded using Tokenized Program Format embedded in a DXBC chunked container (the data format produced by the HLSL compiler). +mstools contains a downloader for the Microsoft HLSL compiler +tools contains the shader compiler, currently wrapping the Microsoft HLSL compiler +gd3d10 contains the implementation of Direct3D 10 and 10.1 with Gallium-specific entry points +gd3d11 contains the implementation of Direct3D 11 with Gallium-specific entry points +gd3d1x contains the shader translator and code not directly implementing Direct3D interfaces, but needed by those implementations +dxgid3d10 contains the DXGI-based "official" entry points to Direct3D 10.0 and 10.1 +dxgid3d11 contains the DXGI-based "official" entry points to Direct3D 11 +dxgi contains the implementation of DXGI (currently over the EGL native interface) +d3d1xstutil contains helper code shared among all the modules in the state tracker +programs contains the Gallium Direct3D 11 demos, runnable either on the Microsoft or Gallium implementations +docs contains documentation diff --git a/src/gallium/state_trackers/d3d1x/dxgi/Makefile b/src/gallium/state_trackers/d3d1x/dxgi/Makefile new file mode 100644 index 00000000000..323f6f7bbe7 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgi/Makefile @@ -0,0 +1,17 @@ +LIBNAME=dxgi +LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common +LIBRARY_DEFINES=-DDXGI_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" +CPP_SOURCES=$(wildcard src/*.cpp) + +include ../Makefile.inc + +ifneq ($(findstring x11, $(EGL_PLATFORMS)),) +LIBRARY_DEFINES += -DGALLIUM_DXGI_USE_X11 +endif +ifneq ($(findstring drm, $(EGL_PLATFORMS)),) +LIBRARY_DEFINES += -DGALLIUM_DXGI_USE_DRM +endif +ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) +LIBRARY_DEFINES += -DGALLIUM_DXGI_USE_FBDEV +endif + diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp new file mode 100644 index 00000000000..e5ba309fe41 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp @@ -0,0 +1,206 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + * Chia-I Wu + */ + +#include "dxgi_private.h" +#include +extern "C" +{ +#include "state_tracker/drm_driver.h" +#include "util/u_dl.h" +} +#define PIPE_PREFIX "pipe_" + +static const char * +get_search_path(void) +{ + static const char *search_path; + + if (!search_path) { + static char buffer[1024]; + const char *p; + int ret; + + p = getenv("DXGI_DRIVERS_PATH"); + if(!p) + p = getenv("EGL_DRIVERS_PATH"); +#ifdef __unix__ + if (p && (geteuid() != getuid() || getegid() != getgid())) { + p = NULL; + } +#endif + + if (p) { + ret = snprintf(buffer, sizeof(buffer), + "%s:%s", p, DXGI_DRIVER_SEARCH_DIR); + if (ret > 0 && ret < (int)sizeof(buffer)) + search_path = buffer; + } + } + if (!search_path) + search_path = DXGI_DRIVER_SEARCH_DIR; + + return search_path; +} + +static void +for_each_colon_separated(const char *search_path, + bool (*loader)(const char *, size_t, void *), + void *loader_data) +{ + const char *cur, *next; + size_t len; + + cur = search_path; + while (cur) { + next = strchr(cur, ':'); + len = (next) ? next - cur : strlen(cur); + + if (!loader(cur, len, loader_data)) + break; + + cur = (next) ? next + 1 : NULL; + } +} + +void +for_each_in_search_path(bool (*callback)(const char *, size_t, void *), + void *callback_data) +{ + const char *search_path = get_search_path(); + for_each_colon_separated(search_path, callback, callback_data); +} + +static struct pipe_module { + boolean initialized; + char *name; + struct util_dl_library *lib; + const struct drm_driver_descriptor *drmdd; + struct pipe_screen *(*swrast_create_screen)(struct sw_winsys *); +} pipe_modules[16]; + +static bool +dlopen_pipe_module_cb(const char *dir, size_t len, void *callback_data) +{ + struct pipe_module *pmod = (struct pipe_module *) callback_data; + char path[1024]; + int ret; + + if (len) { + ret = snprintf(path, sizeof(path), + "%.*s/" PIPE_PREFIX "%s" UTIL_DL_EXT, len, dir, pmod->name); + } + else { + ret = snprintf(path, sizeof(path), + PIPE_PREFIX "%s" UTIL_DL_EXT, pmod->name); + } + if (ret > 0 && ret < (int)sizeof(path)) { + pmod->lib = util_dl_open(path); + } + + return !(pmod->lib); +} + +static bool +load_pipe_module(struct pipe_module *pmod, const char *name) +{ + pmod->name = strdup(name); + if (!pmod->name) + return FALSE; + + for_each_in_search_path(dlopen_pipe_module_cb, (void *) pmod); + if (pmod->lib) { + pmod->drmdd = (const struct drm_driver_descriptor *) + util_dl_get_proc_address(pmod->lib, "driver_descriptor"); + + /* sanity check on the name */ + if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) + pmod->drmdd = NULL; + + /* swrast */ + if (pmod->drmdd && !pmod->drmdd->driver_name) { + pmod->swrast_create_screen = + (struct pipe_screen *(*)(struct sw_winsys *)) + util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); + if (!pmod->swrast_create_screen) + pmod->drmdd = NULL; + } + + if (!pmod->drmdd) { + util_dl_close(pmod->lib); + pmod->lib = NULL; + } + } + + return (pmod->drmdd != NULL); +} + + +static struct pipe_module * +get_pipe_module(const char *name) +{ + struct pipe_module *pmod = NULL; + unsigned i; + + if (!name) + return NULL; + + for (i = 0; i < sizeof(pipe_modules) / sizeof(pipe_modules[0]); i++) { + if (!pipe_modules[i].initialized || + strcmp(pipe_modules[i].name, name) == 0) { + pmod = &pipe_modules[i]; + break; + } + } + if (!pmod) + return NULL; + + if (!pmod->initialized) { + load_pipe_module(pmod, name); + pmod->initialized = TRUE; + } + + return pmod; +} + +struct native_display; + +struct pipe_screen * +dxgi_loader_create_drm_screen(struct native_display* dpy, const char *name, int fd) +{ + struct pipe_module *pmod = get_pipe_module(name); + return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ? + pmod->drmdd->create_screen(fd) : NULL; +} + +struct pipe_screen * +dxgi_loader_create_sw_screen(struct native_display* dpy, struct sw_winsys *ws) +{ + struct pipe_module *pmod = get_pipe_module("swrast"); + return (pmod && pmod->swrast_create_screen) ? + pmod->swrast_create_screen(ws) : NULL; +} diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp new file mode 100644 index 00000000000..69ddbc5a0c0 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -0,0 +1,1314 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "dxgi_private.h" +extern "C" { +#include "native.h" +#include +#include +#include +#include +} +#include +#include + +struct GalliumDXGIOutput; +struct GalliumDXGIAdapter; +struct GalliumDXGISwapChain; +struct GalliumDXGIFactory; + +static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, IUnknown* device, const DXGI_SWAP_CHAIN_DESC& desc, IDXGISwapChain** ppSwapChain); +static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* adapter, const struct native_platform* platform, void* dpy, IDXGIAdapter1** ppAdapter); +static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::string& name, const struct native_connector* connector, IDXGIOutput** ppOutput); +static void GalliumDXGISwapChainRevalidate(IDXGISwapChain* swap_chain); + +template +struct GalliumDXGIObject : public GalliumPrivateDataComObject +{ + ComPtr parent; + + GalliumDXGIObject(Parent* p_parent = 0) + { + this->parent = p_parent; + } + + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + return parent->QueryInterface(riid, ppParent); + } +}; + +static void* STDMETHODCALLTYPE identity_resolver(void* cookie, HWND hwnd) +{ + return (void*)hwnd; +} + +struct GalliumDXGIFactory : public GalliumDXGIObject +{ + HWND associated_window; + const struct native_platform* platform; + void* display; + PFNHWNDRESOLVER resolver; + void* resolver_cookie; + + GalliumDXGIFactory(const struct native_platform* platform, void* display, PFNHWNDRESOLVER resolver, void* resolver_cookie) + : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display), resolver(resolver ? resolver : identity_resolver), resolver_cookie(resolver_cookie) + {} + + virtual HRESULT STDMETHODCALLTYPE EnumAdapters( + UINT Adapter, + __out IDXGIAdapter **ppAdapter) + { + return EnumAdapters1(Adapter, (IDXGIAdapter1**)ppAdapter); + } + + virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( + UINT Adapter, + __out IDXGIAdapter1 **ppAdapter) + { + *ppAdapter = 0; + if(Adapter == 0) + { + return GalliumDXGIAdapterCreate(this, platform, display, ppAdapter); + } +#if 0 + // TODO: enable this + if(platform == native_get_x11_platform()) + { + unsigned nscreens = ScreenCount((Display*)display); + if(Adapter < nscreens) + { + unsigned def_screen = DefaultScreen(display); + if(Adapter <= def_screen) + --Adapter; + *ppAdapter = GalliumDXGIAdapterCreate(this, platform, display, Adapter); + return S_OK; + } + } +#endif + return DXGI_ERROR_NOT_FOUND; + } + + /* TODO: this is a mysterious underdocumented magic API + * Can we have multiple windows associated? + * Can we have multiple windows associated if we use multiple factories? + * If so, what should GetWindowAssociation return? + * If not, does a new swapchain steal the association? + * Does this act for existing swapchains? For new swapchains? + */ + virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( + HWND WindowHandle, + UINT Flags) + { + /* TODO: actually implement, for Wine, X11 and KMS*/ + associated_window = WindowHandle; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( + __out HWND *pWindowHandle) + { + *pWindowHandle = associated_window; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( + __in IUnknown *pDevice, + __in DXGI_SWAP_CHAIN_DESC *pDesc, + __out IDXGISwapChain **ppSwapChain) + { + return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); + } + + virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( + HMODULE Module, + __out IDXGIAdapter **ppAdapter) + { + /* TODO: ignore the module, and just create a Gallium software screen */ + *ppAdapter = 0; + return E_NOTIMPL; + } + + /* TODO: support hotplug */ + virtual BOOL STDMETHODCALLTYPE IsCurrent( void) + { + return TRUE; + } +}; + +struct GalliumDXGIAdapter + : public GalliumMultiComObject< + GalliumDXGIObject, + IGalliumAdapter> +{ + struct native_display* display; + const struct native_config** configs; + std::unordered_multimap configs_by_pipe_format; + std::unordered_map configs_by_native_visual_id; + const struct native_connector** connectors; + unsigned num_configs; + DXGI_ADAPTER_DESC1 desc; + std::vector > outputs; + int num_outputs; + struct native_event_handler handler; + + GalliumDXGIAdapter(GalliumDXGIFactory* factory, const struct native_platform* platform, void* dpy) + { + this->parent = factory; + + handler.invalid_surface = handle_invalid_surface; + handler.new_drm_screen = dxgi_loader_create_drm_screen; + handler.new_sw_screen = dxgi_loader_create_sw_screen; + display = platform->create_display(dpy, &handler, this); + if(!display) + throw E_FAIL; + memset(&desc, 0, sizeof(desc)); + std::string s = std::string("GalliumD3D on ") + display->screen->get_name(display->screen) + " by " + display->screen->get_vendor(display->screen); + + /* hopefully no one will decide to use UTF-8 in Gallium name/vendor strings */ + for(int i = 0; i < std::min((int)s.size(), 127); ++i) + desc.Description[i] = (WCHAR)s[i]; + + // TODO: add an interface to get these; for now, return mid/low values + desc.DedicatedVideoMemory = 256 << 20; + desc.DedicatedSystemMemory = 256 << 20; + desc.SharedSystemMemory = 1024 << 20; + + // TODO: we should actually use an unique ID instead + *(void**)&desc.AdapterLuid = dpy; + + configs = display->get_configs(display, (int*)&num_configs); + for(unsigned i = 0; i < num_configs; ++i) + { + if(configs[i]->window_bit) + { + configs_by_pipe_format.insert(std::make_pair(configs[i]->color_format, i)); + configs_by_native_visual_id[configs[i]->native_visual_id] = i; + } + } + + connectors = 0; + num_outputs = 0; + + if(display->modeset) + { + int num_crtcs; + + connectors = display->modeset->get_connectors(display, &num_outputs, &num_crtcs); + if(!connectors) + num_outputs = 0; + else if(!num_outputs) + { + free(connectors); + connectors = 0; + } + } + if(!num_outputs) + num_outputs = 1; + } + + static void handle_invalid_surface(struct native_display *ndpy, struct native_surface *nsurf, unsigned int seq_num) + { + GalliumDXGISwapChainRevalidate((IDXGISwapChain*)nsurf->user_data); + } + + ~GalliumDXGIAdapter() + { + free(configs); + free(connectors); + } + + virtual HRESULT STDMETHODCALLTYPE EnumOutputs( + UINT Output, + __out IDXGIOutput **ppOutput) + { + if(Output >= (unsigned)num_outputs) + return DXGI_ERROR_NOT_FOUND; + + if(connectors) + { + std::ostringstream ss; + ss << "Output #" << Output; + return GalliumDXGIOutputCreate(this, ss.str(), connectors[Output], ppOutput); + } + else + return GalliumDXGIOutputCreate(this, "Unique output", NULL, ppOutput); + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + __out DXGI_ADAPTER_DESC *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc1( + __out DXGI_ADAPTER_DESC1 *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( + __in REFGUID InterfaceName, + __out LARGE_INTEGER *pUMDVersion) + { + // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear + if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) + { + pUMDVersion->QuadPart = 0x00080011000a0411ULL; + return S_OK; + } + return DXGI_ERROR_UNSUPPORTED; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumScreen() + { + return display->screen; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumReferenceSoftwareScreen() + { + // TODO: give a softpipe screen + return display->screen; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumFastSoftwareScreen() + { + // TODO: give an llvmpipe screen + return display->screen; + } +}; + + +struct GalliumDXGIOutput : public GalliumDXGIObject +{ + DXGI_OUTPUT_DESC desc; + const struct native_mode** modes; + DXGI_MODE_DESC* dxgi_modes; + unsigned num_modes; + const struct native_connector* connector; + DXGI_GAMMA_CONTROL* gamma; + + GalliumDXGIOutput(GalliumDXGIAdapter* adapter, std::string name, const struct native_connector* connector = 0) + : GalliumDXGIObject(adapter), connector(connector) + { + memset(&desc, 0, sizeof(desc)); + for(unsigned i = 0; i < std::min(name.size(), sizeof(desc.DeviceName) - 1); ++i) + desc.DeviceName[i] = name[i]; + desc.AttachedToDesktop = TRUE; + /* TODO: should put an HMONITOR in desc.Monitor */ + + gamma = 0; + num_modes = 0; + modes = 0; + if(connector) + { + modes = parent->display->modeset->get_modes(parent->display, connector, (int*)&num_modes); + if(modes && num_modes) + { + dxgi_modes = new DXGI_MODE_DESC[num_modes]; + for(unsigned i = 0; i < num_modes; ++i) + { + dxgi_modes[i].Width = modes[i]->width; + dxgi_modes[i].Height = modes[i]->height; + dxgi_modes[i].RefreshRate.Numerator = modes[i]->refresh_rate; + dxgi_modes[i].RefreshRate.Denominator = 1; + dxgi_modes[i].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; + dxgi_modes[i].ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; + } + } + else + { + if(modes) + { + free(modes); + modes = 0; + } + goto use_fake_mode; + } + } + else + { +use_fake_mode: + dxgi_modes = new DXGI_MODE_DESC[1]; + dxgi_modes[0].Width = 1920; + dxgi_modes[0].Height = 1200; + dxgi_modes[0].RefreshRate.Numerator = 60; + dxgi_modes[0].RefreshRate.Denominator = 1; + dxgi_modes[0].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; + dxgi_modes[0].ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; + } + } + + ~GalliumDXGIOutput() + { + delete [] dxgi_modes; + free(modes); + if(gamma) + delete gamma; + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + __out DXGI_OUTPUT_DESC *pDesc) + { + *pDesc = desc; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( + DXGI_FORMAT EnumFormat, + UINT Flags, + __inout UINT *pNumModes, + __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) + { + /* TODO: should we return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE when we don't + * support modesetting instead of fake modes? + */ + pipe_format format = dxgi_to_pipe_format[EnumFormat]; + if(parent->configs_by_pipe_format.count(format)) + { + if(!pDesc) + { + *pNumModes = num_modes; + return S_OK; + } + + unsigned copy_modes = std::min(num_modes, *pNumModes); + for(unsigned i = 0; i < copy_modes; ++i) + { + pDesc[i] = dxgi_modes[i]; + pDesc[i].Format = EnumFormat; + } + *pNumModes = num_modes; + + if(copy_modes < num_modes) + return DXGI_ERROR_MORE_DATA; + else + return S_OK; + } + else + { + *pNumModes = 0; + return S_OK; + } + } + + virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( + __in const DXGI_MODE_DESC *pModeToMatch, + __out DXGI_MODE_DESC *pClosestMatch, + __in_opt IUnknown *pConcernedDevice) + { + /* TODO: actually implement this */ + DXGI_FORMAT dxgi_format = pModeToMatch->Format; + enum pipe_format format = dxgi_to_pipe_format[dxgi_format]; + init_pipe_to_dxgi_format(); + if(!parent->configs_by_pipe_format.count(format)) + { + if(!pConcernedDevice) + return E_FAIL; + else + { + format = parent->configs[0]->color_format; + dxgi_format = pipe_to_dxgi_format[format]; + } + } + + *pClosestMatch = dxgi_modes[0]; + pClosestMatch->Format = dxgi_format; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE WaitForVBlank( void) + { + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE TakeOwnership( + __in IUnknown *pDevice, + BOOL Exclusive) + { + return S_OK; + } + + virtual void STDMETHODCALLTYPE ReleaseOwnership( void) + { + } + + virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( + __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) + { + memset(pGammaCaps, 0, sizeof(*pGammaCaps)); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE SetGammaControl( + __in const DXGI_GAMMA_CONTROL *pArray) + { + if(!gamma) + gamma = new DXGI_GAMMA_CONTROL; + *gamma = *pArray; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetGammaControl( + __out DXGI_GAMMA_CONTROL *pArray) + { + if(gamma) + *pArray = *gamma; + else + { + pArray->Scale.Red = 1; + pArray->Scale.Green = 1; + pArray->Scale.Blue = 1; + pArray->Offset.Red = 0; + pArray->Offset.Green = 0; + pArray->Offset.Blue = 0; + for(unsigned i = 0; i <= 1024; ++i) + pArray->GammaCurve[i].Red = pArray->GammaCurve[i].Green = pArray->GammaCurve[i].Blue = (float)i / 1024.0; + } + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( + __in IDXGISurface *pScanoutSurface) + { + return E_NOTIMPL; + } + + virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( + __in IDXGISurface *pDestination) + { + return E_NOTIMPL; + } + + virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( + __out DXGI_FRAME_STATISTICS *pStats) + { + memset(pStats, 0, sizeof(*pStats)); +#ifdef _WIN32 + QueryPerformanceCounter(&pStats->SyncQPCTime); +#endif + return E_NOTIMPL; + } +}; + +/* Swap chain are rather complex, and Microsoft's documentation is rather + * lacking. As far as I know, this is the most thorough publicly available + * description of how swap chains work, based on multiple sources and + * experimentation. + * + * There are two modes (called "swap effects") that a swap chain can operate in: + * discard and sequential. + * + * In discard mode, things always look as if there is a single buffer, which + * you can get with GetBuffers(0). + * The 2D texture returned by GetBuffers(0) and can only be + * used as a render target view and for resource copies, since no CPU access + * flags are set and only the D3D11_BIND_RENDER_TARGET bind flag is set. + * On Present, it is copied to the actual display + * surface and the contents become undefined. + * D3D may internally use multiple buffers, but you can't observe this, except + * by looking at the buffer contents after Present (but those are undefined). + * If it uses multiple buffers internally, then it will normally use BufferCount buffers + * (this has latency implications). + * Discard mode seems to internally use a single buffer in windowed mode, + * even if DWM is enabled, and BufferCount buffers in fullscreen mode. + * + * In sequential mode, the runtime alllocates BufferCount buffers. + * You can get each with GetBuffers(n). + * GetBuffers(0) ALWAYS points to the backbuffer to be presented and has the + * same usage constraints as the discard mode. + * GetBuffer(n) with n > 0 points to resources that are identical to buffer 0, but + * are classified as "read-only resources" (due to DXGI_USAGE_READ_ONLY), + * meaning that you can't create render target views on them, or use them as + * a CopyResource/CopySubresourceRegion destination. + * It appears the only valid operation is to use them as a source for CopyResource + * and CopySubresourceRegion as well as just waiting for them to become + * buffer 0 again. + * Buffer n - 1 is always displayed on screen. + * When you call Present(), the contents of the buffers are rotated, so that buffer 0 + * goes to buffer n - 1, and is thus displayed, and buffer 1 goes to buffer 0, becomes + * the accessible back buffer. + * The resources themselves are NOT rotated, so that you can still render on the + * same ID3D11Texture2D*, and views based on it, that you got before Present(). + * + * Present seems to happen by either copying the relevant buffer into the window, + * or alternatively making it the current one, either by programming the CRTC or + * by sending the resource name to the DWM compositor. + * + * Hence, you can call GetBuffer(0) once and keep using the same ID3D11Texture2D* + * and ID3D11RenderTargetView* (and other views if needed) you got from it. + * + * If the window gets resized, DXGI will then "emulate" all successive presentations, + * by using a stretched blit automatically. + * Thus, you should handle WM_SIZE and call ResizeBuffers to update the DXGI + * swapchain buffers size to the new window size. + * Doing so requires you to release all GetBuffers() results and anything referencing + * them, including views and Direct3D11 deferred context command lists (this is + * documented). + * + * How does Microsoft implement the rotation behavior? + * It turns out that it does it by calling RotateResourceIdentitiesDXGI in the user-mode + * DDI driver. + * This will rotate the kernel buffer handle, or possibly rotate the GPU virtual memory + * mappings. + * + * The reason this is done by driver instead of by the runtime appears to be that + * this is necessary to support driver-provided command list support, since otherwise + * the command list would not always target the current backbuffer, since it would + * be done at the driver level, while only the runtime knows about the rotation. + * + * OK, so how do we implement this in Gallium? + * + * There are three strategies: + * 1. Use a single buffer, and always copy it to a window system provided buffer, or + * just give the buffer to the window system if it supports that + * 2. Rotate the buffers in the D3D1x implementation, and recreate and rebind the views. + * Don't support driver-provided command lists + * 3. Add this rotation functionality to the Gallium driver, with the idea that it would rotate + * remap GPU virtual memory, so that virtual address are unchanged, but the physical + * ones are rotated (so that pushbuffers remain valid). + * If the driver does not support this, either fall back to (1), or have a layer doing this, + * putting a deferred context layer over this intermediate layer. + * + * (2) is not acceptable since it prevents an optimal implementation. + * (3) is the ideal solution, but it is complicated. + * + * Hence, we implement (1) for now, and will switch to (3) later. + * + * Note that (1) doesn't really work for DXGI_SWAP_EFFECT_SEQUENTIAL with more + * than one buffer, so we just pretend we got asked for a single buffer in that case + * Fortunately, no one seems to rely on that, so we'll just not implement it at first, and + * later perform the rotation with blits. + * Once we switch to (3), we'll just use real rotation to do it.. + * + * DXGI_SWAP_EFFECT_SEQUENTIAL with more than one buffer is of dubious use + * anyway, since you can only render or write to buffer 0, and other buffers can apparently + * be used only as sources for copies. + * I was unable to find any code using it either in DirectX SDK examples, or on the web. + * + * It seems the only reason you would use it is to not have to redraw from scratch, while + * also possibly avoid a copy compared to BufferCount == 1, assuming that your + * application is OK with having to redraw starting not from the last frame, but from + * one/two/more frames behind it. + * + * A better design would forbid the user specifying BufferCount explicitly, and + * would instead let the application give an upper bound on how old the buffer can + * become after presentation, with "infinite" being equivalent to discard. + * The runtime would then tell the application with frame number the buffer switched to + * after present. + * In addition, in a better design, the application would be allowed to specify the + * number of buffers available, having all them usable for rendering, so that things + * like video players could efficiently decode frames in parallel. + * Present would in such a better design gain a way to specify the number of buffers + * to present. + * + * Other miscellaneous info: + * DXGI_PRESENT_DO_NOT_SEQUENCE causes DXGI to hold the frame for another + * vblank interval without rotating the resource data. + * + * References: + * "DXGI Overview" in MSDN + * IDXGISwapChain documentation on MSDN + * "RotateResourceIdentitiesDXGI" on MSDN + * http://forums.xna.com/forums/p/42362/266016.aspx + */ + +static float quad_data[] = { + -1, -1, 0, 0, + -1, 1, 0, 1, + 1, 1, 1, 1, + 1, -1, 1, 0, +}; + +struct dxgi_blitter +{ + pipe_context* pipe; + bool normalized; + void* fs; + void* vs; + void* sampler[2]; + void* elements; + void* blend; + void* rasterizer; + void* zsa; + struct pipe_clip_state clip; + struct pipe_vertex_buffer vbuf; + struct pipe_draw_info draw; + + dxgi_blitter(pipe_context* pipe) + : pipe(pipe) + { + //normalized = !!pipe->screen->get_param(pipe, PIPE_CAP_NPOT_TEXTURES); + // TODO: need to update buffer in unnormalized case + normalized = true; + + struct pipe_rasterizer_state rs_state; + memset(&rs_state, 0, sizeof(rs_state)); + rs_state.cull_face = PIPE_FACE_NONE; + rs_state.gl_rasterization_rules = 1; + rs_state.flatshade = 1; + rasterizer = pipe->create_rasterizer_state(pipe, &rs_state); + + struct pipe_blend_state blendd; + blendd.rt[0].colormask = PIPE_MASK_RGBA; + blend = pipe->create_blend_state(pipe, &blendd); + + struct pipe_depth_stencil_alpha_state zsad; + memset(&zsad, 0, sizeof(zsad)); + zsa = pipe->create_depth_stencil_alpha_state(pipe, &zsad); + + struct pipe_vertex_element velem[2]; + memset(&velem[0], 0, sizeof(velem[0]) * 2); + velem[0].src_offset = 0; + velem[0].src_format = PIPE_FORMAT_R32G32_FLOAT; + velem[1].src_offset = 8; + velem[1].src_format = PIPE_FORMAT_R32G32_FLOAT; + elements = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); + + for(unsigned stretch = 0; stretch < 2; ++stretch) + { + struct pipe_sampler_state sampler_state; + memset(&sampler_state, 0, sizeof(sampler_state)); + sampler_state.min_img_filter = stretch ? PIPE_TEX_FILTER_LINEAR : PIPE_TEX_FILTER_NEAREST; + sampler_state.mag_img_filter = stretch ? PIPE_TEX_FILTER_LINEAR : PIPE_TEX_FILTER_NEAREST; + sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler_state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler_state.normalized_coords = normalized; + + sampler[stretch] = pipe->create_sampler_state(pipe, &sampler_state); + } + + fs = util_make_fragment_tex_shader(pipe, normalized ? TGSI_TEXTURE_2D : TGSI_TEXTURE_RECT, TGSI_INTERPOLATE_LINEAR); + + const unsigned semantic_names[] = { TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_GENERIC }; + const unsigned semantic_indices[] = { 0, 0 }; + vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names, semantic_indices); + + vbuf.buffer = pipe_buffer_create(pipe->screen, PIPE_BIND_VERTEX_BUFFER, sizeof(quad_data)); + vbuf.buffer_offset = 0; + vbuf.max_index = ~0; + vbuf.stride = 4 * sizeof(float); + pipe_buffer_write(pipe, vbuf.buffer, 0, sizeof(quad_data), quad_data); + + memset(&clip, 0, sizeof(clip)); + + memset(&draw, 0, sizeof(draw)); + draw.mode = PIPE_PRIM_QUADS; + draw.count = 4; + draw.instance_count = 1; + draw.max_index = ~0; + } + + void blit(struct pipe_surface* surf, struct pipe_sampler_view* view, unsigned x, unsigned y, unsigned w, unsigned h) + { + struct pipe_framebuffer_state fb; + memset(&fb, 0, sizeof(fb)); + fb.nr_cbufs = 1; + fb.cbufs[0] = surf; + fb.width = surf->width; + fb.height = surf->height; + + struct pipe_viewport_state viewport; + float half_width = w * 0.5f; + float half_height = h * 0.5f; + viewport.scale[0] = half_width; + viewport.scale[1] = half_height; + viewport.scale[2] = 1.0f; + viewport.scale[3] = 1.0f; + viewport.translate[0] = x + half_width; + viewport.translate[1] = y + half_height; + viewport.translate[2] = 0.0f; + viewport.translate[3] = 1.0f; + + bool stretch = view->texture->width0 != w || view->texture->height0 != h; + if(pipe->render_condition) + pipe->render_condition(pipe, 0, 0); + pipe->set_framebuffer_state(pipe, &fb); + pipe->bind_fragment_sampler_states(pipe, 1, &sampler[stretch]); + pipe->set_viewport_state(pipe, &viewport); + pipe->set_clip_state(pipe, &clip); + pipe->bind_rasterizer_state(pipe, rasterizer); + pipe->bind_depth_stencil_alpha_state(pipe, zsa); + pipe->bind_blend_state(pipe, blend); + pipe->bind_vertex_elements_state(pipe, elements); + pipe->set_vertex_buffers(pipe, 1, &vbuf); + pipe->bind_fs_state(pipe, fs); + pipe->bind_vs_state(pipe, vs); + if(pipe->bind_gs_state) + pipe->bind_gs_state(pipe, 0); + if(pipe->bind_stream_output_state) + pipe->bind_stream_output_state(pipe, 0); + pipe->set_fragment_sampler_views(pipe, 1, &view); + + pipe->draw_vbo(pipe, &draw); + } + + ~dxgi_blitter() + { + pipe->delete_blend_state(pipe, blend); + pipe->delete_rasterizer_state(pipe, rasterizer); + pipe->delete_depth_stencil_alpha_state(pipe, zsa); + pipe->delete_sampler_state(pipe, sampler[0]); + pipe->delete_sampler_state(pipe, sampler[1]); + pipe->delete_vertex_elements_state(pipe, elements); + pipe->delete_vs_state(pipe, vs); + pipe->delete_fs_state(pipe, fs); + pipe->screen->resource_destroy(pipe->screen, vbuf.buffer); + } +}; + +struct GalliumDXGISwapChain : public GalliumDXGIObject +{ + ComPtrdxgi_device; + ComPtrgallium_device; + ComPtr adapter; + ComPtr target; + + struct native_surface* surface; + const struct native_config* config; + + struct pipe_resource* resources[NUM_NATIVE_ATTACHMENTS]; + int width; + int height; + unsigned seq_num; + bool ever_validated; + bool needs_validation; + unsigned present_count; + + ComPtr buffer0; + struct pipe_resource* gallium_buffer0; + struct pipe_sampler_view* gallium_buffer0_view; + + DXGI_SWAP_CHAIN_DESC desc; + + struct pipe_context* pipe; + bool owns_pipe; + + BOOL fullscreen; + + std::auto_ptr blitter; + bool formats_compatible; + + GalliumDXGISwapChain(GalliumDXGIFactory* factory, IUnknown* p_device, const DXGI_SWAP_CHAIN_DESC& p_desc) + : GalliumDXGIObject(factory), desc(p_desc) + { + HRESULT hr; + + hr = p_device->QueryInterface(IID_IGalliumDevice, (void**)&gallium_device); + if(!SUCCEEDED(hr)) + throw hr; + + hr = p_device->QueryInterface(IID_IDXGIDevice, (void**)&dxgi_device); + if(!SUCCEEDED(hr)) + throw hr; + + hr = dxgi_device->GetAdapter((IDXGIAdapter**)&adapter); + if(!SUCCEEDED(hr)) + throw hr; + + void* win = factory->resolver(factory->resolver_cookie, desc.OutputWindow); + + unsigned config_num; + if(!strcmp(factory->platform->name, "X11")) + { + XWindowAttributes xwa; + XGetWindowAttributes((Display*)factory->display, (Window)win, &xwa); + config_num = adapter->configs_by_native_visual_id[xwa.visual->visualid]; + } + else + { + enum pipe_format format = dxgi_to_pipe_format[desc.BufferDesc.Format]; + if(!adapter->configs_by_pipe_format.count(format)) + { + if(adapter->configs_by_pipe_format.empty()) + throw E_FAIL; + // TODO: choose the best match + format = (pipe_format)adapter->configs_by_pipe_format.begin()->first; + } + // TODO: choose the best config + config_num = adapter->configs_by_pipe_format.find(format)->second; + } + + config = adapter->configs[config_num]; + surface = adapter->display->create_window_surface(adapter->display, (EGLNativeWindowType)win, config); + surface->user_data = this; + + width = 0; + height = 0; + seq_num = 0; + present_count = 0; + needs_validation = true; + ever_validated = false; + + if(desc.SwapEffect == DXGI_SWAP_EFFECT_SEQUENTIAL && desc.BufferCount != 1) + { + std::cerr << "Gallium DXGI: if DXGI_SWAP_EFFECT_SEQUENTIAL is specified, only BufferCount == 1 is implemented, but " << desc.BufferCount << " was specified: ignoring this" << std::endl; + // change the returned desc, so that the application might perhaps notice what we did and react well + desc.BufferCount = 1; + } + + pipe = gallium_device->GetGalliumContext(); + owns_pipe = false; + if(!pipe) + { + pipe = adapter->display->screen->context_create(adapter->display->screen, 0); + owns_pipe = true; + } + + blitter.reset(new dxgi_blitter(pipe)); + + formats_compatible = util_is_format_compatible( + util_format_description(dxgi_to_pipe_format[desc.BufferDesc.Format]), + util_format_description(config->color_format)); + } + + ~GalliumDXGISwapChain() + { + if(owns_pipe) + pipe->destroy(pipe); + } + + virtual HRESULT STDMETHODCALLTYPE GetDevice( + __in REFIID riid, + __out void **ppDevice) + { + return dxgi_device->QueryInterface(riid, ppDevice); + } + + HRESULT create_buffer0() + { + HRESULT hr; + ComPtr new_buffer0; + DXGI_USAGE usage = DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_RENDER_TARGET_OUTPUT; + if(desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD) + usage |= DXGI_USAGE_DISCARD_ON_PRESENT; + // for our blitter + usage |= DXGI_USAGE_SHADER_INPUT; + + DXGI_SURFACE_DESC surface_desc; + surface_desc.Format = desc.BufferDesc.Format; + surface_desc.Width = desc.BufferDesc.Width; + surface_desc.Height = desc.BufferDesc.Height; + surface_desc.SampleDesc = desc.SampleDesc; + hr = dxgi_device->CreateSurface(&surface_desc, 1, usage, 0, &new_buffer0); + if(!SUCCEEDED(hr)) + return hr; + + ComPtr gallium_resource; + hr = new_buffer0->QueryInterface(IID_IGalliumResource, (void**)&gallium_resource); + if(!SUCCEEDED(hr)) + return hr; + + struct pipe_resource* new_gallium_buffer0 = gallium_resource->GetGalliumResource(); + if(!new_gallium_buffer0) + return E_FAIL; + + buffer0.reset(new_buffer0.steal()); + gallium_buffer0 = new_gallium_buffer0; + struct pipe_sampler_view templat; + memset(&templat, 0, sizeof(templat)); + templat.texture = gallium_buffer0; + templat.swizzle_r = 0; + templat.swizzle_g = 1; + templat.swizzle_b = 2; + templat.swizzle_a = 3; + templat.format = gallium_buffer0->format; + gallium_buffer0_view = pipe->create_sampler_view(pipe, gallium_buffer0, &templat); + return S_OK; + } + + bool validate() + { + unsigned new_seq_num; + needs_validation = false; + + if(!surface->validate(surface, 1 << NATIVE_ATTACHMENT_BACK_LEFT, &new_seq_num, resources, &width, &height)) + return false; + + if(!ever_validated || seq_num != new_seq_num) + { + seq_num = new_seq_num; + ever_validated = true; + } + return true; + } + + virtual HRESULT STDMETHODCALLTYPE Present( + UINT SyncInterval, + UINT Flags) + { + if(Flags & DXGI_PRESENT_TEST) + return S_OK; + + if(!buffer0) + { + HRESULT hr = create_buffer0(); + if(!SUCCEEDED(hr)) + return hr; + } + + if(needs_validation) + { + if(!validate()) + return DXGI_ERROR_DEVICE_REMOVED; + } + + bool db = !!(config->buffer_mask & NATIVE_ATTACHMENT_BACK_LEFT); + struct pipe_resource* dst = resources[db ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT]; + struct pipe_resource* src = gallium_buffer0; + struct pipe_surface* dst_surface = 0; + + /* TODO: sharing the context for blitting won't work correctly if queries are active + * Hopefully no one is crazy enough to keep queries active while presenting, expecting + * sensible results. + * We could alternatively force using another context, but that might cause inefficiency issues + */ + + /* Windows DXGI does not scale in an aspect-preserving way, but we do this + * by default, since we can and it's usually what you want + */ + unsigned blit_x, blit_y, blit_w, blit_h; + float black[4] = {0, 0, 0, 0}; + + if(!formats_compatible || src->width0 != dst->width0 || dst->width0 != src->width0) + dst_surface = pipe->screen->get_tex_surface(pipe->screen, dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET); + + int delta = src->width0 * dst->height0 - dst->width0 * src->height0; + if(delta > 0) + { + blit_w = dst->width0; + blit_h = dst->width0 * src->height0 / src->width0; + } + else if(delta < 0) + { + blit_w = dst->height0 * src->width0 / src->height0; + blit_h = dst->height0; + } + else + { + blit_w = dst->width0; + blit_h = dst->height0; + } + + blit_x = (dst->width0 - blit_w) >> 1; + blit_y = (dst->height0 - blit_h) >> 1; + + if(blit_x) + pipe->clear_render_target(pipe, dst_surface, black, 0, 0, blit_x, dst->height0); + if(blit_y) + pipe->clear_render_target(pipe, dst_surface, black, 0, 0, dst->width0, blit_y); + + if(formats_compatible && blit_w == src->width0 && blit_h == src->height0) + { + pipe_subresource sr; + sr.face = 0; + sr.level = 0; + pipe->resource_copy_region(pipe, dst, sr, 0, 0, 0, src, sr, 0, 0, 0, blit_w, blit_h); + } + else + { + blitter->blit(dst_surface, gallium_buffer0_view, blit_x, blit_y, blit_w, blit_h); + if(!owns_pipe) + gallium_device->RestoreGalliumState(); + } + + if(blit_w != dst->width0) + pipe->clear_render_target(pipe, dst_surface, black, blit_x + blit_w, 0, dst->width0 - blit_x - blit_w, dst->height0); + if(blit_h != dst->height0) + pipe->clear_render_target(pipe, dst_surface, black, 0, blit_y + blit_h, dst->width0, dst->height0 - blit_y - blit_h); + + if(dst_surface) + pipe->screen->tex_surface_destroy(dst_surface); + + if(db) + { + if(!surface->swap_buffers(surface)) + return DXGI_ERROR_DEVICE_REMOVED; + } + else + { + if(!surface->flush_frontbuffer(surface)) + return DXGI_ERROR_DEVICE_REMOVED; + } + + ++present_count; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetBuffer( + UINT Buffer, + __in REFIID riid, + __out void **ppSurface) + { + if(Buffer > 0) + { + if(desc.SwapEffect == DXGI_SWAP_EFFECT_SEQUENTIAL) + std::cerr << "DXGI unimplemented: GetBuffer(n) with n > 0 not supported, returning buffer 0 instead!" << std::endl; + else + std::cerr << "DXGI error: in GetBuffer(n), n must be 0 for DXGI_SWAP_EFFECT_DISCARD\n" << std::endl; + } + + if(!buffer0) + { + HRESULT hr = create_buffer0(); + if(!SUCCEEDED(hr)) + return hr; + } + return buffer0->QueryInterface(riid, ppSurface); + } + + /* TODO: implement somehow */ + virtual HRESULT STDMETHODCALLTYPE SetFullscreenState( + BOOL Fullscreen, + __in_opt IDXGIOutput *pTarget) + { + fullscreen = Fullscreen; + target = pTarget; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetFullscreenState( + __out BOOL *pFullscreen, + __out IDXGIOutput **ppTarget) + { + if(pFullscreen) + *pFullscreen = fullscreen; + if(ppTarget) + *ppTarget = target.ref(); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + __out DXGI_SWAP_CHAIN_DESC *pDesc) + { + *pDesc = desc; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE ResizeBuffers( + UINT BufferCount, + UINT Width, + UINT Height, + DXGI_FORMAT NewFormat, + UINT SwapChainFlags) + { + if(buffer0) + { + buffer0.p->AddRef(); + ULONG v = buffer0.p->Release(); + // we must fail if there are any references to buffer0 other than ours + if(v > 1) + return E_FAIL; + pipe_sampler_view_reference(&gallium_buffer0_view, 0); + buffer0 = (IUnknown*)NULL; + gallium_buffer0 = 0; + } + + if(desc.SwapEffect != DXGI_SWAP_EFFECT_SEQUENTIAL) + desc.BufferCount = BufferCount; + desc.BufferDesc.Format = NewFormat; + desc.BufferDesc.Width = Width; + desc.BufferDesc.Height = Height; + desc.Flags = SwapChainFlags; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE ResizeTarget( + const DXGI_MODE_DESC *pNewTargetParameters) + { + /* TODO: implement */ + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetContainingOutput( + __out IDXGIOutput **ppOutput) + { + *ppOutput = adapter->outputs[0].ref(); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( + __out DXGI_FRAME_STATISTICS *pStats) + { + memset(pStats, 0, sizeof(*pStats)); +#ifdef _WIN32 + QueryPerformanceCounter(&pStats->SyncQPCTime); +#endif + pStats->PresentCount = present_count; + pStats->PresentRefreshCount = present_count; + pStats->SyncRefreshCount = present_count; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( + __out UINT *pLastPresentCount) + { + *pLastPresentCount = present_count; + return S_OK; + } +}; + +static void GalliumDXGISwapChainRevalidate(IDXGISwapChain* swap_chain) +{ + ((GalliumDXGISwapChain*)swap_chain)->needs_validation = true; +} + +static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* factory, const struct native_platform* platform, void* dpy, IDXGIAdapter1** pAdapter) +{ + try + { + *pAdapter = new GalliumDXGIAdapter(factory, platform, dpy); + return S_OK; + } + catch(HRESULT hr) + { + return hr; + } +} + +static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::string& name, const struct native_connector* connector, IDXGIOutput** pOutput) +{ + try + { + *pOutput = new GalliumDXGIOutput(adapter, name, connector); + return S_OK; + } + catch(HRESULT hr) + { + return hr; + } +} + +static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, IUnknown* device, const DXGI_SWAP_CHAIN_DESC& desc, IDXGISwapChain** pSwapChain) +{ + try + { + *pSwapChain = new GalliumDXGISwapChain(factory, device, desc); + return S_OK; + } + catch(HRESULT hr) + { + return hr; + } +} + +struct dxgi_binding +{ + const struct native_platform* platform; + void* display; + PFNHWNDRESOLVER resolver; + void* resolver_cookie; +}; + +static dxgi_binding dxgi_default_binding; +static __thread dxgi_binding dxgi_thread_binding; + +void STDMETHODCALLTYPE GalliumDXGIUseNothing() +{ + dxgi_thread_binding.platform = 0; + dxgi_thread_binding.display = 0; + dxgi_thread_binding.resolver = 0; + dxgi_thread_binding.resolver_cookie = 0; +} + +#ifdef GALLIUM_DXGI_USE_X11 +void STDMETHODCALLTYPE GalliumDXGIUseX11Display(Display* dpy, PFNHWNDRESOLVER resolver, void* resolver_cookie) +{ + dxgi_thread_binding.platform = native_get_x11_platform(); + dxgi_thread_binding.display = dpy; + dxgi_thread_binding.resolver = resolver; + dxgi_thread_binding.resolver_cookie = resolver_cookie; +} +#endif + +#ifdef GALLIUM_DXGI_USE_DRM +void STDMETHODCALLTYPE GalliumDXGIUseDRMCard(int fd) +{ + dxgi_thread_binding.platform = native_get_drm_platform(); + dxgi_thread_binding.display = (void*)fd; + dxgi_thread_binding.resolver = 0; + dxgi_thread_binding.resolver_cookie = 0; +} +#endif + +#ifdef GALLIUM_DXGI_USE_FBDEV +void STDMETHODCALLTYPE GalliumDXGIUseFBDev(int fd) +{ + dxgi_thread_binding.platform = native_get_fbdev_platform(); + dxgi_thread_binding.display = (void*)fd; + dxgi_thread_binding.resolver = 0; + dxgi_thread_binding.resolver_cookie = 0; +} +#endif + +#ifdef GALLIUM_DXGI_USE_GDI +void STDMETHODCALLTYPE GalliumDXGIUseHDC(HDC hdc, PFNHWNDRESOLVER resolver, void* resolver_cookie) +{ + dxgi_thread_binding.platform = native_get_gdi_platform(); + dxgi_thread_binding.display = (void*)hdc; + dxgi_thread_binding.resolver = resolver; + dxgi_thread_binding.resolver_cookie = resolver_cookie; +} +#endif + +void STDMETHODCALLTYPE GalliumDXGIMakeDefault() +{ + dxgi_default_binding = dxgi_thread_binding; +} + + /* TODO: why did Microsoft add this? should we do something different for DXGI 1.0 and 1.1? + * Or perhaps what they actually mean is "only create a single factory in your application"? + * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ + HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( + __in REFIID riid, + __out void **ppFactory +) + { + GalliumDXGIFactory* factory; + *ppFactory = 0; + if(dxgi_thread_binding.platform) + factory = new GalliumDXGIFactory(dxgi_thread_binding.platform, dxgi_thread_binding.display, dxgi_thread_binding.resolver, dxgi_thread_binding.resolver_cookie); + else if(dxgi_default_binding.platform) + factory = new GalliumDXGIFactory(dxgi_default_binding.platform, dxgi_default_binding.display, dxgi_default_binding.resolver, dxgi_default_binding.resolver_cookie); + else + factory = new GalliumDXGIFactory(native_get_x11_platform(), NULL, NULL, NULL); + HRESULT hres = factory->QueryInterface(riid, ppFactory); + factory->Release(); + return hres; + } + + HRESULT STDMETHODCALLTYPE CreateDXGIFactory( + __in REFIID riid, + __out void **ppFactory +) + { + return CreateDXGIFactory1(riid, ppFactory); + } diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h new file mode 100644 index 00000000000..30a69326357 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h @@ -0,0 +1,50 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef DXGI_PRIVATE_H_ +#define DXGI_PRIVATE_H_ + +#include +#include +#include + +#include "d3d1xstutil.h" + +#include +#include +#include +#include +#include + +struct native_display; + +struct pipe_screen * +dxgi_loader_create_drm_screen(struct native_display* dpy, const char *name, int fd); + +struct pipe_screen * +dxgi_loader_create_sw_screen(struct native_display* dpy, struct sw_winsys *ws); + +#endif /* DXGI_PRIVATE_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d10/Makefile b/src/gallium/state_trackers/d3d1x/dxgid3d10/Makefile new file mode 100644 index 00000000000..85f41e81586 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgid3d10/Makefile @@ -0,0 +1,4 @@ +LIBNAME=dxgid3d10 +CPP_SOURCES=$(wildcard *.cpp) +LIBRARY_INCLUDES=-I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../include -I../../../include -I../../../auxiliary +include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp new file mode 100644 index 00000000000..dd002261342 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp @@ -0,0 +1,149 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d1xstutil.h" +#include "galliumd3d10_1.h" +#include +#include +#include + +HRESULT D3D10CreateDevice1( + __in_opt IDXGIAdapter *pAdapter, + __in D3D10_DRIVER_TYPE DriverType, + __in HMODULE Software, + __in unsigned Flags, + __in D3D10_FEATURE_LEVEL1 HardwareLevel, + __in unsigned SDKVersion, + __out_opt ID3D10Device1 **ppDevice +) +{ + HRESULT hr; + ComPtr adapter_to_release; + if(!pAdapter) + { + ComPtr factory; + hr = CreateDXGIFactory1(IID_IDXGIFactory1, (void**)&factory); + if(!SUCCEEDED(hr)) + return hr; + hr = factory->EnumAdapters1(0, &adapter_to_release); + if(!SUCCEEDED(hr)) + return hr; + pAdapter = adapter_to_release.p; + } + ComPtr gallium_adapter; + hr = pAdapter->QueryInterface(IID_IGalliumAdapter, (void**)&gallium_adapter); + if(!SUCCEEDED(hr)) + return hr; + struct pipe_screen* screen; + // TODO: what should D3D_DRIVER_TYPE_SOFTWARE return? fast or reference? + if(DriverType == D3D10_DRIVER_TYPE_REFERENCE) + screen = gallium_adapter->GetGalliumReferenceSoftwareScreen(); + else if(DriverType == D3D10_DRIVER_TYPE_SOFTWARE || DriverType == D3D10_DRIVER_TYPE_WARP) + screen = gallium_adapter->GetGalliumFastSoftwareScreen(); + else + screen = gallium_adapter->GetGalliumScreen(); + if(!screen) + return E_FAIL; + struct pipe_context* context = screen->context_create(screen, 0); + if(!context) + return E_FAIL; + ComPtr device; + hr = GalliumD3D10DeviceCreate1(screen, context, TRUE, Flags, pAdapter, &device); + if(!SUCCEEDED(hr)) + { + context->destroy(context); + return hr; + } + if(ppDevice) + *ppDevice = device.steal(); + return S_OK; +} + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( + __in_opt IDXGIAdapter* pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + unsigned Flags, + __in D3D10_FEATURE_LEVEL1 HardwareLevel, + unsigned SDKVersion, + __in_opt DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + __out_opt IDXGISwapChain** ppSwapChain, + __out_opt ID3D10Device1** ppDevice +) +{ + ComPtr dev; + HRESULT hr; + hr = D3D10CreateDevice1(pAdapter, DriverType, Software, Flags, HardwareLevel, SDKVersion, &dev); + if(!SUCCEEDED(hr)) + return hr; + if(ppSwapChain) + { + ComPtr factory; + ComPtr dxgi_device; + ComPtr adapter; + hr = dev->QueryInterface(IID_IDXGIDevice, (void**)&dxgi_device); + if(!SUCCEEDED(hr)) + return hr; + + hr = dxgi_device->GetAdapter(&adapter); + if(!SUCCEEDED(hr)) + return hr; + + adapter->GetParent(IID_IDXGIFactory, (void**)&factory); + hr = factory->CreateSwapChain(dev.p, (DXGI_SWAP_CHAIN_DESC*)pSwapChainDesc, ppSwapChain); + if(!SUCCEEDED(hr)) + return hr; + } + if(ppDevice) + *ppDevice = dev.steal(); + return hr; +} + +HRESULT D3D10CreateDevice( + __in_opt IDXGIAdapter *pAdapter, + __in D3D10_DRIVER_TYPE DriverType, + __in HMODULE Software, + __in unsigned Flags, + __in unsigned SDKVersion, + __out_opt ID3D10Device **ppDevice +) +{ + return D3D10CreateDevice1(pAdapter, DriverType, Software, Flags, D3D10_FEATURE_LEVEL_10_0, SDKVersion, (ID3D10Device1**)ppDevice); +} + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain( + __in_opt IDXGIAdapter* pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + unsigned Flags, + unsigned SDKVersion, + __in_opt DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + __out_opt IDXGISwapChain** ppSwapChain, + __out_opt ID3D10Device** ppDevice +) +{ + return D3D10CreateDeviceAndSwapChain1(pAdapter, DriverType, Software, Flags, D3D10_FEATURE_LEVEL_10_0, SDKVersion, pSwapChainDesc, ppSwapChain, (ID3D10Device1**)ppDevice); +} diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d11/Makefile b/src/gallium/state_trackers/d3d1x/dxgid3d11/Makefile new file mode 100644 index 00000000000..591d1bea940 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgid3d11/Makefile @@ -0,0 +1,4 @@ +LIBNAME=dxgid3d11 +CPP_SOURCES=$(wildcard *.cpp) +LIBRARY_INCLUDES=-I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../include -I../../../include -I../../../auxiliary +include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp new file mode 100644 index 00000000000..86bb24baefd --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp @@ -0,0 +1,135 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d1xstutil.h" +#include "galliumd3d11.h" +#include +#include +#include + +HRESULT D3D11CreateDevice( + __in_opt IDXGIAdapter *pAdapter, + __in D3D_DRIVER_TYPE DriverType, + __in HMODULE Software, + __in unsigned Flags, + __in_ecount_opt( FeatureLevels ) const D3D_FEATURE_LEVEL *pFeatureLevels, + __in unsigned FeatureLevels, + __in unsigned SDKVersion, + __out_opt ID3D11Device **ppDevice, + __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, + __out_opt ID3D11DeviceContext **ppImmediateContext +) +{ + HRESULT hr; + ComPtr adapter_to_release; + if(!pAdapter) + { + ComPtr factory; + hr = CreateDXGIFactory1(IID_IDXGIFactory1, (void**)&factory); + if(!SUCCEEDED(hr)) + return hr; + hr = factory->EnumAdapters1(0, &adapter_to_release); + if(!SUCCEEDED(hr)) + return hr; + pAdapter = adapter_to_release.p; + } + ComPtr gallium_adapter; + hr = pAdapter->QueryInterface(IID_IGalliumAdapter, (void**)&gallium_adapter); + if(!SUCCEEDED(hr)) + return hr; + struct pipe_screen* screen; + // TODO: what should D3D_DRIVER_TYPE_SOFTWARE return? fast or reference? + if(DriverType == D3D_DRIVER_TYPE_REFERENCE) + screen = gallium_adapter->GetGalliumReferenceSoftwareScreen(); + else if(DriverType == D3D_DRIVER_TYPE_SOFTWARE || DriverType == D3D_DRIVER_TYPE_WARP) + screen = gallium_adapter->GetGalliumFastSoftwareScreen(); + else + screen = gallium_adapter->GetGalliumScreen(); + if(!screen) + return E_FAIL; + struct pipe_context* context = screen->context_create(screen, 0); + if(!context) + return E_FAIL; + ComPtr device; + hr = GalliumD3D11DeviceCreate(screen, context, TRUE, Flags, pAdapter, &device); + if(!SUCCEEDED(hr)) + { + context->destroy(context); + return hr; + } + if(ppImmediateContext) + device->GetImmediateContext(ppImmediateContext); + if(pFeatureLevel) + *pFeatureLevel = device->GetFeatureLevel(); + if(ppDevice) + *ppDevice = device.steal(); + return S_OK; +} + +HRESULT WINAPI D3D11CreateDeviceAndSwapChain( + __in_opt IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + unsigned Flags, + __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, + unsigned FeatureLevels, + unsigned SDKVersion, + __in_opt CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + __out_opt IDXGISwapChain** ppSwapChain, + __out_opt ID3D11Device** ppDevice, + __out_opt D3D_FEATURE_LEVEL* pFeatureLevel, + __out_opt ID3D11DeviceContext** ppImmediateContext ) +{ + ComPtr dev; + ComPtr ctx; + HRESULT hr; + hr = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, (ID3D11Device**)&dev, pFeatureLevel, (ID3D11DeviceContext**)&ctx); + if(!SUCCEEDED(hr)) + return hr; + if(ppSwapChain) + { + ComPtr factory; + ComPtr dxgi_device; + ComPtr adapter; + hr = dev->QueryInterface(IID_IDXGIDevice, (void**)&dxgi_device); + if(!SUCCEEDED(hr)) + return hr; + + hr = dxgi_device->GetAdapter(&adapter); + if(!SUCCEEDED(hr)) + return hr; + + adapter->GetParent(IID_IDXGIFactory, (void**)&factory); + hr = factory->CreateSwapChain(dev.p, (DXGI_SWAP_CHAIN_DESC*)pSwapChainDesc, ppSwapChain); + if(!SUCCEEDED(hr)) + return hr; + } + if(ppDevice) + *ppDevice = dev.steal(); + if(ppImmediateContext) + *ppImmediateContext = ctx.steal(); + return hr; +} diff --git a/src/gallium/state_trackers/d3d1x/gd3d10/Makefile b/src/gallium/state_trackers/d3d1x/gd3d10/Makefile new file mode 100644 index 00000000000..c6cfea25ea2 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d10/Makefile @@ -0,0 +1,19 @@ +LIBNAME=gd3d10 +CPP_SOURCES=d3d10.generated.cpp +LIBRARY_INCLUDES=-I../gd3d1x -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common + +GEN_D3D10=perl d3d10.pl + +include ../Makefile.inc + +d3d10.generated.o: d3d10_objects.generated.h d3d10_screen.generated.h d3d10_context.generated.h + +d3d10.generated.cpp: ../gd3d11/d3d11.cpp d3d10.pl + $(GEN_D3D10) $< > $@ +d3d10_objects.generated.h: ../gd3d11/d3d11_objects.h d3d10.pl + $(GEN_D3D10) $< > $@ +d3d10_screen.generated.h: ../gd3d11/d3d11_screen.h d3d10.pl + $(GEN_D3D10) $< > $@ +d3d10_context.generated.h: ../gd3d11/d3d11_context.h d3d10.pl + $(GEN_D3D10) $< > $@ + diff --git a/src/gallium/state_trackers/d3d1x/gd3d10/d3d10.pl b/src/gallium/state_trackers/d3d1x/gd3d10/d3d10.pl new file mode 100755 index 00000000000..4687b8365a6 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d10/d3d10.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl +while(<>) +{ + s/D3D11_SRV_DIMENSION_/D3D10_1_SRV_DIMENSION_/g; + s/D3D11/D3D10/g; + s/D3D10_SIGNATURE_PARAMETER_DESC/D3D11_SIGNATURE_PARAMETER_DESC/g; + s/D3D_FEATURE_LEVEL_/D3D10_FEATURE_LEVEL_/g; + s/D3D_FEATURE_LEVEL/D3D10_FEATURE_LEVEL1/g; + s/^#define API 11/#define API 10/; + s/^(#include "d3d1)1(_[^.]*)(.h")/${1}0$2.generated$3/; + print $_; +} diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/Makefile b/src/gallium/state_trackers/d3d1x/gd3d11/Makefile new file mode 100644 index 00000000000..650c11d3d0a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d11/Makefile @@ -0,0 +1,6 @@ +LIBNAME=gd3d11 +CPP_SOURCES=d3d11.cpp +LIBRARY_INCLUDES=-I../gd3d1x -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common + +include ../Makefile.inc + diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp new file mode 100644 index 00000000000..22cbf150fe1 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -0,0 +1,236 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d1x_private.h" + +extern "C" +{ +#include "util/u_gen_mipmap.h" +#include "tgsi/tgsi_ureg.h" +#include "cso_cache/cso_context.h" +} + + +// the perl script will change this to 10 for d3d10, and also do s/D3D11/D3D10 in the whole file +#define API 11 + +#if API >= 11 +#define DX10_ONLY(x) +#else +#define DX10_ONLY(x) x +#endif + +typedef D3D10_MAPPED_TEXTURE3D D3D10_MAPPED_SUBRESOURCE; + +// used to make QueryInterface know the IIDs of the interface and its ancestors +COM_INTERFACE(ID3D11DeviceChild, IUnknown) +COM_INTERFACE(ID3D11InputLayout, ID3D11DeviceChild) +COM_INTERFACE(ID3D11DepthStencilState, ID3D11DeviceChild) +COM_INTERFACE(ID3D11BlendState, ID3D11DeviceChild) +COM_INTERFACE(ID3D11RasterizerState, ID3D11DeviceChild) +COM_INTERFACE(ID3D11SamplerState, ID3D11DeviceChild) +COM_INTERFACE(ID3D11Resource, ID3D11DeviceChild) +COM_INTERFACE(ID3D11Buffer, ID3D11Resource) +COM_INTERFACE(ID3D11Texture1D, ID3D11Resource) +COM_INTERFACE(ID3D11Texture2D, ID3D11Resource) +COM_INTERFACE(ID3D11Texture3D, ID3D11Resource) +COM_INTERFACE(ID3D11View, ID3D11DeviceChild) +COM_INTERFACE(ID3D11ShaderResourceView, ID3D11View) +COM_INTERFACE(ID3D11RenderTargetView, ID3D11View) +COM_INTERFACE(ID3D11DepthStencilView, ID3D11View) +COM_INTERFACE(ID3D11VertexShader, ID3D11DeviceChild) +COM_INTERFACE(ID3D11GeometryShader, ID3D11DeviceChild) +COM_INTERFACE(ID3D11PixelShader, ID3D11DeviceChild) +COM_INTERFACE(ID3D11Asynchronous, ID3D11DeviceChild) +COM_INTERFACE(ID3D11Query, ID3D11Asynchronous) +COM_INTERFACE(ID3D11Predicate, ID3D11Query) +COM_INTERFACE(ID3D11Counter, ID3D11Asynchronous) +COM_INTERFACE(ID3D11Device, IUnknown) + +#if API >= 11 +COM_INTERFACE(ID3D11UnorderedAccessView, ID3D11View) +COM_INTERFACE(ID3D11HullShader, ID3D11DeviceChild) +COM_INTERFACE(ID3D11DomainShader, ID3D11DeviceChild) +COM_INTERFACE(ID3D11ComputeShader, ID3D11DeviceChild) +COM_INTERFACE(ID3D11ClassInstance, ID3D11DeviceChild) +COM_INTERFACE(ID3D11ClassLinkage, ID3D11DeviceChild) +COM_INTERFACE(ID3D11CommandList, ID3D11DeviceChild) +COM_INTERFACE(ID3D11DeviceContext, ID3D11DeviceChild) +#else +COM_INTERFACE(ID3D10BlendState1, ID3D10BlendState) +COM_INTERFACE(ID3D10ShaderResourceView1, ID3D10ShaderResourceView) +COM_INTERFACE(ID3D10Device1, ID3D10Device) +#endif + +struct GalliumD3D11Screen; + +#if API >= 11 +static ID3D11DeviceContext* GalliumD3D11ImmediateDeviceContext_Create(GalliumD3D11Screen* device, struct pipe_context* pipe, bool owns_pipe); +static void GalliumD3D11ImmediateDeviceContext_RestoreGalliumState(ID3D11DeviceContext* context); +static void GalliumD3D11ImmediateDeviceContext_RestoreGalliumStateBlitOnly(ID3D11DeviceContext* context); +static void GalliumD3D11ImmediateDeviceContext_Destroy(ID3D11DeviceContext* device); +#endif + +static inline pipe_box d3d11_to_pipe_box(struct pipe_resource* resource, unsigned level, const D3D11_BOX* pBox) +{ + pipe_box box; + if(pBox) + { + box.x = pBox->left; + box.y = pBox->top; + box.z = pBox->front; + box.width = pBox->right - pBox->left; + box.height = pBox->bottom - pBox->top; + box.depth = pBox->back - pBox->front; + } + else + { + box.x = box.y = box.z = 0; + box.width = u_minify(resource->width0, level); + box.height = u_minify(resource->height0, level); + box.depth = u_minify(resource->depth0, level); + } + return box; +} + +struct GalliumD3D11Caps +{ + bool so; + bool gs; + bool queries; + bool render_condition; + unsigned constant_buffers[D3D11_STAGES]; + unsigned stages; +}; + +// used to avoid needing to have forward declarations of functions +// this is called "screen" because in the D3D10 case it's only part of the device +struct GalliumD3D11Screen + : public GalliumDXGIDevice< + GalliumMultiComObject< +#if API >= 11 + GalliumPrivateDataComObject, +#else + GalliumPrivateDataComObject, +#endif + IGalliumDevice + > + > +{ + pipe_screen* screen; + pipe_context* immediate_pipe; + GalliumD3D11Caps screen_caps; + +#if API >= 11 + ID3D11DeviceContext* immediate_context; + ID3D11DeviceContext* get_immediate_context() + { + return immediate_context; + } +#else + GalliumD3D11Screen* get_immediate_context() + { + return this; + } +#endif + + + GalliumD3D11Screen(pipe_screen* screen, struct pipe_context* immediate_pipe, IDXGIAdapter* adapter) + : GalliumDXGIDevice(adapter), screen(screen), immediate_pipe(immediate_pipe) + { + } + +#if API < 11 + // we use a D3D11-like API internally + virtual HRESULT STDMETHODCALLTYPE Map( + __in ID3D11Resource *pResource, + __in unsigned Subresource, + __in D3D11_MAP MapType, + __in unsigned MapFlags, + __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0; + virtual void STDMETHODCALLTYPE Unmap( + __in ID3D11Resource *pResource, + __in unsigned Subresource) = 0; + virtual void STDMETHODCALLTYPE Begin( + __in ID3D11Asynchronous *pAsync) = 0; + virtual void STDMETHODCALLTYPE End( + __in ID3D11Asynchronous *pAsync) = 0; + virtual HRESULT STDMETHODCALLTYPE GetData( + __in ID3D11Asynchronous *pAsync, + __out_bcount_opt(DataSize) void *pData, + __in unsigned DataSize, + __in unsigned GetDataFlags) = 0; + + // TODO: maybe we should use function overloading, but that might risk silent errors, + // and cannot be exported to a C interface + virtual void UnbindBlendState(ID3D11BlendState* state) = 0; + virtual void UnbindRasterizerState(ID3D11RasterizerState* state) = 0; + virtual void UnbindDepthStencilState(ID3D11DepthStencilState* state) = 0; + virtual void UnbindInputLayout(ID3D11InputLayout* state) = 0; + virtual void UnbindPixelShader(ID3D11PixelShader* state) = 0; + virtual void UnbindVertexShader(ID3D11VertexShader* state) = 0; + virtual void UnbindGeometryShader(ID3D11GeometryShader* state) = 0; + virtual void UnbindPredicate(ID3D11Predicate* predicate) = 0; + virtual void UnbindSamplerState(ID3D11SamplerState* state) = 0; + virtual void UnbindBuffer(ID3D11Buffer* buffer) = 0; + virtual void UnbindDepthStencilView(ID3D11DepthStencilView* view) = 0; + virtual void UnbindRenderTargetView(ID3D11RenderTargetView* view) = 0; + virtual void UnbindShaderResourceView(ID3D11ShaderResourceView* view) = 0; + + void UnbindBlendState1(ID3D11BlendState1* state) + { + UnbindBlendState(state); + } + void UnbindShaderResourceView1(ID3D11ShaderResourceView1* view) + { + UnbindShaderResourceView(view); + } +#endif +}; + +#include "d3d11_objects.h" +#include "d3d11_screen.h" +#include "d3d11_context.h" + +#if API >= 11 +HRESULT STDMETHODCALLTYPE GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice) +{ + if(creation_flags & D3D11_CREATE_DEVICE_SINGLETHREADED) + *ppDevice = new GalliumD3D11ScreenImpl(screen, context, owns_context, creation_flags, adapter); + else + *ppDevice = new GalliumD3D11ScreenImpl(screen, context, owns_context, creation_flags, adapter); + return S_OK; +} +#else +HRESULT STDMETHODCALLTYPE GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D10Device1** ppDevice) +{ + if(creation_flags & D3D10_CREATE_DEVICE_SINGLETHREADED) + *ppDevice = new GalliumD3D10Device(screen, context, owns_context, creation_flags, adapter); + else + *ppDevice = new GalliumD3D10Device(screen, context, owns_context, creation_flags, adapter); + return S_OK; +} +#endif diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h new file mode 100644 index 00000000000..a8573cdf686 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -0,0 +1,2033 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +/* used to unbind things, we need 128 due to resources */ +static const void* zero_data[128]; + +#define UPDATE_VIEWS_SHIFT (D3D11_STAGES * 0) +#define UPDATE_SAMPLERS_SHIFT (D3D11_STAGES * 1) +#define UPDATE_VERTEX_BUFFERS (1 << (D3D11_STAGES * 2)) + +#if API >= 11 +template +struct GalliumD3D11DeviceContext : + public GalliumD3D11DeviceChild +{ +#else +template +struct GalliumD3D10Device : public GalliumD3D10ScreenImpl +{ + typedef simple_ptr_traits PtrTraits; + typedef GalliumD3D10Device GalliumD3D10DeviceContext; +#endif + + refcnt_ptr, PtrTraits> shaders[D3D11_STAGES]; + refcnt_ptr input_layout; + refcnt_ptr index_buffer; + refcnt_ptr rasterizer_state; + refcnt_ptr depth_stencil_state; + refcnt_ptr blend_state; + refcnt_ptr depth_stencil_view; + refcnt_ptr render_predicate; + + refcnt_ptr constant_buffers[D3D11_STAGES][D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]; + refcnt_ptr shader_resource_views[D3D11_STAGES][D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]; + refcnt_ptr samplers[D3D11_STAGES][D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]; + refcnt_ptr input_buffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; + refcnt_ptr render_target_views[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]; + refcnt_ptr so_targets[D3D11_SO_BUFFER_SLOT_COUNT]; + +#if API >= 11 + refcnt_ptr cs_unordered_access_views[D3D11_PS_CS_UAV_REGISTER_COUNT]; + refcnt_ptr om_unordered_access_views[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]; +#endif + + D3D11_VIEWPORT viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + D3D11_RECT scissor_rects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + unsigned so_offsets[D3D11_SO_BUFFER_SLOT_COUNT]; + D3D11_PRIMITIVE_TOPOLOGY primitive_topology; + DXGI_FORMAT index_format; + unsigned index_offset; + BOOL render_predicate_value; + float blend_color[4]; + unsigned sample_mask; + unsigned stencil_ref; + bool depth_clamp; + + void* default_input_layout; + void* default_rasterizer; + void* default_depth_stencil; + void* default_blend; + void* default_sampler; + void* ld_sampler; + void * default_shaders[D3D11_STAGES]; + + // derived state + int primitive_mode; + struct pipe_vertex_buffer vertex_buffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; + struct pipe_resource* so_buffers[D3D11_SO_BUFFER_SLOT_COUNT]; + struct pipe_sampler_view* sampler_views[D3D11_STAGES][D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]; + struct + { + void* ld; // accessed with a -1 index from v + void* v[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]; + } sampler_csos[D3D11_STAGES]; + struct pipe_resource * buffers[D3D11_SO_BUFFER_SLOT_COUNT]; + unsigned num_shader_resource_views[D3D11_STAGES]; + unsigned num_samplers[D3D11_STAGES]; + unsigned num_vertex_buffers; + unsigned num_render_target_views; + unsigned num_viewports; + unsigned num_scissor_rects; + unsigned num_so_targets; + + struct pipe_context* pipe; + unsigned update_flags; + + bool owns_pipe; + unsigned context_flags; + + GalliumD3D11Caps caps; + + cso_context* cso_ctx; + gen_mipmap_state* gen_mipmap; + +#if API >= 11 +#define SYNCHRONIZED do {} while(0) + + GalliumD3D11DeviceContext(GalliumD3D11Screen* device, pipe_context* pipe, bool owns_pipe, unsigned context_flags = 0) + : GalliumD3D11DeviceChild(device), pipe(pipe), owns_pipe(owns_pipe), context_flags(context_flags) + { + caps = device->screen_caps; + init_context(); + } + + ~GalliumD3D11DeviceContext() + { + destroy_context(); + } +#else +#define SYNCHRONIZED lock_t > lock_(this->mutex) + + GalliumD3D10Device(pipe_screen* screen, pipe_context* pipe, bool owns_pipe, unsigned creation_flags, IDXGIAdapter* adapter) + : GalliumD3D10ScreenImpl(screen, pipe, owns_pipe, creation_flags, adapter), pipe(pipe), owns_pipe(owns_pipe), context_flags(0) + { + caps = this->screen_caps; + init_context(); + } + + ~GalliumD3D10Device() + { + destroy_context(); + } +#endif + + void init_context() + { + if(!pipe->begin_query) + caps.queries = false; + if(!pipe->render_condition) + caps.render_condition = false; + if(!pipe->bind_gs_state) + { + caps.gs = false; + caps.stages = 2; + } + if(!pipe->set_stream_output_buffers) + caps.so = false; + + update_flags = 0; + + // pipeline state + memset(viewports, 0, sizeof(viewports)); + memset(scissor_rects, 0, sizeof(scissor_rects)); + memset(so_offsets, 0, sizeof(so_offsets)); + primitive_topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; + index_format = DXGI_FORMAT_UNKNOWN; + index_offset = 0; + render_predicate_value = 0; + memset(blend_color, 0, sizeof(blend_color)); + sample_mask = ~0; + stencil_ref = 0; + depth_clamp = 0; + + // derived state + primitive_mode = 0; + memset(vertex_buffers, 0, sizeof(vertex_buffers)); + memset(so_buffers, 0, sizeof(so_buffers)); + memset(sampler_views, 0, sizeof(sampler_views)); + memset(sampler_csos, 0, sizeof(sampler_csos)); + memset(num_shader_resource_views, 0, sizeof(num_shader_resource_views)); + memset(num_samplers, 0, sizeof(num_samplers)); + num_vertex_buffers = 0; + num_render_target_views = 0; + num_viewports = 0; + num_scissor_rects = 0; + num_so_targets = 0; + + default_input_layout = pipe->create_vertex_elements_state(pipe, 0, 0); + + struct pipe_rasterizer_state rasterizerd; + memset(&rasterizerd, 0, sizeof(rasterizerd)); + rasterizerd.gl_rasterization_rules = 1; + rasterizerd.cull_face = PIPE_FACE_BACK; + default_rasterizer = pipe->create_rasterizer_state(pipe, &rasterizerd); + + struct pipe_depth_stencil_alpha_state depth_stencild; + memset(&depth_stencild, 0, sizeof(depth_stencild)); + depth_stencild.depth.enabled = TRUE; + depth_stencild.depth.writemask = 1; + depth_stencild.depth.func = PIPE_FUNC_LESS; + default_depth_stencil = pipe->create_depth_stencil_alpha_state(pipe, &depth_stencild); + + struct pipe_blend_state blendd; + memset(&blendd, 0, sizeof(blendd)); + blendd.rt[0].colormask = 0xf; + default_blend = pipe->create_blend_state(pipe, &blendd); + + struct pipe_sampler_state samplerd; + memset(&samplerd, 0, sizeof(samplerd)); + samplerd.normalized_coords = 1; + samplerd.min_img_filter = PIPE_TEX_FILTER_LINEAR; + samplerd.mag_img_filter = PIPE_TEX_FILTER_LINEAR; + samplerd.min_mip_filter = PIPE_TEX_MIPFILTER_LINEAR; + samplerd.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + samplerd.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + samplerd.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + samplerd.border_color[0] = 1.0f; + samplerd.border_color[1] = 1.0f; + samplerd.border_color[2] = 1.0f; + samplerd.border_color[3] = 1.0f; + samplerd.min_lod = -FLT_MAX; + samplerd.max_lod = FLT_MAX; + samplerd.max_anisotropy = 1; + default_sampler = pipe->create_sampler_state(pipe, &samplerd); + + memset(&samplerd, 0, sizeof(samplerd)); + samplerd.normalized_coords = 0; + samplerd.min_img_filter = PIPE_TEX_FILTER_NEAREST; + samplerd.mag_img_filter = PIPE_TEX_FILTER_NEAREST; + samplerd.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + samplerd.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + samplerd.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + samplerd.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + samplerd.min_lod = -FLT_MAX; + samplerd.max_lod = FLT_MAX; + samplerd.max_anisotropy = 1; + ld_sampler = pipe->create_sampler_state(pipe, &samplerd); + + for(unsigned s = 0; s < D3D11_STAGES; ++s) + { + sampler_csos[s].ld = ld_sampler; + for(unsigned i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + sampler_csos[s].v[i] = default_sampler; + } + + // TODO: should this really be empty shaders, or should they be all-passthrough? + memset(default_shaders, 0, sizeof(default_shaders)); + struct ureg_program *ureg; + ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); + ureg_END(ureg); + default_shaders[PIPE_SHADER_FRAGMENT] = ureg_create_shader_and_destroy(ureg, pipe); + + ureg = ureg_create(TGSI_PROCESSOR_VERTEX); + ureg_END(ureg); + default_shaders[PIPE_SHADER_VERTEX] = ureg_create_shader_and_destroy(ureg, pipe); + + cso_ctx = cso_create_context(pipe); + gen_mipmap = util_create_gen_mipmap(pipe, cso_ctx); + + RestoreGalliumState(); + } + + void destroy_context() + { + util_destroy_gen_mipmap(gen_mipmap); + cso_destroy_context(cso_ctx); + pipe->delete_vertex_elements_state(pipe, default_input_layout); + pipe->delete_rasterizer_state(pipe, default_rasterizer); + pipe->delete_depth_stencil_alpha_state(pipe, default_depth_stencil); + pipe->delete_blend_state(pipe, default_blend); + pipe->delete_sampler_state(pipe, default_sampler); + pipe->delete_sampler_state(pipe, ld_sampler); + pipe->delete_fs_state(pipe, default_shaders[PIPE_SHADER_FRAGMENT]); + pipe->delete_vs_state(pipe, default_shaders[PIPE_SHADER_VERTEX]); + if(owns_pipe) + pipe->destroy(pipe); + } + + virtual unsigned STDMETHODCALLTYPE GetContextFlags(void) + { + return context_flags; + } +#if API >= 11 +#define SET_SHADER_EXTRA_ARGS , \ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, \ + unsigned NumClassInstances +#define GET_SHADER_EXTRA_ARGS , \ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, \ + __inout_opt unsigned *pNumClassInstances +#else +#define SET_SHADER_EXTRA_ARGS +#define GET_SHADER_EXTRA_ARGS +#endif + +/* On Windows D3D11, SetConstantBuffers and SetShaderResources crash if passed a null pointer. + * Instead, you have to pass a pointer to nulls to unbind things. + * We do the same. + * TODO: is D3D10 the same? + */ + template + void xs_set_shader(GalliumD3D11Shader<>* shader) + { + if(shader != shaders[s].p) + { + shaders[s] = shader; + void* shader_cso = shader ? shader->object : default_shaders[s]; + switch(s) + { + case PIPE_SHADER_VERTEX: + pipe->bind_vs_state(pipe, shader_cso); + break; + case PIPE_SHADER_FRAGMENT: + pipe->bind_fs_state(pipe, shader_cso); + break; + case PIPE_SHADER_GEOMETRY: + pipe->bind_gs_state(pipe, shader_cso); + break; + } + update_flags |= (1 << (UPDATE_SAMPLERS_SHIFT + s)) | (1 << (UPDATE_VIEWS_SHIFT + s)); + } + } + + template + void xs_set_constant_buffers(unsigned start, unsigned count, GalliumD3D11Buffer *const *constbufs) + { + for(unsigned i = 0; i < count; ++i) + { + if(constbufs[i] != constant_buffers[s][i].p) + { + constant_buffers[s][i] = constbufs[i]; + if(s < caps.stages && start + i < caps.constant_buffers[s]) + pipe->set_constant_buffer(pipe, s, start + i, constbufs[i] ? constbufs[i]->resource : NULL); + } + } + } + + template + void xs_set_shader_resources(unsigned start, unsigned count, GalliumD3D11ShaderResourceView *const *srvs) + { + int last_different = -1; + for(unsigned i = 0; i < count; ++i) + { + if(shader_resource_views[s][start + i].p != srvs[i]) + { + shader_resource_views[s][start + i] = srvs[i]; + sampler_views[s][start + i] = srvs[i] ? srvs[i]->object : 0; + last_different = i; + } + } + if(last_different >= 0) + { + num_shader_resource_views[s] = std::max(num_shader_resource_views[s], start + last_different + 1); + update_flags |= 1 << (UPDATE_VIEWS_SHIFT + s); + } + } + + template + void xs_set_samplers(unsigned start, unsigned count, GalliumD3D11SamplerState *const *samps) + { + int last_different = -1; + for(unsigned i = 0; i < count; ++i) + { + if(samplers[s][start + i].p != samps[i]) + { + samplers[s][start + i] = samps[i]; + sampler_csos[s].v[start + i] = samps[i] ? samps[i]->object : default_sampler; + } + if(last_different >= 0) + { + num_samplers[s] = std::max(num_samplers[s], start + last_different + 1); + update_flags |= (UPDATE_SAMPLERS_SHIFT + s); + } + } + } + +#define IMPLEMENT_SHADER_STAGE(XS, Stage) \ + virtual void STDMETHODCALLTYPE XS##SetShader( \ + __in_opt ID3D11##Stage##Shader *pShader \ + SET_SHADER_EXTRA_ARGS) \ + { \ + SYNCHRONIZED; \ + xs_set_shader((GalliumD3D11Shader<>*)pShader); \ + } \ + virtual void STDMETHODCALLTYPE XS##GetShader(\ + __out ID3D11##Stage##Shader **ppShader \ + GET_SHADER_EXTRA_ARGS) \ + { \ + SYNCHRONIZED; \ + *ppShader = (ID3D11##Stage##Shader*)shaders[D3D11_STAGE_##XS].ref(); \ + } \ + virtual void STDMETHODCALLTYPE XS##SetConstantBuffers(\ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) \ + { \ + SYNCHRONIZED; \ + xs_set_constant_buffers(StartSlot, NumBuffers, (GalliumD3D11Buffer *const *)ppConstantBuffers); \ + } \ + virtual void STDMETHODCALLTYPE XS##GetConstantBuffers(\ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) \ + { \ + SYNCHRONIZED; \ + for(unsigned i = 0; i < NumBuffers; ++i) \ + ppConstantBuffers[i] = constant_buffers[D3D11_STAGE_##XS][StartSlot + i].ref(); \ + } \ + virtual void STDMETHODCALLTYPE XS##SetShaderResources(\ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) \ + { \ + SYNCHRONIZED; \ + xs_set_shader_resources(StartSlot, NumViews, (GalliumD3D11ShaderResourceView *const *)ppShaderResourceViews); \ + } \ + virtual void STDMETHODCALLTYPE XS##GetShaderResources(\ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) \ + { \ + SYNCHRONIZED; \ + for(unsigned i = 0; i < NumViews; ++i) \ + ppShaderResourceViews[i] = shader_resource_views[D3D11_STAGE_##XS][StartSlot + i].ref(); \ + } \ + virtual void STDMETHODCALLTYPE XS##SetSamplers(\ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) \ + { \ + SYNCHRONIZED; \ + xs_set_samplers(StartSlot, NumSamplers, (GalliumD3D11SamplerState *const *)ppSamplers); \ + } \ + virtual void STDMETHODCALLTYPE XS##GetSamplers( \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) \ + { \ + SYNCHRONIZED; \ + for(unsigned i = 0; i < NumSamplers; ++i) \ + ppSamplers[i] = samplers[D3D11_STAGE_##XS][StartSlot + i].ref(); \ + } + +#define DO_VS(x) x +#define DO_GS(x) do {if(caps.gs) {x;}} while(0) +#define DO_PS(x) x +#define DO_HS(x) +#define DO_DS(x) +#define DO_CS(x) + IMPLEMENT_SHADER_STAGE(VS, Vertex) + IMPLEMENT_SHADER_STAGE(GS, Geometry) + IMPLEMENT_SHADER_STAGE(PS, Pixel) + +#if API >= 11 + IMPLEMENT_SHADER_STAGE(HS, Hull) + IMPLEMENT_SHADER_STAGE(DS, Domain) + IMPLEMENT_SHADER_STAGE(CS, Compute) + + virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews( + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, + __in_ecount(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + __in_ecount(NumUAVs) const unsigned *pUAVInitialCounts) + { + SYNCHRONIZED; + for(unsigned i = 0; i < NumUAVs; ++i) + cs_unordered_access_views[StartSlot + i] = ppUnorderedAccessViews[i]; + } + + virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews( + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, + __out_ecount(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) + { + SYNCHRONIZED; + for(unsigned i = 0; i < NumUAVs; ++i) + ppUnorderedAccessViews[i] = cs_unordered_access_views[StartSlot + i].ref(); + } +#endif + + template + void update_stage() + { + if(update_flags & (1 << (UPDATE_VIEWS_SHIFT + s))) + { + while(num_shader_resource_views[s] && !sampler_views[s][num_shader_resource_views[s] - 1]) \ + --num_shader_resource_views[s]; + if(s < caps.stages) + { + struct pipe_sampler_view* views_to_bind[PIPE_MAX_SAMPLERS]; + unsigned num_views_to_bind = shaders[s] ? shaders[s]->slot_to_resource.size() : 0; + for(unsigned i = 0; i < num_views_to_bind; ++i) + { + views_to_bind[i] = sampler_views[s][shaders[s]->slot_to_resource[i]]; + } + switch(s) + { + case PIPE_SHADER_VERTEX: + pipe->set_vertex_sampler_views(pipe, num_views_to_bind, views_to_bind); + break; + case PIPE_SHADER_FRAGMENT: + pipe->set_fragment_sampler_views(pipe, num_views_to_bind, views_to_bind); + break; + case PIPE_SHADER_GEOMETRY: + pipe->set_geometry_sampler_views(pipe, num_views_to_bind, views_to_bind); + break; + } + } + } + + if(update_flags & (1 << (UPDATE_SAMPLERS_SHIFT + s))) + { + while(num_samplers[s] && !sampler_csos[s].v[num_samplers[s] - 1]) + --num_samplers[s]; + if(s < caps.stages) + { + void* samplers_to_bind[PIPE_MAX_SAMPLERS]; + unsigned num_samplers_to_bind = shaders[s] ? shaders[s]->slot_to_sampler.size() : 0; + for(unsigned i = 0; i < num_samplers_to_bind; ++i) + { + // index can be -1 to access sampler_csos[s].ld + samplers_to_bind[i] = *(sampler_csos[s].v + shaders[s]->slot_to_sampler[i]); + } + switch(s) + { + case PIPE_SHADER_VERTEX: + pipe->bind_vertex_sampler_states(pipe, num_samplers_to_bind, samplers_to_bind); + break; + case PIPE_SHADER_FRAGMENT: + pipe->bind_fragment_sampler_states(pipe, num_samplers_to_bind, samplers_to_bind); + break; + case PIPE_SHADER_GEOMETRY: + pipe->bind_geometry_sampler_states(pipe, num_samplers_to_bind, samplers_to_bind); + break; + } + } + } + } + + void update_state() + { + update_stage(); + update_stage(); + update_stage(); +#if API >= 11 + update_stage(); + update_stage(); + update_stage(); +#endif + + if(update_flags & UPDATE_VERTEX_BUFFERS) + { + while(num_vertex_buffers && !vertex_buffers[num_vertex_buffers - 1].buffer) + --num_vertex_buffers; + pipe->set_vertex_buffers(pipe, num_vertex_buffers, vertex_buffers); + } + + update_flags = 0; + } + + virtual void STDMETHODCALLTYPE IASetInputLayout( + __in_opt ID3D11InputLayout *pInputLayout) + { + SYNCHRONIZED; + if(pInputLayout != input_layout.p) + { + input_layout = pInputLayout; + pipe->bind_vertex_elements_state(pipe, pInputLayout ? ((GalliumD3D11InputLayout*)pInputLayout)->object : default_input_layout); + } + } + + virtual void STDMETHODCALLTYPE IAGetInputLayout( + __out ID3D11InputLayout **ppInputLayout) + { + SYNCHRONIZED; + *ppInputLayout = input_layout.ref(); + } + + virtual void STDMETHODCALLTYPE IASetVertexBuffers( + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, + __in_ecount(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, + __in_ecount(NumBuffers) const unsigned *pStrides, + __in_ecount(NumBuffers) const unsigned *pOffsets) + { + SYNCHRONIZED; + int last_different = -1; + for(unsigned i = 0; i < NumBuffers; ++i) + { + ID3D11Buffer* buffer = ppVertexBuffers[i]; + if(buffer != input_buffers[StartSlot + i].p + || vertex_buffers[StartSlot + i].buffer_offset != pOffsets[i] + || vertex_buffers[StartSlot + i].stride != pOffsets[i] + ) + { + input_buffers[StartSlot + i] = buffer; + vertex_buffers[StartSlot + i].buffer = buffer ? ((GalliumD3D11Buffer*)buffer)->resource : 0; + vertex_buffers[StartSlot + i].buffer_offset = pOffsets[i]; + vertex_buffers[StartSlot + i].stride = pStrides[i]; + vertex_buffers[StartSlot + i].max_index = ~0; + last_different = i; + } + } + if(last_different >= 0) + { + num_vertex_buffers = std::max(num_vertex_buffers, StartSlot + NumBuffers); + update_flags |= UPDATE_VERTEX_BUFFERS; + } + } + + virtual void STDMETHODCALLTYPE IAGetVertexBuffers( + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, + __out_ecount_opt(NumBuffers) ID3D11Buffer **ppVertexBuffers, + __out_ecount_opt(NumBuffers) unsigned *pStrides, + __out_ecount_opt(NumBuffers) unsigned *pOffsets) + { + SYNCHRONIZED; + if(ppVertexBuffers) + { + for(unsigned i = 0; i < NumBuffers; ++i) + ppVertexBuffers[i] = input_buffers[StartSlot + i].ref(); + } + + if(pOffsets) + { + for(unsigned i = 0; i < NumBuffers; ++i) + pOffsets[i] = vertex_buffers[StartSlot + i].buffer_offset; + } + + if(pStrides) + { + for(unsigned i = 0; i < NumBuffers; ++i) + pStrides[i] = vertex_buffers[StartSlot + i].stride; + } + } + + void set_index_buffer() + { + pipe_index_buffer ib; + if(!index_buffer) + { + memset(&ib, 0, sizeof(ib)); + } + else + { + if(index_format == DXGI_FORMAT_R32_UINT) + ib.index_size = 4; + else if(index_format == DXGI_FORMAT_R16_UINT) + ib.index_size = 2; + else + ib.index_size = 1; + ib.offset = index_offset; + ib.buffer = index_buffer ? ((GalliumD3D11Buffer*)index_buffer.p)->resource : 0; + } + pipe->set_index_buffer(pipe, &ib); + } + + virtual void STDMETHODCALLTYPE IASetIndexBuffer( + __in_opt ID3D11Buffer *pIndexBuffer, + __in DXGI_FORMAT Format, + __in unsigned Offset) + { + SYNCHRONIZED; + if(index_buffer.p != pIndexBuffer || index_format != Format || index_offset != Offset) + { + index_buffer = pIndexBuffer; + index_format = Format; + index_offset = Offset; + + set_index_buffer(); + } + } + + virtual void STDMETHODCALLTYPE IAGetIndexBuffer( + __out_opt ID3D11Buffer **pIndexBuffer, + __out_opt DXGI_FORMAT *Format, + __out_opt unsigned *Offset) + { + SYNCHRONIZED; + if(pIndexBuffer) + *pIndexBuffer = index_buffer.ref(); + if(Format) + *Format = index_format; + if(Offset) + *Offset = index_offset; + } + + virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( + __in D3D11_PRIMITIVE_TOPOLOGY Topology) + { + SYNCHRONIZED; + if(primitive_topology != Topology) + { + if(Topology < D3D_PRIMITIVE_TOPOLOGY_COUNT) + primitive_mode = d3d_to_pipe_prim[Topology]; + else + primitive_mode = 0; + primitive_topology = Topology; + } + } + + virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( + __out D3D11_PRIMITIVE_TOPOLOGY *pTopology) + { + SYNCHRONIZED; + *pTopology = primitive_topology; + } + + virtual void STDMETHODCALLTYPE DrawIndexed( + __in unsigned IndexCount, + __in unsigned StartIndexLocation, + __in int BaseVertexLocation) + { + SYNCHRONIZED; + if(update_flags) + update_state(); + + pipe_draw_info info; + info.mode = primitive_mode; + info.indexed = TRUE; + info.count = IndexCount; + info.start = StartIndexLocation; + info.index_bias = BaseVertexLocation; + info.min_index = 0; + info.max_index = ~0; + info.start_instance = 0; + info.instance_count = 1; + + pipe->draw_vbo(pipe, &info); + } + + virtual void STDMETHODCALLTYPE Draw( + __in unsigned VertexCount, + __in unsigned StartVertexLocation) + { + SYNCHRONIZED; + if(update_flags) + update_state(); + + pipe_draw_info info; + info.mode = primitive_mode; + info.indexed = FALSE; + info.count = VertexCount; + info.start = StartVertexLocation; + info.index_bias = 0; + info.min_index = 0; + info.max_index = ~0; + info.start_instance = 0; + info.instance_count = 1; + + pipe->draw_vbo(pipe, &info); + } + + virtual void STDMETHODCALLTYPE DrawIndexedInstanced( + __in unsigned IndexCountPerInstance, + __in unsigned InstanceCount, + __in unsigned StartIndexLocation, + __in int BaseVertexLocation, + __in unsigned StartInstanceLocation) + { + SYNCHRONIZED; + if(update_flags) + update_state(); + + pipe_draw_info info; + info.mode = primitive_mode; + info.indexed = TRUE; + info.count = IndexCountPerInstance; + info.start = StartIndexLocation; + info.index_bias = BaseVertexLocation; + info.min_index = 0; + info.max_index = ~0; + info.start_instance = StartInstanceLocation; + info.instance_count = InstanceCount; + + pipe->draw_vbo(pipe, &info); + } + + virtual void STDMETHODCALLTYPE DrawInstanced( + __in unsigned VertexCountPerInstance, + __in unsigned InstanceCount, + __in unsigned StartVertexLocation, + __in unsigned StartInstanceLocation) + { + SYNCHRONIZED; + if(update_flags) + update_state(); + + pipe_draw_info info; + info.mode = primitive_mode; + info.indexed = FALSE; + info.count = VertexCountPerInstance; + info.start = StartVertexLocation; + info.index_bias = 0; + info.min_index = 0; + info.max_index = ~0; + info.start_instance = StartInstanceLocation; + info.instance_count = InstanceCount; + + pipe->draw_vbo(pipe, &info); + } + + virtual void STDMETHODCALLTYPE DrawAuto(void) + { + if(!caps.so) + return; + + SYNCHRONIZED; + if(update_flags) + update_state(); + + pipe->draw_stream_output(pipe, primitive_mode); + } + + virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect( + __in ID3D11Buffer *pBufferForArgs, + __in unsigned AlignedByteOffsetForArgs) + { + SYNCHRONIZED; + if(update_flags) + update_state(); + + struct { + unsigned count; + unsigned instance_count; + unsigned start; + unsigned index_bias; + } data; + + pipe_buffer_read(pipe, ((GalliumD3D11Buffer*)pBufferForArgs)->resource, AlignedByteOffsetForArgs, sizeof(data), &data); + + pipe_draw_info info; + info.mode = primitive_mode; + info.indexed = TRUE; + info.start = data.start; + info.count = data.count; + info.index_bias = data.index_bias; + info.min_index = 0; + info.max_index = ~0; + info.start_instance = 0; + info.instance_count = data.instance_count; + + pipe->draw_vbo(pipe, &info); + } + + virtual void STDMETHODCALLTYPE DrawInstancedIndirect( + __in ID3D11Buffer *pBufferForArgs, + __in unsigned AlignedByteOffsetForArgs) + { + SYNCHRONIZED; + if(update_flags) + update_state(); + + struct { + unsigned count; + unsigned instance_count; + unsigned start; + } data; + + pipe_buffer_read(pipe, ((GalliumD3D11Buffer*)pBufferForArgs)->resource, AlignedByteOffsetForArgs, sizeof(data), &data); + + pipe_draw_info info; + info.mode = primitive_mode; + info.indexed = FALSE; + info.start = data.start; + info.count = data.count; + info.index_bias = 0; + info.min_index = 0; + info.max_index = ~0; + info.start_instance = 0; + info.instance_count = data.instance_count; + + pipe->draw_vbo(pipe, &info); + } + +#if API >= 11 + virtual void STDMETHODCALLTYPE Dispatch( + __in unsigned ThreadGroupCountX, + __in unsigned ThreadGroupCountY, + __in unsigned ThreadGroupCountZ) + { +// uncomment this when this is implemented +// SYNCHRONIZED; +// if(update_flags) +// update_state(); + } + + virtual void STDMETHODCALLTYPE DispatchIndirect( + __in ID3D11Buffer *pBufferForArgs, + __in unsigned AlignedByteOffsetForArgs) + { +// uncomment this when this is implemented +// SYNCHRONIZED; +// if(update_flags) +// update_state(); + } +#endif + + void set_clip() + { + SYNCHRONIZED; + pipe_clip_state clip; + clip.nr = 0; + clip.depth_clamp = depth_clamp; + pipe->set_clip_state(pipe, &clip); + } + + virtual void STDMETHODCALLTYPE RSSetState( + __in_opt ID3D11RasterizerState *pRasterizerState) + { + SYNCHRONIZED; + if(pRasterizerState != rasterizer_state.p) + { + rasterizer_state = pRasterizerState; + pipe->bind_rasterizer_state(pipe, pRasterizerState ? ((GalliumD3D11RasterizerState*)pRasterizerState)->object : default_rasterizer); + bool new_depth_clamp = pRasterizerState ? ((GalliumD3D11RasterizerState*)pRasterizerState)->depth_clamp : false; + if(depth_clamp != new_depth_clamp) + { + depth_clamp = new_depth_clamp; + set_clip(); + } + } + } + + virtual void STDMETHODCALLTYPE RSGetState( + __out ID3D11RasterizerState **ppRasterizerState) + { + SYNCHRONIZED; + *ppRasterizerState = rasterizer_state.ref(); + } + + void set_viewport() + { + // TODO: is depth correct? it seems D3D10/11 uses a [-1,1]x[-1,1]x[0,1] cube + pipe_viewport_state viewport; + float half_width = viewports[0].Width * 0.5f; + float half_height = viewports[0].Height * 0.5f; + + viewport.scale[0] = half_width; + viewport.scale[1] = -half_height; + viewport.scale[2] = (viewports[0].MaxDepth - viewports[0].MinDepth); + viewport.scale[3] = 1.0f; + viewport.translate[0] = half_width + viewports[0].TopLeftX; + viewport.translate[1] = half_height + viewports[0].TopLeftY; + viewport.translate[2] = viewports[0].MinDepth; + viewport.translate[3] = 1.0f; + pipe->set_viewport_state(pipe, &viewport); + } + + virtual void STDMETHODCALLTYPE RSSetViewports( + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumViewports, + __in_ecount_opt(NumViewports) const D3D11_VIEWPORT *pViewports) + { + SYNCHRONIZED; + if(NumViewports) + { + if(memcmp(&viewports[0], &pViewports[0], sizeof(viewports[0]))) + { + viewports[0] = pViewports[0]; + set_viewport(); + } + for(unsigned i = 1; i < NumViewports; ++i) + viewports[i] = pViewports[i]; + } + else if(num_viewports) + { + // TODO: what should we do here? + memset(&viewports[0], 0, sizeof(viewports[0])); + set_viewport(); + } + num_viewports = NumViewports; + } + + virtual void STDMETHODCALLTYPE RSGetViewports( + __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumViewports, + __out_ecount_opt(*pNumViewports) D3D11_VIEWPORT *pViewports) + { + SYNCHRONIZED; + if(pViewports) + { + unsigned i; + for(i = 0; i < std::min(*pNumViewports, num_viewports); ++i) + pViewports[i] = viewports[i]; + + memset(pViewports + i, 0, (*pNumViewports - i) * sizeof(D3D11_VIEWPORT)); + } + + *pNumViewports = num_viewports; + } + + void set_scissor() + { + pipe_scissor_state scissor; + scissor.minx = scissor_rects[0].left; + scissor.miny = scissor_rects[0].top; + scissor.maxx = scissor_rects[0].right; + scissor.maxy = scissor_rects[0].bottom; + pipe->set_scissor_state(pipe, &scissor); + } + + virtual void STDMETHODCALLTYPE RSSetScissorRects( + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumRects, + __in_ecount_opt(NumRects) const D3D11_RECT *pRects) + { + SYNCHRONIZED; + if(NumRects) + { + if(memcmp(&scissor_rects[0], &pRects[0], sizeof(scissor_rects[0]))) + { + scissor_rects[0] = pRects[0]; + set_scissor(); + } + for(unsigned i = 1; i < NumRects; ++i) + scissor_rects[i] = pRects[i]; + } + else if(num_scissor_rects) + { + // TODO: what should we do here? + memset(&scissor_rects[0], 0, sizeof(scissor_rects[0])); + set_scissor(); + } + + num_scissor_rects = NumRects; + } + + virtual void STDMETHODCALLTYPE RSGetScissorRects( + __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumRects, + __out_ecount_opt(*pNumRects) D3D11_RECT *pRects) + { + SYNCHRONIZED; + if(pRects) + { + unsigned i; + for(i = 0; i < std::min(*pNumRects, num_scissor_rects); ++i) + pRects[i] = scissor_rects[i]; + + memset(pRects + i, 0, (*pNumRects - i) * sizeof(D3D11_RECT)); + } + + *pNumRects = num_scissor_rects; + } + + virtual void STDMETHODCALLTYPE OMSetBlendState( + __in_opt ID3D11BlendState *pBlendState, + __in_opt const float BlendFactor[ 4 ], + __in unsigned SampleMask) + { + SYNCHRONIZED; + float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + + if(blend_state.p != pBlendState) + { + pipe->bind_blend_state(pipe, pBlendState ? ((GalliumD3D11BlendState*)pBlendState)->object : default_blend); + blend_state = pBlendState; + } + + // Windows D3D11 does this, even though it's apparently undocumented + if(!BlendFactor) + BlendFactor = white; + + if(memcmp(blend_color, BlendFactor, sizeof(blend_color))) + { + pipe->set_blend_color(pipe, (struct pipe_blend_color*)BlendFactor); + memcpy(blend_color, BlendFactor, sizeof(blend_color)); + } + + if(sample_mask != SampleMask) + { + pipe->set_sample_mask(pipe, sample_mask); + sample_mask = SampleMask; + } + } + + virtual void STDMETHODCALLTYPE OMGetBlendState( + __out_opt ID3D11BlendState **ppBlendState, + __out_opt float BlendFactor[ 4 ], + __out_opt unsigned *pSampleMask) + { + SYNCHRONIZED; + if(ppBlendState) + *ppBlendState = blend_state.ref(); + if(BlendFactor) + memcpy(BlendFactor, blend_color, sizeof(blend_color)); + if(pSampleMask) + *pSampleMask = sample_mask; + } + + void set_stencil_ref() + { + struct pipe_stencil_ref sref; + sref.ref_value[0] = stencil_ref; + sref.ref_value[1] = stencil_ref; + pipe->set_stencil_ref(pipe, &sref); + } + + virtual void STDMETHODCALLTYPE OMSetDepthStencilState( + __in_opt ID3D11DepthStencilState *pDepthStencilState, + __in unsigned StencilRef) + { + SYNCHRONIZED; + if(pDepthStencilState != depth_stencil_state.p) + { + pipe->bind_depth_stencil_alpha_state(pipe, pDepthStencilState ? ((GalliumD3D11DepthStencilState*)pDepthStencilState)->object : default_depth_stencil); + depth_stencil_state = pDepthStencilState; + } + + if(StencilRef != stencil_ref) + { + stencil_ref = StencilRef; + set_stencil_ref(); + } + } + + virtual void STDMETHODCALLTYPE OMGetDepthStencilState( + __out_opt ID3D11DepthStencilState **ppDepthStencilState, + __out_opt unsigned *pStencilRef) + { + SYNCHRONIZED; + if(*ppDepthStencilState) + *ppDepthStencilState = depth_stencil_state.ref(); + if(pStencilRef) + *pStencilRef = stencil_ref; + } + + void set_framebuffer() + { + struct pipe_framebuffer_state fb; + memset(&fb, 0, sizeof(fb)); + if(depth_stencil_view) + { + struct pipe_surface* surf = ((GalliumD3D11DepthStencilView*)depth_stencil_view.p)->object; + fb.zsbuf = surf; + if(surf->width > fb.width) + fb.width = surf->width; + if(surf->height > fb.height) + fb.height = surf->height; + } + fb.nr_cbufs = num_render_target_views; + unsigned i; + for(i = 0; i < num_render_target_views; ++i) + { + if(render_target_views[i]) + { + struct pipe_surface* surf = ((GalliumD3D11RenderTargetView*)render_target_views[i].p)->object; + fb.cbufs[i] = surf; + if(surf->width > fb.width) + fb.width = surf->width; + if(surf->height > fb.height) + fb.height = surf->height; + } + } + + pipe->set_framebuffer_state(pipe, &fb); + } + + /* TODO: the docs say that we should unbind conflicting resources (e.g. those bound for read while we are binding them for write too), but we aren't. + * Hopefully nobody relies on this happening + */ + + virtual void STDMETHODCALLTYPE OMSetRenderTargets( + __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, + __in_ecount_opt(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, + __in_opt ID3D11DepthStencilView *pDepthStencilView) + { + SYNCHRONIZED; + if(!ppRenderTargetViews) + NumViews = 0; + if(NumViews == num_render_target_views) + { + for(unsigned i = 0; i < NumViews; ++i) + { + if(ppRenderTargetViews[i] != render_target_views[i].p) + goto changed; + } + return; + } +changed: + depth_stencil_view = pDepthStencilView; + unsigned i; + for(i = 0; i < NumViews; ++i) + { + render_target_views[i] = ppRenderTargetViews[i]; +#if API >= 11 + om_unordered_access_views[i] = (ID3D11UnorderedAccessView*)NULL; +#endif + } + for(; i < num_render_target_views; ++i) + render_target_views[i] = (ID3D11RenderTargetView*)NULL; + num_render_target_views = NumViews; + set_framebuffer(); + } + + virtual void STDMETHODCALLTYPE OMGetRenderTargets( + __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, + __out_ecount_opt(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, + __out_opt ID3D11DepthStencilView **ppDepthStencilView) + { + SYNCHRONIZED; + if(ppRenderTargetViews) + { + unsigned i; + for(i = 0; i < std::min(num_render_target_views, NumViews); ++i) + ppRenderTargetViews[i] = render_target_views[i].ref(); + + for(; i < NumViews; ++i) + ppRenderTargetViews[i] = 0; + } + + if(ppDepthStencilView) + *ppDepthStencilView = depth_stencil_view.ref(); + } + +#if API >= 11 + /* TODO: what is this supposed to do _exactly_? are we doing the right thing? */ + virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews( + __in unsigned NumRTVs, + __in_ecount_opt(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, + __in_opt ID3D11DepthStencilView *pDepthStencilView, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, + __in unsigned NumUAVs, + __in_ecount_opt(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + __in_ecount_opt(NumUAVs) const unsigned *pUAVInitialCounts) + { + SYNCHRONIZED; + if(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL) + OMSetRenderTargets(NumRTVs, ppRenderTargetViews, pDepthStencilView); + + if(NumUAVs != D3D11_KEEP_UNORDERED_ACCESS_VIEWS) + { + for(unsigned i = 0; i < NumUAVs; ++i) + { + om_unordered_access_views[UAVStartSlot + i] = ppUnorderedAccessViews[i]; + render_target_views[UAVStartSlot + i] = (ID3D11RenderTargetView*)0; + } + } + } + + virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews( + __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumRTVs, + __out_ecount_opt(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, + __out_opt ID3D11DepthStencilView **ppDepthStencilView, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot) unsigned NumUAVs, + __out_ecount_opt(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) + { + SYNCHRONIZED; + if(ppRenderTargetViews) + OMGetRenderTargets(NumRTVs, ppRenderTargetViews, ppDepthStencilView); + + if(ppUnorderedAccessViews) + { + for(unsigned i = 0; i < NumUAVs; ++i) + ppUnorderedAccessViews[i] = om_unordered_access_views[UAVStartSlot + i].ref(); + } + } +#endif + + virtual void STDMETHODCALLTYPE SOSetTargets( + __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, + __in_ecount_opt(NumBuffers) ID3D11Buffer *const *ppSOTargets, + __in_ecount_opt(NumBuffers) const unsigned *pOffsets) + { + SYNCHRONIZED; + unsigned i; + if(!ppSOTargets) + NumBuffers = 0; + bool changed = false; + for(i = 0; i < NumBuffers; ++i) + { + ID3D11Buffer* buffer = ppSOTargets[i]; + if(buffer != so_targets[i].p || pOffsets[i] != so_offsets[i]) + { + so_buffers[i] = buffer ? ((GalliumD3D11Buffer*)buffer)->resource : 0; + so_targets[i] = buffer; + so_offsets[i] = pOffsets[i]; + changed = true; + } + } + for(; i < D3D11_SO_BUFFER_SLOT_COUNT; ++i) + { + if(so_targets[i].p || so_offsets[i]) + { + changed = true; + so_targets[i] = (ID3D11Buffer*)0; + so_offsets[i] = 0; + } + } + num_so_targets = NumBuffers; + + if(changed && caps.so) + pipe->set_stream_output_buffers(pipe, so_buffers, (int*)so_offsets, num_so_targets); + } + + virtual void STDMETHODCALLTYPE SOGetTargets( + __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, + __out_ecount(NumBuffers) ID3D11Buffer **ppSOTargets +#if API < 11 + , __out_ecount(NumBuffers) UINT *pOffsets +#endif + ) + { + SYNCHRONIZED; + for(unsigned i = 0; i < NumBuffers; ++i) + { + ppSOTargets[i] = so_targets[i].ref(); +#if API < 11 + pOffsets[i] = so_offsets[i]; +#endif + } + } + + virtual void STDMETHODCALLTYPE Begin( + __in ID3D11Asynchronous *pAsync) + { + SYNCHRONIZED; + if(caps.queries) + pipe->begin_query(pipe, ((GalliumD3D11Asynchronous<>*)pAsync)->query); + } + + virtual void STDMETHODCALLTYPE End( + __in ID3D11Asynchronous *pAsync) + { + SYNCHRONIZED; + if(caps.queries) + pipe->end_query(pipe, ((GalliumD3D11Asynchronous<>*)pAsync)->query); + } + + virtual HRESULT STDMETHODCALLTYPE GetData( + __in ID3D11Asynchronous *pAsync, + __out_bcount_opt(DataSize) void *pData, + __in unsigned DataSize, + __in unsigned GetDataFlags) + { + SYNCHRONIZED; + if(!caps.queries) + return E_NOTIMPL; + + GalliumD3D11Asynchronous<>* async = (GalliumD3D11Asynchronous<>*)pAsync; + void* data = alloca(async->data_size); + boolean ret = pipe->get_query_result(pipe, ((GalliumD3D11Asynchronous<>*)pAsync)->query, !(GetDataFlags & D3D11_ASYNC_GETDATA_DONOTFLUSH), data); + if(pData) + memcpy(pData, data, std::min(async->data_size, DataSize)); + return ret ? S_OK : S_FALSE; + } + + void set_render_condition() + { + if(caps.render_condition) + { + if(!render_predicate) + pipe->render_condition(pipe, 0, 0); + else + { + GalliumD3D11Predicate* predicate = (GalliumD3D11Predicate*)render_predicate.p; + if(!render_predicate_value && predicate->desc.Query == D3D11_QUERY_OCCLUSION_PREDICATE) + { + unsigned mode = (predicate->desc.MiscFlags & D3D11_QUERY_MISC_PREDICATEHINT) ? PIPE_RENDER_COND_NO_WAIT : PIPE_RENDER_COND_WAIT; + pipe->render_condition(pipe, predicate->query, mode); + } + else + { + /* TODO: add inverted predication to Gallium*/ + pipe->render_condition(pipe, 0, 0); + } + } + } + } + + virtual void STDMETHODCALLTYPE SetPredication( + __in_opt ID3D11Predicate *pPredicate, + __in BOOL PredicateValue) + { + SYNCHRONIZED; + if(render_predicate.p != pPredicate || render_predicate_value != PredicateValue) + { + render_predicate = pPredicate; + render_predicate_value = PredicateValue; + set_render_condition(); + } + } + + virtual void STDMETHODCALLTYPE GetPredication( + __out_opt ID3D11Predicate **ppPredicate, + __out_opt BOOL *pPredicateValue) + { + SYNCHRONIZED; + if(ppPredicate) + *ppPredicate = render_predicate.ref(); + if(pPredicateValue) + *pPredicateValue = render_predicate_value; + } + + static pipe_subresource d3d11_to_pipe_subresource(struct pipe_resource* resource, unsigned subresource) + { + pipe_subresource sr; + if(subresource <= resource->last_level) + { + sr.level = subresource; + sr.face = 0; + } + else + { + unsigned levels = resource->last_level + 1; + sr.level = subresource % levels; + sr.face = subresource / levels; + } + return sr; + } + + virtual HRESULT STDMETHODCALLTYPE Map( + __in ID3D11Resource *pResource, + __in unsigned Subresource, + __in D3D11_MAP MapType, + __in unsigned MapFlags, + __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; + if(resource->transfers.count(Subresource)) + return E_FAIL; + pipe_subresource sr = d3d11_to_pipe_subresource(resource->resource, Subresource); + pipe_box box; + d3d11_to_pipe_box(resource->resource, sr.level, 0); + unsigned usage = 0; + if(MapType == D3D11_MAP_READ) + usage = PIPE_TRANSFER_READ; + else if(MapType == D3D11_MAP_WRITE) + usage = PIPE_TRANSFER_WRITE; + else if(MapType == D3D11_MAP_READ_WRITE) + usage = PIPE_TRANSFER_READ_WRITE; + else if(MapType == D3D11_MAP_WRITE_DISCARD) + usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD; + else if(MapType == D3D11_MAP_WRITE_NO_OVERWRITE) + usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_NOOVERWRITE; + else + return E_INVALIDARG; + if(MapType & D3D10_MAP_FLAG_DO_NOT_WAIT) + usage |= PIPE_TRANSFER_DONTBLOCK; + struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, sr, usage, &box); + if(!transfer) { + if(MapType & D3D10_MAP_FLAG_DO_NOT_WAIT) + return DXGI_ERROR_WAS_STILL_DRAWING; + else + return E_FAIL; + } + resource->transfers[Subresource] = transfer; + pipe->transfer_map(pipe, transfer); + pMappedResource->pData = transfer->data; + pMappedResource->RowPitch = transfer->stride; + pMappedResource->DepthPitch = transfer->slice_stride; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in ID3D11Resource *pResource, + __in unsigned Subresource) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; + std::unordered_map::iterator i = resource->transfers.find(Subresource); + if(i != resource->transfers.end()) + { + pipe->transfer_unmap(pipe, i->second); + pipe->transfer_destroy(pipe, i->second); + resource->transfers.erase(i); + } + } + + virtual void STDMETHODCALLTYPE CopySubresourceRegion( + __in ID3D11Resource *pDstResource, + __in unsigned DstSubresource, + __in unsigned DstX, + __in unsigned DstY, + __in unsigned DstZ, + __in ID3D11Resource *pSrcResource, + __in unsigned SrcSubresource, + __in_opt const D3D11_BOX *pSrcBox) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; + GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)pSrcResource; + pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, DstSubresource); + pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, SrcSubresource); + pipe_box box = d3d11_to_pipe_box(src->resource, subsrc.level, pSrcBox); + for(unsigned i = 0; i < box.depth; ++i) + { + pipe->resource_copy_region(pipe, + dst->resource, subdst, DstX, DstY, DstZ + i, + src->resource, subsrc, box.x, box.y, box.z + i, + box.width, box.height); + } + } + + virtual void STDMETHODCALLTYPE CopyResource( + __in ID3D11Resource *pDstResource, + __in ID3D11Resource *pSrcResource) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; + GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)pSrcResource; + pipe_subresource sr; + unsigned faces = dst->resource->target == PIPE_TEXTURE_CUBE ? 6 : 1; + + for(sr.face = 0; sr.face < faces; ++sr.face) + { + for(sr.level = 0; sr.level <= dst->resource->last_level; ++sr.level) + { + unsigned w = u_minify(dst->resource->width0, sr.level); + unsigned h = u_minify(dst->resource->height0, sr.level); + unsigned d = u_minify(dst->resource->depth0, sr.level); + for(unsigned i = 0; i < d; ++i) + { + pipe->resource_copy_region(pipe, + dst->resource, sr, 0, 0, i, + src->resource, sr, 0, 0, i, + w, h); + } + } + } + } + + virtual void STDMETHODCALLTYPE UpdateSubresource( + __in ID3D11Resource *pDstResource, + __in unsigned DstSubresource, + __in_opt const D3D11_BOX *pDstBox, + __in const void *pSrcData, + __in unsigned SrcRowPitch, + __in unsigned SrcDepthPitch) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; + pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, DstSubresource); + pipe_box box = d3d11_to_pipe_box(dst->resource, subdst.level, pDstBox); + pipe->transfer_inline_write(pipe, dst->resource, subdst, PIPE_TRANSFER_WRITE, &box, pSrcData, SrcRowPitch, SrcDepthPitch); + } + +#if API >= 11 + virtual void STDMETHODCALLTYPE CopyStructureCount( + __in ID3D11Buffer *pDstBuffer, + __in unsigned DstAlignedByteOffset, + __in ID3D11UnorderedAccessView *pSrcView) + { + SYNCHRONIZED; + } +#endif + + virtual void STDMETHODCALLTYPE ClearRenderTargetView( + __in ID3D11RenderTargetView *pRenderTargetView, + __in const float ColorRGBA[4]) + { + SYNCHRONIZED; + GalliumD3D11RenderTargetView* view = ((GalliumD3D11RenderTargetView*)pRenderTargetView); + pipe->clear_render_target(pipe, view->object, ColorRGBA, 0, 0, view->object->width, view->object->height); + } + + virtual void STDMETHODCALLTYPE ClearDepthStencilView( + __in ID3D11DepthStencilView *pDepthStencilView, + __in unsigned ClearFlags, + __in float Depth, + __in UINT8 Stencil) + { + SYNCHRONIZED; + GalliumD3D11DepthStencilView* view = ((GalliumD3D11DepthStencilView*)pDepthStencilView); + unsigned flags = 0; + if(ClearFlags & D3D11_CLEAR_DEPTH) + flags |= PIPE_CLEAR_DEPTH; + if(ClearFlags & D3D11_CLEAR_STENCIL) + flags |= PIPE_CLEAR_STENCIL; + pipe->clear_depth_stencil(pipe, view->object, flags, Depth, Stencil, 0, 0, view->object->width, view->object->height); + } + +#if API >= 11 + virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint( + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + __in const unsigned Values[ 4 ]) + { + SYNCHRONIZED; + } + + virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat( + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + __in const float Values[ 4 ]) + { + SYNCHRONIZED; + } +#endif + + virtual void STDMETHODCALLTYPE RestoreGalliumStateBlitOnly() + { + pipe->bind_blend_state(pipe, blend_state.p ? blend_state.p->object : default_blend); + pipe->bind_depth_stencil_alpha_state(pipe, depth_stencil_state.p ? depth_stencil_state.p->object : default_depth_stencil); + pipe->bind_rasterizer_state(pipe, rasterizer_state.p ? rasterizer_state.p->object : default_rasterizer); + pipe->bind_vertex_elements_state(pipe, input_layout.p ? input_layout.p->object : default_input_layout); + pipe->bind_fs_state(pipe, shaders[D3D11_STAGE_PS].p ? shaders[D3D11_STAGE_PS].p->object : default_shaders[PIPE_SHADER_FRAGMENT]); + pipe->bind_vs_state(pipe, shaders[D3D11_STAGE_VS].p ? shaders[D3D11_STAGE_VS].p->object : default_shaders[PIPE_SHADER_VERTEX]); + if(caps.gs) + pipe->bind_gs_state(pipe, shaders[D3D11_STAGE_GS].p ? shaders[D3D11_STAGE_GS].p->object : default_shaders[PIPE_SHADER_GEOMETRY]); + set_framebuffer(); + set_viewport(); + set_clip(); + set_render_condition(); + // TODO: restore stream output + + update_flags |= UPDATE_VERTEX_BUFFERS | (1 << (UPDATE_SAMPLERS_SHIFT + D3D11_STAGE_PS)) | (1 << (UPDATE_VIEWS_SHIFT + D3D11_STAGE_PS)); + } + + virtual void STDMETHODCALLTYPE GenerateMips( + __in ID3D11ShaderResourceView *pShaderResourceView) + { + SYNCHRONIZED; + + GalliumD3D11ShaderResourceView* view = (GalliumD3D11ShaderResourceView*)pShaderResourceView; + if(caps.gs) + pipe->bind_gs_state(pipe, 0); + if(caps.so) + pipe->bind_stream_output_state(pipe, 0); + if(pipe->render_condition) + pipe->render_condition(pipe, 0, 0); + util_gen_mipmap(gen_mipmap, view->object, 0, 0, view->object->texture->last_level, PIPE_TEX_FILTER_LINEAR); + RestoreGalliumStateBlitOnly(); + } + + virtual void STDMETHODCALLTYPE RestoreGalliumState() + { + SYNCHRONIZED; + RestoreGalliumStateBlitOnly(); + + set_index_buffer(); + set_stencil_ref(); + pipe->set_blend_color(pipe, (struct pipe_blend_color*)blend_color); + pipe->set_sample_mask(pipe, sample_mask); + + for(unsigned s = 0; s < 3; ++s) + { + unsigned num = std::min(caps.constant_buffers[s], (unsigned)D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); + for(unsigned i = 0; i < num; ++i) + pipe->set_constant_buffer(pipe, s, i, constant_buffers[s][i].p ? constant_buffers[s][i].p->resource : 0); + } + + if(caps.so) + pipe->set_stream_output_buffers(pipe, so_buffers, (int*)so_offsets, num_so_targets); + + update_flags |= (1 << (UPDATE_SAMPLERS_SHIFT + D3D11_STAGE_VS)) | (1 << (UPDATE_VIEWS_SHIFT + D3D11_STAGE_VS)); + update_flags |= (1 << (UPDATE_SAMPLERS_SHIFT + D3D11_STAGE_GS)) | (1 << (UPDATE_VIEWS_SHIFT + D3D11_STAGE_GS)); + + set_scissor(); + } + +#if API >= 11 + /* TODO: hack SRVs or sampler states to handle this, or add to Gallium */ + virtual void STDMETHODCALLTYPE SetResourceMinLOD( + __in ID3D11Resource *pResource, + float MinLOD) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; + if(resource->min_lod != MinLOD) + { + // TODO: actually do anything? + resource->min_lod = MinLOD; + } + } + + virtual float STDMETHODCALLTYPE GetResourceMinLOD( + __in ID3D11Resource *pResource) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; + return resource->min_lod; + } +#endif + + virtual void STDMETHODCALLTYPE ResolveSubresource( + __in ID3D11Resource *pDstResource, + __in unsigned DstSubresource, + __in ID3D11Resource *pSrcResource, + __in unsigned SrcSubresource, + __in DXGI_FORMAT Format) + { + SYNCHRONIZED; + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; + GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)pSrcResource; + pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, DstSubresource); + pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, SrcSubresource); + pipe->resource_resolve(pipe, dst->resource, subdst, src->resource, subsrc); + } + +#if API >= 11 + virtual void STDMETHODCALLTYPE ExecuteCommandList( + __in ID3D11CommandList *pCommandList, + BOOL RestoreContextState) + { + SYNCHRONIZED; + } + + virtual HRESULT STDMETHODCALLTYPE FinishCommandList( + BOOL RestoreDeferredContextState, + __out_opt ID3D11CommandList **ppCommandList) + { + SYNCHRONIZED; + return E_NOTIMPL; + } +#endif + + virtual void STDMETHODCALLTYPE ClearState(void) + { + SYNCHRONIZED; + + // we qualify all calls so that we avoid virtual dispatch and might get them inlined + // TODO: make sure all this gets inlined, which might require more compiler flags + // TODO: optimize this +#if API >= 11 + GalliumD3D11DeviceContext::PSSetShader(0, 0, 0); + GalliumD3D11DeviceContext::GSSetShader(0, 0, 0); + GalliumD3D11DeviceContext::VSSetShader(0, 0, 0); + GalliumD3D11DeviceContext::HSSetShader(0, 0, 0); + GalliumD3D11DeviceContext::DSSetShader(0, 0, 0); + GalliumD3D11DeviceContext::CSSetShader(0, 0, 0); +#else + GalliumD3D11DeviceContext::PSSetShader(0); + GalliumD3D11DeviceContext::GSSetShader(0); + GalliumD3D11DeviceContext::VSSetShader(0); +#endif + + GalliumD3D11DeviceContext::IASetInputLayout(0); + GalliumD3D11DeviceContext::IASetIndexBuffer(0, DXGI_FORMAT_UNKNOWN, 0); + GalliumD3D11DeviceContext::RSSetState(0); + GalliumD3D11DeviceContext::OMSetDepthStencilState(0, 0); + GalliumD3D11DeviceContext::OMSetBlendState(0, (float*)zero_data, ~0); + GalliumD3D11DeviceContext::SetPredication(0, 0); + GalliumD3D11DeviceContext::IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED); + + GalliumD3D11DeviceContext::PSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, (ID3D11Buffer**)zero_data); + GalliumD3D11DeviceContext::GSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, (ID3D11Buffer**)zero_data); + GalliumD3D11DeviceContext::VSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, (ID3D11Buffer**)zero_data); +#if API >= 11 + GalliumD3D11DeviceContext::HSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, (ID3D11Buffer**)zero_data); + GalliumD3D11DeviceContext::DSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, (ID3D11Buffer**)zero_data); + GalliumD3D11DeviceContext::CSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, (ID3D11Buffer**)zero_data); +#endif + + GalliumD3D11DeviceContext::IASetVertexBuffers(0, num_vertex_buffers, (ID3D11Buffer**)zero_data, (unsigned*)zero_data, (unsigned*)zero_data); +#if API >= 11 + GalliumD3D11DeviceContext::OMSetRenderTargetsAndUnorderedAccessViews(0, 0, 0 , 0, 0, 0, 0); +#else + GalliumD3D11DeviceContext::OMSetRenderTargets(0, 0, 0 ); +#endif + GalliumD3D11DeviceContext::SOSetTargets(0, 0, 0); + + GalliumD3D11DeviceContext::PSSetShaderResources(0, num_shader_resource_views[D3D11_STAGE_PS], (ID3D11ShaderResourceView**)zero_data); + GalliumD3D11DeviceContext::GSSetShaderResources(0, num_shader_resource_views[D3D11_STAGE_GS], (ID3D11ShaderResourceView**)zero_data); + GalliumD3D11DeviceContext::VSSetShaderResources(0, num_shader_resource_views[D3D11_STAGE_VS], (ID3D11ShaderResourceView**)zero_data); +#if API >= 11 + GalliumD3D11DeviceContext::HSSetShaderResources(0, num_shader_resource_views[D3D11_STAGE_HS], (ID3D11ShaderResourceView**)zero_data); + GalliumD3D11DeviceContext::DSSetShaderResources(0, num_shader_resource_views[D3D11_STAGE_DS], (ID3D11ShaderResourceView**)zero_data); + GalliumD3D11DeviceContext::CSSetShaderResources(0, num_shader_resource_views[D3D11_STAGE_CS], (ID3D11ShaderResourceView**)zero_data); +#endif + + GalliumD3D11DeviceContext::PSSetSamplers(0, num_shader_resource_views[D3D11_STAGE_PS], (ID3D11SamplerState**)zero_data); + GalliumD3D11DeviceContext::GSSetSamplers(0, num_shader_resource_views[D3D11_STAGE_GS], (ID3D11SamplerState**)zero_data); + GalliumD3D11DeviceContext::VSSetSamplers(0, num_shader_resource_views[D3D11_STAGE_VS], (ID3D11SamplerState**)zero_data); +#if API >= 11 + GalliumD3D11DeviceContext::HSSetSamplers(0, num_shader_resource_views[D3D11_STAGE_HS], (ID3D11SamplerState**)zero_data); + GalliumD3D11DeviceContext::DSSetSamplers(0, num_shader_resource_views[D3D11_STAGE_DS], (ID3D11SamplerState**)zero_data); + GalliumD3D11DeviceContext::CSSetSamplers(0, num_shader_resource_views[D3D11_STAGE_CS], (ID3D11SamplerState**)zero_data); +#endif + + GalliumD3D11DeviceContext::RSSetViewports(0, 0); + GalliumD3D11DeviceContext::RSSetScissorRects(0, 0); + } + + virtual void STDMETHODCALLTYPE Flush(void) + { + SYNCHRONIZED; + pipe->flush(pipe, PIPE_FLUSH_FRAME, 0); + } + + /* In Direct3D 10, if the reference count of an object drops to 0, it is automatically + * cleanly unbound from the pipeline. + * In Direct3D 11, the pipeline holds a reference. + * + * Note that instead of always scanning the pipeline on destruction, we could + * maintain the internal reference count on DirectX 10 and use it to check if an + * object is still bound. + * Presumably, on average, scanning is faster if the application is well written. + */ +#if API < 11 +#define IMPLEMENT_SIMPLE_UNBIND(name, member, gallium, def) \ + void Unbind##name(ID3D11##name* state) \ + { \ + SYNCHRONIZED; \ + if((void*)state == (void*)member.p) \ + { \ + member.p = 0; \ + pipe->bind_##gallium##_state(pipe, default_##def); \ + } \ + } + IMPLEMENT_SIMPLE_UNBIND(BlendState, blend_state, blend, blend) + IMPLEMENT_SIMPLE_UNBIND(RasterizerState, rasterizer_state, rasterizer, rasterizer) + IMPLEMENT_SIMPLE_UNBIND(DepthStencilState, depth_stencil_state, depth_stencil_alpha, depth_stencil) + IMPLEMENT_SIMPLE_UNBIND(InputLayout, input_layout, vertex_elements, input_layout) + IMPLEMENT_SIMPLE_UNBIND(PixelShader, shaders[D3D11_STAGE_PS], fs, shaders[D3D11_STAGE_PS]) + IMPLEMENT_SIMPLE_UNBIND(VertexShader, shaders[D3D11_STAGE_VS], vs, shaders[D3D11_STAGE_VS]) + IMPLEMENT_SIMPLE_UNBIND(GeometryShader, shaders[D3D11_STAGE_GS], gs, shaders[D3D11_STAGE_GS]) + + void UnbindPredicate(ID3D11Predicate* predicate) + { + SYNCHRONIZED; + if(predicate == render_predicate) + { + render_predicate.p = NULL; + render_predicate_value = 0; + pipe->render_condition(pipe, 0, 0); + } + } + + void UnbindSamplerState(ID3D11SamplerState* state) + { + SYNCHRONIZED; + for(unsigned s = 0; s < D3D11_STAGES; ++s) + { + for(unsigned i = 0; i < num_samplers[s]; ++i) + { + if(samplers[s][i] == state) + { + samplers[s][i].p = NULL; + sampler_csos[s].v[i] = NULL; + update_flags |= (1 << (UPDATE_SAMPLERS_SHIFT + s)); + } + } + } + } + + void UnbindBuffer(ID3D11Buffer* buffer) + { + SYNCHRONIZED; + if(buffer == index_buffer) + { + index_buffer.p = 0; + index_format = DXGI_FORMAT_UNKNOWN; + index_offset = 0; + struct pipe_index_buffer ib; + memset(&ib, 0, sizeof(ib)); + pipe->set_index_buffer(pipe, &ib); + } + + for(unsigned i = 0; i < num_vertex_buffers; ++i) + { + if(buffer == input_buffers[i]) + { + input_buffers[i].p = 0; + memset(&vertex_buffers[num_vertex_buffers], 0, sizeof(vertex_buffers[num_vertex_buffers])); + update_flags |= UPDATE_VERTEX_BUFFERS; + } + } + + for(unsigned s = 0; s < D3D11_STAGES; ++s) + { + for(unsigned i = 0; i < sizeof(constant_buffers) / sizeof(constant_buffers[0]); ++i) + { + if(constant_buffers[s][i] == buffer) + { + constant_buffers[s][i] = (ID3D10Buffer*)NULL; + pipe->set_constant_buffer(pipe, s, i, NULL); + } + } + } + } + + void UnbindDepthStencilView(ID3D11DepthStencilView* view) + { + SYNCHRONIZED; + if(view == depth_stencil_view) + { + depth_stencil_view.p = NULL; + set_framebuffer(); + } + } + + void UnbindRenderTargetView(ID3D11RenderTargetView* view) + { + SYNCHRONIZED; + bool any_bound = false; + for(unsigned i = 0; i < num_render_target_views; ++i) + { + if(render_target_views[i] == view) + { + render_target_views[i].p = NULL; + any_bound = true; + } + } + if(any_bound) + set_framebuffer(); + } + + void UnbindShaderResourceView(ID3D11ShaderResourceView* view) + { + SYNCHRONIZED; + for(unsigned s = 0; s < D3D11_STAGES; ++s) + { + for(unsigned i = 0; i < num_shader_resource_views[s]; ++i) + { + if(shader_resource_views[s][i] == view) + { + shader_resource_views[s][i].p = NULL; + sampler_views[s][i] = NULL; + update_flags |= (1 << (UPDATE_VIEWS_SHIFT + s)); + } + } + } + } +#endif + +#undef SYNCHRONIZED +}; + +#if API >= 11 +/* This approach serves two purposes. + * First, we don't want to do an atomic operation to manipulate the reference + * count every time something is bound/unbound to the pipeline, since they are + * expensive. + * Fortunately, the immediate context can only be used by a single thread, so + * we don't have to use them, as long as a separate reference count is used + * (see dual_refcnt_t). + * + * Second, we want to avoid the Device -> DeviceContext -> bound DeviceChild -> Device + * garbage cycle. + * To avoid it, DeviceChild doesn't hold a reference to Device as usual, but adds + * one for each external reference count, while internal nonatomic_add_ref doesn't + * add any. + * + * Note that ideally we would to eliminate the non-atomic op too, but this is more + * complicated, since we would either need to use garbage collection and give up + * deterministic destruction (especially bad for large textures), or scan the whole + * pipeline state every time the reference count of object drops to 0, which risks + * pathological slowdowns. + * + * Since this microoptimization should matter relatively little, let's avoid it for now. + * + * Note that deferred contexts don't use this, since as a whole, they must thread-safe. + * Eliminating the atomic ops for deferred contexts seems substantially harder. + * This might be a problem if they are used in a one-shot multithreaded rendering + * fashion, where SMP cacheline bouncing on the reference count may be visible. + * + * The idea would be to attach a structure of reference counts indexed by deferred + * context id to each object. Ideally, this should be organized like ext2 block pointers. + * + * Every deferred context would get a reference count in its own cacheline. + * The external count is protected by a lock bit, and there is also a "lock bit" in each + * internal count. + * + * When the external count has to be dropped to 0, the lock bit is taken and all internal + * reference counts are scanned, taking a count of them. A flag would also be set on them. + * Deferred context manipulation would notice the flag, and update the count. + * Once the count goes to zero, the object is freed. + * + * The problem of this is that if the external reference count ping-pongs between + * zero and non-zero, the scans will take a lot of time. + * + * The idea to solve this is to compute the scans in a binary-tree like fashion, where + * each binary tree node would have a "determined bit", which would be invalidated + * by manipulations. + * + * However, all this complexity might actually be a loss in most cases, so let's just + * stick to a single atomic refcnt for now. + * + * Also, we don't even support deferred contexts yet, so this can wait. + */ +struct nonatomic_device_child_ptr_traits +{ + static void add_ref(void* p) + { + if(p) + ((GalliumD3D11DeviceChild<>*)p)->nonatomic_add_ref(); + } + + static void release(void* p) + { + if(p) + ((GalliumD3D11DeviceChild<>*)p)->nonatomic_release(); + } +}; + +struct GalliumD3D11ImmediateDeviceContext + : public GalliumD3D11DeviceContext +{ + GalliumD3D11ImmediateDeviceContext(GalliumD3D11Screen* device, pipe_context* pipe, unsigned context_flags = 0) + : GalliumD3D11DeviceContext(device, pipe, context_flags) + { + // not necessary, but tests that the API at least basically works + ClearState(); + } + + /* we do this since otherwise we would have a garbage cycle between this and the device */ + virtual ULONG STDMETHODCALLTYPE AddRef() + { + return this->device->AddRef(); + } + + virtual ULONG STDMETHODCALLTYPE Release() + { + return this->device->Release(); + } + + virtual D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType() + { + return D3D11_DEVICE_CONTEXT_IMMEDIATE; + } +}; + +static ID3D11DeviceContext* GalliumD3D11ImmediateDeviceContext_Create(GalliumD3D11Screen* device, struct pipe_context* pipe, bool owns_pipe) +{ + return new GalliumD3D11ImmediateDeviceContext(device, pipe, owns_pipe); +} + +static void GalliumD3D11ImmediateDeviceContext_RestoreGalliumState(ID3D11DeviceContext* context) +{ + ((GalliumD3D11ImmediateDeviceContext*)context)->RestoreGalliumState(); +} + +static void GalliumD3D11ImmediateDeviceContext_RestoreGalliumStateBlitOnly(ID3D11DeviceContext* context) +{ + ((GalliumD3D11ImmediateDeviceContext*)context)->RestoreGalliumStateBlitOnly(); +} + +static void GalliumD3D11ImmediateDeviceContext_Destroy(ID3D11DeviceContext* context) +{ + delete (GalliumD3D11ImmediateDeviceContext*)context; +} +#endif diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h new file mode 100644 index 00000000000..ad6b28fceb1 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h @@ -0,0 +1,715 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +template +struct GalliumD3D11DeviceChild : public GalliumPrivateDataComObject +{ + GalliumD3D11Screen* device; // must not be null + + + // if this is called, the subclass constructor must set device itself + GalliumD3D11DeviceChild() + : device(0) + {} + + GalliumD3D11DeviceChild(GalliumD3D11Screen* p_device) + { + // we store the reference count minus one in refcnt + device = p_device; + device->AddRef(); + } + + /* The purpose of this is to avoid cyclic garbage, since this won't hold + * a pointer to the device if it is only held by a pipeline binding in the immediate context + * + * TODO: we could only manipulate the device refcnt when atomic_refcnt == 0 changes, + * but this requires more complex atomic ops + */ + inline ULONG add_ref() + { + device->AddRef(); + return GalliumPrivateDataComObject::add_ref(); + } + + inline ULONG release() + { + device->Release(); + return GalliumPrivateDataComObject::release(); + } + + virtual ULONG STDMETHODCALLTYPE AddRef() + { + return add_ref(); + } + + virtual ULONG STDMETHODCALLTYPE Release() + { + return release(); + } + + virtual void STDMETHODCALLTYPE GetDevice( + __out ID3D11Device **ppDevice + ) + { + device->AddRef(); + *ppDevice = device; + } +}; + +template +struct GalliumD3D11Object : public GalliumD3D11DeviceChild +{ + Object* object; + GalliumD3D11Object(GalliumD3D11Screen* device, Object* object) + : GalliumD3D11DeviceChild(device), object(object) + {} + + virtual ~GalliumD3D11Object(); +}; + +#define IMPLEMENT_OBJECT_DTOR(name, gallium) \ +template<> \ +GalliumD3D11Object::~GalliumD3D11Object() \ +{ \ + DX10_ONLY(device->Unbind##name(this)); \ + device->immediate_pipe->delete_##gallium##_state(device->immediate_pipe, object); \ +} + +#define IMPLEMENT_VIEW_DTOR(name, gallium) \ +template<> \ +GalliumD3D11Object::~GalliumD3D11Object() \ +{ \ + DX10_ONLY(device->Unbind##name(this)); \ + pipe_##gallium##_reference(&object, 0); \ +} + +IMPLEMENT_OBJECT_DTOR(InputLayout, vertex_elements) +IMPLEMENT_OBJECT_DTOR(DepthStencilState, depth_stencil_alpha) +IMPLEMENT_OBJECT_DTOR(RasterizerState, rasterizer) +IMPLEMENT_OBJECT_DTOR(SamplerState, sampler) +IMPLEMENT_OBJECT_DTOR(BlendState, blend) +IMPLEMENT_OBJECT_DTOR(VertexShader, vs) +IMPLEMENT_OBJECT_DTOR(PixelShader, fs) +IMPLEMENT_OBJECT_DTOR(GeometryShader, gs) + +IMPLEMENT_VIEW_DTOR(ShaderResourceView, sampler_view) +IMPLEMENT_VIEW_DTOR(RenderTargetView, surface) +IMPLEMENT_VIEW_DTOR(DepthStencilView, surface) + +#if API >= 11 +// IMPLEMENT_VIEW_DTOR(UnorderedAccessView, surface); +// IMPLEMENT_OBJECT_DTOR(HullShader, tcs); +// IMPLEMENT_OBJECT_DTOR(DomainShader, tes); +// IMPLEMENT_OBJECT_DTOR(ComputeShader, cs); +#else +IMPLEMENT_OBJECT_DTOR(BlendState1, blend) +IMPLEMENT_VIEW_DTOR(ShaderResourceView1, sampler_view) +#endif + +template +struct GalliumD3D11DescribedObject : public GalliumD3D11Object +{ + Desc desc; + GalliumD3D11DescribedObject(GalliumD3D11Screen* device, Object* object, const Desc& desc) + : GalliumD3D11Object(device, object), desc(desc) + {} + + virtual void STDMETHODCALLTYPE GetDesc(Desc *pDesc) + { + memcpy(pDesc, &desc, sizeof(desc)); + } +}; + +typedef GalliumD3D11Object GalliumD3D11InputLayout; +typedef GalliumD3D11DescribedObject GalliumD3D11DepthStencilState; +typedef GalliumD3D11DescribedObject GalliumD3D11RasterizerStateBase; +typedef GalliumD3D11DescribedObject GalliumD3D11SamplerState; + +#if API >= 11 +typedef GalliumD3D11DescribedObject GalliumD3D11BlendState; +#else +typedef GalliumD3D10DescribedObject GalliumD3D10BlendStateBase; + +struct GalliumD3D10BlendState : public GalliumD3D10BlendStateBase +{ + static D3D10_BLEND_DESC convert_to_d3d10(const D3D10_BLEND_DESC1& desc1) + { + D3D10_BLEND_DESC desc; + desc.AlphaToCoverageEnable = desc1.AlphaToCoverageEnable; + desc.SrcBlend = desc1.RenderTarget[0].SrcBlend; + desc.DestBlend = desc1.RenderTarget[0].DestBlend; + desc.BlendOp = desc1.RenderTarget[0].BlendOp; + desc.SrcBlendAlpha = desc1.RenderTarget[0].SrcBlendAlpha; + desc.DestBlendAlpha = desc1.RenderTarget[0].DestBlendAlpha; + desc.BlendOpAlpha = desc1.RenderTarget[0].BlendOpAlpha; + for(unsigned i = 0; i < 8; ++i) + { + desc.BlendEnable[i] = desc1.RenderTarget[i].BlendEnable; + desc.RenderTargetWriteMask[i] = desc1.RenderTarget[i].RenderTargetWriteMask; + } + return desc; + } + + D3D10_BLEND_DESC1 desc1; + + GalliumD3D10BlendState(GalliumD3D10Screen* device, void* object, const D3D10_BLEND_DESC& desc) + : GalliumD3D10BlendStateBase(device, object, desc) + { + memset(&desc1, 0, sizeof(desc1)); + desc1.AlphaToCoverageEnable = desc.AlphaToCoverageEnable; + desc1.RenderTarget[0].SrcBlend = desc.SrcBlend; + desc1.RenderTarget[0].DestBlend = desc.DestBlend; + desc1.RenderTarget[0].BlendOp = desc.BlendOp; + desc1.RenderTarget[0].SrcBlendAlpha = desc.SrcBlendAlpha; + desc1.RenderTarget[0].DestBlendAlpha = desc.DestBlendAlpha; + desc1.RenderTarget[0].BlendOpAlpha = desc.BlendOpAlpha; + for(unsigned i = 0; i < 8; ++i) + { + desc1.RenderTarget[i].BlendEnable = desc.BlendEnable[i]; + desc1.RenderTarget[i].RenderTargetWriteMask = desc.RenderTargetWriteMask[i]; + } + } + + GalliumD3D10BlendState(GalliumD3D10Screen* device, void* object, const D3D10_BLEND_DESC1& desc) + : GalliumD3D10BlendStateBase(device, object, convert_to_d3d10(desc)), desc1(desc1) + {} + + virtual void STDMETHODCALLTYPE GetDesc1(D3D10_BLEND_DESC1 *pDesc) + { + memcpy(pDesc, &desc1, sizeof(desc1)); + } +}; +#endif + +struct GalliumD3D11RasterizerState : public GalliumD3D11RasterizerStateBase +{ + bool depth_clamp; + + GalliumD3D11RasterizerState(GalliumD3D11Screen* device, void* object, const D3D11_RASTERIZER_DESC& desc, bool depth_clamp) + : GalliumD3D11RasterizerStateBase(device, object, desc), depth_clamp(depth_clamp) + {} +}; + +template +struct GalliumD3D11Shader : public GalliumD3D11Object +{ + std::vector slot_to_resource; + std::vector slot_to_sampler; + + GalliumD3D11Shader(GalliumD3D11Screen* device, void* object) + : GalliumD3D11Object(device, object) + {} +}; + +typedef GalliumD3D11Shader GalliumD3D11VertexShader; +typedef GalliumD3D11Shader GalliumD3D11GeometryShader; +typedef GalliumD3D11Shader GalliumD3D11PixelShader; + +#if API >= 11 +/* +typedef GalliumD3D11Shader GalliumD3D11HullShader; +typedef GalliumD3D11Shader GalliumD3D11DomainShader; +typedef GalliumD3D11Shader GalliumD3D11ComputeShader; +*/ +#endif + +template +struct GalliumD3D11ResourceBase : public GalliumD3D11DeviceChild +{ + unsigned eviction_priority; + + virtual void STDMETHODCALLTYPE SetEvictionPriority( + __in unsigned EvictionPriority) + { + eviction_priority = EvictionPriority; + } + + virtual unsigned STDMETHODCALLTYPE GetEvictionPriority() + { + return eviction_priority; + } +}; + +template +struct GalliumDXGIResource : public IDXGIResource +{ + virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( + __in unsigned EvictionPriority) + { + static_cast(this)->eviction_priority = EvictionPriority; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority(unsigned* pEvictionPriority) + { + *pEvictionPriority = static_cast(this)->eviction_priority; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetDevice( + __in REFIID riid, + __out void **ppParent) + { + if(!static_cast(this)->device) + return E_NOINTERFACE; + return static_cast(this)->device->QueryInterface(riid, ppParent); + } + + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + if(!static_cast(this)->device) + return E_NOINTERFACE; + return static_cast(this)->device->QueryInterface(riid, ppParent); + } +}; + +template +struct com_traits > : public com_traits +{}; + +template +struct GalliumD3D11Resource + : public GalliumMultiComObject< + GalliumMultiPrivateDataComObject< + GalliumD3D11ResourceBase, + GalliumDXGIResource > + >, + IGalliumResource + > +{ + struct pipe_resource* resource; + std::unordered_map transfers; + float min_lod; + DXGI_USAGE dxgi_usage; + + GalliumD3D11Resource(GalliumD3D11Screen* device = 0, struct pipe_resource* resource = 0, unsigned dxgi_usage = 0) + : resource(resource), min_lod(0), dxgi_usage(dxgi_usage) + { + this->device = device; + if(device) + device->AddRef(); + this->eviction_priority = 0; + } + + ~GalliumD3D11Resource() + { + pipe_resource_reference(&resource, 0); + } + + virtual HRESULT STDMETHODCALLTYPE GetUsage( + __out DXGI_USAGE *pUsage + ) + { + *pUsage = this->dxgi_usage; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetSharedHandle(HANDLE *pSharedHandle) + { + return E_NOTIMPL; + } + + virtual struct pipe_resource* STDMETHODCALLTYPE GetGalliumResource() + { + return resource; + } +}; + +template +struct GalliumD3D11TypedResource : public GalliumD3D11Resource +{ + Desc desc; + GalliumD3D11TypedResource() {} + GalliumD3D11TypedResource(GalliumD3D11Screen* device, struct pipe_resource* resource, const Desc& desc, unsigned dxgi_usage) + : GalliumD3D11Resource(device, resource, dxgi_usage), desc(desc) + {} + virtual void STDMETHODCALLTYPE GetType( + __out D3D11_RESOURCE_DIMENSION *pResourceDimension) + { + *pResourceDimension = Dim; + } + virtual void STDMETHODCALLTYPE GetDesc(Desc *pDesc) + { + memcpy(pDesc, &desc, sizeof(desc)); + } +}; + +typedef GalliumD3D11TypedResource GalliumD3D11Texture1DBase; +typedef GalliumD3D11TypedResource GalliumD3D11Texture2DBase; +typedef GalliumD3D11TypedResource GalliumD3D11Texture3DBase; +typedef GalliumD3D11TypedResource GalliumD3D11BufferBase; + +#if API >= 11 +typedef GalliumD3D11BufferBase GalliumD3D11Buffer; +typedef GalliumD3D11Texture1DBase GalliumD3D11Texture1D; +typedef GalliumD3D11Texture2DBase GalliumD3D11Texture2D; +typedef GalliumD3D11Texture3DBase GalliumD3D11Texture3D; +#else +struct GalliumD3D10Buffer : public GalliumD3D10BufferBase +{ + GalliumD3D10Buffer(GalliumD3D10Screen* device, struct pipe_resource* resource, const D3D10_BUFFER_DESC& desc, unsigned dxgi_usage) + : GalliumD3D10BufferBase(device, resource, desc, dxgi_usage) + {} + + ~GalliumD3D10Buffer() + { + device->UnbindBuffer(this); + } + + virtual HRESULT STDMETHODCALLTYPE Map( + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out void **ppData) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, 0, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + *ppData = msr.pData; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap() + { + device->Unmap(this, 0); + } +}; + +struct GalliumD3D10Texture1D : public GalliumD3D10Texture1DBase +{ + GalliumD3D10Texture1D(GalliumD3D10Screen* device, struct pipe_resource* resource, const D3D10_TEXTURE1D_DESC& desc, unsigned dxgi_usage) + : GalliumD3D10Texture1DBase(device, resource, desc, dxgi_usage) + {} + + virtual HRESULT STDMETHODCALLTYPE Map( + __in unsigned Subresource, + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out void **ppData) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + *ppData = msr.pData; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in unsigned Subresource + ) + { + device->Unmap(this, Subresource); + } +}; + +struct GalliumD3D10Texture2D : public GalliumD3D10Texture2DBase +{ + GalliumD3D10Texture2D() {} + GalliumD3D10Texture2D(GalliumD3D10Screen* device, struct pipe_resource* resource, const D3D10_TEXTURE2D_DESC& desc, unsigned dxgi_usage) + : GalliumD3D10Texture2DBase(device, resource, desc, dxgi_usage) + {} + + virtual HRESULT STDMETHODCALLTYPE Map( + __in unsigned Subresource, + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + pMappedTex2D->pData = msr.pData; + pMappedTex2D->RowPitch = msr.RowPitch; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in unsigned Subresource + ) + { + device->Unmap(this, Subresource); + } +}; + + +struct GalliumD3D10Texture3D : public GalliumD3D10Texture3DBase +{ + GalliumD3D10Texture3D(GalliumD3D10Screen* device, struct pipe_resource* resource, const D3D10_TEXTURE3D_DESC& desc, unsigned dxgi_usage) + : GalliumD3D10Texture3DBase(device, resource, desc, dxgi_usage) + {} + + virtual HRESULT STDMETHODCALLTYPE Map( + __in unsigned Subresource, + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + pMappedTex3D->pData = msr.pData; + pMappedTex3D->RowPitch = msr.RowPitch; + pMappedTex3D->DepthPitch = msr.DepthPitch; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in unsigned Subresource + ) + { + device->Unmap(this, Subresource); + } +}; +#endif + +struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObject +{ + GalliumD3D11Surface(GalliumD3D11Screen* device, struct pipe_resource* resource, const D3D11_TEXTURE2D_DESC& desc, unsigned dxgi_usage) + { + this->device = device; + this->device->AddRef(); + this->resource = resource; + this->desc = desc; + this->dxgi_usage = dxgi_usage; + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + __out DXGI_SURFACE_DESC *pDesc) + { + pDesc->Format = this->desc.Format; + pDesc->Width = this->desc.Width; + pDesc->Height = this->desc.Height; + pDesc->SampleDesc = this->desc.SampleDesc; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + if(!device) + return E_NOINTERFACE; + return device->QueryInterface(riid, ppParent); + } + + /* TODO: somehow implement these */ + virtual HRESULT STDMETHODCALLTYPE GetDC( + BOOL Discard, + __out HDC *phdc) + { + *phdc = 0; + return E_NOTIMPL; + } + + virtual HRESULT STDMETHODCALLTYPE ReleaseDC( + __in_opt RECT *pDirtyRect) + { + return E_NOTIMPL; + } + + virtual HRESULT STDMETHODCALLTYPE Map( + __out DXGI_MAPPED_RECT *pLockedRect, + unsigned MapFlags) + { + D3D11_MAP d3d_map; + if(MapFlags & DXGI_MAP_DISCARD) + d3d_map = D3D11_MAP_WRITE_DISCARD; + else + { + if(MapFlags & DXGI_MAP_READ) + { + if(MapFlags & DXGI_MAP_WRITE) + d3d_map = D3D11_MAP_READ_WRITE; + else + d3d_map = D3D11_MAP_READ; + } + else + d3d_map = D3D11_MAP_WRITE; + } + D3D11_MAPPED_SUBRESOURCE d3d_mapped; + HRESULT hres = this->device->get_immediate_context()->Map(this, 0, d3d_map, 0, &d3d_mapped); + pLockedRect->pBits = (uint8_t*)d3d_mapped.pData; + pLockedRect->Pitch = d3d_mapped.RowPitch; + return hres; + } + + virtual HRESULT STDMETHODCALLTYPE Unmap(void) + { + this->device->get_immediate_context()->Unmap(this, 0); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetDevice( + __in REFIID riid, + __out void **ppParent) + { + if(!device) + return E_NOINTERFACE; + return device->QueryInterface(riid, ppParent); + } +}; + +template +struct GalliumD3D11View : public GalliumD3D11DescribedObject +{ + GalliumD3D11Resource<>* resource; + GalliumD3D11View(GalliumD3D11Screen* device, GalliumD3D11Resource<>* resource, Object* object, const Desc& desc) + : GalliumD3D11DescribedObject(device, object, desc), resource(resource) + { + resource->AddRef(); + } + + ~GalliumD3D11View() + { + resource->Release(); + } + + virtual void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) + { + resource->AddRef(); + *ppResource = resource; + } +}; + +typedef GalliumD3D11View GalliumD3D11DepthStencilView; +typedef GalliumD3D11View GalliumD3D11RenderTargetView; + +#if API >= 11 +typedef GalliumD3D11View GalliumD3D11ShaderResourceView; +#else +typedef GalliumD3D10View GalliumD3D10ShaderResourceViewBase; + +struct GalliumD3D10ShaderResourceView : public GalliumD3D10ShaderResourceViewBase +{ + GalliumD3D10ShaderResourceView(GalliumD3D10Screen* device, GalliumD3D10Resource<>* resource, struct pipe_sampler_view* view, const D3D10_SHADER_RESOURCE_VIEW_DESC1& desc) + : GalliumD3D10ShaderResourceViewBase(device, resource, view, desc) + {} + + virtual void STDMETHODCALLTYPE GetDesc1(D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + } + + virtual void STDMETHODCALLTYPE GetDesc(D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + } +}; +#endif + +template +struct GalliumD3D11Asynchronous : public GalliumD3D11DeviceChild +{ + struct pipe_query* query; + unsigned data_size; + + GalliumD3D11Asynchronous(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size) + : GalliumD3D11DeviceChild(device), query(query), data_size(data_size) + {} + + ~GalliumD3D11Asynchronous() + { + this->device->immediate_pipe->destroy_query(this->device->immediate_pipe, query); + } + + virtual unsigned STDMETHODCALLTYPE GetDataSize() + { + return data_size; + } + +#if API < 11 + virtual void STDMETHODCALLTYPE Begin() + { + this->device->Begin(this); + } + + virtual void STDMETHODCALLTYPE End() + { + this->device->End(this); + } + + virtual HRESULT STDMETHODCALLTYPE GetData( + __out_bcount(DataSize) void *pData, + __in unsigned DataSize, + __in unsigned GetDataFlags) + { + return this->device->GetData(this, pData, DataSize, GetDataFlags); + } +#endif +}; + +template +struct GalliumD3D11QueryOrPredicate : public GalliumD3D11Asynchronous +{ + D3D11_QUERY_DESC desc; + GalliumD3D11QueryOrPredicate(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_QUERY_DESC& desc) + : GalliumD3D11Asynchronous(device, query, data_size), desc(desc) + {} + + virtual void STDMETHODCALLTYPE GetDesc( + __out D3D11_QUERY_DESC *pDesc) + { + *pDesc = desc; + } +}; + +struct GalliumD3D11Query : public GalliumD3D11QueryOrPredicate +{ + GalliumD3D11Query(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_QUERY_DESC& desc) + : GalliumD3D11QueryOrPredicate(device, query, data_size, desc) + {} +}; + +struct GalliumD3D11Predicate : public GalliumD3D11QueryOrPredicate +{ + GalliumD3D11Predicate(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_QUERY_DESC& desc) + : GalliumD3D11QueryOrPredicate(device, query, data_size, desc) + {} + + ~GalliumD3D11Predicate() + { + DX10_ONLY(device->UnbindPredicate(this)); + } +}; + +struct GalliumD3D11Counter : public GalliumD3D11Asynchronous +{ + D3D11_COUNTER_DESC desc; + GalliumD3D11Counter(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_COUNTER_DESC& desc) + : GalliumD3D11Asynchronous(device, query, data_size), desc(desc) + {} + + virtual void STDMETHODCALLTYPE GetDesc( + __out D3D11_COUNTER_DESC *pDesc) + { + *pDesc = desc; + } +}; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h new file mode 100644 index 00000000000..50039e388d5 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -0,0 +1,1447 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +/* These cap sets are much more correct than the ones in u_caps.c */ +/* TODO: it seems cube levels should be the same as 2D levels */ + +/* DX 9_1 */ +static unsigned caps_dx_9_1[] = { + UTIL_CHECK_INT(MAX_RENDER_TARGETS, 1), + UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12), /* 2048 */ + UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 8), /* 256 */ + UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ + UTIL_CHECK_TERMINATE +}; + +/* DX 9_2 */ +static unsigned caps_dx_9_2[] = { + UTIL_CHECK_CAP(OCCLUSION_QUERY), + UTIL_CHECK_CAP(TWO_SIDED_STENCIL), + UTIL_CHECK_CAP(TEXTURE_MIRROR_CLAMP), + UTIL_CHECK_CAP(BLEND_EQUATION_SEPARATE), + UTIL_CHECK_INT(MAX_RENDER_TARGETS, 1), + UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12), /* 2048 */ + UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ + UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ + UTIL_CHECK_TERMINATE +}; + +/* DX 9_3 */ +static unsigned caps_dx_9_3[] = { + UTIL_CHECK_CAP(OCCLUSION_QUERY), + UTIL_CHECK_CAP(TWO_SIDED_STENCIL), + UTIL_CHECK_CAP(TEXTURE_MIRROR_CLAMP), + UTIL_CHECK_CAP(BLEND_EQUATION_SEPARATE), + UTIL_CHECK_CAP(SM3), + //UTIL_CHECK_CAP(INSTANCING), + UTIL_CHECK_CAP(OCCLUSION_QUERY), + UTIL_CHECK_INT(MAX_RENDER_TARGETS, 4), + UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 13), /* 4096 */ + UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ + UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ + UTIL_CHECK_TERMINATE +}; + + +// this is called "screen" because in the D3D10 case it's only part of the device +template +struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen +{ + D3D_FEATURE_LEVEL feature_level; + int format_support[PIPE_FORMAT_COUNT]; + unsigned creation_flags; + unsigned exception_mode; + maybe_mutex_t mutex; + +/* TODO: Direct3D 11 specifies that fine-grained locking should be used if the driver supports it. + * Right now, I don't trust Gallium drivers to get this right. + */ +#define SYNCHRONIZED lock_t > lock_(mutex) + + GalliumD3D11ScreenImpl(struct pipe_screen* screen, struct pipe_context* immediate_pipe, BOOL owns_immediate_pipe,unsigned creation_flags, IDXGIAdapter* adapter) + : GalliumD3D11Screen(screen, immediate_pipe, adapter), creation_flags(creation_flags) + { + memset(&screen_caps, 0, sizeof(screen_caps)); + screen_caps.gs = screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0; + screen_caps.so = !!screen->get_param(screen, PIPE_CAP_STREAM_OUTPUT); + screen_caps.queries = screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY); + screen_caps.render_condition = screen_caps.queries; + for(unsigned i = 0; i < PIPE_SHADER_TYPES; ++i) + screen_caps.constant_buffers[i] = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONST_BUFFERS); + screen_caps.stages = 0; + for(unsigned i = 0; i < PIPE_SHADER_TYPES; ++i) + { + if(!screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INSTRUCTIONS)) + break; + screen_caps.stages = i + 1; + } + + memset(format_support, 0xff, sizeof(format_support)); + + float default_level; + /* don't even attempt to autodetect D3D10 level support, since it's just not fully implemented yet */ + if(util_check_caps(screen, caps_dx_9_3)) + default_level = 9.3; + else if(util_check_caps(screen, caps_dx_9_2)) + default_level = 9.2; + else if(util_check_caps(screen, caps_dx_9_1)) + default_level = 9.1; + else + { + _debug_printf("Warning: driver does not even meet D3D_FEATURE_LEVEL_9_1 features, advertising it anyway!\n"); + default_level = 9.1; + } + + char default_level_name[64]; + sprintf(default_level_name, "%.1f", default_level); + float feature_level_number = atof(debug_get_option("D3D11_FEATURE_LEVEL", default_level_name)); + if(!feature_level_number) + feature_level_number = default_level; + +#if API >= 11 + if(feature_level_number >= 11.0f) + feature_level = D3D_FEATURE_LEVEL_11_0; + else +#endif + if(feature_level_number >= 10.1f) + feature_level = D3D_FEATURE_LEVEL_10_1; + else if(feature_level_number >= 10.0f) + feature_level = D3D_FEATURE_LEVEL_10_0; + else if(feature_level_number >= 9.3f) + feature_level = D3D_FEATURE_LEVEL_9_3; + else if(feature_level_number >= 9.2f) + feature_level = D3D_FEATURE_LEVEL_9_2; + else + feature_level = D3D_FEATURE_LEVEL_9_1; + +#if API >= 11 + immediate_context = GalliumD3D11ImmediateDeviceContext_Create(this, immediate_pipe, owns_immediate_pipe); +#endif + } + + ~GalliumD3D11ScreenImpl() + { +#if API >= 11 + GalliumD3D11ImmediateDeviceContext_Destroy(immediate_context); +#endif + } + + virtual D3D_FEATURE_LEVEL STDMETHODCALLTYPE GetFeatureLevel(void) + { + return feature_level; + } + + virtual unsigned STDMETHODCALLTYPE GetCreationFlags(void) + { + return creation_flags; + } + + virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason(void) + { + return S_OK; + } + +#if API >= 11 + virtual void STDMETHODCALLTYPE GetImmediateContext( + __out ID3D11DeviceContext **ppImmediateContext) + { + immediate_context->AddRef(); + *ppImmediateContext = immediate_context; + } +#endif + + virtual HRESULT STDMETHODCALLTYPE SetExceptionMode(unsigned RaiseFlags) + { + exception_mode = RaiseFlags; + return S_OK; + } + + virtual unsigned STDMETHODCALLTYPE GetExceptionMode(void) + { + return exception_mode; + } + + virtual HRESULT STDMETHODCALLTYPE CheckCounter( + __in const D3D11_COUNTER_DESC *pDesc, + __out D3D11_COUNTER_TYPE *pType, + __out unsigned *pActiveCounters, + __out_ecount_opt(*pNameLength) LPSTR szName, + __inout_opt unsigned *pNameLength, + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + __inout_opt unsigned *pUnitsLength, + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + __inout_opt unsigned *pDescriptionLength) + { + return E_NOTIMPL; + } + + virtual void STDMETHODCALLTYPE CheckCounterInfo( + __out D3D11_COUNTER_INFO *pCounterInfo) + { + /* none supported at the moment */ + pCounterInfo->LastDeviceDependentCounter = (D3D11_COUNTER)0; + pCounterInfo->NumSimultaneousCounters = 0; + pCounterInfo->NumDetectableParallelUnits = 1; + } + +#if API >= 11 + virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( + D3D11_FEATURE Feature, + __out_bcount(FeatureSupportDataSize) void *pFeatureSupportData, + unsigned FeatureSupportDataSize) + { + SYNCHRONIZED; + + switch(Feature) + { + case D3D11_FEATURE_THREADING: + { + D3D11_FEATURE_DATA_THREADING* data = (D3D11_FEATURE_DATA_THREADING*)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(*data)) + return E_INVALIDARG; + + data->DriverCommandLists = FALSE; + data->DriverConcurrentCreates = FALSE; + return S_OK; + } + case D3D11_FEATURE_DOUBLES: + { + D3D11_FEATURE_DATA_DOUBLES* data = (D3D11_FEATURE_DATA_DOUBLES*)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(*data)) + return E_INVALIDARG; + + data->DoublePrecisionFloatShaderOps = FALSE; + return S_OK; + } + case D3D11_FEATURE_FORMAT_SUPPORT: + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT* data = (D3D11_FEATURE_DATA_FORMAT_SUPPORT*)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(*data)) + return E_INVALIDARG; + + return this->CheckFormatSupport(data->InFormat, &data->OutFormatSupport); + } + case D3D11_FEATURE_FORMAT_SUPPORT2: + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT* data = (D3D11_FEATURE_DATA_FORMAT_SUPPORT*)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(*data)) + return E_INVALIDARG; + + data->OutFormatSupport = 0; + /* TODO: should this be S_OK? */ + return E_INVALIDARG; + } + case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS: + { + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS* data = (D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS*)pFeatureSupportData; + if(FeatureSupportDataSize != sizeof(*data)) + return E_INVALIDARG; + + data->ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = FALSE; + return S_OK; + } + default: + return E_INVALIDARG; + } + } +#endif + + virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport( + DXGI_FORMAT Format, + unsigned *pFormatSupport + ) + { + SYNCHRONIZED; + + /* TODO: MSAA, advanced features */ + pipe_format format = dxgi_to_pipe_format[Format]; + if(!format) + return E_INVALIDARG; + + int support = format_support[format]; + if(support < 0) + { + support = 0; + unsigned buffer = D3D11_FORMAT_SUPPORT_BUFFER | D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER | D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER; + unsigned sampler_view = D3D11_FORMAT_SUPPORT_SHADER_SAMPLE | D3D11_FORMAT_SUPPORT_MIP | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN; + if(util_format_is_depth_or_stencil(format)) + sampler_view |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON; + + /* TODO: do this properly when Gallium drivers actually support index/vertex format queries */ + if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_VERTEX_BUFFER, 0) + || (screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_INDEX_BUFFER, 0) + || format == PIPE_FORMAT_R8_UNORM)) + support |= buffer; + if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_STREAM_OUTPUT, 0)) + support |= buffer | D3D11_FORMAT_SUPPORT_SO_BUFFER; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_1D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE1D | sampler_view; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | sampler_view; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_CUBE, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | sampler_view; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_3D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE3D | sampler_view; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET, 0)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) + support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_DEPTH_STENCIL; + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET, 0)) + support |= D3D11_FORMAT_SUPPORT_DISPLAY; + format_support[format] = support; + } + *pFormatSupport = support; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( + DXGI_FORMAT Format, + unsigned SampleCount, + unsigned *pNumQualityLevels + ) + { + SYNCHRONIZED; + + *pNumQualityLevels = 0; + return S_OK; + } + + template + bool convert_blend_state(T& to, const U& from, unsigned BlendEnable, unsigned RenderTargetWriteMask) + { + if(invalid(0 + || from.SrcBlend >= D3D11_BLEND_COUNT + || from.SrcBlendAlpha >= D3D11_BLEND_COUNT + || from.DestBlend >= D3D11_BLEND_COUNT + || from.DestBlendAlpha >= D3D11_BLEND_COUNT + || from.BlendOp >= 6 + || from.BlendOpAlpha >= 6 + || !from.BlendOp + || !from.BlendOpAlpha + )) + return false; + + to.blend_enable = BlendEnable; + + to.rgb_func = from.BlendOp - 1; + to.alpha_func = from.BlendOpAlpha - 1; + + to.rgb_src_factor = d3d11_to_pipe_blend[from.SrcBlend]; + to.alpha_src_factor = d3d11_to_pipe_blend[from.SrcBlendAlpha]; + to.rgb_dst_factor = d3d11_to_pipe_blend[from.DestBlend]; + to.alpha_dst_factor = d3d11_to_pipe_blend[from.DestBlendAlpha]; + + to.colormask = RenderTargetWriteMask & 0xf; + return true; + } + +#if API >= 11 + virtual HRESULT STDMETHODCALLTYPE CreateBlendState( + __in const D3D11_BLEND_DESC *pBlendStateDesc, + __out_opt ID3D11BlendState **ppBlendState + ) +#else + virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( + __in const D3D10_BLEND_DESC1 *pBlendStateDesc, + __out_opt ID3D10BlendState1 **ppBlendState + ) +#endif + { + SYNCHRONIZED; + + pipe_blend_state state; + memset(&state, 0, sizeof(state)); + state.alpha_to_coverage = !!pBlendStateDesc->AlphaToCoverageEnable; + state.independent_blend_enable = !!pBlendStateDesc->IndependentBlendEnable; + assert(PIPE_MAX_COLOR_BUFS >= 8); + for(unsigned i = 0; i < 8; ++i) + { + if(!convert_blend_state( + state.rt[i], + pBlendStateDesc->RenderTarget[i], + pBlendStateDesc->RenderTarget[i].BlendEnable, + pBlendStateDesc->RenderTarget[i].RenderTargetWriteMask)) + return E_INVALIDARG; + } + + if(!ppBlendState) + return S_FALSE; + + void* object = immediate_pipe->create_blend_state(immediate_pipe, &state); + if(!object) + return E_FAIL; + + *ppBlendState = new GalliumD3D11BlendState(this, object, *pBlendStateDesc); + return S_OK; + } + +#if API < 11 + virtual HRESULT STDMETHODCALLTYPE CreateBlendState( + __in const D3D10_BLEND_DESC *pBlendStateDesc, + __out_opt ID3D10BlendState **ppBlendState + ) + { + SYNCHRONIZED; + + pipe_blend_state state; + memset(&state, 0, sizeof(state)); + state.alpha_to_coverage = !!pBlendStateDesc->AlphaToCoverageEnable; + assert(PIPE_MAX_COLOR_BUFS >= 8); + for(unsigned i = 0; i < 8; ++i) + { + if(!convert_blend_state( + state.rt[i], + *pBlendStateDesc, + pBlendStateDesc->BlendEnable[i], + pBlendStateDesc->RenderTargetWriteMask[i])) + return E_INVALIDARG; + } + + for(unsigned i = 1; i < 8; ++i) + { + if(memcmp(&state.rt[0], &state.rt[i], sizeof(state.rt[0]))) + { + state.independent_blend_enable = TRUE; + break; + } + } + + void* object = immediate_pipe->create_blend_state(immediate_pipe, &state); + if(!object) + return E_FAIL; + + *ppBlendState = new GalliumD3D11BlendState(this, object, *pBlendStateDesc); + return S_OK; + } +#endif + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( + __in const D3D11_DEPTH_STENCIL_DESC *pDepthStencilStateDesc, + __out_opt ID3D11DepthStencilState **ppDepthStencilState + ) + { + SYNCHRONIZED; + + pipe_depth_stencil_alpha_state state; + memset(&state, 0, sizeof(state)); + state.depth.enabled = !!pDepthStencilStateDesc->DepthEnable; + state.depth.writemask = pDepthStencilStateDesc->DepthWriteMask; + state.depth.func = pDepthStencilStateDesc->DepthFunc - 1; + state.stencil[0].enabled = !!pDepthStencilStateDesc->StencilEnable; + state.stencil[0].writemask = pDepthStencilStateDesc->StencilWriteMask; + state.stencil[0].valuemask = pDepthStencilStateDesc->StencilReadMask; + state.stencil[0].zpass_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->FrontFace.StencilPassOp]; + state.stencil[0].fail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->FrontFace.StencilFailOp]; + state.stencil[0].zfail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->FrontFace.StencilDepthFailOp]; + state.stencil[0].func = pDepthStencilStateDesc->FrontFace.StencilFunc - 1; + state.stencil[1].enabled = !!pDepthStencilStateDesc->StencilEnable; + state.stencil[1].writemask = pDepthStencilStateDesc->StencilWriteMask; + state.stencil[1].valuemask = pDepthStencilStateDesc->StencilReadMask; + state.stencil[1].zpass_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->BackFace.StencilPassOp]; + state.stencil[1].fail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->BackFace.StencilFailOp]; + state.stencil[1].zfail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->BackFace.StencilDepthFailOp]; + state.stencil[1].func = pDepthStencilStateDesc->BackFace.StencilFunc - 1; + + if(!ppDepthStencilState) + return S_FALSE; + + void* object = immediate_pipe->create_depth_stencil_alpha_state(immediate_pipe, &state); + if(!object) + return E_FAIL; + + *ppDepthStencilState = new GalliumD3D11DepthStencilState(this, object, *pDepthStencilStateDesc); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( + __in const D3D11_RASTERIZER_DESC *pRasterizerDesc, + __out_opt ID3D11RasterizerState **ppRasterizerState) + { + SYNCHRONIZED; + + pipe_rasterizer_state state; + memset(&state, 0, sizeof(state)); + state.gl_rasterization_rules = 1; /* D3D10/11 use GL rules */ + state.fill_front = state.fill_back = (pRasterizerDesc->FillMode == D3D11_FILL_WIREFRAME) ? PIPE_POLYGON_MODE_LINE : PIPE_POLYGON_MODE_FILL; + if(pRasterizerDesc->CullMode == D3D11_CULL_FRONT) + state.cull_face = PIPE_FACE_FRONT; + else if(pRasterizerDesc->CullMode == D3D11_CULL_BACK) + state.cull_face = PIPE_FACE_BACK; + else + state.cull_face = PIPE_FACE_NONE; + state.front_ccw = !!pRasterizerDesc->FrontCounterClockwise; + /* TODO: is this correct? */ + /* TODO: we are ignoring DepthBiasClamp! */ + state.offset_tri = state.offset_line = state.offset_point = pRasterizerDesc->SlopeScaledDepthBias || pRasterizerDesc->DepthBias; + state.offset_scale = pRasterizerDesc->SlopeScaledDepthBias; + state.offset_units = pRasterizerDesc->DepthBias; + state.scissor = !!pRasterizerDesc->ScissorEnable; + state.multisample = !!pRasterizerDesc->MultisampleEnable; + state.line_smooth = !!pRasterizerDesc->AntialiasedLineEnable; + + /* TODO: is this correct? */ + state.point_quad_rasterization = 1; + + if(!ppRasterizerState) + return S_FALSE; + + void* object = immediate_pipe->create_rasterizer_state(immediate_pipe, &state); + if(!object) + return E_FAIL; + + *ppRasterizerState = new GalliumD3D11RasterizerState(this, object, *pRasterizerDesc, !pRasterizerDesc->DepthClipEnable); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( + __in const D3D11_SAMPLER_DESC *pSamplerDesc, + __out_opt ID3D11SamplerState **ppSamplerState) + { + SYNCHRONIZED; + + pipe_sampler_state state; + memset(&state, 0, sizeof(state)); + state.normalized_coords = 1; + state.min_mip_filter = (pSamplerDesc->Filter & 1); + state.mag_img_filter = ((pSamplerDesc->Filter >> 2) & 1); + state.min_img_filter = ((pSamplerDesc->Filter >> 4) & 1); + if(pSamplerDesc->Filter & 0x40) + state.max_anisotropy = pSamplerDesc->MaxAnisotropy; + if(pSamplerDesc->Filter & 0x80) + { + state.compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE; + state.compare_func = pSamplerDesc->ComparisonFunc; + } + state.wrap_s = d3d11_to_pipe_wrap[pSamplerDesc->AddressU]; + state.wrap_t = d3d11_to_pipe_wrap[pSamplerDesc->AddressV]; + state.wrap_r = d3d11_to_pipe_wrap[pSamplerDesc->AddressW]; + state.lod_bias = pSamplerDesc->MipLODBias; + memcpy(state.border_color, pSamplerDesc->BorderColor, sizeof(state.border_color)); + state.min_lod = pSamplerDesc->MinLOD; + state.max_lod = pSamplerDesc->MaxLOD; + + if(!ppSamplerState) + return S_FALSE; + + void* object = immediate_pipe->create_sampler_state(immediate_pipe, &state); + if(!object) + return E_FAIL; + + *ppSamplerState = new GalliumD3D11SamplerState(this, object, *pSamplerDesc); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( + __in_ecount(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + __in_range(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) unsigned NumElements, + __in const void *pShaderBytecodeWithInputSignature, + __in SIZE_T BytecodeLength, + __out_opt ID3D11InputLayout **ppInputLayout) + { + SYNCHRONIZED; + + if(NumElements > D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) + return E_INVALIDARG; + assert(D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT <= PIPE_MAX_ATTRIBS); + + // putting semantics matching in the core API seems to be a (minor) design mistake + + struct dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecodeWithInputSignature, BytecodeLength, false); + D3D11_SIGNATURE_PARAMETER_DESC* params; + unsigned num_params = dxbc_parse_signature(sig, ¶ms); + + typedef std::unordered_map, unsigned> semantic_to_idx_map_t; + semantic_to_idx_map_t semantic_to_idx_map; + for(unsigned i = 0; i < NumElements; ++i) + semantic_to_idx_map[std::make_pair(c_string(pInputElementDescs[i].SemanticName), pInputElementDescs[i].SemanticIndex)] = i; + + struct pipe_vertex_element elements[D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT]; + + unsigned num_params_to_use = std::min(num_params, (unsigned)D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT); + for(unsigned i = 0; i < num_params_to_use; ++i) + { + int idx = -1; + semantic_to_idx_map_t::iterator iter = semantic_to_idx_map.find(std::make_pair(c_string(params[i].SemanticName), params[i].SemanticIndex)); + if(iter != semantic_to_idx_map.end()) + idx = iter->second; + + // TODO: I kind of doubt Gallium drivers will like null elements; should we do something about it, either here, in the interface, or in the drivers? + // TODO: also, in which cases should we return errors? (i.e. duplicate semantics in vs, duplicate semantics in layout, unmatched semantic in vs, unmatched semantic in layout) + memset(&elements[i], 0, sizeof(elements[i])); + if(idx >= 0) + { + elements[i].src_format = dxgi_to_pipe_format[pInputElementDescs[idx].Format]; + elements[i].src_offset = pInputElementDescs[idx].AlignedByteOffset; + elements[i].vertex_buffer_index = pInputElementDescs[idx].InputSlot; + elements[i].instance_divisor = pInputElementDescs[idx].InstanceDataStepRate; + } + } + + free(params); + + if(!ppInputLayout) + return S_FALSE; + + void* object = immediate_pipe->create_vertex_elements_state(immediate_pipe, num_params_to_use, elements); + if(!object) + return E_FAIL; + + *ppInputLayout = new GalliumD3D11InputLayout(this, object); + return S_OK; + } + + static unsigned d3d11_to_pipe_bind_flags(unsigned BindFlags) + { + unsigned bind = 0; + if(BindFlags & D3D11_BIND_VERTEX_BUFFER) + bind |= PIPE_BIND_VERTEX_BUFFER; + if(BindFlags & D3D11_BIND_INDEX_BUFFER) + bind |= PIPE_BIND_INDEX_BUFFER; + if(BindFlags & D3D11_BIND_CONSTANT_BUFFER) + bind |= PIPE_BIND_CONSTANT_BUFFER; + if(BindFlags & D3D11_BIND_SHADER_RESOURCE) + bind |= PIPE_BIND_SAMPLER_VIEW; + if(BindFlags & D3D11_BIND_STREAM_OUTPUT) + bind |= PIPE_BIND_STREAM_OUTPUT; + if(BindFlags & D3D11_BIND_RENDER_TARGET) + bind |= PIPE_BIND_RENDER_TARGET; + if(BindFlags & D3D11_BIND_DEPTH_STENCIL) + bind |= PIPE_BIND_DEPTH_STENCIL; + return bind; + } + + inline HRESULT create_resource( + pipe_texture_target target, + unsigned Width, + unsigned Height, + unsigned Depth, + unsigned MipLevels, + unsigned ArraySize, + DXGI_FORMAT Format, + const DXGI_SAMPLE_DESC* SampleDesc, + D3D11_USAGE Usage, + unsigned BindFlags, + unsigned CPUAccessFlags, + unsigned MiscFlags, + const D3D11_SUBRESOURCE_DATA *pInitialData, + DXGI_USAGE dxgi_usage, + struct pipe_resource** ppresource + ) + { + if(invalid(Format >= DXGI_FORMAT_COUNT)) + return E_INVALIDARG; + if(MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE) + { + if(target != PIPE_TEXTURE_2D) + return E_INVALIDARG; + target = PIPE_TEXTURE_CUBE; + + if(ArraySize != 6) + return E_NOTIMPL; + } + else + { + if(ArraySize > 1) + return E_NOTIMPL; + ArraySize = 1; + } + /* TODO: msaa */ + struct pipe_resource templat; + memset(&templat, 0, sizeof(templat)); + templat.target = target; + templat.width0 = Width; + templat.height0 = Height; + templat.depth0 = Depth; + templat.last_level = MipLevels ? (MipLevels - 1) : 0; + templat.format = dxgi_to_pipe_format[Format]; + templat.bind = d3d11_to_pipe_bind_flags(BindFlags); + if(CPUAccessFlags & D3D11_CPU_ACCESS_READ) + templat.bind |= PIPE_BIND_TRANSFER_READ; + if(CPUAccessFlags & D3D11_CPU_ACCESS_WRITE) + templat.bind |= PIPE_BIND_TRANSFER_WRITE; + if(MiscFlags & D3D11_RESOURCE_MISC_SHARED) + templat.bind |= PIPE_BIND_SHARED; + if(MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE) + templat.bind |= PIPE_BIND_TRANSFER_READ | PIPE_BIND_TRANSFER_WRITE; + if(dxgi_usage & DXGI_USAGE_BACK_BUFFER) + templat.bind |= PIPE_BIND_DISPLAY_TARGET; + templat.usage = d3d11_to_pipe_usage[Usage]; + if(invalid(!templat.format)) + return E_NOTIMPL; + + if(!ppresource) + return S_FALSE; + + struct pipe_resource* resource = screen->resource_create(screen, &templat); + if(!resource) + return E_FAIL; + if(pInitialData) + { + for(unsigned slice = 0; slice < ArraySize; ++slice) + { + for(unsigned level = 0; level <= templat.last_level; ++level) + { + struct pipe_subresource sr; + sr.level = level; + sr.face = slice; + struct pipe_box box; + box.x = box.y = box.z = 0; + box.width = u_minify(Width, level); + box.height = u_minify(Height, level); + box.depth = u_minify(Depth, level); + immediate_pipe->transfer_inline_write(immediate_pipe, resource, sr, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, pInitialData->pSysMem, pInitialData->SysMemPitch, pInitialData->SysMemSlicePitch); + ++pInitialData; + } + } + } + *ppresource = resource; + return S_OK; + } + + static unsigned d3d_to_dxgi_usage(unsigned bind, unsigned misc) + { + unsigned dxgi_usage = 0; + if(bind |= D3D11_BIND_RENDER_TARGET) + dxgi_usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT; + if(bind & D3D11_BIND_SHADER_RESOURCE) + dxgi_usage |= DXGI_USAGE_SHADER_INPUT; +#if API >= 11 + if(bind & D3D11_BIND_UNORDERED_ACCESS) + dxgi_usage |= DXGI_USAGE_UNORDERED_ACCESS; +#endif + if(misc & D3D11_RESOURCE_MISC_SHARED) + dxgi_usage |= DXGI_USAGE_SHARED; + return dxgi_usage; + } + + virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( + __in const D3D11_TEXTURE1D_DESC *pDesc, + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Texture1D **ppTexture1D) + { + SYNCHRONIZED; + + struct pipe_resource* resource; + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); + HRESULT hr = create_resource(PIPE_TEXTURE_1D, pDesc->Width, 1, 1, pDesc->MipLevels, pDesc->ArraySize, pDesc->Format, 0, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppTexture1D ? &resource : 0); + if(hr != S_OK) + return hr; + *ppTexture1D = new GalliumD3D11Texture1D(this, resource, *pDesc, dxgi_usage); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( + __in const D3D11_TEXTURE2D_DESC *pDesc, + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Texture2D **ppTexture2D) + { + SYNCHRONIZED; + + struct pipe_resource* resource; + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); + HRESULT hr = create_resource(PIPE_TEXTURE_2D, pDesc->Width, pDesc->Height, 1, pDesc->MipLevels, pDesc->ArraySize, pDesc->Format, &pDesc->SampleDesc, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppTexture2D ? &resource : 0); + if(hr != S_OK) + return hr; + if(pDesc->MipLevels == 1 && pDesc->ArraySize == 1) + *ppTexture2D = new GalliumD3D11Surface(this, resource, *pDesc, dxgi_usage); + else + *ppTexture2D = new GalliumD3D11Texture2D(this, resource, *pDesc, dxgi_usage); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( + __in const D3D11_TEXTURE3D_DESC *pDesc, + __in_xcount_opt(pDesc->MipLevels) const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Texture3D **ppTexture3D) + { + SYNCHRONIZED; + + struct pipe_resource* resource; + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); + HRESULT hr = create_resource(PIPE_TEXTURE_3D, pDesc->Width, pDesc->Height, pDesc->Depth, pDesc->MipLevels, 1, pDesc->Format, 0, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppTexture3D ? &resource : 0); + if(hr != S_OK) + return hr; + *ppTexture3D = new GalliumD3D11Texture3D(this, resource, *pDesc, dxgi_usage); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateBuffer( + __in const D3D11_BUFFER_DESC *pDesc, + __in_opt const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Buffer **ppBuffer) + { + SYNCHRONIZED; + +#if API >= 11 + if(pDesc->StructureByteStride > 1) + return E_NOTIMPL; +#endif + struct pipe_resource* resource; + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); + HRESULT hr = create_resource(PIPE_BUFFER, pDesc->ByteWidth, 1, 1, 1, 1, DXGI_FORMAT_R8_UNORM, 0, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppBuffer ? &resource : 0); + if(hr != S_OK) + return hr; + *ppBuffer = new GalliumD3D11Buffer(this, resource, *pDesc, dxgi_usage); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE OpenGalliumResource( + __in struct pipe_resource* resource, + __out IUnknown** dxgi_resource) + { + SYNCHRONIZED; + + /* TODO: maybe support others */ + assert(resource->target == PIPE_TEXTURE_2D); + *dxgi_resource = 0; + D3D11_TEXTURE2D_DESC desc; + memset(&desc, 0, sizeof(desc)); + desc.Width = resource->width0; + desc.Height = resource->height0; + init_pipe_to_dxgi_format(); + desc.Format = pipe_to_dxgi_format[resource->format]; + desc.SampleDesc.Count = resource->nr_samples; + desc.SampleDesc.Quality = 0; + desc.ArraySize = 1; + desc.MipLevels = resource->last_level + 1; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + if(resource->bind & PIPE_BIND_RENDER_TARGET) + desc.BindFlags |= D3D11_BIND_RENDER_TARGET; + if(resource->bind & PIPE_BIND_DEPTH_STENCIL) + desc.BindFlags |= D3D11_BIND_DEPTH_STENCIL; + if(resource->bind & PIPE_BIND_SAMPLER_VIEW) + desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; + if(resource->bind & PIPE_BIND_SHARED) + desc.MiscFlags |= D3D11_RESOURCE_MISC_SHARED; + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc.BindFlags, desc.MiscFlags); + if(desc.MipLevels == 1 && desc.ArraySize == 1) + *dxgi_resource = (ID3D11Texture2D*)new GalliumD3D11Surface(this, resource, desc, dxgi_usage); + else + *dxgi_resource = (ID3D11Texture2D*)new GalliumD3D11Texture2D(this, resource, desc, dxgi_usage); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateSurface( + __in const DXGI_SURFACE_DESC *pDesc, + unsigned NumSurfaces, + DXGI_USAGE Usage, + __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, + __out IDXGISurface **ppSurface) + { + SYNCHRONIZED; + + D3D11_TEXTURE2D_DESC desc; + memset(&desc, 0, sizeof(desc)); + + struct pipe_resource* resource; + desc.Width = pDesc->Width; + desc.Height = pDesc->Height; + desc.Format = pDesc->Format; + desc.SampleDesc = pDesc->SampleDesc; + desc.ArraySize = NumSurfaces; + desc.MipLevels = 1; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + if(Usage & DXGI_USAGE_RENDER_TARGET_OUTPUT) + desc.BindFlags |= D3D11_BIND_RENDER_TARGET; + if(Usage & DXGI_USAGE_SHADER_INPUT) + desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; +#if API >= 11 + if(Usage & DXGI_USAGE_UNORDERED_ACCESS) + desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS; +#endif + if(Usage & DXGI_USAGE_SHARED) + desc.MiscFlags |= D3D11_RESOURCE_MISC_SHARED; + HRESULT hr = create_resource(PIPE_TEXTURE_2D, pDesc->Width, pDesc->Height, 1, 1, NumSurfaces, pDesc->Format, &pDesc->SampleDesc, D3D11_USAGE_DEFAULT, desc.BindFlags, D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE, desc.MiscFlags, 0, Usage, &resource); + if(hr != S_OK) + return hr; + *ppSurface = new GalliumD3D11Surface(this, resource, desc, Usage); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( + __in ID3D11Resource *pResource, + __in_opt const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + __out_opt ID3D11ShaderResourceView **ppSRView) + { +#if API >= 11 + D3D11_SHADER_RESOURCE_VIEW_DESC def_desc; +#else + if(pDesc->ViewDimension == D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY) + return E_INVALIDARG; + D3D10_SHADER_RESOURCE_VIEW_DESC1 desc1; + memset(&desc1, 0, sizeof(desc1)); + memcpy(&desc1, pDesc, sizeof(*pDesc)); + return CreateShaderResourceView1(pResource, &desc1, (ID3D10ShaderResourceView1**)ppSRView); + } + + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( + __in ID3D11Resource *pResource, + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + __out_opt ID3D10ShaderResourceView1 **ppSRView) + { + D3D10_SHADER_RESOURCE_VIEW_DESC1 def_desc; +#endif + SYNCHRONIZED; + + if(!pDesc) + { + struct pipe_resource* resource = ((GalliumD3D11Resource<>*)pResource)->resource; + init_pipe_to_dxgi_format(); + memset(&def_desc, 0, sizeof(def_desc)); + def_desc.Format = pipe_to_dxgi_format[resource->format]; + switch(resource->target) + { + case PIPE_BUFFER: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; + def_desc.Buffer.ElementWidth = 1; +#if API >= 11 + def_desc.Buffer.NumElements = resource->width0; +#endif + break; + case PIPE_TEXTURE_1D: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D; + def_desc.Texture1D.MipLevels = resource->last_level + 1; + break; + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + def_desc.Texture2D.MipLevels = resource->last_level + 1; + break; + case PIPE_TEXTURE_3D: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; + def_desc.Texture3D.MipLevels = resource->last_level + 1; + break; + case PIPE_TEXTURE_CUBE: + def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; + def_desc.TextureCube.MipLevels = resource->last_level + 1; + break; + default: + return E_INVALIDARG; + } + pDesc = &def_desc; + } + + struct pipe_sampler_view templat; + memset(&templat, 0, sizeof(templat)); + if(invalid(Format >= DXGI_FORMAT_COUNT)) + return E_INVALIDARG; + templat.format = dxgi_to_pipe_format[pDesc->Format]; + if(!templat.format) + return E_NOTIMPL; + templat.swizzle_r = PIPE_SWIZZLE_RED; + templat.swizzle_g = PIPE_SWIZZLE_GREEN; + templat.swizzle_b = PIPE_SWIZZLE_BLUE; + templat.swizzle_a = PIPE_SWIZZLE_ALPHA; + + templat.texture = ((GalliumD3D11Resource<>*)pResource)->resource; + switch(pDesc->ViewDimension) + { + case D3D11_SRV_DIMENSION_TEXTURE1D: + case D3D11_SRV_DIMENSION_TEXTURE2D: + case D3D11_SRV_DIMENSION_TEXTURE3D: + case D3D11_SRV_DIMENSION_TEXTURE1DARRAY: + case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: + /* yes, this works for all of these types (but TODO: texture arrays) */ + templat.first_level = pDesc->Texture1D.MostDetailedMip; + templat.last_level = templat.first_level + pDesc->Texture1D.MipLevels - 1; + break; + case D3D11_SRV_DIMENSION_BUFFER: + case D3D11_SRV_DIMENSION_TEXTURE2DMS: + case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: + return E_NOTIMPL; + default: + return E_INVALIDARG; + } + + if(!ppSRView) + return S_FALSE; + + struct pipe_sampler_view* view = immediate_pipe->create_sampler_view(immediate_pipe, templat.texture, &templat); + if(!view) + return E_FAIL; + *ppSRView = new GalliumD3D11ShaderResourceView(this, (GalliumD3D11Resource<>*)pResource, view, *pDesc); + return S_OK; + } + +#if API >= 11 + virtual HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView( + __in ID3D11Resource *pResource, + __in_opt const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + __out_opt ID3D11UnorderedAccessView **ppUAView) + { + SYNCHRONIZED; + + return E_NOTIMPL; + + // remember to return S_FALSE and not crash if ppUAView == 0 and parameters are valid + } +#endif + + virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( + __in ID3D11Resource *pResource, + __in_opt const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + __out_opt ID3D11RenderTargetView **ppRTView) + { + SYNCHRONIZED; + + D3D11_RENDER_TARGET_VIEW_DESC def_desc; + if(!pDesc) + { + struct pipe_resource* resource = ((GalliumD3D11Resource<>*)pResource)->resource; + init_pipe_to_dxgi_format(); + memset(&def_desc, 0, sizeof(def_desc)); + def_desc.Format = pipe_to_dxgi_format[resource->format]; + switch(resource->target) + { + case PIPE_BUFFER: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_BUFFER; + def_desc.Buffer.ElementWidth = 1; +#if API >= 11 + def_desc.Buffer.NumElements = resource->width0; +#endif + break; + case PIPE_TEXTURE_1D: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1D; + break; + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + break; + case PIPE_TEXTURE_3D: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; + def_desc.Texture3D.WSize = resource->depth0; + break; + case PIPE_TEXTURE_CUBE: + def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + def_desc.Texture2DArray.ArraySize = 6; + break; + default: + return E_INVALIDARG; + } + pDesc = &def_desc; + } + + unsigned zslice = 0; + unsigned face = 0; + unsigned level; + enum pipe_format format; + if(invalid(pDesc->Format >= DXGI_FORMAT_COUNT)) + return E_INVALIDARG; + format = dxgi_to_pipe_format[pDesc->Format]; + if(!format) + return E_NOTIMPL; + + switch(pDesc->ViewDimension) + { + case D3D11_RTV_DIMENSION_TEXTURE1D: + case D3D11_RTV_DIMENSION_TEXTURE2D: + level = pDesc->Texture1D.MipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE3D: + level = pDesc->Texture3D.MipSlice; + zslice = pDesc->Texture3D.FirstWSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE1DARRAY: + case D3D11_RTV_DIMENSION_TEXTURE2DARRAY: + level = pDesc->Texture1DArray.MipSlice; + face = pDesc->Texture1DArray.FirstArraySlice; + break; + case D3D11_RTV_DIMENSION_BUFFER: + case D3D11_RTV_DIMENSION_TEXTURE2DMS: + case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY: + return E_NOTIMPL; + default: + return E_INVALIDARG; + } + + if(!ppRTView) + return S_FALSE; + + struct pipe_surface* surface = screen->get_tex_surface(screen, + ((GalliumD3D11Resource<>*)pResource)->resource, + face, level, zslice, PIPE_BIND_RENDER_TARGET); + if(!surface) + return E_FAIL; + /* muhahahahaha, let's hope this actually works */ + surface->format = format; + *ppRTView = new GalliumD3D11RenderTargetView(this, (GalliumD3D11Resource<>*)pResource, surface, *pDesc); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( + __in ID3D11Resource *pResource, + __in_opt const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + __out_opt ID3D11DepthStencilView **ppDepthStencilView) + { + SYNCHRONIZED; + + D3D11_DEPTH_STENCIL_VIEW_DESC def_desc; + if(!pDesc) + { + struct pipe_resource* resource = ((GalliumD3D11Resource<>*)pResource)->resource; + init_pipe_to_dxgi_format(); + memset(&def_desc, 0, sizeof(def_desc)); + def_desc.Format = pipe_to_dxgi_format[resource->format]; + switch(resource->target) + { + case PIPE_TEXTURE_1D: + def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE1D; + break; + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: + def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; + break; + case PIPE_TEXTURE_CUBE: + def_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY; + def_desc.Texture2DArray.ArraySize = 6; + break; + default: + return E_INVALIDARG; + } + pDesc = &def_desc; + } + + unsigned zslice = 0; + unsigned face = 0; + unsigned level; + enum pipe_format format; + if(invalid(pDesc->Format >= DXGI_FORMAT_COUNT)) + return E_INVALIDARG; + format = dxgi_to_pipe_format[pDesc->Format]; + if(!format) + return E_NOTIMPL; + + switch(pDesc->ViewDimension) + { + case D3D11_DSV_DIMENSION_TEXTURE1D: + case D3D11_DSV_DIMENSION_TEXTURE2D: + level = pDesc->Texture1D.MipSlice; + break; + case D3D11_DSV_DIMENSION_TEXTURE1DARRAY: + case D3D11_DSV_DIMENSION_TEXTURE2DARRAY: + level = pDesc->Texture1DArray.MipSlice; + face = pDesc->Texture1DArray.FirstArraySlice; + break; + case D3D11_DSV_DIMENSION_TEXTURE2DMS: + case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY: + return E_NOTIMPL; + default: + return E_INVALIDARG; + } + + if(!ppDepthStencilView) + return S_FALSE; + + struct pipe_surface* surface = screen->get_tex_surface(screen, + ((GalliumD3D11Resource<>*)pResource)->resource, + face, level, zslice, PIPE_BIND_DEPTH_STENCIL); + if(!surface) + return E_FAIL; + /* muhahahahaha, let's hope this actually works */ + surface->format = format; + *ppDepthStencilView = new GalliumD3D11DepthStencilView(this, (GalliumD3D11Resource<>*)pResource, surface, *pDesc); + return S_OK; + } + + GalliumD3D11Shader<>* create_stage_shader(unsigned type, const void *pShaderBytecode, SIZE_T BytecodeLength +#if API >= 11 + , __in_opt ID3D11ClassLinkage *pClassLinkage +#endif + ) + { + dxbc_chunk_header* tpf_chunk = dxbc_find_shader_bytecode(pShaderBytecode, BytecodeLength); + if(!tpf_chunk) + return 0; + + std::auto_ptr tpf(tpf_parse(tpf_chunk + 1, bswap_le32(tpf_chunk->size))); + if(!tpf.get()) + return 0; + + struct pipe_shader_state tgsi_shader; + memset(&tgsi_shader, 0, sizeof(tgsi_shader)); + tgsi_shader.tokens = (const tgsi_token*)tpf_to_tgsi(*tpf); + if(!tgsi_shader.tokens) + return 0; + + void* shader_cso; + GalliumD3D11Shader<>* shader; + + switch(type) + { + case PIPE_SHADER_VERTEX: + shader_cso = immediate_pipe->create_vs_state(immediate_pipe, &tgsi_shader); + shader = (GalliumD3D11Shader<>*)new GalliumD3D11VertexShader(this, shader_cso); + break; + case PIPE_SHADER_FRAGMENT: + shader_cso = immediate_pipe->create_fs_state(immediate_pipe, &tgsi_shader); + shader = (GalliumD3D11Shader<>*)new GalliumD3D11PixelShader(this, shader_cso); + break; + case PIPE_SHADER_GEOMETRY: + shader_cso = immediate_pipe->create_gs_state(immediate_pipe, &tgsi_shader); + shader = (GalliumD3D11Shader<>*)new GalliumD3D11GeometryShader(this, shader_cso); + break; + default: + shader_cso = 0; + shader = 0; + break; + } + + if(shader) + { + shader->slot_to_resource = tpf->slot_to_resource; + shader->slot_to_sampler = tpf->slot_to_sampler; + } + + free((void*)tgsi_shader.tokens); + return shader; + } + +#if API >= 11 +#define CREATE_SHADER_ARGS \ + __in const void *pShaderBytecode, \ + __in SIZE_T BytecodeLength, \ + __in_opt ID3D11ClassLinkage *pClassLinkage +#define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength, pClassLinkage +#else +#define CREATE_SHADER_ARGS \ + __in const void *pShaderBytecode, \ + __in SIZE_T BytecodeLength +#define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength +#endif + +#define IMPLEMENT_CREATE_SHADER(Stage, GALLIUM) \ + virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ + CREATE_SHADER_ARGS, \ + __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ + { \ + SYNCHRONIZED; \ + GalliumD3D11##Stage##Shader* shader = (GalliumD3D11##Stage##Shader*)create_stage_shader(PIPE_SHADER_##GALLIUM, PASS_SHADER_ARGS); \ + if(!shader) \ + return E_FAIL; \ + if(pp##Stage##Shader) \ + { \ + *pp##Stage##Shader = shader; \ + return S_OK; \ + } \ + else \ + { \ + shader->Release(); \ + return S_FALSE; \ + } \ + } + +#define IMPLEMENT_NOTIMPL_CREATE_SHADER(Stage) \ + virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ + CREATE_SHADER_ARGS, \ + __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ + { \ + return E_NOTIMPL; \ + } + + IMPLEMENT_CREATE_SHADER(Vertex, VERTEX) + IMPLEMENT_CREATE_SHADER(Pixel, FRAGMENT) + IMPLEMENT_CREATE_SHADER(Geometry, GEOMETRY) +#if API >= 11 + IMPLEMENT_NOTIMPL_CREATE_SHADER(Hull) + IMPLEMENT_NOTIMPL_CREATE_SHADER(Domain) + IMPLEMENT_NOTIMPL_CREATE_SHADER(Compute) +#endif + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __in_ecount_opt(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + __in_range(0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT) unsigned NumEntries, +#if API >= 11 + __in_ecount_opt(NumStrides) const unsigned *pBufferStrides, + __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumStrides, + __in unsigned RasterizedStream, + __in_opt ID3D11ClassLinkage *pClassLinkage, +#else + __in UINT OutputStreamStride, +#endif + __out_opt ID3D11GeometryShader **ppGeometryShader) + { + SYNCHRONIZED; + + if(!ppGeometryShader) + return S_FALSE; + + return E_NOTIMPL; + + // remember to return S_FALSE if ppGeometyShader == NULL and the shader is OK + } + +#if API >= 11 + virtual HRESULT STDMETHODCALLTYPE CreateClassLinkage( + __out ID3D11ClassLinkage **ppLinkage) + { + SYNCHRONIZED; + + if(!ppLinkage) + return S_FALSE; + + return E_NOTIMPL; + } +#endif + + virtual HRESULT STDMETHODCALLTYPE CreateQuery( + __in const D3D11_QUERY_DESC *pQueryDesc, + __out_opt ID3D11Query **ppQuery) + { + SYNCHRONIZED; + + if(invalid(pQueryDesc->Query >= D3D11_QUERY_COUNT)) + return E_INVALIDARG; + unsigned query_type = d3d11_to_pipe_query[pQueryDesc->Query]; + if(!query_type) + return E_NOTIMPL; + + if(ppQuery) + return S_FALSE; + + struct pipe_query* query = immediate_pipe->create_query(immediate_pipe, query_type); + if(!query) + return E_FAIL; + + *ppQuery = new GalliumD3D11Query(this, query, d3d11_query_size[pQueryDesc->Query], *pQueryDesc); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreatePredicate( + __in const D3D11_QUERY_DESC *pPredicateDesc, + __out_opt ID3D11Predicate **ppPredicate) + { + SYNCHRONIZED; + + unsigned query_type; + switch(pPredicateDesc->Query) + { + case D3D11_QUERY_SO_OVERFLOW_PREDICATE: + return E_NOTIMPL; + case D3D11_QUERY_OCCLUSION_PREDICATE: + query_type = PIPE_QUERY_OCCLUSION_COUNTER; + break; + default: + return E_INVALIDARG; + } + + if(ppPredicate) + return S_FALSE; + + struct pipe_query* query = immediate_pipe->create_query(immediate_pipe, query_type); + if(!query) + return E_FAIL; + + *ppPredicate = new GalliumD3D11Predicate(this, query, sizeof(BOOL), *pPredicateDesc); + return S_OK; + } + + + virtual HRESULT STDMETHODCALLTYPE CreateCounter( + __in const D3D11_COUNTER_DESC *pCounterDesc, + __out_opt ID3D11Counter **ppCounter) + { + SYNCHRONIZED; + + return E_NOTIMPL; + + // remember to return S_FALSE if ppCounter == NULL and everything is OK + } + +#if API >= 11 + virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext( + unsigned ContextFlags, + __out_opt ID3D11DeviceContext **ppDeferredContext) + { + SYNCHRONIZED; + + // TODO: this will have to be implemented using a new Gallium util module + return E_NOTIMPL; + + // remember to return S_FALSE if ppCounter == NULL and everything is OK + } +#endif + + virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( + __in HANDLE hResource, + __in REFIID ReturnedInterface, + __out_opt void **ppResource) + { + SYNCHRONIZED; + + // TODO: the problem here is that we need to communicate dimensions somehow + return E_NOTIMPL; + + // remember to return S_FALSE if ppCounter == NULL and everything is OK +#if 0 + struct pipe_resou rce templat; + struct winsys_handle handle; + handle.stride = 0; + handle.handle = hResource; + handle.type = DRM_API_HANDLE_TYPE_SHARED; + screen->resource_from_handle(screen, &templat, &handle); +#endif + } + +#if API < 11 + /* these are documented as "Not implemented". + * According to the UMDDI documentation, they apparently turn on a + * (Width + 1) x (Height + 1) convolution filter for 1-bit textures. + * Probably nothing uses these, assuming it has ever been implemented anywhere. + */ + void STDMETHODCALLTYPE SetTextFilterSize( + __in UINT Width, + __in UINT Height + ) + {} + + virtual void STDMETHODCALLTYPE GetTextFilterSize( + __in UINT *Width, + __in UINT *Height + ) + {} +#endif + +#if API >= 11 + virtual void STDMETHODCALLTYPE RestoreGalliumState() + { + GalliumD3D11ImmediateDeviceContext_RestoreGalliumState(immediate_context); + } + + virtual void STDMETHODCALLTYPE RestoreGalliumStateBlitOnly() + { + GalliumD3D11ImmediateDeviceContext_RestoreGalliumStateBlitOnly(immediate_context); + } +#endif + + virtual struct pipe_context* STDMETHODCALLTYPE GetGalliumContext(void) + { + return immediate_pipe; + } + +#undef SYNCHRONIZED +}; diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile new file mode 100644 index 00000000000..924b2f17c54 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile @@ -0,0 +1,6 @@ +LIBNAME=gd3d1x +CPP_SOURCES=$(wildcard *.cpp) +LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common +PROGS=tools/dxbc2tgsi +LIBS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../../../auxiliary/libgallium.a -ldl +include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h new file mode 100644 index 00000000000..6756b2112d8 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h @@ -0,0 +1,101 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef D3D1X_PRIVATE_H_ +#define D3D1X_PRIVATE_H_ + +#include +#include +#include +#include + +#include "dxbc.h" +#include "tpf.h" +#include "tpf_to_tgsi.h" + +#include "d3d1xstutil.h" + +#include +#include + + +#include + +extern "C" +{ +#include +#include +#include +#include +#include +#include +#include +#include +} + +#include "galliumdxgi.h" +#include "galliumd3d10_1.h" +#include "galliumd3d11.h" + +#ifdef CHECK +#define invalid(x) unlikely(x) +#else +#define invalid(x) (0) +#endif + +#define D3D10_STAGE_VS 0 +#define D3D10_STAGE_PS 1 +#define D3D10_STAGE_GS 2 +#define D3D10_STAGES 3 + +#define D3D11_STAGE_VS 0 +#define D3D11_STAGE_PS 1 +#define D3D11_STAGE_GS 2 +#define D3D11_STAGE_HS 3 +#define D3D11_STAGE_DS 4 +#define D3D11_STAGE_CS 5 +#define D3D11_STAGES 6 + +#define D3D11_BLEND_COUNT 20 +extern unsigned d3d11_to_pipe_blend[D3D11_BLEND_COUNT]; + +#define D3D11_USAGE_COUNT 4 +extern unsigned d3d11_to_pipe_usage[D3D11_USAGE_COUNT]; + +#define D3D11_STENCIL_OP_COUNT 9 +extern unsigned d3d11_to_pipe_stencil_op[D3D11_STENCIL_OP_COUNT]; + +#define D3D11_TEXTURE_ADDRESS_COUNT 6 +extern unsigned d3d11_to_pipe_wrap[D3D11_TEXTURE_ADDRESS_COUNT]; + +#define D3D11_QUERY_COUNT 16 +extern unsigned d3d11_to_pipe_query[D3D11_QUERY_COUNT]; +extern unsigned d3d11_query_size[D3D11_QUERY_COUNT]; + +#define D3D_PRIMITIVE_TOPOLOGY_COUNT 65 +extern unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT]; + +#endif /* D3D1X_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp new file mode 100644 index 00000000000..7932e438c99 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp @@ -0,0 +1,147 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d1x_private.h" + +unsigned d3d11_to_pipe_blend[D3D11_BLEND_COUNT] = +{ + PIPE_BLENDFACTOR_ONE, /* absent in D3D11, but apparently accepted */ + PIPE_BLENDFACTOR_ZERO, + PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_SRC_COLOR, + PIPE_BLENDFACTOR_INV_SRC_COLOR, + PIPE_BLENDFACTOR_SRC_ALPHA, + PIPE_BLENDFACTOR_INV_SRC_ALPHA, + PIPE_BLENDFACTOR_DST_ALPHA, + PIPE_BLENDFACTOR_INV_DST_ALPHA, + PIPE_BLENDFACTOR_DST_COLOR, + PIPE_BLENDFACTOR_INV_DST_COLOR, + PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE, + 0, /* absent in D3D11 */ + 0, /* absent in D3D11 */ + PIPE_BLENDFACTOR_CONST_COLOR, + PIPE_BLENDFACTOR_INV_CONST_COLOR, + PIPE_BLENDFACTOR_SRC1_COLOR, + PIPE_BLENDFACTOR_INV_SRC1_COLOR, + PIPE_BLENDFACTOR_SRC1_ALPHA, + PIPE_BLENDFACTOR_INV_SRC1_ALPHA +}; + +unsigned d3d11_to_pipe_usage[D3D11_USAGE_COUNT] = +{ + PIPE_USAGE_DEFAULT, + PIPE_USAGE_IMMUTABLE, + PIPE_USAGE_DYNAMIC, + PIPE_USAGE_STAGING +}; + +unsigned d3d11_to_pipe_stencil_op[D3D11_STENCIL_OP_COUNT] = +{ + PIPE_STENCIL_OP_KEEP, + PIPE_STENCIL_OP_KEEP, + PIPE_STENCIL_OP_ZERO, + PIPE_STENCIL_OP_REPLACE, + PIPE_STENCIL_OP_INCR, + PIPE_STENCIL_OP_DECR, + PIPE_STENCIL_OP_INVERT, + PIPE_STENCIL_OP_INCR_WRAP, + PIPE_STENCIL_OP_DECR_WRAP, +}; + +unsigned d3d11_to_pipe_wrap[D3D11_TEXTURE_ADDRESS_COUNT] = +{ + PIPE_TEX_WRAP_REPEAT, + PIPE_TEX_WRAP_REPEAT, + PIPE_TEX_WRAP_MIRROR_REPEAT, + PIPE_TEX_WRAP_CLAMP_TO_EDGE, + PIPE_TEX_WRAP_CLAMP_TO_BORDER, + PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE, +}; + +unsigned d3d11_to_pipe_query[D3D11_QUERY_COUNT] = +{ + PIPE_QUERY_GPU_FINISHED, + PIPE_QUERY_OCCLUSION_COUNTER, + PIPE_QUERY_TIME_ELAPSED, + PIPE_QUERY_TIMESTAMP_DISJOINT, + 0, /* D3D11_QUERY_PIPELINE_STATISTICS */ + PIPE_QUERY_OCCLUSION_COUNTER, + PIPE_QUERY_SO_STATISTICS, + 0, /* D3D11_QUERY_SO_OVERFLOW_PREDICATE */ + /* per-stream SO queries */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +unsigned d3d11_query_size[D3D11_QUERY_COUNT] = +{ + sizeof(BOOL), + sizeof(UINT64), + sizeof(UINT64), + sizeof(UINT64), + 0, + sizeof(BOOL), + sizeof(D3D11_QUERY_DATA_SO_STATISTICS), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 +}; + +unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT] = +{ + 0, + PIPE_PRIM_POINTS, + PIPE_PRIM_LINES, + PIPE_PRIM_LINE_STRIP, + PIPE_PRIM_TRIANGLES, + PIPE_PRIM_TRIANGLE_STRIP, + PIPE_PRIM_LINES_ADJACENCY, + PIPE_PRIM_LINE_STRIP_ADJACENCY, + PIPE_PRIM_TRIANGLES_ADJACENCY, + PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY, + /* gap */ + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, + /* patches */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +}; diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp new file mode 100644 index 00000000000..2e5062f2ca3 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp @@ -0,0 +1,82 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "dxbc.h" +#include "tpf.h" +#include "../tpf_to_tgsi.h" +#include "tgsi/tgsi_dump.h" +#include +#include + +void usage() +{ + std::cerr << "Gallium Direct3D10/11 Shader to TGSI converter\n"; + std::cerr << "This program is free software, released under a MIT-like license\n"; + std::cerr << "Not affiliated with or endorsed by Microsoft in any way\n"; + std::cerr << "Latest version available from http://cgit.freedesktop.org/mesa/mesa/\n"; + std::cerr << "\n"; + std::cerr << "Usage: dxbc2tgsi FILE\n"; + std::cerr << std::endl; +} + +int main(int argc, char** argv) +{ + if(argc < 2) + { + usage(); + return 1; + } + + std::vector data; + std::ifstream in(argv[1]); + char c; + in >> std::noskipws; + while(in >> c) + data.push_back(c); + in.close(); + + dxbc_container* dxbc = dxbc_parse(&data[0], data.size()); + if(dxbc) + { + std::cout << *dxbc; + dxbc_chunk_header* tpf_chunk = dxbc_find_shader_bytecode(&data[0], data.size()); + if(tpf_chunk) + { + tpf_program* tpf = tpf_parse(tpf_chunk + 1, bswap_le32(tpf_chunk->size)); + if(tpf) + { + const struct tgsi_token* tokens = (const struct tgsi_token*)tpf_to_tgsi(*tpf); + if(tokens) + { + std::cout << *tpf; + std::cout << "\n# TGSI program: " << std::endl; + tgsi_dump(tokens, 0); + } + } + } + delete dxbc; + } +} diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp new file mode 100644 index 00000000000..676c939aa00 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp @@ -0,0 +1,832 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "tpf.h" +#include "tgsi/tgsi_ureg.h" +#include + +#if 1 +#define check(x) assert(x) +#define fail(x) assert(0 && (x)) +#else +#define check(x) do {if(!(x)) throw(#x);} while(0) +#define fail(x) throw(x) +#endif + +static unsigned tpf_to_pipe_interpolation[] = +{ + TGSI_INTERPOLATE_PERSPECTIVE, /* UNDEFINED */ + TGSI_INTERPOLATE_CONSTANT, + TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR */ + TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_CENTROID */ + TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE */ + TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_CENTROID */ + + // Added in D3D10.1 + TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_SAMPLE */ + TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_SAMPLE */ +}; + +static int tpf_to_pipe_sv[] = +{ + -1, + TGSI_SEMANTIC_POSITION, + -1, /*TGSI_SEMANTIC_CLIP_DISTANCE */ + -1, /*TGSI_SEMANTIC_CULL_DISTANCE */ + -1, /*TGSI_SEMANTIC_RENDER_TARGET_ARRAY_INDEX */ + -1, /*TGSI_SEMANTIC_VIEWPORT_ARRAY_INDEX */ + -1, /*TGSI_SEMANTIC_VERTEXID,*/ + TGSI_SEMANTIC_PRIMID, + TGSI_SEMANTIC_INSTANCEID, + TGSI_SEMANTIC_FACE, + -1, /*TGSI_SEMANTIC_SAMPLE_INDEX*/ +}; + +struct tpf_to_tgsi_converter +{ + struct ureg_program* ureg; + std::vector temps; + std::vector outputs; + std::vector inputs; + std::vector samplers; + std::vector > targets; // first is normal, second shadow/comparison + std::vector sampler_modes; // 0 = normal, 1 = shadow/comparison + std::vector > loops; + tpf_insn* insn; + struct tpf_program& program; + std::vector tpf_to_tgsi_insn_num; + std::vector > label_to_tpf_insn_num; + bool in_sub; + bool avoid_txf; + bool avoid_int; + + tpf_to_tgsi_converter(struct tpf_program& program) + : program(program) + { + avoid_txf = true; + avoid_int = false; + } + + struct ureg_dst _reg(tpf_op& op) + { + switch(op.file) + { + case TPF_FILE_NULL: + { + struct ureg_dst d; + memset(&d, 0, sizeof(d)); + d.File = TGSI_FILE_NULL; + return d; + } + case TPF_FILE_TEMP: + check(op.has_simple_index()); + check(op.indices[0].disp < temps.size()); + return temps[op.indices[0].disp]; + case TPF_FILE_OUTPUT: + check(op.has_simple_index()); + check(op.indices[0].disp < outputs.size()); + return outputs[op.indices[0].disp]; + default: + check(0); + return ureg_dst_undef(); + } + } + + struct ureg_dst _dst(unsigned i = 0) + { + check(i < insn->num_ops); + tpf_op& op = *insn->ops[i]; + check(op.mode == TPF_OPERAND_MODE_MASK || op.mode == TPF_OPERAND_MODE_SCALAR); + struct ureg_dst d = ureg_writemask(_reg(op), op.mask); + if(insn->insn.sat) + d = ureg_saturate(d); + return d; + } + + struct ureg_src _src(unsigned i) + { + check(i < insn->num_ops); + tpf_op& op = *insn->ops[i]; + struct ureg_src s; + switch(op.file) + { + case TPF_FILE_IMMEDIATE32: + s = ureg_imm4f(ureg, op.imm_values[0].f32, op.imm_values[1].f32, op.imm_values[2].f32, op.imm_values[3].f32); + break; + case TPF_FILE_INPUT: + check(op.has_simple_index()); + check(op.indices[0].disp < inputs.size()); + s = inputs[op.indices[0].disp]; + break; + case TPF_FILE_CONSTANT_BUFFER: + // TODO: indirect addressing + check(op.num_indices == 2); + check(op.is_index_simple(0)); + check(op.is_index_simple(1)); + s = ureg_src_register(TGSI_FILE_CONSTANT, (unsigned)op.indices[1].disp); + s.Dimension = 1; + s.DimensionIndex = op.indices[0].disp; + break; + default: + s = ureg_src(_reg(op)); + break; + } + if(op.mode == TPF_OPERAND_MODE_SWIZZLE || op.mode == TPF_OPERAND_MODE_SCALAR) + s = ureg_swizzle(s, op.swizzle[0], op.swizzle[1], op.swizzle[2], op.swizzle[3]); + else + { + /* immediates are masked to show needed values */ + check(op.file == TPF_FILE_IMMEDIATE32 || op.file == TPF_FILE_IMMEDIATE64); + } + if(op.abs) + s = ureg_abs(s); + if(op.neg) + s = ureg_negate(s); + return s; + }; + + int _idx(tpf_file file, unsigned i = 0) + { + check(i < insn->num_ops); + tpf_op& op = *insn->ops[i]; + check(op.file == file); + check(op.has_simple_index()); + return (int)op.indices[0].disp; + } + + int _texslot(bool have_sampler = true) + { + std::map, int>::iterator i; + i = program.resource_sampler_to_slot.find(std::make_pair(_idx(TPF_FILE_RESOURCE, 2), have_sampler ? _idx(TPF_FILE_SAMPLER, 3) : -1)); + check(i != program.resource_sampler_to_slot.end()); + return i->second; + } + + unsigned tex_target(unsigned texslot) + { + unsigned mode = sampler_modes[program.slot_to_sampler[texslot]]; + unsigned target; + if(mode) + target = targets[program.slot_to_resource[texslot]].second; + else + target = targets[program.slot_to_resource[texslot]].first; + check(target); + return target; + } + + std::vector insn_tmps; + + struct ureg_dst _tmp() + { + struct ureg_dst t = ureg_DECL_temporary(ureg); + insn_tmps.push_back(t); + return t; + } + + struct ureg_dst _tmp(struct ureg_dst d) + { + if(d.File == TGSI_FILE_TEMPORARY) + return d; + else + return ureg_writemask(_tmp(), d.WriteMask); + } + +#define OP1_(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1)); break +#define OP2_(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1), _src(2)); break +#define OP3_(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1), _src(2), _src(3)); break +#define OP1(n) OP1_(n, n) +#define OP2(n) OP2_(n, n) +#define OP3(n) OP3_(n, n) +#define OP_CF(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, &label); label_to_tpf_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); break; + + void translate_insns(unsigned begin, unsigned end) + { + for(unsigned insn_num = begin; insn_num < end; ++insn_num) + { + tpf_to_tgsi_insn_num[insn_num] = ureg_get_instruction_number(ureg); + unsigned label; + insn = program.insns[insn_num]; + bool ok; + ok = true; + switch(insn->opcode) + { + // trivial instructions + case TPF_OPCODE_NOP: + break; + OP1(MOV); + + // float + OP2(ADD); + OP2(MUL); + OP3(MAD); + OP2(DIV); + OP1(FRC); + OP1(RCP); + OP2(MIN); + OP2(MAX); + OP2_(LT, SLT); + OP2_(GE, SGE); + OP2_(EQ, SEQ); + OP2_(NE, SNE); + + // bitwise + OP1(NOT); + OP2(AND); + OP2(OR); + OP2(XOR); + + // special mathematical + OP2(DP2); + OP2(DP3); + OP2(DP4); + OP1(RSQ); + OP1_(LOG, LG2); + OP1_(EXP, EX2); + + // rounding + OP1_(ROUND_NE, ROUND); + OP1_(ROUND_Z, TRUNC); + OP1_(ROUND_PI, CEIL); + OP1_(ROUND_NI, FLR); + + // cross-thread + OP1_(DERIV_RTX, DDX); + OP1_(DERIV_RTX_COARSE, DDX); + OP1_(DERIV_RTX_FINE, DDX); + OP1_(DERIV_RTY, DDY); + OP1_(DERIV_RTY_COARSE, DDY); + OP1_(DERIV_RTY_FINE, DDY); + case TPF_OPCODE_EMIT: + ureg_EMIT(ureg); + break; + case TPF_OPCODE_CUT: + ureg_ENDPRIM(ureg); + break; + case TPF_OPCODE_EMITTHENCUT: + ureg_EMIT(ureg); + ureg_ENDPRIM(ureg); + break; + + // non-trivial instructions + case TPF_OPCODE_MOVC: + /* CMP checks for < 0, but MOVC checks for != 0 + * but fortunately, x != 0 is equivalent to -abs(x) < 0 + * XXX: can test_nz apply to this?! + */ + ureg_CMP(ureg, _dst(), ureg_negate(ureg_abs(_src(1))), _src(2), _src(3)); + break; + case TPF_OPCODE_SQRT: + { + struct ureg_dst d = _dst(); + struct ureg_dst t = _tmp(d); + ureg_RSQ(ureg, t, _src(1)); + ureg_RCP(ureg, d, ureg_src(t)); + break; + } + case TPF_OPCODE_SINCOS: + { + struct ureg_dst s = _dst(0); + struct ureg_dst c = _dst(1); + struct ureg_src v = _src(2); + if(s.File != TGSI_FILE_NULL) + ureg_SIN(ureg, s, v); + if(c.File != TGSI_FILE_NULL) + ureg_COS(ureg, c, v); + break; + } + + // control flow + case TPF_OPCODE_DISCARD: + ureg_KIL(ureg, _src(0)); + break; + OP_CF(LOOP, BGNLOOP); + OP_CF(ENDLOOP, ENDLOOP); + case TPF_OPCODE_BREAK: + ureg_BRK(ureg); + break; + case TPF_OPCODE_BREAKC: + // XXX: can test_nz apply to this?! + ureg_BREAKC(ureg, _src(0)); + break; + case TPF_OPCODE_CONTINUE: + ureg_CONT(ureg); + break; + case TPF_OPCODE_CONTINUEC: + // XXX: can test_nz apply to this?! + ureg_IF(ureg, _src(0), &label); + ureg_CONT(ureg); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + ureg_ENDIF(ureg); + break; + case TPF_OPCODE_SWITCH: + ureg_SWITCH(ureg, _src(0)); + break; + case TPF_OPCODE_CASE: + ureg_CASE(ureg, _src(0)); + break; + case TPF_OPCODE_DEFAULT: + ureg_DEFAULT(ureg); + break; + case TPF_OPCODE_ENDSWITCH: + ureg_ENDSWITCH(ureg); + break; + case TPF_OPCODE_CALL: + ureg_CAL(ureg, &label); + label_to_tpf_insn_num.push_back(std::make_pair(label, program.label_to_insn_num[_idx(TPF_FILE_LABEL)])); + break; + case TPF_OPCODE_LABEL: + if(in_sub) + ureg_ENDSUB(ureg); + else + ureg_END(ureg); + ureg_BGNSUB(ureg); + in_sub = true; + break; + case TPF_OPCODE_RET: + if(in_sub || insn_num != (program.insns.size() - 1)) + ureg_RET(ureg); + break; + case TPF_OPCODE_RETC: + ureg_IF(ureg, _src(0), &label); + if(insn->insn.test_nz) + ureg_RET(ureg); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + if(!insn->insn.test_nz) + { + ureg_ELSE(ureg, &label); + ureg_RET(ureg); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + } + ureg_ENDIF(ureg); + break; + OP_CF(ELSE, ELSE); + case TPF_OPCODE_ENDIF: + ureg_ENDIF(ureg); + break; + case TPF_OPCODE_IF: + if(insn->insn.test_nz) + { + ureg_IF(ureg, _src(0), &label); + label_to_tpf_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); + } + else + { + unsigned linked = program.cf_insn_linked[insn_num]; + if(program.insns[linked]->opcode == TPF_OPCODE_ENDIF) + { + ureg_IF(ureg, _src(0), &label); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + ureg_ELSE(ureg, &label); + label_to_tpf_insn_num.push_back(std::make_pair(label, linked)); + } + else + { + /* we have to swap the branches in this case (fun!) + * TODO: maybe just emit a SEQ 0? + * */ + unsigned endif = program.cf_insn_linked[linked]; + + ureg_IF(ureg, _src(0), &label); + label_to_tpf_insn_num.push_back(std::make_pair(label, linked)); + + translate_insns(linked + 1, endif); + + tpf_to_tgsi_insn_num[linked] = ureg_get_instruction_number(ureg); + ureg_ELSE(ureg, &label); + label_to_tpf_insn_num.push_back(std::make_pair(label, endif)); + + translate_insns(insn_num + 1, linked); + + insn_num = endif - 1; + goto next; + } + } + break; + case TPF_OPCODE_RESINFO: + { + std::map::iterator i; + i = program.resource_to_slot.find(_idx(TPF_FILE_RESOURCE, 2)); + check(i != program.resource_to_slot.end()); + unsigned texslot = i->second; + + // no driver actually provides this, unfortunately + ureg_TXQ(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot]); + break; + }; + // TODO: sample offset, sample index + case TPF_OPCODE_LD: // dst, coord_int, res; mipmap level in last coord_int arg (ouch) + case TPF_OPCODE_LD_MS: + { + unsigned texslot = _texslot(false); + unsigned dim; + switch(targets[texslot].first) + { + case TGSI_TEXTURE_1D: + dim = 1; + break; + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_RECT: + dim = 2; + break; + case TGSI_TEXTURE_3D: + dim = 3; + break; + default: + check(0); + } + struct ureg_dst tmp = _tmp(); + if(avoid_txf) + { + struct ureg_src texcoord; + if(!avoid_int) + { + ureg_I2F(ureg, tmp, _src(1)); + texcoord = ureg_src(tmp); + } + else + texcoord = _src(1); + + ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_swizzle(texcoord, 0, 1, 2, dim), samplers[texslot]); + } + else + ureg_TXF(ureg, _dst(), tex_target(texslot), ureg_swizzle(_src(1), 0, 1, 2, dim), samplers[texslot]); + break; + } + case TPF_OPCODE_SAMPLE: // dst, coord, res, samp + { + unsigned texslot = _texslot(); + ureg_TEX(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot]); + break; + } + case TPF_OPCODE_SAMPLE_B: // dst, coord, res, samp, bias.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_TXB(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + case TPF_OPCODE_SAMPLE_C: // dst, coord, res, samp, comp.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_TEX(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + case TPF_OPCODE_SAMPLE_C_LZ: // dst, coord, res, samp, comp.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_imm1f(ureg, 0.0)); + ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + case TPF_OPCODE_SAMPLE_D: // dst, coord, res, samp, ddx, ddy + { + unsigned texslot = _texslot(); + ureg_TXD(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot], _src(4), _src(5)); + break; + } + case TPF_OPCODE_SAMPLE_L: // dst, coord, res, samp, bias.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + default: + ok = false; + break; + } + + if(!ok && !avoid_int) + { + ok = true; + switch(insn->opcode) + { + // integer + OP1_(ITOF, I2F); + OP1_(FTOI, F2I); + OP2_(IADD, UADD); + OP1(INEG); + OP2_(IMUL, UMUL); + OP3_(IMAD, UMAD); + OP2_(ISHL, SHL); + OP2_(ISHR, ISHR); + OP2(IMIN); + OP2(IMAX); + OP2_(ILT, ISLT); + OP2_(IGE, ISGE); + OP2_(IEQ, USEQ); + OP2_(INE, USNE); + + // unsigned + OP1_(UTOF, U2F); + OP1_(FTOU, F2U); + OP2(UMUL); + OP3(UMAD); + OP2(UMIN); + OP2(UMAX); + OP2_(ULT, USLT); + OP2_(UGE, USGE); + OP2(USHR); + + case TPF_OPCODE_UDIV: + { + struct ureg_dst q = _dst(0); + struct ureg_dst r = _dst(1); + struct ureg_src a = _src(2); + struct ureg_src b = _src(3); + if(q.File != TGSI_FILE_NULL) + ureg_UDIV(ureg, q, a, b); + if(r.File != TGSI_FILE_NULL) + ureg_UMOD(ureg, r, a, b); + break; + } + default: + ok = false; + } + } + + if(!ok && avoid_int) + { + ok = true; + switch(insn->opcode) + { + case TPF_OPCODE_ITOF: + case TPF_OPCODE_UTOF: + break; + OP1_(FTOI, TRUNC); + OP1_(FTOU, FLR); + // integer + OP2_(IADD, ADD); + OP2_(IMUL, MUL); + OP3_(IMAD, MAD); + OP2_(MIN, MIN); + OP2_(MAX, MAX); + OP2_(ILT, SLT); + OP2_(IGE, SGE); + OP2_(IEQ, SEQ); + OP2_(INE, SNE); + + // unsigned + OP2_(UMUL, MUL); + OP3_(UMAD, MAD); + OP2_(UMIN, MIN); + OP2_(UMAX, MAX); + OP2_(ULT, SLT); + OP2_(UGE, SGE); + + case TPF_OPCODE_INEG: + ureg_MOV(ureg, _dst(), ureg_negate(_src(1))); + break; + case TPF_OPCODE_ISHL: + { + struct ureg_dst d = _dst(); + struct ureg_dst t = _tmp(d); + ureg_EX2(ureg, t, _src(2)); + ureg_MUL(ureg, d, ureg_src(t), _src(1)); + break; + } + case TPF_OPCODE_ISHR: + case TPF_OPCODE_USHR: + { + struct ureg_dst d = _dst(); + struct ureg_dst t = _tmp(d); + ureg_EX2(ureg, t, ureg_negate(_src(2))); + ureg_MUL(ureg, t, ureg_src(t), _src(1)); + ureg_FLR(ureg, d, ureg_src(t)); + break; + } + case TPF_OPCODE_UDIV: + { + struct ureg_dst q = _dst(0); + struct ureg_dst r = _dst(1); + struct ureg_src a = _src(2); + struct ureg_src b = _src(3); + struct ureg_dst f = _tmp(); + ureg_DIV(ureg, f, a, b); + if(q.File != TGSI_FILE_NULL) + ureg_FLR(ureg, q, ureg_src(f)); + if(r.File != TGSI_FILE_NULL) + { + ureg_FRC(ureg, f, ureg_src(f)); + ureg_MUL(ureg, r, ureg_src(f), b); + } + break; + } + default: + ok = false; + } + } + + check(ok); + + if(!insn_tmps.empty()) + { + for(unsigned i = 0; i < insn_tmps.size(); ++i) + ureg_release_temporary(ureg, insn_tmps[i]); + insn_tmps.clear(); + } +next:; + } + } + + void* do_translate() + { + unsigned processor; + switch(program.version.type) + { + case 0: + processor = TGSI_PROCESSOR_FRAGMENT; + break; + case 1: + processor = TGSI_PROCESSOR_VERTEX; + break; + case 2: + processor = TGSI_PROCESSOR_GEOMETRY; + break; + default: + fail("Tessellation and compute shaders not yet supported"); + return 0; + } + + if(!tpf_link_cf_insns(program)) + fail("Malformed control flow"); + if(!tpf_find_labels(program)) + fail("Failed to locate labels"); + if(!tpf_allocate_resource_sampler_pairs(program)) + fail("Unsupported (indirect?) accesses to resources and/or samplers"); + + ureg = ureg_create(processor); + + in_sub = false; + + for(unsigned i = 0; i < program.slot_to_resource.size(); ++i) + samplers.push_back(ureg_DECL_sampler(ureg, i)); + + tpf_to_tgsi_insn_num.resize(program.insns.size()); + for(unsigned insn_num = 0; insn_num < program.dcls.size(); ++insn_num) + { + tpf_dcl& dcl = *program.dcls[insn_num]; + int idx = -1; + if(dcl.op.get() && dcl.op->has_simple_index()) + idx = dcl.op->indices[0].disp; + switch(dcl.opcode) + { + case TPF_OPCODE_DCL_GLOBAL_FLAGS: + break; + case TPF_OPCODE_DCL_TEMPS: + for(unsigned i = 0; i < dcl.num; ++i) + temps.push_back(ureg_DECL_temporary(ureg)); + break; + case TPF_OPCODE_DCL_INPUT: + check(idx >= 0); + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); + if(processor == TGSI_PROCESSOR_VERTEX) + inputs[idx] = ureg_DECL_vs_input(ureg, idx); + else + check(0); + break; + case TPF_OPCODE_DCL_INPUT_PS: + check(idx >= 0); + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); + inputs[idx] = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, idx, tpf_to_pipe_interpolation[dcl.dcl_input_ps.interpolation]); + break; + case TPF_OPCODE_DCL_OUTPUT: + check(idx >= 0); + if(outputs.size() <= (unsigned)idx) + outputs.resize(idx + 1); + if(processor == TGSI_PROCESSOR_FRAGMENT) + outputs[idx] = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, idx); + else + outputs[idx] = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, idx); + break; + case TPF_OPCODE_DCL_INPUT_SIV: + case TPF_OPCODE_DCL_INPUT_SGV: + case TPF_OPCODE_DCL_INPUT_PS_SIV: + case TPF_OPCODE_DCL_INPUT_PS_SGV: + check(idx >= 0); + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); + // TODO: is this correct? + inputs[idx] = ureg_DECL_system_value(ureg, idx, tpf_to_pipe_sv[dcl.sv], 0); + break; + case TPF_OPCODE_DCL_OUTPUT_SIV: + case TPF_OPCODE_DCL_OUTPUT_SGV: + check(idx >= 0); + if(outputs.size() <= (unsigned)idx) + outputs.resize(idx + 1); + check(tpf_to_pipe_sv[dcl.sv] >= 0); + outputs[idx] = ureg_DECL_output(ureg, tpf_to_pipe_sv[dcl.sv], 0); + break; + case TPF_OPCODE_DCL_RESOURCE: + check(idx >= 0); + if(targets.size() <= (unsigned)idx) + targets.resize(idx + 1); + switch(dcl.dcl_resource.target) + { + case TPF_TARGET_TEXTURE1D: + targets[idx].first = TGSI_TEXTURE_1D; + targets[idx].second = TGSI_TEXTURE_SHADOW1D; + break; + case TPF_TARGET_TEXTURE2D: + targets[idx].first = TGSI_TEXTURE_2D; + targets[idx].second = TGSI_TEXTURE_SHADOW2D; + break; + case TPF_TARGET_TEXTURE3D: + targets[idx].first = TGSI_TEXTURE_3D; + targets[idx].second = 0; + break; + case TPF_TARGET_TEXTURECUBE: + targets[idx].first = TGSI_TEXTURE_CUBE; + targets[idx].second = 0; + break; + default: + check(0); + } + break; + case TPF_OPCODE_DCL_SAMPLER: + check(idx >= 0); + if(sampler_modes.size() <= (unsigned)idx) + sampler_modes.resize(idx + 1); + check(!dcl.dcl_sampler.mono); + sampler_modes[idx] = dcl.dcl_sampler.shadow; + break; + case TPF_OPCODE_DCL_CONSTANT_BUFFER: + check(dcl.op->num_indices == 2); + check(dcl.op->is_index_simple(0)); + check(dcl.op->is_index_simple(1)); + idx = dcl.op->indices[0].disp; + ureg_DECL_constant2D(ureg, 0, (unsigned)dcl.op->indices[1].disp - 1, idx); + break; + default: + check(0); + } + } + + translate_insns(0, program.insns.size()); + tpf_to_tgsi_insn_num.push_back(ureg_get_instruction_number(ureg)); + if(in_sub) + ureg_ENDSUB(ureg); + else + ureg_END(ureg); + + for(unsigned i = 0; i < label_to_tpf_insn_num.size(); ++i) + ureg_fixup_label(ureg, label_to_tpf_insn_num[i].first, tpf_to_tgsi_insn_num[label_to_tpf_insn_num[i].second]); + + const struct tgsi_token * tokens = ureg_get_tokens(ureg, 0); + ureg_destroy(ureg); + return (void*)tokens; + } + + void* translate() + { + try + { + return do_translate(); + } + catch(const char*) + { + return 0; + } + } +}; + +void* tpf_to_tgsi(struct tpf_program& program) +{ + tpf_to_tgsi_converter conv(program); + return conv.translate(); +} diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h new file mode 100644 index 00000000000..68a30d2d2e4 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h @@ -0,0 +1,34 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef TPF_TO_TGSI_H_ +#define TPF_TO_TGSI_H_ + +#include "tpf.h" + +void* tpf_to_tgsi(struct tpf_program& program); + +#endif /* TPF_TO_TGSI_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/Makefile b/src/gallium/state_trackers/d3d1x/gd3dapi/Makefile new file mode 100644 index 00000000000..8b16b1bcbcf --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/Makefile @@ -0,0 +1,4 @@ +all: idl + +include ../Makefile.inc + diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl new file mode 100644 index 00000000000..c42e10cb665 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl @@ -0,0 +1,76 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +/* Header for all COM-based Gallium APIs and state trackers */ + +import "oaidl.idl"; +import "ocidl.idl"; + +[object, local, uuid("481c9372-795f-4630-bd5b-1f46d33cc28b")] +interface IGalliumAdapter : IUnknown +{ + struct pipe_screen* GetGalliumScreen(); + struct pipe_screen* GetGalliumReferenceSoftwareScreen(); + struct pipe_screen* GetGalliumFastSoftwareScreen(); +} + +[object, local, uuid("2c0f7e72-d9fe-4e7b-9fee-d476695ad5d9")] +interface IGalliumDevice : IUnknown +{ + // turn Gallium resource into API resource + HRESULT OpenGalliumResource( + [in] struct pipe_resource* resource, + [out] IUnknown** api_resource + ); + + /* returns the Gallium context used by the device + * can return NULL if the device uses multiple contexts or doesn't want to implement GetGalliumContext() + * we have this function because often using one context is faster than using more (or it's the only working option) + */ + struct pipe_context* GetGalliumContext(); + + // restore the context state after using the Gallium context for something else + // does nothing if GetGalliumContext returns null + void RestoreGalliumState(); + + /* like RestoreGalliumState, but ignores: + * - constant buffers + * - non-PS samplers and shader resource views + * - blend color, sample mask + * - scissor + * - index buffer + * + * This is intended to restore state after a blit-like operation. + */ + void RestoreGalliumStateBlitOnly(); +}; + +[object, local, uuid("61934787-7aea-412c-8c72-8afe6a33d622")] +interface IGalliumResource : IUnknown +{ + struct pipe_resource* GetGalliumResource(); +}; + diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl new file mode 100644 index 00000000000..d2b72f56a1c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl @@ -0,0 +1,30 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "ocidl.idl"; +import "d3d10_1.idl"; + +HRESULT GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D10Device1** ppDevice); diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl new file mode 100644 index 00000000000..640cbfa881a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl @@ -0,0 +1,31 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +import "ocidl.idl"; +import "d3d11.idl"; + +HRESULT GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice); + diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl new file mode 100644 index 00000000000..9fbe5d01a7f --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl @@ -0,0 +1,77 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +/* Header for the Gallium extensions to DXGI */ + +import "galliumcom.idl"; +import "../d3dapi/dxgi.idl"; + +/* These calls set the display system that will be associated + * to new DXGI factories created with CreateDXGIFactory and + * CreateDXGIFactory1 by the current thread. + * + * Existing factories and DXGI objects created from them are + * not affected. + * + * Gallium DXGI has both per-thread and per-process settings. + * If the per-thread display system has been set (i.e. a function + * of these was called, and the last one called was not UseNothing), + * it will be used. + * Otherwise, the per-process display system will be used if set, or + * and other the factory creation call may either fail, or use an + * user-specified default.. + * + * The per-process setting can be altered by calling + * GalliumDXGIMakeDefault, which will set the per-process setting + * according to the current per-thread setting. + * + * GalliumDXGIUseNothing() is the initial state, which means that + * the per-process default should be used, and if that is "use nothing" + * too, the call will either fail or use a user-specified default. + * + * NOTE that setting the per-process default is NOT atomic and must + * not be done concurrently with other calls to GalliumDXGIMakeDefault, + * CreateDXGIFactory or CreateDXGIFactory1. + * + * The PFNHWNDRESOLVER function is passed HWNDs coming from + * the API user and must return window-system-specific values: + * - X11: Window* + * - GDI: HWND + */ + +typedef struct _XDisplay Display; +typedef void* (*PFNHWNDRESOLVER)(void*, HWND); + +void GalliumDXGIUseNothing(); + +/* only a subset of these may be available, depending on platform and compilation options */ +void GalliumDXGIUseX11Display(Display* dpy, PFNHWNDRESOLVER resolver, void* resolver_cookie); +void GalliumDXGIUseDRMCard(int fd); +void GalliumDXGIUseFBDev(int fd); +void GalliumDXGIUseHDC(HDC hdc, PFNHWNDRESOLVER resolver, void* resolver_cookie); + +void GalliumDXGIMakeDefault(); + diff --git a/src/gallium/state_trackers/d3d1x/mstools/download-mstools b/src/gallium/state_trackers/d3d1x/mstools/download-mstools new file mode 100755 index 00000000000..15a63171807 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/mstools/download-mstools @@ -0,0 +1,73 @@ +#!/bin/bash +ok=1 +for i in fxc.exe D3DCompiler_43.dll d3dx9_43.dll d3dx10_43.dll d3dx11_43.dll; do + if ! test -e "$i"; then + ok= + fi +done + +if test -n "$ok"; then + exit 0 +fi + +echo "To compile HLSL shaders, the Microsoft HLSL compiler needs to be downloaded." +echo +echo "Downloading Microsoft DirectX June 2010 SDK and extracting files..." +echo "Please wait, this will need to download and unpack a 600 MB file..." +echo +echo "The contribution of a free HLSL compiler would be greatly appreciated!" +echo + +ok=1 +if ! which wget >/dev/null; then + echo "Error: wget is required to download the files" + echo "On Debian or Ubuntu, run the following command to install it:" + echo "sudo apt-get install wget" + echo + ok= +fi + +if ! which cabextract >/dev/null; then + echo "Error: cabextract is required to unpack the files" + echo "On Debian or Ubuntu, run the following command to install it:" + echo "sudo apt-get install cabextract" + echo + ok= +fi + +if test -z "$ok"; then + exit 1 +fi + +dxsdk_file="DXSDK_Jun10.exe" +dxsdk_url="http://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe" +dxsdk_size=599452800 + +fxc_path="DXSDK/Utilities/bin/x86/fxc.exe" +d3dcompiler_cab_path="DXSDK/Redist/Jun2010_D3DCompiler_43_x86.cab" +d3dx9_cab_path="DXSDK/Redist/Jun2010_d3dx9_43_x86.cab" +d3dx10_cab_path="DXSDK/Redist/Jun2010_d3dx10_43_x86.cab" +d3dx11_cab_path="DXSDK/Redist/Jun2010_d3dx11_43_x86.cab" + +if test "$(stat -c '%s' "$dxsdk_file" 2>/dev/null)" != $dxsdk_size; then + wget --continue "$dxsdk_url" + if test "$(stat -c '%s' "$dxsdk_file" 2>/dev/null)" != $dxsdk_size; then + echo "Failed to download DirectX SDK: expected $dxsdk_file with size $dxsdk_size" + echo "Download manually from $dxsdk_url" + exit 1 + fi +fi + +for i in "$fxc_path" "$d3dcompiler_cab_path" "$d3dx9_cab_path" "$d3dx10_cab_path" "$d3dx11_cab_path"; do + if ! test -e "$i"; then + echo "Please wait, this may take several minutes because a 600 MB archive may need to be fully decompressed..." + cabextract -F "$i" "$dxsdk_file" + fi +done + +for i in "$d3dcompiler_cab_path" "$d3dx9_cab_path" "$d3dx10_cab_path" "$d3dx11_cab_path"; do + cabextract -F "*.dll" "$i" +done + +/bin/cp -dpf "$fxc_path" . + diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile new file mode 100644 index 00000000000..4766d3684d0 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/Makefile @@ -0,0 +1,32 @@ +LIBRARY_INCLUDES = -Id3d10app -Id3d11app -I../gd3dapi -I../d3dapi -I../w32api +LIBS= \ + ../dxgi/libdxgi.a \ + ../gd3d1x/libgd3d1x.a \ + ../d3d1xshader/libd3d1xshader.a \ + ../d3d1xstutil/libd3d1xstutil.a \ + ../../egl/libegl.a \ + ../../../auxiliary/libgallium.a \ + ../../../winsys/sw/wrapper/libwsw.a \ + ../../../winsys/sw/xlib/libws_xlib.a \ + ../../../winsys/sw/dri/libswdri.a \ + ../../../winsys/sw/fbdev/libfbdev.a \ + ../../../../../lib/libEGL.so +LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS) +LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS) +LDADD=-lGL -lXext -lXfixes -lX11 -ldrm -ldl + +all: bin/d3d10tri bin/d3d11tri bin/d3d11tex bin/d3d11gears +include ../Makefile.inc + +bin/d3d10tri: d3d10app/d3d10x11main.o d3d10tri/d3d10tri.o $(LIBS_D3D10) + $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D10) -Wl,--end-group $(LDADD) + +bin/d3d11tri: d3d11app/d3d11x11main.o d3d11tri/d3d11tri.o $(LIBS_D3D11) + $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) + +bin/d3d11tex: d3d11app/d3d11x11main.o d3d11tex/d3d11tex.o $(LIBS_D3D11) + $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) + +bin/d3d11gears: d3d11app/d3d11x11main.o d3d11gears/d3d11gears.o $(LIBS_D3D11) + $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) + diff --git a/src/gallium/state_trackers/d3d1x/progs/bin/d3d10tri.exe b/src/gallium/state_trackers/d3d1x/progs/bin/d3d10tri.exe new file mode 100755 index 00000000000..77ab03fcce0 Binary files /dev/null and b/src/gallium/state_trackers/d3d1x/progs/bin/d3d10tri.exe differ diff --git a/src/gallium/state_trackers/d3d1x/progs/bin/d3d11gears.exe b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11gears.exe new file mode 100755 index 00000000000..c2cd296a40f Binary files /dev/null and b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11gears.exe differ diff --git a/src/gallium/state_trackers/d3d1x/progs/bin/d3d11spikysphere.exe b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11spikysphere.exe new file mode 100755 index 00000000000..c3bc667fb31 Binary files /dev/null and b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11spikysphere.exe differ diff --git a/src/gallium/state_trackers/d3d1x/progs/bin/d3d11tex.exe b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11tex.exe new file mode 100755 index 00000000000..0be5cb8dd72 Binary files /dev/null and b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11tex.exe differ diff --git a/src/gallium/state_trackers/d3d1x/progs/bin/d3d11tri.exe b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11tri.exe new file mode 100755 index 00000000000..abada5484bd Binary files /dev/null and b/src/gallium/state_trackers/d3d1x/progs/bin/d3d11tri.exe differ diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h new file mode 100755 index 00000000000..c27e66ed54b --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h @@ -0,0 +1,51 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef D3D10APP_H +#define D3D10APP_H + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0) + +struct d3d10_application +{ + virtual ~d3d10_application() {} + + virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0; + virtual bool init(ID3D10Device* dev, int argc, char** argv) = 0; +}; + +/* this is the entry point you must provide */ +extern "C" d3d10_application* d3d10_application_create(); + +#endif diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp new file mode 100755 index 00000000000..ac4798a108e --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp @@ -0,0 +1,188 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define INITGUID +#include "d3d10app.h" +#include "stdio.h" + +static d3d10_application* app; +static IDXGISwapChain* swap_chain; +static unsigned width, height; +static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D10Device* dev; +static ID3D10Device* ctx; +static int frames = 0; +static int buffer_count = 1; + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_SIZE: + width = lParam & 0xffff; + height = lParam >> 16; + + swap_chain->ResizeBuffers(buffer_count, width, height, format, 0); + frames = 0; + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + return 0; +} + +int main(int argc, char** argv) +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + WNDCLASSEXA wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = "d3d10"; + wcex.hIconSm = 0; + + RegisterClassExA(&wcex); + + HWND hwnd = CreateWindowA("d3d10", "d3d10", WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if(!hwnd) + return FALSE; + + RECT rc; + GetClientRect(hwnd, &rc ); + width = rc.right - rc.left; + height = rc.bottom - rc.top; + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = hwnd; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = buffer_count; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + + D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0; + + HRESULT hr; + if(1) + { + hr = D3D10CreateDeviceAndSwapChain( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev); + } + else + { + hr = D3D10CreateDeviceAndSwapChain1( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG, + feature_level, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + (ID3D10Device1**)&dev); + } + + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr); + return 1; + } + + ctx = dev; + + app = d3d10_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + ShowWindow(hwnd, SW_SHOWDEFAULT); + UpdateWindow(hwnd); + + LARGE_INTEGER freq; + QueryPerformanceFrequency(&freq); + double period = 1.0 / (double)freq.QuadPart; + LARGE_INTEGER ctime_li; + QueryPerformanceCounter(&ctime_li); + double start_time = ctime_li.QuadPart * period; + + MSG msg; + for(;;) + { + if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if(msg.message == WM_QUIT) + break; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if(width && height) + { + ID3D10Texture2D* tex; + static ID3D10RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + QueryPerformanceCounter(&ctime_li); + double ctime = (double)ctime_li.QuadPart * period - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + swap_chain->Present(0, 0); + rtv->Release(); + tex->Release(); + } + else + WaitMessage(); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp new file mode 100755 index 00000000000..4ce3dcf1c56 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp @@ -0,0 +1,164 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define INITGUID +#include "d3d10app.h" +#include +#include +#include +#include + +static d3d10_application* app; +static IDXGISwapChain* swap_chain; +unsigned width, height; +DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D10Device* dev; +static ID3D10Device* ctx; + +static int attributeList[] = { + GLX_RGBA, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + None +}; + +double get_time() +{ + struct timeval tv; + gettimeofday(&tv, 0); + return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001; +} + +int main(int argc, char** argv) +{ + Display* dpy = XOpenDisplay(0); + XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList); + Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); + XSetWindowAttributes swa; + swa.colormap = cmap; + swa.border_pixel = 0; + swa.event_mask = StructureNotifyMask; + width = 512; + height = 512; + Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap| CWEventMask, &swa); + XMapWindow(dpy, win); + + GalliumDXGIUseX11Display(dpy, 0, 0); + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = (HWND)win; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = 3; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + + D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0; + + HRESULT hr; + if(0) + { + hr = D3D10CreateDeviceAndSwapChain( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev); + } + else + { + hr = D3D10CreateDeviceAndSwapChain1( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, + feature_level, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + (ID3D10Device1**)&dev); + } + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr); + return 1; + } + ctx = dev; + + app = d3d10_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + double start_time = get_time(); + + MSG msg; + for(;;) + { + XEvent event; + if(XPending(dpy)) + { + XNextEvent(dpy, &event); + if(event.type == DestroyNotify) + break; + switch(event.type) + { + case ConfigureNotify: + width = event.xconfigure.width; + height = event.xconfigure.height; + swap_chain->ResizeBuffers(3, width, height, format, 0); + break; + } + } + else if(width && height) + { + ID3D10Texture2D* tex; + ID3D10RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, IID_ID3D10Texture2D, (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + double ctime = get_time() - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + tex->Release(); + rtv->Release(); + swap_chain->Present(0, 0); + } + else + XPeekEvent(dpy, &event); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp new file mode 100755 index 00000000000..4e92f0a544c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp @@ -0,0 +1,118 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d10app.h" +#include "d3d10tri.hlsl.ps.h" +#include "d3d10tri.hlsl.vs.h" + +struct vertex { + float position[4]; + float color[4]; +}; + +static struct vertex vertices[3] = +{ + { + { 0.0f, 0.9f, 0.5f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + }, + { + { 0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } + }, + { + { -0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } + }, +}; + +struct d3d10tri : public d3d10_application +{ + ID3D10PixelShader* ps; + ID3D10VertexShader* vs; + ID3D10InputLayout* layout; + ID3D10Buffer* vb; + + virtual bool init(ID3D10Device* dev, int argc, char** argv) + { + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), &vs)); + + D3D10_INPUT_ELEMENT_DESC elements[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0}, + }; + + ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout)); + D3D10_BUFFER_DESC bufferd; + bufferd.ByteWidth = sizeof(vertices); + bufferd.Usage = D3D10_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D10_BIND_VERTEX_BUFFER; + bufferd.CPUAccessFlags = 0; + bufferd.MiscFlags = 0; + + D3D10_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = vertices; + buffersd.SysMemPitch = sizeof(vertices); + buffersd.SysMemSlicePitch = sizeof(vertices); + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); + + return true; + } + + virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + float clear_color[4] = {1, 0, 1, 1}; + D3D10_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (unsigned)width; + vp.Height = (unsigned)height; + vp.MaxDepth = 1.0f; + + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->RSSetViewports(1, &vp); + + ctx->ClearRenderTargetView(rtv, clear_color); + + ctx->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ctx->IASetInputLayout(layout); + unsigned stride = 2 * 4 * 4; + unsigned offset = 0; + ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); + + ctx->VSSetShader(vs); + ctx->PSSetShader(ps); + + ctx->Draw(3, 0); + } +}; + +d3d10_application* d3d10_application_create() +{ + return new d3d10tri(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl new file mode 100755 index 00000000000..6bdd448ce0a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl @@ -0,0 +1,50 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +struct IA2VS +{ + float4 position : POSITION; + float4 color : COLOR; +}; + +struct VS2PS +{ + float4 position : SV_POSITION; + float4 color : COLOR; +}; + +VS2PS vs(IA2VS input) +{ + VS2PS result; + result.position = input.position; + result.color = input.color; + return result; +} + +float4 ps(VS2PS input) : SV_TARGET +{ + return input.color; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h new file mode 100755 index 00000000000..3502d9f7292 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h @@ -0,0 +1,112 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d10tri.hlsl.ps.h /Eps /Tps_4_0 d3d10tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_input_ps linear v1.xyzw +dcl_output o0.xyzw +mov o0.xyzw, v1.xyzw +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 206, 120, + 117, 238, 118, 127, 10, 87, + 80, 75, 114, 198, 95, 2, + 120, 102, 1, 0, 0, 0, + 208, 1, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 20, 1, 0, 0, + 84, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 67, 79, 76, 79, 82, 0, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 171, 171, + 83, 72, 68, 82, 56, 0, + 0, 0, 64, 0, 0, 0, + 14, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h new file mode 100755 index 00000000000..5c941d8a9f8 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h @@ -0,0 +1,128 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d10tri.hlsl.vs.h /Evs /Tvs_4_0 d3d10tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xyzw +dcl_output_siv o0.xyzw, position +dcl_output o1.xyzw +mov o0.xyzw, v0.xyzw +mov o1.xyzw, v1.xyzw +ret +// Approximately 3 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 190, 171, + 186, 20, 44, 105, 95, 129, + 137, 204, 223, 72, 251, 159, + 126, 176, 1, 0, 0, 0, + 28, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 220, 0, + 0, 0, 48, 1, 0, 0, + 160, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 72, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 67, 79, 76, + 79, 82, 0, 171, 79, 83, + 71, 78, 76, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 83, 72, + 68, 82, 104, 0, 0, 0, + 64, 0, 1, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.vcxproj b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.vcxproj new file mode 100755 index 00000000000..f269e3bbc15 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.vcxproj @@ -0,0 +1,98 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {5366F4FD-0E6C-40CC-B2F2-CE3D350F0729} + Win32Proj + d3d10tri + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d10app + + + Console + true + d3d10.lib;d3d10_1.lib;%(AdditionalDependencies) + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d10app + + + Console + true + true + true + d3d10.lib;d3d10_1.lib;%(AdditionalDependencies) + + + + + Document + "$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).ps.h /Eps /Tps_4_0 %(Identity) +"$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).vs.h /Evs /Tvs_4_0 %(Identity) + %(Identity).ps.h;%(Identity).vs.h;%(Outputs) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h new file mode 100755 index 00000000000..9eb69d6f5d8 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h @@ -0,0 +1,51 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef D3D11APP_H +#define D3D11APP_H + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0) + +struct d3d11_application +{ + virtual ~d3d11_application() {} + + virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0; + virtual bool init(ID3D11Device* dev, int argc, char** argv) = 0; +}; + +/* this is the entry point you must provide */ +extern "C" d3d11_application* d3d11_application_create(); + +#endif diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl new file mode 100755 index 00000000000..4075160d170 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl @@ -0,0 +1,53 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +Texture2D tex; +sampler samp; + +struct IA2VS +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD; +}; + +struct VS2PS +{ + float4 position : SV_POSITION; + float2 texcoord : TEXCOORD; +}; + +VS2PS vs_blit(IA2VS input) +{ + VS2PS result; + result.position = input.position; + result.texcoord = input.texcoord; + return result; +} + +float4 ps_blit(VS2PS input) : SV_TARGET +{ + return tex.Sample(samp, input.texcoord); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h new file mode 100755 index 00000000000..d034c872224 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h @@ -0,0 +1,142 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11blit.hlsl.ps.h /Eps_blit /Tps_4_0 d3d11blit.hlsl +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// samp sampler NA NA 0 1 +// tex texture float4 2d 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +sample o0.xyzw, v1.xyxx, t0.xyzw, s0 +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_ps_blit[] = +{ + 68, 88, 66, 67, 183, 100, + 39, 89, 244, 20, 241, 39, + 36, 169, 159, 230, 234, 214, + 114, 11, 1, 0, 0, 0, + 72, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 212, 0, 0, 0, 44, 1, + 0, 0, 96, 1, 0, 0, + 204, 1, 0, 0, 82, 68, + 69, 70, 152, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 101, 0, 0, 0, 92, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 97, 0, 0, 0, 2, 0, + 0, 0, 5, 0, 0, 0, + 4, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 1, 0, 0, 0, 12, 0, + 0, 0, 115, 97, 109, 112, + 0, 116, 101, 120, 0, 77, + 105, 99, 114, 111, 115, 111, + 102, 116, 32, 40, 82, 41, + 32, 72, 76, 83, 76, 32, + 83, 104, 97, 100, 101, 114, + 32, 67, 111, 109, 112, 105, + 108, 101, 114, 32, 57, 46, + 50, 57, 46, 57, 53, 50, + 46, 51, 49, 49, 49, 0, + 171, 171, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 68, 82, 100, 0, 0, 0, + 64, 0, 0, 0, 25, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h new file mode 100755 index 00000000000..8e884d92484 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h @@ -0,0 +1,130 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11blit.hlsl.vs.h /Evs_blit /Tvs_4_0 d3d11blit.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output_siv o0.xyzw, position +dcl_output o1.xy +mov o0.xyzw, v0.xyzw +mov o1.xy, v1.xyxx +ret +// Approximately 3 instruction slots used +#endif + +const BYTE g_vs_blit[] = +{ + 68, 88, 66, 67, 142, 11, + 173, 22, 73, 47, 224, 51, + 147, 83, 148, 177, 56, 17, + 72, 237, 1, 0, 0, 0, + 36, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 56, 1, 0, 0, + 168, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 84, 69, 88, + 67, 79, 79, 82, 68, 0, + 171, 171, 79, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 83, 72, 68, 82, 104, 0, + 0, 0, 64, 0, 1, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 1, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h new file mode 100755 index 00000000000..3b0644a573d --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h @@ -0,0 +1,424 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include + +#include "d3d11blit.hlsl.ps.h" +#include "d3d11blit.hlsl.vs.h" + +template +struct triangle_list_indices : public std::vector +{ + unsigned base; + bool flip; + + triangle_list_indices() + : base(0), flip(false) + {} + + void poly(unsigned a, unsigned b, unsigned c) + { + this->push_back(base + a); + this->push_back(base + (flip ? c : b)); + this->push_back(base + (flip ? b : c)); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d) + { + poly(a, b, c); + poly(a, c, d); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e) + { + poly(a, b, c, d); + poly(a, d, e); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f) + { + poly(a, b, c, d, e); + poly(a, e, f); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g) + { + poly(a, b, c, d, e, f); + poly(a, f, g); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g, unsigned h) + { + poly(a, b, c, d, e, f, g); + poly(a, g, h); + } +}; + +struct mesh +{ + ID3D11InputLayout* layout; + ID3D11Buffer* buffer; + D3D11_PRIMITIVE_TOPOLOGY topology; + unsigned vertex_size; + unsigned draw_count; + DXGI_FORMAT index_format; + unsigned index_offset; + + mesh(ID3D11Device* dev, D3D11_PRIMITIVE_TOPOLOGY topology, + const D3D11_INPUT_ELEMENT_DESC *elements, unsigned num_elements, + const void* vs, unsigned vs_size, + const void* vertices, unsigned vertex_size, unsigned num_vertices, + const void* indices = 0, unsigned index_size = 0, unsigned num_indices = 0) + : topology(topology), vertex_size(vertex_size), draw_count(index_size ? num_indices : num_vertices) + { + dev->CreateInputLayout(elements, num_elements, vs, vs_size, &layout); + if(index_size == 2) + index_format = DXGI_FORMAT_R16_UINT; + else if(index_size == 4) + index_format = DXGI_FORMAT_R32_UINT; + else + index_format = DXGI_FORMAT_UNKNOWN; + this->vertex_size = vertex_size; + index_offset = vertex_size * num_vertices; + + D3D11_BUFFER_DESC bufferd; + memset(&bufferd, 0, sizeof(bufferd)); + bufferd.Usage = D3D11_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + if(index_format) + bufferd.BindFlags |= D3D11_BIND_INDEX_BUFFER; + bufferd.ByteWidth = index_offset + index_format * num_indices; + + char* data = (char*)malloc(bufferd.ByteWidth); + memcpy(data, vertices, vertex_size * num_vertices); + memcpy(data + index_offset, indices, index_size * num_indices); + + D3D11_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = data; + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &buffer)); + free(data); + } + + ~mesh() + { + layout->Release(); + buffer->Release(); + } + + void bind(ID3D11DeviceContext* ctx) + { + unsigned offset = 0; + ctx->IASetPrimitiveTopology(topology); + ctx->IASetInputLayout(layout); + if(index_format) + ctx->IASetIndexBuffer(buffer, index_format, index_offset); + ctx->IASetVertexBuffers(0, 1, &buffer, &vertex_size, &offset); + } + + void draw_bound(ID3D11DeviceContext* ctx) + { + if(index_format) + ctx->DrawIndexed(draw_count, 0, 0); + else + ctx->Draw(draw_count, 0); + } + + void bind_and_draw(ID3D11DeviceContext* ctx) + { + bind(ctx); + draw_bound(ctx); + } +}; + +mesh* create_tex_quad(ID3D11Device* dev, const BYTE* vs, unsigned vs_size) +{ + float quad_data[] = { + -1, -1, 0, 1, + -1, 1, 0, 0, + 1, -1, 1, 1, + 1, 1, 1, 0, + }; + + D3D11_INPUT_ELEMENT_DESC elements[2] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + elements, 2, + vs, vs_size, + quad_data, 4 * sizeof(float), 4, + 0, 0, 0); +} + +struct d3d11_blitter +{ + mesh* quad; + ID3D11VertexShader* vs; + ID3D11PixelShader* ps; + ID3D11SamplerState* sampler[2]; + + d3d11_blitter(ID3D11Device* dev) + { + quad = create_tex_quad(dev, g_vs_blit, sizeof(g_vs_blit)); + + dev->CreateVertexShader(g_vs_blit, sizeof(g_vs_blit), 0, &vs); + dev->CreatePixelShader(g_ps_blit, sizeof(g_ps_blit), 0, &ps); + + for(unsigned i = 0; i < 2; ++i) + { + D3D11_SAMPLER_DESC samplerd; + memset(&samplerd, 0, sizeof(samplerd)); + samplerd.Filter = i ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_LINEAR; + samplerd.AddressU = samplerd.AddressV = samplerd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + dev->CreateSamplerState(&samplerd, &sampler[i]); + } + } + + void bind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear) + { + D3D11_VIEWPORT vp; + vp.TopLeftX = x; + vp.TopLeftY = y; + vp.Width = width; + vp.Height = height; + vp.MinDepth = 0; + vp.MaxDepth = 1; + ctx->RSSetViewports(1, &vp); + ctx->RSSetState(0); + ctx->OMSetBlendState(0, 0, ~0); + ctx->OMSetDepthStencilState(0, 0); + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->VSSetShader(vs, 0, 0); + ctx->PSSetShader(ps, 0, 0); + ctx->PSSetShaderResources(0, 1, &srv); + ctx->PSSetSamplers(0, 1, &sampler[!!linear]); + quad->bind(ctx); + } + + void draw_bound(ID3D11DeviceContext* ctx) + { + quad->draw_bound(ctx); + } + + void bind_draw_and_unbind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear) + { + bind(ctx, srv, rtv, x, y, width, height, linear); + draw_bound(ctx); + unbind(ctx); + } + + void unbind(ID3D11DeviceContext* ctx) + { + void* null = 0; + ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&null); + ctx->PSSetSamplers(0, 1, (ID3D11SamplerState**)&null); + } +}; + +template +struct vec_t +{ + T v[n]; + + T& operator [](unsigned i) + { + return v[i]; + } + + const T& operator [](unsigned i) const + { + return v[i]; + } +}; + +template +vec_t operator -(const vec_t a) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = -a[i]; + return r; +} + +template +vec_t operator +(const vec_t& a, const vec_t& b) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = a[i] + b[i]; + return r; +} + +template +vec_t& operator +=(vec_t& a, const vec_t& b) +{ + for(unsigned i = 0; i < n; ++i) + a[i] += b[i]; + return a; +} + +template +struct mat_t : public vec_t, c> +{}; + +template +vec_t operator *(const vec_t& a, const T& b) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = a[i] * b; + return r; +} + +template +vec_t operator *(const T& b, const vec_t& a) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = a[i] * b; + return r; +} + +template +vec_t operator *(const mat_t& m, const vec_t& b) +{ + vec_t r; + r = m[0] * b[0]; + for(unsigned i = 1; i < d; ++i) + r += m[i] * b[i]; + return r; +} + +template +mat_t operator *(const mat_t& m, const mat_t& b) +{ + mat_t r; + for(unsigned i = 0; i < d; ++i) + r[i] = m * b[i]; + return r; +} + +template +vec_t vec(T a, T b, T c) +{ + vec_t v; + v[0] = a; + v[1] = b; + v[2] = c; + return v; +} + +template +vec_t vec(T a, T b, T c, T d) +{ + vec_t v; + v[0] = a; + v[1] = b; + v[2] = c; + v[3] = d; + return v; +} + +typedef mat_t float4x4; +typedef mat_t float4x3; +typedef mat_t float3x4; +typedef mat_t float3x3; + +typedef vec_t float3; +typedef vec_t float4; + +template +mat_t mat4x4_frustum(T left, T right, T bottom, T top, T nearval, T farval) +{ + T x = (2.0f * nearval) / (right - left); + T y = (2.0f * nearval) / (top - bottom); + T a = (right + left) / (right - left); + T b = (top + bottom) / (top - bottom); + T c = -(farval + nearval) / (farval - nearval); + T d = -(2.0f * farval * nearval) / (farval - nearval); + T _0 = (T)0; + + mat_t m; + m[0] = vec(x, _0, _0, _0); + m[1] = vec(_0, y, _0, _0); + m[2] = vec(a, b, c, (T)-1); + m[3] = vec(_0, _0, d, _0); + return m; +} + +template +mat_t mat3x3_diag(T v) +{ + mat_t m; + T _0 = (T)0; + m[0] = vec(v, _0, _0); + m[1] = vec(_0, v, _0); + m[2] = vec(_0, _0, v); + return m; +} + +template +mat_t mat4x4_diag(T v) +{ + mat_t m; + T _0 = (T)0; + m[0] = vec(v, _0, _0, _0); + m[1] = vec(_0, v, _0, _0); + m[2] = vec(_0, _0, v, _0); + m[3] = vec(_0, _0, _0, v); + return m; +} + +template +mat_t mat_push_rotate(const mat_t& m, unsigned axis, T angle) +{ + T s = (T)sin(angle); + T c = (T)cos(angle); + + mat_t r = m; + unsigned a = (axis + 1) % 3; + unsigned b = (axis + 2) % 3; + r[a] = (m[a] * c) + (m[b] * s); + r[b] = -(m[a] * s) + (m[b] * c); + return r; +} + +template +mat_t mat_push_translate(const mat_t& m, float x, float y, float z) +{ + mat_t r = m; + vec_t v; + v[0] = x; + v[1] = y; + v[2] = z; + if(n >= 4) + v[3] = (T)0; + r[3] += m * v; + return r; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp new file mode 100755 index 00000000000..76903e57f09 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp @@ -0,0 +1,172 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define INITGUID +#include "d3d11app.h" +#include "stdio.h" + +static d3d11_application* app; +static IDXGISwapChain* swap_chain; +static unsigned width, height; +static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D11Device* dev; +static ID3D11DeviceContext* ctx; +static int frames = 0; +static int buffer_count = 1; + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_SIZE: + width = lParam & 0xffff; + height = lParam >> 16; + + swap_chain->ResizeBuffers(buffer_count, width, height, format, 0); + frames = 0; + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + return 0; +} + +int main(int argc, char** argv) +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + WNDCLASSEXA wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = "d3d11"; + wcex.hIconSm = 0; + + RegisterClassExA(&wcex); + + HWND hwnd = CreateWindowA("d3d11", "d3d11", WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if(!hwnd) + return FALSE; + + RECT rc; + GetClientRect(hwnd, &rc ); + width = rc.right - rc.left; + height = rc.bottom - rc.top; + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = hwnd; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = buffer_count; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + + D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; + + HRESULT hr = D3D11CreateDeviceAndSwapChain( + NULL, + D3D_DRIVER_TYPE_HARDWARE, + NULL, + D3D11_CREATE_DEVICE_SINGLETHREADED, // | D3D11_CREATE_DEVICE_DEBUG, + NULL, + 0, + D3D11_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev, + &feature_level, + &ctx); + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr); + return 1; + } + + app = d3d11_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + ShowWindow(hwnd, SW_SHOWDEFAULT); + UpdateWindow(hwnd); + + LARGE_INTEGER freq; + QueryPerformanceFrequency(&freq); + double period = 1.0 / (double)freq.QuadPart; + LARGE_INTEGER ctime_li; + QueryPerformanceCounter(&ctime_li); + double start_time = ctime_li.QuadPart * period; + + MSG msg; + for(;;) + { + if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if(msg.message == WM_QUIT) + break; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if(width && height) + { + ID3D11Texture2D* tex; + static ID3D11RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + QueryPerformanceCounter(&ctime_li); + double ctime = (double)ctime_li.QuadPart * period - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + swap_chain->Present(0, 0); + rtv->Release(); + tex->Release(); + } + else + WaitMessage(); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp new file mode 100755 index 00000000000..9dcb32537e7 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp @@ -0,0 +1,124 @@ +#define INITGUID +#include "d3d11app.h" +#include +#include +#include +#include + +static d3d11_application* app; +static IDXGISwapChain* swap_chain; +unsigned width, height; +DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D11Device* dev; +static ID3D11DeviceContext* ctx; + +static int attributeList[] = { + GLX_RGBA, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + None +}; + +double get_time() +{ + struct timeval tv; + gettimeofday(&tv, 0); + return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001; +} + +int main(int argc, char** argv) +{ + Display* dpy = XOpenDisplay(0); + XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList); + Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); + XSetWindowAttributes swa; + swa.colormap = cmap; + swa.border_pixel = 0; + swa.event_mask = StructureNotifyMask; + width = 512; + height = 512; + Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap| CWEventMask, &swa); + XMapWindow(dpy, win); + + GalliumDXGIUseX11Display(dpy, 0, 0); + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = (HWND)win; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = 3; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + + D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; + + HRESULT hr =D3D11CreateDeviceAndSwapChain( + NULL, + D3D_DRIVER_TYPE_HARDWARE, + NULL, + D3D11_CREATE_DEVICE_SINGLETHREADED, + NULL, + 0, + D3D11_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev, + &feature_level, + &ctx); + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr); + return 1; + } + + app = d3d11_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + double start_time = get_time(); + + MSG msg; + for(;;) + { + XEvent event; + if(XPending(dpy)) + { + XNextEvent(dpy, &event); + if(event.type == DestroyNotify) + break; + switch(event.type) + { + case ConfigureNotify: + width = event.xconfigure.width; + height = event.xconfigure.height; + swap_chain->ResizeBuffers(3, width, height, format, 0); + break; + } + } + else if(width && height) + { + ID3D11Texture2D* tex; + ID3D11RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + double ctime = get_time() - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + tex->Release(); + rtv->Release(); + swap_chain->Present(0, 0); + } + else + XPeekEvent(dpy, &event); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp new file mode 100755 index 00000000000..32a63ae6dd5 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp @@ -0,0 +1,573 @@ +/* +* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +* Copyright (C) 2009-2010 Luca Barbieri 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, sublicense, +* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL +* BRIAN PAUL 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. +*/ + +/* +* This is a port of the infamous "glxgears" demo to straight EGL +* Port by Dane Rushton 10 July 2005 +* +* This a rewrite of the 'eglgears' demo in straight Gallium +* Port by Luca Barbieri +* +* This a port of the 'galliumgears' demo to Direct3D 11 +* Port by Luca Barbieri +*/ + +#define _USE_MATH_DEFINES +#include "d3d11app.h" +#include "d3d11u.h" +#include "d3d11gears.hlsl.ps.h" +#include "d3d11gears.hlsl.vs.h" + +#include +#include +#include +#include + +struct gear +{ + struct mesh* mesh; + float x; + float y; + float t0; + float wmul; + float4 color; +}; + +struct cbuf_t +{ + float4x4 projection; + float4x4 modelview; + float4 light; + float4 diffuse; + float4 specular; + float specular_power; + float padding[3]; +}; + +struct gear gears[3]; + +struct vertex +{ + float position[3]; + float normal[3]; + + vertex(float x, float y, float z, float nx, float ny, float nz) + { + position[0] = x; + position[1] = y; + position[2] = z; + normal[0] = nx; + normal[1] = ny; + normal[2] = nz; + } +}; + +#define VERT(x, y, z) vertices.push_back(vertex((x), (y), (z), (nx), (ny), (nz))) + +static mesh* build_gear(ID3D11Device* dev, int triangle_budget, float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) +{ + int i, j, k; + float r0, r1, r2; + float da; + float nx, ny, nz; + int face; + int segs = 4; + int base_triangles = teeth * segs * 2 * 2; + int divs0 = (triangle_budget / base_triangles) - 1; + int divs = (divs0 > 0) ? divs0 : 1; + float* c = (float*)malloc(teeth * segs * sizeof(float)); + float* s = (float*)malloc(teeth * segs * sizeof(float)); + float* dc = (float*)malloc(teeth * segs * divs * sizeof(float)); + float* ds = (float*)malloc(teeth * segs * divs * sizeof(float)); + int num_vertices = teeth * segs * 2 * (3 + 2 * divs); + int num_triangles = base_triangles * (1 + divs); + printf("Creating gear with %i teeth using %i vertices used in %i triangles\n", teeth, num_vertices, num_triangles); + triangle_list_indices<> indices; + std::vector vertices; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0f; + r2 = outer_radius + tooth_depth / 2.0f; + + da = (float)(2.0 * M_PI / (teeth * segs * divs)); + for(i = 0; i < teeth * segs * divs; ++i) { + float angle = da * i; + ds[i] = sin(angle); + dc[i] = cos(angle); + } + + for(i = 0; i < teeth * segs; ++i) { + s[i] = ds[i * divs]; + c[i] = dc[i * divs]; + } + + /* faces */ + for(face = -1; face <= 1; face += 2) { + float z = width * face * 0.5f; + nx = 0.0f; + ny = 0.0f; + nz = (float)face; + + indices.flip = face > 0; + + assert(segs == 4); + for(i = 0; i < teeth; ++i) { + VERT(r1 * c[segs * i], r1 * s[segs * i], z); + VERT(r2 * c[segs * i + 1], r2 * s[segs * i + 1], z); + VERT(r2 * c[segs * i + 2], r2 * s[segs * i + 2], z); + VERT(r1 * c[segs * i + 3], r1 * s[segs * i + 3], z); + } + + for(i = 0; i < teeth * segs * divs; ++i) { + VERT(r0 * dc[i], r0 * ds[i], z); + } + + for(i = 0; i < teeth; ++i) { + for(j = i * segs; j < (i + 1) * segs; ++j) { + int nextj = j + 1; + if(nextj == teeth * segs) + nextj = 0; + + for(k = j * divs; k < (j + 1) * divs; ++k) { + int nextk = k + 1; + if(nextk == teeth * segs * divs) + nextk = 0; + indices.poly(teeth * segs + k, j, teeth * segs + nextk); + } + + indices.poly(teeth * segs + nextj * divs, j, nextj); + } + } + + indices.base += teeth * segs * (1 + divs); + } + + /* teeth faces */ + indices.flip = true; + float z = width * 0.5f; + + float* coords = (float*)malloc((segs + 1) * 2 * sizeof(float)); + nz = 0; + for(i = 0; i < teeth; i++) { + int next = i + 1; + if(next == teeth) + next = 0; + + coords[0] = r1 * c[segs * i]; + coords[1] = r1 * s[segs * i]; + coords[2] = r2 * c[segs * i + 1]; + coords[3] = r2 * s[segs * i + 1]; + coords[4] = r2 * c[segs * i + 2]; + coords[5] = r2 * s[segs * i + 2]; + coords[6] = r1 * c[segs * i + 3]; + coords[7] = r1 * s[segs * i + 3]; + coords[8] = r1 * c[segs * next]; + coords[9] = r1 * s[segs * next]; + + for(int j = 0; j < segs; ++j) { + float dx = coords[j * 2] - coords[j * 2 + 2]; + float dy = coords[j * 2 + 1] - coords[j * 2 + 3]; + float len = hypotf(dx, dy); + nx = -dy / len; + ny = dx / len; + VERT(coords[j * 2], coords[j * 2 + 1], z); + VERT(coords[j * 2], coords[j * 2 + 1], -z); + VERT(coords[j * 2 + 2], coords[j * 2 + 3], z); + VERT(coords[j * 2 + 2], coords[j * 2 + 3], -z); + + indices.poly(0, 1, 3, 2); + indices.base += 4; + } + } + free(coords); + + /* inner part - simulate a cylinder */ + indices.flip = true; + for(i = 0; i < teeth * segs * divs; i++) { + int next = i + 1; + if(next == teeth * segs * divs) + next = 0; + + nx = -dc[i]; + ny = -ds[i]; + VERT(r0 * dc[i], r0 * ds[i], -width * 0.5f); + VERT(r0 * dc[i], r0 * ds[i], width * 0.5f); + + indices.poly(i * 2, i * 2 + 1, next * 2 + 1, next * 2); + } + + indices.base += teeth * segs * divs * 2; + free(c); + free(s); + free(dc); + free(ds); + + D3D11_INPUT_ELEMENT_DESC elements[2] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + elements, 2, + g_vs, sizeof(g_vs), + &vertices[0], sizeof(vertices[0]), vertices.size(), + &indices[0], sizeof(indices[0]), indices.size()); +} + +struct d3d11gears : public d3d11_application +{ + float view_rotx; + float view_roty; + float view_rotz; + int wireframe; + int triangles; + float speed; + float period; + unsigned impressions; + bool blue_only; + + float last_time; + + int cur_width; + int cur_height; + + ID3D11DepthStencilView* zsv; + ID3D11RenderTargetView* offscreen_rtv; + ID3D11ShaderResourceView* offscreen_srv; + + ID3D11Device* dev; + ID3D11BlendState* blend; + ID3D11DepthStencilState* zsa; + + ID3D11PixelShader* ps; + ID3D11VertexShader* vs; + ID3D11Buffer* cb; + + d3d11_blitter* blitter; + + d3d11gears() + : cur_width(-1), cur_height(-1), zsv(0), offscreen_rtv(0), offscreen_srv(0) + { + view_rotx = (float)(M_PI / 9.0); + view_roty = (float)(M_PI / 6.0); + view_rotz = 0.0f; + wireframe = 0; + triangles = 3200; + speed = 1.0f; + period = -1.0f; + impressions = 1; + blue_only = false; + } + + void draw_one(ID3D11DeviceContext* ctx, cbuf_t& cbd, const float4x4& modelview, float angle) + { + for(unsigned i = blue_only ? 2 : 0; i < 3; ++i) + { + float4x4 m2 = modelview; + m2 = mat_push_translate(m2, gears[i].x, gears[i].y, 0.0f); + m2 = mat_push_rotate(m2, 2, angle * gears[i].wmul + gears[i].t0); + + cbd.modelview = m2; + cbd.diffuse = gears[i].color; + cbd.specular = gears[i].color; + cbd.specular_power = 5.0f; + + ctx->UpdateSubresource(cb, 0, 0, &cbd, 0, 0); + + gears[i].mesh->bind_and_draw(ctx); + } + } + + float get_angle(double time) + { + // designed so that 1 = original glxgears speed + float mod_speed = M_PI * 70.0f / 180.0f * speed; + if(period < 0) + return (float)(time * mod_speed); + else + return (float)(cos(time / period) * period * mod_speed); + } + + void init_for_dimensions(unsigned width, unsigned height) + { + if(zsv) + zsv->Release(); + ID3D11Texture2D* zsbuf; + D3D11_TEXTURE2D_DESC zsbufd; + memset(&zsbufd, 0, sizeof(zsbufd)); + zsbufd.Width = width; + zsbufd.Height = height; + zsbufd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + zsbufd.ArraySize = 1; + zsbufd.MipLevels = 1; + zsbufd.SampleDesc.Count = 1; + zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL; + ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf)); + ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv)); + zsbuf->Release(); + + ID3D11Texture2D* offscreen; + if(offscreen_rtv) + { + offscreen_rtv->Release(); + offscreen_srv->Release(); + offscreen_rtv = 0; + offscreen_srv = 0; + } + + if(impressions > 1) + { + DXGI_FORMAT formats[] = { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R10G10B10A2_UNORM, + }; + DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; // this won't work well at all + unsigned needed_support = D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE; + for(unsigned i = 0; i < sizeof(formats); ++i) + { + unsigned support; + dev->CheckFormatSupport(DXGI_FORMAT_R32G32B32A32_FLOAT, &support); + if((support & needed_support) == needed_support) + { + format = formats[i]; + break; + } + } + + + D3D11_TEXTURE2D_DESC offscreend; + memset(&offscreend, 0, sizeof(offscreend)); + offscreend.Width = width; + offscreend.Height = height; + + offscreend.Format = format; + offscreend.MipLevels = 1; + offscreend.ArraySize = 1; + offscreend.SampleDesc.Count = 1; + offscreend.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; + ensure(dev->CreateTexture2D(&offscreend, 0, &offscreen)); + ensure(dev->CreateRenderTargetView(offscreen, 0, &offscreen_rtv)); + ensure(dev->CreateShaderResourceView(offscreen, 0, &offscreen_srv)); + offscreen->Release(); + } + + cur_width = width; + cur_height = height; + } + + void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + if((int)width != cur_width || (int)height != cur_height) + init_for_dimensions(width, height); + + float4 lightpos = vec(5.0f, 5.0f, 10.0f, 0.0f); + float black[4] = {0.0, 0.0, 0.0, 0}; + + float4x4 proj; + float4x4 m; + + float xr = (float)width / (float)height; + float yr = 1.0f; + if(xr < 1.0f) { + yr /= xr; + xr = 1.0f; + } + proj = mat4x4_frustum(-xr, xr, -yr, yr, 5.0f, 60.0f); + + m = mat4x4_diag(1.0f); + m = mat_push_translate(m, 0.0f, 0.0f, -40.0f); + m = mat_push_rotate(m, 0, view_rotx); + m = mat_push_rotate(m, 1, view_roty); + m = mat_push_rotate(m, 2, view_rotz); + + cbuf_t cbd; + + cbd.projection = proj; + cbd.light = lightpos; + + float blend_factor[4] = {1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions}; + + ID3D11RenderTargetView* render_rtv; + if(impressions == 1) + render_rtv = rtv; + else + render_rtv = offscreen_rtv; + + ctx->RSSetViewports(1, &vp); + ctx->ClearRenderTargetView(render_rtv, black); + + ctx->PSSetShader(ps, 0, 0); + ctx->VSSetShader(vs, 0, 0); + + ctx->PSSetConstantBuffers(0, 1, &cb); + ctx->VSSetConstantBuffers(0, 1, &cb); + + if(impressions == 1) + { + ctx->OMSetBlendState(0, 0, ~0); + ctx->OMSetDepthStencilState(0, 0); + ctx->OMSetRenderTargets(1, &rtv, zsv); + ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); + draw_one(ctx, cbd, m, get_angle(time)); + } + else + { + ctx->OMSetBlendState(blend, blend_factor, ~0); + + float time_delta = (float)time - last_time; + float time_delta_per_impression = time_delta / impressions; + float base_time = last_time + time_delta_per_impression / 2; + for(unsigned impression = 0; impression < impressions; ++impression) + { + float impression_time = base_time + time_delta_per_impression * impression; + + ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); + + // do early z-pass since we must not write any pixel more than once due to blending + for(unsigned pass = 0; pass < 2; ++pass) + { + if(pass == 0) + { + ctx->OMSetRenderTargets(0, 0, zsv); + ctx->OMSetDepthStencilState(0, 0); + } + else + { + ctx->OMSetRenderTargets(1, &render_rtv, zsv); + ctx->OMSetDepthStencilState(zsa, 0); + } + + draw_one(ctx, cbd, m, get_angle(impression_time)); + } + } + + blitter->bind_draw_and_unbind(ctx, offscreen_srv, rtv, 0, 0, (float)width, (float)height, false); + } + last_time = (float)time; + } + + bool init(ID3D11Device* dev, int argc, char** argv) + { + this->dev = dev; + + for(char** p = argv + 1; *p; ++p) { + if(!strcmp(*p, "-w")) + wireframe = 1; + else if(!strcmp(*p, "-b")) + blue_only = true; + else if(!strcmp(*p, "-t")) + triangles = atoi(*++p); + else if(!strcmp(*p, "-m")) + impressions = (float)atof(*++p); + else if(!strcmp(*p, "-p")) + period = (float)atof(*++p); + else if(!strcmp(*p, "-s")) + speed = (float)atof(*++p); + else { + fprintf(stderr, "Usage: d3d11gears [-v|-w] [-t TRIANGLES]\n"); + fprintf(stderr, "d3d11gears is an enhanced port of glxgears to Direct3D 11\n"); + fprintf(stderr, "\n"); + //fprintf(stderr, "-v\t\tuse per-vertex diffuse-only lighting (classic glxgears look)\n"); + fprintf(stderr, "-w\t\twireframe mode\n"); + fprintf(stderr, "-t TRIANGLES\ttriangle budget (default is 3200)\n"); + fprintf(stderr, "-m IMPRESSIONS\tmotion blur impressions (default is 1)\n"); + fprintf(stderr, "-p PERIOD\tspeed reversal period (default is infinite)\n"); + fprintf(stderr, "-s SPEED\tgear speed (default is 1.0)\n"); + fprintf(stderr, "-b\tonly show blue gear (for faster motion blur)\n"); + return false; + } + } + + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + + gears[0].color = vec(0.8f, 0.1f, 0.0f, 1.0f); + gears[1].color = vec(0.0f, 0.8f, 0.2f, 1.0f); + gears[2].color = vec(0.2f, 0.2f, 1.0f, 1.0f); + + gears[0].mesh = build_gear(dev, triangles / 2, 1.0f, 4.0f, 1.0f, 20, 0.7f); + gears[1].mesh = build_gear(dev, triangles / 4, 0.5f, 2.0f, 2.0f, 10, 0.7f); + gears[2].mesh = build_gear(dev, triangles / 4, 1.3f, 2.0f, 0.5f, 10, 0.7f); + + gears[0].x = -3.0f; + gears[0].y = -2.0f; + gears[0].wmul = 1.0f; + gears[0].t0 = 0.0 * M_PI / 180.0f; + + gears[1].x = 3.1f; + gears[1].y = -2.0f; + gears[1].wmul = -2.0f; + gears[1].t0 = -9.0f * (float)M_PI / 180.0f; + + gears[2].x = -3.1f; + gears[2].y = 4.2f; + gears[2].wmul = -2.0f; + gears[2].t0 = -25.0f * (float)M_PI / 180.0f; + + D3D11_BUFFER_DESC bufferd; + memset(&bufferd, 0, sizeof(bufferd)); + bufferd.ByteWidth = sizeof(cbuf_t); + bufferd.Usage = D3D11_USAGE_DEFAULT; + bufferd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + ensure(dev->CreateBuffer(&bufferd, 0, &cb)); + + if(impressions > 1) + { + D3D11_BLEND_DESC blendd; + memset(&blendd, 0, sizeof(blendd)); + blendd.RenderTarget[0].BlendEnable = TRUE; + blendd.RenderTarget[0].BlendOp = blendd.RenderTarget[0].BlendOpAlpha + = D3D11_BLEND_OP_ADD; + blendd.RenderTarget[0].SrcBlend = blendd.RenderTarget[0].SrcBlendAlpha + = D3D11_BLEND_BLEND_FACTOR; + blendd.RenderTarget[0].DestBlend = blendd.RenderTarget[0].DestBlendAlpha + = D3D11_BLEND_ONE; + blendd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + ensure(dev->CreateBlendState(&blendd, &blend)); + + D3D11_DEPTH_STENCIL_DESC zsad; + memset(&zsad, 0, sizeof(zsad)); + zsad.DepthEnable = TRUE; + zsad.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + zsad.DepthFunc = D3D11_COMPARISON_EQUAL; + ensure(dev->CreateDepthStencilState(&zsad, &zsa)); + + blitter = new d3d11_blitter(dev); + } + + return true; + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11gears(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl new file mode 100755 index 00000000000..679d417cd78 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl @@ -0,0 +1,75 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +cbuffer cb +{ + float4x4 proj; + float4x4 modelview; + float4 light; + float4 diffuse; + float4 specular; + float specular_power; +}; + +struct IA2VS +{ + float4 position : POSITION; + float3 normal : NORMAL; +}; + +struct VS2PS +{ + float4 position : SV_POSITION; + float3 normal : NORMAL; + float3 eye : EYE; + float3 light : LIGHT; +}; + +VS2PS vs(IA2VS input) +{ + VS2PS result; + + float3 view = mul((float3x4)modelview, input.position); + result.position = mul((float4x4)proj, float4(view, 1)); + result.light = light - view; + result.eye = -view; + result.normal = mul((float3x3)modelview, input.normal); + + return result; +} + +float4 ps(VS2PS input) : SV_TARGET +{ + float3 nlight = normalize(input.light); + float3 nnormal = normalize(input.normal); + + float diffuse_c = saturate(dot(nnormal, nlight)); + float specular_c = pow(saturate(dot(nnormal, normalize(normalize(input.eye) + nlight))), specular_power); + + return diffuse * diffuse_c + specular * specular_c; +} + + diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h new file mode 100755 index 00000000000..890b1af276b --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h @@ -0,0 +1,309 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11gears.hlsl.ps.h /Eps /Tps_4_0 d3d11gears.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb +// { +// +// float4x4 proj; // Offset: 0 Size: 64 [unused] +// float4x4 modelview; // Offset: 64 Size: 64 [unused] +// float4 light; // Offset: 128 Size: 16 [unused] +// float4 diffuse; // Offset: 144 Size: 16 +// float4 specular; // Offset: 160 Size: 16 +// float specular_power; // Offset: 176 Size: 4 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb cbuffer NA NA 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// NORMAL 0 xyz 1 NONE float xyz +// EYE 0 xyz 2 NONE float xyz +// LIGHT 0 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer cb0[12], immediateIndexed +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xyz +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 3 +dp3 r0.x, v2.xyzx, v2.xyzx +rsq r0.x, r0.x +dp3 r0.y, v3.xyzx, v3.xyzx +rsq r0.y, r0.y +mul r0.yzw, r0.yyyy, v3.xxyz +mad r1.xyz, v2.xyzx, r0.xxxx, r0.yzwy +dp3 r0.x, r1.xyzx, r1.xyzx +rsq r0.x, r0.x +mul r1.xyz, r0.xxxx, r1.xyzx +dp3 r0.x, v1.xyzx, v1.xyzx +rsq r0.x, r0.x +mul r2.xyz, r0.xxxx, v1.xyzx +dp3_sat r0.x, r2.xyzx, r1.xyzx +dp3_sat r0.y, r2.xyzx, r0.yzwy +log r0.x, r0.x +mul r0.x, r0.x, cb0[11].x +exp r0.x, r0.x +mul r1.xyzw, r0.xxxx, cb0[10].xyzw +mad o0.xyzw, cb0[9].xyzw, r0.yyyy, r1.xyzw +ret +// Approximately 20 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 91, 23, + 206, 102, 23, 38, 122, 59, + 55, 123, 215, 57, 98, 213, + 215, 191, 1, 0, 0, 0, + 92, 5, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 192, 1, 0, 0, 80, 2, + 0, 0, 132, 2, 0, 0, + 224, 4, 0, 0, 82, 68, + 69, 70, 132, 1, 0, 0, + 1, 0, 0, 0, 64, 0, + 0, 0, 1, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 80, 1, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 0, 171, 60, 0, + 0, 0, 6, 0, 0, 0, + 88, 0, 0, 0, 192, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 232, 0, + 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 10, 1, + 0, 0, 128, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 32, 1, + 0, 0, 144, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 40, 1, + 0, 0, 160, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 49, 1, + 0, 0, 176, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 64, 1, 0, 0, + 0, 0, 0, 0, 112, 114, + 111, 106, 0, 171, 171, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 109, 111, + 100, 101, 108, 118, 105, 101, + 119, 0, 108, 105, 103, 104, + 116, 0, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 100, 105, 102, 102, 117, 115, + 101, 0, 115, 112, 101, 99, + 117, 108, 97, 114, 0, 115, + 112, 101, 99, 117, 108, 97, + 114, 95, 112, 111, 119, 101, + 114, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 57, + 46, 50, 57, 46, 57, 53, + 50, 46, 51, 49, 49, 49, + 0, 171, 171, 171, 73, 83, + 71, 78, 136, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 116, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 7, 7, + 0, 0, 123, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 7, 7, + 0, 0, 127, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 7, 7, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 78, 79, 82, 77, + 65, 76, 0, 69, 89, 69, + 0, 76, 73, 71, 72, 84, + 0, 171, 171, 171, 79, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 84, + 65, 82, 71, 69, 84, 0, + 171, 171, 83, 72, 68, 82, + 84, 2, 0, 0, 64, 0, + 0, 0, 149, 0, 0, 0, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 18, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 226, 0, + 16, 0, 0, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 6, 25, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 16, 32, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 16, 32, + 0, 7, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 150, 7, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 11, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 50, 0, + 0, 10, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 20, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h new file mode 100755 index 00000000000..3170d3a0b65 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h @@ -0,0 +1,308 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11gears.hlsl.vs.h /Evs /Tvs_4_0 d3d11gears.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb +// { +// +// float4x4 proj; // Offset: 0 Size: 64 +// float4x4 modelview; // Offset: 64 Size: 64 +// float4 light; // Offset: 128 Size: 16 +// float4 diffuse; // Offset: 144 Size: 16 [unused] +// float4 specular; // Offset: 160 Size: 16 [unused] +// float specular_power; // Offset: 176 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb cbuffer NA NA 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// EYE 0 xyz 2 NONE float xyz +// LIGHT 0 xyz 3 NONE float xyz +// +vs_4_0 +dcl_constantbuffer cb0[9], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_output_siv o0.xyzw, position +dcl_output o1.xyz +dcl_output o2.xyz +dcl_output o3.xyz +dcl_temps 2 +mul r0.xyz, v0.yyyy, cb0[5].xyzx +mad r0.xyz, cb0[4].xyzx, v0.xxxx, r0.xyzx +mad r0.xyz, cb0[6].xyzx, v0.zzzz, r0.xyzx +mad r0.xyz, cb0[7].xyzx, v0.wwww, r0.xyzx +mul r1.xyzw, r0.yyyy, cb0[1].xyzw +mad r1.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw +mad r1.xyzw, cb0[2].xyzw, r0.zzzz, r1.xyzw +add o0.xyzw, r1.xyzw, cb0[3].xyzw +mul r1.xyz, v1.yyyy, cb0[5].xyzx +mad r1.xyz, cb0[4].xyzx, v1.xxxx, r1.xyzx +mad o1.xyz, cb0[6].xyzx, v1.zzzz, r1.xyzx +mov o2.xyz, -r0.xyzx +add o3.xyz, -r0.xyzx, cb0[8].xyzx +ret +// Approximately 14 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 251, 82, + 65, 114, 135, 66, 139, 83, + 7, 10, 20, 121, 102, 38, + 44, 36, 1, 0, 0, 0, + 104, 5, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 192, 1, 0, 0, 16, 2, + 0, 0, 160, 2, 0, 0, + 236, 4, 0, 0, 82, 68, + 69, 70, 132, 1, 0, 0, + 1, 0, 0, 0, 64, 0, + 0, 0, 1, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 80, 1, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 0, 171, 60, 0, + 0, 0, 6, 0, 0, 0, + 88, 0, 0, 0, 192, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 232, 0, + 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 2, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 2, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 10, 1, + 0, 0, 128, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 32, 1, + 0, 0, 144, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 40, 1, + 0, 0, 160, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 49, 1, + 0, 0, 176, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 64, 1, 0, 0, + 0, 0, 0, 0, 112, 114, + 111, 106, 0, 171, 171, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 109, 111, + 100, 101, 108, 118, 105, 101, + 119, 0, 108, 105, 103, 104, + 116, 0, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 100, 105, 102, 102, 117, 115, + 101, 0, 115, 112, 101, 99, + 117, 108, 97, 114, 0, 115, + 112, 101, 99, 117, 108, 97, + 114, 95, 112, 111, 119, 101, + 114, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 57, + 46, 50, 57, 46, 57, 53, + 50, 46, 51, 49, 49, 49, + 0, 171, 171, 171, 73, 83, + 71, 78, 72, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 15, + 0, 0, 65, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 7, 7, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 78, + 79, 82, 77, 65, 76, 0, + 79, 83, 71, 78, 136, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 8, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 127, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 8, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 78, 79, + 82, 77, 65, 76, 0, 69, + 89, 69, 0, 76, 73, 71, + 72, 84, 0, 171, 171, 171, + 83, 72, 68, 82, 68, 2, + 0, 0, 64, 0, 1, 0, + 145, 0, 0, 0, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 3, 0, 0, 0, + 104, 0, 0, 2, 2, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 86, 21, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 6, 16, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 166, 26, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 246, 31, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 166, 10, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 86, 21, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 6, 16, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 166, 26, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 114, 32, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 9, + 114, 32, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 14, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.vcxproj b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.vcxproj new file mode 100755 index 00000000000..eb2c37a9615 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.vcxproj @@ -0,0 +1,100 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {706313AB-8F2C-48D2-9F67-31AA043F48C9} + Win32Proj + d3d11gears + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + d3d11.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + true + true + d3d11.lib;%(AdditionalDependencies) + + + + + + + + + Document + "$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).ps.h /Eps /Tps_4_0 %(Identity) +"$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).vs.h /Evs /Tvs_4_0 %(Identity) + %(Identity).ps.h;%(Identity).vs.h;%(Outputs) + + + + + + + + + + + \ No newline at end of file diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp new file mode 100755 index 00000000000..31af95ca2c4 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp @@ -0,0 +1,227 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define _USE_MATH_DEFINES +#include "d3d11app.h" +#include "d3d11spikysphere.hlsl.vs.h" +#include "d3d11spikysphere.hlsl.hs.h" +#include "d3d11spikysphere.hlsl.ds.h" +#include "d3d11spikysphere.hlsl.ps.h" + +#include +#include +#include +#include +#include + +struct cb_frame_t +{ + D3DXMATRIX model; + D3DXMATRIX view_proj; + float disp_scale; + float disp_freq; + float tess_factor; +}; + +static float vertex_data[] = +{ + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + + 0.0, 1.0, 0.0, + -1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + + 0.0, -1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + + -1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0, + + 0.0, 1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, -1.0, + + -1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0, + + 1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0, + + 0.0, -1.0, 0.0, + -1.0, 0.0, 0.0, + 0.0, 0.0, -1.0, +}; + +struct d3d11spikysphere : public d3d11_application +{ + ID3D11Device* dev; + ID3D11PixelShader* ps; + ID3D11DomainShader* ds; + ID3D11HullShader* hs; + ID3D11VertexShader* vs; + ID3D11InputLayout* layout; + ID3D11Buffer* vb; + ID3D11RenderTargetView* rtv; + ID3D11DepthStencilView* zsv; + ID3D11Buffer* cb_frame; + + int cur_width; + int cur_height; + + d3d11spikysphere() + : cur_width(-1), cur_height(-1), zsv(0) + {} + + bool init(ID3D11Device* dev, int argc, char** argv) + { + this->dev = dev; + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + ensure(dev->CreateHullShader(g_hs, sizeof(g_hs), NULL, &hs)); + ensure(dev->CreateDomainShader(g_ds, sizeof(g_ds), NULL, &ds)); + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + + D3D11_INPUT_ELEMENT_DESC elements[1] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, + 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + ensure(dev->CreateInputLayout(elements, 1, g_vs, sizeof(g_vs), &layout)); + + D3D11_BUFFER_DESC bufferd; + bufferd.ByteWidth = sizeof(vertex_data); + bufferd.Usage = D3D11_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufferd.CPUAccessFlags = 0; + bufferd.MiscFlags = 0; + bufferd.StructureByteStride = 0; + + D3D11_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = vertex_data; + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); + + D3D11_BUFFER_DESC cbd; + cbd.ByteWidth = (sizeof(cb_frame_t) + 15) & ~15; + cbd.Usage = D3D11_USAGE_DYNAMIC; + cbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + cbd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + cbd.MiscFlags = 0; + cbd.StructureByteStride = 0; + + ensure(dev->CreateBuffer(&cbd, NULL, &cb_frame)); + return true; + } + + void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + if(width != cur_width || height != cur_height) + { + if(zsv) + zsv->Release(); + ID3D11Texture2D* zsbuf; + D3D11_TEXTURE2D_DESC zsbufd; + memset(&zsbufd, 0, sizeof(zsbufd)); + zsbufd.Width = width; + zsbufd.Height = height; + zsbufd.Format = DXGI_FORMAT_D32_FLOAT; + zsbufd.ArraySize = 1; + zsbufd.MipLevels = 1; + zsbufd.SampleDesc.Count = 1; + zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL; + ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf)); + ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv)); + zsbuf->Release(); + } + + float black[4] = {0, 0, 0, 0}; + + D3D11_MAPPED_SUBRESOURCE map; + ensure(ctx->Map(cb_frame, 0, D3D11_MAP_WRITE_DISCARD, 0, &map)); + cb_frame_t* cb_frame_data = (cb_frame_t*)map.pData; + D3DXMatrixIdentity(&cb_frame_data->model); + + D3DXMATRIX view; + D3DXVECTOR3 eye(2.0f * (float)sin(time), 0.0f, 2.0f * (float)cos(time)); + D3DXVECTOR3 at(0, 0, 0); + D3DXVECTOR3 up(0, 1, 0); + D3DXMatrixLookAtLH(&view, &eye, &at, &up); + D3DXMATRIX proj; + D3DXMatrixPerspectiveLH(&proj, 1.1f, 1.1f, 1.0f, 3.0f); + + cb_frame_data->view_proj = view * proj; + float min_tess_factor = 1.0f; + cb_frame_data->tess_factor = (1.0f - (float)cos(time)) * ((64.0f - min_tess_factor) / 2.0f) + min_tess_factor; + cb_frame_data->disp_scale = 0.9f; + //cb_frame_data->disp_scale = (sin(time) + 1.0) / 2.0; + cb_frame_data->disp_freq = 5.0f * (float)M_PI; + //cb_frame_data->disp_freq = (4.0 + 4.0 * cos(time / 5.0)) * PI; + ctx->Unmap(cb_frame, 0); + + ctx->HSSetConstantBuffers(0, 1, &cb_frame); + ctx->DSSetConstantBuffers(0, 1, &cb_frame); + + //ctx->OMSetBlendState(bs, black, ~0); + //ctx->OMSetDepthStencilState(dss, 0); + ctx->OMSetRenderTargets(1, &rtv, zsv); + //ctx->RSSetState(rs); + ctx->RSSetViewports(1, &vp); + + ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST); + ctx->IASetInputLayout(layout); + unsigned stride = 3 * 4; + unsigned offset = 0; + ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); + + ctx->VSSetShader(vs, NULL, 0); + ctx->HSSetShader(hs, NULL, 0); + ctx->DSSetShader(ds, NULL, 0); + ctx->GSSetShader(NULL, NULL, 0); + ctx->PSSetShader(ps, NULL, 0); + + ctx->ClearRenderTargetView(rtv, black); + ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH, 1.0f, 0); + + ctx->Draw(3 * 8, 0); + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11spikysphere(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl new file mode 100755 index 00000000000..1edf42f7693 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl @@ -0,0 +1,193 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define INPUT_PATCH_SIZE 3 +#define OUTPUT_PATCH_SIZE 3 + +static const float PI = 3.141592653589793238462643f; + +cbuffer cb_frame +{ + float4x4 model; + float4x4 view_proj; + float disp_scale; + float disp_freq; + float tess_factor; +}; + +struct IA2VS +{ + float3 position : POSITION; +}; + +struct VS2HS +{ + float3 position : POSITION; +}; + +VS2HS vs(IA2VS input) +{ + VS2HS result; + result.position = input.position; + return result; +} + +struct HS2DS_PATCH +{ + float tessouter[3] : SV_TessFactor; + float tessinner[1] : SV_InsideTessFactor; +}; + +struct HS2DS +{ + float3 position : POSITION; +}; + +HS2DS_PATCH hs_patch(InputPatch ip) +{ + HS2DS_PATCH result; + + result.tessouter[0] = result.tessouter[1] = result.tessouter[2] + = result.tessinner[0] = tess_factor; + return result; +} + +[domain("tri")] +[partitioning("fractional_even")] +[outputtopology("triangle_cw")] +[outputcontrolpoints(OUTPUT_PATCH_SIZE)] +[patchconstantfunc("hs_patch")] +HS2DS hs(InputPatch p, uint i : SV_OutputControlPointID) +{ + HS2DS result; + result.position = p[i].position; + return result; +} + +struct DS2PS +{ + float4 position : SV_POSITION; + float3 objpos : OBJPOS; + // float3 worldpos : WORLDPOS; + float3 objnormal : OBJNORMAL; + float3 worldnormal : WORLDNORMAL; +}; + +float3 dnormf_dt(float3 f, float3 dfdt) +{ + float ff = dot(f, f); + return (ff * dfdt - dot(f, dfdt) * f) / (ff * sqrt(ff)); +} + +float3 map(float3 p, float3 q, float3 r, float3 k) +{ + return normalize(p * k.x + q * k.y + r * k.z); +} + +float3 dmap_du(float3 p, float3 q, float3 r, float3 k) +{ + return dnormf_dt(p * k.x + q * k.y + r * k.z, p); +} + +float dispf(float v) +{ + return cos(v * disp_freq); +} + +float ddispf(float v) +{ + return -sin(v * disp_freq) * disp_freq; +} + +float disp(float3 k) +{ + return dispf(k.x) * dispf(k.y) * dispf(k.z); +} + +float ddisp_du(float3 k) +{ + return ddispf(k.x) * dispf(k.y) * dispf(k.z); +} + +float3 ddisp(float3 k) +{ + float3 f = float3(dispf(k.x), dispf(k.y), dispf(k.z)); + return float3(ddispf(k.x) * f.y * f.z, ddispf(k.y) * f.z * f.x, ddispf(k.z) * f.x * f.y); +} + +[domain("tri")] +DS2PS ds(HS2DS_PATCH input, + float3 k : SV_DomainLocation, + const OutputPatch patch) +{ + DS2PS result; + + float3 s = map(patch[0].position, patch[1].position, patch[2].position, k); + float3 d = 1.0 + disp(s) * disp_scale; + result.objpos = s * d; + result.objpos /= (1.0 + disp_scale); + float3 worldpos = mul(model, float4(result.objpos, 1.0f)); + result.position = mul(view_proj, float4(worldpos, 1.0f)); + + float3 dd = ddisp(s) * disp_scale; + + /* + float3 ds_du = dmap_du(patch[0].position, patch[1].position, patch[2].position, k); + float3 ds_dv = dmap_du(patch[1].position, patch[2].position, patch[0].position, k.yzx); + float3 ds_dw = dmap_du(patch[2].position, patch[0].position, patch[1].position, k.zxy); + + float3 ds_dU = ds_du - ds_dw; + float3 ds_dV = ds_dv - ds_dw; + + float3 dc_dU = s * dot(dd, ds_dU) + ds_dU * d; + float3 dc_dV = s * dot(dd, ds_dV) + ds_dV * d; + */ + + // this should be faster + float3 _u = normalize((abs(s.x) > abs(s.y)) ? float3(-s.z, 0, s.x) : float3(0, -s.z, s.y)); + float3 _v = normalize(cross(s, _u)); + float3 dc_dU = s * dot(dd, _u) + _u * d; + float3 dc_dV = s * dot(dd, _v) + _v * d; + + result.objnormal = normalize(cross(dc_dU, dc_dV)); + result.worldnormal = mul(model, result.objnormal); + return result; +} + +float4 ps(DS2PS input) : SV_TARGET +{ + float3 pseudoambient = float3(0.4, 0.4, 0.6); + float3 diffuse = float3(0.6, 0.6, 0.4); + float3 light = normalize(float3(0, 1, -1)); + + float4 r; +// r.xyz = normalize(input.objpos + 2 * input.objnormal); + r.xyz = pseudoambient * saturate(dot(normalize(input.objnormal), normalize(input.objpos))); + r.xyz += saturate(dot(light, normalize(input.worldnormal))) * diffuse; + + r.w = 1; + return r; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h new file mode 100755 index 00000000000..4ec1f6b87e3 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h @@ -0,0 +1,623 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.ds.h /Eds /Tds_5_0 d3d11spikysphere.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb_frame +// { +// +// float4x4 model; // Offset: 0 Size: 64 +// float4x4 view_proj; // Offset: 64 Size: 64 +// float disp_scale; // Offset: 128 Size: 4 +// float disp_freq; // Offset: 132 Size: 4 +// float tess_factor; // Offset: 136 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb_frame cbuffer NA NA 0 1 +// +// +// +// Patch Constant signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TessFactor 0 x 0 TRIEDGE float +// SV_TessFactor 1 x 1 TRIEDGE float +// SV_TessFactor 2 x 2 TRIEDGE float +// SV_InsideTessFactor 0 x 3 TRIINT float +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// OBJPOS 0 xyz 1 NONE float xyz +// OBJNORMAL 0 xyz 2 NONE float xyz +// WORLDNORMAL 0 xyz 3 NONE float xyz +// +// Tessellation Domain # of control points +// -------------------- -------------------- +// Triangle 3 +// +ds_5_0 +dcl_input_control_point_count 3 +dcl_tessellator_domain domain_tri +dcl_globalFlags refactoringAllowed +dcl_constantbuffer cb0[9], immediateIndexed +dcl_input vDomain.xyz +dcl_input vicp[3][0].xyz +dcl_output_siv o0.xyzw, position +dcl_output o1.xyz +dcl_output o2.xyz +dcl_output o3.xyz +dcl_temps 5 +add r0.x, cb0[8].x, l(1.000000) +mul r0.yzw, vDomain.yyyy, vicp[1][0].yyzx +mad r0.yzw, vicp[0][0].yyzx, vDomain.xxxx, r0.yyzw +mad r0.yzw, vicp[2][0].yyzx, vDomain.zzzz, r0.yyzw +dp3 r1.x, r0.yzwy, r0.yzwy +rsq r1.x, r1.x +mul r0.yzw, r0.yyzw, r1.xxxx +mul r1.xyz, r0.wyzw, cb0[8].yyyy +sincos null, r2.xyz, r1.zxyz +sincos r1.xyz, null, -r1.xyzx +mul r1.xyz, r1.xyzx, cb0[8].yyyy +mul r1.xyz, r2.zxyz, r1.xyzx +mul r1.xyz, r2.xyzx, r1.xyzx +mul r1.xyz, r1.xyzx, cb0[8].xxxx +mul r1.w, r2.z, r2.y +mul r1.w, r2.x, r1.w +mad r1.w, r1.w, cb0[8].x, l(1.000000) +mul r2.xyz, r0.wyzw, r1.wwww +div r2.xyz, r2.xyzx, r0.xxxx +mul r3.xyz, r2.yyyy, cb0[1].xyzx +mad r3.xyz, cb0[0].xyzx, r2.xxxx, r3.xyzx +mad r3.xyz, cb0[2].xyzx, r2.zzzz, r3.xyzx +mov o1.xyz, r2.xyzx +add r2.xyz, r3.xyzx, cb0[3].xyzx +mul r3.xyzw, r2.yyyy, cb0[5].xyzw +mad r3.xyzw, cb0[4].xyzw, r2.xxxx, r3.xyzw +mad r2.xyzw, cb0[6].xyzw, r2.zzzz, r3.xyzw +add o0.xyzw, r2.xyzw, cb0[7].xyzw +mov r2.y, l(0) +lt r0.x, |r0.y|, |r0.w| +mul r2.xz, r0.zzwz, l(-1.000000, 0.000000, 1.000000, 0.000000) +mov r2.w, r0.y +movc r2.xyz, r0.xxxx, r2.zxyz, r2.wyxw +dp3 r0.x, r2.xyzx, r2.xyzx +rsq r0.x, r0.x +mul r2.xyz, r0.xxxx, r2.xyzx +mul r3.xyz, r0.wyzw, r2.xyzx +mad r3.xyz, r0.zwyz, r2.yzxy, -r3.xyzx +dp3 r0.x, r3.xyzx, r3.xyzx +rsq r0.x, r0.x +mul r3.xyz, r0.xxxx, r3.xyzx +dp3 r0.x, r1.yzxy, r3.xyzx +mul r3.xyz, r1.wwww, r3.xyzx +mul r4.xyz, r1.wwww, r2.xyzx +dp3 r1.x, r1.zxyz, r2.xyzx +mad r1.xyz, r0.zwyz, r1.xxxx, r4.xyzx +mad r0.xyz, r0.yzwy, r0.xxxx, r3.xyzx +mul r2.xyz, r0.xyzx, r1.xyzx +mad r0.xyz, r1.zxyz, r0.yzxy, -r2.xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +mov o2.xyz, r0.xyzx +mul r1.xyz, r0.yyyy, cb0[1].xyzx +mad r0.xyw, cb0[0].xyxz, r0.xxxx, r1.xyxz +mad o3.xyz, cb0[2].xyzx, r0.zzzz, r0.xywx +ret +// Approximately 57 instruction slots used +#endif + +const BYTE g_ds[] = +{ + 68, 88, 66, 67, 0, 128, + 111, 5, 170, 61, 238, 30, + 169, 104, 139, 245, 182, 233, + 180, 255, 1, 0, 0, 0, + 112, 11, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 68, 2, 0, 0, 120, 2, + 0, 0, 12, 3, 0, 0, + 168, 3, 0, 0, 212, 10, + 0, 0, 82, 68, 69, 70, + 4, 2, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 60, 0, + 0, 0, 0, 5, 83, 68, + 0, 1, 0, 0, 210, 1, + 0, 0, 82, 68, 49, 49, + 60, 0, 0, 0, 24, 0, + 0, 0, 32, 0, 0, 0, + 40, 0, 0, 0, 36, 0, + 0, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 95, 102, 114, 97, + 109, 101, 0, 171, 171, 171, + 92, 0, 0, 0, 5, 0, + 0, 0, 128, 0, 0, 0, + 144, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 1, 0, 0, 0, 0, + 0, 0, 64, 0, 0, 0, + 2, 0, 0, 0, 88, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 124, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 2, 0, + 0, 0, 88, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 134, 1, 0, 0, + 128, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 152, 1, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 188, 1, 0, 0, 132, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 152, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 198, 1, + 0, 0, 136, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 152, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 109, 111, 100, 101, + 108, 0, 102, 108, 111, 97, + 116, 52, 120, 52, 0, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 78, 1, 0, 0, + 118, 105, 101, 119, 95, 112, + 114, 111, 106, 0, 100, 105, + 115, 112, 95, 115, 99, 97, + 108, 101, 0, 102, 108, 111, + 97, 116, 0, 171, 0, 0, + 3, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 145, 1, 0, 0, 100, 105, + 115, 112, 95, 102, 114, 101, + 113, 0, 116, 101, 115, 115, + 95, 102, 97, 99, 116, 111, + 114, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 57, 46, 50, 57, 46, + 57, 53, 50, 46, 51, 49, + 49, 49, 0, 171, 73, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 7, 7, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 171, + 171, 171, 80, 67, 83, 71, + 140, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 13, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 0, 2, 0, + 0, 0, 13, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 118, 0, 0, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 83, 86, 95, 84, 101, 115, + 115, 70, 97, 99, 116, 111, + 114, 0, 83, 86, 95, 73, + 110, 115, 105, 100, 101, 84, + 101, 115, 115, 70, 97, 99, + 116, 111, 114, 0, 171, 171, + 79, 83, 71, 78, 148, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 8, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 133, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 8, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 79, 66, + 74, 80, 79, 83, 0, 79, + 66, 74, 78, 79, 82, 77, + 65, 76, 0, 87, 79, 82, + 76, 68, 78, 79, 82, 77, + 65, 76, 0, 171, 171, 171, + 83, 72, 69, 88, 36, 7, + 0, 0, 80, 0, 4, 0, + 201, 1, 0, 0, 147, 24, + 0, 1, 149, 16, 0, 1, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 95, 0, 0, 2, + 114, 192, 1, 0, 95, 0, + 0, 4, 114, 144, 33, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 3, 0, 0, 0, + 104, 0, 0, 2, 5, 0, + 0, 0, 0, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 226, 0, 16, 0, + 0, 0, 0, 0, 86, 197, + 1, 0, 86, 146, 33, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 146, 33, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 6, 192, 1, 0, + 86, 14, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 146, 33, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 166, 202, 1, 0, + 86, 14, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 118, 14, 16, 0, 0, 0, + 0, 0, 86, 133, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 77, 0, 0, 6, + 0, 208, 0, 0, 114, 0, + 16, 0, 2, 0, 0, 0, + 38, 9, 16, 0, 1, 0, + 0, 0, 77, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 0, 208, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 86, 133, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 38, 9, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 42, 0, 16, 0, 2, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 130, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 10, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 118, 14, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 14, 0, + 0, 7, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 3, 0, + 0, 0, 86, 5, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 54, 0, 0, 5, 114, 32, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 0, 0, 0, 8, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 166, 10, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 0, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 54, 0, + 0, 5, 34, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 49, 0, 0, 9, 18, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 128, 129, 0, + 0, 0, 0, 0, 0, 0, + 58, 0, 16, 128, 129, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 82, 0, + 16, 0, 2, 0, 0, 0, + 166, 11, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 191, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 0, 16, 0, + 2, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 38, 9, 16, 0, + 2, 0, 0, 0, 118, 12, + 16, 0, 2, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 3, 0, 0, 0, 118, 14, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 230, 9, 16, 0, + 0, 0, 0, 0, 150, 4, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 3, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 150, 4, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 38, 9, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 9, + 114, 0, 16, 0, 1, 0, + 0, 0, 230, 9, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 50, 0, 0, 9, + 114, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 38, 9, 16, 0, 1, 0, + 0, 0, 150, 4, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 114, 32, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 0, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 8, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 32, 16, 0, + 3, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 166, 10, + 16, 0, 0, 0, 0, 0, + 70, 3, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 148, 0, + 0, 0, 57, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 38, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h new file mode 100755 index 00000000000..316bcdfedd7 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h @@ -0,0 +1,297 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.hs.h /Ehs /Ths_5_0 d3d11spikysphere.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb_frame +// { +// +// float4x4 model; // Offset: 0 Size: 64 [unused] +// float4x4 view_proj; // Offset: 64 Size: 64 [unused] +// float disp_scale; // Offset: 128 Size: 4 [unused] +// float disp_freq; // Offset: 132 Size: 4 [unused] +// float tess_factor; // Offset: 136 Size: 4 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb_frame cbuffer NA NA 0 1 +// +// +// +// Patch Constant signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TessFactor 0 x 0 TRIEDGE float x +// SV_TessFactor 1 x 1 TRIEDGE float x +// SV_TessFactor 2 x 2 TRIEDGE float x +// SV_InsideTessFactor 0 x 3 TRIINT float x +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// Tessellation Domain # of control points +// -------------------- -------------------- +// Triangle 3 +// +// Tessellation Output Primitive Partitioning Type +// ------------------------------ ------------------ +// Clockwise Triangles Even Fractional +// +hs_5_0 +hs_decls +dcl_input_control_point_count 3 +dcl_output_control_point_count 3 +dcl_tessellator_domain domain_tri +dcl_tessellator_partitioning partitioning_fractional_even +dcl_tessellator_output_primitive output_triangle_cw +dcl_globalFlags refactoringAllowed +dcl_constantbuffer cb0[9], immediateIndexed +hs_fork_phase +dcl_hs_fork_phase_instance_count 3 +dcl_input vForkInstanceID +dcl_output_siv o0.x, finalTriUeq0EdgeTessFactor +dcl_output_siv o1.x, finalTriVeq0EdgeTessFactor +dcl_output_siv o2.x, finalTriWeq0EdgeTessFactor +dcl_temps 1 +dcl_indexrange o0.x 3 +mov r0.x, vForkInstanceID.x +mov o[r0.x + 0].x, cb0[8].z +ret +hs_fork_phase +dcl_output_siv o3.x, finalTriInsideTessFactor +mov o3.x, cb0[8].z +ret +// Approximately 5 instruction slots used +#endif + +const BYTE g_hs[] = +{ + 68, 88, 66, 67, 174, 23, + 253, 184, 171, 234, 181, 122, + 114, 17, 23, 172, 69, 130, + 17, 19, 1, 0, 0, 0, + 212, 4, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 68, 2, 0, 0, 120, 2, + 0, 0, 172, 2, 0, 0, + 64, 3, 0, 0, 56, 4, + 0, 0, 82, 68, 69, 70, + 4, 2, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 60, 0, + 0, 0, 0, 5, 83, 72, + 0, 1, 0, 0, 210, 1, + 0, 0, 82, 68, 49, 49, + 60, 0, 0, 0, 24, 0, + 0, 0, 32, 0, 0, 0, + 40, 0, 0, 0, 36, 0, + 0, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 95, 102, 114, 97, + 109, 101, 0, 171, 171, 171, + 92, 0, 0, 0, 5, 0, + 0, 0, 128, 0, 0, 0, + 144, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 1, 0, 0, 0, 0, + 0, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 88, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 124, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 88, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 134, 1, 0, 0, + 128, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 152, 1, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 188, 1, 0, 0, 132, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 152, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 198, 1, + 0, 0, 136, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 152, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 109, 111, 100, 101, + 108, 0, 102, 108, 111, 97, + 116, 52, 120, 52, 0, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 78, 1, 0, 0, + 118, 105, 101, 119, 95, 112, + 114, 111, 106, 0, 100, 105, + 115, 112, 95, 115, 99, 97, + 108, 101, 0, 102, 108, 111, + 97, 116, 0, 171, 0, 0, + 3, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 145, 1, 0, 0, 100, 105, + 115, 112, 95, 102, 114, 101, + 113, 0, 116, 101, 115, 115, + 95, 102, 97, 99, 116, 111, + 114, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 57, 46, 50, 57, 46, + 57, 53, 50, 46, 51, 49, + 49, 49, 0, 171, 73, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 7, 7, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 171, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 7, 8, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 171, 171, 171, + 80, 67, 83, 71, 140, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 1, 14, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 13, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 1, 14, 0, 0, 104, 0, + 0, 0, 2, 0, 0, 0, + 13, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 1, 14, 0, 0, 118, 0, + 0, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 1, 14, 0, 0, 83, 86, + 95, 84, 101, 115, 115, 70, + 97, 99, 116, 111, 114, 0, + 83, 86, 95, 73, 110, 115, + 105, 100, 101, 84, 101, 115, + 115, 70, 97, 99, 116, 111, + 114, 0, 171, 171, 83, 72, + 69, 88, 240, 0, 0, 0, + 80, 0, 3, 0, 60, 0, + 0, 0, 113, 0, 0, 1, + 147, 24, 0, 1, 148, 24, + 0, 1, 149, 16, 0, 1, + 150, 32, 0, 1, 151, 24, + 0, 1, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 115, 0, + 0, 1, 153, 0, 0, 2, + 3, 0, 0, 0, 95, 0, + 0, 2, 0, 112, 1, 0, + 103, 0, 0, 4, 18, 32, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 103, 0, + 0, 4, 18, 32, 16, 0, + 1, 0, 0, 0, 18, 0, + 0, 0, 103, 0, 0, 4, + 18, 32, 16, 0, 2, 0, + 0, 0, 19, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 91, 0, 0, 4, + 18, 32, 16, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 4, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 112, 1, 0, 54, 0, + 0, 7, 18, 32, 144, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 42, 128, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 62, 0, 0, 1, + 115, 0, 0, 1, 103, 0, + 0, 4, 18, 32, 16, 0, + 3, 0, 0, 0, 20, 0, + 0, 0, 54, 0, 0, 6, + 18, 32, 16, 0, 3, 0, + 0, 0, 42, 128, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 148, 0, + 0, 0, 5, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h new file mode 100755 index 00000000000..df0ad052880 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h @@ -0,0 +1,211 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.ps.h /Eps /Tps_4_0 d3d11spikysphere.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// OBJPOS 0 xyz 1 NONE float xyz +// OBJNORMAL 0 xyz 2 NONE float xyz +// WORLDNORMAL 0 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xyz +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 2 +dp3 r0.x, v2.xyzx, v2.xyzx +rsq r0.x, r0.x +mul r0.xyz, r0.xxxx, v2.xyzx +dp3 r0.w, v1.xyzx, v1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, v1.xyzx +dp3_sat r0.x, r0.xyzx, r1.xyzx +dp3 r0.y, v3.xyzx, v3.xyzx +rsq r0.y, r0.y +mul r0.yz, r0.yyyy, v3.yyzy +dp2_sat r0.y, l(0.707107, -0.707107, 0.000000, 0.000000), r0.yzyy +mul r0.yzw, r0.yyyy, l(0.000000, 0.600000, 0.600000, 0.400000) +mad o0.xyz, r0.xxxx, l(0.400000, 0.400000, 0.600000, 0.000000), r0.yzwy +mov o0.w, l(1.000000) +ret +// Approximately 15 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 211, 117, + 143, 38, 226, 40, 181, 77, + 39, 255, 33, 137, 74, 241, + 40, 100, 1, 0, 0, 0, + 184, 3, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 40, 1, + 0, 0, 92, 1, 0, 0, + 60, 3, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 148, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 116, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 7, 7, 0, 0, + 123, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 7, 7, 0, 0, + 133, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 7, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 79, 66, 74, 80, 79, 83, + 0, 79, 66, 74, 78, 79, + 82, 77, 65, 76, 0, 87, + 79, 82, 76, 68, 78, 79, + 82, 77, 65, 76, 0, 171, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 171, 171, + 83, 72, 68, 82, 216, 1, + 0, 0, 64, 0, 0, 0, + 118, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 16, 32, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 18, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 98, 0, + 16, 0, 0, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 86, 22, 16, 0, + 3, 0, 0, 0, 15, 32, + 0, 10, 34, 0, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 243, 4, 53, 63, + 243, 4, 53, 191, 0, 0, + 0, 0, 0, 0, 0, 0, + 150, 5, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 154, 153, 25, 63, 154, 153, + 25, 63, 205, 204, 204, 62, + 50, 0, 0, 12, 114, 32, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 205, 204, 204, 62, 205, 204, + 204, 62, 154, 153, 25, 63, + 0, 0, 0, 0, 150, 7, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 15, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h new file mode 100755 index 00000000000..15a4663c0db --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h @@ -0,0 +1,105 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.vs.h /Evs /Tvs_4_0 d3d11spikysphere.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +vs_4_0 +dcl_input v0.xyz +dcl_output o0.xyz +mov o0.xyz, v0.xyzx +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 71, 140, + 219, 201, 207, 71, 236, 3, + 158, 208, 157, 229, 54, 227, + 221, 132, 1, 0, 0, 0, + 176, 1, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 192, 0, + 0, 0, 244, 0, 0, 0, + 52, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 7, 7, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 80, 79, + 83, 73, 84, 73, 79, 78, + 0, 171, 171, 171, 83, 72, + 68, 82, 56, 0, 0, 0, + 64, 0, 1, 0, 14, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.vcxproj b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.vcxproj new file mode 100755 index 00000000000..0cf8c709d4e --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.vcxproj @@ -0,0 +1,102 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {64988608-72A3-4125-8A31-45E1EACE8F0A} + Win32Proj + d3d11spikysphere + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + d3d11.lib;d3dx10.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + true + true + d3d11.lib;d3dx10.lib;%(AdditionalDependencies) + + + + + + + + + Document + "$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).ps.h /Eps /Tps_4_0 %(Identity) +"$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).vs.h /Evs /Tvs_4_0 %(Identity) + %(Identity).ps.h;%(Identity).vs.h;%(Outputs) + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp new file mode 100755 index 00000000000..db3742e2f12 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp @@ -0,0 +1,116 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d11app.h" +#include "d3d11u.h" +#include "d3d11tex.hlsl.ps.h" +#include "d3d11tex.hlsl.vs.h" +#include "../data/cornell_box_image.h" +#include "../data/tux_image.h" + +struct d3d11tex : public d3d11_application +{ + ID3D11PixelShader* ps; + ID3D11VertexShader* vs; + mesh* quad; + ID3D11ShaderResourceView* srv[2]; + ID3D11SamplerState* samp[2]; + + virtual bool init(ID3D11Device* dev, int argc, char** argv) + { + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + + quad = create_tex_quad(dev, g_vs, sizeof(g_vs)); + + D3D11_TEXTURE2D_DESC texd; + memset(&texd, 0, sizeof(texd)); + texd.BindFlags = D3D11_BIND_SHADER_RESOURCE; + texd.Usage = D3D11_USAGE_IMMUTABLE; + texd.SampleDesc.Count = 1; + texd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texd.Width = 32; + texd.Height = 32; + texd.ArraySize = 1; + texd.MipLevels = 1; + + D3D11_SUBRESOURCE_DATA texsd; + texsd.SysMemPitch = 32 * 4; + texsd.SysMemSlicePitch = 32 * 32 * 4; + + ID3D11Texture2D* tex; + + texsd.pSysMem = g_cornell_box_image; + ensure(dev->CreateTexture2D(&texd, &texsd, &tex)); + ensure(dev->CreateShaderResourceView(tex, 0, &srv[0])); + tex->Release(); + + texsd.pSysMem = g_tux_image; + ensure(dev->CreateTexture2D(&texd, &texsd, &tex)); + ensure(dev->CreateShaderResourceView(tex, 0, &srv[1])); + tex->Release(); + + D3D11_SAMPLER_DESC sampd; + memset(&sampd, 0, sizeof(sampd)); + sampd.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; + sampd.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; + sampd.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; + sampd.MinLOD = -FLT_MAX; + sampd.MaxLOD = FLT_MAX; + + sampd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + dev->CreateSamplerState(&sampd, &samp[0]); + + sampd.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; + dev->CreateSamplerState(&sampd, &samp[1]); + return true; + } + + virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->RSSetViewports(1, &vp); + + ctx->VSSetShader(vs, NULL, 0); + ctx->PSSetShader(ps, NULL, 0); + + ctx->PSSetShaderResources(0, 2, srv); + ctx->PSSetSamplers(0, 2, samp); + + quad->bind_and_draw(ctx); + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11tex(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl new file mode 100755 index 00000000000..1a6990cc396 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl @@ -0,0 +1,66 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +Texture2D tex0; +Texture2D tex1; +sampler samp0; +sampler samp1; + +struct IA2VS +{ + float4 position : POSITION; + float2 texcoord : TEXCOORD; +}; + +struct VS2PS +{ + float4 position : SV_POSITION; + float2 texcoord : TEXCOORD; + float4 factors : FACTORS; +}; + +VS2PS vs(IA2VS input) +{ + VS2PS result; + result.position = input.position; + result.texcoord = input.texcoord * 8; + result.factors.xy = input.texcoord; + result.factors.zw = 1 - input.texcoord; + return result; +} + +float4 ps(VS2PS input) : SV_TARGET +{ + float4 a0 = tex0.Sample(samp0, input.texcoord); + float4 a1 = tex0.Sample(samp1, input.texcoord); + float4 a = a0 * input.factors.z + a1 * input.factors.x; + + float4 b0 = tex1.Sample(samp0, input.texcoord); + float4 b1 = tex1.Sample(samp1, input.texcoord); + float4 b = b0 * input.factors.z + b1 * input.factors.x; + + return a * input.factors.w + b * input.factors.y; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h new file mode 100755 index 00000000000..722ed9afd0f --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h @@ -0,0 +1,234 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tex.hlsl.ps.h /Eps /Tps_4_0 d3d11tex.hlsl +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// samp0 sampler NA NA 0 1 +// samp1 sampler NA NA 1 1 +// tex0 texture float4 2d 0 1 +// tex1 texture float4 2d 1 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// FACTORS 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v1.xy +dcl_input_ps linear v2.xyzw +dcl_output o0.xyzw +dcl_temps 3 +sample r0.xyzw, v1.xyxx, t1.xyzw, s1 +mul r0.xyzw, r0.xyzw, v2.xxxx +sample r1.xyzw, v1.xyxx, t1.xyzw, s0 +mad r0.xyzw, r1.xyzw, v2.zzzz, r0.xyzw +mul r0.xyzw, r0.xyzw, v2.yyyy +sample r1.xyzw, v1.xyxx, t0.xyzw, s1 +mul r1.xyzw, r1.xyzw, v2.xxxx +sample r2.xyzw, v1.xyxx, t0.xyzw, s0 +mad r1.xyzw, r2.xyzw, v2.zzzz, r1.xyzw +mad o0.xyzw, r1.xyzw, v2.wwww, r0.xyzw +ret +// Approximately 11 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 139, 203, + 114, 37, 104, 101, 201, 12, + 197, 147, 116, 98, 80, 214, + 173, 207, 1, 0, 0, 0, + 16, 4, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 32, 1, 0, 0, 152, 1, + 0, 0, 204, 1, 0, 0, + 148, 3, 0, 0, 82, 68, + 69, 70, 228, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 178, 0, 0, 0, 156, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 162, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 168, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 12, 0, 0, 0, 173, 0, + 0, 0, 2, 0, 0, 0, + 5, 0, 0, 0, 4, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 1, 0, + 0, 0, 12, 0, 0, 0, + 115, 97, 109, 112, 48, 0, + 115, 97, 109, 112, 49, 0, + 116, 101, 120, 48, 0, 116, + 101, 120, 49, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 73, 83, 71, 78, 112, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 101, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 70, 65, 67, 84, 79, + 82, 83, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 68, 82, 192, 1, 0, 0, + 64, 0, 0, 0, 112, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 1, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 1, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 6, 16, 16, 0, + 2, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 166, 26, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 86, 21, 16, 0, 2, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 6, 16, + 16, 0, 2, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 166, 26, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 9, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 246, 31, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 11, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h new file mode 100755 index 00000000000..0e3ebcd66d8 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h @@ -0,0 +1,153 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tex.hlsl.vs.h /Evs /Tvs_4_0 d3d11tex.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// FACTORS 0 xyzw 2 NONE float xyzw +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output_siv o0.xyzw, position +dcl_output o1.xy +dcl_output o2.xyzw +mov o0.xyzw, v0.xyzw +mul o1.xy, v1.xyxx, l(8.000000, 8.000000, 0.000000, 0.000000) +mad o2.xyzw, v1.xyxy, l(1.000000, 1.000000, -1.000000, -1.000000), l(0.000000, 0.000000, 1.000000, 1.000000) +ret +// Approximately 4 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 129, 141, + 49, 0, 46, 132, 26, 20, + 64, 38, 200, 86, 119, 202, + 172, 121, 1, 0, 0, 0, + 160, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 88, 1, 0, 0, + 36, 2, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 84, 69, 88, + 67, 79, 79, 82, 68, 0, + 171, 171, 79, 83, 71, 78, + 112, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 92, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 101, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 70, 65, 67, + 84, 79, 82, 83, 0, 171, + 171, 171, 83, 72, 68, 82, + 196, 0, 0, 0, 64, 0, + 1, 0, 49, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 2, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 50, 32, + 16, 0, 1, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 65, 0, 0, + 0, 65, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 242, 32, 16, 0, + 2, 0, 0, 0, 70, 20, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 191, 0, 0, + 128, 191, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.vcxproj b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.vcxproj new file mode 100755 index 00000000000..ea6cc038687 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.vcxproj @@ -0,0 +1,98 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {14F73B97-2DC6-423E-97D9-64E3368713DC} + Win32Proj + d3d11tex + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + d3d11.lib;%(AdditionalDependencies) + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + true + true + d3d11.lib;%(AdditionalDependencies) + + + + + Document + "$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).ps.h /Eps /Tps_4_0 %(Identity) +"$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).vs.h /Evs /Tvs_4_0 %(Identity) + %(Identity).ps.h;%(Identity).vs.h;%(Outputs) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp new file mode 100755 index 00000000000..5622074e19d --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp @@ -0,0 +1,120 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d11app.h" +#include "d3d11tri.hlsl.ps.h" +#include "d3d11tri.hlsl.vs.h" + +struct vertex { + float position[4]; + float color[4]; +}; + +static struct vertex vertices[3] = +{ + { + { 0.0f, 0.9f, 0.5f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + }, + { + { 0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } + }, + { + { -0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } + }, +}; + +struct d3d11tri : public d3d11_application +{ + ID3D11PixelShader* ps; + ID3D11VertexShader* vs; + ID3D11InputLayout* layout; + ID3D11Buffer* vb; + + virtual bool init(ID3D11Device* dev, int argc, char** argv) + { + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + + D3D11_INPUT_ELEMENT_DESC elements[] = + { + // inverse order to make sure the implementation can properly parse the vertex shader signature + {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout)); + D3D11_BUFFER_DESC bufferd; + bufferd.ByteWidth = sizeof(vertices); + bufferd.Usage = D3D11_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufferd.CPUAccessFlags = 0; + bufferd.MiscFlags = 0; + bufferd.StructureByteStride = 0; + + D3D11_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = vertices; + buffersd.SysMemPitch = sizeof(vertices); + buffersd.SysMemSlicePitch = sizeof(vertices); + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); + + return true; + } + + virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + float clear_color[4] = {1, 0, 1, 1}; + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->RSSetViewports(1, &vp); + + ctx->ClearRenderTargetView(rtv, clear_color); + + ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ctx->IASetInputLayout(layout); + unsigned stride = 2 * 4 * 4; + unsigned offset = 0; + ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); + + ctx->VSSetShader(vs, NULL, 0); + ctx->PSSetShader(ps, NULL, 0); + + ctx->Draw(3, 0); + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11tri(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl new file mode 100755 index 00000000000..6bdd448ce0a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl @@ -0,0 +1,50 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +struct IA2VS +{ + float4 position : POSITION; + float4 color : COLOR; +}; + +struct VS2PS +{ + float4 position : SV_POSITION; + float4 color : COLOR; +}; + +VS2PS vs(IA2VS input) +{ + VS2PS result; + result.position = input.position; + result.color = input.color; + return result; +} + +float4 ps(VS2PS input) : SV_TARGET +{ + return input.color; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h new file mode 100755 index 00000000000..21f6141f380 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h @@ -0,0 +1,112 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tri.hlsl.ps.h /Eps /Tps_4_0 d3d11tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_input_ps linear v1.xyzw +dcl_output o0.xyzw +mov o0.xyzw, v1.xyzw +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 206, 120, + 117, 238, 118, 127, 10, 87, + 80, 75, 114, 198, 95, 2, + 120, 102, 1, 0, 0, 0, + 208, 1, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 20, 1, 0, 0, + 84, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 67, 79, 76, 79, 82, 0, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 171, 171, + 83, 72, 68, 82, 56, 0, + 0, 0, 64, 0, 0, 0, + 14, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h new file mode 100755 index 00000000000..edf18e01f76 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h @@ -0,0 +1,128 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tri.hlsl.vs.h /Evs /Tvs_4_0 d3d11tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xyzw +dcl_output_siv o0.xyzw, position +dcl_output o1.xyzw +mov o0.xyzw, v0.xyzw +mov o1.xyzw, v1.xyzw +ret +// Approximately 3 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 190, 171, + 186, 20, 44, 105, 95, 129, + 137, 204, 223, 72, 251, 159, + 126, 176, 1, 0, 0, 0, + 28, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 220, 0, + 0, 0, 48, 1, 0, 0, + 160, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 72, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 67, 79, 76, + 79, 82, 0, 171, 79, 83, + 71, 78, 76, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 83, 72, + 68, 82, 104, 0, 0, 0, + 64, 0, 1, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.vcxproj b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.vcxproj new file mode 100755 index 00000000000..3ed69fc6f2c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.vcxproj @@ -0,0 +1,99 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {1C11FC42-BFB5-4668-97F6-C5B564754F8F} + Win32Proj + d3d11tri + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + d3d11.lib;%(AdditionalDependencies) + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(SolutionDir)\d3d11app + + + Console + true + true + true + d3d11.lib;%(AdditionalDependencies) + + + + + Document + "$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).ps.h /Eps /Tps_4_0 %(Identity) + %(Identity).ps.h;%(Identity).vs.h;%(Outputs) + "$(DXSDK_DIR)\Utilities\bin\x86\fxc.exe" /Fh%(Identity).ps.h /Eps /Tps_4_0 %(Identity) + %(Identity).ps.h;%(Identity).vs.h;%(Outputs) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/gallium/state_trackers/d3d1x/progs/data/cornell_box_image.h b/src/gallium/state_trackers/d3d1x/progs/data/cornell_box_image.h new file mode 100755 index 00000000000..007b151f093 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/data/cornell_box_image.h @@ -0,0 +1,1028 @@ +unsigned char g_cornell_box_image[] = +{ + 159, 93, 68, 255, + 171, 158, 120, 255, + 167, 153, 115, 255, + 167, 158, 121, 255, + 166, 161, 122, 255, + 164, 163, 122, 255, + 163, 166, 124, 255, + 165, 166, 125, 255, + 164, 167, 125, 255, + 161, 171, 126, 255, + 161, 170, 126, 255, + 162, 171, 125, 255, + 162, 172, 125, 255, + 160, 172, 125, 255, + 161, 174, 127, 255, + 159, 175, 124, 255, + 158, 175, 124, 255, + 156, 177, 124, 255, + 155, 177, 123, 255, + 154, 178, 122, 255, + 154, 178, 122, 255, + 153, 178, 120, 255, + 151, 180, 120, 255, + 150, 181, 120, 255, + 149, 181, 121, 255, + 146, 181, 118, 255, + 146, 181, 118, 255, + 143, 182, 116, 255, + 141, 183, 114, 255, + 137, 183, 112, 255, + 139, 186, 111, 255, + 89, 176, 70, 255, + 156, 49, 33, 255, + 154, 90, 62, 255, + 172, 149, 110, 255, + 169, 145, 105, 255, + 168, 149, 109, 255, + 166, 153, 112, 255, + 165, 156, 114, 255, + 164, 159, 115, 255, + 164, 162, 117, 255, + 163, 165, 118, 255, + 161, 166, 121, 255, + 160, 169, 122, 255, + 160, 170, 121, 255, + 160, 171, 120, 255, + 158, 173, 119, 255, + 159, 174, 120, 255, + 158, 174, 120, 255, + 154, 177, 119, 255, + 154, 177, 117, 255, + 151, 178, 115, 255, + 151, 179, 115, 255, + 148, 181, 113, 255, + 146, 181, 114, 255, + 142, 182, 113, 255, + 141, 181, 110, 255, + 140, 182, 108, 255, + 136, 183, 106, 255, + 132, 184, 102, 255, + 127, 185, 99, 255, + 132, 187, 101, 255, + 85, 173, 66, 255, + 44, 170, 34, 255, + 173, 59, 45, 255, + 157, 48, 32, 255, + 155, 90, 62, 255, + 171, 148, 108, 255, + 168, 143, 103, 255, + 167, 148, 105, 255, + 166, 151, 108, 255, + 167, 154, 110, 255, + 166, 158, 111, 255, + 164, 161, 113, 255, + 162, 164, 113, 255, + 162, 166, 116, 255, + 162, 168, 118, 255, + 157, 168, 109, 255, + 150, 167, 101, 255, + 150, 169, 102, 255, + 149, 169, 102, 255, + 145, 173, 100, 255, + 150, 177, 107, 255, + 151, 181, 112, 255, + 150, 182, 110, 255, + 149, 183, 108, 255, + 146, 184, 107, 255, + 143, 184, 106, 255, + 139, 185, 104, 255, + 135, 185, 102, 255, + 132, 186, 100, 255, + 128, 186, 97, 255, + 133, 189, 99, 255, + 88, 175, 62, 255, + 42, 171, 33, 255, + 56, 184, 44, 255, + 178, 64, 46, 255, + 175, 62, 45, 255, + 164, 51, 35, 255, + 158, 91, 65, 255, + 173, 148, 109, 255, + 169, 143, 103, 255, + 169, 147, 106, 255, + 167, 151, 106, 255, + 166, 154, 109, 255, + 164, 159, 111, 255, + 165, 162, 111, 255, + 165, 166, 112, 255, + 160, 165, 106, 255, + 200, 203, 172, 255, + 245, 248, 244, 255, + 242, 243, 236, 255, + 241, 243, 236, 255, + 246, 247, 244, 255, + 197, 212, 170, 255, + 155, 184, 101, 255, + 157, 189, 107, 255, + 155, 190, 105, 255, + 152, 191, 103, 255, + 149, 192, 101, 255, + 144, 193, 99, 255, + 140, 191, 95, 255, + 134, 192, 93, 255, + 136, 194, 96, 255, + 91, 179, 65, 255, + 46, 177, 34, 255, + 57, 188, 45, 255, + 59, 193, 45, 255, + 186, 65, 49, 255, + 187, 66, 49, 255, + 191, 66, 51, 255, + 176, 51, 37, 255, + 160, 88, 61, 255, + 172, 148, 108, 255, + 169, 144, 102, 255, + 168, 147, 105, 255, + 167, 151, 106, 255, + 167, 156, 108, 255, + 168, 160, 111, 255, + 167, 165, 110, 255, + 167, 169, 110, 255, + 181, 186, 132, 255, + 217, 220, 190, 255, + 215, 219, 185, 255, + 217, 222, 185, 255, + 220, 227, 187, 255, + 188, 204, 131, 255, + 172, 198, 104, 255, + 172, 202, 105, 255, + 167, 203, 102, 255, + 163, 203, 102, 255, + 157, 202, 99, 255, + 153, 201, 96, 255, + 146, 199, 93, 255, + 148, 199, 96, 255, + 95, 183, 62, 255, + 47, 191, 38, 255, + 62, 201, 51, 255, + 61, 200, 49, 255, + 61, 198, 51, 255, + 192, 66, 51, 255, + 198, 68, 54, 255, + 209, 70, 56, 255, + 207, 70, 55, 255, + 181, 52, 37, 255, + 161, 90, 62, 255, + 172, 146, 106, 255, + 171, 145, 104, 255, + 171, 150, 107, 255, + 171, 155, 109, 255, + 171, 159, 111, 255, + 171, 164, 111, 255, + 171, 168, 113, 255, + 172, 172, 110, 255, + 172, 173, 107, 255, + 172, 180, 106, 255, + 173, 187, 106, 255, + 177, 192, 107, 255, + 181, 198, 109, 255, + 181, 202, 110, 255, + 179, 203, 110, 255, + 175, 204, 105, 255, + 169, 204, 104, 255, + 163, 202, 101, 255, + 153, 202, 97, 255, + 151, 199, 97, 255, + 97, 181, 63, 255, + 51, 190, 38, 255, + 66, 222, 53, 255, + 68, 218, 56, 255, + 64, 209, 53, 255, + 62, 205, 51, 255, + 197, 67, 54, 255, + 205, 71, 58, 255, + 220, 75, 58, 255, + 229, 75, 63, 255, + 211, 71, 54, 255, + 172, 48, 31, 255, + 162, 114, 79, 255, + 160, 148, 102, 255, + 159, 149, 102, 255, + 157, 153, 104, 255, + 158, 154, 107, 255, + 158, 157, 107, 255, + 158, 160, 108, 255, + 160, 161, 112, 255, + 158, 164, 110, 255, + 158, 166, 110, 255, + 158, 167, 108, 255, + 158, 168, 109, 255, + 156, 171, 106, 255, + 153, 170, 104, 255, + 151, 170, 102, 255, + 149, 171, 99, 255, + 145, 171, 99, 255, + 142, 171, 97, 255, + 140, 173, 97, 255, + 111, 173, 78, 255, + 46, 178, 29, 255, + 68, 223, 55, 255, + 72, 242, 62, 255, + 71, 231, 60, 255, + 66, 218, 55, 255, + 64, 208, 54, 255, + 202, 68, 55, 255, + 212, 73, 56, 255, + 229, 77, 61, 255, + 244, 81, 67, 255, + 233, 77, 62, 255, + 194, 59, 41, 255, + 174, 113, 86, 255, + 171, 151, 111, 255, + 172, 155, 115, 255, + 174, 162, 122, 255, + 175, 169, 127, 255, + 179, 175, 132, 255, + 181, 182, 138, 255, + 186, 187, 145, 255, + 186, 192, 148, 255, + 188, 195, 150, 255, + 188, 196, 149, 255, + 184, 197, 146, 255, + 180, 194, 142, 255, + 176, 191, 138, 255, + 167, 189, 128, 255, + 161, 185, 121, 255, + 153, 183, 113, 255, + 148, 182, 111, 255, + 141, 183, 106, 255, + 108, 183, 78, 255, + 54, 202, 43, 255, + 74, 243, 61, 255, + 78, 255, 66, 255, + 73, 241, 63, 255, + 68, 223, 55, 255, + 63, 214, 52, 255, + 203, 70, 56, 255, + 218, 74, 61, 255, + 237, 79, 64, 255, + 253, 85, 68, 255, + 247, 80, 67, 255, + 209, 62, 47, 255, + 184, 121, 95, 255, + 184, 160, 129, 255, + 187, 166, 134, 255, + 190, 176, 142, 255, + 195, 186, 150, 255, + 201, 195, 158, 255, + 206, 204, 166, 255, + 212, 211, 175, 255, + 213, 218, 178, 255, + 215, 221, 181, 255, + 217, 224, 183, 255, + 211, 223, 179, 255, + 207, 220, 173, 255, + 199, 213, 166, 255, + 188, 210, 154, 255, + 180, 205, 145, 255, + 168, 201, 133, 255, + 158, 198, 125, 255, + 151, 197, 119, 255, + 117, 193, 91, 255, + 60, 217, 46, 255, + 78, 255, 66, 255, + 78, 255, 69, 255, + 74, 248, 65, 255, + 68, 228, 58, 255, + 65, 215, 54, 255, + 204, 70, 56, 255, + 219, 74, 62, 255, + 241, 80, 66, 255, + 255, 87, 70, 255, + 255, 82, 71, 255, + 221, 65, 52, 255, + 190, 129, 103, 255, + 192, 169, 139, 255, + 197, 175, 144, 255, + 202, 186, 154, 255, + 209, 198, 163, 255, + 215, 209, 177, 255, + 223, 218, 186, 255, + 228, 228, 192, 255, + 231, 235, 200, 255, + 234, 239, 202, 255, + 234, 241, 200, 255, + 228, 239, 197, 255, + 224, 236, 191, 255, + 215, 228, 182, 255, + 203, 224, 169, 255, + 191, 218, 156, 255, + 179, 213, 145, 255, + 168, 208, 135, 255, + 160, 204, 129, 255, + 123, 201, 96, 255, + 63, 229, 49, 255, + 79, 255, 69, 255, + 80, 255, 70, 255, + 77, 251, 66, 255, + 70, 230, 61, 255, + 66, 216, 55, 255, + 205, 71, 57, 255, + 222, 74, 63, 255, + 243, 81, 67, 255, + 255, 86, 71, 255, + 255, 85, 70, 255, + 227, 66, 52, 255, + 197, 132, 108, 255, + 198, 175, 145, 255, + 205, 183, 153, 255, + 210, 195, 164, 255, + 219, 205, 176, 255, + 225, 217, 185, 255, + 231, 227, 195, 255, + 237, 237, 203, 255, + 244, 242, 209, 255, + 243, 247, 211, 255, + 243, 251, 210, 255, + 238, 249, 206, 255, + 231, 246, 202, 255, + 224, 238, 188, 255, + 211, 232, 176, 255, + 199, 224, 166, 255, + 187, 220, 155, 255, + 175, 215, 144, 255, + 167, 211, 138, 255, + 127, 204, 103, 255, + 64, 237, 51, 255, + 80, 255, 69, 255, + 81, 255, 70, 255, + 76, 251, 66, 255, + 70, 232, 61, 255, + 66, 218, 56, 255, + 205, 70, 57, 255, + 222, 74, 63, 255, + 240, 82, 67, 255, + 255, 86, 71, 255, + 255, 85, 70, 255, + 231, 66, 54, 255, + 200, 136, 111, 255, + 203, 179, 151, 255, + 209, 186, 158, 255, + 215, 197, 169, 255, + 222, 209, 179, 255, + 231, 220, 192, 255, + 235, 230, 200, 255, + 242, 238, 207, 255, + 247, 246, 213, 255, + 245, 251, 216, 255, + 246, 251, 217, 255, + 241, 251, 213, 255, + 234, 249, 206, 255, + 227, 241, 194, 255, + 215, 236, 183, 255, + 202, 229, 172, 255, + 188, 223, 160, 255, + 177, 219, 148, 255, + 169, 215, 144, 255, + 129, 207, 108, 255, + 62, 242, 52, 255, + 80, 255, 68, 255, + 80, 255, 70, 255, + 76, 251, 66, 255, + 69, 232, 61, 255, + 66, 218, 54, 255, + 206, 70, 57, 255, + 221, 75, 63, 255, + 238, 80, 66, 255, + 255, 86, 71, 255, + 255, 84, 70, 255, + 231, 66, 54, 255, + 202, 139, 115, 255, + 205, 181, 155, 255, + 212, 188, 161, 255, + 217, 199, 171, 255, + 224, 209, 181, 255, + 231, 220, 192, 255, + 234, 229, 199, 255, + 242, 236, 207, 255, + 243, 242, 211, 255, + 243, 246, 216, 255, + 243, 249, 210, 255, + 237, 248, 209, 255, + 233, 246, 202, 255, + 227, 241, 179, 255, + 214, 236, 170, 255, + 202, 229, 160, 255, + 191, 226, 150, 255, + 177, 220, 144, 255, + 175, 217, 153, 255, + 129, 210, 110, 255, + 61, 242, 51, 255, + 78, 255, 67, 255, + 79, 255, 69, 255, + 76, 250, 66, 255, + 70, 231, 60, 255, + 66, 218, 54, 255, + 206, 71, 57, 255, + 219, 76, 63, 255, + 235, 79, 65, 255, + 251, 85, 71, 255, + 253, 83, 67, 255, + 231, 66, 53, 255, + 202, 139, 118, 255, + 206, 182, 155, 255, + 211, 188, 161, 255, + 216, 198, 170, 255, + 223, 207, 181, 255, + 228, 217, 189, 255, + 230, 226, 196, 255, + 237, 231, 201, 255, + 237, 236, 206, 255, + 239, 237, 218, 255, + 250, 252, 49, 255, + 250, 253, 59, 255, + 246, 250, 60, 255, + 240, 245, 58, 255, + 229, 238, 55, 255, + 220, 230, 51, 255, + 221, 224, 51, 255, + 77, 197, 0, 255, + 126, 209, 94, 255, + 134, 211, 117, 255, + 61, 241, 50, 255, + 73, 255, 67, 255, + 77, 255, 69, 255, + 74, 247, 64, 255, + 70, 229, 58, 255, + 66, 218, 56, 255, + 205, 71, 56, 255, + 217, 74, 61, 255, + 232, 78, 67, 255, + 245, 83, 70, 255, + 247, 80, 69, 255, + 229, 66, 51, 255, + 202, 139, 118, 255, + 206, 179, 156, 255, + 211, 185, 161, 255, + 215, 194, 170, 255, + 222, 203, 178, 255, + 225, 211, 185, 255, + 227, 219, 191, 255, + 230, 223, 195, 255, + 232, 227, 199, 255, + 233, 228, 210, 255, + 227, 231, 53, 255, + 230, 232, 66, 255, + 225, 230, 65, 255, + 220, 228, 62, 255, + 210, 225, 62, 255, + 204, 220, 60, 255, + 209, 217, 60, 255, + 82, 198, 17, 255, + 119, 208, 87, 255, + 131, 211, 115, 255, + 57, 242, 51, 255, + 69, 255, 63, 255, + 74, 255, 67, 255, + 75, 242, 64, 255, + 69, 227, 58, 255, + 66, 216, 56, 255, + 204, 70, 56, 255, + 215, 74, 60, 255, + 227, 77, 65, 255, + 237, 81, 66, 255, + 240, 79, 67, 255, + 225, 65, 50, 255, + 202, 138, 116, 255, + 204, 178, 154, 255, + 208, 182, 158, 255, + 212, 190, 166, 255, + 216, 197, 172, 255, + 219, 204, 179, 255, + 221, 211, 184, 255, + 225, 215, 188, 255, + 224, 218, 189, 255, + 225, 219, 201, 255, + 211, 216, 48, 255, + 213, 218, 62, 255, + 210, 218, 62, 255, + 207, 217, 60, 255, + 201, 215, 57, 255, + 196, 212, 57, 255, + 200, 210, 55, 255, + 84, 198, 16, 255, + 118, 208, 87, 255, + 133, 210, 116, 255, + 47, 221, 39, 255, + 68, 255, 61, 255, + 73, 253, 65, 255, + 72, 237, 62, 255, + 69, 225, 58, 255, + 66, 215, 56, 255, + 202, 69, 55, 255, + 213, 72, 59, 255, + 222, 76, 62, 255, + 230, 79, 65, 255, + 233, 76, 64, 255, + 221, 64, 49, 255, + 200, 134, 113, 255, + 201, 174, 150, 255, + 204, 178, 155, 255, + 207, 185, 161, 255, + 211, 192, 167, 255, + 213, 197, 172, 255, + 215, 203, 177, 255, + 217, 205, 179, 255, + 216, 209, 180, 255, + 216, 210, 190, 255, + 198, 204, 45, 255, + 199, 207, 55, 255, + 197, 209, 56, 255, + 194, 209, 55, 255, + 193, 206, 55, 255, + 189, 204, 55, 255, + 193, 204, 54, 255, + 85, 197, 17, 255, + 113, 204, 82, 255, + 126, 203, 107, 255, + 34, 180, 27, 255, + 63, 253, 57, 255, + 70, 249, 60, 255, + 70, 234, 61, 255, + 67, 223, 58, 255, + 65, 216, 54, 255, + 200, 69, 56, 255, + 209, 72, 59, 255, + 216, 74, 62, 255, + 223, 76, 64, 255, + 226, 74, 63, 255, + 215, 63, 51, 255, + 200, 132, 111, 255, + 197, 171, 146, 255, + 200, 173, 150, 255, + 204, 180, 156, 255, + 206, 185, 161, 255, + 209, 191, 166, 255, + 209, 195, 169, 255, + 210, 197, 172, 255, + 207, 200, 172, 255, + 209, 202, 182, 255, + 186, 196, 41, 255, + 188, 200, 53, 255, + 188, 202, 53, 255, + 187, 202, 52, 255, + 183, 202, 53, 255, + 180, 200, 51, 255, + 188, 199, 52, 255, + 84, 199, 20, 255, + 92, 190, 53, 255, + 102, 179, 78, 255, + 33, 170, 24, 255, + 51, 221, 45, 255, + 67, 244, 62, 255, + 68, 229, 58, 255, + 67, 220, 58, 255, + 64, 213, 55, 255, + 198, 68, 54, 255, + 204, 71, 58, 255, + 211, 72, 60, 255, + 216, 74, 61, 255, + 219, 71, 61, 255, + 213, 60, 49, 255, + 197, 129, 108, 255, + 195, 166, 143, 255, + 196, 168, 144, 255, + 197, 175, 149, 255, + 200, 179, 154, 255, + 201, 184, 158, 255, + 202, 188, 161, 255, + 202, 190, 163, 255, + 200, 192, 161, 255, + 202, 193, 173, 255, + 176, 190, 40, 255, + 180, 194, 50, 255, + 178, 196, 51, 255, + 178, 196, 51, 255, + 177, 195, 50, 255, + 174, 196, 50, 255, + 182, 195, 52, 255, + 86, 199, 20, 255, + 84, 184, 46, 255, + 89, 167, 62, 255, + 34, 171, 25, 255, + 39, 199, 31, 255, + 65, 238, 59, 255, + 67, 225, 57, 255, + 66, 217, 57, 255, + 64, 212, 54, 255, + 196, 67, 53, 255, + 200, 70, 56, 255, + 205, 70, 58, 255, + 209, 71, 58, 255, + 212, 69, 58, 255, + 208, 59, 47, 255, + 199, 127, 104, 255, + 200, 154, 133, 255, + 199, 156, 133, 255, + 202, 161, 136, 255, + 203, 165, 139, 255, + 204, 171, 143, 255, + 203, 174, 144, 255, + 202, 176, 146, 255, + 199, 180, 145, 255, + 197, 184, 162, 255, + 169, 185, 37, 255, + 170, 190, 48, 255, + 172, 190, 50, 255, + 173, 191, 50, 255, + 172, 191, 50, 255, + 171, 192, 47, 255, + 178, 191, 50, 255, + 86, 198, 21, 255, + 86, 184, 48, 255, + 88, 167, 62, 255, + 35, 173, 27, 255, + 35, 187, 27, 255, + 64, 229, 56, 255, + 66, 221, 57, 255, + 65, 214, 55, 255, + 62, 210, 52, 255, + 194, 68, 52, 255, + 197, 67, 54, 255, + 197, 67, 54, 255, + 201, 66, 55, 255, + 203, 66, 55, 255, + 207, 57, 46, 255, + 142, 121, 104, 255, + 122, 229, 199, 255, + 129, 224, 200, 255, + 123, 231, 211, 255, + 118, 241, 229, 255, + 119, 241, 235, 255, + 120, 244, 238, 255, + 112, 251, 250, 255, + 144, 226, 217, 255, + 174, 192, 170, 255, + 159, 183, 34, 255, + 162, 184, 44, 255, + 164, 187, 46, 255, + 164, 188, 48, 255, + 165, 189, 46, 255, + 165, 189, 47, 255, + 173, 187, 48, 255, + 85, 195, 22, 255, + 86, 185, 48, 255, + 87, 168, 64, 255, + 35, 175, 26, 255, + 32, 183, 23, 255, + 61, 223, 51, 255, + 62, 218, 55, 255, + 63, 210, 52, 255, + 61, 209, 53, 255, + 193, 67, 53, 255, + 193, 67, 52, 255, + 191, 63, 54, 255, + 190, 63, 49, 255, + 196, 63, 51, 255, + 207, 61, 49, 255, + 92, 64, 48, 255, + 46, 154, 127, 255, + 52, 196, 156, 255, + 54, 192, 154, 255, + 49, 186, 143, 255, + 48, 185, 143, 255, + 47, 182, 138, 255, + 43, 176, 129, 255, + 40, 180, 133, 255, + 28, 180, 142, 255, + 152, 182, 35, 255, + 149, 184, 44, 255, + 155, 183, 44, 255, + 158, 185, 45, 255, + 160, 185, 43, 255, + 161, 187, 45, 255, + 167, 186, 49, 255, + 87, 195, 20, 255, + 86, 184, 46, 255, + 87, 168, 65, 255, + 35, 176, 26, 255, + 32, 183, 23, 255, + 60, 217, 49, 255, + 62, 214, 54, 255, + 64, 208, 51, 255, + 61, 206, 51, 255, + 189, 65, 51, 255, + 190, 65, 51, 255, + 183, 60, 52, 255, + 182, 60, 52, 255, + 189, 61, 48, 255, + 202, 59, 47, 255, + 98, 71, 58, 255, + 50, 145, 114, 255, + 52, 184, 142, 255, + 50, 179, 139, 255, + 51, 180, 139, 255, + 52, 181, 138, 255, + 52, 181, 138, 255, + 51, 181, 137, 255, + 51, 181, 135, 255, + 42, 181, 144, 255, + 141, 182, 34, 255, + 141, 180, 44, 255, + 148, 182, 45, 255, + 151, 182, 45, 255, + 152, 184, 47, 255, + 154, 184, 45, 255, + 162, 184, 48, 255, + 87, 194, 21, 255, + 89, 182, 47, 255, + 87, 168, 66, 255, + 35, 176, 27, 255, + 32, 184, 24, 255, + 57, 213, 47, 255, + 61, 210, 52, 255, + 61, 206, 50, 255, + 60, 205, 51, 255, + 186, 65, 49, 255, + 185, 63, 49, 255, + 177, 59, 50, 255, + 175, 57, 48, 255, + 182, 60, 47, 255, + 196, 57, 44, 255, + 95, 71, 58, 255, + 50, 146, 114, 255, + 51, 184, 142, 255, + 50, 180, 139, 255, + 50, 179, 139, 255, + 52, 182, 139, 255, + 51, 181, 137, 255, + 50, 180, 137, 255, + 51, 181, 135, 255, + 41, 179, 141, 255, + 136, 178, 32, 255, + 135, 180, 40, 255, + 139, 181, 41, 255, + 145, 180, 41, 255, + 150, 181, 44, 255, + 152, 179, 43, 255, + 159, 181, 47, 255, + 86, 192, 21, 255, + 92, 181, 47, 255, + 87, 169, 66, 255, + 35, 176, 26, 255, + 33, 184, 24, 255, + 56, 211, 47, 255, + 59, 206, 49, 255, + 59, 203, 48, 255, + 58, 203, 51, 255, + 184, 65, 50, 255, + 183, 61, 49, 255, + 172, 57, 50, 255, + 167, 53, 45, 255, + 178, 57, 48, 255, + 191, 56, 41, 255, + 95, 71, 57, 255, + 51, 145, 116, 255, + 52, 184, 141, 255, + 53, 180, 139, 255, + 53, 180, 139, 255, + 52, 178, 136, 255, + 52, 178, 135, 255, + 52, 178, 136, 255, + 48, 179, 133, 255, + 43, 179, 143, 255, + 133, 176, 32, 255, + 131, 177, 39, 255, + 137, 177, 42, 255, + 141, 177, 43, 255, + 145, 178, 43, 255, + 148, 178, 44, 255, + 154, 178, 46, 255, + 91, 189, 22, 255, + 96, 176, 55, 255, + 85, 167, 64, 255, + 37, 173, 28, 255, + 33, 182, 25, 255, + 55, 207, 47, 255, + 59, 202, 52, 255, + 61, 200, 49, 255, + 60, 200, 49, 255, + 182, 63, 50, 255, + 177, 61, 48, 255, + 170, 56, 48, 255, + 151, 48, 41, 255, + 173, 56, 44, 255, + 182, 44, 33, 255, + 94, 80, 67, 255, + 51, 145, 115, 255, + 52, 181, 140, 255, + 52, 176, 136, 255, + 50, 178, 137, 255, + 51, 178, 136, 255, + 51, 178, 135, 255, + 49, 176, 134, 255, + 49, 177, 132, 255, + 42, 177, 140, 255, + 129, 173, 30, 255, + 129, 174, 38, 255, + 134, 174, 40, 255, + 139, 174, 41, 255, + 142, 176, 39, 255, + 145, 175, 41, 255, + 152, 174, 43, 255, + 91, 187, 22, 255, + 105, 173, 61, 255, + 96, 164, 77, 255, + 31, 169, 23, 255, + 32, 180, 25, 255, + 53, 202, 47, 255, + 57, 199, 48, 255, + 59, 197, 48, 255, + 59, 199, 48, 255, + 181, 62, 50, 255, + 175, 60, 48, 255, + 166, 54, 47, 255, + 130, 44, 35, 255, + 162, 40, 31, 255, + 209, 130, 111, 255, + 105, 125, 103, 255, + 48, 141, 111, 255, + 52, 179, 138, 255, + 52, 174, 136, 255, + 50, 176, 136, 255, + 50, 176, 134, 255, + 50, 176, 133, 255, + 50, 175, 133, 255, + 49, 175, 131, 255, + 42, 175, 138, 255, + 126, 164, 20, 255, + 122, 166, 33, 255, + 129, 169, 35, 255, + 134, 170, 36, 255, + 138, 171, 41, 255, + 142, 171, 43, 255, + 148, 172, 45, 255, + 101, 182, 24, 255, + 89, 162, 53, 255, + 104, 170, 83, 255, + 72, 170, 55, 255, + 29, 172, 24, 255, + 52, 198, 46, 255, + 56, 196, 46, 255, + 57, 195, 48, 255, + 58, 198, 47, 255, + 178, 61, 48, 255, + 171, 58, 48, 255, + 156, 53, 45, 255, + 119, 28, 25, 255, + 193, 119, 102, 255, + 228, 193, 167, 255, + 96, 121, 99, 255, + 47, 142, 110, 255, + 52, 175, 137, 255, + 51, 171, 133, 255, + 50, 172, 134, 255, + 50, 172, 132, 255, + 50, 172, 131, 255, + 49, 171, 131, 255, + 49, 172, 128, 255, + 36, 169, 127, 255, + 172, 197, 99, 255, + 153, 186, 86, 255, + 148, 182, 71, 255, + 143, 176, 58, 255, + 139, 170, 45, 255, + 135, 163, 30, 255, + 139, 163, 27, 255, + 84, 155, 25, 255, + 57, 136, 49, 255, + 71, 151, 54, 255, + 85, 160, 67, 255, + 62, 166, 49, 255, + 42, 189, 34, 255, + 53, 194, 45, 255, + 54, 192, 48, 255, + 58, 196, 48, 255, + 176, 61, 47, 255, + 168, 58, 45, 255, + 140, 39, 34, 255, + 140, 73, 55, 255, + 152, 103, 77, 255, + 141, 78, 59, 255, + 90, 80, 65, 255, + 45, 148, 114, 255, + 50, 173, 134, 255, + 50, 169, 132, 255, + 50, 170, 130, 255, + 48, 170, 129, 255, + 46, 170, 129, 255, + 46, 171, 130, 255, + 44, 171, 128, 255, + 23, 161, 117, 255, + 225, 253, 204, 255, + 211, 244, 195, 255, + 212, 245, 199, 255, + 213, 245, 199, 255, + 215, 243, 193, 255, + 213, 243, 190, 255, + 208, 240, 182, 255, + 193, 235, 176, 255, + 185, 231, 167, 255, + 180, 225, 163, 255, + 172, 223, 156, 255, + 176, 221, 158, 255, + 107, 206, 96, 255, + 39, 183, 33, 255, + 55, 188, 47, 255, + 57, 193, 49, 255, + 173, 60, 45, 255, + 159, 45, 33, 255, + 159, 91, 77, 255, + 157, 108, 85, 255, + 146, 94, 74, 255, + 139, 87, 72, 255, + 134, 71, 56, 255, + 42, 143, 109, 255, + 37, 172, 131, 255, + 39, 167, 128, 255, + 43, 164, 123, 255, + 48, 159, 118, 255, + 52, 155, 115, 255, + 58, 151, 112, 255, + 63, 149, 104, 255, + 73, 149, 104, 255, + 206, 233, 185, 255, + 208, 237, 190, 255, + 207, 237, 188, 255, + 205, 237, 186, 255, + 203, 237, 185, 255, + 199, 237, 179, 255, + 199, 236, 178, 255, + 196, 235, 174, 255, + 192, 233, 170, 255, + 190, 230, 167, 255, + 184, 228, 162, 255, + 178, 227, 158, 255, + 187, 227, 167, 255, + 114, 205, 102, 255, + 38, 181, 33, 255, + 55, 191, 48, 255, + 164, 44, 34, 255, + 178, 112, 95, 255, + 183, 153, 126, 255, + 158, 121, 90, 255, + 151, 117, 88, 255, + 148, 122, 92, 255, + 148, 126, 95, 255, + 140, 136, 102, 255, + 135, 144, 109, 255, + 145, 148, 114, 255, + 151, 157, 121, 255, + 160, 167, 131, 255, + 170, 178, 141, 255, + 178, 190, 149, 255, + 188, 201, 162, 255, + 199, 213, 173, 255, + 199, 220, 181, 255, + 205, 226, 183, 255, + 203, 227, 182, 255, + 204, 228, 182, 255, + 202, 228, 180, 255, + 200, 230, 179, 255, + 199, 229, 178, 255, + 196, 227, 176, 255, + 193, 228, 172, 255, + 189, 226, 168, 255, + 186, 225, 165, 255, + 181, 223, 161, 255, + 177, 223, 155, 255, + 184, 226, 163, 255, + 112, 203, 98, 255, + 39, 183, 34, 255, + 185, 121, 100, 255, + 206, 188, 162, 255, + 196, 177, 149, 255, + 193, 178, 146, 255, + 192, 186, 153, 255, + 198, 192, 161, 255, + 204, 198, 169, 255, + 207, 203, 173, 255, + 210, 206, 175, 255, + 207, 212, 178, 255, + 209, 213, 179, 255, + 208, 216, 181, 255, + 207, 216, 182, 255, + 207, 218, 183, 255, + 206, 217, 179, 255, + 204, 219, 180, 255, + 203, 219, 180, 255, + 203, 220, 178, 255, + 201, 221, 178, 255, + 202, 222, 178, 255, + 201, 222, 176, 255, + 199, 223, 177, 255, + 198, 222, 176, 255, + 195, 222, 173, 255, + 194, 222, 174, 255, + 193, 221, 170, 255, + 191, 220, 167, 255, + 187, 220, 166, 255, + 182, 220, 162, 255, + 180, 218, 158, 255, + 186, 221, 161, 255, + 111, 202, 97, 255, +}; + diff --git a/src/gallium/state_trackers/d3d1x/progs/data/tux_image.h b/src/gallium/state_trackers/d3d1x/progs/data/tux_image.h new file mode 100755 index 00000000000..53aeffa5582 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/data/tux_image.h @@ -0,0 +1,1028 @@ +unsigned char g_tux_image[] = +{ + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 249, 249, 249, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 234, 234, 234, 255, + 23, 23, 25, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 81, 81, 83, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 1, 1, 3, 255, + 0, 0, 2, 255, + 8, 7, 9, 255, + 71, 71, 70, 255, + 0, 0, 0, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 106, 106, 107, 255, + 0, 0, 0, 255, + 1, 1, 3, 255, + 2, 2, 4, 255, + 0, 0, 2, 255, + 13, 13, 13, 255, + 46, 46, 46, 255, + 0, 0, 0, 255, + 57, 57, 59, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 33, 33, 35, 255, + 0, 0, 0, 255, + 0, 0, 1, 255, + 1, 1, 3, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 0, 0, 1, 255, + 0, 0, 0, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 10, 10, 13, 255, + 87, 87, 87, 255, + 43, 42, 43, 255, + 0, 0, 0, 255, + 17, 17, 18, 255, + 163, 163, 162, 255, + 71, 70, 70, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 213, 213, 213, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 29, 29, 32, 255, + 178, 178, 177, 255, + 210, 212, 215, 255, + 0, 0, 0, 255, + 213, 215, 219, 255, + 112, 112, 112, 255, + 235, 235, 234, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 176, 176, 177, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 78, 79, 79, 255, + 43, 47, 59, 255, + 103, 94, 77, 255, + 103, 77, 0, 255, + 168, 156, 123, 255, + 0, 0, 0, 255, + 179, 182, 191, 255, + 1, 1, 3, 255, + 0, 0, 0, 255, + 182, 182, 183, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 31, 35, 45, 255, + 172, 146, 99, 255, + 237, 173, 0, 255, + 248, 208, 9, 255, + 250, 215, 39, 255, + 220, 183, 4, 255, + 223, 201, 120, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 151, 151, 152, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 93, 89, 86, 255, + 216, 146, 0, 255, + 245, 193, 9, 255, + 243, 215, 34, 255, + 255, 229, 32, 255, + 228, 193, 8, 255, + 238, 173, 0, 255, + 0, 0, 2, 255, + 0, 0, 0, 255, + 92, 92, 93, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 77, 81, 91, 255, + 120, 94, 41, 255, + 209, 163, 0, 255, + 215, 176, 9, 255, + 189, 133, 0, 255, + 198, 135, 4, 255, + 198, 176, 136, 255, + 0, 0, 0, 255, + 115, 115, 114, 255, + 0, 0, 0, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 0, 0, 0, 255, + 181, 186, 198, 255, + 169, 142, 94, 255, + 174, 119, 18, 255, + 174, 136, 68, 255, + 189, 193, 203, 255, + 255, 255, 255, 255, + 84, 84, 84, 255, + 2, 2, 3, 255, + 0, 0, 0, 255, + 107, 106, 107, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 116, 116, 116, 255, + 35, 35, 36, 255, + 255, 255, 255, 255, + 185, 187, 193, 255, + 182, 186, 197, 255, + 214, 218, 225, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 0, 0, 0, 255, + 0, 0, 1, 255, + 0, 0, 0, 255, + 248, 248, 248, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 198, 198, 199, 255, + 0, 0, 0, 255, + 246, 246, 244, 255, + 255, 255, 255, 255, + 252, 253, 251, 255, + 250, 250, 249, 255, + 255, 255, 255, 255, + 255, 255, 253, 255, + 255, 255, 253, 255, + 255, 255, 255, 255, + 68, 68, 69, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 16, 16, 18, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 246, 246, 246, 255, + 0, 0, 0, 255, + 26, 25, 26, 255, + 254, 255, 254, 255, + 255, 255, 253, 255, + 243, 243, 242, 255, + 241, 241, 240, 255, + 253, 253, 251, 255, + 247, 247, 246, 255, + 236, 236, 235, 255, + 236, 235, 235, 255, + 132, 131, 132, 255, + 0, 0, 0, 255, + 0, 0, 1, 255, + 0, 0, 0, 255, + 46, 46, 47, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 67, 67, 69, 255, + 0, 0, 0, 255, + 80, 80, 80, 255, + 243, 243, 242, 255, + 254, 254, 252, 255, + 245, 245, 243, 255, + 252, 252, 251, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 235, 235, 233, 255, + 214, 213, 213, 255, + 224, 223, 223, 255, + 31, 31, 32, 255, + 23, 23, 23, 255, + 1, 0, 2, 255, + 0, 0, 0, 255, + 179, 179, 179, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 254, 254, 252, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 255, 255, 253, 255, + 255, 255, 255, 255, + 253, 253, 252, 255, + 184, 184, 184, 255, + 0, 0, 0, 255, + 32, 32, 32, 255, + 0, 0, 0, 255, + 37, 37, 39, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 189, 189, 189, 255, + 0, 0, 0, 255, + 111, 111, 111, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 248, 248, 247, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 253, 253, 251, 255, + 252, 252, 251, 255, + 252, 252, 250, 255, + 254, 254, 252, 255, + 255, 255, 255, 255, + 15, 15, 16, 255, + 16, 16, 17, 255, + 12, 11, 13, 255, + 0, 0, 0, 255, + 247, 247, 246, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 51, 51, 52, 255, + 0, 0, 0, 255, + 250, 250, 248, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 240, 240, 239, 255, + 254, 254, 252, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 252, 252, 251, 255, + 253, 253, 250, 255, + 253, 253, 251, 255, + 255, 255, 255, 255, + 56, 56, 57, 255, + 0, 0, 0, 255, + 24, 24, 25, 255, + 0, 0, 0, 255, + 152, 152, 153, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 200, 200, 201, 255, + 0, 0, 0, 255, + 19, 19, 20, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 235, 235, 234, 255, + 254, 254, 252, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 255, 255, 255, 255, + 83, 83, 83, 255, + 0, 0, 0, 255, + 18, 18, 18, 255, + 0, 0, 0, 255, + 95, 95, 97, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 34, 35, 39, 255, + 10, 12, 19, 255, + 69, 69, 70, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 237, 237, 236, 255, + 254, 254, 252, 255, + 252, 252, 250, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 255, 255, 255, 255, + 91, 91, 92, 255, + 2, 2, 4, 255, + 1, 1, 3, 255, + 0, 0, 0, 255, + 81, 81, 81, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 53, 51, 49, 255, + 49, 33, 0, 255, + 62, 67, 84, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 251, 251, 250, 255, + 240, 240, 239, 255, + 254, 254, 252, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 253, 254, 253, 255, + 255, 255, 255, 255, + 63, 65, 73, 255, + 9, 9, 10, 255, + 11, 11, 12, 255, + 13, 13, 15, 255, + 104, 105, 114, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 233, 174, 24, 255, + 255, 217, 8, 255, + 107, 77, 0, 255, + 131, 137, 154, 255, + 255, 255, 255, 255, + 254, 254, 252, 255, + 250, 250, 249, 255, + 239, 239, 237, 255, + 254, 254, 252, 255, + 252, 252, 250, 255, + 252, 252, 251, 255, + 253, 253, 251, 255, + 253, 254, 253, 255, + 251, 249, 248, 255, + 255, 205, 14, 255, + 87, 70, 6, 255, + 0, 0, 1, 255, + 0, 0, 0, 255, + 0, 2, 14, 255, + 216, 203, 137, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 230, 207, 159, 255, + 216, 168, 49, 255, + 207, 153, 25, 255, + 239, 180, 4, 255, + 246, 190, 11, 255, + 255, 214, 12, 255, + 25, 13, 0, 255, + 79, 81, 89, 255, + 255, 255, 255, 255, + 255, 255, 254, 255, + 250, 250, 249, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 255, 255, 255, 255, + 231, 227, 222, 255, + 250, 184, 0, 255, + 101, 71, 5, 255, + 0, 0, 3, 255, + 0, 0, 3, 255, + 112, 83, 2, 255, + 250, 193, 0, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 210, 154, 18, 255, + 247, 187, 0, 255, + 247, 189, 7, 255, + 246, 189, 11, 255, + 245, 189, 12, 255, + 249, 191, 12, 255, + 240, 191, 11, 255, + 0, 0, 0, 255, + 24, 25, 26, 255, + 255, 255, 255, 255, + 255, 255, 253, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 252, 252, 251, 255, + 253, 253, 251, 255, + 255, 255, 255, 255, + 188, 186, 184, 255, + 232, 168, 0, 255, + 216, 154, 8, 255, + 158, 108, 7, 255, + 182, 127, 7, 255, + 251, 190, 10, 255, + 243, 181, 0, 255, + 250, 247, 244, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 215, 169, 62, 255, + 245, 186, 4, 255, + 245, 189, 11, 255, + 245, 189, 12, 255, + 245, 189, 12, 255, + 245, 188, 12, 255, + 255, 204, 12, 255, + 125, 99, 7, 255, + 0, 0, 0, 255, + 129, 128, 128, 255, + 255, 255, 255, 255, + 253, 253, 251, 255, + 253, 253, 251, 255, + 252, 252, 250, 255, + 253, 253, 251, 255, + 255, 255, 255, 255, + 181, 178, 176, 255, + 220, 156, 0, 255, + 241, 183, 11, 255, + 232, 173, 9, 255, + 239, 181, 10, 255, + 247, 191, 12, 255, + 245, 188, 8, 255, + 234, 176, 3, 255, + 250, 248, 243, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 216, 173, 80, 255, + 243, 184, 4, 255, + 245, 189, 11, 255, + 245, 188, 12, 255, + 245, 189, 12, 255, + 245, 189, 12, 255, + 246, 188, 12, 255, + 255, 203, 2, 255, + 120, 112, 98, 255, + 255, 255, 255, 255, + 254, 254, 253, 255, + 252, 252, 251, 255, + 253, 253, 251, 255, + 255, 255, 254, 255, + 255, 255, 255, 255, + 213, 214, 216, 255, + 8, 0, 0, 255, + 235, 173, 7, 255, + 248, 192, 12, 255, + 247, 191, 12, 255, + 246, 190, 12, 255, + 245, 189, 12, 255, + 245, 189, 11, 255, + 247, 190, 7, 255, + 238, 169, 0, 255, + 249, 245, 236, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 206, 145, 1, 255, + 249, 191, 9, 255, + 246, 190, 12, 255, + 245, 189, 11, 255, + 245, 189, 11, 255, + 245, 189, 12, 255, + 245, 189, 12, 255, + 247, 191, 9, 255, + 197, 150, 8, 255, + 229, 234, 248, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 104, 104, 104, 255, + 0, 0, 0, 255, + 35, 21, 1, 255, + 236, 174, 10, 255, + 248, 191, 12, 255, + 245, 189, 12, 255, + 245, 189, 11, 255, + 246, 191, 11, 255, + 248, 190, 4, 255, + 234, 168, 0, 255, + 222, 178, 80, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 245, 240, 231, 255, + 193, 121, 0, 255, + 232, 170, 0, 255, + 239, 180, 4, 255, + 248, 191, 12, 255, + 250, 193, 12, 255, + 248, 192, 12, 255, + 246, 190, 12, 255, + 251, 194, 12, 255, + 220, 157, 4, 255, + 9, 0, 0, 255, + 10, 12, 17, 255, + 30, 30, 31, 255, + 0, 0, 2, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 0, 0, 0, 255, + 62, 38, 2, 255, + 232, 169, 9, 255, + 250, 194, 12, 255, + 247, 191, 12, 255, + 248, 191, 12, 255, + 229, 164, 0, 255, + 210, 162, 50, 255, + 241, 234, 228, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 237, 231, 222, 255, + 207, 183, 141, 255, + 181, 135, 49, 255, + 158, 97, 0, 255, + 182, 120, 0, 255, + 220, 157, 0, 255, + 243, 183, 11, 255, + 236, 175, 10, 255, + 164, 104, 0, 255, + 26, 11, 0, 255, + 42, 44, 49, 255, + 75, 75, 76, 255, + 75, 75, 76, 255, + 78, 78, 80, 255, + 82, 82, 83, 255, + 38, 41, 49, 255, + 48, 27, 0, 255, + 197, 134, 3, 255, + 237, 178, 11, 255, + 237, 176, 8, 255, + 187, 122, 0, 255, + 214, 191, 154, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 217, 211, 206, 255, + 163, 137, 96, 255, + 112, 63, 0, 255, + 105, 53, 0, 255, + 91, 63, 21, 255, + 248, 251, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 219, 217, 212, 255, + 95, 48, 0, 255, + 143, 84, 0, 255, + 124, 71, 0, 255, + 210, 201, 190, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 231, 232, 234, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 222, 223, 226, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, +}; + diff --git a/src/gallium/state_trackers/d3d1x/progs/progs.sln b/src/gallium/state_trackers/d3d1x/progs/progs.sln new file mode 100755 index 00000000000..13c2d6e581c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/progs/progs.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "d3d11app", "d3d11app", "{77576C4F-7281-41FB-A5C7-D12707AB9ED0}" + ProjectSection(SolutionItems) = preProject + d3d11app\d3d11blit.hlsl = d3d11app\d3d11blit.hlsl + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d11gears", "d3d11gears\d3d11gears.vcxproj", "{706313AB-8F2C-48D2-9F67-31AA043F48C9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d11tri", "d3d11tri\d3d11tri.vcxproj", "{1C11FC42-BFB5-4668-97F6-C5B564754F8F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d11spikysphere", "d3d11spikysphere\d3d11spikysphere.vcxproj", "{64988608-72A3-4125-8A31-45E1EACE8F0A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d11tex", "d3d11tex\d3d11tex.vcxproj", "{14F73B97-2DC6-423E-97D9-64E3368713DC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d10tri", "d3d10tri\d3d10tri.vcxproj", "{5366F4FD-0E6C-40CC-B2F2-CE3D350F0729}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {706313AB-8F2C-48D2-9F67-31AA043F48C9}.Debug|Win32.ActiveCfg = Debug|Win32 + {706313AB-8F2C-48D2-9F67-31AA043F48C9}.Debug|Win32.Build.0 = Debug|Win32 + {706313AB-8F2C-48D2-9F67-31AA043F48C9}.Release|Win32.ActiveCfg = Release|Win32 + {706313AB-8F2C-48D2-9F67-31AA043F48C9}.Release|Win32.Build.0 = Release|Win32 + {1C11FC42-BFB5-4668-97F6-C5B564754F8F}.Debug|Win32.ActiveCfg = Debug|Win32 + {1C11FC42-BFB5-4668-97F6-C5B564754F8F}.Debug|Win32.Build.0 = Debug|Win32 + {1C11FC42-BFB5-4668-97F6-C5B564754F8F}.Release|Win32.ActiveCfg = Release|Win32 + {1C11FC42-BFB5-4668-97F6-C5B564754F8F}.Release|Win32.Build.0 = Release|Win32 + {64988608-72A3-4125-8A31-45E1EACE8F0A}.Debug|Win32.ActiveCfg = Debug|Win32 + {64988608-72A3-4125-8A31-45E1EACE8F0A}.Debug|Win32.Build.0 = Debug|Win32 + {64988608-72A3-4125-8A31-45E1EACE8F0A}.Release|Win32.ActiveCfg = Release|Win32 + {64988608-72A3-4125-8A31-45E1EACE8F0A}.Release|Win32.Build.0 = Release|Win32 + {14F73B97-2DC6-423E-97D9-64E3368713DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {14F73B97-2DC6-423E-97D9-64E3368713DC}.Debug|Win32.Build.0 = Debug|Win32 + {14F73B97-2DC6-423E-97D9-64E3368713DC}.Release|Win32.ActiveCfg = Release|Win32 + {14F73B97-2DC6-423E-97D9-64E3368713DC}.Release|Win32.Build.0 = Release|Win32 + {5366F4FD-0E6C-40CC-B2F2-CE3D350F0729}.Debug|Win32.ActiveCfg = Debug|Win32 + {5366F4FD-0E6C-40CC-B2F2-CE3D350F0729}.Debug|Win32.Build.0 = Debug|Win32 + {5366F4FD-0E6C-40CC-B2F2-CE3D350F0729}.Release|Win32.ActiveCfg = Release|Win32 + {5366F4FD-0E6C-40CC-B2F2-CE3D350F0729}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/gallium/state_trackers/d3d1x/tools/fxc b/src/gallium/state_trackers/d3d1x/tools/fxc new file mode 100755 index 00000000000..0cf76a0af6e --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/tools/fxc @@ -0,0 +1,16 @@ +#!/bin/bash +dir="$(dirname "$0")/../mstools" +(cd "$dir"; ./download-mstools) + +arch="$(uname -m)" +if test "$arch" == i386 || test "$arch" == i486 || test "$arch" == i586 || test "$arch" == i686 || test "$arch" == x86_64; then + emu="wine" +else + emu="qemu-i386 wine" +fi +exe="$dir/fxc.exe" +if test "$#" == 0 || test "$1" == "--help"; then + exec $emu "$exe" "/?" +else + exec $emu "$exe" "$@" +fi diff --git a/src/gallium/state_trackers/d3d1x/w32api b/src/gallium/state_trackers/d3d1x/w32api new file mode 120000 index 00000000000..e47a1989e10 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/w32api @@ -0,0 +1 @@ +/usr/include/wine/windows \ No newline at end of file -- cgit v1.2.3 From 2ec86793bd43fe15d8f79d04e32d6c524e8ad844 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 21 Sep 2010 14:28:51 +0100 Subject: llvmpipe: fix flatshading in new line code Calculate interpolants before rearranging the vertices. --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 9f090d1992e..829eb8a5a04 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -292,6 +292,7 @@ try_setup_line( struct lp_setup_context *setup, float x2diff; float y2diff; float dx, dy; + float area; boolean draw_start; boolean draw_end; @@ -311,6 +312,18 @@ try_setup_line( struct lp_setup_context *setup, dx = v1[0][0] - v2[0][0]; dy = v1[0][1] - v2[0][1]; + area = (dx * dx + dy * dy); + if (area == 0) { + LP_COUNT(nr_culled_tris); + return TRUE; + } + + info.oneoverarea = 1.0f / area; + info.dx = dx; + info.dy = dy; + info.v1 = v1; + info.v2 = v2; + /* X-MAJOR LINE */ if (fabsf(dx) >= fabsf(dy)) { @@ -573,12 +586,6 @@ try_setup_line( struct lp_setup_context *setup, line->plane[3].dcdx = y[3] - y[0]; - info.oneoverarea = 1.0f / (dx * dx + dy * dy); - info.dx = dx; - info.dy = dy; - info.v1 = v1; - info.v2 = v2; - /* Setup parameter interpolants: */ setup_line_coefficients( setup, line, &info); -- cgit v1.2.3 From 70fed0b0ec8a3ec4f6b9b47f1fe98cc54c6037f0 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 02:39:52 +0200 Subject: d3d1x: add blob and signature extraction APIs NOTE: untested, needs a testing tool! --- .../d3d1x/d3d1xshader/include/dxbc.h | 11 ++++ .../d3d1x/d3d1xshader/src/dxbc_assemble.cpp | 59 ++++++++++++++++++++++ .../d3d1x/d3d1xshader/src/dxbc_parse.cpp | 15 ++---- .../d3d1x/d3d1xstutil/include/d3d1xstutil.h | 34 +++++++++++++ .../state_trackers/d3d1x/d3dapi/d3dcommon.idl | 4 ++ src/gallium/state_trackers/d3d1x/gd3d10/Makefile | 5 +- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 1 + 7 files changed, 116 insertions(+), 13 deletions(-) create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h index 44fce810795..06a078af6ec 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h @@ -75,6 +75,15 @@ struct dxbc_container std::map chunk_map; }; +struct dxbc_container_header +{ + unsigned fourcc; + uint32_t unk[4]; + uint32_t one; + uint32_t total_size; + uint32_t chunk_count; +}; + dxbc_container* dxbc_parse(const void* data, int size); std::ostream& operator <<(std::ostream& out, const dxbc_container& container); @@ -98,4 +107,6 @@ struct _D3D11_SIGNATURE_PARAMETER_DESC; typedef struct _D3D11_SIGNATURE_PARAMETER_DESC D3D11_SIGNATURE_PARAMETER_DESC; int dxbc_parse_signature(dxbc_chunk_signature* sig, D3D11_SIGNATURE_PARAMETER_DESC** params); +std::pair dxbc_assemble(struct dxbc_chunk_header** chunks, unsigned num_chunks); + #endif /* DXBC_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp new file mode 100644 index 00000000000..1021a8a1bd5 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp @@ -0,0 +1,59 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include +#include +#include "dxbc.h" + +std::pair dxbc_assemble(struct dxbc_chunk_header** chunks, unsigned num_chunks) +{ + size_t data_size = 0; + for(unsigned i = 0; i < num_chunks; ++i) + data_size += sizeof(uint32_t) + sizeof(dxbc_chunk_header) + bswap_le32(chunks[i]->size); + + size_t total_size = sizeof(dxbc_container_header) + data_size; + dxbc_container_header* header = (dxbc_container_header*)malloc(total_size); + if(!header) + return std::make_pair((void*)0, 0); + + header->fourcc = bswap_le32(FOURCC_DXBC); + memset(header->unk, 0, sizeof(header->unk)); + header->one = bswap_le32(1); + header->total_size = bswap_le32(total_size); + header->chunk_count = num_chunks; + + uint32_t* chunk_offsets = (uint32_t*)(header + 1); + uint32_t off = sizeof(struct dxbc_container_header) + num_chunks * sizeof(uint32_t); + for(unsigned i = 0; i < num_chunks; ++i) + { + chunk_offsets[i] = bswap_le32(off); + unsigned chunk_full_size = sizeof(dxbc_chunk_header) + bswap_le32(chunks[i]->size); + memcpy((char*)header + off, chunks[i], chunk_full_size); + off += chunk_full_size; + } + + return std::make_pair((void*)header, total_size); +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp index 6b696ae1afe..4903e2c3b94 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp @@ -29,26 +29,18 @@ #include #include -struct dxbc_container_header -{ - unsigned fourcc; - uint32_t unk[5]; - uint32_t total_size; - uint32_t chunk_count; - uint32_t chunk_offsets[]; -}; - dxbc_container* dxbc_parse(const void* data, int size) { std::auto_ptr container(new dxbc_container()); container->data = data; dxbc_container_header* header = (dxbc_container_header*)data; + uint32_t* chunk_offsets = (uint32_t*)(header + 1); if(bswap_le32(header->fourcc) != FOURCC_DXBC) return 0; unsigned num_chunks = bswap_le32(header->chunk_count); for(unsigned i = 0; i < num_chunks; ++i) { - unsigned offset = bswap_le32(header->chunk_offsets[i]); + unsigned offset = bswap_le32(chunk_offsets[i]); dxbc_chunk_header* chunk = (dxbc_chunk_header*)((char*)data + offset); unsigned fourcc = bswap_le32(chunk->fourcc); container->chunk_map[fourcc] = i; @@ -60,12 +52,13 @@ dxbc_container* dxbc_parse(const void* data, int size) dxbc_chunk_header* dxbc_find_chunk(const void* data, int size, unsigned fourcc) { dxbc_container_header* header = (dxbc_container_header*)data; + uint32_t* chunk_offsets = (uint32_t*)(header + 1); if(bswap_le32(header->fourcc) != FOURCC_DXBC) return 0; unsigned num_chunks = bswap_le32(header->chunk_count); for(unsigned i = 0; i < num_chunks; ++i) { - unsigned offset = bswap_le32(header->chunk_offsets[i]); + unsigned offset = bswap_le32(chunk_offsets[i]); dxbc_chunk_header* chunk = (dxbc_chunk_header*)((char*)data + offset); if(bswap_le32(chunk->fourcc) == fourcc) return chunk; diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index a9260acdbab..47bf842b7b1 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -59,6 +59,7 @@ namespace std { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } #include "galliumdxgi.h" +#include extern "C" { @@ -1035,4 +1036,37 @@ struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObject instead of this class. + */ +class GalliumD3DBlob : public GalliumComObject +{ + void* data; + size_t size; + + GalliumD3DBlob(void* data, size_t size) + : data(data), size(size) + {} + + ~GalliumD3DBlob() + { + free(data); + } +public: + virtual LPVOID STDMETHODCALLTYPE GetBufferPointer() + { + return data; + } + + virtual SIZE_T STDMETHODCALLTYPE GetBufferSize() + { + return size; + } +}; + #endif /* D3D1XSTUTIL_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl index 3594bf58f8c..71021b8a6c0 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl @@ -314,6 +314,10 @@ interface ID3D10Blob : IUnknown SIZE_T GetBufferSize(); }; +typedef ID3D10Blob* LPD3D10BLOB; +typedef ID3D10Blob ID3DBlob; +typedef ID3DBlob* LPD3DBLOB; + typedef enum _D3D_INCLUDE_TYPE { D3D_INCLUDE_LOCAL = 0, diff --git a/src/gallium/state_trackers/d3d1x/gd3d10/Makefile b/src/gallium/state_trackers/d3d1x/gd3d10/Makefile index c6cfea25ea2..300149d384e 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d10/Makefile +++ b/src/gallium/state_trackers/d3d1x/gd3d10/Makefile @@ -6,7 +6,7 @@ GEN_D3D10=perl d3d10.pl include ../Makefile.inc -d3d10.generated.o: d3d10_objects.generated.h d3d10_screen.generated.h d3d10_context.generated.h +d3d10.generated.o: d3d10_objects.generated.h d3d10_screen.generated.h d3d10_context.generated.h d3d10_misc.generated.h d3d10.generated.cpp: ../gd3d11/d3d11.cpp d3d10.pl $(GEN_D3D10) $< > $@ @@ -16,4 +16,5 @@ d3d10_screen.generated.h: ../gd3d11/d3d11_screen.h d3d10.pl $(GEN_D3D10) $< > $@ d3d10_context.generated.h: ../gd3d11/d3d11_context.h d3d10.pl $(GEN_D3D10) $< > $@ - +d3d10_misc.generated.h: ../gd3d11/d3d11_misc.h d3d10.pl + $(GEN_D3D10) $< > $@ diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 22cbf150fe1..69dfd403f3d 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -214,6 +214,7 @@ struct GalliumD3D11Screen #include "d3d11_objects.h" #include "d3d11_screen.h" #include "d3d11_context.h" +#include "d3d11_misc.h" #if API >= 11 HRESULT STDMETHODCALLTYPE GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice) -- cgit v1.2.3 From cb7cc36fff63e1bbdf4820538a8133f150541be4 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 15:39:42 +0200 Subject: d3d1x: fix compilation with recent Wine versions installed Recent Wine versions provide a d3d11shader.h, which is however empty and was getting used instead of our non-empty one. Correct the include path order to fix this. --- src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 6ac74d1895f..8c8e2fb445f 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile @@ -1,6 +1,6 @@ LIBNAME=d3d1xshader CPP_SOURCES=$(wildcard src/*.cpp) -LIBRARY_INCLUDES=-Iinclude -I../w32api -I../d3dapi +LIBRARY_INCLUDES=-Iinclude -I../d3dapi -I../w32api PROGS=tools/fxdis LIBS=libd3d1xshader.a -- cgit v1.2.3 From f815b57b888d00228dcb355cbd34ed0f4c44a620 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 15:51:02 +0200 Subject: d3d1x: add missing file --- .../state_trackers/d3d1x/gd3d11/d3d11_misc.h | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h new file mode 100644 index 00000000000..239a5bb98cb --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -0,0 +1,87 @@ +#if API < 10 +HRESULT D3D10CreateBlob( + __in SIZE_T NumBytes, + __out LPD3D10BLOB *ppBuffer +) +{ + void* data = malloc(NumBytes); + if(!data) + return E_OUTOFMEMORY; + *ppBuffer = new GalliumD3DBlob(data, NumBytes); + return S_OK; +} + +LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile( + __in ID3D10Device *pDevice +) +{ + return "ps_4_0"; +} + +LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile( + __in ID3D10Device *pDevice +) +{ + return "vs_4_0"; +} + +LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile( + __in ID3D10Device *pDevice +) +{ + return "gs_4_0"; +} + +static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, unsigned num_chunks, ID3D10Blob** blob) +{ + std::pair p = dxbc_assemble(chunks, num_chunks); + if(!p.first) + return E_OUTOFMEMORY; + *blob = return new GalliumD3DBlob(p.first, p.second); + return S_OK; +} + +HRESULT D3D10GetInputSignatureBlob( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __out ID3D10Blob **ppSignatureBlob +) +{ + dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, false); + if(!sig) + return E_FAIL; + + return dxbc_assemble_as_blob(&sig, 1, ppSignatureBlob); +} + +HRESULT D3D10GetOutputSignatureBlob( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __out ID3D10Blob **ppSignatureBlob +) +{ + dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, true); + if(!sig) + return E_FAIL; + + return dxbc_assemble_as_blob(&sig, 1, ppSignatureBlob); +} + +HRESULT D3D10GetInputOutputSignatureBlob( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __out ID3D10Blob **ppSignatureBlob +) +{ + dxbc_chunk_signature* sigs[2]; + sigs[0] = dxbc_find_signature(pShaderBytecode, BytecodeLength, false); + if(!sigs[0]) + return E_FAIL; + sigs[1] = dxbc_find_signature(pShaderBytecode, BytecodeLength, true); + if(!sigs[1]) + return E_FAIL; + + return dxbc_assemble_as_blob(&sigs, 2, ppSignatureBlob); +} + +#endif -- cgit v1.2.3 From bb26272beaf1d2bddffaad5341235e70abcf483b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 16:00:45 +0200 Subject: d3d1x: actually enable and fix blob apis --- .../state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 3 ++- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 47bf842b7b1..f79cc72a5d7 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -1049,6 +1049,7 @@ class GalliumD3DBlob : public GalliumComObject void* data; size_t size; +public: GalliumD3DBlob(void* data, size_t size) : data(data), size(size) {} @@ -1057,7 +1058,7 @@ class GalliumD3DBlob : public GalliumComObject { free(data); } -public: + virtual LPVOID STDMETHODCALLTYPE GetBufferPointer() { return data; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index 239a5bb98cb..39e41f19e5f 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -1,4 +1,4 @@ -#if API < 10 +#if API < 11 HRESULT D3D10CreateBlob( __in SIZE_T NumBytes, __out LPD3D10BLOB *ppBuffer @@ -37,7 +37,7 @@ static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, unsigned std::pair p = dxbc_assemble(chunks, num_chunks); if(!p.first) return E_OUTOFMEMORY; - *blob = return new GalliumD3DBlob(p.first, p.second); + *blob = new GalliumD3DBlob(p.first, p.second); return S_OK; } @@ -51,7 +51,7 @@ HRESULT D3D10GetInputSignatureBlob( if(!sig) return E_FAIL; - return dxbc_assemble_as_blob(&sig, 1, ppSignatureBlob); + return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); } HRESULT D3D10GetOutputSignatureBlob( @@ -64,7 +64,7 @@ HRESULT D3D10GetOutputSignatureBlob( if(!sig) return E_FAIL; - return dxbc_assemble_as_blob(&sig, 1, ppSignatureBlob); + return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); } HRESULT D3D10GetInputOutputSignatureBlob( @@ -81,7 +81,7 @@ HRESULT D3D10GetInputOutputSignatureBlob( if(!sigs[1]) return E_FAIL; - return dxbc_assemble_as_blob(&sigs, 2, ppSignatureBlob); + return dxbc_assemble_as_blob((dxbc_chunk_header**)&sigs, 2, ppSignatureBlob); } #endif -- cgit v1.2.3 From 441344ba7ed2a1d162ee33ac4bac4bf645188ceb Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 21 Sep 2010 09:56:05 -0400 Subject: glx: Hold on to drawables if we're just switching to another context https://bugs.freedesktop.org/show_bug.cgi?id=30234 --- src/glx/dri2_glx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 8247588e76b..911298b37c8 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -118,6 +118,8 @@ dri2_destroy_context(struct glx_context *context) struct dri2_context *pcp = (struct dri2_context *) context; struct dri2_screen *psc = (struct dri2_screen *) context->psc; + driReleaseDrawables(&pcp->base); + if (context->xid) glx_send_destroy_context(psc->base.dpy, context->xid); @@ -158,7 +160,8 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new) (*psc->core->unbindContext) (pcp->driContext); - driReleaseDrawables(&pcp->base); + if (context == new) + driReleaseDrawables(&pcp->base); } static struct glx_context * -- cgit v1.2.3 From b3a647276e5fae570628826961c9b86612c2a2c6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Sep 2010 10:07:52 -0600 Subject: draw: new draw_fs.[ch] files --- src/gallium/auxiliary/draw/draw_fs.c | 73 ++++++++++++++++++++++++++++++++++++ src/gallium/auxiliary/draw/draw_fs.h | 42 +++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/gallium/auxiliary/draw/draw_fs.c create mode 100644 src/gallium/auxiliary/draw/draw_fs.h (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_fs.c b/src/gallium/auxiliary/draw/draw_fs.c new file mode 100644 index 00000000000..1543bd86f17 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_fs.c @@ -0,0 +1,73 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * 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 VMWARE 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. + * + **************************************************************************/ + +#include "pipe/p_shader_tokens.h" + +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_prim.h" + +#include "tgsi/tgsi_parse.h" + +#include "draw_fs.h" +#include "draw_private.h" +#include "draw_context.h" + + +struct draw_fragment_shader * +draw_create_fragment_shader(struct draw_context *draw, + const struct pipe_shader_state *shader) +{ + struct draw_fragment_shader *dfs; + + dfs = CALLOC_STRUCT(draw_fragment_shader); + if (dfs) { + dfs->base = *shader; + tgsi_scan_shader(shader->tokens, &dfs->info); + } + + return dfs; +} + + +void +draw_bind_fragment_shader(struct draw_context *draw, + struct draw_fragment_shader *dfs) +{ + draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE); + + draw->fs.fragment_shader = dfs; +} + + +void +draw_delete_fragment_shader(struct draw_context *draw, + struct draw_fragment_shader *dfs) +{ + FREE(dfs); +} + diff --git a/src/gallium/auxiliary/draw/draw_fs.h b/src/gallium/auxiliary/draw/draw_fs.h new file mode 100644 index 00000000000..44995b8277f --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_fs.h @@ -0,0 +1,42 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * 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 VMWARE 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. + * + **************************************************************************/ + +#ifndef DRAW_FS_H +#define DRAW_FS_H + + +#include "tgsi/tgsi_scan.h" + + +struct draw_fragment_shader +{ + struct pipe_shader_state base; + struct tgsi_shader_info info; +}; + + +#endif /* DRAW_FS_H */ -- cgit v1.2.3 From 388c94195af41c2084f4882ab414c86b575818fb Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 21 Sep 2010 17:50:30 +0100 Subject: llvmpipe: Describe how to profile llvmpipe. --- src/gallium/drivers/llvmpipe/README | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README index 8b5539d2c51..ec30d4d7084 100644 --- a/src/gallium/drivers/llvmpipe/README +++ b/src/gallium/drivers/llvmpipe/README @@ -131,6 +131,44 @@ replacing the native ICD driver, but it's quite an advanced usage, so if you need to ask, don't even try it. +Profiling +========= + +To profile llvmpipe you should pass the options + + scons debug=no profile=yes + +This will ensure that frame pointers are used both in C and JIT functions, and +that no tail call optimizations are done by gcc. + + +To better profile JIT code you'll need to build LLVM with oprofile integration. + + source_dir=$PWD/llvm-2.6 + build_dir=$source_dir/build/profile + install_dir=$source_dir-profile + + mkdir -p "$build_dir" + cd "$build_dir" && \ + $source_dir/configure \ + --prefix=$install_dir \ + --enable-optimized \ + --disable-profiling \ + --enable-targets=host-only \ + --with-oprofile + + make -C "$build_dir" + make -C "$build_dir" install + + find "$install_dir/lib" -iname '*.a' -print0 | xargs -0 strip --strip-debug + +The you should define + + export LLVM=/path/to/llvm-2.6-profile + +and rebuild. + + Unit testing ============ -- cgit v1.2.3 From b556bb7c44236a9fae54f58cc03e1d05eaa2124f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 21 Sep 2010 17:51:06 +0100 Subject: llvmpipe: When failing free fs shader too. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index fb673db6d0f..4277c47eeb6 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -906,6 +906,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, shader->draw_data = draw_create_fragment_shader(llvmpipe->draw, templ); if (shader->draw_data == NULL) { FREE((void *) shader->base.tokens); + FREE(shader); return NULL; } -- cgit v1.2.3 From b5bb21562942dab7571ef748c3ca562a66f25b33 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Sep 2010 10:08:38 -0700 Subject: glsl: Add definition of gl_TextureMatrix inverse/transpose builtins. Fixes glsl2/builtin-texturematrix. Bug #30196. --- src/glsl/ir_variable.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 3fed4d9e6ed..1eff740ef96 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -162,6 +162,9 @@ generate_110_uniforms(exec_list *instructions, state->Const.MaxTextureCoords); add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type); + add_uniform(instructions, state, "gl_TextureMatrixInverse", mat4_array_type); + add_uniform(instructions, state, "gl_TextureMatrixTranspose", mat4_array_type); + add_uniform(instructions, state, "gl_TextureMatrixInverseTranspose", mat4_array_type); add_uniform(instructions, state, "gl_DepthRange", state->symbols->get_type("gl_DepthRangeParameters")); -- cgit v1.2.3 From 6048be89697fe27e30ef0f45594daba4e896362c Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 21 Sep 2010 14:36:44 -0400 Subject: r600g: directly allocate bo for user buffer Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 4 ++- src/gallium/drivers/r600/r600_state2.c | 38 ++++++++++++++++++++++-- src/gallium/winsys/r600/drm/r600_state2.c | 49 ++++++++++++++++--------------- src/gallium/winsys/r600/drm/radeon_priv.h | 2 +- 4 files changed, 66 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index a123eb62e0f..8879efca794 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -192,6 +192,8 @@ struct r600_reloc { }; #pragma pack() +struct radeon_bo; + struct r600_context { struct radeon *radeon; unsigned ngroups; @@ -203,7 +205,7 @@ struct r600_context { unsigned nreloc; unsigned creloc; struct r600_reloc *reloc; - struct radeon_ws_bo **bo; + struct radeon_bo **bo; u32 *pm4; }; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 5269e6db912..36a33760339 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -677,7 +677,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; -#if 0 +#if 1 static int dc = 0; char dname[256]; #endif @@ -2174,11 +2174,44 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e } } +struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, + const struct pipe_resource *templ); +struct pipe_resource *r600_user_buffer_create2(struct pipe_screen *screen, + void *ptr, unsigned bytes, + unsigned bind) +{ + struct pipe_resource *resource; + struct r600_resource *rresource; + struct pipe_resource desc; + struct radeon *radeon = (struct radeon *)screen->winsys; + void *rptr; + + desc.screen = screen; + desc.target = PIPE_BUFFER; + desc.format = PIPE_FORMAT_R8_UNORM; + desc.usage = PIPE_USAGE_IMMUTABLE; + desc.bind = bind; + desc.width0 = bytes; + desc.height0 = 1; + desc.depth0 = 1; + desc.flags = 0; + resource = r600_buffer_create(screen, &desc); + if (resource == NULL) { + return NULL; + } + + rresource = (struct r600_resource *)resource; + rptr = radeon_ws_bo_map(radeon, rresource->bo, 0, NULL); + memcpy(rptr, ptr, bytes); + radeon_ws_bo_unmap(radeon, rresource->bo); + + return resource; +} + void r600_init_screen_texture_functions(struct pipe_screen *screen); struct pipe_screen *r600_screen_create2(struct radeon *radeon) { struct r600_screen *rscreen; - enum radeon_family family = r600_get_family(radeon); rscreen = CALLOC_STRUCT(r600_screen); if (rscreen == NULL) { @@ -2197,6 +2230,7 @@ struct pipe_screen *r600_screen_create2(struct radeon *radeon) rscreen->screen.context_create = r600_create_context2; r600_init_screen_texture_functions(&rscreen->screen); r600_init_screen_resource_functions(&rscreen->screen); + rscreen->screen.user_buffer_create = r600_user_buffer_create2; return &rscreen->screen; } diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index b3d618748d1..e32071b0e4e 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -39,8 +39,8 @@ #include struct radeon_ws_bo { - struct pipe_reference reference; - struct pb_buffer *pb; + struct pipe_reference reference; + struct pb_buffer *pb; }; struct radeon_bo { @@ -54,6 +54,9 @@ struct radeon_bo { struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); +void radeon_bo_reference(struct radeon *radeon, + struct radeon_bo **dst, + struct radeon_bo *src); unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); @@ -694,14 +697,13 @@ out_err: return r; } -static void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_ws_bo *bo) +static void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo) { int i, reloc_id; - unsigned handle = radeon_ws_bo_get_handle(bo); assert(bo != NULL); for (i = 0, reloc_id = -1; i < ctx->creloc; i++) { - if (ctx->reloc[i].handle == handle) { + if (ctx->reloc[i].handle == bo->handle) { reloc_id = i * sizeof(struct r600_reloc) / 4; /* set PKT3 to point to proper reloc */ *pm4 = reloc_id; @@ -713,11 +715,11 @@ static void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct rad r600_context_flush(ctx); } reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4; - ctx->reloc[ctx->creloc].handle = handle; + ctx->reloc[ctx->creloc].handle = bo->handle; ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT; ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT; ctx->reloc[ctx->creloc].flags = 0; - radeon_ws_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); + radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); ctx->creloc++; /* set PKT3 to point to proper reloc */ *pm4 = reloc_id; @@ -741,10 +743,6 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat /* find relocation */ id = block->pm4_bo_index[id]; radeon_ws_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); - for (int j = 0; j < block->reloc[id].nreloc; j++) { - r600_context_bo_reloc(ctx, &block->pm4[block->reloc[id].bo_pm4_index[j]], - block->reloc[id].bo); - } } block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; @@ -780,8 +778,6 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } - r600_context_bo_reloc(ctx, &block->pm4[block->reloc[1].bo_pm4_index[0]], block->reloc[1].bo); - r600_context_bo_reloc(ctx, &block->pm4[block->reloc[2].bo_pm4_index[0]], block->reloc[2].bo); block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; @@ -860,9 +856,23 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 static inline void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group, unsigned opcode) { + struct radeon_bo *bo; + int id; + for (int i = 0; i < group->nblocks; i++) { struct r600_group_block *block = &group->blocks[i]; if (block->status & R600_BLOCK_STATUS_DIRTY) { + for (int j = 0; j < block->nreg; j++) { + if (block->pm4_bo_index[j]) { + /* find relocation */ + id = block->pm4_bo_index[j]; + bo = radeon_bo_pb_get_bo(block->reloc[id].bo->pb); + for (int k = 0; k < block->reloc[id].nreloc; k++) { + r600_context_bo_reloc(ctx, &block->pm4[block->reloc[id].bo_pm4_index[k]], bo); + } + } + } + ctx->pm4[ctx->pm4_cdwords++] = PKT3(opcode, block->nreg); ctx->pm4[ctx->pm4_cdwords++] = (block->start_offset - group->start_offset) >> 2; memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); @@ -911,7 +921,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], draw->indices); + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); } else { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; @@ -949,7 +959,7 @@ void r600_context_flush(struct r600_context *ctx) #endif /* restart */ for (int i = 0; i < ctx->creloc; i++) { - radeon_ws_bo_reference(ctx->radeon, &ctx->bo[i], NULL); + radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); } ctx->creloc = 0; ctx->pm4_dirty_cdwords = 0; @@ -961,13 +971,6 @@ void r600_context_flush(struct r600_context *ctx) if (block->status & R600_BLOCK_STATUS_ENABLED) { ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; block->status |= R600_BLOCK_STATUS_DIRTY; - for (int k = 1; k <= block->nbo; k++) { - for (int l = 0; l < block->reloc[k].nreloc; l++) { - r600_context_bo_reloc(ctx, - &block->pm4[block->reloc[k].bo_pm4_index[l]], - block->reloc[k].bo); - } - } } } } @@ -1010,7 +1013,7 @@ void r600_context_dump_bof(struct r600_context *ctx, const char *file) if (array == NULL) goto out_err; for (i = 0; i < ctx->creloc; i++) { - struct radeon_bo *rbo = radeon_bo_pb_get_bo(ctx->bo[i]->pb); + struct radeon_bo *rbo = ctx->bo[i]; bo = bof_object(); if (bo == NULL) goto out_err; diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 85aea89c700..4471d3ca427 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -43,7 +43,7 @@ struct radeon_register { }; struct radeon_bo { - struct pipe_reference reference; + struct pipe_reference reference; unsigned handle; unsigned size; unsigned alignment; -- cgit v1.2.3 From 23c507f1358833585de330ed313dffafabbbd3cd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Sep 2010 10:35:50 -0700 Subject: i965: Share the KIL_NV implementation between glsl and non-glsl. --- src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_emit.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 17 +---------------- 3 files changed, 3 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 2639d4f26b3..c28acad24b5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -373,6 +373,7 @@ void emit_fb_write(struct brw_wm_compile *c, void emit_frontfacing(struct brw_compile *p, const struct brw_reg *dst, GLuint mask); +void emit_kil_nv(struct brw_wm_compile *c); void emit_linterp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index f3ad01b3fec..a4754ca8cf6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1223,7 +1223,7 @@ static void emit_kil( struct brw_wm_compile *c, /* KIL_NV kills the pixels that are currently executing, not based on a test * of the arguments. */ -static void emit_kil_nv( struct brw_wm_compile *c ) +void emit_kil_nv( struct brw_wm_compile *c ) { struct brw_compile *p = &c->func; struct brw_reg r0uw = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 7d6724dc1c1..7c05e452ddd 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -614,21 +614,6 @@ static void emit_arl(struct brw_wm_compile *c, brw_set_saturate(p, 0); } -/** - * For GLSL shaders, this KIL will be unconditional. - * It may be contained inside an IF/ENDIF structure of course. - */ -static void emit_kil(struct brw_wm_compile *c) -{ - struct brw_compile *p = &c->func; - struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */ - brw_AND(p, depth, c->emit_mask_reg, depth); - brw_pop_insn_state(p); -} - static INLINE struct brw_reg high_words( struct brw_reg reg ) { return stride( suboffset( retype( reg, BRW_REGISTER_TYPE_W ), 1 ), @@ -898,7 +883,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]); break; case OPCODE_KIL_NV: - emit_kil(c); + emit_kil_nv(c); break; case OPCODE_IF: assert(if_depth < MAX_IF_DEPTH); -- cgit v1.2.3 From 4a0bc4716db7bbcbcd65c0f993704733f47d41f7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Sep 2010 10:53:34 -0700 Subject: i965: Also enable CC statistics when doing OQs. This is required by the spec, so respect that. --- src/mesa/drivers/dri/i965/brw_cc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index cfce5d31405..8430ee0cfa0 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -90,6 +90,7 @@ static void prepare_cc_unit(struct brw_context *brw) */ static void upload_cc_unit(struct brw_context *brw) { + struct intel_context *intel = &brw->intel; GLcontext *ctx = &brw->intel.ctx; struct brw_cc_unit_state cc; void *map; @@ -203,12 +204,12 @@ static void upload_cc_unit(struct brw_context *brw) cc.cc2.depth_write_enable = ctx->Depth.Mask; } + if (intel->stats_wm || (INTEL_DEBUG & DEBUG_STATS)) + cc.cc5.statistics_enable = 1; + /* CACHE_NEW_CC_VP */ cc.cc4.cc_viewport_state_offset = brw->cc.vp_bo->offset >> 5; /* reloc */ - if (INTEL_DEBUG & DEBUG_STATS) - cc.cc5.statistics_enable = 1; - map = brw_state_batch(brw, sizeof(cc), 64, &brw->cc.state_bo, &brw->cc.state_offset); memcpy(map, &cc, sizeof(cc)); -- cgit v1.2.3 From dd9a88f4ddf4e5fa384792f891a1cc3d8ff73946 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Sep 2010 12:05:37 -0700 Subject: i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ Looks like the problem was we weren't passing the depth to the render target as expected, so the chip would wedge. Fixes GPU hang in occlusion-query-discard. Bug #30097 --- src/mesa/drivers/dri/i965/brw_wm.c | 4 +++- src/mesa/drivers/dri/i965/brw_wm.h | 3 ++- src/mesa/drivers/dri/i965/brw_wm_iz.c | 22 ++++++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index d70be7bda28..17ff3e2b2b3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -215,6 +215,7 @@ static void do_wm_prog( struct brw_context *brw, static void brw_wm_populate_key( struct brw_context *brw, struct brw_wm_prog_key *key ) { + struct intel_context *intel = &brw->intel; GLcontext *ctx = &brw->intel.ctx; /* BRW_NEW_FRAGMENT_PROGRAM */ const struct brw_fragment_program *fp = @@ -279,7 +280,8 @@ static void brw_wm_populate_key( struct brw_context *brw, } } - brw_wm_lookup_iz(line_aa, + brw_wm_lookup_iz(intel, + line_aa, lookup, uses_depth, key); diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index c28acad24b5..fed13729698 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -299,7 +299,8 @@ void brw_wm_print_insn( struct brw_wm_compile *c, void brw_wm_print_program( struct brw_wm_compile *c, const char *stage ); -void brw_wm_lookup_iz( GLuint line_aa, +void brw_wm_lookup_iz( struct intel_context *intel, + GLuint line_aa, GLuint lookup, GLboolean ps_uses_depth, struct brw_wm_prog_key *key ); diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.c b/src/mesa/drivers/dri/i965/brw_wm_iz.c index 8505ef19510..62e556698ba 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.c +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.c @@ -120,24 +120,38 @@ const struct { * \param line_aa AA_NEVER, AA_ALWAYS or AA_SOMETIMES * \param lookup bitmask of IZ_* flags */ -void brw_wm_lookup_iz( GLuint line_aa, +void brw_wm_lookup_iz( struct intel_context *intel, + GLuint line_aa, GLuint lookup, GLboolean ps_uses_depth, struct brw_wm_prog_key *key ) { GLuint reg = 2; + GLboolean kill_stats_promoted_workaround = GL_FALSE; assert (lookup < IZ_BIT_MAX); - + + /* Crazy workaround in the windowizer, which we need to track in + * our register allocation and render target writes. See the "If + * statistics are enabled..." paragraph of 11.5.3.2: Early Depth + * Test Cases [Pre-DevGT] of the 3D Pipeline - Windower B-Spec. + */ + if (intel->stats_wm && + (lookup & IZ_PS_KILL_ALPHATEST_BIT) && + wm_iz_table[lookup].mode == P) { + kill_stats_promoted_workaround = GL_TRUE; + } + if (lookup & IZ_PS_COMPUTES_DEPTH_BIT) key->computes_depth = 1; - if (wm_iz_table[lookup].sd_present || ps_uses_depth) { + if (wm_iz_table[lookup].sd_present || ps_uses_depth || + kill_stats_promoted_workaround) { key->source_depth_reg = reg; reg += 2; } - if (wm_iz_table[lookup].sd_to_rt) + if (wm_iz_table[lookup].sd_to_rt || kill_stats_promoted_workaround) key->source_depth_to_render_target = 1; if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) { -- cgit v1.2.3 From 1bcdc504d10b7776cc96d63efd9e9432a66a2a90 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Tue, 21 Sep 2010 21:57:35 +0200 Subject: gallium/docs: The RET opcode may appear anywhere in a subroutine. Signed-off-by: Tilman Sauerbeck --- src/gallium/docs/source/tgsi.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 4c1f47ac670..9e02d43ab74 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -678,8 +678,6 @@ This instruction replicates its result. pc = pop() - Potential restrictions: - * Only occurs at end of function. .. opcode:: SSG - Set Sign -- cgit v1.2.3 From 82c346673a78e6cc32e7a1451f2b127128246ef3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 22:08:37 +0200 Subject: d3d1x: fix build with compilers other than GCC 4.5 There was some libstdc++-specific code that would only build with GCC 4.5 Now it should be much more compatible, at the price of reimplementing the generic hash function. --- .../d3d1x/d3d1xstutil/include/d3d1xstutil.h | 40 ++++++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index f79cc72a5d7..ab195f1af8a 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -748,21 +748,48 @@ static inline bool operator !=(const c_string& a, const c_string& b) return strcmp(a.p, b.p); } -#ifdef __GLIBCXX__ +static inline size_t raw_hash(const char* p, size_t size) +{ + size_t res; + if(sizeof(size_t) >= 8) + res = (size_t)14695981039346656037ULL; + else + res = (size_t)2166136261UL; + const char* end = p + size; + for(; p != end; ++p) + { + res ^= (size_t)*p++; + if(sizeof(size_t) >= 8) + res *= (size_t)1099511628211ULL; + else + res *= (size_t)16777619UL; + } + return res; +}; + +template +static inline size_t raw_hash(const T& t) +{ + return raw_hash((const char*)&t, sizeof(t)); +} + +// TODO: only tested with the gcc libstdc++, might not work elsewhere namespace std { +#ifndef _MSC_VER namespace tr1 { +#endif template<> inline size_t hash::operator()(GUID __val) const { - return _Fnv_hash::hash(__val); + return raw_hash(__val); } template<> inline size_t hash::operator()(c_string __val) const { - return _Fnv_hash::hash(__val.p, strlen(__val.p)); + return raw_hash(__val.p, strlen(__val.p)); } template @@ -777,13 +804,12 @@ namespace std std::pair p; p.first = hash()(__val.first); p.second = hash()(__val.second); - return _Fnv_hash::hash(p); + return raw_hash(p); } +#ifndef _MSC_VER } -} -#else -#warning "You probably need to add a pair, C string and GUID hash implementation for your C++ library" #endif +} template struct GalliumPrivateDataComObject : public GalliumComObject -- cgit v1.2.3 From b4b2091655676ec3b898d3ae7298192aa7f9147f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 22:34:40 +0200 Subject: d3d1x: add template parameters to base class ctor calls for GCC 4.4 GCC 4.5 is fine without them, but GCC 4.4 requires them. Should fully fix the build on GCC 4.4 --- .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 6 +++--- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 22 ++++++++++++---------- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 4 ++-- .../state_trackers/d3d1x/gd3d11/d3d11_objects.h | 6 +++--- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 69ddbc5a0c0..41c8f29847e 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -77,7 +77,7 @@ struct GalliumDXGIFactory : public GalliumDXGIObject void* resolver_cookie; GalliumDXGIFactory(const struct native_platform* platform, void* display, PFNHWNDRESOLVER resolver, void* resolver_cookie) - : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display), resolver(resolver ? resolver : identity_resolver), resolver_cookie(resolver_cookie) + : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display), resolver(resolver ? resolver : identity_resolver), resolver_cookie(resolver_cookie) {} virtual HRESULT STDMETHODCALLTYPE EnumAdapters( @@ -316,7 +316,7 @@ struct GalliumDXGIOutput : public GalliumDXGIObject(adapter), connector(connector) { memset(&desc, 0, sizeof(desc)); for(unsigned i = 0; i < std::min(name.size(), sizeof(desc.DeviceName) - 1); ++i) @@ -818,7 +818,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject(factory), desc(p_desc) { HRESULT hr; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 69dfd403f3d..46a3905d8fc 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -126,20 +126,22 @@ struct GalliumD3D11Caps unsigned stages; }; -// used to avoid needing to have forward declarations of functions -// this is called "screen" because in the D3D10 case it's only part of the device -struct GalliumD3D11Screen - : public GalliumDXGIDevice< - GalliumMultiComObject< +typedef GalliumDXGIDevice< + GalliumMultiComObject< #if API >= 11 - GalliumPrivateDataComObject, + GalliumPrivateDataComObject, #else - GalliumPrivateDataComObject, + GalliumPrivateDataComObject, #endif - IGalliumDevice - > + IGalliumDevice > +> GalliumD3D11ScreenBase; + +// used to avoid needing to have forward declarations of functions +// this is called "screen" because in the D3D10 case it's only part of the device +struct GalliumD3D11Screen : public GalliumD3D11ScreenBase { + pipe_screen* screen; pipe_context* immediate_pipe; GalliumD3D11Caps screen_caps; @@ -159,7 +161,7 @@ struct GalliumD3D11Screen GalliumD3D11Screen(pipe_screen* screen, struct pipe_context* immediate_pipe, IDXGIAdapter* adapter) - : GalliumDXGIDevice(adapter), screen(screen), immediate_pipe(immediate_pipe) + : GalliumD3D11ScreenBase(adapter), screen(screen), immediate_pipe(immediate_pipe) { } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index a8573cdf686..032cb0ea841 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -119,7 +119,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #define SYNCHRONIZED do {} while(0) GalliumD3D11DeviceContext(GalliumD3D11Screen* device, pipe_context* pipe, bool owns_pipe, unsigned context_flags = 0) - : GalliumD3D11DeviceChild(device), pipe(pipe), owns_pipe(owns_pipe), context_flags(context_flags) + : GalliumD3D11DeviceChild(device), pipe(pipe), owns_pipe(owns_pipe), context_flags(context_flags) { caps = device->screen_caps; init_context(); @@ -1988,7 +1988,7 @@ struct GalliumD3D11ImmediateDeviceContext : public GalliumD3D11DeviceContext { GalliumD3D11ImmediateDeviceContext(GalliumD3D11Screen* device, pipe_context* pipe, unsigned context_flags = 0) - : GalliumD3D11DeviceContext(device, pipe, context_flags) + : GalliumD3D11DeviceContext(device, pipe, context_flags) { // not necessary, but tests that the API at least basically works ClearState(); diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h index ad6b28fceb1..b7542fd30e4 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h @@ -684,14 +684,14 @@ struct GalliumD3D11QueryOrPredicate : public GalliumD3D11Asynchronous struct GalliumD3D11Query : public GalliumD3D11QueryOrPredicate { GalliumD3D11Query(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_QUERY_DESC& desc) - : GalliumD3D11QueryOrPredicate(device, query, data_size, desc) + : GalliumD3D11QueryOrPredicate(device, query, data_size, desc) {} }; struct GalliumD3D11Predicate : public GalliumD3D11QueryOrPredicate { GalliumD3D11Predicate(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_QUERY_DESC& desc) - : GalliumD3D11QueryOrPredicate(device, query, data_size, desc) + : GalliumD3D11QueryOrPredicate(device, query, data_size, desc) {} ~GalliumD3D11Predicate() @@ -704,7 +704,7 @@ struct GalliumD3D11Counter : public GalliumD3D11Asynchronous { D3D11_COUNTER_DESC desc; GalliumD3D11Counter(GalliumD3D11Screen* device, struct pipe_query* query, unsigned data_size, const D3D11_COUNTER_DESC& desc) - : GalliumD3D11Asynchronous(device, query, data_size), desc(desc) + : GalliumD3D11Asynchronous(device, query, data_size), desc(desc) {} virtual void STDMETHODCALLTYPE GetDesc( -- cgit v1.2.3 From c02bf8162981c4b6287098bc33e954519d414326 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 22:47:09 +0200 Subject: d3d1x: fix GCC 4.1/4.2 build --- .../state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index ab195f1af8a..19ac53e6bd3 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -781,12 +781,22 @@ namespace std { #endif template<> + struct hash : public std::unary_function + { + inline size_t operator()(GUID __val) const; + }; + inline size_t hash::operator()(GUID __val) const { return raw_hash(__val); } template<> + struct hash : public std::unary_function + { + inline size_t operator()(c_string __val) const; + }; + inline size_t hash::operator()(c_string __val) const { return raw_hash(__val.p, strlen(__val.p)); @@ -795,7 +805,7 @@ namespace std template struct hash > : public std::unary_function, size_t> { - size_t operator()(std::pair __val) const; + inline size_t operator()(std::pair __val) const; }; template -- cgit v1.2.3 From 2b95525429935474ee4b507348507da45adc6872 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Sep 2010 14:56:58 -0600 Subject: glsl2: fix typo in error msg --- src/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c2c662152e2..53e18a06d1b 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -457,7 +457,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog, */ if (input->type != output->type) { linker_error_printf(prog, - "%s shader output `%s' delcared as " + "%s shader output `%s' declared as " "type `%s', but %s shader input declared " "as type `%s'\n", producer_stage, output->name, -- cgit v1.2.3 From 45d10c7d5910ada45b3bf7c34f9fb98c80c72664 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 21 Sep 2010 16:56:59 -0400 Subject: r600g: fix multi buffer rendering Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_state2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 36a33760339..f29aa0fdeaf 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -234,10 +234,10 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) exports_ps |= 1; else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { - exports_ps |= (1 << (num_cout+1)); num_cout++; } } + exports_ps |= S_028854_EXPORT_COLORS(num_cout); if (!exports_ps) { /* always at least export 1 component per pixel */ exports_ps = 2; @@ -687,7 +687,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, #if 0 sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 2) { + if (dc < 20) { r600_context_dump_bof(&rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } -- cgit v1.2.3 From 83ea4878db8768b6e8444492009d80247d4374b7 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 21 Sep 2010 23:21:35 +0200 Subject: d3d1x: ignore errors while building docs Some versions of dot apparently lack pdf output. --- src/gallium/state_trackers/d3d1x/docs/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/docs/Makefile b/src/gallium/state_trackers/d3d1x/docs/Makefile index ca1e3ce05dd..7f38fa73fb4 100644 --- a/src/gallium/state_trackers/d3d1x/docs/Makefile +++ b/src/gallium/state_trackers/d3d1x/docs/Makefile @@ -1,4 +1,5 @@ all: module_dependencies.svg module_dependencies.pdf +.IGNORE: module_dependencies.svg module_dependencies.pdf include ../Makefile.inc -- cgit v1.2.3 From ffa2d203fb71d54dc8dfa5d17aa1637d2f2bb5b5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Sep 2010 15:25:31 -0600 Subject: gallivm: fix lp_build_sample_compare() The old code didn't really make sense. We only need to compare the X channel of the texture (depth) against the texcoord. For (bi)linear sampling we should move the calls to this function and compute the final result as (s1+s2+s3+s4) * 0.25. Someday. This fixes the glean glsl1 shadow2D() tests. See fd.o bug 29307. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 40 +++++++++++++---------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index f86d0553c7d..91fab18e4e6 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -47,6 +47,7 @@ #include "lp_bld_arit.h" #include "lp_bld_bitarit.h" #include "lp_bld_logic.h" +#include "lp_bld_printf.h" #include "lp_bld_swizzle.h" #include "lp_bld_flow.h" #include "lp_bld_gather.h" @@ -1057,6 +1058,11 @@ lp_build_sample_general(struct lp_build_sample_context *bld, } +/** + * Do shadow test/comparison. + * \param p the texcoord Z (aka R, aka P) component + * \param texel the texel to compare against (use the X channel) + */ static void lp_build_sample_compare(struct lp_build_sample_context *bld, LLVMValueRef p, @@ -1064,30 +1070,30 @@ lp_build_sample_compare(struct lp_build_sample_context *bld, { struct lp_build_context *texel_bld = &bld->texel_bld; LLVMValueRef res; - unsigned chan; + const unsigned chan = 0; - if(bld->static_state->compare_mode == PIPE_TEX_COMPARE_NONE) + if (bld->static_state->compare_mode == PIPE_TEX_COMPARE_NONE) return; - /* TODO: Compare before swizzling, to avoid redundant computations */ - res = NULL; - for(chan = 0; chan < 4; ++chan) { - LLVMValueRef cmp; - cmp = lp_build_cmp(texel_bld, bld->static_state->compare_func, p, texel[chan]); - cmp = lp_build_select(texel_bld, cmp, texel_bld->one, texel_bld->zero); - - if(res) - res = lp_build_add(texel_bld, res, cmp); - else - res = cmp; + /* debug code */ + if (0) { + LLVMValueRef indx = lp_build_const_int32(0); + LLVMValueRef coord = LLVMBuildExtractElement(bld->builder, p, indx, ""); + LLVMValueRef tex = LLVMBuildExtractElement(bld->builder, + texel[chan], indx, ""); + lp_build_printf(bld->builder, "shadow compare coord %f to texture %f\n", + coord, tex); } - assert(res); - res = lp_build_mul(texel_bld, res, lp_build_const_vec(texel_bld->type, 0.25)); + /* result = (p FUNC texel) ? 1 : 0 */ + res = lp_build_cmp(texel_bld, bld->static_state->compare_func, + p, texel[chan]); + res = lp_build_select(texel_bld, res, texel_bld->one, texel_bld->zero); /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */ - for(chan = 0; chan < 3; ++chan) - texel[chan] = res; + texel[0] = + texel[1] = + texel[2] = res; texel[3] = texel_bld->one; } -- cgit v1.2.3 From 9e8d9f456f6c03ac135fd7a1a1443279358494fc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Sep 2010 15:29:26 -0600 Subject: softpipe: add missing calls to set draw vertex samplers/views Part of the fix for running softpipe w/ LLVM-enabled draw module. --- src/gallium/drivers/softpipe/sp_state_sampler.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 79d9516ad9c..1be5136f0ea 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -118,6 +118,10 @@ softpipe_bind_vertex_sampler_states(struct pipe_context *pipe, softpipe->num_vertex_samplers = num_samplers; + draw_set_samplers(softpipe->draw, + softpipe->vertex_samplers, + softpipe->num_vertex_samplers); + softpipe->dirty |= SP_NEW_SAMPLER; } @@ -234,6 +238,10 @@ softpipe_set_vertex_sampler_views(struct pipe_context *pipe, softpipe->num_vertex_sampler_views = num; + draw_set_sampler_views(softpipe->draw, + softpipe->vertex_sampler_views, + softpipe->num_vertex_sampler_views); + softpipe->dirty |= SP_NEW_TEXTURE; } -- cgit v1.2.3 From 13cd131b0f713c468c3cf3b12f6439288d5a3161 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 21 Sep 2010 15:11:00 -0700 Subject: glut: Define markWindowHidden for non-Windows only. Fixes this GCC warning on MinGW build. glut_event.c:255: warning: 'markWindowHidden' defined but not used --- src/glut/glx/glut_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c index 4cdb814d76a..c450ee96b83 100644 --- a/src/glut/glx/glut_event.c +++ b/src/glut/glx/glut_event.c @@ -251,6 +251,8 @@ __glutRegisterEventParser(GLUTeventParser * parser) eventParserList = parser; } + +#if !defined(_WIN32) static void markWindowHidden(GLUTwindow * window) { @@ -272,8 +274,6 @@ markWindowHidden(GLUTwindow * window) } } -#if !defined(_WIN32) - static void purgeStaleWindow(Window win) { -- cgit v1.2.3 From 3642ca2f66efa8e078062f566b8f9975928d9f44 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 21 Sep 2010 15:17:52 -0700 Subject: glut: Define eventParser for non-Windows only. Fixes this GCC warning on MinGW build. glut_input.c:295: warning: 'eventParser' defined but not used --- src/glut/glx/glut_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glut/glx/glut_input.c b/src/glut/glx/glut_input.c index 7d2eda00f71..53f9dc5e0f8 100644 --- a/src/glut/glx/glut_input.c +++ b/src/glut/glx/glut_input.c @@ -292,10 +292,10 @@ __glutProcessDeviceEvents(XEvent * event) return 0; } +#if !defined(_WIN32) static GLUTeventParser eventParser = {__glutProcessDeviceEvents, NULL}; -#if !defined(_WIN32) static void addDeviceEventParser(void) { -- cgit v1.2.3 From e7087175f8a04f777403366fb34b58edd00f4d60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Sep 2010 18:13:02 -0600 Subject: mesa: don't advertise bogus GL_ARB_shading_language_120 extension Instead of using the invalid GL_ARB_shading_language_120 extension to determine the GLSL version, use a new ctx->Const.GLSLVersion field. Updated the intel and r600 drivers, but untested. See fd.o bug 29910 NOTE: This is a candidate for the 7.9 branch (but let's wait and see if there's any regressions). --- src/mesa/drivers/dri/i965/brw_context.c | 10 ++++++++ src/mesa/drivers/dri/intel/intel_extensions.c | 1 - src/mesa/drivers/dri/r600/r600_context.c | 3 ++- src/mesa/main/context.c | 15 ++++++++++++ src/mesa/main/extensions.c | 7 ------ src/mesa/main/getstring.c | 34 ++++++++++++++++++++------- src/mesa/main/mtypes.h | 3 ++- src/mesa/main/version.c | 2 +- src/mesa/state_tracker/st_extensions.c | 6 ++++- 9 files changed, 60 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index d08538ec20c..49be289750b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -42,6 +42,12 @@ #include "tnl/t_pipeline.h" +static const struct dri_extension gl_21_extension[] = { + {"GL_VERSION_2_1", GL_VERSION_2_1_functions }, +}; + + + /*************************************** * Mesa's Driver Functions ***************************************/ @@ -88,6 +94,8 @@ GLboolean brwCreateContext( int api, TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; + ctx->Const.GLSLVersion = 120; + ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS; ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */ @@ -152,6 +160,8 @@ GLboolean brwCreateContext( int api, MIN2(ctx->Const.FragmentProgram.MaxNativeParameters, ctx->Const.FragmentProgram.MaxEnvParams); + driInitExtensions(ctx, gl_21_extension, GL_TRUE); + if (intel->is_g4x || intel->gen >= 5) { brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45; brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index bf22a423fcb..a066b5b5597 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -89,7 +89,6 @@ static const struct dri_extension card_extensions[] = { { "GL_ARB_point_sprite", NULL }, { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, - { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, { "GL_ARB_sync", GL_ARB_sync_functions }, { "GL_ARB_texture_border_clamp", NULL }, { "GL_ARB_texture_cube_map", NULL }, diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 9c8fe2a24fa..f4e67163506 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -166,7 +166,6 @@ static const struct dri_extension mm_extensions[] = { static const struct dri_extension gl_20_extension[] = { #ifdef R600_ENABLE_GLSL_TEST {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, - {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, #else {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, #endif /* R600_ENABLE_GLSL_TEST */ @@ -266,6 +265,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) r700->bShaderUseMemConstant = GL_FALSE; } + ctx->Const.GLSLVersion = 120; + ctx->Const.MaxTextureImageUnits = 16; /* 8 per clause on r6xx, 16 on r7xx * but I think mesa only supports 8 at the moment diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b1f800f4c21..3bddf2570ec 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -597,6 +597,21 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxVarying = MAX_VARYING; #endif + /* Shading language version */ + if (ctx->API == API_OPENGL) { +#if FEATURE_ARB_shading_language_120 + ctx->Const.GLSLVersion = 120; +#else + ctx->Const.GLSLVersion = 110; +#endif + } + else if (ctx->API == API_OPENGLES2) { + ctx->Const.GLSLVersion = 100; + } + else if (ctx->API == API_OPENGLES) { + ctx->Const.GLSLVersion = 0; /* GLSL not supported */ + } + /* GL_ARB_framebuffer_object */ ctx->Const.MaxSamples = 0; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 50b97f51132..080fa98dfc6 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -77,7 +77,6 @@ static const struct { { OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) }, { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) }, { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, - { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, { OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) }, { OFF, "GL_ARB_sync", F(ARB_sync) }, @@ -268,9 +267,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif #if FEATURE_ARB_shading_language_100 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; -#endif -#if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; #endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_shadow_ambient = GL_TRUE; @@ -513,9 +509,6 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) #if FEATURE_EXT_texture_sRGB ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif -#if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif } diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 5e4fcd599c3..3910047fb5d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -30,26 +30,42 @@ #include "enums.h" #include "extensions.h" + +/** + * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. + */ static const GLubyte * shading_language_version(GLcontext *ctx) { switch (ctx->API) { -#if FEATURE_ARB_shading_language_100 case API_OPENGL: - if (ctx->Extensions.ARB_shading_language_120) - return (const GLubyte *) "1.20"; - else if (ctx->Extensions.ARB_shading_language_100) - return (const GLubyte *) "1.10"; - goto error; -#endif + if (!ctx->Extensions.ARB_shader_objects) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetString"); + return (const GLubyte *) 0; + } + + switch (ctx->Const.GLSLVersion) { + case 110: + return (const GLubyte *) "1.10"; + case 120: + return (const GLubyte *) "1.20"; + case 130: + return (const GLubyte *) "1.30"; + default: + _mesa_problem(ctx, + "Invalid GLSL version in shading_language_version()"); + return (const GLubyte *) 0; + } + break; case API_OPENGLES2: return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16"; case API_OPENGLES: + /* fall-through */ + default: - error: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); + _mesa_problem(ctx, "Unexpected API value in shading_language_version()"); return (const GLubyte *) 0; } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fdf8100c8cd..5494be8f423 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2608,6 +2608,8 @@ struct gl_constants GLuint MaxVarying; /**< Number of float[4] varying parameters */ + GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */ + /** Which texture units support GL_ATI_envmap_bumpmap as targets */ GLbitfield SupportedBumpUnits; @@ -2668,7 +2670,6 @@ struct gl_extensions GLboolean ARB_seamless_cube_map; GLboolean ARB_shader_objects; GLboolean ARB_shading_language_100; - GLboolean ARB_shading_language_120; GLboolean ARB_shadow; GLboolean ARB_shadow_ambient; GLboolean ARB_sync; diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 9e1f5f2a4fe..5997ca00fdc 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -84,7 +84,7 @@ compute_version(GLcontext *ctx) (ctx->Extensions.EXT_stencil_two_side || ctx->Extensions.ATI_separate_stencil)); const GLboolean ver_2_1 = (ver_2_0 && - ctx->Extensions.ARB_shading_language_120 && + ctx->Const.GLSLVersion >= 120 && ctx->Extensions.EXT_pixel_buffer_object && ctx->Extensions.EXT_texture_sRGB); const GLboolean ver_3_0 = (ver_2_1 && diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 4c18c66cc4d..017f6c5cf7e 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -186,6 +186,11 @@ void st_init_limits(struct st_context *st) * attributes) supported by a driver. */ c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2; c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING); + + /* XXX we'll need a better query here someday */ + if (screen->get_param(screen, PIPE_CAP_GLSL)) { + c->GLSLVersion = 120; + } } @@ -285,7 +290,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_vertex_shader = GL_TRUE; ctx->Extensions.ARB_shader_objects = GL_TRUE; ctx->Extensions.ARB_shading_language_100 = GL_TRUE; - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; } if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_REPEAT) > 0) { -- cgit v1.2.3 From ca35292a4456fec1c584d40bf9b4197fe733f609 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 21 Sep 2010 20:24:51 -0400 Subject: r600g: occlusion query for new design Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 38 +++++++- src/gallium/drivers/r600/r600_state2.c | 47 ++++++++++ src/gallium/winsys/r600/drm/r600_priv.h | 7 +- src/gallium/winsys/r600/drm/r600_state2.c | 151 +++++++++++++++++++++++++++++- 4 files changed, 237 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 8879efca794..6d87220db2a 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -28,6 +28,8 @@ #include #include +#include +#include #define RADEON_CTX_MAX_PM4 (64 * 1024 / 4) @@ -183,6 +185,9 @@ struct r600_group { unsigned *offset_block_id; }; +/* + * relocation + */ #pragma pack(1) struct r600_reloc { uint32_t handle; @@ -192,7 +197,29 @@ struct r600_reloc { }; #pragma pack() -struct radeon_bo; +/* + * query + */ +struct r600_query { + u64 result; + /* The kind of query. Currently only OQ is supported. */ + unsigned type; + /* How many results have been written, in dwords. It's incremented + * after end_query and flush. */ + unsigned num_results; + /* if we've flushed the query */ + unsigned state; + /* The buffer where query results are stored. */ + struct radeon_ws_bo *buffer; + unsigned buffer_size; + /* linked list of queries */ + struct list_head list; +}; + +#define R600_QUERY_STATE_STARTED (1 << 0) +#define R600_QUERY_STATE_ENDED (1 << 1) +#define R600_QUERY_STATE_SUSPENDED (1 << 2) + struct r600_context { struct radeon *radeon; @@ -207,6 +234,7 @@ struct r600_context { struct r600_reloc *reloc; struct radeon_bo **bo; u32 *pm4; + struct list_head query_list; }; struct r600_draw { @@ -229,4 +257,12 @@ void r600_context_flush(struct r600_context *ctx); void r600_context_dump_bof(struct r600_context *ctx, const char *file); void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw); +struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type); +void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query); +boolean r600_context_query_result(struct r600_context *ctx, + struct r600_query *query, + boolean wait, void *vresult); +void r600_query_begin(struct r600_context *ctx, struct r600_query *query); +void r600_query_end(struct r600_context *ctx, struct r600_query *query); + #endif diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index f29aa0fdeaf..0343704a90c 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -2089,6 +2089,52 @@ static void r600_init_config2(struct r600_pipe_context *rctx) r600_context_pipe_state_set(&rctx->ctx, rstate); } +static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + return (struct pipe_query*)r600_context_query_create(&rctx->ctx, query_type); +} + +static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + r600_context_query_destroy(&rctx->ctx, (struct r600_query *)query); +} + +static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + r600_query_begin(&rctx->ctx, (struct r600_query *)query); +} + +static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + r600_query_end(&rctx->ctx, (struct r600_query *)query); +} + +static boolean r600_get_query_result(struct pipe_context *ctx, + struct pipe_query *query, + boolean wait, void *vresult) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); +} + +static void r600_init_query_functions2(struct r600_pipe_context *rctx) +{ + rctx->context.create_query = r600_create_query; + rctx->context.destroy_query = r600_destroy_query; + rctx->context.begin_query = r600_begin_query; + rctx->context.end_query = r600_end_query; + rctx->context.get_query_result = r600_get_query_result; +} + static struct pipe_context *r600_create_context2(struct pipe_screen *screen, void *priv) { struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); @@ -2108,6 +2154,7 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi rctx->radeon = rscreen->radeon; r600_init_blit_functions2(rctx); + r600_init_query_functions2(rctx); r600_init_state_functions2(rctx); r600_init_context_resource_functions2(rctx); diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index d02562f17f3..6023f215bb6 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -45,12 +45,11 @@ struct radeon *r600_new(int fd, unsigned device); void r600_delete(struct radeon *r600); struct r600_reg { - unsigned need_bo; - unsigned flush_flags; - unsigned offset; + unsigned need_bo; + unsigned flush_flags; + unsigned offset; }; - /* radeon_pciid.c */ unsigned radeon_family_from_device(unsigned device); diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index e32071b0e4e..d02a5a3895d 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -60,6 +60,10 @@ void radeon_bo_reference(struct radeon *radeon, unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); +/* queries */ +static void r600_context_queries_suspend(struct r600_context *ctx); +static void r600_context_queries_resume(struct r600_context *ctx); + static int r600_group_id_register_offset(unsigned offset) { if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { @@ -583,6 +587,7 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) memset(ctx, 0, sizeof(struct r600_context)); ctx->radeon = radeon; + LIST_INITHEAD(&ctx->query_list); /* initialize groups */ r = r600_group_init(&ctx->groups[R600_GROUP_CONFIG], R600_CONFIG_REG_OFFSET, R600_CONFIG_REG_END); if (r) { @@ -902,7 +907,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) R600_ERR("context is too big to be scheduled\n"); return; } - /* Ok we enough room to copy packet */ + /* enough room to copy packet */ r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONFIG], PKT3_SET_CONFIG_REG); r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONTEXT], PKT3_SET_CONTEXT_REG); r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_ALU_CONST], PKT3_SET_ALU_CONST); @@ -929,6 +934,8 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + /* all dirty state have been scheduled in current cs */ + ctx->pm4_dirty_cdwords = 0; } void r600_context_flush(struct r600_context *ctx) @@ -942,6 +949,9 @@ void r600_context_flush(struct r600_context *ctx) if (!ctx->pm4_cdwords) return; + /* suspend queries */ + r600_context_queries_suspend(ctx); + #if 1 /* emit cs */ drmib.num_chunks = 2; @@ -964,6 +974,13 @@ void r600_context_flush(struct r600_context *ctx) ctx->creloc = 0; ctx->pm4_dirty_cdwords = 0; ctx->pm4_cdwords = 0; + + /* resume queries */ + r600_context_queries_resume(ctx); + + /* set all valid group as dirty so they get reemited on + * next draw command + */ for (int i = 0; i < ctx->ngroups; i++) { for (int j = 0; j < ctx->groups[i].nblocks; j++) { /* mark enabled block as dirty */ @@ -1057,3 +1074,135 @@ out_err: bof_decref(device_id); bof_decref(root); } + +static void r600_query_result(struct r600_context *ctx, struct r600_query *query) +{ + u64 start, end; + u32 *results; + int i; + + results = radeon_ws_bo_map(ctx->radeon, query->buffer, 0, NULL); + for (i = 0; i < query->num_results; i += 4) { + start = (u64)results[i] | (u64)results[i + 1] << 32; + end = (u64)results[i + 2] | (u64)results[i + 3] << 32; + if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) { + query->result += end - start; + } + } + radeon_ws_bo_unmap(ctx->radeon, query->buffer); + query->num_results = 0; +} + +void r600_query_begin(struct r600_context *ctx, struct r600_query *query) +{ + /* query request needs 6 dwords for begin + 6 dwords for end */ + if ((12 + ctx->pm4_cdwords) > ctx->pm4_ndwords) { + /* need to flush */ + r600_context_flush(ctx); + } + + /* if query buffer is full force a flush */ + if (query->num_results >= ((query->buffer_size >> 2) - 2)) { + r600_context_flush(ctx); + r600_query_result(ctx, query); + } + + /* emit begin query */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; + ctx->pm4[ctx->pm4_cdwords++] = query->num_results; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); + + query->state |= R600_QUERY_STATE_STARTED; + query->state ^= R600_QUERY_STATE_ENDED; +} + +void r600_query_end(struct r600_context *ctx, struct r600_query *query) +{ + /* emit begin query */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; + ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); + + query->num_results += 16; + query->state ^= R600_QUERY_STATE_STARTED; + query->state |= R600_QUERY_STATE_ENDED; +} + +struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type) +{ + struct r600_query *query; + + if (query_type != PIPE_QUERY_OCCLUSION_COUNTER) + return NULL; + + query = calloc(1, sizeof(struct r600_query)); + if (query == NULL) + return NULL; + + query->type = query_type; + query->buffer_size = 4096; + + query->buffer = radeon_ws_bo(ctx->radeon, query->buffer_size, 1, 0); + if (!query->buffer) { + free(query); + return NULL; + } + + LIST_ADDTAIL(&query->list, &ctx->query_list); + + return query; +} + +void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query) +{ + radeon_ws_bo_reference(ctx->radeon, &query->buffer, NULL); + LIST_DEL(&query->list); + free(query); +} + +boolean r600_context_query_result(struct r600_context *ctx, + struct r600_query *query, + boolean wait, void *vresult) +{ + uint64_t *result = (uint64_t*)vresult; + + if (query->num_results) { + r600_context_flush(ctx); + } + r600_query_result(ctx, query); + *result = query->result; + query->result = 0; + return TRUE; +} + +static void r600_context_queries_suspend(struct r600_context *ctx) +{ + struct r600_query *query; + + LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) { + if (query->state & R600_QUERY_STATE_STARTED) { + r600_query_end(ctx, query); + query->state |= R600_QUERY_STATE_SUSPENDED; + } + } +} + +static void r600_context_queries_resume(struct r600_context *ctx) +{ + struct r600_query *query; + + LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) { + if (query->state & R600_QUERY_STATE_SUSPENDED) { + r600_query_begin(ctx, query); + query->state ^= R600_QUERY_STATE_SUSPENDED; + } + } +} -- cgit v1.2.3 From 6e901e330aa7f0d186dad19bcc886bf45a76e50b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 21 Sep 2010 13:16:32 +1000 Subject: r600g: fix typo in struct member name --- src/gallium/drivers/r600/eg_hw_states.c | 4 ++-- src/gallium/drivers/r600/r600_hw_states.c | 4 ++-- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_state2.c | 2 +- src/gallium/drivers/r600/r600_texture.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 3d10095919a..6ad350b7d3c 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -164,7 +164,7 @@ static void eg_db(struct r600_context *rctx, struct radeon_state *rstate, return; rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tilled = 1; + rtex->tiled = 1; rtex->array_mode = 2; rtex->tile_type = 1; rtex->depth = 1; @@ -1107,7 +1107,7 @@ static void eg_texture_state_db(struct r600_screen *rscreen, struct r600_resourc radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); rbuffer = &rtexture->resource; - rtexture->tilled = 1; + rtexture->tiled = 1; rtexture->array_mode = 2; rtexture->tile_type = 1; rtexture->depth = 1; diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 271bd1ac506..13abd172d60 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -165,7 +165,7 @@ static void r600_db(struct r600_context *rctx, struct radeon_state *rstate, return; rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tilled = 1; + rtex->tiled = 1; rtex->array_mode = 2; rtex->tile_type = 1; rtex->depth = 1; @@ -1178,7 +1178,7 @@ static void r600_texture_state_db(struct r600_screen *rscreen, struct r600_resou radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); rbuffer = &rtexture->resource; - rtexture->tilled = 1; + rtexture->tiled = 1; rtexture->array_mode = 2; rtexture->tile_type = 1; rtexture->depth = 1; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index cd1c31e82d0..5d569106451 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -50,7 +50,7 @@ struct r600_resource_texture { unsigned long pitch_override; unsigned long bpt; unsigned long size; - unsigned tilled; + unsigned tiled; unsigned array_mode; unsigned tile_type; unsigned depth; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 0343704a90c..b93bdd3022b 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -1563,7 +1563,7 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta return; rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tilled = 1; + rtex->tiled = 1; rtex->array_mode = 2; rtex->tile_type = 1; rtex->depth = 1; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index f60fe9f3169..4aabae1fae0 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -267,7 +267,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, trans->transfer.box = *box; trans->transfer.stride = rtex->pitch[sr.level]; trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face); - if (rtex->tilled && !rtex->depth) { + if (rtex->tiled && !rtex->depth) { resource.target = PIPE_TEXTURE_2D; resource.format = texture->format; resource.width0 = box->width; -- cgit v1.2.3 From 41ef78c5af9a8b0ac80d9bd5375700a8bd0643f8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 22 Sep 2010 12:57:45 +1000 Subject: r600g: cleanup some of the DB blit code add cb/db flush states to the blit code. add support for the rv6xx that need special treatment. according to R6xx_7xx_3D.pdf set r700 CB_SHADER_CONTROL reg in blit code docs say dual export should be disabled for DB->CB --- src/gallium/drivers/r600/r600_blit.c | 62 +++++++++++++++++++++++++++++++++--- src/gallium/drivers/r600/r600d.h | 7 ++++ 2 files changed, 65 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 0506e8280af..e1f226cbdda 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -160,6 +160,8 @@ struct r600_blit_states { struct radeon_state vs_shader; struct radeon_state vs_resource0; struct radeon_state vs_resource1; + struct radeon_state cb_flush; + struct radeon_state db_flush; }; static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600_blit_states *bstates) @@ -445,6 +447,7 @@ static void r600_blit_state_rasterizer(struct r600_screen *rscreen, struct radeo static void r600_blit_state_dsa(struct r600_screen *rscreen, struct radeon_state *rstate) { + uint32_t db_render_override, db_shader_control; radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); /* set states (most default value are 0 and struct already @@ -453,8 +456,16 @@ static void r600_blit_state_dsa(struct r600_screen *rscreen, struct radeon_state rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; rstate->states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F800000; rstate->states[R600_DSA__DB_RENDER_CONTROL] = 0x00000060; - rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = 0x0000002A; - rstate->states[R600_DSA__DB_SHADER_CONTROL] = 0x00000210; + + db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | + S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | + S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); + + db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(0) | + S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); + + rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = db_render_override; + rstate->states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control; radeon_state_pm4(rstate); } @@ -475,6 +486,25 @@ static void r600_blit_state_cb_cntl(struct r600_screen *rscreen, struct radeon_s rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F; rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x0000000F; rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; + rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = 0x1; + radeon_state_pm4(rstate); +} + +static void r600_blit_state_cb_flush(struct r600_screen *rscreen, struct radeon_state *rstate, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) +{ + radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_FLUSH, 0, 0); + + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rtexture->uncompressed); + rstate->nbo = 1; + radeon_state_pm4(rstate); +} + +static void r600_blit_state_db_flush(struct r600_screen *rscreen, struct radeon_state *rstate, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) +{ + radeon_state_init(rstate, rscreen->rw, R600_STATE_DB_FLUSH, 0, 0); + + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rtexture->resource.bo); + rstate->nbo = 1; radeon_state_pm4(rstate); } @@ -512,6 +542,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te struct r600_context *rctx = r600_context(ctx); struct radeon_draw draw; struct r600_blit_states bstates; + enum radeon_family family; int r; r = r600_texture_scissor(ctx, rtexture, level); @@ -535,8 +566,29 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (r) { return r; } - bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = 0x0000008C; - bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; + + /* for some gpus we need special cases */ + family = radeon_get_family(rscreen->rw); + /* according to R6xx_R7xx_3D.pdf section 6.3.1, these GPUs needs special handling */ + if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || + family == CHIP_RV635) { + bstates.dsa.states[R600_DSA__DB_DEPTH_CONTROL] = S_028800_Z_ENABLE(1) | + S_028800_STENCIL_ENABLE(1) | S_028800_ZFUNC(PIPE_FUNC_LEQUAL) | + S_028800_STENCILFUNC(PIPE_FUNC_ALWAYS) | + S_028800_STENCILZPASS(V_028800_STENCIL_KEEP) | + S_028800_STENCILZFAIL(V_028800_STENCIL_INCR); + + bstates.dsa.states[R600_DSA__DB_STENCILREFMASK] = S_028430_STENCILWRITEMASK(0xff); + } else { + bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1); + bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; + } + + r600_blit_state_cb_flush(rscreen, &bstates.cb_flush, rtexture, 0, 0); + r600_blit_state_db_flush(rscreen, &bstates.db_flush, rtexture, 0, 0); + /* force rebuild */ bstates.dsa.cpm4 = bstates.cb_cntl.cpm4 = 0; if (radeon_state_pm4(&bstates.dsa)) { @@ -561,6 +613,8 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te radeon_draw_bind(&draw, &rctx->config); radeon_draw_bind(&draw, &bstates.vgt); radeon_draw_bind(&draw, &bstates.draw); + radeon_draw_bind(&draw, &bstates.cb_flush); + radeon_draw_bind(&draw, &bstates.db_flush); radeon_draw_bind(&draw, &bstates.vs_resource0); radeon_draw_bind(&draw, &bstates.vs_resource1); radeon_draw_bind(&draw, &bstates.vs_constant0); diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index f1aa49c0f78..56fba19a703 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -607,8 +607,15 @@ #define G_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) >> 0) & 0x3FF) #define C_028D34_DEPTH_HEIGHT_TILE_MAX 0xFFFFFC00 #define R_028D0C_DB_RENDER_CONTROL 0x028D0C +#define S_028D0C_DEPTH_CLEAR_ENABLE(x) (((x) & 0x1) << 0) +#define S_028D0C_STENCIL_CLEAR_ENABLE(x) (((x) & 0x1) << 1) +#define S_028D0C_DEPTH_COPY_ENABLE(x) (((x) & 0x1) << 2) +#define S_028D0C_STENCIL_COPY_ENABLE(x) (((x) & 0x1) << 3) +#define S_028D0C_RESUMMARIZE_ENABLE(x) (((x) & 0x1) << 4) #define S_028D0C_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5) #define S_028D0C_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6) +#define S_028D0C_COPY_CENTROID(x) (((x) & 0x1) << 7) +#define S_028D0C_COPY_SAMPLE(x) (((x) & 0x1) << 8) #define S_028D0C_R700_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15) #define R_028D10_DB_RENDER_OVERRIDE 0x028D10 #define V_028D10_FORCE_OFF 0 -- cgit v1.2.3 From d18f3accb02646a48c1f1e1e276d5d9f1dc667b3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 22 Sep 2010 14:19:16 +1000 Subject: r600g: make stencil readback work need to write two components to get stencil components as well --- src/gallium/drivers/r600/r600_blit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index e1f226cbdda..8db3de0c4fb 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -583,9 +583,8 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = S_028D0C_DEPTH_COPY_ENABLE(1) | S_028D0C_STENCIL_COPY_ENABLE(1) | S_028D0C_COPY_CENTROID(1); - bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000001; } - + bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000003; r600_blit_state_cb_flush(rscreen, &bstates.cb_flush, rtexture, 0, 0); r600_blit_state_db_flush(rscreen, &bstates.db_flush, rtexture, 0, 0); -- cgit v1.2.3 From 2b1ea90342a8fb912f3a5a40ebcd7c1ec488a4bb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 22 Sep 2010 14:27:58 +1000 Subject: r600g: disable dirty handling on texture from depth code. nothing was every dirtying the object again, the mesa-demos reflect test was just stalling. this fixes glean readPixSanity. --- src/gallium/drivers/r600/r600_texture.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 4aabae1fae0..37822903e82 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -650,14 +650,7 @@ int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_textu struct r600_screen *rscreen = r600_screen(ctx->screen); int r; - if (!rtexture->depth) { - /* This shouldn't happen maybe print a warning */ - return 0; - } - if (rtexture->uncompressed && !rtexture->dirty) { - /* Uncompressed bo already in good state */ - return 0; - } + /* TODO possible dirty handling */ /* allocate uncompressed texture */ if (rtexture->uncompressed == NULL) { -- cgit v1.2.3 From 86bb64f889c08d2d8738bb7a0183c578e0338f0a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 07:15:15 +0200 Subject: d3d1x: attempt to fix/workaround bug #30322 This may just be hiding some other bug though, since the types are supposed to be the same (and it compiles for me). Anyway, this interface will likely need to changed, since it seems Wine needs a more powerful one capable of expressing window subregions and called at every Present. --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 41c8f29847e..c9db7b66644 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -77,7 +77,7 @@ struct GalliumDXGIFactory : public GalliumDXGIObject void* resolver_cookie; GalliumDXGIFactory(const struct native_platform* platform, void* display, PFNHWNDRESOLVER resolver, void* resolver_cookie) - : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display), resolver(resolver ? resolver : identity_resolver), resolver_cookie(resolver_cookie) + : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display), resolver(resolver ? resolver : (PFNHWNDRESOLVER)identity_resolver), resolver_cookie(resolver_cookie) {} virtual HRESULT STDMETHODCALLTYPE EnumAdapters( -- cgit v1.2.3 From e1e7c8df7fd0670d0c133c006c02e0257be94bf9 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 07:17:38 +0200 Subject: nvfx: remove gl_PointCoord hack Now Gallium has the proper fix, thanks to Brian Paul. --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index d97cab8db19..23fdb0820a5 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1235,10 +1235,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) struct nouveau_channel* chan = nvfx->screen->base.channel; struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog; struct nvfx_vertex_program* vp; - /* Gallium always puts the point coord in GENERIC[0] - * TODO: this is wrong, Gallium needs to be fixed - */ - unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * (nvfx->rasterizer->pipe.sprite_coord_enable | 1); + + // TODO: the multiplication by point_quad_rasterization is probably superfluous + unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable; boolean emulate_sprite_flipping = sprite_coord_enable && nvfx->rasterizer->pipe.sprite_coord_mode; unsigned key = emulate_sprite_flipping; @@ -1297,7 +1296,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) unsigned used_texcoords = 0; for(unsigned i = 0; i < fp->num_slots; ++i) { unsigned generic = fp->slot_to_generic[i]; - if(!((1 << generic) & sprite_coord_enable)) + if((generic < 32) && !((1 << generic) & sprite_coord_enable)) { unsigned char slot_mask = vp->generic_to_fp_input[generic]; if(slot_mask >= 0xf0) @@ -1320,7 +1319,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx) for(i = 0; i < fp->num_slots; ++i) { unsigned generic = fp->slot_to_generic[i]; - if((1 << generic) & sprite_coord_enable) + if((generic < 32) && ((1 << generic) & sprite_coord_enable)) { if(fp->slot_to_fp_input[i] != sprite_reloc_input) goto update_slots; @@ -1346,7 +1345,7 @@ update_slots: for(; i < fp->num_slots; ++i) { unsigned generic = fp->slot_to_generic[i]; - if((1 << generic) & sprite_coord_enable) + if((generic < 32) && ((1 << generic) & sprite_coord_enable)) fp->slot_to_fp_input[i] = sprite_reloc_input; else fp->slot_to_fp_input[i] = vp->generic_to_fp_input[generic] & 0xf; -- cgit v1.2.3 From a0e510320009766faa5ff8c0ed744e87f8095df7 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 07:44:59 +0200 Subject: glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x build The Gallium EGL state tracker reuses dri2.c but not the GLX code. Currently there is a bit of code in dri2.c that is incorrectly tied to GLX: instead, make it call an helper that both GLX and Gallium EGL implement, like dri2InvalidateBuffers. This avoids a link error complaining that dri2GetGlxDrawableFromXDrawableId is undefined. Note that we might want to move the whole event translation elsewhere, and probably stop using non-XCB DRI2 altogether, but this seems to be the minimal fix. --- src/gallium/state_trackers/egl/x11/x11_screen.c | 11 +++++++++++ src/glx/dri2.c | 9 +++------ src/glx/dri2_glx.c | 10 ++++++++++ src/glx/glxclient.h | 1 + 4 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c index c07ebb7ef6c..c919b79eac8 100644 --- a/src/gallium/state_trackers/egl/x11/x11_screen.c +++ b/src/gallium/state_trackers/egl/x11/x11_screen.c @@ -432,4 +432,15 @@ dri2InvalidateBuffers(Display *dpy, XID drawable) xscr->dri_invalidate_buffers(xscr, drawable, xscr->dri_user_data); } +extern unsigned +dri2GetSwapEventType(Display *dpy, XID drawable); + +/** + * This is also called from src/glx/dri2.c. + */ +unsigned dri2GetSwapEventType(Display *dpy, XID drawable) +{ + return 0; +} + #endif /* GLX_DIRECT_RENDERING */ diff --git a/src/glx/dri2.c b/src/glx/dri2.c index 30999c899a7..adfd3d1f7c8 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -98,16 +98,13 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire; - __GLXDRIdrawable *pdraw; - struct glx_display *glx_dpy = __glXInitialize(dpy); /* Ignore swap events if we're not looking for them */ - pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable); - if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)) - return False; + aevent->type = dri2GetSwapEventType(dpy, awire->drawable); + if(!aevent->type) + return False; aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); - aevent->type = glx_dpy->codes->first_event + GLX_BufferSwapComplete; aevent->send_event = (awire->type & 0x80) != 0; aevent->display = dpy; aevent->drawable = awire->drawable; diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 911298b37c8..88bb8b81769 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -502,6 +502,16 @@ process_buffers(struct dri2_drawable * pdraw, DRI2Buffer * buffers, } +unsigned dri2GetSwapEventType(Display* dpy, XID drawable) +{ + struct glx_display *glx_dpy = __glXInitialize(dpy); + __GLXDRIdrawable *pdraw; + pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable); + if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)) + return 0; + return glx_dpy->codes->first_event + GLX_BufferSwapComplete; +} + static int64_t dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, int64_t remainder) diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index b453e6dbd04..324b5a65c19 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -150,6 +150,7 @@ extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy); extern __GLXDRIdisplay *driCreateDisplay(Display * dpy); extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy); extern void dri2InvalidateBuffers(Display *dpy, XID drawable); +extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable); /* -- cgit v1.2.3 From feb9c8c510f2deb1267b17bc10a4aff49e482630 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 09:37:23 +0200 Subject: winsys: automatically build sw winsys needed by EGL and d3d1x A cleaner solution would be preferable, but this does no harm and works. --- src/gallium/winsys/sw/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/sw/Makefile b/src/gallium/winsys/sw/Makefile index e9182ea5b1b..094e811d57d 100644 --- a/src/gallium/winsys/sw/Makefile +++ b/src/gallium/winsys/sw/Makefile @@ -4,6 +4,16 @@ include $(TOP)/configs/current SUBDIRS = null wrapper +# TODO: this should go through a further indirection level +# (i.e. EGL should set a variable that is checked here) +ifneq ($(findstring x11, $(EGL_PLATFORMS)),) +SUBDIRS += xlib +endif + +ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) +SUBDIRS += fbdev +endif + default install clean: @for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ -- cgit v1.2.3 From 6d0c39ce360609a0dc05abb63573452ab81c00e6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 11:35:05 +0200 Subject: d3d1x: don't build progs automatically progs requires winsys, which hasn't yet been built by the time we go into state_trackers. It may be a good idea to also move it into tests. After a normal build, run make in src/gallium/state_trackers/d3d1x/progs to build them. --- src/gallium/state_trackers/d3d1x/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/Makefile b/src/gallium/state_trackers/d3d1x/Makefile index 6d55376be1d..75076eed723 100644 --- a/src/gallium/state_trackers/d3d1x/Makefile +++ b/src/gallium/state_trackers/d3d1x/Makefile @@ -1,4 +1,4 @@ -SUBDIRS=d3dapi gd3dapi docs d3d1xstutil d3d1xshader gd3d1x gd3d11 gd3d10 dxgi dxgid3d11 dxgid3d10 progs +SUBDIRS=d3dapi gd3dapi docs d3d1xstutil d3d1xshader gd3d1x gd3d11 gd3d10 dxgi dxgid3d11 dxgid3d10 all: @for dir in $(SUBDIRS) ; do $(MAKE) -C "$$dir" || exit $?; done -- cgit v1.2.3 From d092c0c60ddcb56f8c5d2786ae3b61f5339b84e1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 13:21:13 +0200 Subject: d3d1x: add missing memory barrier --- .../state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 19ac53e6bd3..55cbd4a7199 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -363,8 +363,12 @@ struct dual_refcnt_t unsigned nonatomic_release() { //printf("%p nonatomic_release at %u %u\n", this, atomic_refcnt, nonatomic_refcnt); - if(!--nonatomic_refcnt && !atomic_refcnt && is_zero()) - return 0; + if(!--nonatomic_refcnt) + { + __sync_synchronize(); + if(!atomic_refcnt && is_zero()) + return 0; + } return 1; } }; -- cgit v1.2.3 From 12044e4c9907b9b3dca8960faa4f26fc4e195d83 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 13:22:00 +0200 Subject: d3d1x: link with CXXFLAGS Otherwise, -m32 doesn't make it there. --- src/gallium/state_trackers/d3d1x/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/Makefile.inc b/src/gallium/state_trackers/d3d1x/Makefile.inc index 1b9423b9d63..303915d5bf5 100644 --- a/src/gallium/state_trackers/d3d1x/Makefile.inc +++ b/src/gallium/state_trackers/d3d1x/Makefile.inc @@ -3,7 +3,7 @@ include $(TOP)/configs/current IDL=$(wildcard *.idl include/*.idl) IDL_H=$(IDL:.idl=.h) -LD=$(CXX) +LD=$(CXX) $(CXXFLAGS) include ../../../Makefile.template -- cgit v1.2.3 From 1aed6f42e9da0ca85b4d204d9dcaaa4632b34230 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 13:24:55 +0200 Subject: d3d1x: fix cf analysis --- src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp index a100ee5c3f5..a381564ada1 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp @@ -35,8 +35,8 @@ bool tpf_link_cf_insns(tpf_program& program) if(program.cf_insn_linked.size()) return true; - program.cf_insn_linked.resize(program.insns.size()); std::vector cf_insn_linked; + cf_insn_linked.resize(program.insns.size()); memset(&cf_insn_linked[0], 0xff, cf_insn_linked.size() * sizeof(int)); std::vector cf_stack; for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) -- cgit v1.2.3 From d83b7a69a0aeece9d7ba68c1b161656988009bfa Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 13:25:45 +0200 Subject: d3d1x: fix warning --- src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp index 676c939aa00..4d7c296bb62 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp @@ -441,7 +441,7 @@ struct tpf_to_tgsi_converter case TPF_OPCODE_LD_MS: { unsigned texslot = _texslot(false); - unsigned dim; + unsigned dim = 0; switch(targets[texslot].first) { case TGSI_TEXTURE_1D: -- cgit v1.2.3 From cac1565b98c7450ef5c74660e8145e300b3f8d7f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 13:54:07 +0200 Subject: d3d1x: fix segfault when hashing --- src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 55cbd4a7199..6c13a9ccb4e 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -762,7 +762,7 @@ static inline size_t raw_hash(const char* p, size_t size) const char* end = p + size; for(; p != end; ++p) { - res ^= (size_t)*p++; + res ^= (size_t)*p; if(sizeof(size_t) >= 8) res *= (size_t)1099511628211ULL; else -- cgit v1.2.3 From 256b9d99fb704d6c11d6242b7ec40206963f201e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 11 Sep 2010 13:20:27 +0100 Subject: util: Flush stdout on util_format. --- src/gallium/tests/unit/u_format_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/tests/unit/u_format_test.c b/src/gallium/tests/unit/u_format_test.c index cfde6af75e0..ba0dd17957e 100644 --- a/src/gallium/tests/unit/u_format_test.c +++ b/src/gallium/tests/unit/u_format_test.c @@ -67,6 +67,7 @@ print_packed(const struct util_format_description *format_desc, sep = " "; } printf("%s", suffix); + fflush(stdout); } @@ -88,6 +89,7 @@ print_unpacked_rgba_doubl(const struct util_format_description *format_desc, sep = ",\n"; } printf("%s", suffix); + fflush(stdout); } @@ -109,6 +111,7 @@ print_unpacked_rgba_float(const struct util_format_description *format_desc, sep = ",\n"; } printf("%s", suffix); + fflush(stdout); } @@ -129,6 +132,7 @@ print_unpacked_rgba_8unorm(const struct util_format_description *format_desc, } } printf("%s", suffix); + fflush(stdout); } @@ -150,6 +154,7 @@ print_unpacked_z_float(const struct util_format_description *format_desc, sep = ",\n"; } printf("%s", suffix); + fflush(stdout); } @@ -170,6 +175,7 @@ print_unpacked_z_32unorm(const struct util_format_description *format_desc, } } printf("%s", suffix); + fflush(stdout); } @@ -190,6 +196,7 @@ print_unpacked_s_8uscaled(const struct util_format_description *format_desc, } } printf("%s", suffix); + fflush(stdout); } @@ -635,6 +642,7 @@ test_one_func(const struct util_format_description *format_desc, printf("Testing util_format_%s_%s ...\n", format_desc->short_name, suffix); + fflush(stdout); for (i = 0; i < util_format_nr_test_cases; ++i) { const struct util_format_test_case *test = &util_format_test_cases[i]; -- cgit v1.2.3 From 162b0efff6e82cc5f332a71aa16a376a2e9ba40c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 11 Sep 2010 13:21:44 +0100 Subject: gallivm: Add unorm support to lp_build_lerp() Unfortunately this can cause segfault with LLVM 2.6, if x is a constant. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 84 +++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index dce3c3745b5..ff0c7f7ca82 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -614,17 +614,15 @@ lp_build_div(struct lp_build_context *bld, /** - * Linear interpolation. - * - * This also works for integer values with a few caveats. + * Linear interpolation -- without any checks. * * @sa http://www.stereopsis.com/doubleblend.html */ -LLVMValueRef -lp_build_lerp(struct lp_build_context *bld, - LLVMValueRef x, - LLVMValueRef v0, - LLVMValueRef v1) +static INLINE LLVMValueRef +lp_build_lerp_simple(struct lp_build_context *bld, + LLVMValueRef x, + LLVMValueRef v0, + LLVMValueRef v1) { LLVMValueRef delta; LLVMValueRef res; @@ -639,12 +637,80 @@ lp_build_lerp(struct lp_build_context *bld, res = lp_build_add(bld, v0, res); - if(bld->type.fixed) + if (bld->type.fixed) { /* XXX: This step is necessary for lerping 8bit colors stored on 16bits, * but it will be wrong for other uses. Basically we need a more * powerful lp_type, capable of further distinguishing the values * interpretation from the value storage. */ res = LLVMBuildAnd(bld->builder, res, lp_build_const_int_vec(bld->type, (1 << bld->type.width/2) - 1), ""); + } + + return res; +} + + +/** + * Linear interpolation. + */ +LLVMValueRef +lp_build_lerp(struct lp_build_context *bld, + LLVMValueRef x, + LLVMValueRef v0, + LLVMValueRef v1) +{ + const struct lp_type type = bld->type; + LLVMValueRef res; + + assert(lp_check_value(type, x)); + assert(lp_check_value(type, v0)); + assert(lp_check_value(type, v1)); + + if (type.norm) { + struct lp_type wide_type; + struct lp_build_context wide_bld; + LLVMValueRef xl, xh, v0l, v0h, v1l, v1h, resl, resh; + LLVMValueRef shift; + + assert(type.length >= 2); + assert(!type.sign); + + /* + * Create a wider type, enough to hold the intermediate result of the + * multiplication. + */ + memset(&wide_type, 0, sizeof wide_type); + wide_type.fixed = TRUE; + wide_type.width = type.width*2; + wide_type.length = type.length/2; + + lp_build_context_init(&wide_bld, bld->builder, wide_type); + + lp_build_unpack2(bld->builder, type, wide_type, x, &xl, &xh); + lp_build_unpack2(bld->builder, type, wide_type, v0, &v0l, &v0h); + lp_build_unpack2(bld->builder, type, wide_type, v1, &v1l, &v1h); + + /* + * Scale x from [0, 255] to [0, 256] + */ + + shift = lp_build_const_int_vec(wide_type, type.width - 1); + + xl = lp_build_add(&wide_bld, xl, + LLVMBuildAShr(bld->builder, xl, shift, "")); + xh = lp_build_add(&wide_bld, xh, + LLVMBuildAShr(bld->builder, xh, shift, "")); + + /* + * Lerp both halves. + */ + + resl = lp_build_lerp_simple(&wide_bld, xl, v0l, v1l); + resh = lp_build_lerp_simple(&wide_bld, xh, v0h, v1h); + + res = lp_build_pack2(bld->builder, wide_type, type, resl, resh); + } else { + res = lp_build_lerp_simple(bld, x, v0, v1); + } return res; } -- cgit v1.2.3 From 9a8e9f4595b66ea094b293da1afcded8f06ab3d6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 22 Sep 2010 14:48:28 +0100 Subject: llvmpipe: Special case complementary and identify blend factors in SoA. One multiplication instead of two. Also fix floating point random number generation and verification. TODO: Do the same for AoS blending. --- src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c | 3 -- src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c | 46 +++++++++++++++++++++++-- src/gallium/drivers/llvmpipe/lp_test_blend.c | 41 ++++++++-------------- src/gallium/drivers/llvmpipe/lp_test_main.c | 33 +++++++++++------- 4 files changed, 79 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c index b5924cbb7dc..d1c9b88f9bb 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c @@ -320,9 +320,6 @@ lp_build_blend_aos(LLVMBuilderRef builder, if(!blend->rt[rt].blend_enable) return src; - /* It makes no sense to blend unless values are normalized */ - assert(type.norm); - /* Setup build context */ memset(&bld, 0, sizeof bld); lp_build_context_init(&bld.base, builder, type); diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c index b9c7a6ceed6..30d261e979f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2009 VMware, Inc. + * Copyright 2009-2010 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -195,6 +195,13 @@ lp_build_blend_soa_factor(struct lp_build_blend_soa_context *bld, } +static boolean +lp_build_blend_factor_complementary(unsigned src_factor, unsigned dst_factor) +{ + return dst_factor == (src_factor ^ 0x10); +} + + /** * Generate blend code in SOA mode. * \param rt render target index (to index the blend / colormask state) @@ -243,8 +250,41 @@ lp_build_blend_soa(LLVMBuilderRef builder, unsigned func = i < 3 ? blend->rt[rt].rgb_func : blend->rt[rt].alpha_func; boolean func_commutative = lp_build_blend_func_commutative(func); - /* It makes no sense to blend unless values are normalized */ - assert(type.norm); + if (func == PIPE_BLEND_ADD && + lp_build_blend_factor_complementary(src_factor, dst_factor) && 0) { + /* + * Special case linear interpolation, (i.e., complementary factors). + */ + + LLVMValueRef weight; + if (src_factor < dst_factor) { + weight = lp_build_blend_soa_factor(&bld, src_factor, i); + res[i] = lp_build_lerp(&bld.base, weight, dst[i], src[i]); + } else { + weight = lp_build_blend_soa_factor(&bld, dst_factor, i); + res[i] = lp_build_lerp(&bld.base, weight, src[i], dst[i]); + } + continue; + } + + if ((func == PIPE_BLEND_ADD || + func == PIPE_BLEND_SUBTRACT || + func == PIPE_BLEND_REVERSE_SUBTRACT) && + src_factor == dst_factor && + type.floating) { + /* + * Special common factor. + * + * XXX: Only for floating points for now, since saturation will + * cause different results. + */ + + LLVMValueRef factor; + factor = lp_build_blend_soa_factor(&bld, src_factor, i); + res[i] = lp_build_blend_func(&bld.base, func, src[i], dst[i]); + res[i] = lp_build_mul(&bld.base, res[i], factor); + continue; + } /* * Compute src/dst factors. diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index d0389f0cb0b..8b6b5e1298f 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -243,19 +243,6 @@ add_blend_test(LLVMModuleRef module, } -/** Add and limit result to ceiling of 1.0 */ -#define ADD_SAT(R, A, B) \ -do { \ - R = (A) + (B); if (R > 1.0f) R = 1.0f; \ -} while (0) - -/** Subtract and limit result to floor of 0.0 */ -#define SUB_SAT(R, A, B) \ -do { \ - R = (A) - (B); if (R < 0.0f) R = 0.0f; \ -} while (0) - - static void compute_blend_ref_term(unsigned rgb_factor, unsigned alpha_factor, @@ -423,19 +410,19 @@ compute_blend_ref(const struct pipe_blend_state *blend, */ switch (blend->rt[0].rgb_func) { case PIPE_BLEND_ADD: - ADD_SAT(res[0], src_term[0], dst_term[0]); /* R */ - ADD_SAT(res[1], src_term[1], dst_term[1]); /* G */ - ADD_SAT(res[2], src_term[2], dst_term[2]); /* B */ + res[0] = src_term[0] + dst_term[0]; /* R */ + res[1] = src_term[1] + dst_term[1]; /* G */ + res[2] = src_term[2] + dst_term[2]; /* B */ break; case PIPE_BLEND_SUBTRACT: - SUB_SAT(res[0], src_term[0], dst_term[0]); /* R */ - SUB_SAT(res[1], src_term[1], dst_term[1]); /* G */ - SUB_SAT(res[2], src_term[2], dst_term[2]); /* B */ + res[0] = src_term[0] - dst_term[0]; /* R */ + res[1] = src_term[1] - dst_term[1]; /* G */ + res[2] = src_term[2] - dst_term[2]; /* B */ break; case PIPE_BLEND_REVERSE_SUBTRACT: - SUB_SAT(res[0], dst_term[0], src_term[0]); /* R */ - SUB_SAT(res[1], dst_term[1], src_term[1]); /* G */ - SUB_SAT(res[2], dst_term[2], src_term[2]); /* B */ + res[0] = dst_term[0] - src_term[0]; /* R */ + res[1] = dst_term[1] - src_term[1]; /* G */ + res[2] = dst_term[2] - src_term[2]; /* B */ break; case PIPE_BLEND_MIN: res[0] = MIN2(src_term[0], dst_term[0]); /* R */ @@ -456,13 +443,13 @@ compute_blend_ref(const struct pipe_blend_state *blend, */ switch (blend->rt[0].alpha_func) { case PIPE_BLEND_ADD: - ADD_SAT(res[3], src_term[3], dst_term[3]); /* A */ + res[3] = src_term[3] + dst_term[3]; /* A */ break; case PIPE_BLEND_SUBTRACT: - SUB_SAT(res[3], src_term[3], dst_term[3]); /* A */ + res[3] = src_term[3] - dst_term[3]; /* A */ break; case PIPE_BLEND_REVERSE_SUBTRACT: - SUB_SAT(res[3], dst_term[3], src_term[3]); /* A */ + res[3] = dst_term[3] - src_term[3]; /* A */ break; case PIPE_BLEND_MIN: res[3] = MIN2(src_term[3], dst_term[3]); /* A */ @@ -676,6 +663,8 @@ test_one(unsigned verbose, fprintf(stderr, " Ref%c: ", channel); dump_vec(stderr, type, ref + j*stride); fprintf(stderr, "\n"); + + fprintf(stderr, "\n"); } } } @@ -773,7 +762,7 @@ blend_funcs[] = { const struct lp_type blend_types[] = { /* float, fixed, sign, norm, width, len */ - { TRUE, FALSE, FALSE, TRUE, 32, 4 }, /* f32 x 4 */ + { TRUE, FALSE, TRUE, FALSE, 32, 4 }, /* f32 x 4 */ { FALSE, FALSE, FALSE, TRUE, 8, 16 }, /* u8n x 16 */ }; diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index 7bbbc61d4c2..7a0d06ae2c8 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -205,16 +205,19 @@ random_elem(struct lp_type type, void *dst, unsigned index) assert(index < type.length); value = (double)rand()/(double)RAND_MAX; if(!type.norm) { - unsigned long long mask; - if (type.floating) - mask = ~(unsigned long long)0; - else if (type.fixed) - mask = ((unsigned long long)1 << (type.width / 2)) - 1; - else if (type.sign) - mask = ((unsigned long long)1 << (type.width - 1)) - 1; - else - mask = ((unsigned long long)1 << type.width) - 1; - value += (double)(mask & rand()); + if (type.floating) { + value *= 2.0; + } + else { + unsigned long long mask; + if (type.fixed) + mask = ((unsigned long long)1 << (type.width / 2)) - 1; + else if (type.sign) + mask = ((unsigned long long)1 << (type.width - 1)) - 1; + else + mask = ((unsigned long long)1 << type.width) - 1; + value += (double)(mask & rand()); + } } if(!type.sign) if(rand() & 1) @@ -261,12 +264,18 @@ boolean compare_vec_with_eps(struct lp_type type, const void *res, const void *ref, double eps) { unsigned i; + eps *= type.floating ? 8.0 : 2.0; for (i = 0; i < type.length; ++i) { double res_elem = read_elem(type, res, i); double ref_elem = read_elem(type, ref, i); - double delta = fabs(res_elem - ref_elem); - if(delta >= 2.0*eps) + double delta = res_elem - ref_elem; + if (ref_elem < -1.0 || ref_elem > 1.0) { + delta /= ref_elem; + } + delta = fabs(delta); + if (delta >= eps) { return FALSE; + } } return TRUE; -- cgit v1.2.3 From 87267c71f67d02fcdd59a899fd0eea6d64e523b5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 22 Sep 2010 15:02:10 +0100 Subject: llvmpipe: Make rgb/alpha bland func/factors match, when there is no alpha. Makes AoS blending easier, and state more canonical. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 4277c47eeb6..f0a15e11b9b 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -1049,7 +1049,7 @@ llvmpipe_set_constant_buffer(struct pipe_context *pipe, * Return the blend factor equivalent to a destination alpha of one. */ static INLINE unsigned -force_dst_alpha_one(unsigned factor, boolean alpha) +force_dst_alpha_one(unsigned factor) { switch(factor) { case PIPE_BLENDFACTOR_DST_ALPHA: @@ -1060,15 +1060,6 @@ force_dst_alpha_one(unsigned factor, boolean alpha) return PIPE_BLENDFACTOR_ZERO; } - if (alpha) { - switch(factor) { - case PIPE_BLENDFACTOR_DST_COLOR: - return PIPE_BLENDFACTOR_ONE; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - return PIPE_BLENDFACTOR_ZERO; - } - } - return factor; } @@ -1145,12 +1136,15 @@ make_variant_key(struct llvmpipe_context *lp, * * TODO: This should be generalized to all channels for better * performance, but only alpha causes correctness issues. + * + * Also, force rgb/alpha func/factors match, to make AoS blending easier. */ if (format_desc->swizzle[3] > UTIL_FORMAT_SWIZZLE_W) { - blend_rt->rgb_src_factor = force_dst_alpha_one(blend_rt->rgb_src_factor, FALSE); - blend_rt->rgb_dst_factor = force_dst_alpha_one(blend_rt->rgb_dst_factor, FALSE); - blend_rt->alpha_src_factor = force_dst_alpha_one(blend_rt->alpha_src_factor, TRUE); - blend_rt->alpha_dst_factor = force_dst_alpha_one(blend_rt->alpha_dst_factor, TRUE); + blend_rt->rgb_src_factor = force_dst_alpha_one(blend_rt->rgb_src_factor); + blend_rt->rgb_dst_factor = force_dst_alpha_one(blend_rt->rgb_dst_factor); + blend_rt->alpha_func = blend_rt->rgb_func; + blend_rt->alpha_src_factor = blend_rt->rgb_src_factor; + blend_rt->alpha_dst_factor = blend_rt->rgb_dst_factor; } } -- cgit v1.2.3 From 1abe48afbe5ba894f6c160e830c04288bb2913b4 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 22 Sep 2010 10:32:44 -0400 Subject: r600g: flush color buffer after draw command Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600_state2.c | 37 ++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index d02a5a3895d..32c7171b518 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -887,8 +887,24 @@ static inline void r600_context_group_emit_dirty(struct r600_context *ctx, struc } } +static struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset) +{ + struct r600_group_block *block; + unsigned id; + + id = ctx->groups[group_id].offset_block_id[(offset - ctx->groups[group_id].start_offset) >> 2]; + block = &ctx->groups[group_id].blocks[id]; + offset -= block->start_offset; + id = block->pm4_bo_index[offset >> 2]; + if (block->reloc[id].bo) { + return radeon_bo_pb_get_bo(block->reloc[id].bo->pb); + } + return NULL; +} + void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) { + struct radeon_bo *cb[8]; unsigned ndwords = 9; if (draw->indices) { @@ -907,12 +923,14 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) R600_ERR("context is too big to be scheduled\n"); return; } + /* enough room to copy packet */ r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONFIG], PKT3_SET_CONFIG_REG); r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONTEXT], PKT3_SET_CONTEXT_REG); r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_ALU_CONST], PKT3_SET_ALU_CONST); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_SAMPLER], PKT3_SET_SAMPLER); r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_RESOURCE], PKT3_SET_RESOURCE); + r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_SAMPLER], PKT3_SET_SAMPLER); + /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type; @@ -934,6 +952,23 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + + /* flush color buffer */ + for (int i = 0; i < 8; i++) { + cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2)); + if (cb[i]) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + S_0085F0_CB_ACTION_ENA(1); + ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); + } + } + /* all dirty state have been scheduled in current cs */ ctx->pm4_dirty_cdwords = 0; } -- cgit v1.2.3 From b91dba49e0b08b18dbd6c477facdcc7b5472c8c7 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 22 Sep 2010 11:01:11 -0400 Subject: intel: Fix GL_ARB_shading_language_120 commit Fix commit e7087175f8a04f777403366fb34b58edd00f4d60. Move the reference to GL_VERSION_2_1_functions to intel_extensions.c where it's available, don't try to enable a non-existing extension and advertise 1.20 for all intel chipsets, not just GEN4 and up. --- src/mesa/drivers/dri/i965/brw_context.c | 11 ----------- src/mesa/drivers/dri/intel/intel_extensions.c | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 49be289750b..4b44e2adec0 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -41,13 +41,6 @@ #include "intel_span.h" #include "tnl/t_pipeline.h" - -static const struct dri_extension gl_21_extension[] = { - {"GL_VERSION_2_1", GL_VERSION_2_1_functions }, -}; - - - /*************************************** * Mesa's Driver Functions ***************************************/ @@ -94,8 +87,6 @@ GLboolean brwCreateContext( int api, TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; - ctx->Const.GLSLVersion = 120; - ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS; ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */ @@ -160,8 +151,6 @@ GLboolean brwCreateContext( int api, MIN2(ctx->Const.FragmentProgram.MaxNativeParameters, ctx->Const.FragmentProgram.MaxEnvParams); - driInitExtensions(ctx, gl_21_extension, GL_TRUE); - if (intel->is_g4x || intel->gen >= 5) { brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45; brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index a066b5b5597..4b6229ffe6f 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -212,6 +212,9 @@ intelInitExtensions(GLcontext *ctx) */ driInitExtensions(ctx, card_extensions, GL_FALSE); + _mesa_map_function_array(GL_VERSION_2_1_functions); + ctx->Const.GLSLVersion = 120; + if (intel->gen >= 5) driInitExtensions(ctx, ironlake_extensions, GL_FALSE); -- cgit v1.2.3 From 516ac2bd50ad1e71bd2a359d247532d9f18bcf99 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Sep 2010 11:20:48 -0600 Subject: llvmpipe: fix sprite texcoord setup for non-projective texturing Normally the Mesa state tracker uses TXP instructions for texturing. But if a fragment shader uses texture2D() that's a TEX instruction. In that case we were incorrectly computing the texcoord coefficients in the point sprite setup code. Some new comments in the code explain things. --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 85 ++++++++++++++++++--------- 1 file changed, 58 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 774a3c80dad..2c354d1d0ed 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -65,47 +65,77 @@ constant_coef(struct lp_setup_context *setup, } +/** + * Setup automatic texcoord coefficients (for sprite rendering). + * \param slot the vertex attribute slot to setup + * \param i the attribute channel in [0,3] + * \param sprite_coord_origin one of PIPE_SPRITE_COORD_x + * \param perspective_proj will the TEX instruction do a divide by Q? + */ static void -perspective_coef(struct lp_setup_context *setup, - struct lp_rast_triangle *point, - const struct point_info *info, - unsigned slot, - unsigned vert_attr, - unsigned i, - unsigned sprite_coord_origin) +texcoord_coef(struct lp_setup_context *setup, + struct lp_rast_triangle *point, + const struct point_info *info, + unsigned slot, + unsigned i, + unsigned sprite_coord_origin, + boolean perspective_proj) { + assert(i < 4); + if (i == 0) { float dadx = FIXED_ONE / (float)info->dx12; float dady = 0.0f; - point->inputs.dadx[slot][i] = dadx; - point->inputs.dady[slot][i] = dady; - point->inputs.a0[slot][i] = (0.5 - - (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + - dady * ((float)info->v0[0][1] - setup->pixel_offset))); + float x0 = info->v0[0][0] - setup->pixel_offset; + float y0 = info->v0[0][1] - setup->pixel_offset; + + point->inputs.dadx[slot][0] = dadx; + point->inputs.dady[slot][0] = dady; + point->inputs.a0[slot][0] = 0.5 - (dadx * x0 + dady * y0); + + if (!perspective_proj) { + /* Divide coefficients by vertex.w here. + * + * It would be clearer to always multiply by w0 above and + * then divide it out for perspective projection here, but + * doing it this way involves less algebra. + */ + float w0 = info->v0[0][3]; + point->inputs.dadx[slot][0] *= w0; + point->inputs.dady[slot][0] *= w0; + point->inputs.a0[slot][0] *= w0; + } } else if (i == 1) { float dadx = 0.0f; float dady = FIXED_ONE / (float)info->dx12; + float x0 = info->v0[0][0] - setup->pixel_offset; + float y0 = info->v0[0][1] - setup->pixel_offset; if (sprite_coord_origin == PIPE_SPRITE_COORD_LOWER_LEFT) { dady = -dady; } - point->inputs.dadx[slot][i] = dadx; - point->inputs.dady[slot][i] = dady; - point->inputs.a0[slot][i] = (0.5 - - (dadx * ((float)info->v0[0][0] - setup->pixel_offset) + - dady * ((float)info->v0[0][1] - setup->pixel_offset))); + point->inputs.dadx[slot][1] = dadx; + point->inputs.dady[slot][1] = dady; + point->inputs.a0[slot][1] = 0.5 - (dadx * x0 + dady * y0); + + if (!perspective_proj) { + float w0 = info->v0[0][3]; + point->inputs.dadx[slot][1] *= w0; + point->inputs.dady[slot][1] *= w0; + point->inputs.a0[slot][1] *= w0; + } } else if (i == 2) { - point->inputs.a0[slot][i] = 0.0f; - point->inputs.dadx[slot][i] = 0.0f; - point->inputs.dady[slot][i] = 0.0f; + point->inputs.a0[slot][2] = 0.0f; + point->inputs.dadx[slot][2] = 0.0f; + point->inputs.dady[slot][2] = 0.0f; } - else if (i == 3) { - point->inputs.a0[slot][i] = 1.0f; - point->inputs.dadx[slot][i] = 0.0f; - point->inputs.dady[slot][i] = 0.0f; + else { + point->inputs.a0[slot][3] = 1.0f; + point->inputs.dadx[slot][3] = 0.0f; + point->inputs.dady[slot][3] = 0.0f; } } @@ -184,7 +214,7 @@ setup_point_coefficients( struct lp_setup_context *setup, case LP_INTERP_PERSPECTIVE: /* check if the sprite coord flag is set for this attribute. - * If so, set it up so it up so x any y vary from 0 to 1. + * If so, set it up so it up so x and y vary from 0 to 1. */ if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { const int index = shader->info.input_semantic_index[slot]; @@ -195,8 +225,9 @@ setup_point_coefficients( struct lp_setup_context *setup, (setup->sprite_coord_enable & (1 << index))) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - perspective_coef(setup, point, info, slot+1, vert_attr, i, - setup->sprite_coord_origin); + texcoord_coef(setup, point, info, slot + 1, i, + setup->sprite_coord_origin, + (usage_mask & TGSI_WRITEMASK_W)); fragcoord_usage_mask |= TGSI_WRITEMASK_W; break; } -- cgit v1.2.3 From b8835a3992edb7b01712ea83b5729ef0f6f94e4f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 22 Sep 2010 14:00:53 -0400 Subject: r600g: disable shader rebuild optimization & account cb flush packet Shader rebuild should be more clever, we should store along each shader all the value that change shader program rather than using flags in context (ie change sequence like : change vs buffer, draw, change vs buffer, switch shader will trigger useless shader rebuild). Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_state2.c | 25 ++++--------------------- src/gallium/winsys/r600/drm/r600_state2.c | 10 +++++++++- 2 files changed, 13 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index b93bdd3022b..4ad9e4c6eb1 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -137,8 +137,6 @@ struct r600_pipe_context { struct r600_pipe_shader *ps_shader; struct r600_pipe_shader *vs_shader; /* shader information */ - bool ps_rebuild; - bool vs_rebuild; unsigned sprite_coord_enable; bool flatshade; }; @@ -198,7 +196,6 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028894_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); - rctx->vs_rebuild = FALSE; } static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) @@ -268,7 +265,6 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0x00000000, 0xFFFFFFFF, NULL); - rctx->ps_rebuild = FALSE; } static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) @@ -350,20 +346,6 @@ static int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_s if (shader == NULL) return -EINVAL; - if (shader->bo) { - switch (shader->shader.processor_type) { - case TGSI_PROCESSOR_VERTEX: - if (!rctx->vs_rebuild) - return 0; - break; - case TGSI_PROCESSOR_FRAGMENT: - if (!rctx->ps_rebuild) - return 0; - break; - default: - return -EINVAL; - } - } /* there should be enough input */ if (rctx->vertex_elements->count < shader->shader.bc.nresource) { R600_ERR("%d resources provided, expecting %d\n", @@ -644,6 +626,7 @@ static void r600_draw_common(struct r600_drawl *draw) if (draw->index_buffer) { rbuffer = (struct r600_resource*)draw->index_buffer; rdraw.indices = rbuffer->bo; + rdraw.indices_bo_offset = 0; } r600_context_draw(&rctx->ctx, &rdraw); } @@ -1075,10 +1058,10 @@ static void r600_bind_rs_state(struct pipe_context *ctx, void *state) return; if (rctx->flatshade != rs->flatshade) { - rctx->ps_rebuild = TRUE; +// rctx->ps_rebuild = TRUE; } if (rctx->sprite_coord_enable != rs->sprite_coord_enable) { - rctx->ps_rebuild = TRUE; +// rctx->ps_rebuild = TRUE; } rctx->flatshade = rs->flatshade; rctx->sprite_coord_enable = rs->sprite_coord_enable; @@ -1364,7 +1347,7 @@ static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) rctx->vertex_elements = v; if (v) { v->refcount++; - rctx->vs_rebuild = TRUE; +// rctx->vs_rebuild = TRUE; } } diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 32c7171b518..cde4ec37f9a 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -914,6 +914,15 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) r600_context_flush(ctx); } } + + /* find number of color buffer */ + for (int i = 0; i < 8; i++) { + cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2)); + if (cb[i]) { + ndwords += 7; + } + } + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { /* need to flush */ r600_context_flush(ctx); @@ -955,7 +964,6 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) /* flush color buffer */ for (int i = 0; i < 8; i++) { - cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2)); if (cb[i]) { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | -- cgit v1.2.3 From f060ae9ab6492446dbaf4d55665822c11a72d509 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 22 Sep 2010 14:59:09 -0400 Subject: r600g: fix multiple occlusion query on same id When calling query begin using same query id we need to discard previous query results. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_context.c | 4 ++-- src/gallium/drivers/r600/r600_state2.c | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 7a63d966eb5..18ff7936899 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -69,7 +69,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, { struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; -#if 0 +#if 1 static int dc = 0; char dname[256]; #endif @@ -84,7 +84,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, #if 0 sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 2) { + if (dc < 20) { radeon_ctx_dump_bof(rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 4ad9e4c6eb1..5182b26fcfa 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -556,6 +556,7 @@ static void r600_draw_common(struct r600_drawl *draw) struct r600_draw rdraw; struct r600_pipe_state vgt; + switch (draw->index_size) { case 2: vgt_draw_initiator = 0; @@ -660,7 +661,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; -#if 1 +#if 0 static int dc = 0; char dname[256]; #endif @@ -2089,7 +2090,10 @@ static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *quer static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_query *rquery = (struct r600_query *)query; + rquery->result = 0; + rquery->num_results = 0; r600_query_begin(&rctx->ctx, (struct r600_query *)query); } @@ -2105,7 +2109,11 @@ static boolean r600_get_query_result(struct pipe_context *ctx, boolean wait, void *vresult) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_query *rquery = (struct r600_query *)query; + if (rquery->num_results) { + ctx->flush(ctx, 0, NULL); + } return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); } -- cgit v1.2.3 From 9ec0b2a45e18c045fd3dbcdf846fad7faf97494c Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 22 Sep 2010 15:07:15 -0400 Subject: dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext We can't expect to have a context when this is called, and we don't need one so just require a __DRIscreen instead. Reported by Yu Dai --- include/GL/internal/dri_interface.h | 2 +- src/egl/drivers/dri2/egl_dri2.c | 6 ++---- src/gallium/state_trackers/dri/drm/dri2.c | 4 ++-- src/mesa/drivers/dri/intel/intel_screen.c | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index ff83ff145e7..5351a2ba4ab 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -805,7 +805,7 @@ typedef struct __DRIimageExtensionRec __DRIimageExtension; struct __DRIimageExtensionRec { __DRIextension base; - __DRIimage *(*createImageFromName)(__DRIcontext *context, + __DRIimage *(*createImageFromName)(__DRIscreen *screen, int width, int height, int format, int name, int pitch, void *loaderPrivate); diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 856029091a2..083f796f430 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1509,7 +1509,6 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, EGLClientBuffer buffer, const EGLint *attr_list) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); struct dri2_egl_image *dri2_img; unsigned int attachments[1]; xcb_drawable_t drawable; @@ -1577,7 +1576,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, stride = buffers[0].pitch / buffers[0].cpp; dri2_img->dri_image = - dri2_dpy->image->createImageFromName(dri2_ctx->dri_context, + dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, buffers_reply->width, buffers_reply->height, format, @@ -1628,7 +1627,6 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, EGLClientBuffer buffer, const EGLint *attr_list) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); struct dri2_egl_image *dri2_img; EGLint width, height, format, name, stride, pitch, i, err; @@ -1697,7 +1695,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, } dri2_img->dri_image = - dri2_dpy->image->createImageFromName(dri2_ctx->dri_context, + dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, width, height, format, diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 596309bfbd9..135f66c61da 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -305,11 +305,11 @@ dri2_lookup_egl_image(struct dri_context *ctx, void *handle) } static __DRIimage * -dri2_create_image_from_name(__DRIcontext *context, +dri2_create_image_from_name(__DRIscreen *_screen, int width, int height, int format, int name, int pitch, void *loaderPrivate) { - struct dri_screen *screen = dri_screen(context->driScreenPriv); + struct dri_screen *screen = dri_screen(_screen); __DRIimage *img; struct pipe_resource templ; struct winsys_handle whandle; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 0a542a7303d..6d66a25ca1f 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -123,12 +123,12 @@ static const struct __DRI2flushExtensionRec intelFlushExtension = { }; static __DRIimage * -intel_create_image_from_name(__DRIcontext *context, +intel_create_image_from_name(__DRIscreen *screen, int width, int height, int format, int name, int pitch, void *loaderPrivate) { + struct intel_screen *intelScreen = screen->private; __DRIimage *image; - struct intel_context *intel = context->driverPrivate; int cpp; image = CALLOC(sizeof *image); @@ -159,7 +159,7 @@ intel_create_image_from_name(__DRIcontext *context, image->data = loaderPrivate; cpp = _mesa_get_format_bytes(image->format); - image->region = intel_region_alloc_for_handle(intel->intelScreen, + image->region = intel_region_alloc_for_handle(intelScreen, cpp, width, height, pitch, name, "image"); if (image->region == NULL) { -- cgit v1.2.3 From 6ce098631abf465e89b12d10c4e6713b9c843422 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 16:29:36 +0200 Subject: d3d1x: destroy native_display on adapter destruction --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index c9db7b66644..24a812ff4ce 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -239,6 +239,7 @@ struct GalliumDXGIAdapter ~GalliumDXGIAdapter() { + display->destroy(display); free(configs); free(connectors); } -- cgit v1.2.3 From 4f8e38dab88378b0b5f822893dae5b791e53fb46 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 19:04:36 +0200 Subject: d3d1x: fix GUID declarations --- .../state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 6c13a9ccb4e..83cf0f2c3e4 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -42,22 +42,23 @@ namespace std #include #define WIN32_LEAN_AND_MEAN -#include +#define INITGUID #include -#include +// just replicate GUIDs in every object file to avoid the hassle of having to pull in a library for them #ifdef __GNUC__ #define ATTRIBUTE_UNUSED __attribute__((unused)) #else #define ATTRIBUTE_UNUSED #endif - -// just replicate GUIDs in every object file to avoid the hassle of having to pull in a library for them #undef DEFINE_GUID #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ static const GUID name ATTRIBUTE_UNUSED = \ { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#include +#include + #include "galliumdxgi.h" #include -- cgit v1.2.3 From e7624e23a3a374896863f54fe30dafd0bff8a91a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 13:51:53 +0200 Subject: d3d1x: redesign the HWND resolver interface This one should be powerful enough to hook up Wine. --- .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 295 ++++++++++++++------- .../state_trackers/d3d1x/gd3d11/d3d11_misc.h | 7 +- .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl | 49 +++- .../d3d1x/progs/d3d10app/d3d10x11main.cpp | 2 +- .../d3d1x/progs/d3d11app/d3d11x11main.cpp | 2 +- 5 files changed, 250 insertions(+), 105 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 24a812ff4ce..3cbe056e7b6 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -63,22 +63,53 @@ struct GalliumDXGIObject : public GalliumPrivateDataComObject } }; -static void* STDMETHODCALLTYPE identity_resolver(void* cookie, HWND hwnd) +COM_INTERFACE(IGalliumDXGIBackend, IUnknown) + +struct GalliumDXGIIdentityBackend : public GalliumComObject { - return (void*)hwnd; -} + virtual void * STDMETHODCALLTYPE BeginPresent( + HWND hwnd, + void** window, + RECT *rect, + RGNDATA **rgndata, + BOOL* preserve_aspect_ratio + ) + { + *window = (void*)hwnd; + rect->left = 0; + rect->top = 0; + rect->right = INT_MAX; + rect->bottom = INT_MAX; + *rgndata = 0; + + // yes, because we like things looking good + *preserve_aspect_ratio = TRUE; + return 0; + } + + virtual void STDMETHODCALLTYPE EndPresent( + HWND hwnd, + void* present_cookie + ) + {} +}; struct GalliumDXGIFactory : public GalliumDXGIObject { HWND associated_window; const struct native_platform* platform; void* display; - PFNHWNDRESOLVER resolver; + ComPtr backend; void* resolver_cookie; - GalliumDXGIFactory(const struct native_platform* platform, void* display, PFNHWNDRESOLVER resolver, void* resolver_cookie) - : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display), resolver(resolver ? resolver : (PFNHWNDRESOLVER)identity_resolver), resolver_cookie(resolver_cookie) - {} + GalliumDXGIFactory(const struct native_platform* platform, void* display, IGalliumDXGIBackend* p_backend) + : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display) + { + if(p_backend) + backend = p_backend; + else + backend.reset(new GalliumDXGIIdentityBackend()); + } virtual HRESULT STDMETHODCALLTYPE EnumAdapters( UINT Adapter, @@ -678,6 +709,7 @@ struct dxgi_blitter rasterizer = pipe->create_rasterizer_state(pipe, &rs_state); struct pipe_blend_state blendd; + memset(&blendd, 0, sizeof(blendd)); blendd.rt[0].colormask = PIPE_MASK_RGBA; blend = pipe->create_blend_state(pipe, &blendd); @@ -793,9 +825,12 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject adapter; ComPtr target; + DXGI_SWAP_CHAIN_DESC desc; + struct native_surface* surface; const struct native_config* config; + void* window; struct pipe_resource* resources[NUM_NATIVE_ATTACHMENTS]; int width; int height; @@ -808,8 +843,6 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject(factory), desc(p_desc) + : GalliumDXGIObject(factory), desc(p_desc), surface(0) { HRESULT hr; @@ -835,13 +868,40 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectresolver(factory->resolver_cookie, desc.OutputWindow); + memset(resources, 0, sizeof(resources)); + + if(desc.SwapEffect == DXGI_SWAP_EFFECT_SEQUENTIAL && desc.BufferCount != 1) + { + std::cerr << "Gallium DXGI: if DXGI_SWAP_EFFECT_SEQUENTIAL is specified, only BufferCount == 1 is implemented, but " << desc.BufferCount << " was specified: ignoring this" << std::endl; + // change the returned desc, so that the application might perhaps notice what we did and react well + desc.BufferCount = 1; + } + + pipe = gallium_device->GetGalliumContext(); + owns_pipe = false; + if(!pipe) + { + pipe = adapter->display->screen->context_create(adapter->display->screen, 0); + owns_pipe = true; + } + + blitter.reset(new dxgi_blitter(pipe)); + window = 0; + } + + void init_for_window() + { + if(surface) + { + surface->destroy(surface); + surface = 0; + } unsigned config_num; - if(!strcmp(factory->platform->name, "X11")) + if(!strcmp(parent->platform->name, "X11")) { XWindowAttributes xwa; - XGetWindowAttributes((Display*)factory->display, (Window)win, &xwa); + XGetWindowAttributes((Display*)parent->display, (Window)window, &xwa); config_num = adapter->configs_by_native_visual_id[xwa.visual->visualid]; } else @@ -859,7 +919,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectconfigs[config_num]; - surface = adapter->display->create_window_surface(adapter->display, (EGLNativeWindowType)win, config); + surface = adapter->display->create_window_surface(adapter->display, (EGLNativeWindowType)window, config); surface->user_data = this; width = 0; @@ -869,23 +929,6 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectGetGalliumContext(); - owns_pipe = false; - if(!pipe) - { - pipe = adapter->display->screen->context_create(adapter->display->screen, 0); - owns_pipe = true; - } - - blitter.reset(new dxgi_blitter(pipe)); - formats_compatible = util_is_format_compatible( util_format_description(dxgi_to_pipe_format[desc.BufferDesc.Format]), util_format_description(config->color_format)); @@ -951,7 +994,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectvalidate(surface, 1 << NATIVE_ATTACHMENT_BACK_LEFT, &new_seq_num, resources, &width, &height)) + if(!surface->validate(surface, (1 << NATIVE_ATTACHMENT_BACK_LEFT) | (1 << NATIVE_ATTACHMENT_FRONT_LEFT), &new_seq_num, resources, &width, &height)) return false; if(!ever_validated || seq_num != new_seq_num) @@ -976,16 +1019,36 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectbackend->BeginPresent(desc.OutputWindow, &cur_window, &rect, &rgndata, &preserve_aspect_ratio); + if(!cur_window || rect.left >= rect.right || rect.top >= rect.bottom) + goto end_present; + + if(cur_window != window) + { + window = cur_window; + init_for_window(); + } + if(needs_validation) { if(!validate()) return DXGI_ERROR_DEVICE_REMOVED; } - bool db = !!(config->buffer_mask & NATIVE_ATTACHMENT_BACK_LEFT); - struct pipe_resource* dst = resources[db ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT]; - struct pipe_resource* src = gallium_buffer0; - struct pipe_surface* dst_surface = 0; + db = !!(config->buffer_mask & NATIVE_ATTACHMENT_BACK_LEFT); + dst = resources[db ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT]; + src = gallium_buffer0; + dst_surface = 0; /* TODO: sharing the context for blitting won't work correctly if queries are active * Hopefully no one is crazy enough to keep queries active while presenting, expecting @@ -993,58 +1056,85 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject dst->width0) + rect.right = dst->width0; + if((unsigned)rect.bottom > dst->height0) + rect.bottom = dst->height0; + if(rect.left > rect.right) + rect.left = rect.right; + if(rect.top > rect.bottom) + rect.top = rect.bottom; - if(!formats_compatible || src->width0 != dst->width0 || dst->width0 != src->width0) - dst_surface = pipe->screen->get_tex_surface(pipe->screen, dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET); + if(rect.left >= rect.right && rect.top >= rect.bottom) + goto end_present; - int delta = src->width0 * dst->height0 - dst->width0 * src->height0; - if(delta > 0) - { - blit_w = dst->width0; - blit_h = dst->width0 * src->height0 / src->width0; - } - else if(delta < 0) - { - blit_w = dst->height0 * src->width0 / src->height0; - blit_h = dst->height0; - } - else + dst_w = rect.right - rect.left; + dst_h = rect.bottom - rect.top; + + // TODO: add support for rgndata +// if(preserve_aspect_ratio || !rgndata) + if(1) { - blit_w = dst->width0; - blit_h = dst->height0; - } + unsigned blit_x, blit_y, blit_w, blit_h; + float black[4] = {0, 0, 0, 0}; + + if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h) + dst_surface = pipe->screen->get_tex_surface(pipe->screen, dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET); + + if(preserve_aspect_ratio) + { + int delta = src->width0 * dst_h - dst_w * src->height0; + if(delta > 0) + { + blit_w = dst_w; + blit_h = dst_w * src->height0 / src->width0; + } + else if(delta < 0) + { + blit_w = dst_h * src->width0 / src->height0; + blit_h = dst_h; + } + else + { + blit_w = dst_w; + blit_h = dst_h; + } - blit_x = (dst->width0 - blit_w) >> 1; - blit_y = (dst->height0 - blit_h) >> 1; + blit_x = (dst_w - blit_w) >> 1; + blit_y = (dst_h - blit_h) >> 1; + } + else + { + blit_x = 0; + blit_y = 0; + blit_w = dst_w; + blit_h = dst_h; + } - if(blit_x) - pipe->clear_render_target(pipe, dst_surface, black, 0, 0, blit_x, dst->height0); - if(blit_y) - pipe->clear_render_target(pipe, dst_surface, black, 0, 0, dst->width0, blit_y); + if(blit_x) + pipe->clear_render_target(pipe, dst_surface, black, rect.left, rect.top, blit_x, dst_h); + if(blit_y) + pipe->clear_render_target(pipe, dst_surface, black, rect.left, rect.top, dst_w, blit_y); - if(formats_compatible && blit_w == src->width0 && blit_h == src->height0) - { - pipe_subresource sr; - sr.face = 0; - sr.level = 0; - pipe->resource_copy_region(pipe, dst, sr, 0, 0, 0, src, sr, 0, 0, 0, blit_w, blit_h); - } - else - { - blitter->blit(dst_surface, gallium_buffer0_view, blit_x, blit_y, blit_w, blit_h); - if(!owns_pipe) - gallium_device->RestoreGalliumState(); - } + if(formats_compatible && blit_w == src->width0 && blit_h == src->height0) + { + pipe_subresource sr; + sr.face = 0; + sr.level = 0; + pipe->resource_copy_region(pipe, dst, sr, rect.left, rect.top, 0, src, sr, 0, 0, 0, blit_w, blit_h); + } + else + { + blitter->blit(dst_surface, gallium_buffer0_view, rect.left + blit_x, rect.top + blit_y, blit_w, blit_h); + if(!owns_pipe) + gallium_device->RestoreGalliumState(); + } - if(blit_w != dst->width0) - pipe->clear_render_target(pipe, dst_surface, black, blit_x + blit_w, 0, dst->width0 - blit_x - blit_w, dst->height0); - if(blit_h != dst->height0) - pipe->clear_render_target(pipe, dst_surface, black, 0, blit_y + blit_h, dst->width0, dst->height0 - blit_y - blit_h); + if(blit_w != dst_w) + pipe->clear_render_target(pipe, dst_surface, black, rect.left + blit_x + blit_w, rect.top, dst_w - blit_x - blit_w, dst_h); + if(blit_h != dst_h) + pipe->clear_render_target(pipe, dst_surface, black, rect.left, rect.top + blit_y + blit_h, dst_w, dst_h - blit_y - blit_h); + } if(dst_surface) pipe->screen->tex_surface_destroy(dst_surface); @@ -1060,6 +1150,9 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectbackend->EndPresent(desc.OutputWindow, present_cookie); + ++present_count; return S_OK; } @@ -1225,8 +1318,7 @@ struct dxgi_binding { const struct native_platform* platform; void* display; - PFNHWNDRESOLVER resolver; - void* resolver_cookie; + IGalliumDXGIBackend* backend; }; static dxgi_binding dxgi_default_binding; @@ -1236,50 +1328,57 @@ void STDMETHODCALLTYPE GalliumDXGIUseNothing() { dxgi_thread_binding.platform = 0; dxgi_thread_binding.display = 0; - dxgi_thread_binding.resolver = 0; - dxgi_thread_binding.resolver_cookie = 0; + if(dxgi_thread_binding.backend) + dxgi_thread_binding.backend->Release(); + dxgi_thread_binding.backend = 0; } #ifdef GALLIUM_DXGI_USE_X11 -void STDMETHODCALLTYPE GalliumDXGIUseX11Display(Display* dpy, PFNHWNDRESOLVER resolver, void* resolver_cookie) +void STDMETHODCALLTYPE GalliumDXGIUseX11Display(Display* dpy, IGalliumDXGIBackend* backend) { + GalliumDXGIUseNothing(); dxgi_thread_binding.platform = native_get_x11_platform(); dxgi_thread_binding.display = dpy; - dxgi_thread_binding.resolver = resolver; - dxgi_thread_binding.resolver_cookie = resolver_cookie; + + if(backend) + { + dxgi_thread_binding.backend = backend; + backend->AddRef(); + } } #endif +/* #ifdef GALLIUM_DXGI_USE_DRM void STDMETHODCALLTYPE GalliumDXGIUseDRMCard(int fd) { + GalliumDXGIUseNothing(); dxgi_thread_binding.platform = native_get_drm_platform(); dxgi_thread_binding.display = (void*)fd; - dxgi_thread_binding.resolver = 0; - dxgi_thread_binding.resolver_cookie = 0; + dxgi_thread_binding.backend = 0; } #endif #ifdef GALLIUM_DXGI_USE_FBDEV void STDMETHODCALLTYPE GalliumDXGIUseFBDev(int fd) { + GalliumDXGIUseNothing(); dxgi_thread_binding.platform = native_get_fbdev_platform(); dxgi_thread_binding.display = (void*)fd; - dxgi_thread_binding.resolver = 0; - dxgi_thread_binding.resolver_cookie = 0; + dxgi_thread_binding.backend = 0; } #endif #ifdef GALLIUM_DXGI_USE_GDI void STDMETHODCALLTYPE GalliumDXGIUseHDC(HDC hdc, PFNHWNDRESOLVER resolver, void* resolver_cookie) { + GalliumDXGIUseNothing(); dxgi_thread_binding.platform = native_get_gdi_platform(); dxgi_thread_binding.display = (void*)hdc; - dxgi_thread_binding.resolver = resolver; - dxgi_thread_binding.resolver_cookie = resolver_cookie; + dxgi_thread_binding.backend = 0; } #endif - +*/ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() { dxgi_default_binding = dxgi_thread_binding; @@ -1296,11 +1395,11 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() GalliumDXGIFactory* factory; *ppFactory = 0; if(dxgi_thread_binding.platform) - factory = new GalliumDXGIFactory(dxgi_thread_binding.platform, dxgi_thread_binding.display, dxgi_thread_binding.resolver, dxgi_thread_binding.resolver_cookie); + factory = new GalliumDXGIFactory(dxgi_thread_binding.platform, dxgi_thread_binding.display, dxgi_thread_binding.backend); else if(dxgi_default_binding.platform) - factory = new GalliumDXGIFactory(dxgi_default_binding.platform, dxgi_default_binding.display, dxgi_default_binding.resolver, dxgi_default_binding.resolver_cookie); + factory = new GalliumDXGIFactory(dxgi_default_binding.platform, dxgi_default_binding.display, dxgi_default_binding.backend); else - factory = new GalliumDXGIFactory(native_get_x11_platform(), NULL, NULL, NULL); + factory = new GalliumDXGIFactory(native_get_x11_platform(), NULL, NULL); HRESULT hres = factory->QueryInterface(riid, ppFactory); factory->Release(); return hres; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index 39e41f19e5f..0d515e3f472 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -1,5 +1,10 @@ #if API < 11 -HRESULT D3D10CreateBlob( +extern "C" HRESULT STDMETHODCALLTYPE D3D10CreateBlob( + __in SIZE_T NumBytes, + __out LPD3D10BLOB *ppBuffer +); + +HRESULT STDMETHODCALLTYPE D3D10CreateBlob( __in SIZE_T NumBytes, __out LPD3D10BLOB *ppBuffer ) diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl index 9fbe5d01a7f..e6f51472096 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl @@ -62,16 +62,57 @@ import "../d3dapi/dxgi.idl"; * - GDI: HWND */ -typedef struct _XDisplay Display; -typedef void* (*PFNHWNDRESOLVER)(void*, HWND); +[object, local, uuid("c22d2f85-f7dd-40b0-a50b-5d308f973c5e")] +interface IGalliumDXGIBackend : IUnknown +{ + /* Returns a cookie that is passed to EndPresent + * + * *window and *rect are the window and subrectangle + * to present in. + * + * For X11, *window is a Window. + * For other systems, it will be the equivalent way to reference a window. + * + * The rectangle is clipped against the window size, so you can + * specify (0, 0, INT_MAX, INT_MAX) to use the whole window. + * + * rgndata is set to either NULL, or the region, in coordinates relative + * to the subrectangle, to clip presentation to. + * *rgndata is valid until EndPresent is called, at which point EndPresent + * may free the data. + * + * If window is set 0, the window is fully obscured, so don't present + * anything, and tell the app of the obscuration. + * + * If preserve_aspect_ratio is set, *rgndata will be ignored. This + * limitation may be lifted in future versions. + * + * EndPresent is still called even if you return 0 in window. + */ + void* BeginPresent( + [in] HWND hwnd, + [out] void** window, + [out] RECT* rect, + [out] struct _RGNDATA** rgndata, + [out] BOOL* preserve_aspect_ratio + ); + + void EndPresent( + [in] HWND hwnd, + [out] void* present_cookie + ); +} void GalliumDXGIUseNothing(); /* only a subset of these may be available, depending on platform and compilation options */ -void GalliumDXGIUseX11Display(Display* dpy, PFNHWNDRESOLVER resolver, void* resolver_cookie); +void GalliumDXGIUseX11Display(struct _XDisplay* dpy, IGalliumDXGIBackend* backend); + +/* these don't really work for now void GalliumDXGIUseDRMCard(int fd); void GalliumDXGIUseFBDev(int fd); -void GalliumDXGIUseHDC(HDC hdc, PFNHWNDRESOLVER resolver, void* resolver_cookie); +void GalliumDXGIUseHDC(HDC hdc, IGalliumDXGIGDIBackend* backend); +*/ void GalliumDXGIMakeDefault(); diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp index 4ce3dcf1c56..ddba68518af 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp @@ -67,7 +67,7 @@ int main(int argc, char** argv) Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap| CWEventMask, &swa); XMapWindow(dpy, win); - GalliumDXGIUseX11Display(dpy, 0, 0); + GalliumDXGIUseX11Display(dpy, 0); DXGI_SWAP_CHAIN_DESC swap_chain_desc; memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp index 9dcb32537e7..7e1edeb6355 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp @@ -41,7 +41,7 @@ int main(int argc, char** argv) Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap| CWEventMask, &swa); XMapWindow(dpy, win); - GalliumDXGIUseX11Display(dpy, 0, 0); + GalliumDXGIUseX11Display(dpy, 0); DXGI_SWAP_CHAIN_DESC swap_chain_desc; memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); -- cgit v1.2.3 From 3d4a15dfab04dbdce3ee2c7b182b076ed5eb757a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 19:31:34 +0200 Subject: d3d1x: fix API name --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index 0d515e3f472..f31b54ba8f3 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -72,7 +72,7 @@ HRESULT D3D10GetOutputSignatureBlob( return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); } -HRESULT D3D10GetInputOutputSignatureBlob( +HRESULT D3D10GetInputAndOutputSignatureBlob( __in const void *pShaderBytecode, __in SIZE_T BytecodeLength, __out ID3D10Blob **ppSignatureBlob -- cgit v1.2.3 From ab5e9a726d50b414718a248fd8625f1c6f269a49 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 19:31:54 +0200 Subject: d3d1x: define GUIDs in the normal way --- .../state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 14 -------------- .../state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp | 1 - .../state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp | 1 - 3 files changed, 16 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 83cf0f2c3e4..7627720148d 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -42,20 +42,6 @@ namespace std #include #define WIN32_LEAN_AND_MEAN -#define INITGUID -#include - -// just replicate GUIDs in every object file to avoid the hassle of having to pull in a library for them -#ifdef __GNUC__ -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#else -#define ATTRIBUTE_UNUSED -#endif -#undef DEFINE_GUID -#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - static const GUID name ATTRIBUTE_UNUSED = \ - { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } - #include #include diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp index ddba68518af..0fcef0d7b69 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp @@ -24,7 +24,6 @@ * **************************************************************************/ -#define INITGUID #include "d3d10app.h" #include #include diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp index 7e1edeb6355..7055da941b7 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp @@ -1,4 +1,3 @@ -#define INITGUID #include "d3d11app.h" #include #include -- cgit v1.2.3 From 38da5c9cb636387539daaf5688c2a3badee32447 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 22 Sep 2010 19:33:54 +0200 Subject: d3d1x: add Wine dlls (tri, tex working, but no other testing) --- src/gallium/state_trackers/d3d1x/winedlls/Makefile | 11 ++ .../state_trackers/d3d1x/winedlls/Makefile.wine | 23 +++ .../state_trackers/d3d1x/winedlls/d3d10/Makefile | 6 + .../state_trackers/d3d1x/winedlls/d3d10/d3d10.spec | 33 ++++ .../state_trackers/d3d1x/winedlls/d3d10/version.rc | 3 + .../state_trackers/d3d1x/winedlls/d3d10_1/Makefile | 6 + .../d3d1x/winedlls/d3d10_1/d3d10_1.spec | 29 +++ .../d3d1x/winedlls/d3d10_1/version.rc | 3 + .../state_trackers/d3d1x/winedlls/d3d11/Makefile | 6 + .../state_trackers/d3d1x/winedlls/d3d11/d3d11.spec | 6 + .../state_trackers/d3d1x/winedlls/d3d11/version.rc | 3 + .../state_trackers/d3d1x/winedlls/dxgi/Makefile | 6 + .../state_trackers/d3d1x/winedlls/dxgi/dxgi.spec | 4 + .../state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c | 214 +++++++++++++++++++++ .../state_trackers/d3d1x/winedlls/dxgi/version.rc | 3 + .../state_trackers/d3d1x/winedlls/version.rc.h | 30 +++ 16 files changed, 386 insertions(+) create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d10/version.rc create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/d3d10_1.spec create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/version.rc create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d11/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d11/d3d11.spec create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/d3d11/version.rc create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/dxgi/Makefile create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi.spec create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/dxgi/version.rc create mode 100644 src/gallium/state_trackers/d3d1x/winedlls/version.rc.h (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/winedlls/Makefile b/src/gallium/state_trackers/d3d1x/winedlls/Makefile new file mode 100644 index 00000000000..c7e51b2fdda --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/Makefile @@ -0,0 +1,11 @@ +SUBDIRS=dxgi d3d10 d3d10_1 d3d11 + +all: + @for dir in $(SUBDIRS) ; do $(MAKE) -C "$$dir" || exit $?; done + +clean: + rm -f `find . -name \*.[oa]` + rm -f `find . -name depend` + +install: + sudo install */*.dll.so /usr/lib/wine diff --git a/src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine b/src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine new file mode 100644 index 00000000000..c9a06876c44 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine @@ -0,0 +1,23 @@ +TOP=../../../../../.. +D3D1X=../.. +include $(TOP)/configs/current +CFLAGS=$(CXXFLAGS) + +all: lib$(LIBNAME).def lib$(LIBNAME).cross.a $(LIBNAME).dll.so + +%.dll.fake: %.spec $(OBJECTS) version.res + wineg++ -m32 -fasynchronous-unwind-tables -shared $^ -o $@ $(LDADD) + +%.dll.so: %.spec $(OBJECTS) version.res + wineg++ -m32 -fasynchronous-unwind-tables -shared $^ -o $@ $(LDADD) + +lib%.def: %.spec + winebuild -w --def -o $@ --export $< + +lib%.cross.a: %.spec + winebuild -m32 -b i586-mingw32msvc -w --implib -o $@ --export $< + +version.res: version.rc + wrc --nostdinc -I. -I. -I../../include -I../../include -D__WINESRC__ -fo$@ $^ + +include ../../../../Makefile.template diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile new file mode 100644 index 00000000000..0ea5ffea0dd --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile @@ -0,0 +1,6 @@ +LIBNAME=d3d10 +LIBRARY_INCLUDES=-I$(D3D1X)/gd3dapi -I$(D3D1X)/d3dapi -I$(D3D1X)/w32api +OBJECTS=../../dxgid3d10/libdxgid3d10.a ../../gd3d10/libgd3d10.a ../../gd3d1x/libgd3d1x.a ../../d3d1xshader/libd3d1xshader.a ../../d3d1xstutil/libd3d1xstutil.a ../../../../auxiliary/libgallium.a +LDADD=-L../dxgi -ldxgi -ldl + +include ../Makefile.wine diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec new file mode 100644 index 00000000000..4a68ab58db2 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec @@ -0,0 +1,33 @@ +@ stub D3D10CompileEffectFromMemory +@ stub D3D10CompileShader +@ stdcall D3D10CreateBlob(long ptr) +@ stdcall D3D10CreateDevice(ptr long ptr long long ptr) +@ stdcall D3D10CreateDeviceAndSwapChain(ptr long ptr long long ptr ptr ptr) +@ stub D3D10CreateEffectFromMemory +@ stub D3D10CreateEffectPoolFromMemory +@ stub D3D10CreateStateBlock +@ stub D3D10DisassembleEffect +@ stub D3D10DisassembleShader +@ stdcall D3D10GetGeometryShaderProfile(ptr) +@ stdcall D3D10GetInputAndOutputSignatureBlob(ptr long ptr) +@ stdcall D3D10GetInputSignatureBlob(ptr long ptr) +@ stdcall D3D10GetOutputSignatureBlob(ptr long ptr) +@ stdcall D3D10GetPixelShaderProfile(ptr) +@ stub D3D10GetShaderDebugInfo +@ stub D3D10GetVersion +@ stdcall D3D10GetVertexShaderProfile(ptr) +@ stub D3D10PreprocessShader +@ stub D3D10ReflectShader +@ stub D3D10RegisterLayers +@ stub D3D10StateBlockMaskDifference +@ stub D3D10StateBlockMaskDisableAll +@ stub D3D10StateBlockMaskDisableCapture +@ stub D3D10StateBlockMaskEnableAll +@ stub D3D10StateBlockMaskEnableCapture +@ stub D3D10StateBlockMaskGetSetting +@ stub D3D10StateBlockMaskIntersect +@ stub D3D10StateBlockMaskUnion + +@ stdcall D3D10CreateDevice1(ptr long ptr long long long ptr) +@ stdcall D3D10CreateDeviceAndSwapChain1(ptr long ptr long long long ptr ptr ptr) + diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10/version.rc b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/version.rc new file mode 100644 index 00000000000..0575ab8b576 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/version.rc @@ -0,0 +1,3 @@ +#define FILENAME "d3d10" +#define NAME "D3D10" +#include "../version.rc.h" diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/Makefile b/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/Makefile new file mode 100644 index 00000000000..60cdca1af9c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/Makefile @@ -0,0 +1,6 @@ +LIBNAME=d3d10_1 +LIBRARY_INCLUDES= +OBJECTS= +LDADD=-L../d3d10 -ld3d10 + +include ../Makefile.wine diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/d3d10_1.spec b/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/d3d10_1.spec new file mode 100644 index 00000000000..993e4bbe014 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/d3d10_1.spec @@ -0,0 +1,29 @@ +@ stub D3D10CompileShader +@ stdcall D3D10CreateBlob(long ptr) d3d10.D3D10CreateBlob +@ stdcall D3D10CreateDevice1(ptr long ptr long long long ptr) d3d10.D3D10CreateDevice1 +@ stdcall D3D10CreateDeviceAndSwapChain1(ptr long ptr long long long ptr ptr ptr) d3d10.D3D10CreateDeviceAndSwapChain1 +@ stub D3D10CreateEffectFromMemory +@ stub D3D10CreateEffectPoolFromMemory +@ stub D3D10CreateStateBlock +@ stub D3D10DisassembleEffect +@ stub D3D10DisassembleShader +@ stdcall D3D10GetGeometryShaderProfile(ptr) d3d10.D3D10GetGeometryShaderProfile +@ stdcall D3D10GetInputAndOutputSignatureBlob(ptr long ptr) d3d10.D3D10GetInputAndOutputSignatureBlob +@ stdcall D3D10GetInputSignatureBlob(ptr long ptr) d3d10.D3D10GetInputSignatureBlob +@ stdcall D3D10GetOutputSignatureBlob(ptr long ptr) d3d10.D3D10GetOutputSignatureBlob +@ stdcall D3D10GetPixelShaderProfile(ptr) d3d10.D3D10GetPixelShaderProfile +@ stub D3D10GetShaderDebugInfo +@ stub D3D10GetVersion +@ stdcall D3D10GetVertexShaderProfile(ptr) d3d10.D3D10GetVertexShaderProfile +@ stub D3D10PreprocessShader +@ stub D3D10ReflectShader +@ stub D3D10RegisterLayers +@ stub D3D10StateBlockMaskDifference +@ stub D3D10StateBlockMaskDisableAll +@ stub D3D10StateBlockMaskDisableCapture +@ stub D3D10StateBlockMaskEnableAll +@ stub D3D10StateBlockMaskEnableCapture +@ stub D3D10StateBlockMaskGetSetting +@ stub D3D10StateBlockMaskIntersect +@ stub D3D10StateBlockMaskUnion + diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/version.rc b/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/version.rc new file mode 100644 index 00000000000..0575ab8b576 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10_1/version.rc @@ -0,0 +1,3 @@ +#define FILENAME "d3d10" +#define NAME "D3D10" +#include "../version.rc.h" diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d11/Makefile b/src/gallium/state_trackers/d3d1x/winedlls/d3d11/Makefile new file mode 100644 index 00000000000..b8d992e2437 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d11/Makefile @@ -0,0 +1,6 @@ +LIBNAME=d3d11 +LIBRARY_INCLUDES=-I$(D3D1X)/gd3dapi -I$(D3D1X)/d3dapi -I$(D3D1X)/w32api +OBJECTS=../../dxgid3d11/libdxgid3d11.a ../../gd3d11/libgd3d11.a ../../gd3d1x/libgd3d1x.a ../../d3d1xshader/libd3d1xshader.a ../../d3d1xstutil/libd3d1xstutil.a ../../../../auxiliary/libgallium.a +LDADD=-L../dxgi -ldxgi -ldl + +include ../Makefile.wine diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d11/d3d11.spec b/src/gallium/state_trackers/d3d1x/winedlls/d3d11/d3d11.spec new file mode 100644 index 00000000000..1d2e0c5b930 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d11/d3d11.spec @@ -0,0 +1,6 @@ +@ stub D3D11CoreCreateDevice +@ stub D3D11CoreCreateLayeredDevice +@ stub D3D11CoreGetLayeredDeviceSize +@ stub D3D11CoreRegisterLayers +@ stdcall D3D11CreateDevice(ptr long ptr long ptr long long ptr ptr ptr) +@ stdcall D3D11CreateDeviceAndSwapChain(ptr long ptr long ptr long long ptr ptr ptr ptr ptr) diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d11/version.rc b/src/gallium/state_trackers/d3d1x/winedlls/d3d11/version.rc new file mode 100644 index 00000000000..a398678333f --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d11/version.rc @@ -0,0 +1,3 @@ +#define FILENAME "d3d11" +#define NAME "D3D11" +#include "../version.rc.h" diff --git a/src/gallium/state_trackers/d3d1x/winedlls/dxgi/Makefile b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/Makefile new file mode 100644 index 00000000000..650bdc84d59 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/Makefile @@ -0,0 +1,6 @@ +LIBNAME=dxgi +LIBRARY_INCLUDES=-I$(D3D1X)/gd3dapi -I$(D3D1X)/d3dapi -I$(D3D1X)/w32api +OBJECTS=dxgi_dll.o ../../dxgi/libdxgi.a ../../d3d1xstutil/libd3d1xstutil.a ../../../egl/libegl.a ../../../../auxiliary/libgallium.a ../../../../winsys/sw/xlib/libws_xlib.a +LDADD=-lgdi32 -lEGL -lXfixes -lX11 -ldrm -ldl -lXext + +include ../Makefile.wine diff --git a/src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi.spec b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi.spec new file mode 100644 index 00000000000..65a91a45837 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi.spec @@ -0,0 +1,4 @@ +@ stdcall CreateDXGIFactory(ptr ptr) +@ stdcall CreateDXGIFactory1(ptr ptr) +@ stub DXGID3D10CreateDevice +@ stub DXGID3D10RegisterLayers diff --git a/src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c new file mode 100644 index 00000000000..5a900046df2 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c @@ -0,0 +1,214 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include +#include +#include +#include + +#define DLL_WINE_PREATTACH 8 + +#define X11DRV_ESCAPE 6789 +#define X11DRV_GET_DISPLAY 0 +#define X11DRV_GET_DRAWABLE 1 + +/* Wine works in this way: wineserver stores the all window positions + * in (somewhat fictitious) "screen coordinates", and does not itself + * interact with X11. + * + * Instead, it is the responsibliity of the owner of the X window to + * handle ConfigureNotify and inform wineserver that the window + * moved. + * + * This means that we can freely look at window positions non-atomically, + * since they won't get updated until we return and the application + * processes the Win32 message queue. + * + * Of course, if this thread doesn't own the window, we are screwed. + * + * It might be a good idea to integrate this code in winex11.drv. + */ + +struct WineDXGIBackend +{ + const IGalliumDXGIBackendVtbl *vtbl_IGalliumDXGIBackend; + LONG ref; +}; + +static void* STDMETHODCALLTYPE WineDXGIBackend_BeginPresent( + IGalliumDXGIBackend* This, + HWND hwnd, + void** pwindow, + RECT* prect, + RGNDATA** prgndata, + BOOL* ppreserve_aspect_ratio) +{ + /* this is the parent HWND which actually has an X11 window associated */ + HWND x11_hwnd = GetAncestor(hwnd, GA_ROOT); + HDC hdc; + RECT client_rect; + POINT x11_hwnd_origin_from_screen; + Drawable drawable; + POINT hwnd_origin_from_screen; + HRGN hrgn; + unsigned code = X11DRV_GET_DRAWABLE; + unsigned rgndata_size; + RGNDATA* rgndata; + + hdc = GetDC(x11_hwnd); + ExtEscape(hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, sizeof(drawable), (LPTSTR)&drawable); + + GetDCOrgEx(hdc, &x11_hwnd_origin_from_screen); + ReleaseDC(x11_hwnd, hdc); + + hdc = GetDC(hwnd); + GetDCOrgEx(hdc, &hwnd_origin_from_screen); + hrgn = CreateRectRgn(0, 0, 0, 0); + GetRandomRgn(hdc, hrgn, SYSRGN); + + /* the coordinate system differs depending on whether Wine is + * pretending to be Win9x or WinNT, so match that behavior. + */ + if (!(GetVersion() & 0x80000000)) + OffsetRgn(hrgn, -hwnd_origin_from_screen.x, -hwnd_origin_from_screen.y); + ReleaseDC(hwnd, hdc); + + *pwindow = (void*)drawable; + GetClientRect(hwnd, &client_rect); + + prect->left = hwnd_origin_from_screen.x - x11_hwnd_origin_from_screen.x; + prect->top = hwnd_origin_from_screen.y - x11_hwnd_origin_from_screen.y; + + prect->right = prect->left + client_rect.right; + prect->bottom = prect->top + client_rect.bottom; + + rgndata_size = GetRegionData(hrgn, 0, NULL); + rgndata = HeapAlloc(GetProcessHeap(), 0, rgndata_size); + GetRegionData(hrgn, rgndata_size, rgndata); + *prgndata = rgndata; + + // Windows doesn't preserve the aspect ratio + // TODO: maybe let the user turn this on somehow + *ppreserve_aspect_ratio = FALSE; + + DeleteObject(hrgn); + + return rgndata; +} + +static void STDMETHODCALLTYPE WineDXGIBackend_EndPresent( + IGalliumDXGIBackend* This, + HWND hwnd, + void *present_cookie) +{ + HeapFree(GetProcessHeap(), 0, present_cookie); +} + +/* Wine should switch to C++ at least to be able to implement COM interfaces in a sensible way, + * instead of this ridiculous amount of clumsy duplicated code everywhere + * C++ exists exactly to avoid having to write the following code */ +static ULONG STDMETHODCALLTYPE WineDXGIBackend_AddRef(IGalliumDXGIBackend* This) +{ + return InterlockedIncrement(&((struct WineDXGIBackend*)&This)->ref); +} + +static ULONG STDMETHODCALLTYPE WineDXGIBackend_Release(IGalliumDXGIBackend* This) +{ + ULONG v = InterlockedDecrement(&((struct WineDXGIBackend*)&This)->ref); + if(!v) + HeapFree(GetProcessHeap(), 0, This); + return v; +} + +static HRESULT WINAPI WineDXGIBackend_QueryInterface( + IGalliumDXGIBackend* iface, + REFIID riid, + void** ppvObject) +{ + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IGalliumDXGIBackend)) + { + WineDXGIBackend_AddRef(iface); + *ppvObject = iface; + return S_OK; + } + + return E_NOINTERFACE; +} + +static IGalliumDXGIBackendVtbl WineDXGIBackend_vtbl = +{ + WineDXGIBackend_QueryInterface, + WineDXGIBackend_AddRef, + WineDXGIBackend_Release, + WineDXGIBackend_BeginPresent, + WineDXGIBackend_EndPresent +}; + +IGalliumDXGIBackend* new_WineDXGIBackend() +{ + struct WineDXGIBackend* backend = HeapAlloc(GetProcessHeap(), 0, sizeof(struct WineDXGIBackend)); + backend->ref = 1; + backend->vtbl_IGalliumDXGIBackend = &WineDXGIBackend_vtbl; + return (IGalliumDXGIBackend*)backend; +} + +static void install_wine_dxgi_backend() +{ + IGalliumDXGIBackend* backend = new_WineDXGIBackend(); + HWND root = GetDesktopWindow(); + unsigned code = X11DRV_GET_DISPLAY; + Display* dpy; + HDC hdc; + + hdc = GetDC(root); + ExtEscape(hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, sizeof(dpy), (LPTSTR)&dpy); + ReleaseDC(root, hdc); + + GalliumDXGIUseX11Display(dpy, backend); + GalliumDXGIMakeDefault(); + GalliumDXGIUseNothing(); + backend->lpVtbl->Release(backend); +} + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return TRUE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + install_wine_dxgi_backend(); + break; + case DLL_PROCESS_DETACH: + break; + default: + break; + } + + return TRUE; +} diff --git a/src/gallium/state_trackers/d3d1x/winedlls/dxgi/version.rc b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/version.rc new file mode 100644 index 00000000000..3653281fbcc --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/dxgi/version.rc @@ -0,0 +1,3 @@ +#define FILENAME "dxgi" +#define NAME "DXGI" +#include "../version.rc.h" diff --git a/src/gallium/state_trackers/d3d1x/winedlls/version.rc.h b/src/gallium/state_trackers/d3d1x/winedlls/version.rc.h new file mode 100644 index 00000000000..096d119fa3c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/winedlls/version.rc.h @@ -0,0 +1,30 @@ +1 VERSIONINFO +FILEVERSION 6,0,6000,16386 +PRODUCTVERSION 6,0,6000,16386 +FILEFLAGSMASK 63 +FILEFLAGS 0 +FILEOS 0x00000000L +FILETYPE 0x00000002L +FILESUBTYPE 0x00000000L +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + // all Wine DLLs claim to be from Microsoft, maybe it's needed for compatibility + VALUE "CompanyName", "Microsoft Corporation" + VALUE "FileDescription", "GalliumD3D1x " NAME " runtime" + VALUE "FileVersion", "6.0.6000.16386" + VALUE "InternalName", "" + VALUE "LegalCopyright", "Copyright (c) 2010 Luca Barbieri and other contributors" + VALUE "OriginalFilename", FILENAME ".dll" + VALUE "ProductName", "GalliumD3D1x" + VALUE "ProductVersion", "6.0.6000.16386" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0409, 0x04E4 + } +} + -- cgit v1.2.3 From b39e6f33b60ef9bbaf81f320aaca6a440d8a6a8f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 11:47:03 -0700 Subject: glsl: Rework assignments with write_masks to have LHS chan count match RHS. It turns out that most people new to this IR are surprised when an assignment to (say) 3 components on the LHS takes 4 components on the RHS. It also makes for quite strange IR output: (assign (constant bool (1)) (x) (var_ref color) (swiz x (var_ref v) )) (assign (constant bool (1)) (y) (var_ref color) (swiz yy (var_ref v) )) (assign (constant bool (1)) (z) (var_ref color) (swiz zzz (var_ref v) )) But even worse, even we get it wrong, as shown by this line of our current step(float, vec4): (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge)))) where we try to assign a float to the writemasked-out x channel and don't supply anything for the actual w channel we're writing. Drivers right now just get lucky since ir_to_mesa spams the float value across all the source channels of a vec4. Instead, the RHS will now have a number of components equal to the number of components actually being written. Hopefully this confuses everyone less, and it also makes codegen for a scalar target simpler. Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/glsl/ast_function.cpp | 43 +++++++++++---------- src/glsl/builtin_function.cpp | 74 ++++++++++++++++++------------------ src/glsl/builtins/ir/noise2 | 16 ++++---- src/glsl/builtins/ir/noise3 | 24 ++++++------ src/glsl/builtins/ir/noise4 | 34 ++++++++--------- src/glsl/ir.cpp | 29 +++++++++++++- src/glsl/ir.h | 8 ++++ src/glsl/ir_constant_propagation.cpp | 16 ++++++-- src/glsl/ir_mat_op_to_vec.cpp | 5 +-- src/glsl/ir_validate.cpp | 16 ++++---- src/mesa/program/ir_to_mesa.cpp | 28 +++++++++++++- 11 files changed, 181 insertions(+), 112 deletions(-) (limited to 'src') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 5d9d35b2d9b..20448f5a975 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -504,8 +504,9 @@ emit_inline_vector_constructor(const glsl_type *type, instructions->push_tail(inst); } else { unsigned base_component = 0; + unsigned base_lhs_component = 0; ir_constant_data data; - unsigned constant_mask = 0; + unsigned constant_mask = 0, constant_components = 0; memset(&data, 0, sizeof(data)); @@ -515,8 +516,8 @@ emit_inline_vector_constructor(const glsl_type *type, /* Do not try to assign more components to the vector than it has! */ - if ((rhs_components + base_component) > lhs_components) { - rhs_components = lhs_components - base_component; + if ((rhs_components + base_lhs_component) > lhs_components) { + rhs_components = lhs_components - base_lhs_component; } const ir_constant *const c = param->as_constant(); @@ -543,18 +544,23 @@ emit_inline_vector_constructor(const glsl_type *type, /* Mask of fields to be written in the assignment. */ - constant_mask |= ((1U << rhs_components) - 1) << base_component; - } + constant_mask |= ((1U << rhs_components) - 1) << base_lhs_component; + constant_components++; - /* Advance the component index by the number of components that were - * just assigned. + base_component += rhs_components; + } + /* Advance the component index by the number of components + * that were just assigned. */ - base_component += rhs_components; + base_lhs_component += rhs_components; } if (constant_mask != 0) { ir_dereference *lhs = new(ctx) ir_dereference_variable(var); - ir_rvalue *rhs = new(ctx) ir_constant(var->type, &data); + const glsl_type *rhs_type = glsl_type::get_instance(var->type->base_type, + constant_components, + 1); + ir_rvalue *rhs = new(ctx) ir_constant(rhs_type, &data); ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask); @@ -574,12 +580,10 @@ emit_inline_vector_constructor(const glsl_type *type, const ir_constant *const c = param->as_constant(); if (c == NULL) { - /* Generate a swizzle that puts the first element of the source at - * the location of the first element of the destination. - */ + /* Generate a swizzle in case rhs_components != rhs->type->vector_elements. */ unsigned swiz[4] = { 0, 0, 0, 0 }; for (unsigned i = 0; i < rhs_components; i++) - swiz[i + base_component] = i; + swiz[i] = i; /* Mask of fields to be written in the assignment. */ @@ -587,7 +591,7 @@ emit_inline_vector_constructor(const glsl_type *type, << base_component; ir_dereference *lhs = new(ctx) ir_dereference_variable(var); - ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, lhs_components); + ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, rhs_components); ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, write_mask); @@ -632,10 +636,10 @@ assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base, */ unsigned swiz[4] = { src_base, src_base, src_base, src_base }; for (unsigned i = 0; i < count; i++) - swiz[i + row_base] = src_base + i; + swiz[i + row_base] = i; ir_rvalue *const rhs = - new(mem_ctx) ir_swizzle(src, swiz, column_ref->type->components()); + new(mem_ctx) ir_swizzle(src, swiz, count); /* Mask of fields to be written in the assignment. */ @@ -816,7 +820,7 @@ emit_inline_matrix_constructor(const glsl_type *type, var->type->matrix_columns); unsigned swiz[4] = { 0, 0, 0, 0 }; - for (unsigned i = 1; i < src_matrix->type->vector_elements; i++) + for (unsigned i = 1; i < last_row; i++) swiz[i] = i; const unsigned write_mask = (1U << last_row) - 1; @@ -837,14 +841,11 @@ emit_inline_matrix_constructor(const glsl_type *type, */ ir_rvalue *rhs; if (lhs->type->vector_elements != rhs_col->type->vector_elements) { - rhs = new(ctx) ir_swizzle(rhs_col, swiz, - lhs->type->vector_elements); + rhs = new(ctx) ir_swizzle(rhs_col, swiz, last_row); } else { rhs = rhs_col; } - assert(lhs->type == rhs->type); - ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, write_mask); instructions->push_tail(inst); diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index c904f4629f2..5f9bbec2f01 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1889,8 +1889,8 @@ static const char *builtin_noise2 = "\n" " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" " (return (var_ref t))\n" " ))\n" "\n" @@ -1903,8 +1903,8 @@ static const char *builtin_noise2 = "\n" " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" " (return (var_ref t))\n" " ))\n" "\n" @@ -1919,8 +1919,8 @@ static const char *builtin_noise2 = "\n" " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" " (return (var_ref t))\n" " ))\n" "\n" @@ -1935,8 +1935,8 @@ static const char *builtin_noise2 = "\n" " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" " (return (var_ref t))\n" " ))\n" "))\n" @@ -1956,9 +1956,9 @@ static const char *builtin_noise3 = " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n" - " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" " (return (var_ref t))\n" " ))\n" "\n" @@ -1974,9 +1974,9 @@ static const char *builtin_noise3 = " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n" " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n" - " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" " (return (var_ref t))\n" " ))\n" "\n" @@ -1992,9 +1992,9 @@ static const char *builtin_noise3 = " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n" " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n" - " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" " (return (var_ref t))\n" " ))\n" "\n" @@ -2010,9 +2010,9 @@ static const char *builtin_noise3 = " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n" " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n" - " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n" - " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" " (return (var_ref t))\n" " ))\n" "))\n" @@ -2037,10 +2037,10 @@ static const char *builtin_noise4 = " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n" - " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n" - " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n" - " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" " (return (var_ref _r))\n" " ))\n" "\n" @@ -2061,10 +2061,10 @@ static const char *builtin_noise4 = " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n" - " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n" - " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n" - " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" " (return (var_ref _r))\n" " ))\n" "\n" @@ -2085,10 +2085,10 @@ static const char *builtin_noise4 = " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n" - " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n" - " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n" - " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" " (return (var_ref _r))\n" " ))\n" "\n" @@ -2102,17 +2102,17 @@ static const char *builtin_noise4 = " (declare () vec4 _r)\n" "\n" " (declare () float _p)\n" - " (assign (constant bool (1)) (xy) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n" + " (assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n" "\n" " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n" " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))\n" " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))\n" "\n" - " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n" - " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n" - " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n" - " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" " (return (var_ref _r))\n" " ))\n" "))\n" diff --git a/src/glsl/builtins/ir/noise2 b/src/glsl/builtins/ir/noise2 index 008f8b00f1f..383fccfadfb 100644 --- a/src/glsl/builtins/ir/noise2 +++ b/src/glsl/builtins/ir/noise2 @@ -8,8 +8,8 @@ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p))) (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) (return (var_ref t)) )) @@ -22,8 +22,8 @@ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p))) (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) (return (var_ref t)) )) @@ -38,8 +38,8 @@ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p))) (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) (return (var_ref t)) )) @@ -54,8 +54,8 @@ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p))) (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) (return (var_ref t)) )) )) diff --git a/src/glsl/builtins/ir/noise3 b/src/glsl/builtins/ir/noise3 index f191e145f99..ed7ad5190f2 100644 --- a/src/glsl/builtins/ir/noise3 +++ b/src/glsl/builtins/ir/noise3 @@ -11,9 +11,9 @@ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0))))) (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b))) - (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) + (assign (constant bool (1)) (z) (var_ref t) (var_ref c)) (return (var_ref t)) )) @@ -29,9 +29,9 @@ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0))))) (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b))) - (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) + (assign (constant bool (1)) (z) (var_ref t) (var_ref c)) (return (var_ref t)) )) @@ -47,9 +47,9 @@ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0))))) (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b))) - (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) + (assign (constant bool (1)) (z) (var_ref t) (var_ref c)) (return (var_ref t)) )) @@ -65,9 +65,9 @@ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0))))) (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0))))) - (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a))) - (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b))) - (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c))) + (assign (constant bool (1)) (x) (var_ref t) (var_ref a)) + (assign (constant bool (1)) (y) (var_ref t) (var_ref b)) + (assign (constant bool (1)) (z) (var_ref t) (var_ref c)) (return (var_ref t)) )) )) diff --git a/src/glsl/builtins/ir/noise4 b/src/glsl/builtins/ir/noise4 index fb300fd1486..77a2529a180 100644 --- a/src/glsl/builtins/ir/noise4 +++ b/src/glsl/builtins/ir/noise4 @@ -16,10 +16,10 @@ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p))) (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0))))) - (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x))) - (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y))) - (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z))) - (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w))) + (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x)) + (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y)) + (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z)) + (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w)) (return (var_ref _r)) )) @@ -40,10 +40,10 @@ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p))) (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0))))) - (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x))) - (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y))) - (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z))) - (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w))) + (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x)) + (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y)) + (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z)) + (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w)) (return (var_ref _r)) )) @@ -64,10 +64,10 @@ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p))) (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0))))) - (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x))) - (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y))) - (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z))) - (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w))) + (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x)) + (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y)) + (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z)) + (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w)) (return (var_ref _r)) )) @@ -81,17 +81,17 @@ (declare () vec4 _r) (declare () float _p) - (assign (constant bool (1)) (xy) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) ) + (assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) ) (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p))) (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0))))) (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p))) (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0))))) - (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x))) - (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y))) - (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z))) - (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w))) + (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x)) + (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y)) + (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z)) + (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w)) (return (var_ref _r)) )) )) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 7cc55d40b78..5e2109ecc6e 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -55,6 +55,9 @@ update_rhs_swizzle(ir_swizzle_mask &m, unsigned from, unsigned to) void ir_assignment::set_lhs(ir_rvalue *lhs) { + void *mem_ctx = this; + bool swizzled = false; + while (lhs != NULL) { ir_swizzle *swiz = lhs->as_swizzle(); @@ -82,7 +85,21 @@ ir_assignment::set_lhs(ir_rvalue *lhs) this->write_mask = write_mask; lhs = swiz->val; - this->rhs = new(this) ir_swizzle(this->rhs, rhs_swiz); + this->rhs = new(mem_ctx) ir_swizzle(this->rhs, rhs_swiz); + swizzled = true; + } + + if (swizzled) { + /* Now, RHS channels line up with the LHS writemask. Collapse it + * to just the channels that will be written. + */ + ir_swizzle_mask rhs_swiz = { 0, 0, 0, 0, 0, 0 }; + int rhs_chan = 0; + for (int i = 0; i < 4; i++) { + if (write_mask & (1 << i)) + update_rhs_swizzle(rhs_swiz, i, rhs_chan++); + } + this->rhs = new(mem_ctx) ir_swizzle(this->rhs, rhs_swiz); } assert((lhs == NULL) || lhs->as_dereference()); @@ -122,6 +139,16 @@ ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs, this->rhs = rhs; this->lhs = lhs; this->write_mask = write_mask; + + if (lhs->type->is_scalar() || lhs->type->is_vector()) { + int lhs_components = 0; + for (int i = 0; i < 4; i++) { + if (write_mask & (1 << i)) + lhs_components++; + } + + assert(lhs_components == this->rhs->type->vector_elements); + } } ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 240e7cd49af..fa246b5e570 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -646,6 +646,14 @@ public: * For non-vector types in the LHS, this field will be zero. For vector * types, a bit will be set for each component that is written. Note that * for \c vec2 and \c vec3 types only the lower bits will ever be set. + * + * A partially-set write mask means that each enabled channel gets + * the value from a consecutive channel of the rhs. For example, + * to write just .xyw of gl_FrontColor with color: + * + * (assign (constant bool (1)) (xyw) + * (var_ref gl_FragColor) + * (swiz xyw (var_ref color))) */ unsigned write_mask:4; }; diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp index f7a0599f425..390f295d6e9 100644 --- a/src/glsl/ir_constant_propagation.cpp +++ b/src/glsl/ir_constant_propagation.cpp @@ -168,18 +168,26 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) if (!found) return; + int rhs_channel = 0; + for (int j = 0; j < 4; j++) { + if (j == channel) + break; + if (found->write_mask & (1 << j)) + rhs_channel++; + } + switch (type->base_type) { case GLSL_TYPE_FLOAT: - data.f[i] = found->constant->value.f[channel]; + data.f[i] = found->constant->value.f[rhs_channel]; break; case GLSL_TYPE_INT: - data.i[i] = found->constant->value.i[channel]; + data.i[i] = found->constant->value.i[rhs_channel]; break; case GLSL_TYPE_UINT: - data.u[i] = found->constant->value.u[channel]; + data.u[i] = found->constant->value.u[rhs_channel]; break; case GLSL_TYPE_BOOL: - data.b[i] = found->constant->value.b[channel]; + data.b[i] = found->constant->value.b[rhs_channel]; break; default: assert(!"not reached"); diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index c32ca88b0fe..244fe489280 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -310,14 +310,11 @@ ir_mat_op_to_vec_visitor::do_equal_mat_mat(ir_variable *result_var, new(this->mem_ctx) ir_expression(ir_binop_any_nequal, glsl_type::bool_type, op0, op1); - ir_rvalue *const swiz = - new(this->mem_ctx) ir_swizzle(cmp, i, i, i, i, columns); - ir_dereference *const lhs = new(this->mem_ctx) ir_dereference_variable(tmp_bvec); ir_assignment *const assign = - new(this->mem_ctx) ir_assignment(lhs, swiz, NULL, (1U << i)); + new(this->mem_ctx) ir_assignment(lhs, cmp, NULL, (1U << i)); this->base_ir->insert_before(assign); } diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 912d1c0d709..e35514aa6f9 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -391,14 +391,16 @@ ir_validate::visit_enter(ir_assignment *ir) abort(); } - /* Mask of fields that do not exist in the destination. These should - * not be written by the assignment. - */ - const unsigned invalid_mask = ~((1U << lhs->type->components()) - 1); + int lhs_components = 0; + for (int i = 0; i < 4; i++) { + if (ir->write_mask & (1 << i)) + lhs_components++; + } - if ((invalid_mask & ir->write_mask) != 0) { - printf("Assignment write mask enables invalid components for " - "type %s:\n", lhs->type->name); + if (lhs_components != ir->rhs->type->vector_elements) { + printf("Assignment count of LHS write mask channels enabled not\n" + "matching RHS vector size (%d LHS, %d RHS).\n", + lhs_components, ir->rhs->type->vector_elements); ir->print(); abort(); } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index f24dce79f65..de0cb1ac5bd 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1577,13 +1577,39 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); l.writemask = WRITEMASK_XYZW; } else if (ir->lhs->type->is_scalar()) { - /* FINISHME: This hack makes writing to gl_FragData, which lives in the + /* FINISHME: This hack makes writing to gl_FragDepth, which lives in the * FINISHME: W component of fragment shader output zero, work correctly. */ l.writemask = WRITEMASK_XYZW; } else { + int swizzles[4]; + int first_enabled_chan = 0; + int rhs_chan = 0; + assert(ir->lhs->type->is_vector()); l.writemask = ir->write_mask; + + for (int i = 0; i < 4; i++) { + if (l.writemask & (1 << i)) { + first_enabled_chan = GET_SWZ(r.swizzle, i); + break; + } + } + + /* Swizzle a small RHS vector into the channels being written. + * + * glsl ir treats write_mask as dictating how many channels are + * present on the RHS while Mesa IR treats write_mask as just + * showing which channels of the vec4 RHS get written. + */ + for (int i = 0; i < 4; i++) { + if (l.writemask & (1 << i)) + swizzles[i] = GET_SWZ(r.swizzle, rhs_chan++); + else + swizzles[i] = first_enabled_chan; + } + r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], + swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); -- cgit v1.2.3 From 3ffab367685c0e0c7ce4d01a3b9b934cb0b15883 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 11:43:58 -0700 Subject: glsl: Fix copy'n'wasted ir_noop_swizzle conditions. It considered .xyyy a noop for vec4 instead of .xyzw, and similar for vec3. --- src/glsl/ir_noop_swizzle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glsl/ir_noop_swizzle.cpp b/src/glsl/ir_noop_swizzle.cpp index b78c87b47f3..0403dfa4e93 100644 --- a/src/glsl/ir_noop_swizzle.cpp +++ b/src/glsl/ir_noop_swizzle.cpp @@ -61,9 +61,9 @@ ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue) return; if (elems >= 2 && swiz->mask.y != 1) return; - if (elems >= 3 && swiz->mask.z != 1) + if (elems >= 3 && swiz->mask.z != 2) return; - if (elems >= 4 && swiz->mask.w != 1) + if (elems >= 4 && swiz->mask.w != 3) return; this->progress = true; -- cgit v1.2.3 From eaa6bf59db68f97fa32c3395eb4aa6e589f34b26 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 13:07:57 -0700 Subject: ir_to_mesa: Only compare vector_elements present for any_nequal/all_equal Fixes: glsl-mat-from-int-ctor-03 --- src/mesa/program/ir_to_mesa.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index de0cb1ac5bd..93b6c305f19 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1096,6 +1096,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) assert(!ir->operands[operand]->type->is_matrix()); } + int vector_elements = ir->operands[0]->type->vector_elements; + if (ir->operands[1]) { + vector_elements = MAX2(vector_elements, + ir->operands[1]->type->vector_elements); + } + this->result.file = PROGRAM_UNDEFINED; /* Storage for our result. Ideally for an assignment we'd be using @@ -1204,7 +1210,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); ir_to_mesa_emit_op2(ir, OPCODE_SNE, ir_to_mesa_dst_reg_from_src(temp), op[0], op[1]); - ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + if (vector_elements == 4) + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + else if (vector_elements == 3) + ir_to_mesa_emit_op2(ir, OPCODE_DP3, result_dst, temp, temp); + else + ir_to_mesa_emit_op2(ir, OPCODE_DP2, result_dst, temp, temp); ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, result_src, src_reg_for_float(0.0)); } else { @@ -1218,7 +1229,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); ir_to_mesa_emit_op2(ir, OPCODE_SNE, ir_to_mesa_dst_reg_from_src(temp), op[0], op[1]); - ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + if (vector_elements == 4) + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + else if (vector_elements == 3) + ir_to_mesa_emit_op2(ir, OPCODE_DP3, result_dst, temp, temp); + else + ir_to_mesa_emit_op2(ir, OPCODE_DP2, result_dst, temp, temp); ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, result_src, src_reg_for_float(0.0)); } else { -- cgit v1.2.3 From 4bb42a4f7e86d3e6e09fa504ea2d8630cb877066 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 22 Sep 2010 22:29:15 +0200 Subject: tgsi: Fix missing test before check As introduced with commit d21301675c249602e19310d5b62fad424f2f2ac2 NOTE: This is a candidate for the 7.9 branch. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 67deffbd119..086d983a73a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2975,7 +2975,8 @@ tgsi_emit_sse2( tgsi_get_processor_name(proc)); } - ok = check_soa_dependencies(&parse.FullToken.FullInstruction); + if (ok) + ok = check_soa_dependencies(&parse.FullToken.FullInstruction); break; case TGSI_TOKEN_TYPE_IMMEDIATE: -- cgit v1.2.3 From d74bab1fb67fe1334fd80eaf0d4e224fc6d96f22 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 14:14:30 -0700 Subject: i965: Fix the vector/expression splitting for the write_mask change. +113 piglits. --- src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 5 +---- src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 3 --- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index 478614090a0..eba8a764e21 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -128,10 +128,7 @@ ir_channel_expressions_visitor::assign(ir_assignment *ir, int elem, ir_rvalue *v */ assert(ir->write_mask == (1 << ir->lhs->type->components()) - 1); - /* Smear the float across all the channels for the masked write. */ - val_swiz = new(mem_ctx) ir_swizzle(val, 0, 0, 0, 0, - ir->lhs->type->components()); - assign = new(mem_ctx) ir_assignment(lhs, val_swiz, NULL, (1 << elem)); + assign = new(mem_ctx) ir_assignment(lhs, val, NULL, (1 << elem)); ir->insert_before(assign); } diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 00d5c202485..d4da86b3b06 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -281,9 +281,6 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) if (rhs) { new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]); - /* If we're writing into a writemask, smear it out to that channel. */ - if (!lhs) - new_rhs = new(mem_ctx) ir_swizzle(new_rhs, i, i, i, i, i + 1); } else { new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL), i, i, i, i, 1); -- cgit v1.2.3 From 86a1938aa56c02d7da137b09e579d24d7da50d9e Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 22 Sep 2010 17:34:00 -0400 Subject: glx: Invalidate buffers after binding a drawable If the server doesn't send invalidate events, we may miss a resize before the rendering starts. Invalidate the buffers now so the driver will recheck before rendering starts. https://bugs.freedesktop.org/show_bug.cgi?id=29984 https://bugs.freedesktop.org/show_bug.cgi?id=30155 --- src/glx/dri2_glx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 88bb8b81769..b0559b24d72 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -138,6 +138,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old, struct dri2_context *pcp = (struct dri2_context *) context; struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc; struct dri2_drawable *pdraw, *pread; + struct dri2_display *pdp; pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw); pread = (struct dri2_drawable *) driFetchDrawable(context, read); @@ -145,11 +146,21 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old, if (pdraw == NULL || pread == NULL) return GLXBadDrawable; - if ((*psc->core->bindContext) (pcp->driContext, - pdraw->driDrawable, pread->driDrawable)) - return Success; + if (!(*psc->core->bindContext) (pcp->driContext, + pdraw->driDrawable, pread->driDrawable)) + return GLXBadContext; + + /* If the server doesn't send invalidate events, we may miss a + * resize before the rendering starts. Invalidate the buffers now + * so the driver will recheck before rendering starts. */ + pdp = (struct dri2_display *) psc->base.display; + if (!pdp->invalidateAvailable) { + dri2InvalidateBuffers(psc->base.dpy, pdraw->base.xDrawable); + if (pread != pdraw) + dri2InvalidateBuffers(psc->base.dpy, pread->base.xDrawable); + } - return GLXBadContext; + return Success; } static void -- cgit v1.2.3 From ac3d5beb0b20eb369b188aaf7b78f935969f3b62 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 14:40:40 -0700 Subject: i965: When splitting vector variable assignment, ignore unset channels. The new checks for sanity in ir_assignment creation got angry about this write_mask == 0. Fixes: glsl-fs-dot-vec2. glsl-fs-atan-2 glsl-fs-dot-vec2 --- src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index d4da86b3b06..9b58916cf2b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -271,12 +271,15 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) void *mem_ctx = lhs ? lhs->mem_ctx : rhs->mem_ctx; unsigned int writemask; + if (!(ir->write_mask & (1 << i))) + continue; + if (lhs) { new_lhs = new(mem_ctx) ir_dereference_variable(lhs->components[i]); - writemask = (ir->write_mask >> i) & 1; + writemask = 1; } else { new_lhs = ir->lhs->clone(mem_ctx, NULL); - writemask = ir->write_mask & (1 << i); + writemask = 1 << i; } if (rhs) { -- cgit v1.2.3 From bb70bd55596fa19f5775bac98bffb567f3ba1d9f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 14:52:38 -0700 Subject: i965: Update expression splitting for the vector-result change to compares. Fixes: glsl1-precision exp2 glsl1-precision log2 --- .../drivers/dri/i965/brw_fs_channel_expressions.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index eba8a764e21..9fbf7b7c6b8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -119,7 +119,6 @@ ir_channel_expressions_visitor::assign(ir_assignment *ir, int elem, ir_rvalue *v { ir_dereference *lhs = ir->lhs->clone(mem_ctx, NULL); ir_assignment *assign; - ir_swizzle *val_swiz; /* This assign-of-expression should have been generated by the * expression flattening visitor (since we never short circit to @@ -232,6 +231,12 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) case ir_binop_bit_and: case ir_binop_bit_xor: case ir_binop_bit_or: + case ir_binop_less: + case ir_binop_greater: + case ir_binop_lequal: + case ir_binop_gequal: + case ir_binop_equal: + case ir_binop_nequal: for (i = 0; i < vector_elements; i++) { ir_rvalue *op0 = get_element(op_var[0], i); ir_rvalue *op1 = get_element(op_var[1], i); @@ -312,10 +317,6 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) break; } - case ir_binop_less: - case ir_binop_greater: - case ir_binop_lequal: - case ir_binop_gequal: case ir_binop_logic_and: case ir_binop_logic_xor: case ir_binop_logic_or: @@ -323,8 +324,8 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) printf("\n"); assert(!"not reached: expression operates on scalars only"); break; - case ir_binop_equal: - case ir_binop_nequal: { + case ir_binop_all_equal: + case ir_binop_any_nequal: { ir_expression *last = NULL; for (i = 0; i < vector_elements; i++) { ir_rvalue *op0 = get_element(op_var[0], i); @@ -332,7 +333,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) ir_expression *temp; ir_expression_operation join; - if (expr->operation == ir_binop_equal) + if (expr->operation == ir_binop_all_equal) join = ir_binop_logic_and; else join = ir_binop_logic_or; -- cgit v1.2.3 From 03923ff95ed2c1ee54f0132e87e277b6cf07b7f5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Sep 2010 14:58:29 -0700 Subject: i965: Warning fix for vector result any_nequal/all_equal change. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index cf5c52119a5..2b517375eb6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -750,7 +750,9 @@ fs_visitor::visit(ir_expression *ir) case ir_binop_dot: case ir_binop_cross: case ir_unop_any: - assert(!"not reached: should be handled by brw_channel_expressions"); + case ir_binop_all_equal: + case ir_binop_any_nequal: + assert(!"not reached: should be handled by brw_fs_channel_expressions"); break; case ir_unop_noise: -- cgit v1.2.3 From fb5ef05dc5e57b6454bd43b9a0eca3b6e9bf27c1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 10:01:08 +1000 Subject: r600g: use floats instead of hex for blit vbo once I go past 0x3f80000, I can't translate hex to float in-brain anymore. --- src/gallium/drivers/r600/r600_blit.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 8db3de0c4fb..a27696ac3b4 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -169,16 +169,15 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 struct radeon_state *rstate; struct radeon_ws_bo *bo; void *data; - u32 vbo[] = { - 0xBF800000, 0xBF800000, 0x3F800000, 0x3F800000, - 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000, - 0x3F800000, 0xBF800000, 0x3F800000, 0x3F800000, - 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000, - 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000, - 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000, - 0xBF800000, 0x3F800000, 0x3F800000, 0x3F800000, - 0x3F000000, 0x3F000000, 0x3F000000, 0x00000000 - }; + float vbo[] = { + -1.0, -1.0, 1.0, 1.0, + 0.5, 0.5, 0.5, 0.0, + 1.0, -1.0, 1.0, 1.0, + 0.5, 0.5, 0.5, 0.0, + 1.0, 1.0, 1.0, 1.0, + 0.5, 0.5, 0.5, 0.0, + -1.0, 1.0, 1.0, 1.0, + 0.5, 0.5, 0.5, 0.0}; /* simple shader */ bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0); -- cgit v1.2.3 From 8078e58795052b8eb7c35fd73db06f26bec078e2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 10:20:56 +1000 Subject: r600g: fix depth readback on rv610 and other quirky variants. at least zreaddraw works for me here now on my rv610 --- src/gallium/drivers/r600/r600_blit.c | 40 +++++++++++++++++++++++-------- src/gallium/drivers/r600/r600_hw_states.c | 4 ++-- 2 files changed, 32 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index a27696ac3b4..40422042d3c 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -169,16 +169,30 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 struct radeon_state *rstate; struct radeon_ws_bo *bo; void *data; - float vbo[] = { + float *vbo; + enum radeon_family family; + float vbo_r600[] = { -1.0, -1.0, 1.0, 1.0, - 0.5, 0.5, 0.5, 0.0, + 0.5, 0.5, 0.0, 0.0, 1.0, -1.0, 1.0, 1.0, - 0.5, 0.5, 0.5, 0.0, + 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, - 0.5, 0.5, 0.5, 0.0, + 0.5, 0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, - 0.5, 0.5, 0.5, 0.0}; + 0.5, 0.5, 0.0, 0.0 }; + + float vbo_rv6xx[] = { + -1.0, -1.0, 0.0, 1.0, + 0.5, 0.5, 0.0, 0.0, + 1.0, -1.0, 0.0, 1.0, + 0.5, 0.5, 0.0, 0.0, + 1.0, 1.0, 0.0, 1.0, + 0.5, 0.5, 0.0, 0.0, + -1.0, 1.0, 0.0, 1.0, + 0.5, 0.5, 0.0, 0.0}; + + family = radeon_get_family(rscreen->rw); /* simple shader */ bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0); if (bo == NULL) { @@ -189,6 +203,12 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600 radeon_ws_bo_reference(rscreen->rw, &bo, NULL); return -ENOMEM; } + if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || + family == CHIP_RV635) + vbo = vbo_rv6xx; + else + vbo = vbo_r600; + memcpy(data, vbo, 128); radeon_ws_bo_unmap(rscreen->rw, bo); @@ -572,17 +592,17 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || family == CHIP_RV635) { bstates.dsa.states[R600_DSA__DB_DEPTH_CONTROL] = S_028800_Z_ENABLE(1) | - S_028800_STENCIL_ENABLE(1) | S_028800_ZFUNC(PIPE_FUNC_LEQUAL) | - S_028800_STENCILFUNC(PIPE_FUNC_ALWAYS) | + S_028800_STENCIL_ENABLE(1) | S_028800_ZFUNC(V_028800_STENCILFUNC_LEQUAL) | + S_028800_STENCILFUNC(V_028800_STENCILFUNC_ALWAYS) | S_028800_STENCILZPASS(V_028800_STENCIL_KEEP) | S_028800_STENCILZFAIL(V_028800_STENCIL_INCR); bstates.dsa.states[R600_DSA__DB_STENCILREFMASK] = S_028430_STENCILWRITEMASK(0xff); - } else { - bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = S_028D0C_DEPTH_COPY_ENABLE(1) | + } + bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = S_028D0C_DEPTH_COPY_ENABLE(1) | S_028D0C_STENCIL_COPY_ENABLE(1) | S_028D0C_COPY_CENTROID(1); - } + bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000003; r600_blit_state_cb_flush(rscreen, &bstates.cb_flush, rtexture, 0, 0); r600_blit_state_db_flush(rscreen, &bstates.db_flush, rtexture, 0, 0); diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 13abd172d60..13b1124d90e 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -1220,8 +1220,8 @@ static void r600_texture_state_viewport(struct r600_screen *rscreen, struct r600 rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(width); rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(height); rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(height); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(0.5); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(0.5); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(0.0); + rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(1.0); rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = S_028818_VPORT_X_SCALE_ENA(1) | S_028818_VPORT_X_OFFSET_ENA(1) | -- cgit v1.2.3 From fa11c400d0bce7b1373312a224cd4daf4c1bda8a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 10:30:35 +1000 Subject: r600g: fix typo in evergreen register list pointed out by glisse on irc. --- src/gallium/winsys/r600/drm/eg_states.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h index 518e05fefbb..d87109fb801 100644 --- a/src/gallium/winsys/r600/drm/eg_states.h +++ b/src/gallium/winsys/r600/drm/eg_states.h @@ -295,7 +295,7 @@ static const struct radeon_register EG_names_UCP[] = { {0x0002860C, 0, 0, "PA_CL_UCP5_X"}, {0x00028610, 0, 0, "PA_CL_UCP5_Y"}, {0x00028614, 0, 0, "PA_CL_UCP5_Z"}, - {0x0002861C, 0, 0, "PA_CL_UCP5_W"}, + {0x00028618, 0, 0, "PA_CL_UCP5_W"}, }; static const struct radeon_register EG_names_VS_CBUF[] = { -- cgit v1.2.3 From 1c2423999e35576bebd7962a907507a81eb79b07 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 22 Sep 2010 20:40:44 -0400 Subject: rbug: fix rbug when contexts are being destroyed --- src/gallium/drivers/rbug/rbug_context.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 3ffda87520f..413da59e559 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -43,6 +43,7 @@ rbug_destroy(struct pipe_context *_pipe) struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + remove_from_list(&rb_pipe->list); pipe->destroy(pipe); FREE(rb_pipe); -- cgit v1.2.3 From 17eace581d25a626a7d75d9d1205d012cbb14a6e Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 22 Sep 2010 22:01:17 -0400 Subject: dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup We will typically have a current context when we need to lookup the image, but the lookup implementation don't need it so drop it. --- include/GL/internal/dri_interface.h | 2 +- src/egl/drivers/dri2/egl_dri2.c | 7 +++---- src/gallium/include/state_tracker/st_api.h | 1 - src/gallium/state_trackers/dri/common/dri_context.h | 3 --- src/gallium/state_trackers/dri/common/dri_screen.c | 8 +++----- src/gallium/state_trackers/dri/common/dri_screen.h | 3 +++ src/gallium/state_trackers/dri/drm/dri2.c | 10 +++++----- src/mesa/drivers/dri/common/dri_util.c | 1 + src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/intel/intel_fbo.c | 4 ++-- src/mesa/drivers/dri/intel/intel_tex_image.c | 4 ++-- 11 files changed, 21 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 5351a2ba4ab..9ee039bd90b 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -841,7 +841,7 @@ typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension; struct __DRIimageLookupExtensionRec { __DRIextension base; - __DRIimage *(*lookupEGLImage)(__DRIcontext *context, void *image, + __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image, void *loaderPrivate); }; diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 083f796f430..9c4ff560b14 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -370,10 +370,9 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) } static __DRIimage * -dri2_lookup_egl_image(__DRIcontext *context, void *image, void *data) +dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data) { - struct dri2_egl_context *dri2_ctx = data; - _EGLDisplay *disp = dri2_ctx->base.Resource.Display; + _EGLDisplay *disp = data; struct dri2_egl_image *dri2_img; _EGLImage *img; @@ -728,7 +727,7 @@ dri2_create_screen(_EGLDisplay *disp) dri2_dpy = disp->DriverData; dri2_dpy->dri_screen = dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions, - &dri2_dpy->driver_configs, dri2_dpy); + &dri2_dpy->driver_configs, disp); if (dri2_dpy->dri_screen == NULL) { _eglLog(_EGL_WARNING, "DRI2: failed to create dri screen"); diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 8ea15545689..21e2165ed9e 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -384,7 +384,6 @@ struct st_manager * This function is optional. */ boolean (*get_egl_image)(struct st_manager *smapi, - struct st_context_iface *stctx, void *egl_image, struct st_egl_image *out); diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h index ffe9eba13c8..beb59c6f684 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.h +++ b/src/gallium/state_trackers/dri/common/dri_context.h @@ -61,9 +61,6 @@ struct dri_context /* gallium */ struct st_api *stapi; struct st_context_iface *st; - - /* hooks filled in by dri2 & drisw */ - __DRIimage * (*lookup_egl_image)(struct dri_context *ctx, void *handle); }; static INLINE struct dri_context * diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 475a96d1967..7e4b11d83f7 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -287,16 +287,14 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, static boolean dri_get_egl_image(struct st_manager *smapi, - struct st_context_iface *stctxi, void *egl_image, struct st_egl_image *stimg) { - struct dri_context *ctx = - (struct dri_context *)stctxi->st_manager_private; + struct dri_screen *screen = (struct dri_screen *)smapi; __DRIimage *img = NULL; - if (ctx->lookup_egl_image) { - img = ctx->lookup_egl_image(ctx, egl_image); + if (screen->lookup_egl_image) { + img = screen->lookup_egl_image(screen, egl_image); } if (!img) diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index 849f399b2f8..d4eb8f454f0 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -69,6 +69,9 @@ struct dri_screen boolean sd_depth_bits_last; boolean auto_fake_front; enum pipe_texture_target target; + + /* hooks filled in by dri2 & drisw */ + __DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle); }; /** cast wrapper */ diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 135f66c61da..116afccb194 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -291,15 +291,16 @@ dri2_flush_frontbuffer(struct dri_drawable *drawable, } static __DRIimage * -dri2_lookup_egl_image(struct dri_context *ctx, void *handle) +dri2_lookup_egl_image(struct dri_screen *screen, void *handle) { - __DRIimageLookupExtension *loader = ctx->sPriv->dri2.image; + __DRIimageLookupExtension *loader = screen->sPriv->dri2.image; __DRIimage *img; if (!loader->lookupEGLImage) return NULL; - img = loader->lookupEGLImage(ctx->cPriv, handle, ctx->cPriv->loaderPrivate); + img = loader->lookupEGLImage(screen->sPriv, + handle, screen->sPriv->loaderPrivate); return img; } @@ -537,6 +538,7 @@ dri2_init_screen(__DRIscreen * sPriv) screen->auto_fake_front = dri_with_format(sPriv); screen->broken_invalidate = !sPriv->dri2.useInvalidate; + screen->lookup_egl_image = dri2_lookup_egl_image; return configs; fail: @@ -556,8 +558,6 @@ dri2_create_context(gl_api api, const __GLcontextModes * visual, ctx = cPriv->driverPrivate; - ctx->lookup_egl_image = dri2_lookup_egl_image; - return TRUE; } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index f07c3da4bb6..d46f622d573 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -880,6 +880,7 @@ dri2CreateNewScreen(int scrn, int fd, } psp->DriverAPI = driDriverAPI; + psp->loaderPrivate = data; driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, __dri2NConfigOptions); diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 5096d22cad3..785beacd817 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -539,6 +539,7 @@ struct __DRIscreenRec { driOptionCache optionInfo; driOptionCache optionCache; unsigned int api_mask; + void *loaderPrivate; }; extern void diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 2693b5fa72e..363a5c02425 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -202,8 +202,8 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx, __DRIimage *image; screen = intel->intelScreen->driScrnPriv; - image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle, - intel->driContext->loaderPrivate); + image = screen->dri2.image->lookupEGLImage(screen, image_handle, + screen->loaderPrivate); if (image == NULL) return; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 7d33df35998..b1ed7ee5e73 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -805,8 +805,8 @@ intel_image_target_texture_2d(GLcontext *ctx, GLenum target, __DRIimage *image; screen = intel->intelScreen->driScrnPriv; - image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle, - intel->driContext->loaderPrivate); + image = screen->dri2.image->lookupEGLImage(screen, image_handle, + screen->loaderPrivate); if (image == NULL) return; -- cgit v1.2.3 From 881c05aa1ec22bb229a0bceae372d68f9fc91431 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 03:10:50 +0200 Subject: d3d1x: properly reference count the backend --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 3cbe056e7b6..2149d83a9c6 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -1381,7 +1381,11 @@ void STDMETHODCALLTYPE GalliumDXGIUseHDC(HDC hdc, PFNHWNDRESOLVER resolver, void */ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() { + if(dxgi_default_binding.backend) + dxgi_default_binding.backend->Release(); dxgi_default_binding = dxgi_thread_binding; + if(dxgi_default_binding.backend) + dxgi_default_binding.backend->AddRef(); } /* TODO: why did Microsoft add this? should we do something different for DXGI 1.0 and 1.1? -- cgit v1.2.3 From c262c4a2ff1a19d0136771767ba63f04cf3b83e3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 14:18:22 +1000 Subject: u_blitter: add a custom blitter call passing a dsa cso reimplement the flush stage added for r300 to allow a custom DSA stage to be used in the pipeline, this allows for r600 hw DB->CB flushes. --- src/gallium/auxiliary/util/u_blitter.c | 45 +++++++++++++++++++++++----------- src/gallium/auxiliary/util/u_blitter.h | 6 +++++ 2 files changed, 37 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f93ef26ae73..c160716e6a7 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -964,16 +964,18 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, blitter_restore_CSOs(ctx); } -/* Clear a region of a depth stencil surface. */ -void util_blitter_flush_depth_stencil(struct blitter_context *blitter, - struct pipe_surface *dstsurf) +/* draw a rectangle across a region using a custom dsa stage - for r600g */ +void util_blitter_custom_depth_stencil(struct blitter_context *blitter, + struct pipe_surface *zsurf, + struct pipe_surface *cbsurf, + void *dsa_stage, float depth) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; struct pipe_framebuffer_state fb_state; - assert(dstsurf->texture); - if (!dstsurf->texture) + assert(zsurf->texture); + if (!zsurf->texture) return; /* check the saved state */ @@ -981,8 +983,8 @@ void util_blitter_flush_depth_stencil(struct blitter_context *blitter, assert(blitter->saved_fb_state.nr_cbufs != ~0); /* bind CSOs */ - pipe->bind_blend_state(pipe, ctx->blend_keep_color); - pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_flush_depth_stencil); + pipe->bind_blend_state(pipe, ctx->blend_write_color); + pipe->bind_depth_stencil_alpha_state(pipe, dsa_stage); pipe->bind_rasterizer_state(pipe, ctx->rs_state); pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 0)); @@ -990,15 +992,30 @@ void util_blitter_flush_depth_stencil(struct blitter_context *blitter, pipe->bind_vertex_elements_state(pipe, ctx->velem_state); /* set a framebuffer state */ - fb_state.width = dstsurf->width; - fb_state.height = dstsurf->height; - fb_state.nr_cbufs = 0; - fb_state.cbufs[0] = 0; - fb_state.zsbuf = dstsurf; + fb_state.width = zsurf->width; + fb_state.height = zsurf->height; + fb_state.nr_cbufs = 1; + if (cbsurf) { + fb_state.cbufs[0] = cbsurf; + fb_state.nr_cbufs = 1; + } else { + fb_state.cbufs[0] = NULL; + fb_state.nr_cbufs = 0; + } + fb_state.zsbuf = zsurf; pipe->set_framebuffer_state(pipe, &fb_state); - blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height); - blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height, 0, + blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height); + blitter->draw_rectangle(blitter, 0, 0, zsurf->width, zsurf->height, depth, UTIL_BLITTER_ATTRIB_NONE, NULL); blitter_restore_CSOs(ctx); } + +/* flush a region of a depth stencil surface for r300g */ +void util_blitter_flush_depth_stencil(struct blitter_context *blitter, + struct pipe_surface *dstsurf) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + util_blitter_custom_depth_stencil(blitter, dstsurf, NULL, + ctx->dsa_flush_depth_stencil, 0.0f); +} diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index e33d2e283f8..f9f96f25c77 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -203,6 +203,12 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, void util_blitter_flush_depth_stencil(struct blitter_context *blitter, struct pipe_surface *dstsurf); + +void util_blitter_custom_depth_stencil(struct blitter_context *blitter, + struct pipe_surface *zsurf, + struct pipe_surface *cbsurf, + void *dsa_stage, float depth); + /* The functions below should be used to save currently bound constant state * objects inside a driver. The objects are automatically restored at the end * of the util_blitter_{clear, copy_region, fill_region} functions and then -- cgit v1.2.3 From 2f8453eea3b5ff8d2818517753d3990490f699b8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 13:34:36 +1000 Subject: r600g: use blitter to do db->cb flushing. use the blitter + custom stage to avoid doing a whole lot of state setup by hand. This makes life a lot easier for doing this on evergreen it also keeps all the state setup in one place. We setup a custom context state at the start with a flag to denote its for the flush, when it gets generated we generate the correct state for the flush and no longer have to do it all by hand. this should also make adding texture *to* depth easier. --- src/gallium/drivers/r600/eg_hw_states.c | 152 +-------- src/gallium/drivers/r600/r600_blit.c | 546 +++--------------------------- src/gallium/drivers/r600/r600_context.c | 3 +- src/gallium/drivers/r600/r600_context.h | 18 +- src/gallium/drivers/r600/r600_hw_states.c | 202 ++--------- src/gallium/drivers/r600/r600_resource.h | 8 +- src/gallium/drivers/r600/r600_screen.h | 7 +- src/gallium/drivers/r600/r600_texture.c | 168 ++++----- 8 files changed, 145 insertions(+), 959 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 6ad350b7d3c..42b49002c39 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -543,17 +543,9 @@ static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate, radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); tmp = (struct r600_resource_texture*)view->texture; rbuffer = &tmp->resource; - if (tmp->depth) { - r = r600_texture_from_depth(ctx, tmp, view->first_level); - if (r) { - return; - } - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], tmp->uncompressed); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], tmp->uncompressed); - } else { - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); - } + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); + rstate->nbo = 2; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; @@ -1015,141 +1007,7 @@ static int eg_vs_shader(struct r600_context *rctx, struct r600_context_state *rp state->placement[0] = RADEON_GEM_DOMAIN_GTT; state->placement[2] = RADEON_GEM_DOMAIN_GTT; return radeon_state_pm4(state); -} - -static void eg_texture_state_scissor(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level) -{ - struct radeon_state *rstate = &rtexture->scissor[level]; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0); - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF; - rstate->states[EG_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA; - rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = 0x80000000; - rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = 0x80000000; - - radeon_state_pm4(rstate); -} - -static void eg_texture_state_cb(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) -{ - struct radeon_state *rstate; - struct r600_resource *rbuffer; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype, attrib; - const struct util_format_description *desc; - - rstate = &rtexture->cb[cb][level]; - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0, cb, 0); - rbuffer = &rtexture->resource; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - pitch = (rtexture->pitch[level] / rtexture->bpt) / 8 - 1; - slice = (rtexture->pitch[level] / rtexture->bpt) * rtexture->height[level] / 64 - 1; - ntype = 0; - attrib = 0; - desc = util_format_description(rbuffer->base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_028C70_NUMBER_SRGB; - format = r600_translate_colorformat(rtexture->resource.base.b.format); - swap = r600_translate_colorswap(rtexture->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rtexture->uncompressed); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 1; - color_info = 0; - } else { - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 1; - color_info = S_028C70_SOURCE_FORMAT(1); - } - color_info |= S_028C70_FORMAT(format) | - S_028C70_COMP_SWAP(swap) | - S_028C70_BLEND_CLAMP(1) | - S_028C70_NUMBER_TYPE(ntype); - rstate->states[EG_CB__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; - rstate->states[EG_CB__CB_COLOR0_INFO] = color_info; - rstate->states[EG_CB__CB_COLOR0_PITCH] = S_028C64_PITCH_TILE_MAX(pitch); - rstate->states[EG_CB__CB_COLOR0_SLICE] = S_028C68_SLICE_TILE_MAX(slice); - rstate->states[EG_CB__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[EG_CB__CB_COLOR0_ATTRIB] = S_028C74_NON_DISP_TILING_ORDER(1); - - radeon_state_pm4(rstate); -} - -static void eg_texture_state_db(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) -{ - struct radeon_state *rstate = &rtexture->db[level]; - struct r600_resource *rbuffer; - unsigned pitch, slice, format; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); - rbuffer = &rtexture->resource; - rtexture->tiled = 1; - rtexture->array_mode = 2; - rtexture->tile_type = 1; - rtexture->depth = 1; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - pitch = (rtexture->pitch[level] / rtexture->bpt) / 8 - 1; - slice = (rtexture->pitch[level] / rtexture->bpt) * rtexture->height[level] / 64 - 1; - format = r600_translate_dbformat(rbuffer->base.b.format); - rstate->states[EG_DB__DB_Z_READ_BASE] = rtexture->offset[level] >> 8; - rstate->states[EG_DB__DB_Z_WRITE_BASE] = rtexture->offset[level] >> 8; - rstate->states[EG_DB__DB_Z_INFO] = S_028040_ARRAY_MODE(rtexture->array_mode) | S_028040_FORMAT(format); - rstate->states[EG_DB__DB_DEPTH_VIEW] = 0x00000000; - rstate->states[EG_DB__DB_DEPTH_SIZE] = S_028058_PITCH_TILE_MAX(pitch); - rstate->states[EG_DB__DB_DEPTH_SLICE] = S_02805C_SLICE_TILE_MAX(slice); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 1; - - radeon_state_pm4(rstate); -} -static void eg_texture_state_viewport(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) -{ - struct radeon_state *rstate = &rtexture->viewport[level]; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[EG_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui((float)rtexture->width[level]/2.0); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui((float)rtexture->width[level]/2.0); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui((float)rtexture->height[level]/2.0); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui((float)-rtexture->height[level]/2.0); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = 0x3F000000; - rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = 0x3F000000; - rstate->states[EG_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; - rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; - - radeon_state_pm4(rstate); } struct r600_context_hw_state_vtbl eg_hw_state_vtbl = { @@ -1171,10 +1029,6 @@ struct r600_context_hw_state_vtbl eg_hw_state_vtbl = { .vs_shader = eg_vs_shader, .ps_shader = eg_ps_shader, .init_config = eg_init_config, - .texture_state_viewport = eg_texture_state_viewport, - .texture_state_db = eg_texture_state_db, - .texture_state_cb = eg_texture_state_cb, - .texture_state_scissor = eg_texture_state_scissor, }; void eg_set_constant_buffer(struct pipe_context *ctx, diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 40422042d3c..0b22f037015 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -136,531 +136,75 @@ static void r600_resource_copy_region(struct pipe_context *ctx, src, subsrc, srcx, srcy, srcz, width, height); } -void r600_init_blit_functions(struct r600_context *rctx) +static void *r600_create_db_flush_dsa(struct r600_context *rctx) { - rctx->context.clear = r600_clear; - rctx->context.clear_render_target = r600_clear_render_target; - rctx->context.clear_depth_stencil = r600_clear_depth_stencil; - rctx->context.resource_copy_region = r600_resource_copy_region; -} - - -struct r600_blit_states { - struct radeon_state rasterizer; - struct radeon_state dsa; - struct radeon_state blend; - struct radeon_state cb_cntl; - struct radeon_state vgt; - struct radeon_state draw; - struct radeon_state vs_constant0; - struct radeon_state vs_constant1; - struct radeon_state vs_constant2; - struct radeon_state vs_constant3; - struct radeon_state ps_shader; - struct radeon_state vs_shader; - struct radeon_state vs_resource0; - struct radeon_state vs_resource1; - struct radeon_state cb_flush; - struct radeon_state db_flush; -}; - -static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600_blit_states *bstates) -{ - struct radeon_state *rstate; - struct radeon_ws_bo *bo; - void *data; - float *vbo; + struct r600_screen *rscreen = rctx->screen; + struct pipe_depth_stencil_alpha_state dsa; + struct r600_context_state *state; + boolean quirk = false; enum radeon_family family; - float vbo_r600[] = { - -1.0, -1.0, 1.0, 1.0, - 0.5, 0.5, 0.0, 0.0, - 1.0, -1.0, 1.0, 1.0, - 0.5, 0.5, 0.0, 0.0, - 1.0, 1.0, 1.0, 1.0, - 0.5, 0.5, 0.0, 0.0, - -1.0, 1.0, 1.0, 1.0, - 0.5, 0.5, 0.0, 0.0 }; - - float vbo_rv6xx[] = { - -1.0, -1.0, 0.0, 1.0, - 0.5, 0.5, 0.0, 0.0, - 1.0, -1.0, 0.0, 1.0, - 0.5, 0.5, 0.0, 0.0, - 1.0, 1.0, 0.0, 1.0, - 0.5, 0.5, 0.0, 0.0, - -1.0, 1.0, 0.0, 1.0, - 0.5, 0.5, 0.0, 0.0}; - family = radeon_get_family(rscreen->rw); - /* simple shader */ - bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0); - if (bo == NULL) { - return -ENOMEM; - } - data = radeon_ws_bo_map(rscreen->rw, bo, 0, NULL); - if (!data) { - radeon_ws_bo_reference(rscreen->rw, &bo, NULL); - return -ENOMEM; - } if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || family == CHIP_RV635) - vbo = vbo_rv6xx; - else - vbo = vbo_r600; - - memcpy(data, vbo, 128); - radeon_ws_bo_unmap(rscreen->rw, bo); - - rstate = &bstates->vs_resource0; - radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000080; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; - rstate->bo[0] = bo; - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - if (radeon_state_pm4(rstate)) { - radeon_state_fini(rstate); - return -ENOMEM; - } - - rstate = &bstates->vs_resource1; - radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, 1, R600_SHADER_VS); - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD0] = 0x00000010; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD1] = 0x00000070; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD2] = 0x02302000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD3] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD4] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD5] = 0x00000000; - rstate->states[R600_VS_RESOURCE__RESOURCE160_WORD6] = 0xC0000000; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - if (radeon_state_pm4(rstate)) { - radeon_state_fini(rstate); - return -ENOMEM; - } - - return 0; -} - -static void r600_blit_state_vs_shader(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - struct radeon_ws_bo *bo; - void *data; - u32 shader_bc_r600[] = { - 0x00000004, 0x81000400, - 0x00000008, 0xA01C0000, - 0xC001A03C, 0x94000688, - 0xC0024000, 0x94200688, - 0x7C000000, 0x002D1001, - 0x00080000, 0x00000000, - 0x7C000100, 0x002D1002, - 0x00080000, 0x00000000, - 0x00000001, 0x00601910, - 0x00000401, 0x20601910, - 0x00000801, 0x40601910, - 0x80000C01, 0x60601910, - 0x00000002, 0x00801910, - 0x00000402, 0x20801910, - 0x00000802, 0x40801910, - 0x80000C02, 0x60801910 - }; - u32 shader_bc_r700[] = { - 0x00000004, 0x81000400, - 0x00000008, 0xA01C0000, - 0xC001A03C, 0x94000688, - 0xC0024000, 0x94200688, - 0x7C000000, 0x002D1001, - 0x00080000, 0x00000000, - 0x7C000100, 0x002D1002, - 0x00080000, 0x00000000, - 0x00000001, 0x00600C90, - 0x00000401, 0x20600C90, - 0x00000801, 0x40600C90, - 0x80000C01, 0x60600C90, - 0x00000002, 0x00800C90, - 0x00000402, 0x20800C90, - 0x00000802, 0x40800C90, - 0x80000C02, 0x60800C90 - }; - - /* simple shader */ - bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0); - if (bo == NULL) { - return; - } - data = radeon_ws_bo_map(rscreen->rw, bo, 0, NULL); - if (!data) { - radeon_ws_bo_reference(rscreen->rw, &bo, NULL); - return; - } - switch (radeon_get_family_class(rscreen->rw)) { - case R600: - memcpy(data, shader_bc_r600, 128); - break; - case R700: - memcpy(data, shader_bc_r700, 128); - break; - default: - R600_ERR("unsupported chip family\n"); - radeon_ws_bo_unmap(rscreen->rw, bo); - radeon_ws_bo_reference(rscreen->rw, &bo, NULL); - return; - } - radeon_ws_bo_unmap(rscreen->rw, bo); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); + quirk = true; + + memset(&dsa, 0, sizeof(dsa)); - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_VS_SHADER__SPI_VS_OUT_ID_0] = 0x03020100; - rstate->states[R600_VS_SHADER__SPI_VS_OUT_ID_1] = 0x07060504; - rstate->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = 0x00000005; - - rstate->bo[0] = bo; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], bo); - rstate->nbo = 2; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - - radeon_state_pm4(rstate); -} - -static void r600_blit_state_ps_shader(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - struct radeon_ws_bo *bo; - void *data; - u32 shader_bc_r600[] = { - 0x00000002, 0xA00C0000, - 0xC0008000, 0x94200688, - 0x00000000, 0x00201910, - 0x00000400, 0x20201910, - 0x00000800, 0x40201910, - 0x80000C00, 0x60201910 - }; - u32 shader_bc_r700[] = { - 0x00000002, 0xA00C0000, - 0xC0008000, 0x94200688, - 0x00000000, 0x00200C90, - 0x00000400, 0x20200C90, - 0x00000800, 0x40200C90, - 0x80000C00, 0x60200C90 - }; - - /* simple shader */ - bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0); - if (bo == NULL) { - return; - } - data = radeon_ws_bo_map(rscreen->rw, bo, 0, NULL); - if (!data) { - radeon_ws_bo_reference(rscreen->rw, &bo, NULL); - return; - } - switch (radeon_get_family_class(rscreen->rw)) { - case R600: - memcpy(data, shader_bc_r600, 48); - break; - case R700: - memcpy(data, shader_bc_r700, 48); - break; - default: - R600_ERR("unsupported chip family\n"); - radeon_ws_bo_unmap(rscreen->rw, bo); - radeon_ws_bo_reference(rscreen->rw, &bo, NULL); - return; + if (quirk) { + dsa.depth.enabled = 1; + dsa.depth.func = PIPE_FUNC_LEQUAL; + dsa.stencil[0].enabled = 1; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; + dsa.stencil[0].writemask = 0xff; } - radeon_ws_bo_unmap(rscreen->rw, bo); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0] = 0x00000C00; - rstate->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = 0x10000001; - rstate->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = 0x00000002; - rstate->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = 0x00000002; - - rstate->bo[0] = bo; - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - - radeon_state_pm4(rstate); -} - -static void r600_blit_state_vgt(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_VGT, 0, 0); - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; - rstate->states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF; - rstate->states[R600_VGT__VGT_PRIMITIVE_TYPE] = 0x00000005; - - radeon_state_pm4(rstate); -} - -static void r600_blit_state_draw(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_DRAW, 0, 0); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_DRAW__VGT_DRAW_INITIATOR] = 0x00000002; - rstate->states[R600_DRAW__VGT_NUM_INDICES] = 0x00000004; - - radeon_state_pm4(rstate); + state = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); + state->flags |= R600_STATE_FLAG_DSA_FLUSH; + return state; + } -static void r600_blit_state_vs_constant(struct r600_screen *rscreen, struct radeon_state *rstate, - unsigned id, float c0, float c1, float c2, float c3) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_CONSTANT, id, R600_SHADER_VS); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT0_256] = fui(c0); - rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT1_256] = fui(c1); - rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256] = fui(c2); - rstate->states[R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256] = fui(c3); - - radeon_state_pm4(rstate); -} - -static void r600_blit_state_rasterizer(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000; - rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400; - rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005; - rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008; - rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000; - rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = 0x00080004; - rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001; - - radeon_state_pm4(rstate); -} - -static void r600_blit_state_dsa(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - uint32_t db_render_override, db_shader_control; - radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; - rstate->states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F800000; - rstate->states[R600_DSA__DB_RENDER_CONTROL] = 0x00000060; - - db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); - - db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(0) | - S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); - - rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = db_render_override; - rstate->states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control; - - radeon_state_pm4(rstate); -} - -static void r600_blit_state_blend(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0); - radeon_state_pm4(rstate); -} - -static void r600_blit_state_cb_cntl(struct r600_screen *rscreen, struct radeon_state *rstate) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0); - rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000; - rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF; - rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF; - rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = 0x00CC0080; - rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F; - rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = 0x0000000F; - rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; - rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = 0x1; - radeon_state_pm4(rstate); -} - -static void r600_blit_state_cb_flush(struct r600_screen *rscreen, struct radeon_state *rstate, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_FLUSH, 0, 0); - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rtexture->uncompressed); - rstate->nbo = 1; - radeon_state_pm4(rstate); -} - -static void r600_blit_state_db_flush(struct r600_screen *rscreen, struct radeon_state *rstate, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) -{ - radeon_state_init(rstate, rscreen->rw, R600_STATE_DB_FLUSH, 0, 0); - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rtexture->resource.bo); - rstate->nbo = 1; - radeon_state_pm4(rstate); -} - -static int r600_blit_states_init(struct pipe_context *ctx, struct r600_blit_states *bstates) +void r600_init_blit_functions(struct r600_context *rctx) { - struct r600_screen *rscreen = r600_screen(ctx->screen); - - r600_blit_state_ps_shader(rscreen, &bstates->ps_shader); - r600_blit_state_vs_shader(rscreen, &bstates->vs_shader); - r600_blit_state_vgt(rscreen, &bstates->vgt); - r600_blit_state_draw(rscreen, &bstates->draw); - r600_blit_state_vs_constant(rscreen, &bstates->vs_constant0, 0, 1.0, 0.0, 0.0, 0.0); - r600_blit_state_vs_constant(rscreen, &bstates->vs_constant1, 1, 0.0, 1.0, 0.0, 0.0); - r600_blit_state_vs_constant(rscreen, &bstates->vs_constant2, 2, 0.0, 0.0, -0.00199900055, 0.0); - r600_blit_state_vs_constant(rscreen, &bstates->vs_constant3, 3, 0.0, 0.0, -0.99900049, 1.0); - r600_blit_state_rasterizer(rscreen, &bstates->rasterizer); - r600_blit_state_dsa(rscreen, &bstates->dsa); - r600_blit_state_blend(rscreen, &bstates->blend); - r600_blit_state_cb_cntl(rscreen, &bstates->cb_cntl); - r600_blit_state_vs_resources(rscreen, bstates); - return 0; -} + rctx->context.clear = r600_clear; + rctx->context.clear_render_target = r600_clear_render_target; + rctx->context.clear_depth_stencil = r600_clear_depth_stencil; + rctx->context.resource_copy_region = r600_resource_copy_region; -static void r600_blit_states_destroy(struct pipe_context *ctx, struct r600_blit_states *bstates) -{ - radeon_state_fini(&bstates->ps_shader); - radeon_state_fini(&bstates->vs_shader); - radeon_state_fini(&bstates->vs_resource0); - radeon_state_fini(&bstates->vs_resource1); + /* create a custom depth stencil for DB flush */ + rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); } -int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) +int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) { - struct r600_screen *rscreen = r600_screen(ctx->screen); struct r600_context *rctx = r600_context(ctx); - struct radeon_draw draw; - struct r600_blit_states bstates; + struct r600_screen *rscreen = rctx->screen; + struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; + struct pipe_surface *zsurf, *cbsurf; enum radeon_family family; - int r; + int level = 0; + float depth = 1.0f; - r = r600_texture_scissor(ctx, rtexture, level); - if (r) { - return r; - } - r = r600_texture_cb(ctx, rtexture, 0, level); - if (r) { - return r; - } - r = r600_texture_db(ctx, rtexture, level); - if (r) { - return r; - } - r = r600_texture_viewport(ctx, rtexture, level); - if (r) { - return r; - } + zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, + PIPE_BIND_DEPTH_STENCIL); - r = r600_blit_states_init(ctx, &bstates); - if (r) { - return r; - } + cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0, + PIPE_BIND_RENDER_TARGET); + + r600_blitter_save_states(ctx); + util_blitter_save_framebuffer(rctx->blitter, fb); - /* for some gpus we need special cases */ family = radeon_get_family(rscreen->rw); - /* according to R6xx_R7xx_3D.pdf section 6.3.1, these GPUs needs special handling */ if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || - family == CHIP_RV635) { - bstates.dsa.states[R600_DSA__DB_DEPTH_CONTROL] = S_028800_Z_ENABLE(1) | - S_028800_STENCIL_ENABLE(1) | S_028800_ZFUNC(V_028800_STENCILFUNC_LEQUAL) | - S_028800_STENCILFUNC(V_028800_STENCILFUNC_ALWAYS) | - S_028800_STENCILZPASS(V_028800_STENCIL_KEEP) | - S_028800_STENCILZFAIL(V_028800_STENCIL_INCR); - - bstates.dsa.states[R600_DSA__DB_STENCILREFMASK] = S_028430_STENCILWRITEMASK(0xff); - } - bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = S_028D0C_DEPTH_COPY_ENABLE(1) | - S_028D0C_STENCIL_COPY_ENABLE(1) | - S_028D0C_COPY_CENTROID(1); - - bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x00000003; - r600_blit_state_cb_flush(rscreen, &bstates.cb_flush, rtexture, 0, 0); - r600_blit_state_db_flush(rscreen, &bstates.db_flush, rtexture, 0, 0); - - /* force rebuild */ - bstates.dsa.cpm4 = bstates.cb_cntl.cpm4 = 0; - if (radeon_state_pm4(&bstates.dsa)) { - goto out; - } - if (radeon_state_pm4(&bstates.cb_cntl)) { - goto out; - } - - r = radeon_draw_init(&draw, rscreen->rw); - if (r) { - R600_ERR("failed creating draw for uncompressing textures\n"); - goto out; - } - - radeon_draw_bind(&draw, &bstates.vs_shader); - radeon_draw_bind(&draw, &bstates.ps_shader); - radeon_draw_bind(&draw, &bstates.rasterizer); - radeon_draw_bind(&draw, &bstates.dsa); - radeon_draw_bind(&draw, &bstates.blend); - radeon_draw_bind(&draw, &bstates.cb_cntl); - radeon_draw_bind(&draw, &rctx->config); - radeon_draw_bind(&draw, &bstates.vgt); - radeon_draw_bind(&draw, &bstates.draw); - radeon_draw_bind(&draw, &bstates.cb_flush); - radeon_draw_bind(&draw, &bstates.db_flush); - radeon_draw_bind(&draw, &bstates.vs_resource0); - radeon_draw_bind(&draw, &bstates.vs_resource1); - radeon_draw_bind(&draw, &bstates.vs_constant0); - radeon_draw_bind(&draw, &bstates.vs_constant1); - radeon_draw_bind(&draw, &bstates.vs_constant2); - radeon_draw_bind(&draw, &bstates.vs_constant3); - radeon_draw_bind(&draw, &rtexture->viewport[level]); - radeon_draw_bind(&draw, &rtexture->scissor[level]); - radeon_draw_bind(&draw, &rtexture->cb[0][level]); - radeon_draw_bind(&draw, &rtexture->db[level]); - - /* suspend queries */ - r600_queries_suspend(ctx); - - /* schedule draw*/ - r = radeon_ctx_set_draw(rctx->ctx, &draw); - if (r == -EBUSY) { - r600_flush(ctx, 0, NULL); - r = radeon_ctx_set_draw(rctx->ctx, &draw); - } - if (r) { - goto out; - } + family == CHIP_RV635) + depth = 0.0f; + + util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); /* resume queries */ r600_queries_resume(ctx); - -out: - r600_blit_states_destroy(ctx, &bstates); - return r; + return 0; } diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 18ff7936899..b9abff9dc10 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -125,11 +125,12 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) else rctx->vtbl = &r600_hw_state_vtbl; - r600_init_blit_functions(rctx); r600_init_query_functions(rctx); r600_init_state_functions(rctx); r600_init_context_resource_functions(rctx); + r600_init_blit_functions(rctx); + rctx->blitter = util_blitter_create(&rctx->context); if (rctx->blitter == NULL) { FREE(rctx); diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index 3107f189c78..8778f23a819 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -98,6 +98,7 @@ enum pipe_state_type { }; #define R600_MAX_RSTATE 16 +#define R600_STATE_FLAG_DSA_FLUSH 1 struct r600_context_state { union pipe_states state; @@ -107,6 +108,7 @@ struct r600_context_state { struct r600_shader shader; struct radeon_ws_bo *bo; unsigned nrstate; + unsigned flags; }; struct r600_vertex_element @@ -189,21 +191,6 @@ struct r600_context_hw_state_vtbl { int (*vs_shader)(struct r600_context *rctx, struct r600_context_state *rpshader, struct radeon_state *state); void (*init_config)(struct r600_context *rctx); - - - void (*texture_state_viewport)(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level); - void (*texture_state_cb)(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned cb, - unsigned level); - void (*texture_state_db)(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level); - void (*texture_state_scissor)(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level); }; extern struct r600_context_hw_state_vtbl r600_hw_state_vtbl; extern struct r600_context_hw_state_vtbl eg_hw_state_vtbl; @@ -257,6 +244,7 @@ struct r600_context { struct u_upload_mgr *upload_ib; bool any_user_vbs; + void *custom_dsa_flush; }; /* Convenience cast wrapper. */ diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 13b1124d90e..f3cb3b1ae0e 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -134,12 +134,14 @@ static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate, format = r600_translate_colorformat(rtex->resource.base.b.format); swap = r600_translate_colorswap(rtex->resource.base.b.format); + color_info = S_0280A0_FORMAT(format) | S_0280A0_COMP_SWAP(swap) | S_0280A0_BLEND_CLAMP(1) | - S_0280A0_SOURCE_FORMAT(1) | S_0280A0_NUMBER_TYPE(ntype); + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) + color_info |= S_0280A0_SOURCE_FORMAT(1); rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8; rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | @@ -386,14 +388,20 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) struct r600_query *rquery = NULL; boolean query_running; int i; + bool flush_db = FALSE; if (rctx->ps_shader == NULL) { return; } + if (rctx->dsa->flags & R600_STATE_FLAG_DSA_FLUSH) + flush_db = TRUE; + radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); - db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(1) | - S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); + db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); + + if (!flush_db) + db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(1); rshader = &rctx->ps_shader->shader; if (rshader->uses_kill) @@ -441,8 +449,13 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) alpha_ref = fui(state->alpha.ref_value); } - db_render_control = S_028D0C_STENCIL_COMPRESS_DISABLE(1) | - S_028D0C_DEPTH_COMPRESS_DISABLE(1); + db_render_control = 0; + + if (flush_db) + db_render_control = S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1); + db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); @@ -545,7 +558,6 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4], array_mode = 0, tile_type = 0; - int r; rstate->cpm4 = 0; swizzle[0] = view->swizzle_r; @@ -566,17 +578,15 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); texture = (struct r600_resource_texture*)view->texture; rbuffer = &texture->resource; + if (texture->depth) { - r = r600_texture_from_depth(ctx, texture, view->first_level); - if (r) { - return; - } - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], texture->uncompressed); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], texture->uncompressed); - } else { - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); + r600_texture_depth_flush(ctx, view->texture); + rbuffer = &texture->flushed_depth_texture->resource; } + + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); + radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); + rstate->nbo = 2; rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; @@ -1077,164 +1087,6 @@ static int r600_vs_shader(struct r600_context *rctx, struct r600_context_state * return radeon_state_pm4(state); } -static void r600_texture_state_scissor(struct r600_screen *rscreen, - struct r600_resource_texture *rtexture, - unsigned level) -{ - struct radeon_state *rstate = &rtexture->scissor[level]; - enum radeon_family family; - - family = radeon_get_family(rscreen->rw); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0); - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF; - - if (family >= CHIP_RV770) - rstate->states[R600_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA; - - rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = 0x80000000; - rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = S_028244_BR_X(rtexture->width[level]) | S_028244_BR_Y(rtexture->height[level]); - rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = 0x80000000; - - radeon_state_pm4(rstate); -} - -static void r600_texture_state_cb(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) -{ - struct radeon_state *rstate; - struct r600_resource *rbuffer; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype; - const struct util_format_description *desc; - - rstate = &rtexture->cb[cb][level]; - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0); - rbuffer = &rtexture->resource; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - pitch = (rtexture->pitch[level] / rtexture->bpt) / 8 - 1; - slice = (rtexture->pitch[level] / rtexture->bpt) * rtexture->height[level] / 64 - 1; - ntype = 0; - desc = util_format_description(rbuffer->base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_0280A0_NUMBER_SRGB; - format = r600_translate_colorformat(rtexture->resource.base.b.format); - swap = r600_translate_colorswap(rtexture->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rtexture->uncompressed); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rtexture->uncompressed); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[2], rtexture->uncompressed); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 3; - color_info = 0; - } else { - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[2], rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[4] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 3; - color_info = S_0280A0_SOURCE_FORMAT(1); - } - color_info |= S_0280A0_FORMAT(format) | - S_0280A0_COMP_SWAP(swap) | - S_0280A0_BLEND_CLAMP(1) | - S_0280A0_NUMBER_TYPE(ntype); - rstate->states[R600_CB0__CB_COLOR0_BASE] = rtexture->offset[level] >> 8; - rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | - S_028060_SLICE_TILE_MAX(slice); - - radeon_state_pm4(rstate); -} - -static void r600_texture_state_db(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) -{ - struct radeon_state *rstate = &rtexture->db[level]; - struct r600_resource *rbuffer; - unsigned pitch, slice, format; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); - rbuffer = &rtexture->resource; - rtexture->tiled = 1; - rtexture->array_mode = 2; - rtexture->tile_type = 1; - rtexture->depth = 1; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - pitch = (rtexture->pitch[level] / rtexture->bpt) / 8 - 1; - slice = (rtexture->pitch[level] / rtexture->bpt) * rtexture->height[level] / 64 - 1; - format = r600_translate_dbformat(rbuffer->base.b.format); - rstate->states[R600_DB__DB_DEPTH_BASE] = rtexture->offset[level] >> 8; - rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtexture->array_mode) | - S_028010_FORMAT(format); - rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; - rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (rtexture->height[level] / 8) -1; - rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | - S_028000_SLICE_TILE_MAX(slice); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 1; - - radeon_state_pm4(rstate); -} - -static void r600_texture_state_viewport(struct r600_screen *rscreen, struct r600_resource_texture *rtexture, unsigned level) -{ - struct radeon_state *rstate = &rtexture->viewport[level]; - float width, height; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); - - width = rtexture->width[level] * 0.5; - height = rtexture->height[level] * 0.5; - - /* set states (most default value are 0 and struct already - * initialized to 0, thus avoid resetting them) - */ - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(width); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(width); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(height); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(height); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(0.0); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(1.0); - rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = - S_028818_VPORT_X_SCALE_ENA(1) | - S_028818_VPORT_X_OFFSET_ENA(1) | - S_028818_VPORT_Y_SCALE_ENA(1) | - S_028818_VPORT_Y_OFFSET_ENA(1) | - S_028818_VPORT_Z_SCALE_ENA(1) | - S_028818_VPORT_Z_OFFSET_ENA(1) | - S_028818_VTX_W0_FMT(1); - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = fui(1); - - radeon_state_pm4(rstate); -} - struct r600_context_hw_state_vtbl r600_hw_state_vtbl = { .blend = r600_blend, .ucp = r600_ucp, @@ -1254,10 +1106,6 @@ struct r600_context_hw_state_vtbl r600_hw_state_vtbl = { .vs_shader = r600_vs_shader, .ps_shader = r600_ps_shader, .init_config = r600_init_config, - .texture_state_viewport = r600_texture_state_viewport, - .texture_state_db = r600_texture_state_db, - .texture_state_cb = r600_texture_state_cb, - .texture_state_scissor = r600_texture_state_scissor, }; void r600_set_constant_buffer_file(struct pipe_context *ctx, diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 5d569106451..a24197c3c23 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -55,11 +55,7 @@ struct r600_resource_texture { unsigned tile_type; unsigned depth; unsigned dirty; - struct radeon_ws_bo *uncompressed; - struct radeon_state scissor[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state cb[8][PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state db[PIPE_MAX_TEXTURE_LEVELS]; - struct radeon_state viewport[PIPE_MAX_TEXTURE_LEVELS]; + struct r600_resource_texture *flushed_depth_texture; }; void r600_init_context_resource_functions(struct r600_context *r600); @@ -106,4 +102,6 @@ static INLINE boolean r600_buffer_is_user_buffer(struct pipe_resource *buffer) return r600_buffer(buffer)->user_buffer ? TRUE : FALSE; } +int r600_texture_depth_flush(struct pipe_context *ctx, + struct pipe_resource *texture); #endif diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h index 502444f03ac..4105bb7cf61 100644 --- a/src/gallium/drivers/r600/r600_screen.h +++ b/src/gallium/drivers/r600/r600_screen.h @@ -77,14 +77,9 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer); void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); -int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); -int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level); -int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); -int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); -int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); /* r600_blit.c */ -int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level); +int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture); /* helpers */ int r600_conv_pipe_format(unsigned pformat, unsigned *format); diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 37822903e82..b0d3b28c720 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -136,19 +136,6 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, return &resource->base.b; } -static void r600_texture_destroy_state(struct pipe_resource *ptexture) -{ - struct r600_resource_texture *rtexture = (struct r600_resource_texture*)ptexture; - - for (int i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) { - radeon_state_fini(&rtexture->scissor[i]); - radeon_state_fini(&rtexture->db[i]); - for (int j = 0; j < 8; j++) { - radeon_state_fini(&rtexture->cb[j][i]); - } - } -} - static void r600_texture_destroy(struct pipe_screen *screen, struct pipe_resource *ptex) { @@ -156,13 +143,12 @@ static void r600_texture_destroy(struct pipe_screen *screen, struct r600_resource *resource = &rtex->resource; struct radeon *radeon = (struct radeon *)screen->winsys; + if (rtex->flushed_depth_texture) + pipe_resource_reference(&rtex->flushed_depth_texture, NULL); + if (resource->bo) { radeon_ws_bo_reference(radeon, &resource->bo, NULL); } - if (rtex->uncompressed) { - radeon_ws_bo_reference(radeon, &rtex->uncompressed, NULL); - } - r600_texture_destroy_state(ptex); FREE(rtex); } @@ -248,6 +234,39 @@ static unsigned int r600_texture_is_referenced(struct pipe_context *context, return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } +int r600_texture_depth_flush(struct pipe_context *ctx, + struct pipe_resource *texture) +{ + struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; + struct pipe_resource resource; + + if (rtex->flushed_depth_texture) + goto out; + + resource.target = PIPE_TEXTURE_2D; + resource.format = texture->format; + resource.width0 = texture->width0; + resource.height0 = texture->height0; + resource.depth0 = 0; + resource.last_level = 0; + resource.nr_samples = 0; + resource.usage = PIPE_USAGE_DYNAMIC; + resource.bind = 0; + resource.flags = 0; + + resource.bind |= PIPE_BIND_RENDER_TARGET; + + rtex->flushed_depth_texture = ctx->screen->resource_create(ctx->screen, &resource); + if (rtex->flushed_depth_texture == NULL) { + R600_ERR("failed to create temporary texture to hold untiled copy\n"); + return -ENOMEM; + } + +out: + r600_blit_uncompress_depth(ctx, rtex); + return 0; +} + struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, struct pipe_resource *texture, struct pipe_subresource sr, @@ -257,6 +276,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; struct pipe_resource resource; struct r600_transfer *trans; + int r; trans = CALLOC_STRUCT(r600_transfer); if (trans == NULL) @@ -267,7 +287,15 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, trans->transfer.box = *box; trans->transfer.stride = rtex->pitch[sr.level]; trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face); - if (rtex->tiled && !rtex->depth) { + if (rtex->depth) { + r = r600_texture_depth_flush(ctx, texture); + if (r < 0) { + R600_ERR("failed to create temporary texture to hold untiled copy\n"); + pipe_resource_reference(&trans->transfer.resource, NULL); + FREE(trans); + return NULL; + } + } else if (rtex->tiled) { resource.target = PIPE_TEXTURE_2D; resource.format = texture->format; resource.width0 = box->width; @@ -311,10 +339,17 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; + struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; if (rtransfer->linear_texture) { pipe_resource_reference(&rtransfer->linear_texture, NULL); } + if (rtex->flushed_depth_texture) { + if (transfer->usage & PIPE_TRANSFER_WRITE) { + // TODO + } + pipe_resource_reference(&rtex->flushed_depth_texture, NULL); + } pipe_resource_reference(&transfer->resource, NULL); FREE(transfer); } @@ -326,25 +361,19 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, struct radeon_ws_bo *bo; enum pipe_format format = transfer->resource->format; struct radeon *radeon = (struct radeon *)ctx->screen->winsys; - struct r600_resource_texture *rtex; unsigned long offset = 0; char *map; - int r; if (rtransfer->linear_texture) { bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; } else { - rtex = (struct r600_resource_texture*)transfer->resource; - if (rtex->depth && radeon_get_family_class(radeon) != EVERGREEN) { - r = r600_texture_from_depth(ctx, rtex, transfer->sr.level); - if (r) { - return NULL; - } - r600_flush(ctx, 0, NULL); - bo = rtex->uncompressed; - } else { + struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; + + if (rtex->flushed_depth_texture) + bo = ((struct r600_resource *)rtex->flushed_depth_texture)->bo; + else bo = ((struct r600_resource *)transfer->resource)->bo; - } + offset = rtransfer->offset + transfer->box.y / util_format_get_blockheight(format) * transfer->stride + transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); @@ -362,15 +391,15 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct radeon *radeon = (struct radeon *)ctx->screen->winsys; - struct r600_resource_texture *rtex; struct radeon_ws_bo *bo; if (rtransfer->linear_texture) { bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; } else { - rtex = (struct r600_resource_texture*)transfer->resource; - if (rtex->depth) { - bo = rtex->uncompressed; + struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; + + if (rtex->flushed_depth_texture) { + bo = ((struct r600_resource *)rtex->flushed_depth_texture)->bo; } else { bo = ((struct r600_resource *)transfer->resource)->bo; } @@ -644,74 +673,3 @@ out_unknown: // R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format)); return ~0; } - -int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - int r; - - /* TODO possible dirty handling */ - - /* allocate uncompressed texture */ - if (rtexture->uncompressed == NULL) { - rtexture->uncompressed = radeon_ws_bo(rscreen->rw, rtexture->size, 4096, 0); - if (rtexture->uncompressed == NULL) { - return -ENOMEM; - } - } - - /* render a rectangle covering whole buffer to uncompress depth */ - r = r600_blit_uncompress_depth(ctx, rtexture, level); - if (r) { - return r; - } - - rtexture->dirty = 0; - return 0; -} - - - -int r600_texture_scissor(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - - if (!rtexture->scissor[level].cpm4) { - rctx->vtbl->texture_state_scissor(rscreen, rtexture, level); - } - return 0; -} - -int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - - if (!rtexture->cb[cb][level].cpm4) { - rctx->vtbl->texture_state_cb(rscreen, rtexture, cb, level); - } - return 0; -} - -int r600_texture_db(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - - if (!rtexture->db[level].cpm4) { - rctx->vtbl->texture_state_db(rscreen, rtexture, level); - } - return 0; -} - -int r600_texture_viewport(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - - if (!rtexture->viewport[level].cpm4) { - rctx->vtbl->texture_state_viewport(rscreen, rtexture, level); - } - return 0; -} -- cgit v1.2.3 From 6547a82df185e1786e2313cfc4eb254f0a59f5aa Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 16:02:54 +1000 Subject: r600g: fix warnings since last commit. --- src/gallium/drivers/r600/r600_texture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index b0d3b28c720..16468c9b1a9 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -144,7 +144,7 @@ static void r600_texture_destroy(struct pipe_screen *screen, struct radeon *radeon = (struct radeon *)screen->winsys; if (rtex->flushed_depth_texture) - pipe_resource_reference(&rtex->flushed_depth_texture, NULL); + pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL); if (resource->bo) { radeon_ws_bo_reference(radeon, &resource->bo, NULL); @@ -256,7 +256,7 @@ int r600_texture_depth_flush(struct pipe_context *ctx, resource.bind |= PIPE_BIND_RENDER_TARGET; - rtex->flushed_depth_texture = ctx->screen->resource_create(ctx->screen, &resource); + rtex->flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource); if (rtex->flushed_depth_texture == NULL) { R600_ERR("failed to create temporary texture to hold untiled copy\n"); return -ENOMEM; @@ -348,7 +348,7 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx, if (transfer->usage & PIPE_TRANSFER_WRITE) { // TODO } - pipe_resource_reference(&rtex->flushed_depth_texture, NULL); + pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL); } pipe_resource_reference(&transfer->resource, NULL); FREE(transfer); -- cgit v1.2.3 From ada1d91c15e05b55829d61d04879faeea98474e9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 16:12:23 +1000 Subject: egl: fix build since 17eace581d25a626a7d75d9d1205d012cbb14a6e looks like mesa st didn't get updated. --- src/mesa/state_tracker/st_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 450b0453cf4..66e32b4c9e8 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -794,7 +794,7 @@ st_manager_get_egl_image_surface(struct st_context *st, return NULL; memset(&stimg, 0, sizeof(stimg)); - if (!smapi->get_egl_image(smapi, &st->iface, eglimg, &stimg)) + if (!smapi->get_egl_image(smapi, eglimg, &stimg)) return NULL; ps = smapi->screen->get_tex_surface(smapi->screen, -- cgit v1.2.3 From 17ad9972f4b998dbf1a046780b6bde461d721dd0 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 03:35:50 +0200 Subject: d3d1x: fix deadlocks on non-recursive mutex --- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 032cb0ea841..7e49c3a2c5e 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -901,7 +901,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl void set_clip() { - SYNCHRONIZED; pipe_clip_state clip; clip.nr = 0; clip.depth_clamp = depth_clamp; @@ -1588,7 +1587,7 @@ changed: } #endif - virtual void STDMETHODCALLTYPE RestoreGalliumStateBlitOnly() + void restore_gallium_state_blit_only() { pipe->bind_blend_state(pipe, blend_state.p ? blend_state.p->object : default_blend); pipe->bind_depth_stencil_alpha_state(pipe, depth_stencil_state.p ? depth_stencil_state.p->object : default_depth_stencil); @@ -1607,6 +1606,12 @@ changed: update_flags |= UPDATE_VERTEX_BUFFERS | (1 << (UPDATE_SAMPLERS_SHIFT + D3D11_STAGE_PS)) | (1 << (UPDATE_VIEWS_SHIFT + D3D11_STAGE_PS)); } + virtual void STDMETHODCALLTYPE RestoreGalliumStateBlitOnly() + { + SYNCHRONIZED; + restore_gallium_state_blit_only(); + } + virtual void STDMETHODCALLTYPE GenerateMips( __in ID3D11ShaderResourceView *pShaderResourceView) { @@ -1620,13 +1625,13 @@ changed: if(pipe->render_condition) pipe->render_condition(pipe, 0, 0); util_gen_mipmap(gen_mipmap, view->object, 0, 0, view->object->texture->last_level, PIPE_TEX_FILTER_LINEAR); - RestoreGalliumStateBlitOnly(); + restore_gallium_state_blit_only(); } virtual void STDMETHODCALLTYPE RestoreGalliumState() { SYNCHRONIZED; - RestoreGalliumStateBlitOnly(); + restore_gallium_state_blit_only(); set_index_buffer(); set_stencil_ref(); @@ -1707,7 +1712,12 @@ changed: virtual void STDMETHODCALLTYPE ClearState(void) { - SYNCHRONIZED; + /* we don't take a lock here because we would deadlock otherwise + * TODO: this is probably incorrect, because ClearState should likely be atomic. + * However, I can't think of any correct usage that would be affected by this + * being non-atomic, and making this atomic is quite expensive and complicates + * the code + */ // we qualify all calls so that we avoid virtual dispatch and might get them inlined // TODO: make sure all this gets inlined, which might require more compiler flags -- cgit v1.2.3 From 1b15a3cafdc699c63466059d56f36b295475ee9e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 03:49:17 +0200 Subject: d3d1x: bind NULL CSOs before destroying default CSOs on context dtor Otherwise softpipe and llvmpipe assert. --- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 7e49c3a2c5e..3c789d3af05 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -267,14 +267,32 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl { util_destroy_gen_mipmap(gen_mipmap); cso_destroy_context(cso_ctx); + + pipe->bind_vertex_elements_state(pipe, 0); pipe->delete_vertex_elements_state(pipe, default_input_layout); + + pipe->bind_rasterizer_state(pipe, 0); pipe->delete_rasterizer_state(pipe, default_rasterizer); + + pipe->bind_depth_stencil_alpha_state(pipe, 0); pipe->delete_depth_stencil_alpha_state(pipe, default_depth_stencil); + + pipe->bind_blend_state(pipe, 0); pipe->delete_blend_state(pipe, default_blend); + + pipe->bind_fragment_sampler_states(pipe, 0, 0); + pipe->bind_vertex_sampler_states(pipe, 0, 0); + if(pipe->bind_geometry_sampler_states) + pipe->bind_geometry_sampler_states(pipe, 0, 0); pipe->delete_sampler_state(pipe, default_sampler); pipe->delete_sampler_state(pipe, ld_sampler); + + pipe->bind_fs_state(pipe, 0); pipe->delete_fs_state(pipe, default_shaders[PIPE_SHADER_FRAGMENT]); + + pipe->bind_vs_state(pipe, 0); pipe->delete_vs_state(pipe, default_shaders[PIPE_SHADER_VERTEX]); + if(owns_pipe) pipe->destroy(pipe); } -- cgit v1.2.3 From 8b597b4ea4290301bd97587db5389f151cb5f25f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 23 Sep 2010 16:11:17 +0100 Subject: draw: don't apply flatshading to clipped tris with <3 verts If a triangle was completely culled by clipping, we would still try to fix up its provoking vertex. --- src/gallium/auxiliary/draw/draw_pipe_clip.c | 35 +++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 8a3d499febb..50acc6caedc 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -321,27 +321,28 @@ do_clip_tri( struct draw_stage *stage, /* If flat-shading, copy provoking vertex color to polygon vertex[0] */ - if (clipper->flat) { - if (stage->draw->rasterizer->flatshade_first) { - if (inlist[0] != header->v[0]) { - assert(tmpnr < MAX_CLIPPED_VERTICES + 1); - inlist[0] = dup_vert(stage, inlist[0], tmpnr++); - copy_colors(stage, inlist[0], header->v[0]); + if (n >= 3) { + if (clipper->flat) { + if (stage->draw->rasterizer->flatshade_first) { + if (inlist[0] != header->v[0]) { + assert(tmpnr < MAX_CLIPPED_VERTICES + 1); + inlist[0] = dup_vert(stage, inlist[0], tmpnr++); + copy_colors(stage, inlist[0], header->v[0]); + } } - } - else { - if (inlist[0] != header->v[2]) { - assert(tmpnr < MAX_CLIPPED_VERTICES + 1); - inlist[0] = dup_vert(stage, inlist[0], tmpnr++); - copy_colors(stage, inlist[0], header->v[2]); + else { + if (inlist[0] != header->v[2]) { + assert(tmpnr < MAX_CLIPPED_VERTICES + 1); + inlist[0] = dup_vert(stage, inlist[0], tmpnr++); + copy_colors(stage, inlist[0], header->v[2]); + } } } - } - - /* Emit the polygon as triangles to the setup stage: - */ - if (n >= 3) + + /* Emit the polygon as triangles to the setup stage: + */ emit_poly( stage, inlist, n, header ); + } } -- cgit v1.2.3 From 440129521c36bc2c2e59c462a94394b2f42a847e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 15:30:51 +0100 Subject: draw: Prevent clipped vertices overflow. Some pathological triangles cause a theoritically impossible number of clipped vertices. The clipper will still assert, but at least release builds will not crash, while this problem is further investigated. --- src/gallium/auxiliary/draw/draw_pipe_clip.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 50acc6caedc..a10d8e9edc0 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -263,6 +263,8 @@ do_clip_tri( struct draw_stage *stage, clipmask &= ~(1<= MAX_CLIPPED_VERTICES) + return; inlist[n] = inlist[0]; /* prevent rotation of vertices */ for (i = 1; i <= n; i++) { @@ -272,16 +274,22 @@ do_clip_tri( struct draw_stage *stage, if (!IS_NEGATIVE(dp_prev)) { assert(outcount < MAX_CLIPPED_VERTICES); + if (outcount >= MAX_CLIPPED_VERTICES) + return; outlist[outcount++] = vert_prev; } if (DIFFERENT_SIGNS(dp, dp_prev)) { struct vertex_header *new_vert; - assert(tmpnr < MAX_CLIPPED_VERTICES+1); + assert(tmpnr < MAX_CLIPPED_VERTICES + 1); + if (tmpnr >= MAX_CLIPPED_VERTICES + 1) + return; new_vert = clipper->stage.tmp[tmpnr++]; assert(outcount < MAX_CLIPPED_VERTICES); + if (outcount >= MAX_CLIPPED_VERTICES) + return; outlist[outcount++] = new_vert; if (IS_NEGATIVE(dp)) { @@ -326,6 +334,8 @@ do_clip_tri( struct draw_stage *stage, if (stage->draw->rasterizer->flatshade_first) { if (inlist[0] != header->v[0]) { assert(tmpnr < MAX_CLIPPED_VERTICES + 1); + if (tmpnr >= MAX_CLIPPED_VERTICES + 1) + return; inlist[0] = dup_vert(stage, inlist[0], tmpnr++); copy_colors(stage, inlist[0], header->v[0]); } @@ -333,6 +343,8 @@ do_clip_tri( struct draw_stage *stage, else { if (inlist[0] != header->v[2]) { assert(tmpnr < MAX_CLIPPED_VERTICES + 1); + if (tmpnr >= MAX_CLIPPED_VERTICES + 1) + return; inlist[0] = dup_vert(stage, inlist[0], tmpnr++); copy_colors(stage, inlist[0], header->v[2]); } -- cgit v1.2.3 From 22762012d1ab4060d8274c1007067c80bb8e806c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 11:58:09 +0200 Subject: d3d1x: initialize the mutex --- src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 7627720148d..974518a5ce3 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -675,6 +675,11 @@ struct maybe_mutex_t { pipe_mutex mutex; + maybe_mutex_t() + { + pipe_mutex_init(mutex); + } + void lock() { pipe_mutex_lock(mutex); -- cgit v1.2.3 From 75c29fe1c853d5d5e7be6af3187a4d4e36832f5b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 13:17:45 +0200 Subject: d3d1x: autogenerate shader enums and text from def files This avoids the duplication in tpf.h and tpf_text.cpp --- .../state_trackers/d3d1x/d3d1xshader/Makefile | 6 + .../d3d1x/d3d1xshader/defs/files.txt | 41 +++ .../d3d1x/d3d1xshader/defs/interpolations.txt | 8 + .../d3d1x/d3d1xshader/defs/opcodes.txt | 207 +++++++++++ .../d3d1x/d3d1xshader/defs/operand_compnums.txt | 5 + .../d3d1x/d3d1xshader/defs/operand_index_reprs.txt | 5 + .../d3d1x/d3d1xshader/defs/operand_modes.txt | 4 + .../d3d1x/d3d1xshader/defs/shortfiles.txt | 41 +++ .../state_trackers/d3d1x/d3d1xshader/defs/svs.txt | 23 ++ .../d3d1x/d3d1xshader/defs/targets.txt | 13 + .../defs/token_instruction_extended_types.txt | 4 + .../defs/token_operand_extended_types.txt | 2 + .../state_trackers/d3d1x/d3d1xshader/gen-header.sh | 13 + .../state_trackers/d3d1x/d3d1xshader/gen-text.sh | 11 + .../state_trackers/d3d1x/d3d1xshader/include/tpf.h | 404 +-------------------- .../d3d1x/d3d1xshader/src/tpf_parse.cpp | 10 +- .../d3d1x/d3d1xshader/src/tpf_text.cpp | 385 -------------------- 17 files changed, 390 insertions(+), 792 deletions(-) create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt create mode 100755 src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh create mode 100755 src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh delete mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 8c8e2fb445f..866762e1bb4 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile @@ -5,3 +5,9 @@ PROGS=tools/fxdis LIBS=libd3d1xshader.a include ../Makefile.inc + +include/tpf_defs.h: $(wildcard defs/*.txt) + ./gen-header.sh $^ > $@ + +src/tpf_text.cpp: $(wildcard defs/*.txt) + ./gen-text.sh $^ > $@ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt new file mode 100644 index 00000000000..c44a46beed5 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt @@ -0,0 +1,41 @@ +temp +input +output +indexable_temp +immediate32 +immediate64 +sampler +resource +constant_buffer +immediate_constant_buffer +label +input_primitiveid +output_depth +null +rasterizer +output_coverage_mask +stream +function_body +function_table +interface +function_input +function_output +output_control_point_id +input_fork_instance_id +input_join_instance_id +input_control_point +output_control_point +input_patch_constant +input_domain_point +this_pointer +unordered_access_view +thread_group_shared_memory +input_thread_id +input_thread_group_id +input_thread_id_in_group +input_coverage_mask +input_thread_id_in_group_flattened +input_gs_instance_id +output_depth_greater_equal +output_depth_less_equal +cycle_counter diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt new file mode 100644 index 00000000000..4e52eec34f4 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt @@ -0,0 +1,8 @@ +undefined +constant +linear +linear centroid +linear noperspective +linear noperspective centroid +linear sample +linear noperspective sample diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt new file mode 100644 index 00000000000..46ff28d6f9c --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt @@ -0,0 +1,207 @@ +add +and +break +breakc +call +callc +case +continue +continuec +cut +default +deriv_rtx +deriv_rty +discard +div +dp2 +dp3 +dp4 +else +emit +emitthencut +endif +endloop +endswitch +eq +exp +frc +ftoi +ftou +ge +iadd +if +ieq +ige +ilt +imad +imax +imin +imul +ine +ineg +ishl +ishr +itof +label +ld +ld_ms +log +loop +lt +mad +min +max +customdata +mov +movc +mul +ne +nop +not +or +resinfo +ret +retc +round_ne +round_ni +round_pi +round_z +rsq +sample +sample_c +sample_c_lz +sample_l +sample_d +sample_b +sqrt +switch +sincos +udiv +ult +uge +umul +umad +umax +umin +ushr +utof +xor +dcl_resource +dcl_constant_buffer +dcl_sampler +dcl_index_range +dcl_gs_output_primitive_topology +dcl_gs_input_primitive +dcl_max_output_vertex_count +dcl_input +dcl_input_sgv +dcl_input_siv +dcl_input_ps +dcl_input_ps_sgv +dcl_input_ps_siv +dcl_output +dcl_output_sgv +dcl_output_siv +dcl_temps +dcl_indexable_temp +dcl_global_flags +d3d10_count +lod +gather4 +sample_pos +sample_info +d3d10_1_count +hs_decls +hs_control_point_phase +hs_fork_phase +hs_join_phase +emit_stream +cut_stream +emitthencut_stream +interface_call +bufinfo +deriv_rtx_coarse +deriv_rtx_fine +deriv_rty_coarse +deriv_rty_fine +gather4_c +gather4_po +gather4_po_c +rcp +f32tof16 +f16tof32 +uaddc +usubb +countbits +firstbit_hi +firstbit_lo +firstbit_shi +ubfe +ibfe +bfi +bfrev +swapc +dcl_stream +dcl_function_body +dcl_function_table +dcl_interface +dcl_input_control_point_count +dcl_output_control_point_count +dcl_tess_domain +dcl_tess_partitioning +dcl_tess_output_primitive +dcl_hs_max_tessfactor +dcl_hs_fork_phase_instance_count +dcl_hs_join_phase_instance_count +dcl_thread_group +dcl_unordered_access_view_typed +dcl_unordered_access_view_raw +dcl_unordered_access_view_structured +dcl_thread_group_shared_memory_raw +dcl_thread_group_shared_memory_structured +dcl_resource_raw +dcl_resource_structured +ld_uav_typed +store_uav_typed +ld_raw +store_raw +ld_structured +store_structured +atomic_and +atomic_or +atomic_xor +atomic_cmp_store +atomic_iadd +atomic_imax +atomic_imin +atomic_umax +atomic_umin +imm_atomic_alloc +imm_atomic_consume +imm_atomic_iadd +imm_atomic_and +imm_atomic_or +imm_atomic_xor +imm_atomic_exch +imm_atomic_cmp_exch +imm_atomic_imax +imm_atomic_imin +imm_atomic_umax +imm_atomic_umin +sync +dadd +dmax +dmin +dmul +deq +dge +dlt +dne +dmov +dmovc +dtof +ftod +eval_snapped +eval_sample_index +eval_centroid +dcl_gs_instance_count diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt new file mode 100644 index 00000000000..887df2b141a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt @@ -0,0 +1,5 @@ +0 +1 +4 +n + diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt new file mode 100644 index 00000000000..f1ce172aaf1 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt @@ -0,0 +1,5 @@ +imm32 +imm64 +reg +reg_imm32 +reg_imm64 diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt new file mode 100644 index 00000000000..4088957e989 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt @@ -0,0 +1,4 @@ +mask +swizzle +scalar + diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt new file mode 100644 index 00000000000..9e2d303ccd9 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt @@ -0,0 +1,41 @@ +r +v +o +x +l +d +sampler +resource +cb +icb +label +vPrim +oDepth +null +rasterizer +oMask +stream +function_body +function_table +interface +function_input +function_output +vOutputControlPointID +vForkInstanceID +vJoinInstanceID +vicp +vocp +input_patch_constant +vDomain +this +u +g +vThreadID +vThreadGrouID +vThreadIDInGroup +vCoverage +vThreadIDInGroupFlattened +vGSInstanceID +oDepthGE +oDepthLE +vCycleCounter diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt new file mode 100644 index 00000000000..c7148ec301a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt @@ -0,0 +1,23 @@ +undefined +position +clip_distance +cull_distance +render_target_array_index +viewport_array_index +vertex_id +primitive_id +instance_id +is_front_face +sample_index +final_quad_u_eq_0_edge_tessfactor +final_quad_v_eq_0_edge_tessfactor +final_quad_u_eq_1_edge_tessfactor +final_quad_v_eq_1_edge_tessfactor +final_quad_u_inside_tessfactor +final_quad_v_inside_tessfactor +final_tri_u_eq_0_edge_tessfactor +final_tri_v_eq_0_edge_tessfactor +final_tri_w_eq_0_edge_tessfactor +final_tri_inside_tessfactor +final_line_detail_tessfactor +final_line_density_tessfactor diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt new file mode 100644 index 00000000000..d3bc186c54d --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt @@ -0,0 +1,13 @@ +unknown +buffer +texture1d +texture2d +texture2dms +texture3d +texturecube +texture1darray +texture2darray +texture2dmsarray +texturecubearray +raw_buffer +structured_buffer diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt new file mode 100644 index 00000000000..e8fd70c4808 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt @@ -0,0 +1,4 @@ +empty +sample_controls +resource_dim +resource_return_type diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt new file mode 100644 index 00000000000..891fcafa67a --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt @@ -0,0 +1,2 @@ +empty +modifier diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh new file mode 100755 index 00000000000..558794f1d25 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh @@ -0,0 +1,13 @@ +#!/bin/bash +for i in "$@"; do + n=$(basename "$i" .txt|sed -e 's/s$//') + if test "$n" == "shortfile"; then continue; fi + echo "enum tpf_$n" + echo "{" + while read j; do + echo $'\t'"TPF_${n}_$j", + done < "$i" |tr '[a-z]' '[A-Z]'|tr ' ' '_' + echo $'\t'"TPF_${n}_COUNT"|tr '[a-z]' '[A-Z]' + echo "};" + echo +done diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh new file mode 100755 index 00000000000..b31e16e19c9 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh @@ -0,0 +1,11 @@ +#!/bin/bash +for i in "$@"; do + n=$(basename "$i" .txt|sed -e 's/s$//') + echo "const char* tpf_${n}_names[] =" + echo "{" + while read j; do + echo $'\t'"\"$j\"", + done < "$i" + echo "};" + echo +done diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h index 2761b794d59..6ab9b820e8f 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h @@ -36,376 +36,13 @@ #include #include "le32.h" -/* This is an independent implementation of definitions and tools for the - * "tokenized program format" (TPF) bytecode documented in the - * d3d11TokenizedProgramFormat.hpp header in the Windows Driver Development kit - */ - -enum tpf_opcode { - // Shader Model 4.0 (Direct3D 10.0) - - TPF_OPCODE_ADD, - TPF_OPCODE_AND, - TPF_OPCODE_BREAK, - TPF_OPCODE_BREAKC, - TPF_OPCODE_CALL, - TPF_OPCODE_CALLC, - TPF_OPCODE_CASE, - TPF_OPCODE_CONTINUE, - TPF_OPCODE_CONTINUEC, - TPF_OPCODE_CUT, - TPF_OPCODE_DEFAULT, - TPF_OPCODE_DERIV_RTX, - TPF_OPCODE_DERIV_RTY, - TPF_OPCODE_DISCARD, - TPF_OPCODE_DIV, - TPF_OPCODE_DP2, - TPF_OPCODE_DP3, - TPF_OPCODE_DP4, - TPF_OPCODE_ELSE, - TPF_OPCODE_EMIT, - TPF_OPCODE_EMITTHENCUT, - TPF_OPCODE_ENDIF, - TPF_OPCODE_ENDLOOP, - TPF_OPCODE_ENDSWITCH, - TPF_OPCODE_EQ, - TPF_OPCODE_EXP, - TPF_OPCODE_FRC, - TPF_OPCODE_FTOI, - TPF_OPCODE_FTOU, - TPF_OPCODE_GE, - TPF_OPCODE_IADD, - TPF_OPCODE_IF, - TPF_OPCODE_IEQ, - TPF_OPCODE_IGE, - TPF_OPCODE_ILT, - TPF_OPCODE_IMAD, - TPF_OPCODE_IMAX, - TPF_OPCODE_IMIN, - TPF_OPCODE_IMUL, - TPF_OPCODE_INE, - TPF_OPCODE_INEG, - TPF_OPCODE_ISHL, - TPF_OPCODE_ISHR, - TPF_OPCODE_ITOF, - TPF_OPCODE_LABEL, - TPF_OPCODE_LD, - TPF_OPCODE_LD_MS, - TPF_OPCODE_LOG, - TPF_OPCODE_LOOP, - TPF_OPCODE_LT, - TPF_OPCODE_MAD, - TPF_OPCODE_MIN, - TPF_OPCODE_MAX, - TPF_OPCODE_CUSTOMDATA, - TPF_OPCODE_MOV, - TPF_OPCODE_MOVC, - TPF_OPCODE_MUL, - TPF_OPCODE_NE, - TPF_OPCODE_NOP, - TPF_OPCODE_NOT, - TPF_OPCODE_OR, - TPF_OPCODE_RESINFO, - TPF_OPCODE_RET, - TPF_OPCODE_RETC, - TPF_OPCODE_ROUND_NE, - TPF_OPCODE_ROUND_NI, - TPF_OPCODE_ROUND_PI, - TPF_OPCODE_ROUND_Z, - TPF_OPCODE_RSQ, - TPF_OPCODE_SAMPLE, - TPF_OPCODE_SAMPLE_C, - TPF_OPCODE_SAMPLE_C_LZ, - TPF_OPCODE_SAMPLE_L, - TPF_OPCODE_SAMPLE_D, - TPF_OPCODE_SAMPLE_B, - TPF_OPCODE_SQRT, - TPF_OPCODE_SWITCH, - TPF_OPCODE_SINCOS, - TPF_OPCODE_UDIV, - TPF_OPCODE_ULT, - TPF_OPCODE_UGE, - TPF_OPCODE_UMUL, - TPF_OPCODE_UMAD, - TPF_OPCODE_UMAX, - TPF_OPCODE_UMIN, - TPF_OPCODE_USHR, - TPF_OPCODE_UTOF, - TPF_OPCODE_XOR, - - // these have custom formats - TPF_OPCODE_DCL_RESOURCE, - TPF_OPCODE_DCL_CONSTANT_BUFFER, - TPF_OPCODE_DCL_SAMPLER, - TPF_OPCODE_DCL_INDEX_RANGE, - TPF_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY, - TPF_OPCODE_DCL_GS_INPUT_PRIMITIVE, - TPF_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT, - TPF_OPCODE_DCL_INPUT, - TPF_OPCODE_DCL_INPUT_SGV, - TPF_OPCODE_DCL_INPUT_SIV, - TPF_OPCODE_DCL_INPUT_PS, - TPF_OPCODE_DCL_INPUT_PS_SGV, - TPF_OPCODE_DCL_INPUT_PS_SIV, - TPF_OPCODE_DCL_OUTPUT, - TPF_OPCODE_DCL_OUTPUT_SGV, - TPF_OPCODE_DCL_OUTPUT_SIV, - TPF_OPCODE_DCL_TEMPS, - TPF_OPCODE_DCL_INDEXABLE_TEMP, - TPF_OPCODE_DCL_GLOBAL_FLAGS, - - TPF_OPCODE_D3D10_COUNT, // this is really a reserved opcode... - - // Shader Model 4.1 (Direct3D 10.1) - - TPF_OPCODE_LOD, - TPF_OPCODE_GATHER4, - TPF_OPCODE_SAMPLE_POS, - TPF_OPCODE_SAMPLE_INFO, - - TPF_OPCODE_D3D10_1_COUNT, // this is really a reserved opcode... - - // Shader Model 5.0 (Direct3D 11) - - // HS subshader beginning markers - TPF_OPCODE_HS_DECLS, - TPF_OPCODE_HS_CONTROL_POINT_PHASE, - TPF_OPCODE_HS_FORK_PHASE, - TPF_OPCODE_HS_JOIN_PHASE, - - TPF_OPCODE_EMIT_STREAM, - TPF_OPCODE_CUT_STREAM, - TPF_OPCODE_EMITTHENCUT_STREAM, - TPF_OPCODE_INTERFACE_CALL, - - TPF_OPCODE_BUFINFO, - TPF_OPCODE_DERIV_RTX_COARSE, - TPF_OPCODE_DERIV_RTX_FINE, - TPF_OPCODE_DERIV_RTY_COARSE, - TPF_OPCODE_DERIV_RTY_FINE, - TPF_OPCODE_GATHER4_C, - TPF_OPCODE_GATHER4_PO, - TPF_OPCODE_GATHER4_PO_C, - TPF_OPCODE_RCP, - TPF_OPCODE_F32TOF16, - TPF_OPCODE_F16TOF32, - TPF_OPCODE_UADDC, - TPF_OPCODE_USUBB, - TPF_OPCODE_COUNTBITS, - TPF_OPCODE_FIRSTBIT_HI, - TPF_OPCODE_FIRSTBIT_LO, - TPF_OPCODE_FIRSTBIT_SHI, - TPF_OPCODE_UBFE, - TPF_OPCODE_IBFE, - TPF_OPCODE_BFI, - TPF_OPCODE_BFREV, - TPF_OPCODE_SWAPC, - - // these have custom formats - TPF_OPCODE_DCL_STREAM, - TPF_OPCODE_DCL_FUNCTION_BODY, - TPF_OPCODE_DCL_FUNCTION_TABLE, - TPF_OPCODE_DCL_INTERFACE, - - // these have custom formats - TPF_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT, - TPF_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT, - TPF_OPCODE_DCL_TESS_DOMAIN, - TPF_OPCODE_DCL_TESS_PARTITIONING, - TPF_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE, - TPF_OPCODE_DCL_HS_MAX_TESSFACTOR, - TPF_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT, - TPF_OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT, - - // these have custom formats - TPF_OPCODE_DCL_THREAD_GROUP, - TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED, - TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW, - TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED, - TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW, - TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED, - TPF_OPCODE_DCL_RESOURCE_RAW, - TPF_OPCODE_DCL_RESOURCE_STRUCTURED, - - TPF_OPCODE_LD_UAV_TYPED, - TPF_OPCODE_STORE_UAV_TYPED, - TPF_OPCODE_LD_RAW, - TPF_OPCODE_STORE_RAW, - TPF_OPCODE_LD_STRUCTURED, - TPF_OPCODE_STORE_STRUCTURED, - - TPF_OPCODE_ATOMIC_AND, - TPF_OPCODE_ATOMIC_OR, - TPF_OPCODE_ATOMIC_XOR, - TPF_OPCODE_ATOMIC_CMP_STORE, - TPF_OPCODE_ATOMIC_IADD, - TPF_OPCODE_ATOMIC_IMAX, - TPF_OPCODE_ATOMIC_IMIN, - TPF_OPCODE_ATOMIC_UMAX, - TPF_OPCODE_ATOMIC_UMIN, - - TPF_OPCODE_IMM_ATOMIC_ALLOC, - TPF_OPCODE_IMM_ATOMIC_CONSUME, - TPF_OPCODE_IMM_ATOMIC_IADD, - TPF_OPCODE_IMM_ATOMIC_AND, - TPF_OPCODE_IMM_ATOMIC_OR, - TPF_OPCODE_IMM_ATOMIC_XOR, - TPF_OPCODE_IMM_ATOMIC_EXCH, - TPF_OPCODE_IMM_ATOMIC_CMP_EXCH, - TPF_OPCODE_IMM_ATOMIC_IMAX, - TPF_OPCODE_IMM_ATOMIC_IMIN, - TPF_OPCODE_IMM_ATOMIC_UMAX, - TPF_OPCODE_IMM_ATOMIC_UMIN, - - TPF_OPCODE_SYNC, - - TPF_OPCODE_DADD, - TPF_OPCODE_DMAX, - TPF_OPCODE_DMIN, - TPF_OPCODE_DMUL, - TPF_OPCODE_DEQ, - TPF_OPCODE_DGE, - TPF_OPCODE_DLT, - TPF_OPCODE_DNE, - TPF_OPCODE_DMOV, - TPF_OPCODE_DMOVC, - - TPF_OPCODE_DTOF, - TPF_OPCODE_FTOD, - - TPF_OPCODE_EVAL_SNAPPED, - TPF_OPCODE_EVAL_SAMPLE_INDEX, - TPF_OPCODE_EVAL_CENTROID, - - TPF_OPCODE_DCL_GS_INSTANCE_COUNT, - - TPF_OPCODE_D3D11_COUNT -}; +#include "tpf_defs.h" extern const char* tpf_opcode_names[]; - -enum tpf_file -{ - TPF_FILE_TEMP = 0, - TPF_FILE_INPUT = 1, - TPF_FILE_OUTPUT = 2, - TPF_FILE_INDEXABLE_TEMP = 3, - TPF_FILE_IMMEDIATE32 = 4, // one 32-bit value for each component follows - TPF_FILE_IMMEDIATE64 = 5, // one 64-bit value for each component follows - TPF_FILE_SAMPLER = 6, - TPF_FILE_RESOURCE = 7, - TPF_FILE_CONSTANT_BUFFER= 8, - TPF_FILE_IMMEDIATE_CONSTANT_BUFFER= 9, - TPF_FILE_LABEL = 10, - TPF_FILE_INPUT_PRIMITIVEID = 11, - TPF_FILE_OUTPUT_DEPTH = 12, - TPF_FILE_NULL = 13, - - // Added in D3D10.1 - - TPF_FILE_RASTERIZER = 14, - TPF_FILE_OUTPUT_COVERAGE_MASK = 15, - - // Added in D3D11 - - TPF_FILE_STREAM = 16, - TPF_FILE_FUNCTION_BODY = 17, - TPF_FILE_FUNCTION_TABLE = 18, - TPF_FILE_INTERFACE = 19, - TPF_FILE_FUNCTION_INPUT = 20, - TPF_FILE_FUNCTION_OUTPUT = 21, - TPF_FILE_OUTPUT_CONTROL_POINT_ID = 22, - TPF_FILE_INPUT_FORK_INSTANCE_ID = 23, - TPF_FILE_INPUT_JOIN_INSTANCE_ID = 24, - TPF_FILE_INPUT_CONTROL_POINT = 25, - TPF_FILE_OUTPUT_CONTROL_POINT = 26, - TPF_FILE_INPUT_PATCH_CONSTANT = 27, - TPF_FILE_INPUT_DOMAIN_POINT = 28, - TPF_FILE_THIS_POINTER = 29, - TPF_FILE_UNORDERED_ACCESS_VIEW = 30, - TPF_FILE_THREAD_GROUP_SHARED_MEMORY = 31, - TPF_FILE_INPUT_THREAD_ID = 32, - TPF_FILE_INPUT_THREAD_GROUP_ID = 33, - TPF_FILE_INPUT_THREAD_ID_IN_GROUP = 34, - TPF_FILE_INPUT_COVERAGE_MASK = 35, - TPF_FILE_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36, - TPF_FILE_INPUT_GS_INSTANCE_ID = 37, - TPF_FILE_OUTPUT_DEPTH_GREATER_EQUAL = 38, - TPF_FILE_OUTPUT_DEPTH_LESS_EQUAL = 39, - TPF_FILE_CYCLE_COUNTER = 40, - - TPF_FILE_COUNT = 41, -}; - extern const char* tpf_file_names[]; extern const char* tpf_file_ms_names[]; - -enum tpf_target -{ - TPF_TARGET_UNKNOWN = 0, - TPF_TARGET_BUFFER = 1, - TPF_TARGET_TEXTURE1D = 2, - TPF_TARGET_TEXTURE2D = 3, - TPF_TARGET_TEXTURE2DMS = 4, - TPF_TARGET_TEXTURE3D = 5, - TPF_TARGET_TEXTURECUBE = 6, - TPF_TARGET_TEXTURE1DARRAY = 7, - TPF_TARGET_TEXTURE2DARRAY = 8, - TPF_TARGET_TEXTURE2DMSARRAY = 9, - TPF_TARGET_TEXTURECUBEARRAY = 10, - - // Added in D3D11 - TPF_TARGET_RAW_BUFFER = 11, - TPF_TARGET_STRUCTURED_BUFFER = 12, -}; - extern const char* tpf_target_names[]; - -enum tpf_interpolation -{ - TPF_INTERPOLATION_UNDEFINED = 0, - TPF_INTERPOLATION_CONSTANT = 1, - TPF_INTERPOLATION_LINEAR = 2, - TPF_INTERPOLATION_LINEAR_CENTROID = 3, - TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4, - TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5, - - // Added in D3D10.1 - TPF_INTERPOLATION_LINEAR_SAMPLE = 6, - TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, -}; - extern const char* tpf_interpolation_names[]; - -enum tpf_sv -{ - TPF_SV_UNDEFINED, - TPF_SV_POSITION, - TPF_SV_CLIP_DISTANCE, - TPF_SV_CULL_DISTANCE, - TPF_SV_RENDER_TARGET_ARRAY_INDEX, - TPF_SV_VIEWPORT_ARRAY_INDEX, - TPF_SV_VERTEX_ID, - TPF_SV_PRIMITIVE_ID, - TPF_SV_INSTANCE_ID, - TPF_SV_IS_FRONT_FACE, - TPF_SV_SAMPLE_INDEX, - - // Added in D3D11 - TPF_SV_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_U_INSIDE_TESSFACTOR, - TPF_SV_FINAL_QUAD_V_INSIDE_TESSFACTOR, - TPF_SV_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_TRI_INSIDE_TESSFACTOR, - TPF_SV_FINAL_LINE_DETAIL_TESSFACTOR, - TPF_SV_FINAL_LINE_DENSITY_TESSFACTOR, -}; - extern const char* tpf_sv_names[]; struct tpf_token_version @@ -518,14 +155,6 @@ struct tpf_token_instruction }; }; -enum tpf_token_instruction_extended_type -{ - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_EMPTY = 0, - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_SAMPLE_CONTROLS = 1, - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_DIM = 2, - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_RETURN_TYPE = 3, -}; - union tpf_token_instruction_extended { struct @@ -565,30 +194,6 @@ struct tpf_token_resource_return_type unsigned w : 4; }; -enum tpf_operand_comps -{ - TPF_OPERAND_COMPS_0 = 0, - TPF_OPERAND_COMPS_1 = 1, - TPF_OPERAND_COMPS_4 = 2, - TPF_OPERAND_COMPS_N = 3 -}; - -enum tpf_operand_mode -{ - TPF_OPERAND_MODE_MASK = 0, - TPF_OPERAND_MODE_SWIZZLE = 1, - TPF_OPERAND_MODE_SCALAR = 2 -}; - -enum tpf_operand_index_repr -{ - TPF_OPERAND_INDEX_REPR_IMM32 = 0, - TPF_OPERAND_INDEX_REPR_IMM64 = 1, - TPF_OPERAND_INDEX_REPR_REG = 2, - TPF_OPERAND_INDEX_REPR_REG_IMM32 = 3, - TPF_OPERAND_INDEX_REPR_REG_IMM64 = 4, -}; - struct tpf_token_operand { unsigned comps_enum : 2; /* tpf_operands_comps */ @@ -606,12 +211,6 @@ struct tpf_token_operand #define TPF_OPERAND_SEL_SWZ(sel, i) (((sel) >> ((i) * 2)) & 3) #define TPF_OPERAND_SEL_SCALAR(sel) ((sel) & 3) -enum tpf_token_operand_extended_type -{ - TPF_TOKEN_OPERAND_EXTENDED_TYPE_EMPTY = 0, - TPF_TOKEN_OPERAND_EXTENDED_TYPE_MODIFIER = 1, -}; - struct tpf_token_operand_extended { unsigned type : 6; @@ -806,3 +405,4 @@ bool tpf_find_labels(tpf_program& program); bool tpf_allocate_resource_sampler_pairs(tpf_program& program); #endif /* TPF_H_ */ + diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp index a4f6cc6b661..2dfb88e5beb 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp @@ -86,13 +86,13 @@ struct tpf_parser op.mask = 0xf; switch(optok.comps_enum) { - case TPF_OPERAND_COMPS_0: + case TPF_OPERAND_COMPNUM_0: op.comps = 0; break; - case TPF_OPERAND_COMPS_1: + case TPF_OPERAND_COMPNUM_1: op.comps = 1; break; - case TPF_OPERAND_COMPS_4: + case TPF_OPERAND_COMPNUM_4: op.comps = 4; op.mode = optok.mode; switch(optok.mode) @@ -111,7 +111,7 @@ struct tpf_parser break; } break; - case TPF_OPERAND_COMPS_N: + case TPF_OPERAND_COMPNUM_N: fail("Unhandled operand component type"); } op.file = (tpf_file)optok.file; @@ -192,7 +192,7 @@ relative: read_token(&insntok); unsigned* insn_end = tokens - 1 + insntok.length; tpf_opcode opcode = (tpf_opcode)insntok.opcode; - check(opcode < TPF_OPCODE_D3D11_COUNT); + check(opcode < TPF_OPCODE_COUNT); if(opcode == TPF_OPCODE_CUSTOMDATA) { diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp deleted file mode 100644 index 94192c92792..00000000000 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -// generated with sed -re 's/TPF_WHATEVER_//; s/=.*//; s,//.*,,; s/,//; s/\s*//g;'|tr '[A-Z]' '[a-z]'|tr -s '\n'|sed -re 's/(.*)/\t"\1",/g' - -const char* tpf_opcode_names[] = -{ - "add", - "and", - "break", - "breakc", - "call", - "callc", - "case", - "continue", - "continuec", - "cut", - "default", - "deriv_rtx", - "deriv_rty", - "discard", - "div", - "dp2", - "dp3", - "dp4", - "else", - "emit", - "emitthencut", - "endif", - "endloop", - "endswitch", - "eq", - "exp", - "frc", - "ftoi", - "ftou", - "ge", - "iadd", - "if", - "ieq", - "ige", - "ilt", - "imad", - "imax", - "imin", - "imul", - "ine", - "ineg", - "ishl", - "ishr", - "itof", - "label", - "ld", - "ld_ms", - "log", - "loop", - "lt", - "mad", - "min", - "max", - "customdata", - "mov", - "movc", - "mul", - "ne", - "nop", - "not", - "or", - "resinfo", - "ret", - "retc", - "round_ne", - "round_ni", - "round_pi", - "round_z", - "rsq", - "sample", - "sample_c", - "sample_c_lz", - "sample_l", - "sample_d", - "sample_b", - "sqrt", - "switch", - "sincos", - "udiv", - "ult", - "uge", - "umul", - "umad", - "umax", - "umin", - "ushr", - "utof", - "xor", - "dcl_resource", - "dcl_constant_buffer", - "dcl_sampler", - "dcl_index_range", - "dcl_gs_output_primitive_topology", - "dcl_gs_input_primitive", - "dcl_max_output_vertex_count", - "dcl_input", - "dcl_input_sgv", - "dcl_input_siv", - "dcl_input_ps", - "dcl_input_ps_sgv", - "dcl_input_ps_siv", - "dcl_output", - "dcl_output_sgv", - "dcl_output_siv", - "dcl_temps", - "dcl_indexable_temp", - "dcl_global_flags", - "d3d10_count", - "lod", - "gather4", - "sample_pos", - "sample_info", - "d3d10_1_count", - "hs_decls", - "hs_control_point_phase", - "hs_fork_phase", - "hs_join_phase", - "emit_stream", - "cut_stream", - "emitthencut_stream", - "interface_call", - "bufinfo", - "deriv_rtx_coarse", - "deriv_rtx_fine", - "deriv_rty_coarse", - "deriv_rty_fine", - "gather4_c", - "gather4_po", - "gather4_po_c", - "rcp", - "f32tof16", - "f16tof32", - "uaddc", - "usubb", - "countbits", - "firstbit_hi", - "firstbit_lo", - "firstbit_shi", - "ubfe", - "ibfe", - "bfi", - "bfrev", - "swapc", - "dcl_stream", - "dcl_function_body", - "dcl_function_table", - "dcl_interface", - "dcl_input_control_point_count", - "dcl_output_control_point_count", - "dcl_tess_domain", - "dcl_tess_partitioning", - "dcl_tess_output_primitive", - "dcl_hs_max_tessfactor", - "dcl_hs_fork_phase_instance_count", - "dcl_hs_join_phase_instance_count", - "dcl_thread_group", - "dcl_unordered_access_view_typed", - "dcl_unordered_access_view_raw", - "dcl_unordered_access_view_structured", - "dcl_thread_group_shared_memory_raw", - "dcl_thread_group_shared_memory_structured", - "dcl_resource_raw", - "dcl_resource_structured", - "ld_uav_typed", - "store_uav_typed", - "ld_raw", - "store_raw", - "ld_structured", - "store_structured", - "atomic_and", - "atomic_or", - "atomic_xor", - "atomic_cmp_store", - "atomic_iadd", - "atomic_imax", - "atomic_imin", - "atomic_umax", - "atomic_umin", - "imm_atomic_alloc", - "imm_atomic_consume", - "imm_atomic_iadd", - "imm_atomic_and", - "imm_atomic_or", - "imm_atomic_xor", - "imm_atomic_exch", - "imm_atomic_cmp_exch", - "imm_atomic_imax", - "imm_atomic_imin", - "imm_atomic_umax", - "imm_atomic_umin", - "sync", - "dadd", - "dmax", - "dmin", - "dmul", - "deq", - "dge", - "dlt", - "dne", - "dmov", - "dmovc", - "dtof", - "ftod", - "eval_snapped", - "eval_sample_index", - "eval_centroid", - "dcl_gs_instance_count", - "d3d11_count", -}; - -const char* tpf_file_names[] = -{ - "temp", - "input", - "output", - "indexable_temp", - "immediate32", - "immediate64", - "sampler", - "resource", - "constant_buffer", - "immediate_constant_buffer", - "label", - "input_primitiveid", - "output_depth", - "null", - "rasterizer", - "output_coverage_mask", - "stream", - "function_body", - "function_table", - "interface", - "function_input", - "function_output", - "output_control_point_id", - "input_fork_instance_id", - "input_join_instance_id", - "input_control_point", - "output_control_point", - "input_patch_constant", - "input_domain_point", - "this_pointer", - "unordered_access_view", - "thread_group_shared_memory", - "input_thread_id", - "input_thread_group_id", - "input_thread_id_in_group", - "input_coverage_mask", - "input_thread_id_in_group_flattened", - "input_gs_instance_id", - "output_depth_greater_equal", - "output_depth_less_equal", - "cycle_counter", -}; - -const char* tpf_file_ms_names[] = -{ - "r", - "v", - "o", - "x", - "l", - "d", - "sampler", - "resource", - "cb", - "icb", - "label", - "vPrim", - "oDepth", - "null", - "rasterizer", - "oMask", - "stream", - "function_body", - "function_table", - "interface", - "function_input", - "function_output", - "vOutputControlPointID", - "vForkInstanceID", - "vJoinInstanceID", - "vicp", - "vocp", - "input_patch_constant", - "vDomain", - "this", - "u", - "g", - "vThreadID", - "vThreadGrouID", - "vThreadIDInGroup", - "vCoverage", - "vThreadIDInGroupFlattened", - "vGSInstanceID", - "oDepthGE", - "oDepthLE", - "vCycleCounter", -}; - -const char* tpf_target_names[] = -{ - "unknown", - "buffer", - "texture1d", - "texture2d", - "texture2dms", - "texture3d", - "texturecube", - "texture1darray", - "texture2darray", - "texture2dmsarray", - "texturecubearray", - "raw_buffer", - "structured_buffer", -}; - -const char* tpf_interpolation_names[] = -{ - "undefined", - "constant", - "linear", - "linear centroid", - "linear noperspective", - "linear noperspective centroid", - "linear sample", - "linear noperspective sample", -}; - -const char* tpf_sv_names[] = -{ - "undefined", - "position", - "clip_distance", - "cull_distance", - "render_target_array_index", - "viewport_array_index", - "vertex_id", - "primitive_id", - "instance_id", - "is_front_face", - "sample_index", - "final_quad_u_eq_0_edge_tessfactor", - "final_quad_v_eq_0_edge_tessfactor", - "final_quad_u_eq_1_edge_tessfactor", - "final_quad_v_eq_1_edge_tessfactor", - "final_quad_u_inside_tessfactor", - "final_quad_v_inside_tessfactor", - "final_tri_u_eq_0_edge_tessfactor", - "final_tri_v_eq_0_edge_tessfactor", - "final_tri_w_eq_0_edge_tessfactor", - "final_tri_inside_tessfactor", - "final_line_detail_tessfactor", - "final_line_density_tessfactor", -}; -- cgit v1.2.3 From e5ae4588d150a179974a812887f3b6445d8e2f34 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 13:31:30 +0200 Subject: d3d1x: s/tpf/sm4/g --- .../state_trackers/d3d1x/d3d1xshader/Makefile | 4 +- .../state_trackers/d3d1x/d3d1xshader/gen-header.sh | 6 +- .../state_trackers/d3d1x/d3d1xshader/gen-text.sh | 2 +- .../state_trackers/d3d1x/d3d1xshader/include/sm4.h | 410 ++++++++++ .../state_trackers/d3d1x/d3d1xshader/include/tpf.h | 408 ---------- .../d3d1x/d3d1xshader/src/sm4_analyze.cpp | 186 +++++ .../d3d1x/d3d1xshader/src/sm4_dump.cpp | 222 ++++++ .../d3d1x/d3d1xshader/src/sm4_parse.cpp | 424 +++++++++++ .../d3d1x/d3d1xshader/src/tpf_analyze.cpp | 186 ----- .../d3d1x/d3d1xshader/src/tpf_dump.cpp | 222 ------ .../d3d1x/d3d1xshader/src/tpf_parse.cpp | 424 ----------- .../d3d1x/d3d1xshader/tools/fxdis.cpp | 14 +- .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 14 +- .../state_trackers/d3d1x/gd3d1x/d3d1x_private.h | 4 +- .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp | 832 +++++++++++++++++++++ .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.h | 34 + .../d3d1x/gd3d1x/tools/dxbc2tgsi.cpp | 16 +- .../state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp | 832 --------------------- .../state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h | 34 - 19 files changed, 2138 insertions(+), 2136 deletions(-) create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h delete mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_dump.cpp create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp delete mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp delete mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp delete mode 100644 src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp create mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.h delete mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp delete mode 100644 src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 866762e1bb4..4f67145b6fa 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile @@ -6,8 +6,8 @@ LIBS=libd3d1xshader.a include ../Makefile.inc -include/tpf_defs.h: $(wildcard defs/*.txt) +include/sm4_defs.h: $(wildcard defs/*.txt) ./gen-header.sh $^ > $@ -src/tpf_text.cpp: $(wildcard defs/*.txt) +src/sm4_text.cpp: $(wildcard defs/*.txt) ./gen-text.sh $^ > $@ diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh index 558794f1d25..fcda13f9076 100755 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh @@ -2,12 +2,12 @@ for i in "$@"; do n=$(basename "$i" .txt|sed -e 's/s$//') if test "$n" == "shortfile"; then continue; fi - echo "enum tpf_$n" + echo "enum sm4_$n" echo "{" while read j; do - echo $'\t'"TPF_${n}_$j", + echo $'\t'"SM4_${n}_$j", done < "$i" |tr '[a-z]' '[A-Z]'|tr ' ' '_' - echo $'\t'"TPF_${n}_COUNT"|tr '[a-z]' '[A-Z]' + echo $'\t'"SM4_${n}_COUNT"|tr '[a-z]' '[A-Z]' echo "};" echo done diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh index b31e16e19c9..4663f635d43 100755 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh @@ -1,7 +1,7 @@ #!/bin/bash for i in "$@"; do n=$(basename "$i" .txt|sed -e 's/s$//') - echo "const char* tpf_${n}_names[] =" + echo "const char* sm4_${n}_names[] =" echo "{" while read j; do echo $'\t'"\"$j\"", diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h new file mode 100644 index 00000000000..07f84f0c73f --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h @@ -0,0 +1,410 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +/* Header for Shader Model 4.0, 4.1 and 5.0 */ + +#ifndef SM4_H_ +#define SM4_H_ + +#include +#include +#include +#include +#include +#include +#include +#include "le32.h" + +#include "sm4_defs.h" + +extern const char* sm4_opcode_names[]; +extern const char* sm4_file_names[]; +extern const char* sm4_file_ms_names[]; +extern const char* sm4_target_names[]; +extern const char* sm4_interpolation_names[]; +extern const char* sm4_sv_names[]; + +struct sm4_token_version +{ + unsigned minor : 4; + unsigned major : 4; + unsigned format : 8; + unsigned type : 16; +}; + +struct sm4_token_instruction +{ + // we don't make it an union directly because unions can't be inherited from + union + { + // length and extended are always present, but they are only here to reduce duplication + struct + { + unsigned opcode : 11; + unsigned _11_23 : 13; + unsigned length : 7; + unsigned extended : 1; + }; + struct + { + unsigned opcode : 11; + unsigned resinfo_return_type : 2; + unsigned sat : 1; + unsigned _14_17 : 4; + unsigned test_nz : 1; // bit 18 + unsigned precise_mask : 4; + unsigned _23 : 1; + unsigned length : 7; + unsigned extended : 1; + } insn; + struct + { + unsigned opcode : 11; + unsigned threads_in_group : 1; + unsigned shared_memory : 1; + unsigned uav_group : 1; + unsigned uav_global : 1; + unsigned _15_17 : 3; + } sync; + struct + { + unsigned opcode : 11; + unsigned allow_refactoring : 1; + unsigned fp64 : 1; + unsigned early_depth_stencil : 1; + unsigned enable_raw_and_structured_in_non_cs : 1; + } dcl_global_flags; + struct + { + unsigned opcode : 11; + unsigned target : 5; + unsigned nr_samples : 7; + } dcl_resource; + struct + { + unsigned opcode : 11; + unsigned shadow : 1; + unsigned mono : 1; + } dcl_sampler; + struct + { + unsigned opcode : 11; + unsigned interpolation : 5; + } dcl_input_ps; + struct + { + unsigned opcode : 11; + unsigned dynamic : 1; + } dcl_constant_buffer; + struct + { + unsigned opcode : 11; + unsigned primitive : 6; + } dcl_gs_input_primitive; + struct + { + unsigned opcode : 11; + unsigned primitive_topology : 7; + } dcl_gs_output_primitive_topology; + struct + { + unsigned opcode : 11; + unsigned control_points : 6; + } dcl_input_control_point_count; + struct + { + unsigned opcode : 11; + unsigned control_points : 6; + } dcl_output_control_point_count; + struct + { + unsigned opcode : 11; + unsigned domain : 3; /* D3D_TESSELLATOR_DOMAIN */ + } dcl_tess_domain; + struct + { + unsigned opcode : 11; + unsigned partitioning : 3; /* D3D_TESSELLATOR_PARTITIONING */ + } dcl_tess_partitioning; + struct + { + unsigned opcode : 11; + unsigned primitive : 3; /* D3D_TESSELLATOR_OUTPUT_PRIMITIVE */ + } dcl_tess_output_primitive; + }; +}; + +union sm4_token_instruction_extended +{ + struct + { + unsigned type : 6; + unsigned _6_30 : 25; + unsigned extended :1; + }; + struct + { + unsigned type : 6; + unsigned _6_8 : 3; + int offset_u : 4; + int offset_v : 4; + int offset_w : 4; + } sample_controls; + struct + { + unsigned type : 6; + unsigned target : 5; + } resource_target; + struct + { + unsigned type : 6; + unsigned x : 4; + unsigned y : 4; + unsigned z : 4; + unsigned w : 4; + } resource_return_type; +}; + +struct sm4_token_resource_return_type +{ + unsigned x : 4; + unsigned y : 4; + unsigned z : 4; + unsigned w : 4; +}; + +struct sm4_token_operand +{ + unsigned comps_enum : 2; /* sm4_operands_comps */ + unsigned mode : 2; /* sm4_operand_mode */ + unsigned sel : 8; + unsigned file : 8; /* sm4_file */ + unsigned num_indices : 2; + unsigned index0_repr : 3; /* sm4_operand_index_repr */ + unsigned index1_repr : 3; /* sm4_operand_index_repr */ + unsigned index2_repr : 3; /* sm4_operand_index_repr */ + unsigned extended : 1; +}; + +#define SM4_OPERAND_SEL_MASK(sel) ((sel) & 0xf) +#define SM4_OPERAND_SEL_SWZ(sel, i) (((sel) >> ((i) * 2)) & 3) +#define SM4_OPERAND_SEL_SCALAR(sel) ((sel) & 3) + +struct sm4_token_operand_extended +{ + unsigned type : 6; + unsigned neg : 1; + unsigned abs : 1; +}; + +union sm4_any +{ + double f64; + float f32; + int64_t i64; + int32_t i32; + uint64_t u64; + int64_t u32; +}; + +struct sm4_op; +struct sm4_insn; +struct sm4_dcl; +struct sm4_program; +std::ostream& operator <<(std::ostream& out, const sm4_op& op); +std::ostream& operator <<(std::ostream& out, const sm4_insn& op); +std::ostream& operator <<(std::ostream& out, const sm4_dcl& op); +std::ostream& operator <<(std::ostream& out, const sm4_program& op); + +struct sm4_op +{ + uint8_t mode; + uint8_t comps; + uint8_t mask; + uint8_t num_indices; + uint8_t swizzle[4]; + sm4_file file; + sm4_any imm_values[4]; + bool neg; + bool abs; + struct + { + int64_t disp; + std::auto_ptr reg; + } indices[3]; + + bool is_index_simple(unsigned i) const + { + return !indices[i].reg.get() && indices[i].disp >= 0 && (int64_t)(int32_t)indices[i].disp == indices[i].disp; + } + + bool has_simple_index() const + { + return num_indices == 1 && is_index_simple(0); + } + + sm4_op() + { + memset(this, 0, sizeof(*this)); + } + + void dump(); + +private: + sm4_op(const sm4_op& op) + {} +}; + +/* for sample_d */ +#define SM4_MAX_OPS 6 + +struct sm4_insn : public sm4_token_instruction +{ + int8_t sample_offset[3]; + uint8_t resource_target; + uint8_t resource_return_type[4]; + + unsigned num; + unsigned num_ops; + std::auto_ptr ops[SM4_MAX_OPS]; + + sm4_insn() + { + memset(this, 0, sizeof(*this)); + } + + void dump(); + +private: + sm4_insn(const sm4_insn& op) + {} +}; + +struct sm4_dcl : public sm4_token_instruction +{ + std::auto_ptr op; + union + { + unsigned num; + float f32; + sm4_sv sv; + struct + { + unsigned id; + unsigned expected_function_table_length; + unsigned table_length; + unsigned array_length; + } intf; + unsigned thread_group_size[3]; + sm4_token_resource_return_type rrt; + struct + { + unsigned num; + unsigned comps; + } indexable_temp; + struct + { + unsigned stride; + unsigned count; + } structured; + }; + + void* data; + + sm4_dcl() + { + memset(this, 0, sizeof(*this)); + } + + ~sm4_dcl() + { + free(data); + } + + void dump(); + +private: + sm4_dcl(const sm4_dcl& op) + {} +}; + +struct sm4_program +{ + sm4_token_version version; + std::vector dcls; + std::vector insns; + + /* for ifs, the insn number of the else or endif if there is no else + * for elses, the insn number of the endif + * for endifs, the insn number of the if + * for loops, the insn number of the endloop + * for endloops, the insn number of the loop + * for all others, -1 + */ + std::vector cf_insn_linked; + + /* NOTE: sampler 0 is the unnormalized nearest sampler for LD/LD_MS, while + * sampler 1 is user-specified sampler 0 + */ + bool resource_sampler_slots_assigned; + std::vector slot_to_resource; + std::vector slot_to_sampler; + std::map, int> resource_sampler_to_slot; + std::map resource_to_slot; + + bool labels_found; + std::vector label_to_insn_num; + + sm4_program() + { + memset(&version, 0, sizeof(version)); + labels_found = false; + resource_sampler_slots_assigned = false; + } + + ~sm4_program() + { + for(std::vector::iterator i = dcls.begin(), e = dcls.end(); i != e; ++i) + delete *i; + for(std::vector::iterator i = insns.begin(), e = insns.end(); i != e; ++i) + delete *i; + } + + void dump(); + +private: + sm4_program(const sm4_dcl& op) + {} +}; + +sm4_program* sm4_parse(void* tokens, int size); + +bool sm4_link_cf_insns(sm4_program& program); +bool sm4_find_labels(sm4_program& program); +bool sm4_allocate_resource_sampler_pairs(sm4_program& program); + +#endif /* SM4_H_ */ + diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h deleted file mode 100644 index 6ab9b820e8f..00000000000 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#ifndef TPF_H_ -#define TPF_H_ - -#include -#include -#include -#include -#include -#include -#include -#include "le32.h" - -#include "tpf_defs.h" - -extern const char* tpf_opcode_names[]; -extern const char* tpf_file_names[]; -extern const char* tpf_file_ms_names[]; -extern const char* tpf_target_names[]; -extern const char* tpf_interpolation_names[]; -extern const char* tpf_sv_names[]; - -struct tpf_token_version -{ - unsigned minor : 4; - unsigned major : 4; - unsigned format : 8; - unsigned type : 16; -}; - -struct tpf_token_instruction -{ - // we don't make it an union directly because unions can't be inherited from - union - { - // length and extended are always present, but they are only here to reduce duplication - struct - { - unsigned opcode : 11; - unsigned _11_23 : 13; - unsigned length : 7; - unsigned extended : 1; - }; - struct - { - unsigned opcode : 11; - unsigned resinfo_return_type : 2; - unsigned sat : 1; - unsigned _14_17 : 4; - unsigned test_nz : 1; // bit 18 - unsigned precise_mask : 4; - unsigned _23 : 1; - unsigned length : 7; - unsigned extended : 1; - } insn; - struct - { - unsigned opcode : 11; - unsigned threads_in_group : 1; - unsigned shared_memory : 1; - unsigned uav_group : 1; - unsigned uav_global : 1; - unsigned _15_17 : 3; - } sync; - struct - { - unsigned opcode : 11; - unsigned allow_refactoring : 1; - unsigned fp64 : 1; - unsigned early_depth_stencil : 1; - unsigned enable_raw_and_structured_in_non_cs : 1; - } dcl_global_flags; - struct - { - unsigned opcode : 11; - unsigned target : 5; - unsigned nr_samples : 7; - } dcl_resource; - struct - { - unsigned opcode : 11; - unsigned shadow : 1; - unsigned mono : 1; - } dcl_sampler; - struct - { - unsigned opcode : 11; - unsigned interpolation : 5; - } dcl_input_ps; - struct - { - unsigned opcode : 11; - unsigned dynamic : 1; - } dcl_constant_buffer; - struct - { - unsigned opcode : 11; - unsigned primitive : 6; - } dcl_gs_input_primitive; - struct - { - unsigned opcode : 11; - unsigned primitive_topology : 7; - } dcl_gs_output_primitive_topology; - struct - { - unsigned opcode : 11; - unsigned control_points : 6; - } dcl_input_control_point_count; - struct - { - unsigned opcode : 11; - unsigned control_points : 6; - } dcl_output_control_point_count; - struct - { - unsigned opcode : 11; - unsigned domain : 3; /* D3D_TESSELLATOR_DOMAIN */ - } dcl_tess_domain; - struct - { - unsigned opcode : 11; - unsigned partitioning : 3; /* D3D_TESSELLATOR_PARTITIONING */ - } dcl_tess_partitioning; - struct - { - unsigned opcode : 11; - unsigned primitive : 3; /* D3D_TESSELLATOR_OUTPUT_PRIMITIVE */ - } dcl_tess_output_primitive; - }; -}; - -union tpf_token_instruction_extended -{ - struct - { - unsigned type : 6; - unsigned _6_30 : 25; - unsigned extended :1; - }; - struct - { - unsigned type : 6; - unsigned _6_8 : 3; - int offset_u : 4; - int offset_v : 4; - int offset_w : 4; - } sample_controls; - struct - { - unsigned type : 6; - unsigned target : 5; - } resource_target; - struct - { - unsigned type : 6; - unsigned x : 4; - unsigned y : 4; - unsigned z : 4; - unsigned w : 4; - } resource_return_type; -}; - -struct tpf_token_resource_return_type -{ - unsigned x : 4; - unsigned y : 4; - unsigned z : 4; - unsigned w : 4; -}; - -struct tpf_token_operand -{ - unsigned comps_enum : 2; /* tpf_operands_comps */ - unsigned mode : 2; /* tpf_operand_mode */ - unsigned sel : 8; - unsigned file : 8; /* tpf_file */ - unsigned num_indices : 2; - unsigned index0_repr : 3; /* tpf_operand_index_repr */ - unsigned index1_repr : 3; /* tpf_operand_index_repr */ - unsigned index2_repr : 3; /* tpf_operand_index_repr */ - unsigned extended : 1; -}; - -#define TPF_OPERAND_SEL_MASK(sel) ((sel) & 0xf) -#define TPF_OPERAND_SEL_SWZ(sel, i) (((sel) >> ((i) * 2)) & 3) -#define TPF_OPERAND_SEL_SCALAR(sel) ((sel) & 3) - -struct tpf_token_operand_extended -{ - unsigned type : 6; - unsigned neg : 1; - unsigned abs : 1; -}; - -union tpf_any -{ - double f64; - float f32; - int64_t i64; - int32_t i32; - uint64_t u64; - int64_t u32; -}; - -struct tpf_op; -struct tpf_insn; -struct tpf_dcl; -struct tpf_program; -std::ostream& operator <<(std::ostream& out, const tpf_op& op); -std::ostream& operator <<(std::ostream& out, const tpf_insn& op); -std::ostream& operator <<(std::ostream& out, const tpf_dcl& op); -std::ostream& operator <<(std::ostream& out, const tpf_program& op); - -struct tpf_op -{ - uint8_t mode; - uint8_t comps; - uint8_t mask; - uint8_t num_indices; - uint8_t swizzle[4]; - tpf_file file; - tpf_any imm_values[4]; - bool neg; - bool abs; - struct - { - int64_t disp; - std::auto_ptr reg; - } indices[3]; - - bool is_index_simple(unsigned i) const - { - return !indices[i].reg.get() && indices[i].disp >= 0 && (int64_t)(int32_t)indices[i].disp == indices[i].disp; - } - - bool has_simple_index() const - { - return num_indices == 1 && is_index_simple(0); - } - - tpf_op() - { - memset(this, 0, sizeof(*this)); - } - - void dump(); - -private: - tpf_op(const tpf_op& op) - {} -}; - -/* for sample_d */ -#define TPF_MAX_OPS 6 - -struct tpf_insn : public tpf_token_instruction -{ - int8_t sample_offset[3]; - uint8_t resource_target; - uint8_t resource_return_type[4]; - - unsigned num; - unsigned num_ops; - std::auto_ptr ops[TPF_MAX_OPS]; - - tpf_insn() - { - memset(this, 0, sizeof(*this)); - } - - void dump(); - -private: - tpf_insn(const tpf_insn& op) - {} -}; - -struct tpf_dcl : public tpf_token_instruction -{ - std::auto_ptr op; - union - { - unsigned num; - float f32; - tpf_sv sv; - struct - { - unsigned id; - unsigned expected_function_table_length; - unsigned table_length; - unsigned array_length; - } intf; - unsigned thread_group_size[3]; - tpf_token_resource_return_type rrt; - struct - { - unsigned num; - unsigned comps; - } indexable_temp; - struct - { - unsigned stride; - unsigned count; - } structured; - }; - - void* data; - - tpf_dcl() - { - memset(this, 0, sizeof(*this)); - } - - ~tpf_dcl() - { - free(data); - } - - void dump(); - -private: - tpf_dcl(const tpf_dcl& op) - {} -}; - -struct tpf_program -{ - tpf_token_version version; - std::vector dcls; - std::vector insns; - - /* for ifs, the insn number of the else or endif if there is no else - * for elses, the insn number of the endif - * for endifs, the insn number of the if - * for loops, the insn number of the endloop - * for endloops, the insn number of the loop - * for all others, -1 - */ - std::vector cf_insn_linked; - - /* NOTE: sampler 0 is the unnormalized nearest sampler for LD/LD_MS, while - * sampler 1 is user-specified sampler 0 - */ - bool resource_sampler_slots_assigned; - std::vector slot_to_resource; - std::vector slot_to_sampler; - std::map, int> resource_sampler_to_slot; - std::map resource_to_slot; - - bool labels_found; - std::vector label_to_insn_num; - - tpf_program() - { - memset(&version, 0, sizeof(version)); - labels_found = false; - resource_sampler_slots_assigned = false; - } - - ~tpf_program() - { - for(std::vector::iterator i = dcls.begin(), e = dcls.end(); i != e; ++i) - delete *i; - for(std::vector::iterator i = insns.begin(), e = insns.end(); i != e; ++i) - delete *i; - } - - void dump(); - -private: - tpf_program(const tpf_dcl& op) - {} -}; - -tpf_program* tpf_parse(void* tokens, int size); - -bool tpf_link_cf_insns(tpf_program& program); -bool tpf_find_labels(tpf_program& program); -bool tpf_allocate_resource_sampler_pairs(tpf_program& program); - -#endif /* TPF_H_ */ - diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp new file mode 100644 index 00000000000..848db1bdbbb --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp @@ -0,0 +1,186 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include +#include +#include "sm4.h" + +#define check(x) do {if(!(x)) return false;} while(0) + +bool sm4_link_cf_insns(sm4_program& program) +{ + if(program.cf_insn_linked.size()) + return true; + + std::vector cf_insn_linked; + cf_insn_linked.resize(program.insns.size()); + memset(&cf_insn_linked[0], 0xff, cf_insn_linked.size() * sizeof(int)); + std::vector cf_stack; + for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) + { + unsigned v; + switch(program.insns[insn_num]->opcode) + { + case SM4_OPCODE_LOOP: + cf_stack.push_back(insn_num); + break; + case SM4_OPCODE_ENDLOOP: + check(!cf_stack.empty()); + v = cf_stack.back(); + check(program.insns[v]->opcode == SM4_OPCODE_LOOP); + cf_insn_linked[v] = insn_num; + cf_insn_linked[insn_num] = v; + cf_stack.pop_back(); + break; + case SM4_OPCODE_IF: + case SM4_OPCODE_SWITCH: + cf_insn_linked[insn_num] = insn_num; // later changed + cf_stack.push_back(insn_num); + break; + case SM4_OPCODE_ELSE: + case SM4_OPCODE_CASE: + check(!cf_stack.empty()); + v = cf_stack.back(); + if(program.insns[insn_num]->opcode == SM4_OPCODE_ELSE) + check(program.insns[v]->opcode == SM4_OPCODE_IF); + else + check(program.insns[v]->opcode == SM4_OPCODE_SWITCH || program.insns[v]->opcode == SM4_OPCODE_CASE); + cf_insn_linked[insn_num] = cf_insn_linked[v]; // later changed + cf_insn_linked[v] = insn_num; + cf_stack.back() = insn_num; + break; + case SM4_OPCODE_ENDSWITCH: + case SM4_OPCODE_ENDIF: + check(!cf_stack.empty()); + v = cf_stack.back(); + if(program.insns[insn_num]->opcode == SM4_OPCODE_ENDIF) + check(program.insns[v]->opcode == SM4_OPCODE_IF || program.insns[v]->opcode == SM4_OPCODE_ELSE); + else + check(program.insns[v]->opcode == SM4_OPCODE_SWITCH || program.insns[v]->opcode == SM4_OPCODE_CASE); + cf_insn_linked[insn_num] = cf_insn_linked[v]; + cf_insn_linked[v] = insn_num; + cf_stack.pop_back(); + break; + } + } + check(cf_stack.empty()); + program.cf_insn_linked.swap(cf_insn_linked); + return true; +} + +bool sm4_find_labels(sm4_program& program) +{ + if(program.labels_found) + return true; + + std::vector labels; + for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) + { + switch(program.insns[insn_num]->opcode) + { + case SM4_OPCODE_LABEL: + if(program.insns[insn_num]->num_ops > 0) + { + sm4_op& op = *program.insns[insn_num]->ops[0]; + if(op.file == SM4_FILE_LABEL && op.has_simple_index()) + { + unsigned idx = (unsigned)op.indices[0].disp; + if(idx >= labels.size()) + labels.resize(idx + 1); + labels[idx] = insn_num; + } + } + break; + } + } + program.label_to_insn_num.swap(labels); + program.labels_found = true; + return true; +} + +bool sm4_allocate_resource_sampler_pairs(sm4_program& program) +{ + if(program.resource_sampler_slots_assigned) + return true; + + std::set > pairs; + std::set resinfos; + + for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) + { + int resource = -1; + int sampler = -2; + for(unsigned i = 0; i < program.insns[insn_num]->num_ops; ++i) + { + sm4_op* op = program.insns[insn_num]->ops[i].get(); + if(op) + { + if(op->file == SM4_FILE_RESOURCE) + { + if(!op->has_simple_index() || resource >= 0) + return false; + resource = (int)op->indices[0].disp; + } + if(op->file == SM4_FILE_SAMPLER) + { + if(!op->has_simple_index() || sampler >= 0) + return false; + sampler = (int)op->indices[0].disp; + } + } + } + + unsigned opcode = program.insns[insn_num]->opcode; + if(opcode == SM4_OPCODE_LD || opcode == SM4_OPCODE_LD_MS) + sampler = -1; + if(sampler >= -1 && resource >= 0) + pairs.insert(std::make_pair(resource, sampler)); + if(opcode == SM4_OPCODE_RESINFO) + resinfos.insert(resource); + } + + for(std::set >::iterator i = pairs.begin(); i != pairs.end(); ++i) + { + program.resource_sampler_to_slot[*i] = program.slot_to_resource.size(); + if(!program.resource_to_slot.count(i->first)) + { + program.resource_to_slot[i->first] = program.slot_to_resource.size(); + resinfos.erase(i->first); + } + program.slot_to_resource.push_back(i->first); + program.slot_to_sampler.push_back(i->second); + } + + for(std::set::iterator i = resinfos.begin(); i != resinfos.end(); ++i) + { + program.resource_sampler_to_slot[std::make_pair(*i, -1)] = program.slot_to_resource.size(); + program.resource_to_slot[*i] = program.slot_to_resource.size(); + program.slot_to_resource.push_back(*i); + program.slot_to_sampler.push_back(-1); + } + program.resource_sampler_slots_assigned = true; + return true; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_dump.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_dump.cpp new file mode 100644 index 00000000000..746d7c8927f --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_dump.cpp @@ -0,0 +1,222 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "sm4.h" + +// TODO: we should fix this to output the same syntax as fxc, if sm4_dump_short_syntax is set + +bool sm4_dump_short_syntax = true; + +std::ostream& operator <<(std::ostream& out, const sm4_op& op) +{ + if(op.neg) + out << '-'; + if(op.abs) + out << '|'; + if(op.file == SM4_FILE_IMMEDIATE32) + { + out << "l("; + for(unsigned i = 0; i < op.comps; ++i) + { + if(i) + out << ", "; + out << op.imm_values[i].f32; + } + out << ")"; + } + else if(op.file == SM4_FILE_IMMEDIATE64) + { + out << "d("; + for(unsigned i = 0; i < op.comps; ++i) + { + if(i) + out << ", "; + out << op.imm_values[i].f64; + } + out << ")"; + return out; + } + else + { + bool naked = false; + if(sm4_dump_short_syntax) + { + switch(op.file) + { + case SM4_FILE_TEMP: + case SM4_FILE_INPUT: + case SM4_FILE_OUTPUT: + case SM4_FILE_CONSTANT_BUFFER: + case SM4_FILE_INDEXABLE_TEMP: + case SM4_FILE_UNORDERED_ACCESS_VIEW: + case SM4_FILE_THREAD_GROUP_SHARED_MEMORY: + naked = true; + break; + default: + naked = false; + break; + } + } + + out << (sm4_dump_short_syntax ? sm4_shortfile_names : sm4_file_names)[op.file]; + + if(op.indices[0].reg.get()) + naked = false; + + for(unsigned i = 0; i < op.num_indices; ++i) + { + if(!naked || i) + out << '['; + if(op.indices[i].reg.get()) + { + out << *op.indices[i].reg; + if(op.indices[i].disp) + out << '+' << op.indices[i].disp; + } + else + out << op.indices[i].disp; + if(!naked || i) + out << ']'; + } + if(op.comps) + { + switch(op.mode) + { + case SM4_OPERAND_MODE_MASK: + out << (sm4_dump_short_syntax ? '.' : '!'); + for(unsigned i = 0; i < op.comps; ++i) + { + if(op.mask & (1 << i)) + out << "xyzw"[i]; + } + break; + case SM4_OPERAND_MODE_SWIZZLE: + out << '.'; + for(unsigned i = 0; i < op.comps; ++i) + out << "xyzw"[op.swizzle[i]]; + break; + case SM4_OPERAND_MODE_SCALAR: + out << (sm4_dump_short_syntax ? '.' : ':'); + out << "xyzw"[op.swizzle[0]]; + break; + } + } + } + if(op.abs) + out << '|'; + return out; +} + +std::ostream& operator <<(std::ostream& out, const sm4_dcl& dcl) +{ + out << sm4_opcode_names[dcl.opcode]; + switch(dcl.opcode) + { + case SM4_OPCODE_DCL_GLOBAL_FLAGS: + if(dcl.dcl_global_flags.allow_refactoring) + out << " refactoringAllowed"; + if(dcl.dcl_global_flags.early_depth_stencil) + out << " forceEarlyDepthStencil"; + if(dcl.dcl_global_flags.fp64) + out << " enableDoublePrecisionFloatOps"; + if(dcl.dcl_global_flags.enable_raw_and_structured_in_non_cs) + out << " enableRawAndStructuredBuffers"; + break; + case SM4_OPCODE_DCL_INPUT_PS: + case SM4_OPCODE_DCL_INPUT_PS_SIV: + case SM4_OPCODE_DCL_INPUT_PS_SGV: + out << ' ' << sm4_interpolation_names[dcl.dcl_input_ps.interpolation]; + break; + case SM4_OPCODE_DCL_TEMPS: + out << ' ' << dcl.num; + break; + default: + break; + } + if(dcl.op.get()) + out << ' ' << *dcl.op; + switch(dcl.opcode) + { + case SM4_OPCODE_DCL_CONSTANT_BUFFER: + out << ", " << (dcl.dcl_constant_buffer.dynamic ? "dynamicIndexed" : "immediateIndexed"); + break; + case SM4_OPCODE_DCL_INPUT_SIV: + case SM4_OPCODE_DCL_INPUT_SGV: + case SM4_OPCODE_DCL_OUTPUT_SIV: + case SM4_OPCODE_DCL_OUTPUT_SGV: + case SM4_OPCODE_DCL_INPUT_PS_SIV: + case SM4_OPCODE_DCL_INPUT_PS_SGV: + out << ", " << sm4_sv_names[dcl.num]; + break; + } + + return out; +} + +std::ostream& operator <<(std::ostream& out, const sm4_insn& insn) +{ + out << sm4_opcode_names[insn.opcode]; + if(insn.insn.sat) + out << "_sat"; + for(unsigned i = 0; i < insn.num_ops; ++i) + { + if(i) + out << ','; + out << ' ' << *insn.ops[i]; + } + return out; +} + +std::ostream& operator <<(std::ostream& out, const sm4_program& program) +{ + out << "pvghdc"[program.version.type] << "s_" << program.version.major << "_" << program.version.minor << "\n"; + for(unsigned i = 0; i < program.dcls.size(); ++i) + out << *program.dcls[i] << "\n"; + + for(unsigned i = 0; i < program.insns.size(); ++i) + out << *program.insns[i] << "\n"; + return out; +} + +void sm4_op::dump() +{ + std::cout << *this; +} + +void sm4_insn::dump() +{ + std::cout << *this; +} + +void sm4_dcl::dump() +{ + std::cout << *this; +} + +void sm4_program::dump() +{ + std::cout << *this; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp new file mode 100644 index 00000000000..2c0f8269af3 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp @@ -0,0 +1,424 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "sm4.h" +#include "utils.h" + +#if 1 +#define check(x) assert(x) +#define fail(x) assert(0 && (x)) +#else +#define check(x) do {if(!(x)) throw(#x);} while(0) +#define fail(x) throw(x) +#endif + +struct sm4_parser +{ + unsigned* tokens; + unsigned* tokens_end; + sm4_program& program; + + sm4_parser(sm4_program& program, void* p_tokens, unsigned size) + : program(program) + { + tokens = (unsigned*)p_tokens; + tokens_end = (unsigned*)((char*)p_tokens + size); + } + + /* TODO: byteswap if machine is big endian */ + uint32_t read32() + { + check(tokens < tokens_end); + return bswap_le32(*tokens++); + } + + template + void read_token(T* tok) + { + *(unsigned*)tok = read32(); + } + + uint64_t read64() + { + unsigned a = read32(); + unsigned b = read32(); + return (uint64_t)a | ((uint64_t)b << 32); + } + + void skip(unsigned toskip) + { + tokens += toskip; + } + + void read_op(sm4_op* pop) + { + sm4_op& op = *pop; + sm4_token_operand optok; + read_token(&optok); + assert(optok.file < SM4_FILE_COUNT); + op.swizzle[0] = 0; + op.swizzle[1] = 1; + op.swizzle[2] = 2; + op.swizzle[3] = 3; + op.mask = 0xf; + switch(optok.comps_enum) + { + case SM4_OPERAND_COMPNUM_0: + op.comps = 0; + break; + case SM4_OPERAND_COMPNUM_1: + op.comps = 1; + break; + case SM4_OPERAND_COMPNUM_4: + op.comps = 4; + op.mode = optok.mode; + switch(optok.mode) + { + case SM4_OPERAND_MODE_MASK: + op.mask = SM4_OPERAND_SEL_MASK(optok.sel); + break; + case SM4_OPERAND_MODE_SWIZZLE: + op.swizzle[0] = SM4_OPERAND_SEL_SWZ(optok.sel, 0); + op.swizzle[1] = SM4_OPERAND_SEL_SWZ(optok.sel, 1); + op.swizzle[2] = SM4_OPERAND_SEL_SWZ(optok.sel, 2); + op.swizzle[3] = SM4_OPERAND_SEL_SWZ(optok.sel, 3); + break; + case SM4_OPERAND_MODE_SCALAR: + op.swizzle[0] = op.swizzle[1] = op.swizzle[2] = op.swizzle[3] = SM4_OPERAND_SEL_SCALAR(optok.sel); + break; + } + break; + case SM4_OPERAND_COMPNUM_N: + fail("Unhandled operand component type"); + } + op.file = (sm4_file)optok.file; + op.num_indices = optok.num_indices; + + if(optok.extended) + { + sm4_token_operand_extended optokext; + read_token(&optokext); + if(optokext.type == 0) + {} + else if(optokext.type == 1) + { + op.neg = optokext.neg; + op.abs= optokext.abs; + } + else + fail("Unhandled extended operand token type"); + } + + for(unsigned i = 0; i < op.num_indices; ++i) + { + unsigned repr; + if(i == 0) + repr = optok.index0_repr; + else if(i == 1) + repr = optok.index1_repr; + else if(i == 2) + repr = optok.index2_repr; + else + fail("Unhandled operand index representation"); + op.indices[0].disp = 0; + // TODO: is disp supposed to be signed here?? + switch(repr) + { + case SM4_OPERAND_INDEX_REPR_IMM32: + op.indices[i].disp = (int32_t)read32(); + break; + case SM4_OPERAND_INDEX_REPR_IMM64: + op.indices[i].disp = read64(); + break; + case SM4_OPERAND_INDEX_REPR_REG: +relative: + op.indices[i].reg.reset(new sm4_op()); + read_op(&*op.indices[0].reg); + break; + case SM4_OPERAND_INDEX_REPR_REG_IMM32: + op.indices[i].disp = (int32_t)read32(); + goto relative; + case SM4_OPERAND_INDEX_REPR_REG_IMM64: + op.indices[i].disp = read64(); + goto relative; + } + } + + if(op.file == SM4_FILE_IMMEDIATE32) + { + for(unsigned i = 0; i < op.comps; ++i) + op.imm_values[i].i32 = read32(); + } + else if(op.file == SM4_FILE_IMMEDIATE64) + { + for(unsigned i = 0; i < op.comps; ++i) + op.imm_values[i].i64 = read64(); + } + } + + void do_parse() + { + read_token(&program.version); + + unsigned lentok = read32(); + tokens_end = tokens - 2 + lentok; + + while(tokens != tokens_end) + { + sm4_token_instruction insntok; + read_token(&insntok); + unsigned* insn_end = tokens - 1 + insntok.length; + sm4_opcode opcode = (sm4_opcode)insntok.opcode; + check(opcode < SM4_OPCODE_COUNT); + + if(opcode == SM4_OPCODE_CUSTOMDATA) + { + unsigned customlen = read32() - 2; + skip(customlen); + continue; + } + + if((opcode >= SM4_OPCODE_DCL_RESOURCE && opcode <= SM4_OPCODE_DCL_GLOBAL_FLAGS) + || (opcode >= SM4_OPCODE_DCL_STREAM && opcode <= SM4_OPCODE_DCL_RESOURCE_STRUCTURED)) + { + sm4_dcl& dcl = *new sm4_dcl; + program.dcls.push_back(&dcl); + (sm4_token_instruction&)dcl = insntok; + + sm4_token_instruction_extended exttok; + memcpy(&exttok, &insntok, sizeof(exttok)); + while(exttok.extended) + { + read_token(&exttok); + } + +#define READ_OP_ANY dcl.op.reset(new sm4_op()); read_op(&*dcl.op); +#define READ_OP(FILE) READ_OP_ANY + //check(dcl.op->file == SM4_FILE_##FILE); + + switch(opcode) + { + case SM4_OPCODE_DCL_GLOBAL_FLAGS: + break; + case SM4_OPCODE_DCL_RESOURCE: + READ_OP(RESOURCE); + read_token(&dcl.rrt); + break; + case SM4_OPCODE_DCL_SAMPLER: + READ_OP(SAMPLER); + break; + case SM4_OPCODE_DCL_INPUT: + case SM4_OPCODE_DCL_INPUT_PS: + READ_OP(INPUT); + break; + case SM4_OPCODE_DCL_INPUT_SIV: + case SM4_OPCODE_DCL_INPUT_SGV: + case SM4_OPCODE_DCL_INPUT_PS_SIV: + case SM4_OPCODE_DCL_INPUT_PS_SGV: + READ_OP(INPUT); + dcl.sv = (sm4_sv)(uint16_t)read32(); + break; + case SM4_OPCODE_DCL_OUTPUT: + READ_OP(OUTPUT); + break; + case SM4_OPCODE_DCL_OUTPUT_SIV: + case SM4_OPCODE_DCL_OUTPUT_SGV: + READ_OP(OUTPUT); + dcl.sv = (sm4_sv)(uint16_t)read32(); + break; + case SM4_OPCODE_DCL_INDEX_RANGE: + READ_OP_ANY; + check(dcl.op->file == SM4_FILE_INPUT || dcl.op->file == SM4_FILE_OUTPUT); + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_TEMPS: + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_INDEXABLE_TEMP: + READ_OP(INDEXABLE_TEMP); + dcl.indexable_temp.num = read32(); + dcl.indexable_temp.comps = read32(); + break; + case SM4_OPCODE_DCL_CONSTANT_BUFFER: + READ_OP(CONSTANT_BUFFER); + break; + case SM4_OPCODE_DCL_GS_INPUT_PRIMITIVE: + case SM4_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY: + break; + case SM4_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT: + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_GS_INSTANCE_COUNT: + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT: + case SM4_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT: + case SM4_OPCODE_DCL_TESS_DOMAIN: + case SM4_OPCODE_DCL_TESS_PARTITIONING: + case SM4_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE: + break; + case SM4_OPCODE_DCL_HS_MAX_TESSFACTOR: + dcl.f32 = read32(); + break; + case SM4_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT: + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_FUNCTION_BODY: + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_FUNCTION_TABLE: + dcl.num = read32(); + dcl.data = malloc(dcl.num * sizeof(uint32_t)); + for(unsigned i = 0; i < dcl.num; ++i) + ((uint32_t*)dcl.data)[i] = read32(); + break; + case SM4_OPCODE_DCL_INTERFACE: + dcl.intf.id = read32(); + dcl.intf.expected_function_table_length = read32(); + { + uint32_t v = read32(); + dcl.intf.table_length = v & 0xffff; + dcl.intf.array_length = v >> 16; + } + dcl.data = malloc(dcl.intf.table_length * sizeof(uint32_t)); + for(unsigned i = 0; i < dcl.intf.table_length; ++i) + ((uint32_t*)dcl.data)[i] = read32(); + break; + case SM4_OPCODE_DCL_THREAD_GROUP: + dcl.thread_group_size[0] = read32(); + dcl.thread_group_size[1] = read32(); + dcl.thread_group_size[2] = read32(); + break; + case SM4_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED: + READ_OP(UNORDERED_ACCESS_VIEW); + read_token(&dcl.rrt); + break; + case SM4_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW: + READ_OP(UNORDERED_ACCESS_VIEW); + break; + case SM4_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED: + READ_OP(UNORDERED_ACCESS_VIEW); + dcl.structured.stride = read32(); + break; + case SM4_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW: + READ_OP(THREAD_GROUP_SHARED_MEMORY); + dcl.num = read32(); + break; + case SM4_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED: + READ_OP(THREAD_GROUP_SHARED_MEMORY); + dcl.structured.stride = read32(); + dcl.structured.count = read32(); + break; + case SM4_OPCODE_DCL_RESOURCE_RAW: + READ_OP(RESOURCE); + break; + case SM4_OPCODE_DCL_RESOURCE_STRUCTURED: + READ_OP(RESOURCE); + dcl.structured.stride = read32(); + break; + case SM4_OPCODE_DCL_STREAM: + /* TODO: dcl_stream is undocumented: what is it? */ + fail("Unhandled dcl_stream since it's undocumented"); + default: + fail("Unhandled declaration"); + } + + check(tokens == insn_end); + } + else + { + sm4_insn& insn = *new sm4_insn; + program.insns.push_back(&insn); + (sm4_token_instruction&)insn = insntok; + + sm4_token_instruction_extended exttok; + memcpy(&exttok, &insntok, sizeof(exttok)); + while(exttok.extended) + { + read_token(&exttok); + if(exttok.type == SM4_TOKEN_INSTRUCTION_EXTENDED_TYPE_SAMPLE_CONTROLS) + { + insn.sample_offset[0] = exttok.sample_controls.offset_u; + insn.sample_offset[1] = exttok.sample_controls.offset_v; + insn.sample_offset[2] = exttok.sample_controls.offset_w; + } + else if(exttok.type == SM4_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_DIM) + insn.resource_target = exttok.resource_target.target; + else if(exttok.type == SM4_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_RETURN_TYPE) + { + insn.resource_return_type[0] = exttok.resource_return_type.x; + insn.resource_return_type[1] = exttok.resource_return_type.y; + insn.resource_return_type[2] = exttok.resource_return_type.z; + insn.resource_return_type[3] = exttok.resource_return_type.w; + } + } + + switch(opcode) + { + case SM4_OPCODE_INTERFACE_CALL: + insn.num = read32(); + break; + default: + break; + } + + unsigned op_num = 0; + while(tokens != insn_end) + { + check(tokens < insn_end); + check(op_num < SM4_MAX_OPS); + insn.ops[op_num].reset(new sm4_op); + read_op(&*insn.ops[op_num]); + ++op_num; + } + insn.num_ops = op_num; + } + } + } + + const char* parse() + { + try + { + do_parse(); + return 0; + } + catch(const char* error) + { + return error; + } + } +}; + +sm4_program* sm4_parse(void* tokens, int size) +{ + sm4_program* program = new sm4_program; + sm4_parser parser(*program, tokens, size); + if(!parser.parse()) + return program; + delete program; + return 0; +} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp deleted file mode 100644 index a381564ada1..00000000000 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_analyze.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include -#include -#include "tpf.h" - -#define check(x) do {if(!(x)) return false;} while(0) - -bool tpf_link_cf_insns(tpf_program& program) -{ - if(program.cf_insn_linked.size()) - return true; - - std::vector cf_insn_linked; - cf_insn_linked.resize(program.insns.size()); - memset(&cf_insn_linked[0], 0xff, cf_insn_linked.size() * sizeof(int)); - std::vector cf_stack; - for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) - { - unsigned v; - switch(program.insns[insn_num]->opcode) - { - case TPF_OPCODE_LOOP: - cf_stack.push_back(insn_num); - break; - case TPF_OPCODE_ENDLOOP: - check(!cf_stack.empty()); - v = cf_stack.back(); - check(program.insns[v]->opcode == TPF_OPCODE_LOOP); - cf_insn_linked[v] = insn_num; - cf_insn_linked[insn_num] = v; - cf_stack.pop_back(); - break; - case TPF_OPCODE_IF: - case TPF_OPCODE_SWITCH: - cf_insn_linked[insn_num] = insn_num; // later changed - cf_stack.push_back(insn_num); - break; - case TPF_OPCODE_ELSE: - case TPF_OPCODE_CASE: - check(!cf_stack.empty()); - v = cf_stack.back(); - if(program.insns[insn_num]->opcode == TPF_OPCODE_ELSE) - check(program.insns[v]->opcode == TPF_OPCODE_IF); - else - check(program.insns[v]->opcode == TPF_OPCODE_SWITCH || program.insns[v]->opcode == TPF_OPCODE_CASE); - cf_insn_linked[insn_num] = cf_insn_linked[v]; // later changed - cf_insn_linked[v] = insn_num; - cf_stack.back() = insn_num; - break; - case TPF_OPCODE_ENDSWITCH: - case TPF_OPCODE_ENDIF: - check(!cf_stack.empty()); - v = cf_stack.back(); - if(program.insns[insn_num]->opcode == TPF_OPCODE_ENDIF) - check(program.insns[v]->opcode == TPF_OPCODE_IF || program.insns[v]->opcode == TPF_OPCODE_ELSE); - else - check(program.insns[v]->opcode == TPF_OPCODE_SWITCH || program.insns[v]->opcode == TPF_OPCODE_CASE); - cf_insn_linked[insn_num] = cf_insn_linked[v]; - cf_insn_linked[v] = insn_num; - cf_stack.pop_back(); - break; - } - } - check(cf_stack.empty()); - program.cf_insn_linked.swap(cf_insn_linked); - return true; -} - -bool tpf_find_labels(tpf_program& program) -{ - if(program.labels_found) - return true; - - std::vector labels; - for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) - { - switch(program.insns[insn_num]->opcode) - { - case TPF_OPCODE_LABEL: - if(program.insns[insn_num]->num_ops > 0) - { - tpf_op& op = *program.insns[insn_num]->ops[0]; - if(op.file == TPF_FILE_LABEL && op.has_simple_index()) - { - unsigned idx = (unsigned)op.indices[0].disp; - if(idx >= labels.size()) - labels.resize(idx + 1); - labels[idx] = insn_num; - } - } - break; - } - } - program.label_to_insn_num.swap(labels); - program.labels_found = true; - return true; -} - -bool tpf_allocate_resource_sampler_pairs(tpf_program& program) -{ - if(program.resource_sampler_slots_assigned) - return true; - - std::set > pairs; - std::set resinfos; - - for(unsigned insn_num = 0; insn_num < program.insns.size(); ++insn_num) - { - int resource = -1; - int sampler = -2; - for(unsigned i = 0; i < program.insns[insn_num]->num_ops; ++i) - { - tpf_op* op = program.insns[insn_num]->ops[i].get(); - if(op) - { - if(op->file == TPF_FILE_RESOURCE) - { - if(!op->has_simple_index() || resource >= 0) - return false; - resource = (int)op->indices[0].disp; - } - if(op->file == TPF_FILE_SAMPLER) - { - if(!op->has_simple_index() || sampler >= 0) - return false; - sampler = (int)op->indices[0].disp; - } - } - } - - unsigned opcode = program.insns[insn_num]->opcode; - if(opcode == TPF_OPCODE_LD || opcode == TPF_OPCODE_LD_MS) - sampler = -1; - if(sampler >= -1 && resource >= 0) - pairs.insert(std::make_pair(resource, sampler)); - if(opcode == TPF_OPCODE_RESINFO) - resinfos.insert(resource); - } - - for(std::set >::iterator i = pairs.begin(); i != pairs.end(); ++i) - { - program.resource_sampler_to_slot[*i] = program.slot_to_resource.size(); - if(!program.resource_to_slot.count(i->first)) - { - program.resource_to_slot[i->first] = program.slot_to_resource.size(); - resinfos.erase(i->first); - } - program.slot_to_resource.push_back(i->first); - program.slot_to_sampler.push_back(i->second); - } - - for(std::set::iterator i = resinfos.begin(); i != resinfos.end(); ++i) - { - program.resource_sampler_to_slot[std::make_pair(*i, -1)] = program.slot_to_resource.size(); - program.resource_to_slot[*i] = program.slot_to_resource.size(); - program.slot_to_resource.push_back(*i); - program.slot_to_sampler.push_back(-1); - } - program.resource_sampler_slots_assigned = true; - return true; -} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp deleted file mode 100644 index 2e6e0949a8a..00000000000 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_dump.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "tpf.h" - -// TODO: we should fix this to output the same syntax as fxc, if tpf_dump_ms_syntax is set - -bool tpf_dump_ms_syntax = true; - -std::ostream& operator <<(std::ostream& out, const tpf_op& op) -{ - if(op.neg) - out << '-'; - if(op.abs) - out << '|'; - if(op.file == TPF_FILE_IMMEDIATE32) - { - out << "l("; - for(unsigned i = 0; i < op.comps; ++i) - { - if(i) - out << ", "; - out << op.imm_values[i].f32; - } - out << ")"; - } - else if(op.file == TPF_FILE_IMMEDIATE64) - { - out << "d("; - for(unsigned i = 0; i < op.comps; ++i) - { - if(i) - out << ", "; - out << op.imm_values[i].f64; - } - out << ")"; - return out; - } - else - { - bool naked = false; - if(tpf_dump_ms_syntax) - { - switch(op.file) - { - case TPF_FILE_TEMP: - case TPF_FILE_INPUT: - case TPF_FILE_OUTPUT: - case TPF_FILE_CONSTANT_BUFFER: - case TPF_FILE_INDEXABLE_TEMP: - case TPF_FILE_UNORDERED_ACCESS_VIEW: - case TPF_FILE_THREAD_GROUP_SHARED_MEMORY: - naked = true; - break; - default: - naked = false; - break; - } - } - - out << (tpf_dump_ms_syntax ? tpf_file_ms_names : tpf_file_names)[op.file]; - - if(op.indices[0].reg.get()) - naked = false; - - for(unsigned i = 0; i < op.num_indices; ++i) - { - if(!naked || i) - out << '['; - if(op.indices[i].reg.get()) - { - out << *op.indices[i].reg; - if(op.indices[i].disp) - out << '+' << op.indices[i].disp; - } - else - out << op.indices[i].disp; - if(!naked || i) - out << ']'; - } - if(op.comps) - { - switch(op.mode) - { - case TPF_OPERAND_MODE_MASK: - out << (tpf_dump_ms_syntax ? '.' : '!'); - for(unsigned i = 0; i < op.comps; ++i) - { - if(op.mask & (1 << i)) - out << "xyzw"[i]; - } - break; - case TPF_OPERAND_MODE_SWIZZLE: - out << '.'; - for(unsigned i = 0; i < op.comps; ++i) - out << "xyzw"[op.swizzle[i]]; - break; - case TPF_OPERAND_MODE_SCALAR: - out << (tpf_dump_ms_syntax ? '.' : ':'); - out << "xyzw"[op.swizzle[0]]; - break; - } - } - } - if(op.abs) - out << '|'; - return out; -} - -std::ostream& operator <<(std::ostream& out, const tpf_dcl& dcl) -{ - out << tpf_opcode_names[dcl.opcode]; - switch(dcl.opcode) - { - case TPF_OPCODE_DCL_GLOBAL_FLAGS: - if(dcl.dcl_global_flags.allow_refactoring) - out << " refactoringAllowed"; - if(dcl.dcl_global_flags.early_depth_stencil) - out << " forceEarlyDepthStencil"; - if(dcl.dcl_global_flags.fp64) - out << " enableDoublePrecisionFloatOps"; - if(dcl.dcl_global_flags.enable_raw_and_structured_in_non_cs) - out << " enableRawAndStructuredBuffers"; - break; - case TPF_OPCODE_DCL_INPUT_PS: - case TPF_OPCODE_DCL_INPUT_PS_SIV: - case TPF_OPCODE_DCL_INPUT_PS_SGV: - out << ' ' << tpf_interpolation_names[dcl.dcl_input_ps.interpolation]; - break; - case TPF_OPCODE_DCL_TEMPS: - out << ' ' << dcl.num; - break; - default: - break; - } - if(dcl.op.get()) - out << ' ' << *dcl.op; - switch(dcl.opcode) - { - case TPF_OPCODE_DCL_CONSTANT_BUFFER: - out << ", " << (dcl.dcl_constant_buffer.dynamic ? "dynamicIndexed" : "immediateIndexed"); - break; - case TPF_OPCODE_DCL_INPUT_SIV: - case TPF_OPCODE_DCL_INPUT_SGV: - case TPF_OPCODE_DCL_OUTPUT_SIV: - case TPF_OPCODE_DCL_OUTPUT_SGV: - case TPF_OPCODE_DCL_INPUT_PS_SIV: - case TPF_OPCODE_DCL_INPUT_PS_SGV: - out << ", " << tpf_sv_names[dcl.num]; - break; - } - - return out; -} - -std::ostream& operator <<(std::ostream& out, const tpf_insn& insn) -{ - out << tpf_opcode_names[insn.opcode]; - if(insn.insn.sat) - out << "_sat"; - for(unsigned i = 0; i < insn.num_ops; ++i) - { - if(i) - out << ','; - out << ' ' << *insn.ops[i]; - } - return out; -} - -std::ostream& operator <<(std::ostream& out, const tpf_program& program) -{ - out << "pvghdc"[program.version.type] << "s_" << program.version.major << "_" << program.version.minor << "\n"; - for(unsigned i = 0; i < program.dcls.size(); ++i) - out << *program.dcls[i] << "\n"; - - for(unsigned i = 0; i < program.insns.size(); ++i) - out << *program.insns[i] << "\n"; - return out; -} - -void tpf_op::dump() -{ - std::cout << *this; -} - -void tpf_insn::dump() -{ - std::cout << *this; -} - -void tpf_dcl::dump() -{ - std::cout << *this; -} - -void tpf_program::dump() -{ - std::cout << *this; -} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp deleted file mode 100644 index 2dfb88e5beb..00000000000 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "tpf.h" -#include "utils.h" - -#if 1 -#define check(x) assert(x) -#define fail(x) assert(0 && (x)) -#else -#define check(x) do {if(!(x)) throw(#x);} while(0) -#define fail(x) throw(x) -#endif - -struct tpf_parser -{ - unsigned* tokens; - unsigned* tokens_end; - tpf_program& program; - - tpf_parser(tpf_program& program, void* p_tokens, unsigned size) - : program(program) - { - tokens = (unsigned*)p_tokens; - tokens_end = (unsigned*)((char*)p_tokens + size); - } - - /* TODO: byteswap if machine is big endian */ - uint32_t read32() - { - check(tokens < tokens_end); - return bswap_le32(*tokens++); - } - - template - void read_token(T* tok) - { - *(unsigned*)tok = read32(); - } - - uint64_t read64() - { - unsigned a = read32(); - unsigned b = read32(); - return (uint64_t)a | ((uint64_t)b << 32); - } - - void skip(unsigned toskip) - { - tokens += toskip; - } - - void read_op(tpf_op* pop) - { - tpf_op& op = *pop; - tpf_token_operand optok; - read_token(&optok); - assert(optok.file < TPF_FILE_COUNT); - op.swizzle[0] = 0; - op.swizzle[1] = 1; - op.swizzle[2] = 2; - op.swizzle[3] = 3; - op.mask = 0xf; - switch(optok.comps_enum) - { - case TPF_OPERAND_COMPNUM_0: - op.comps = 0; - break; - case TPF_OPERAND_COMPNUM_1: - op.comps = 1; - break; - case TPF_OPERAND_COMPNUM_4: - op.comps = 4; - op.mode = optok.mode; - switch(optok.mode) - { - case TPF_OPERAND_MODE_MASK: - op.mask = TPF_OPERAND_SEL_MASK(optok.sel); - break; - case TPF_OPERAND_MODE_SWIZZLE: - op.swizzle[0] = TPF_OPERAND_SEL_SWZ(optok.sel, 0); - op.swizzle[1] = TPF_OPERAND_SEL_SWZ(optok.sel, 1); - op.swizzle[2] = TPF_OPERAND_SEL_SWZ(optok.sel, 2); - op.swizzle[3] = TPF_OPERAND_SEL_SWZ(optok.sel, 3); - break; - case TPF_OPERAND_MODE_SCALAR: - op.swizzle[0] = op.swizzle[1] = op.swizzle[2] = op.swizzle[3] = TPF_OPERAND_SEL_SCALAR(optok.sel); - break; - } - break; - case TPF_OPERAND_COMPNUM_N: - fail("Unhandled operand component type"); - } - op.file = (tpf_file)optok.file; - op.num_indices = optok.num_indices; - - if(optok.extended) - { - tpf_token_operand_extended optokext; - read_token(&optokext); - if(optokext.type == 0) - {} - else if(optokext.type == 1) - { - op.neg = optokext.neg; - op.abs= optokext.abs; - } - else - fail("Unhandled extended operand token type"); - } - - for(unsigned i = 0; i < op.num_indices; ++i) - { - unsigned repr; - if(i == 0) - repr = optok.index0_repr; - else if(i == 1) - repr = optok.index1_repr; - else if(i == 2) - repr = optok.index2_repr; - else - fail("Unhandled operand index representation"); - op.indices[0].disp = 0; - // TODO: is disp supposed to be signed here?? - switch(repr) - { - case TPF_OPERAND_INDEX_REPR_IMM32: - op.indices[i].disp = (int32_t)read32(); - break; - case TPF_OPERAND_INDEX_REPR_IMM64: - op.indices[i].disp = read64(); - break; - case TPF_OPERAND_INDEX_REPR_REG: -relative: - op.indices[i].reg.reset(new tpf_op()); - read_op(&*op.indices[0].reg); - break; - case TPF_OPERAND_INDEX_REPR_REG_IMM32: - op.indices[i].disp = (int32_t)read32(); - goto relative; - case TPF_OPERAND_INDEX_REPR_REG_IMM64: - op.indices[i].disp = read64(); - goto relative; - } - } - - if(op.file == TPF_FILE_IMMEDIATE32) - { - for(unsigned i = 0; i < op.comps; ++i) - op.imm_values[i].i32 = read32(); - } - else if(op.file == TPF_FILE_IMMEDIATE64) - { - for(unsigned i = 0; i < op.comps; ++i) - op.imm_values[i].i64 = read64(); - } - } - - void do_parse() - { - read_token(&program.version); - - unsigned lentok = read32(); - tokens_end = tokens - 2 + lentok; - - while(tokens != tokens_end) - { - tpf_token_instruction insntok; - read_token(&insntok); - unsigned* insn_end = tokens - 1 + insntok.length; - tpf_opcode opcode = (tpf_opcode)insntok.opcode; - check(opcode < TPF_OPCODE_COUNT); - - if(opcode == TPF_OPCODE_CUSTOMDATA) - { - unsigned customlen = read32() - 2; - skip(customlen); - continue; - } - - if((opcode >= TPF_OPCODE_DCL_RESOURCE && opcode <= TPF_OPCODE_DCL_GLOBAL_FLAGS) - || (opcode >= TPF_OPCODE_DCL_STREAM && opcode <= TPF_OPCODE_DCL_RESOURCE_STRUCTURED)) - { - tpf_dcl& dcl = *new tpf_dcl; - program.dcls.push_back(&dcl); - (tpf_token_instruction&)dcl = insntok; - - tpf_token_instruction_extended exttok; - memcpy(&exttok, &insntok, sizeof(exttok)); - while(exttok.extended) - { - read_token(&exttok); - } - -#define READ_OP_ANY dcl.op.reset(new tpf_op()); read_op(&*dcl.op); -#define READ_OP(FILE) READ_OP_ANY - //check(dcl.op->file == TPF_FILE_##FILE); - - switch(opcode) - { - case TPF_OPCODE_DCL_GLOBAL_FLAGS: - break; - case TPF_OPCODE_DCL_RESOURCE: - READ_OP(RESOURCE); - read_token(&dcl.rrt); - break; - case TPF_OPCODE_DCL_SAMPLER: - READ_OP(SAMPLER); - break; - case TPF_OPCODE_DCL_INPUT: - case TPF_OPCODE_DCL_INPUT_PS: - READ_OP(INPUT); - break; - case TPF_OPCODE_DCL_INPUT_SIV: - case TPF_OPCODE_DCL_INPUT_SGV: - case TPF_OPCODE_DCL_INPUT_PS_SIV: - case TPF_OPCODE_DCL_INPUT_PS_SGV: - READ_OP(INPUT); - dcl.sv = (tpf_sv)(uint16_t)read32(); - break; - case TPF_OPCODE_DCL_OUTPUT: - READ_OP(OUTPUT); - break; - case TPF_OPCODE_DCL_OUTPUT_SIV: - case TPF_OPCODE_DCL_OUTPUT_SGV: - READ_OP(OUTPUT); - dcl.sv = (tpf_sv)(uint16_t)read32(); - break; - case TPF_OPCODE_DCL_INDEX_RANGE: - READ_OP_ANY; - check(dcl.op->file == TPF_FILE_INPUT || dcl.op->file == TPF_FILE_OUTPUT); - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_TEMPS: - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_INDEXABLE_TEMP: - READ_OP(INDEXABLE_TEMP); - dcl.indexable_temp.num = read32(); - dcl.indexable_temp.comps = read32(); - break; - case TPF_OPCODE_DCL_CONSTANT_BUFFER: - READ_OP(CONSTANT_BUFFER); - break; - case TPF_OPCODE_DCL_GS_INPUT_PRIMITIVE: - case TPF_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY: - break; - case TPF_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT: - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_GS_INSTANCE_COUNT: - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT: - case TPF_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT: - case TPF_OPCODE_DCL_TESS_DOMAIN: - case TPF_OPCODE_DCL_TESS_PARTITIONING: - case TPF_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE: - break; - case TPF_OPCODE_DCL_HS_MAX_TESSFACTOR: - dcl.f32 = read32(); - break; - case TPF_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT: - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_FUNCTION_BODY: - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_FUNCTION_TABLE: - dcl.num = read32(); - dcl.data = malloc(dcl.num * sizeof(uint32_t)); - for(unsigned i = 0; i < dcl.num; ++i) - ((uint32_t*)dcl.data)[i] = read32(); - break; - case TPF_OPCODE_DCL_INTERFACE: - dcl.intf.id = read32(); - dcl.intf.expected_function_table_length = read32(); - { - uint32_t v = read32(); - dcl.intf.table_length = v & 0xffff; - dcl.intf.array_length = v >> 16; - } - dcl.data = malloc(dcl.intf.table_length * sizeof(uint32_t)); - for(unsigned i = 0; i < dcl.intf.table_length; ++i) - ((uint32_t*)dcl.data)[i] = read32(); - break; - case TPF_OPCODE_DCL_THREAD_GROUP: - dcl.thread_group_size[0] = read32(); - dcl.thread_group_size[1] = read32(); - dcl.thread_group_size[2] = read32(); - break; - case TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED: - READ_OP(UNORDERED_ACCESS_VIEW); - read_token(&dcl.rrt); - break; - case TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW: - READ_OP(UNORDERED_ACCESS_VIEW); - break; - case TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED: - READ_OP(UNORDERED_ACCESS_VIEW); - dcl.structured.stride = read32(); - break; - case TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW: - READ_OP(THREAD_GROUP_SHARED_MEMORY); - dcl.num = read32(); - break; - case TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED: - READ_OP(THREAD_GROUP_SHARED_MEMORY); - dcl.structured.stride = read32(); - dcl.structured.count = read32(); - break; - case TPF_OPCODE_DCL_RESOURCE_RAW: - READ_OP(RESOURCE); - break; - case TPF_OPCODE_DCL_RESOURCE_STRUCTURED: - READ_OP(RESOURCE); - dcl.structured.stride = read32(); - break; - case TPF_OPCODE_DCL_STREAM: - /* TODO: dcl_stream is undocumented: what is it? */ - fail("Unhandled dcl_stream since it's undocumented"); - default: - fail("Unhandled declaration"); - } - - check(tokens == insn_end); - } - else - { - tpf_insn& insn = *new tpf_insn; - program.insns.push_back(&insn); - (tpf_token_instruction&)insn = insntok; - - tpf_token_instruction_extended exttok; - memcpy(&exttok, &insntok, sizeof(exttok)); - while(exttok.extended) - { - read_token(&exttok); - if(exttok.type == TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_SAMPLE_CONTROLS) - { - insn.sample_offset[0] = exttok.sample_controls.offset_u; - insn.sample_offset[1] = exttok.sample_controls.offset_v; - insn.sample_offset[2] = exttok.sample_controls.offset_w; - } - else if(exttok.type == TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_DIM) - insn.resource_target = exttok.resource_target.target; - else if(exttok.type == TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_RETURN_TYPE) - { - insn.resource_return_type[0] = exttok.resource_return_type.x; - insn.resource_return_type[1] = exttok.resource_return_type.y; - insn.resource_return_type[2] = exttok.resource_return_type.z; - insn.resource_return_type[3] = exttok.resource_return_type.w; - } - } - - switch(opcode) - { - case TPF_OPCODE_INTERFACE_CALL: - insn.num = read32(); - break; - default: - break; - } - - unsigned op_num = 0; - while(tokens != insn_end) - { - check(tokens < insn_end); - check(op_num < TPF_MAX_OPS); - insn.ops[op_num].reset(new tpf_op); - read_op(&*insn.ops[op_num]); - ++op_num; - } - insn.num_ops = op_num; - } - } - } - - const char* parse() - { - try - { - do_parse(); - return 0; - } - catch(const char* error) - { - return error; - } - } -}; - -tpf_program* tpf_parse(void* tokens, int size) -{ - tpf_program* program = new tpf_program; - tpf_parser parser(*program, tokens, size); - if(!parser.parse()) - return program; - delete program; - return 0; -} diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp index 721f95fc8ac..20a7cbd1c38 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/tools/fxdis.cpp @@ -25,7 +25,7 @@ **************************************************************************/ #include "dxbc.h" -#include "tpf.h" +#include "sm4.h" #include #include @@ -60,14 +60,14 @@ int main(int argc, char** argv) if(dxbc) { std::cout << *dxbc; - dxbc_chunk_header* tpf_chunk = dxbc_find_shader_bytecode(&data[0], data.size()); - if(tpf_chunk) + dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(&data[0], data.size()); + if(sm4_chunk) { - tpf_program* tpf = tpf_parse(tpf_chunk + 1, bswap_le32(tpf_chunk->size)); - if(tpf) + sm4_program* sm4 = sm4_parse(sm4_chunk + 1, bswap_le32(sm4_chunk->size)); + if(sm4) { - std::cout << *tpf; - delete tpf; + std::cout << *sm4; + delete sm4; } } delete dxbc; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 50039e388d5..0c8d3ed9433 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -1172,17 +1172,17 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif ) { - dxbc_chunk_header* tpf_chunk = dxbc_find_shader_bytecode(pShaderBytecode, BytecodeLength); - if(!tpf_chunk) + dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(pShaderBytecode, BytecodeLength); + if(!sm4_chunk) return 0; - std::auto_ptr tpf(tpf_parse(tpf_chunk + 1, bswap_le32(tpf_chunk->size))); - if(!tpf.get()) + std::auto_ptr sm4(sm4_parse(sm4_chunk + 1, bswap_le32(sm4_chunk->size))); + if(!sm4.get()) return 0; struct pipe_shader_state tgsi_shader; memset(&tgsi_shader, 0, sizeof(tgsi_shader)); - tgsi_shader.tokens = (const tgsi_token*)tpf_to_tgsi(*tpf); + tgsi_shader.tokens = (const tgsi_token*)sm4_to_tgsi(*sm4); if(!tgsi_shader.tokens) return 0; @@ -1211,8 +1211,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen if(shader) { - shader->slot_to_resource = tpf->slot_to_resource; - shader->slot_to_sampler = tpf->slot_to_sampler; + shader->slot_to_resource = sm4->slot_to_resource; + shader->slot_to_sampler = sm4->slot_to_sampler; } free((void*)tgsi_shader.tokens); diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h index 6756b2112d8..0274a1baf66 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h @@ -33,8 +33,8 @@ #include #include "dxbc.h" -#include "tpf.h" -#include "tpf_to_tgsi.h" +#include "sm4.h" +#include "sm4_to_tgsi.h" #include "d3d1xstutil.h" diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp new file mode 100644 index 00000000000..995059e15b3 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -0,0 +1,832 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "sm4.h" +#include "tgsi/tgsi_ureg.h" +#include + +#if 1 +#define check(x) assert(x) +#define fail(x) assert(0 && (x)) +#else +#define check(x) do {if(!(x)) throw(#x);} while(0) +#define fail(x) throw(x) +#endif + +static unsigned sm4_to_pipe_interpolation[] = +{ + TGSI_INTERPOLATE_PERSPECTIVE, /* UNDEFINED */ + TGSI_INTERPOLATE_CONSTANT, + TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR */ + TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_CENTROID */ + TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE */ + TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_CENTROID */ + + // Added in D3D10.1 + TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_SAMPLE */ + TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_SAMPLE */ +}; + +static int sm4_to_pipe_sv[] = +{ + -1, + TGSI_SEMANTIC_POSITION, + -1, /*TGSI_SEMANTIC_CLIP_DISTANCE */ + -1, /*TGSI_SEMANTIC_CULL_DISTANCE */ + -1, /*TGSI_SEMANTIC_RENDER_TARGET_ARRAY_INDEX */ + -1, /*TGSI_SEMANTIC_VIEWPORT_ARRAY_INDEX */ + -1, /*TGSI_SEMANTIC_VERTEXID,*/ + TGSI_SEMANTIC_PRIMID, + TGSI_SEMANTIC_INSTANCEID, + TGSI_SEMANTIC_FACE, + -1, /*TGSI_SEMANTIC_SAMPLE_INDEX*/ +}; + +struct sm4_to_tgsi_converter +{ + struct ureg_program* ureg; + std::vector temps; + std::vector outputs; + std::vector inputs; + std::vector samplers; + std::vector > targets; // first is normal, second shadow/comparison + std::vector sampler_modes; // 0 = normal, 1 = shadow/comparison + std::vector > loops; + sm4_insn* insn; + struct sm4_program& program; + std::vector sm4_to_tgsi_insn_num; + std::vector > label_to_sm4_insn_num; + bool in_sub; + bool avoid_txf; + bool avoid_int; + + sm4_to_tgsi_converter(struct sm4_program& program) + : program(program) + { + avoid_txf = true; + avoid_int = false; + } + + struct ureg_dst _reg(sm4_op& op) + { + switch(op.file) + { + case SM4_FILE_NULL: + { + struct ureg_dst d; + memset(&d, 0, sizeof(d)); + d.File = TGSI_FILE_NULL; + return d; + } + case SM4_FILE_TEMP: + check(op.has_simple_index()); + check(op.indices[0].disp < temps.size()); + return temps[op.indices[0].disp]; + case SM4_FILE_OUTPUT: + check(op.has_simple_index()); + check(op.indices[0].disp < outputs.size()); + return outputs[op.indices[0].disp]; + default: + check(0); + return ureg_dst_undef(); + } + } + + struct ureg_dst _dst(unsigned i = 0) + { + check(i < insn->num_ops); + sm4_op& op = *insn->ops[i]; + check(op.mode == SM4_OPERAND_MODE_MASK || op.mode == SM4_OPERAND_MODE_SCALAR); + struct ureg_dst d = ureg_writemask(_reg(op), op.mask); + if(insn->insn.sat) + d = ureg_saturate(d); + return d; + } + + struct ureg_src _src(unsigned i) + { + check(i < insn->num_ops); + sm4_op& op = *insn->ops[i]; + struct ureg_src s; + switch(op.file) + { + case SM4_FILE_IMMEDIATE32: + s = ureg_imm4f(ureg, op.imm_values[0].f32, op.imm_values[1].f32, op.imm_values[2].f32, op.imm_values[3].f32); + break; + case SM4_FILE_INPUT: + check(op.has_simple_index()); + check(op.indices[0].disp < inputs.size()); + s = inputs[op.indices[0].disp]; + break; + case SM4_FILE_CONSTANT_BUFFER: + // TODO: indirect addressing + check(op.num_indices == 2); + check(op.is_index_simple(0)); + check(op.is_index_simple(1)); + s = ureg_src_register(TGSI_FILE_CONSTANT, (unsigned)op.indices[1].disp); + s.Dimension = 1; + s.DimensionIndex = op.indices[0].disp; + break; + default: + s = ureg_src(_reg(op)); + break; + } + if(op.mode == SM4_OPERAND_MODE_SWIZZLE || op.mode == SM4_OPERAND_MODE_SCALAR) + s = ureg_swizzle(s, op.swizzle[0], op.swizzle[1], op.swizzle[2], op.swizzle[3]); + else + { + /* immediates are masked to show needed values */ + check(op.file == SM4_FILE_IMMEDIATE32 || op.file == SM4_FILE_IMMEDIATE64); + } + if(op.abs) + s = ureg_abs(s); + if(op.neg) + s = ureg_negate(s); + return s; + }; + + int _idx(sm4_file file, unsigned i = 0) + { + check(i < insn->num_ops); + sm4_op& op = *insn->ops[i]; + check(op.file == file); + check(op.has_simple_index()); + return (int)op.indices[0].disp; + } + + int _texslot(bool have_sampler = true) + { + std::map, int>::iterator i; + i = program.resource_sampler_to_slot.find(std::make_pair(_idx(SM4_FILE_RESOURCE, 2), have_sampler ? _idx(SM4_FILE_SAMPLER, 3) : -1)); + check(i != program.resource_sampler_to_slot.end()); + return i->second; + } + + unsigned tex_target(unsigned texslot) + { + unsigned mode = sampler_modes[program.slot_to_sampler[texslot]]; + unsigned target; + if(mode) + target = targets[program.slot_to_resource[texslot]].second; + else + target = targets[program.slot_to_resource[texslot]].first; + check(target); + return target; + } + + std::vector insn_tmps; + + struct ureg_dst _tmp() + { + struct ureg_dst t = ureg_DECL_temporary(ureg); + insn_tmps.push_back(t); + return t; + } + + struct ureg_dst _tmp(struct ureg_dst d) + { + if(d.File == TGSI_FILE_TEMPORARY) + return d; + else + return ureg_writemask(_tmp(), d.WriteMask); + } + +#define OP1_(d, g) case SM4_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1)); break +#define OP2_(d, g) case SM4_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1), _src(2)); break +#define OP3_(d, g) case SM4_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1), _src(2), _src(3)); break +#define OP1(n) OP1_(n, n) +#define OP2(n) OP2_(n, n) +#define OP3(n) OP3_(n, n) +#define OP_CF(d, g) case SM4_OPCODE_##d: ureg_##g(ureg, &label); label_to_sm4_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); break; + + void translate_insns(unsigned begin, unsigned end) + { + for(unsigned insn_num = begin; insn_num < end; ++insn_num) + { + sm4_to_tgsi_insn_num[insn_num] = ureg_get_instruction_number(ureg); + unsigned label; + insn = program.insns[insn_num]; + bool ok; + ok = true; + switch(insn->opcode) + { + // trivial instructions + case SM4_OPCODE_NOP: + break; + OP1(MOV); + + // float + OP2(ADD); + OP2(MUL); + OP3(MAD); + OP2(DIV); + OP1(FRC); + OP1(RCP); + OP2(MIN); + OP2(MAX); + OP2_(LT, SLT); + OP2_(GE, SGE); + OP2_(EQ, SEQ); + OP2_(NE, SNE); + + // bitwise + OP1(NOT); + OP2(AND); + OP2(OR); + OP2(XOR); + + // special mathematical + OP2(DP2); + OP2(DP3); + OP2(DP4); + OP1(RSQ); + OP1_(LOG, LG2); + OP1_(EXP, EX2); + + // rounding + OP1_(ROUND_NE, ROUND); + OP1_(ROUND_Z, TRUNC); + OP1_(ROUND_PI, CEIL); + OP1_(ROUND_NI, FLR); + + // cross-thread + OP1_(DERIV_RTX, DDX); + OP1_(DERIV_RTX_COARSE, DDX); + OP1_(DERIV_RTX_FINE, DDX); + OP1_(DERIV_RTY, DDY); + OP1_(DERIV_RTY_COARSE, DDY); + OP1_(DERIV_RTY_FINE, DDY); + case SM4_OPCODE_EMIT: + ureg_EMIT(ureg); + break; + case SM4_OPCODE_CUT: + ureg_ENDPRIM(ureg); + break; + case SM4_OPCODE_EMITTHENCUT: + ureg_EMIT(ureg); + ureg_ENDPRIM(ureg); + break; + + // non-trivial instructions + case SM4_OPCODE_MOVC: + /* CMP checks for < 0, but MOVC checks for != 0 + * but fortunately, x != 0 is equivalent to -abs(x) < 0 + * XXX: can test_nz apply to this?! + */ + ureg_CMP(ureg, _dst(), ureg_negate(ureg_abs(_src(1))), _src(2), _src(3)); + break; + case SM4_OPCODE_SQRT: + { + struct ureg_dst d = _dst(); + struct ureg_dst t = _tmp(d); + ureg_RSQ(ureg, t, _src(1)); + ureg_RCP(ureg, d, ureg_src(t)); + break; + } + case SM4_OPCODE_SINCOS: + { + struct ureg_dst s = _dst(0); + struct ureg_dst c = _dst(1); + struct ureg_src v = _src(2); + if(s.File != TGSI_FILE_NULL) + ureg_SIN(ureg, s, v); + if(c.File != TGSI_FILE_NULL) + ureg_COS(ureg, c, v); + break; + } + + // control flow + case SM4_OPCODE_DISCARD: + ureg_KIL(ureg, _src(0)); + break; + OP_CF(LOOP, BGNLOOP); + OP_CF(ENDLOOP, ENDLOOP); + case SM4_OPCODE_BREAK: + ureg_BRK(ureg); + break; + case SM4_OPCODE_BREAKC: + // XXX: can test_nz apply to this?! + ureg_BREAKC(ureg, _src(0)); + break; + case SM4_OPCODE_CONTINUE: + ureg_CONT(ureg); + break; + case SM4_OPCODE_CONTINUEC: + // XXX: can test_nz apply to this?! + ureg_IF(ureg, _src(0), &label); + ureg_CONT(ureg); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + ureg_ENDIF(ureg); + break; + case SM4_OPCODE_SWITCH: + ureg_SWITCH(ureg, _src(0)); + break; + case SM4_OPCODE_CASE: + ureg_CASE(ureg, _src(0)); + break; + case SM4_OPCODE_DEFAULT: + ureg_DEFAULT(ureg); + break; + case SM4_OPCODE_ENDSWITCH: + ureg_ENDSWITCH(ureg); + break; + case SM4_OPCODE_CALL: + ureg_CAL(ureg, &label); + label_to_sm4_insn_num.push_back(std::make_pair(label, program.label_to_insn_num[_idx(SM4_FILE_LABEL)])); + break; + case SM4_OPCODE_LABEL: + if(in_sub) + ureg_ENDSUB(ureg); + else + ureg_END(ureg); + ureg_BGNSUB(ureg); + in_sub = true; + break; + case SM4_OPCODE_RET: + if(in_sub || insn_num != (program.insns.size() - 1)) + ureg_RET(ureg); + break; + case SM4_OPCODE_RETC: + ureg_IF(ureg, _src(0), &label); + if(insn->insn.test_nz) + ureg_RET(ureg); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + if(!insn->insn.test_nz) + { + ureg_ELSE(ureg, &label); + ureg_RET(ureg); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + } + ureg_ENDIF(ureg); + break; + OP_CF(ELSE, ELSE); + case SM4_OPCODE_ENDIF: + ureg_ENDIF(ureg); + break; + case SM4_OPCODE_IF: + if(insn->insn.test_nz) + { + ureg_IF(ureg, _src(0), &label); + label_to_sm4_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); + } + else + { + unsigned linked = program.cf_insn_linked[insn_num]; + if(program.insns[linked]->opcode == SM4_OPCODE_ENDIF) + { + ureg_IF(ureg, _src(0), &label); + ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); + ureg_ELSE(ureg, &label); + label_to_sm4_insn_num.push_back(std::make_pair(label, linked)); + } + else + { + /* we have to swap the branches in this case (fun!) + * TODO: maybe just emit a SEQ 0? + * */ + unsigned endif = program.cf_insn_linked[linked]; + + ureg_IF(ureg, _src(0), &label); + label_to_sm4_insn_num.push_back(std::make_pair(label, linked)); + + translate_insns(linked + 1, endif); + + sm4_to_tgsi_insn_num[linked] = ureg_get_instruction_number(ureg); + ureg_ELSE(ureg, &label); + label_to_sm4_insn_num.push_back(std::make_pair(label, endif)); + + translate_insns(insn_num + 1, linked); + + insn_num = endif - 1; + goto next; + } + } + break; + case SM4_OPCODE_RESINFO: + { + std::map::iterator i; + i = program.resource_to_slot.find(_idx(SM4_FILE_RESOURCE, 2)); + check(i != program.resource_to_slot.end()); + unsigned texslot = i->second; + + // no driver actually provides this, unfortunately + ureg_TXQ(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot]); + break; + }; + // TODO: sample offset, sample index + case SM4_OPCODE_LD: // dst, coord_int, res; mipmap level in last coord_int arg (ouch) + case SM4_OPCODE_LD_MS: + { + unsigned texslot = _texslot(false); + unsigned dim = 0; + switch(targets[texslot].first) + { + case TGSI_TEXTURE_1D: + dim = 1; + break; + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_RECT: + dim = 2; + break; + case TGSI_TEXTURE_3D: + dim = 3; + break; + default: + check(0); + } + struct ureg_dst tmp = _tmp(); + if(avoid_txf) + { + struct ureg_src texcoord; + if(!avoid_int) + { + ureg_I2F(ureg, tmp, _src(1)); + texcoord = ureg_src(tmp); + } + else + texcoord = _src(1); + + ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_swizzle(texcoord, 0, 1, 2, dim), samplers[texslot]); + } + else + ureg_TXF(ureg, _dst(), tex_target(texslot), ureg_swizzle(_src(1), 0, 1, 2, dim), samplers[texslot]); + break; + } + case SM4_OPCODE_SAMPLE: // dst, coord, res, samp + { + unsigned texslot = _texslot(); + ureg_TEX(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot]); + break; + } + case SM4_OPCODE_SAMPLE_B: // dst, coord, res, samp, bias.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_TXB(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + case SM4_OPCODE_SAMPLE_C: // dst, coord, res, samp, comp.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_TEX(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + case SM4_OPCODE_SAMPLE_C_LZ: // dst, coord, res, samp, comp.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_imm1f(ureg, 0.0)); + ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + case SM4_OPCODE_SAMPLE_D: // dst, coord, res, samp, ddx, ddy + { + unsigned texslot = _texslot(); + ureg_TXD(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot], _src(4), _src(5)); + break; + } + case SM4_OPCODE_SAMPLE_L: // dst, coord, res, samp, bias.x + { + unsigned texslot = _texslot(); + struct ureg_dst tmp = _tmp(); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); + ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); + ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); + break; + } + default: + ok = false; + break; + } + + if(!ok && !avoid_int) + { + ok = true; + switch(insn->opcode) + { + // integer + OP1_(ITOF, I2F); + OP1_(FTOI, F2I); + OP2_(IADD, UADD); + OP1(INEG); + OP2_(IMUL, UMUL); + OP3_(IMAD, UMAD); + OP2_(ISHL, SHL); + OP2_(ISHR, ISHR); + OP2(IMIN); + OP2(IMAX); + OP2_(ILT, ISLT); + OP2_(IGE, ISGE); + OP2_(IEQ, USEQ); + OP2_(INE, USNE); + + // unsigned + OP1_(UTOF, U2F); + OP1_(FTOU, F2U); + OP2(UMUL); + OP3(UMAD); + OP2(UMIN); + OP2(UMAX); + OP2_(ULT, USLT); + OP2_(UGE, USGE); + OP2(USHR); + + case SM4_OPCODE_UDIV: + { + struct ureg_dst q = _dst(0); + struct ureg_dst r = _dst(1); + struct ureg_src a = _src(2); + struct ureg_src b = _src(3); + if(q.File != TGSI_FILE_NULL) + ureg_UDIV(ureg, q, a, b); + if(r.File != TGSI_FILE_NULL) + ureg_UMOD(ureg, r, a, b); + break; + } + default: + ok = false; + } + } + + if(!ok && avoid_int) + { + ok = true; + switch(insn->opcode) + { + case SM4_OPCODE_ITOF: + case SM4_OPCODE_UTOF: + break; + OP1_(FTOI, TRUNC); + OP1_(FTOU, FLR); + // integer + OP2_(IADD, ADD); + OP2_(IMUL, MUL); + OP3_(IMAD, MAD); + OP2_(MIN, MIN); + OP2_(MAX, MAX); + OP2_(ILT, SLT); + OP2_(IGE, SGE); + OP2_(IEQ, SEQ); + OP2_(INE, SNE); + + // unsigned + OP2_(UMUL, MUL); + OP3_(UMAD, MAD); + OP2_(UMIN, MIN); + OP2_(UMAX, MAX); + OP2_(ULT, SLT); + OP2_(UGE, SGE); + + case SM4_OPCODE_INEG: + ureg_MOV(ureg, _dst(), ureg_negate(_src(1))); + break; + case SM4_OPCODE_ISHL: + { + struct ureg_dst d = _dst(); + struct ureg_dst t = _tmp(d); + ureg_EX2(ureg, t, _src(2)); + ureg_MUL(ureg, d, ureg_src(t), _src(1)); + break; + } + case SM4_OPCODE_ISHR: + case SM4_OPCODE_USHR: + { + struct ureg_dst d = _dst(); + struct ureg_dst t = _tmp(d); + ureg_EX2(ureg, t, ureg_negate(_src(2))); + ureg_MUL(ureg, t, ureg_src(t), _src(1)); + ureg_FLR(ureg, d, ureg_src(t)); + break; + } + case SM4_OPCODE_UDIV: + { + struct ureg_dst q = _dst(0); + struct ureg_dst r = _dst(1); + struct ureg_src a = _src(2); + struct ureg_src b = _src(3); + struct ureg_dst f = _tmp(); + ureg_DIV(ureg, f, a, b); + if(q.File != TGSI_FILE_NULL) + ureg_FLR(ureg, q, ureg_src(f)); + if(r.File != TGSI_FILE_NULL) + { + ureg_FRC(ureg, f, ureg_src(f)); + ureg_MUL(ureg, r, ureg_src(f), b); + } + break; + } + default: + ok = false; + } + } + + check(ok); + + if(!insn_tmps.empty()) + { + for(unsigned i = 0; i < insn_tmps.size(); ++i) + ureg_release_temporary(ureg, insn_tmps[i]); + insn_tmps.clear(); + } +next:; + } + } + + void* do_translate() + { + unsigned processor; + switch(program.version.type) + { + case 0: + processor = TGSI_PROCESSOR_FRAGMENT; + break; + case 1: + processor = TGSI_PROCESSOR_VERTEX; + break; + case 2: + processor = TGSI_PROCESSOR_GEOMETRY; + break; + default: + fail("Tessellation and compute shaders not yet supported"); + return 0; + } + + if(!sm4_link_cf_insns(program)) + fail("Malformed control flow"); + if(!sm4_find_labels(program)) + fail("Failed to locate labels"); + if(!sm4_allocate_resource_sampler_pairs(program)) + fail("Unsupported (indirect?) accesses to resources and/or samplers"); + + ureg = ureg_create(processor); + + in_sub = false; + + for(unsigned i = 0; i < program.slot_to_resource.size(); ++i) + samplers.push_back(ureg_DECL_sampler(ureg, i)); + + sm4_to_tgsi_insn_num.resize(program.insns.size()); + for(unsigned insn_num = 0; insn_num < program.dcls.size(); ++insn_num) + { + sm4_dcl& dcl = *program.dcls[insn_num]; + int idx = -1; + if(dcl.op.get() && dcl.op->has_simple_index()) + idx = dcl.op->indices[0].disp; + switch(dcl.opcode) + { + case SM4_OPCODE_DCL_GLOBAL_FLAGS: + break; + case SM4_OPCODE_DCL_TEMPS: + for(unsigned i = 0; i < dcl.num; ++i) + temps.push_back(ureg_DECL_temporary(ureg)); + break; + case SM4_OPCODE_DCL_INPUT: + check(idx >= 0); + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); + if(processor == TGSI_PROCESSOR_VERTEX) + inputs[idx] = ureg_DECL_vs_input(ureg, idx); + else + check(0); + break; + case SM4_OPCODE_DCL_INPUT_PS: + check(idx >= 0); + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); + inputs[idx] = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, idx, sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation]); + break; + case SM4_OPCODE_DCL_OUTPUT: + check(idx >= 0); + if(outputs.size() <= (unsigned)idx) + outputs.resize(idx + 1); + if(processor == TGSI_PROCESSOR_FRAGMENT) + outputs[idx] = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, idx); + else + outputs[idx] = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, idx); + break; + case SM4_OPCODE_DCL_INPUT_SIV: + case SM4_OPCODE_DCL_INPUT_SGV: + case SM4_OPCODE_DCL_INPUT_PS_SIV: + case SM4_OPCODE_DCL_INPUT_PS_SGV: + check(idx >= 0); + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); + // TODO: is this correct? + inputs[idx] = ureg_DECL_system_value(ureg, idx, sm4_to_pipe_sv[dcl.sv], 0); + break; + case SM4_OPCODE_DCL_OUTPUT_SIV: + case SM4_OPCODE_DCL_OUTPUT_SGV: + check(idx >= 0); + if(outputs.size() <= (unsigned)idx) + outputs.resize(idx + 1); + check(sm4_to_pipe_sv[dcl.sv] >= 0); + outputs[idx] = ureg_DECL_output(ureg, sm4_to_pipe_sv[dcl.sv], 0); + break; + case SM4_OPCODE_DCL_RESOURCE: + check(idx >= 0); + if(targets.size() <= (unsigned)idx) + targets.resize(idx + 1); + switch(dcl.dcl_resource.target) + { + case SM4_TARGET_TEXTURE1D: + targets[idx].first = TGSI_TEXTURE_1D; + targets[idx].second = TGSI_TEXTURE_SHADOW1D; + break; + case SM4_TARGET_TEXTURE2D: + targets[idx].first = TGSI_TEXTURE_2D; + targets[idx].second = TGSI_TEXTURE_SHADOW2D; + break; + case SM4_TARGET_TEXTURE3D: + targets[idx].first = TGSI_TEXTURE_3D; + targets[idx].second = 0; + break; + case SM4_TARGET_TEXTURECUBE: + targets[idx].first = TGSI_TEXTURE_CUBE; + targets[idx].second = 0; + break; + default: + check(0); + } + break; + case SM4_OPCODE_DCL_SAMPLER: + check(idx >= 0); + if(sampler_modes.size() <= (unsigned)idx) + sampler_modes.resize(idx + 1); + check(!dcl.dcl_sampler.mono); + sampler_modes[idx] = dcl.dcl_sampler.shadow; + break; + case SM4_OPCODE_DCL_CONSTANT_BUFFER: + check(dcl.op->num_indices == 2); + check(dcl.op->is_index_simple(0)); + check(dcl.op->is_index_simple(1)); + idx = dcl.op->indices[0].disp; + ureg_DECL_constant2D(ureg, 0, (unsigned)dcl.op->indices[1].disp - 1, idx); + break; + default: + check(0); + } + } + + translate_insns(0, program.insns.size()); + sm4_to_tgsi_insn_num.push_back(ureg_get_instruction_number(ureg)); + if(in_sub) + ureg_ENDSUB(ureg); + else + ureg_END(ureg); + + for(unsigned i = 0; i < label_to_sm4_insn_num.size(); ++i) + ureg_fixup_label(ureg, label_to_sm4_insn_num[i].first, sm4_to_tgsi_insn_num[label_to_sm4_insn_num[i].second]); + + const struct tgsi_token * tokens = ureg_get_tokens(ureg, 0); + ureg_destroy(ureg); + return (void*)tokens; + } + + void* translate() + { + try + { + return do_translate(); + } + catch(const char*) + { + return 0; + } + } +}; + +void* sm4_to_tgsi(struct sm4_program& program) +{ + sm4_to_tgsi_converter conv(program); + return conv.translate(); +} diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.h b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.h new file mode 100644 index 00000000000..5722b277fb7 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.h @@ -0,0 +1,34 @@ +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef SM4_TO_TGSI_H_ +#define SM4_TO_TGSI_H_ + +#include "sm4.h" + +void* sm4_to_tgsi(struct sm4_program& program); + +#endif /* SM4_TO_TGSI_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp index 2e5062f2ca3..d210f8acad1 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/tools/dxbc2tgsi.cpp @@ -25,8 +25,8 @@ **************************************************************************/ #include "dxbc.h" -#include "tpf.h" -#include "../tpf_to_tgsi.h" +#include "sm4.h" +#include "../sm4_to_tgsi.h" #include "tgsi/tgsi_dump.h" #include #include @@ -62,16 +62,16 @@ int main(int argc, char** argv) if(dxbc) { std::cout << *dxbc; - dxbc_chunk_header* tpf_chunk = dxbc_find_shader_bytecode(&data[0], data.size()); - if(tpf_chunk) + dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(&data[0], data.size()); + if(sm4_chunk) { - tpf_program* tpf = tpf_parse(tpf_chunk + 1, bswap_le32(tpf_chunk->size)); - if(tpf) + sm4_program* sm4 = sm4_parse(sm4_chunk + 1, bswap_le32(sm4_chunk->size)); + if(sm4) { - const struct tgsi_token* tokens = (const struct tgsi_token*)tpf_to_tgsi(*tpf); + const struct tgsi_token* tokens = (const struct tgsi_token*)sm4_to_tgsi(*sm4); if(tokens) { - std::cout << *tpf; + std::cout << *sm4; std::cout << "\n# TGSI program: " << std::endl; tgsi_dump(tokens, 0); } diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp deleted file mode 100644 index 4d7c296bb62..00000000000 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp +++ /dev/null @@ -1,832 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "tpf.h" -#include "tgsi/tgsi_ureg.h" -#include - -#if 1 -#define check(x) assert(x) -#define fail(x) assert(0 && (x)) -#else -#define check(x) do {if(!(x)) throw(#x);} while(0) -#define fail(x) throw(x) -#endif - -static unsigned tpf_to_pipe_interpolation[] = -{ - TGSI_INTERPOLATE_PERSPECTIVE, /* UNDEFINED */ - TGSI_INTERPOLATE_CONSTANT, - TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR */ - TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_CENTROID */ - TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE */ - TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_CENTROID */ - - // Added in D3D10.1 - TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_SAMPLE */ - TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_SAMPLE */ -}; - -static int tpf_to_pipe_sv[] = -{ - -1, - TGSI_SEMANTIC_POSITION, - -1, /*TGSI_SEMANTIC_CLIP_DISTANCE */ - -1, /*TGSI_SEMANTIC_CULL_DISTANCE */ - -1, /*TGSI_SEMANTIC_RENDER_TARGET_ARRAY_INDEX */ - -1, /*TGSI_SEMANTIC_VIEWPORT_ARRAY_INDEX */ - -1, /*TGSI_SEMANTIC_VERTEXID,*/ - TGSI_SEMANTIC_PRIMID, - TGSI_SEMANTIC_INSTANCEID, - TGSI_SEMANTIC_FACE, - -1, /*TGSI_SEMANTIC_SAMPLE_INDEX*/ -}; - -struct tpf_to_tgsi_converter -{ - struct ureg_program* ureg; - std::vector temps; - std::vector outputs; - std::vector inputs; - std::vector samplers; - std::vector > targets; // first is normal, second shadow/comparison - std::vector sampler_modes; // 0 = normal, 1 = shadow/comparison - std::vector > loops; - tpf_insn* insn; - struct tpf_program& program; - std::vector tpf_to_tgsi_insn_num; - std::vector > label_to_tpf_insn_num; - bool in_sub; - bool avoid_txf; - bool avoid_int; - - tpf_to_tgsi_converter(struct tpf_program& program) - : program(program) - { - avoid_txf = true; - avoid_int = false; - } - - struct ureg_dst _reg(tpf_op& op) - { - switch(op.file) - { - case TPF_FILE_NULL: - { - struct ureg_dst d; - memset(&d, 0, sizeof(d)); - d.File = TGSI_FILE_NULL; - return d; - } - case TPF_FILE_TEMP: - check(op.has_simple_index()); - check(op.indices[0].disp < temps.size()); - return temps[op.indices[0].disp]; - case TPF_FILE_OUTPUT: - check(op.has_simple_index()); - check(op.indices[0].disp < outputs.size()); - return outputs[op.indices[0].disp]; - default: - check(0); - return ureg_dst_undef(); - } - } - - struct ureg_dst _dst(unsigned i = 0) - { - check(i < insn->num_ops); - tpf_op& op = *insn->ops[i]; - check(op.mode == TPF_OPERAND_MODE_MASK || op.mode == TPF_OPERAND_MODE_SCALAR); - struct ureg_dst d = ureg_writemask(_reg(op), op.mask); - if(insn->insn.sat) - d = ureg_saturate(d); - return d; - } - - struct ureg_src _src(unsigned i) - { - check(i < insn->num_ops); - tpf_op& op = *insn->ops[i]; - struct ureg_src s; - switch(op.file) - { - case TPF_FILE_IMMEDIATE32: - s = ureg_imm4f(ureg, op.imm_values[0].f32, op.imm_values[1].f32, op.imm_values[2].f32, op.imm_values[3].f32); - break; - case TPF_FILE_INPUT: - check(op.has_simple_index()); - check(op.indices[0].disp < inputs.size()); - s = inputs[op.indices[0].disp]; - break; - case TPF_FILE_CONSTANT_BUFFER: - // TODO: indirect addressing - check(op.num_indices == 2); - check(op.is_index_simple(0)); - check(op.is_index_simple(1)); - s = ureg_src_register(TGSI_FILE_CONSTANT, (unsigned)op.indices[1].disp); - s.Dimension = 1; - s.DimensionIndex = op.indices[0].disp; - break; - default: - s = ureg_src(_reg(op)); - break; - } - if(op.mode == TPF_OPERAND_MODE_SWIZZLE || op.mode == TPF_OPERAND_MODE_SCALAR) - s = ureg_swizzle(s, op.swizzle[0], op.swizzle[1], op.swizzle[2], op.swizzle[3]); - else - { - /* immediates are masked to show needed values */ - check(op.file == TPF_FILE_IMMEDIATE32 || op.file == TPF_FILE_IMMEDIATE64); - } - if(op.abs) - s = ureg_abs(s); - if(op.neg) - s = ureg_negate(s); - return s; - }; - - int _idx(tpf_file file, unsigned i = 0) - { - check(i < insn->num_ops); - tpf_op& op = *insn->ops[i]; - check(op.file == file); - check(op.has_simple_index()); - return (int)op.indices[0].disp; - } - - int _texslot(bool have_sampler = true) - { - std::map, int>::iterator i; - i = program.resource_sampler_to_slot.find(std::make_pair(_idx(TPF_FILE_RESOURCE, 2), have_sampler ? _idx(TPF_FILE_SAMPLER, 3) : -1)); - check(i != program.resource_sampler_to_slot.end()); - return i->second; - } - - unsigned tex_target(unsigned texslot) - { - unsigned mode = sampler_modes[program.slot_to_sampler[texslot]]; - unsigned target; - if(mode) - target = targets[program.slot_to_resource[texslot]].second; - else - target = targets[program.slot_to_resource[texslot]].first; - check(target); - return target; - } - - std::vector insn_tmps; - - struct ureg_dst _tmp() - { - struct ureg_dst t = ureg_DECL_temporary(ureg); - insn_tmps.push_back(t); - return t; - } - - struct ureg_dst _tmp(struct ureg_dst d) - { - if(d.File == TGSI_FILE_TEMPORARY) - return d; - else - return ureg_writemask(_tmp(), d.WriteMask); - } - -#define OP1_(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1)); break -#define OP2_(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1), _src(2)); break -#define OP3_(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, _dst(), _src(1), _src(2), _src(3)); break -#define OP1(n) OP1_(n, n) -#define OP2(n) OP2_(n, n) -#define OP3(n) OP3_(n, n) -#define OP_CF(d, g) case TPF_OPCODE_##d: ureg_##g(ureg, &label); label_to_tpf_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); break; - - void translate_insns(unsigned begin, unsigned end) - { - for(unsigned insn_num = begin; insn_num < end; ++insn_num) - { - tpf_to_tgsi_insn_num[insn_num] = ureg_get_instruction_number(ureg); - unsigned label; - insn = program.insns[insn_num]; - bool ok; - ok = true; - switch(insn->opcode) - { - // trivial instructions - case TPF_OPCODE_NOP: - break; - OP1(MOV); - - // float - OP2(ADD); - OP2(MUL); - OP3(MAD); - OP2(DIV); - OP1(FRC); - OP1(RCP); - OP2(MIN); - OP2(MAX); - OP2_(LT, SLT); - OP2_(GE, SGE); - OP2_(EQ, SEQ); - OP2_(NE, SNE); - - // bitwise - OP1(NOT); - OP2(AND); - OP2(OR); - OP2(XOR); - - // special mathematical - OP2(DP2); - OP2(DP3); - OP2(DP4); - OP1(RSQ); - OP1_(LOG, LG2); - OP1_(EXP, EX2); - - // rounding - OP1_(ROUND_NE, ROUND); - OP1_(ROUND_Z, TRUNC); - OP1_(ROUND_PI, CEIL); - OP1_(ROUND_NI, FLR); - - // cross-thread - OP1_(DERIV_RTX, DDX); - OP1_(DERIV_RTX_COARSE, DDX); - OP1_(DERIV_RTX_FINE, DDX); - OP1_(DERIV_RTY, DDY); - OP1_(DERIV_RTY_COARSE, DDY); - OP1_(DERIV_RTY_FINE, DDY); - case TPF_OPCODE_EMIT: - ureg_EMIT(ureg); - break; - case TPF_OPCODE_CUT: - ureg_ENDPRIM(ureg); - break; - case TPF_OPCODE_EMITTHENCUT: - ureg_EMIT(ureg); - ureg_ENDPRIM(ureg); - break; - - // non-trivial instructions - case TPF_OPCODE_MOVC: - /* CMP checks for < 0, but MOVC checks for != 0 - * but fortunately, x != 0 is equivalent to -abs(x) < 0 - * XXX: can test_nz apply to this?! - */ - ureg_CMP(ureg, _dst(), ureg_negate(ureg_abs(_src(1))), _src(2), _src(3)); - break; - case TPF_OPCODE_SQRT: - { - struct ureg_dst d = _dst(); - struct ureg_dst t = _tmp(d); - ureg_RSQ(ureg, t, _src(1)); - ureg_RCP(ureg, d, ureg_src(t)); - break; - } - case TPF_OPCODE_SINCOS: - { - struct ureg_dst s = _dst(0); - struct ureg_dst c = _dst(1); - struct ureg_src v = _src(2); - if(s.File != TGSI_FILE_NULL) - ureg_SIN(ureg, s, v); - if(c.File != TGSI_FILE_NULL) - ureg_COS(ureg, c, v); - break; - } - - // control flow - case TPF_OPCODE_DISCARD: - ureg_KIL(ureg, _src(0)); - break; - OP_CF(LOOP, BGNLOOP); - OP_CF(ENDLOOP, ENDLOOP); - case TPF_OPCODE_BREAK: - ureg_BRK(ureg); - break; - case TPF_OPCODE_BREAKC: - // XXX: can test_nz apply to this?! - ureg_BREAKC(ureg, _src(0)); - break; - case TPF_OPCODE_CONTINUE: - ureg_CONT(ureg); - break; - case TPF_OPCODE_CONTINUEC: - // XXX: can test_nz apply to this?! - ureg_IF(ureg, _src(0), &label); - ureg_CONT(ureg); - ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); - ureg_ENDIF(ureg); - break; - case TPF_OPCODE_SWITCH: - ureg_SWITCH(ureg, _src(0)); - break; - case TPF_OPCODE_CASE: - ureg_CASE(ureg, _src(0)); - break; - case TPF_OPCODE_DEFAULT: - ureg_DEFAULT(ureg); - break; - case TPF_OPCODE_ENDSWITCH: - ureg_ENDSWITCH(ureg); - break; - case TPF_OPCODE_CALL: - ureg_CAL(ureg, &label); - label_to_tpf_insn_num.push_back(std::make_pair(label, program.label_to_insn_num[_idx(TPF_FILE_LABEL)])); - break; - case TPF_OPCODE_LABEL: - if(in_sub) - ureg_ENDSUB(ureg); - else - ureg_END(ureg); - ureg_BGNSUB(ureg); - in_sub = true; - break; - case TPF_OPCODE_RET: - if(in_sub || insn_num != (program.insns.size() - 1)) - ureg_RET(ureg); - break; - case TPF_OPCODE_RETC: - ureg_IF(ureg, _src(0), &label); - if(insn->insn.test_nz) - ureg_RET(ureg); - ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); - if(!insn->insn.test_nz) - { - ureg_ELSE(ureg, &label); - ureg_RET(ureg); - ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); - } - ureg_ENDIF(ureg); - break; - OP_CF(ELSE, ELSE); - case TPF_OPCODE_ENDIF: - ureg_ENDIF(ureg); - break; - case TPF_OPCODE_IF: - if(insn->insn.test_nz) - { - ureg_IF(ureg, _src(0), &label); - label_to_tpf_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); - } - else - { - unsigned linked = program.cf_insn_linked[insn_num]; - if(program.insns[linked]->opcode == TPF_OPCODE_ENDIF) - { - ureg_IF(ureg, _src(0), &label); - ureg_fixup_label(ureg, label, ureg_get_instruction_number(ureg)); - ureg_ELSE(ureg, &label); - label_to_tpf_insn_num.push_back(std::make_pair(label, linked)); - } - else - { - /* we have to swap the branches in this case (fun!) - * TODO: maybe just emit a SEQ 0? - * */ - unsigned endif = program.cf_insn_linked[linked]; - - ureg_IF(ureg, _src(0), &label); - label_to_tpf_insn_num.push_back(std::make_pair(label, linked)); - - translate_insns(linked + 1, endif); - - tpf_to_tgsi_insn_num[linked] = ureg_get_instruction_number(ureg); - ureg_ELSE(ureg, &label); - label_to_tpf_insn_num.push_back(std::make_pair(label, endif)); - - translate_insns(insn_num + 1, linked); - - insn_num = endif - 1; - goto next; - } - } - break; - case TPF_OPCODE_RESINFO: - { - std::map::iterator i; - i = program.resource_to_slot.find(_idx(TPF_FILE_RESOURCE, 2)); - check(i != program.resource_to_slot.end()); - unsigned texslot = i->second; - - // no driver actually provides this, unfortunately - ureg_TXQ(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot]); - break; - }; - // TODO: sample offset, sample index - case TPF_OPCODE_LD: // dst, coord_int, res; mipmap level in last coord_int arg (ouch) - case TPF_OPCODE_LD_MS: - { - unsigned texslot = _texslot(false); - unsigned dim = 0; - switch(targets[texslot].first) - { - case TGSI_TEXTURE_1D: - dim = 1; - break; - case TGSI_TEXTURE_2D: - case TGSI_TEXTURE_RECT: - dim = 2; - break; - case TGSI_TEXTURE_3D: - dim = 3; - break; - default: - check(0); - } - struct ureg_dst tmp = _tmp(); - if(avoid_txf) - { - struct ureg_src texcoord; - if(!avoid_int) - { - ureg_I2F(ureg, tmp, _src(1)); - texcoord = ureg_src(tmp); - } - else - texcoord = _src(1); - - ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_swizzle(texcoord, 0, 1, 2, dim), samplers[texslot]); - } - else - ureg_TXF(ureg, _dst(), tex_target(texslot), ureg_swizzle(_src(1), 0, 1, 2, dim), samplers[texslot]); - break; - } - case TPF_OPCODE_SAMPLE: // dst, coord, res, samp - { - unsigned texslot = _texslot(); - ureg_TEX(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot]); - break; - } - case TPF_OPCODE_SAMPLE_B: // dst, coord, res, samp, bias.x - { - unsigned texslot = _texslot(); - struct ureg_dst tmp = _tmp(); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); - ureg_TXB(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); - break; - } - case TPF_OPCODE_SAMPLE_C: // dst, coord, res, samp, comp.x - { - unsigned texslot = _texslot(); - struct ureg_dst tmp = _tmp(); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), _src(1)); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), ureg_swizzle(_src(4), 0, 0, 0, 0)); - ureg_TEX(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); - break; - } - case TPF_OPCODE_SAMPLE_C_LZ: // dst, coord, res, samp, comp.x - { - unsigned texslot = _texslot(); - struct ureg_dst tmp = _tmp(); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), _src(1)); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), ureg_swizzle(_src(4), 0, 0, 0, 0)); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_imm1f(ureg, 0.0)); - ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); - break; - } - case TPF_OPCODE_SAMPLE_D: // dst, coord, res, samp, ddx, ddy - { - unsigned texslot = _texslot(); - ureg_TXD(ureg, _dst(), tex_target(texslot), _src(1), samplers[texslot], _src(4), _src(5)); - break; - } - case TPF_OPCODE_SAMPLE_L: // dst, coord, res, samp, bias.x - { - unsigned texslot = _texslot(); - struct ureg_dst tmp = _tmp(); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); - ureg_TXL(ureg, _dst(), tex_target(texslot), ureg_src(tmp), samplers[texslot]); - break; - } - default: - ok = false; - break; - } - - if(!ok && !avoid_int) - { - ok = true; - switch(insn->opcode) - { - // integer - OP1_(ITOF, I2F); - OP1_(FTOI, F2I); - OP2_(IADD, UADD); - OP1(INEG); - OP2_(IMUL, UMUL); - OP3_(IMAD, UMAD); - OP2_(ISHL, SHL); - OP2_(ISHR, ISHR); - OP2(IMIN); - OP2(IMAX); - OP2_(ILT, ISLT); - OP2_(IGE, ISGE); - OP2_(IEQ, USEQ); - OP2_(INE, USNE); - - // unsigned - OP1_(UTOF, U2F); - OP1_(FTOU, F2U); - OP2(UMUL); - OP3(UMAD); - OP2(UMIN); - OP2(UMAX); - OP2_(ULT, USLT); - OP2_(UGE, USGE); - OP2(USHR); - - case TPF_OPCODE_UDIV: - { - struct ureg_dst q = _dst(0); - struct ureg_dst r = _dst(1); - struct ureg_src a = _src(2); - struct ureg_src b = _src(3); - if(q.File != TGSI_FILE_NULL) - ureg_UDIV(ureg, q, a, b); - if(r.File != TGSI_FILE_NULL) - ureg_UMOD(ureg, r, a, b); - break; - } - default: - ok = false; - } - } - - if(!ok && avoid_int) - { - ok = true; - switch(insn->opcode) - { - case TPF_OPCODE_ITOF: - case TPF_OPCODE_UTOF: - break; - OP1_(FTOI, TRUNC); - OP1_(FTOU, FLR); - // integer - OP2_(IADD, ADD); - OP2_(IMUL, MUL); - OP3_(IMAD, MAD); - OP2_(MIN, MIN); - OP2_(MAX, MAX); - OP2_(ILT, SLT); - OP2_(IGE, SGE); - OP2_(IEQ, SEQ); - OP2_(INE, SNE); - - // unsigned - OP2_(UMUL, MUL); - OP3_(UMAD, MAD); - OP2_(UMIN, MIN); - OP2_(UMAX, MAX); - OP2_(ULT, SLT); - OP2_(UGE, SGE); - - case TPF_OPCODE_INEG: - ureg_MOV(ureg, _dst(), ureg_negate(_src(1))); - break; - case TPF_OPCODE_ISHL: - { - struct ureg_dst d = _dst(); - struct ureg_dst t = _tmp(d); - ureg_EX2(ureg, t, _src(2)); - ureg_MUL(ureg, d, ureg_src(t), _src(1)); - break; - } - case TPF_OPCODE_ISHR: - case TPF_OPCODE_USHR: - { - struct ureg_dst d = _dst(); - struct ureg_dst t = _tmp(d); - ureg_EX2(ureg, t, ureg_negate(_src(2))); - ureg_MUL(ureg, t, ureg_src(t), _src(1)); - ureg_FLR(ureg, d, ureg_src(t)); - break; - } - case TPF_OPCODE_UDIV: - { - struct ureg_dst q = _dst(0); - struct ureg_dst r = _dst(1); - struct ureg_src a = _src(2); - struct ureg_src b = _src(3); - struct ureg_dst f = _tmp(); - ureg_DIV(ureg, f, a, b); - if(q.File != TGSI_FILE_NULL) - ureg_FLR(ureg, q, ureg_src(f)); - if(r.File != TGSI_FILE_NULL) - { - ureg_FRC(ureg, f, ureg_src(f)); - ureg_MUL(ureg, r, ureg_src(f), b); - } - break; - } - default: - ok = false; - } - } - - check(ok); - - if(!insn_tmps.empty()) - { - for(unsigned i = 0; i < insn_tmps.size(); ++i) - ureg_release_temporary(ureg, insn_tmps[i]); - insn_tmps.clear(); - } -next:; - } - } - - void* do_translate() - { - unsigned processor; - switch(program.version.type) - { - case 0: - processor = TGSI_PROCESSOR_FRAGMENT; - break; - case 1: - processor = TGSI_PROCESSOR_VERTEX; - break; - case 2: - processor = TGSI_PROCESSOR_GEOMETRY; - break; - default: - fail("Tessellation and compute shaders not yet supported"); - return 0; - } - - if(!tpf_link_cf_insns(program)) - fail("Malformed control flow"); - if(!tpf_find_labels(program)) - fail("Failed to locate labels"); - if(!tpf_allocate_resource_sampler_pairs(program)) - fail("Unsupported (indirect?) accesses to resources and/or samplers"); - - ureg = ureg_create(processor); - - in_sub = false; - - for(unsigned i = 0; i < program.slot_to_resource.size(); ++i) - samplers.push_back(ureg_DECL_sampler(ureg, i)); - - tpf_to_tgsi_insn_num.resize(program.insns.size()); - for(unsigned insn_num = 0; insn_num < program.dcls.size(); ++insn_num) - { - tpf_dcl& dcl = *program.dcls[insn_num]; - int idx = -1; - if(dcl.op.get() && dcl.op->has_simple_index()) - idx = dcl.op->indices[0].disp; - switch(dcl.opcode) - { - case TPF_OPCODE_DCL_GLOBAL_FLAGS: - break; - case TPF_OPCODE_DCL_TEMPS: - for(unsigned i = 0; i < dcl.num; ++i) - temps.push_back(ureg_DECL_temporary(ureg)); - break; - case TPF_OPCODE_DCL_INPUT: - check(idx >= 0); - if(inputs.size() <= (unsigned)idx) - inputs.resize(idx + 1); - if(processor == TGSI_PROCESSOR_VERTEX) - inputs[idx] = ureg_DECL_vs_input(ureg, idx); - else - check(0); - break; - case TPF_OPCODE_DCL_INPUT_PS: - check(idx >= 0); - if(inputs.size() <= (unsigned)idx) - inputs.resize(idx + 1); - inputs[idx] = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, idx, tpf_to_pipe_interpolation[dcl.dcl_input_ps.interpolation]); - break; - case TPF_OPCODE_DCL_OUTPUT: - check(idx >= 0); - if(outputs.size() <= (unsigned)idx) - outputs.resize(idx + 1); - if(processor == TGSI_PROCESSOR_FRAGMENT) - outputs[idx] = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, idx); - else - outputs[idx] = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, idx); - break; - case TPF_OPCODE_DCL_INPUT_SIV: - case TPF_OPCODE_DCL_INPUT_SGV: - case TPF_OPCODE_DCL_INPUT_PS_SIV: - case TPF_OPCODE_DCL_INPUT_PS_SGV: - check(idx >= 0); - if(inputs.size() <= (unsigned)idx) - inputs.resize(idx + 1); - // TODO: is this correct? - inputs[idx] = ureg_DECL_system_value(ureg, idx, tpf_to_pipe_sv[dcl.sv], 0); - break; - case TPF_OPCODE_DCL_OUTPUT_SIV: - case TPF_OPCODE_DCL_OUTPUT_SGV: - check(idx >= 0); - if(outputs.size() <= (unsigned)idx) - outputs.resize(idx + 1); - check(tpf_to_pipe_sv[dcl.sv] >= 0); - outputs[idx] = ureg_DECL_output(ureg, tpf_to_pipe_sv[dcl.sv], 0); - break; - case TPF_OPCODE_DCL_RESOURCE: - check(idx >= 0); - if(targets.size() <= (unsigned)idx) - targets.resize(idx + 1); - switch(dcl.dcl_resource.target) - { - case TPF_TARGET_TEXTURE1D: - targets[idx].first = TGSI_TEXTURE_1D; - targets[idx].second = TGSI_TEXTURE_SHADOW1D; - break; - case TPF_TARGET_TEXTURE2D: - targets[idx].first = TGSI_TEXTURE_2D; - targets[idx].second = TGSI_TEXTURE_SHADOW2D; - break; - case TPF_TARGET_TEXTURE3D: - targets[idx].first = TGSI_TEXTURE_3D; - targets[idx].second = 0; - break; - case TPF_TARGET_TEXTURECUBE: - targets[idx].first = TGSI_TEXTURE_CUBE; - targets[idx].second = 0; - break; - default: - check(0); - } - break; - case TPF_OPCODE_DCL_SAMPLER: - check(idx >= 0); - if(sampler_modes.size() <= (unsigned)idx) - sampler_modes.resize(idx + 1); - check(!dcl.dcl_sampler.mono); - sampler_modes[idx] = dcl.dcl_sampler.shadow; - break; - case TPF_OPCODE_DCL_CONSTANT_BUFFER: - check(dcl.op->num_indices == 2); - check(dcl.op->is_index_simple(0)); - check(dcl.op->is_index_simple(1)); - idx = dcl.op->indices[0].disp; - ureg_DECL_constant2D(ureg, 0, (unsigned)dcl.op->indices[1].disp - 1, idx); - break; - default: - check(0); - } - } - - translate_insns(0, program.insns.size()); - tpf_to_tgsi_insn_num.push_back(ureg_get_instruction_number(ureg)); - if(in_sub) - ureg_ENDSUB(ureg); - else - ureg_END(ureg); - - for(unsigned i = 0; i < label_to_tpf_insn_num.size(); ++i) - ureg_fixup_label(ureg, label_to_tpf_insn_num[i].first, tpf_to_tgsi_insn_num[label_to_tpf_insn_num[i].second]); - - const struct tgsi_token * tokens = ureg_get_tokens(ureg, 0); - ureg_destroy(ureg); - return (void*)tokens; - } - - void* translate() - { - try - { - return do_translate(); - } - catch(const char*) - { - return 0; - } - } -}; - -void* tpf_to_tgsi(struct tpf_program& program) -{ - tpf_to_tgsi_converter conv(program); - return conv.translate(); -} diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h deleted file mode 100644 index 68a30d2d2e4..00000000000 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.h +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#ifndef TPF_TO_TGSI_H_ -#define TPF_TO_TGSI_H_ - -#include "tpf.h" - -void* tpf_to_tgsi(struct tpf_program& program); - -#endif /* TPF_TO_TGSI_H_ */ -- cgit v1.2.3 From 6c598c78bd17642d731cf57b8369cc794f64ba2f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 13:44:22 +0200 Subject: d3d1x: normalize whitespace --- .../d3d1x/d3d1xshader/include/dxbc.h | 4 +- .../state_trackers/d3d1x/d3d1xshader/include/sm4.h | 2 +- .../d3d1x/d3d1xshader/src/sm4_analyze.cpp | 4 +- .../d3d1x/d3d1xstutil/include/d3d1xstutil.h | 260 ++++----- .../state_trackers/d3d1x/d3dapi/d3d10_1.idl | 18 +- .../state_trackers/d3d1x/d3dapi/d3d10misc.h | 18 +- .../state_trackers/d3d1x/d3dapi/d3d10shader.idl | 24 +- src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl | 628 ++++++++++----------- .../state_trackers/d3d1x/d3dapi/d3d11shader.idl | 36 +- .../state_trackers/d3d1x/d3dapi/d3dcommon.idl | 28 +- src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl | 520 ++++++++--------- .../state_trackers/d3d1x/d3dapi/dxgitype.idl | 68 +-- .../state_trackers/d3d1x/docs/coding_style.txt | 1 - .../state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp | 238 ++++---- .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 356 ++++++------ .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp | 24 +- .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp | 22 +- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 26 +- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 352 ++++++------ .../state_trackers/d3d1x/gd3d11/d3d11_misc.h | 38 +- .../state_trackers/d3d1x/gd3d11/d3d11_objects.h | 206 +++---- .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 214 +++---- .../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp | 2 +- .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp | 2 +- .../state_trackers/d3d1x/gd3dapi/galliumcom.idl | 2 +- .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl | 4 +- .../d3d1x/progs/d3d10app/d3d10x11main.cpp | 4 +- .../d3d1x/progs/d3d10tri/d3d10tri.cpp | 28 +- .../state_trackers/d3d1x/progs/d3d11app/d3d11u.h | 2 +- .../d3d1x/progs/d3d11app/d3d11x11main.cpp | 2 +- .../d3d1x/progs/d3d11gears/d3d11gears.cpp | 8 +- .../d3d1x/progs/d3d11tri/d3d11tri.cpp | 28 +- 32 files changed, 1584 insertions(+), 1585 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h index 06a078af6ec..5c7c87e5e8e 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h @@ -33,7 +33,7 @@ #include #include "le32.h" -#define FOURCC(a, b, c, d) ((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 )) +#define FOURCC(a, b, c, d) ((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 )) #define FOURCC_DXBC FOURCC('D', 'X', 'B', 'C') #define FOURCC_RDEF FOURCC('R', 'D', 'E', 'F') #define FOURCC_ISGN FOURCC('I', 'S', 'G', 'N') @@ -100,7 +100,7 @@ static inline dxbc_chunk_header* dxbc_find_shader_bytecode(const void* data, int static inline dxbc_chunk_signature* dxbc_find_signature(const void* data, int size, bool output) { - return (dxbc_chunk_signature*)dxbc_find_chunk(data, size, output ? FOURCC_OSGN : FOURCC_ISGN); + return (dxbc_chunk_signature*)dxbc_find_chunk(data, size, output ? FOURCC_OSGN : FOURCC_ISGN); } struct _D3D11_SIGNATURE_PARAMETER_DESC; diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h index 07f84f0c73f..c8404d96918 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h @@ -157,7 +157,7 @@ struct sm4_token_instruction }; }; -union sm4_token_instruction_extended +union sm4_token_instruction_extended { struct { diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp index 848db1bdbbb..7903d547f14 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_analyze.cpp @@ -167,7 +167,7 @@ bool sm4_allocate_resource_sampler_pairs(sm4_program& program) program.resource_sampler_to_slot[*i] = program.slot_to_resource.size(); if(!program.resource_to_slot.count(i->first)) { - program.resource_to_slot[i->first] = program.slot_to_resource.size(); + program.resource_to_slot[i->first] = program.slot_to_resource.size(); resinfos.erase(i->first); } program.slot_to_resource.push_back(i->first); @@ -177,7 +177,7 @@ bool sm4_allocate_resource_sampler_pairs(sm4_program& program) for(std::set::iterator i = resinfos.begin(); i != resinfos.end(); ++i) { program.resource_sampler_to_slot[std::make_pair(*i, -1)] = program.slot_to_resource.size(); - program.resource_to_slot[*i] = program.slot_to_resource.size(); + program.resource_to_slot[*i] = program.slot_to_resource.size(); program.slot_to_resource.push_back(*i); program.slot_to_sampler.push_back(-1); } diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 974518a5ce3..eebabaa9af5 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -200,7 +200,7 @@ extern "C" * with are unsafe regarding vtable layout. * In particular, consider the case where we try to delete GalliumComObject * with a pointer to GalliumComObject. - * Since we think that this is a GalliumComObject, we'll look for the + * Since we think that this is a GalliumComObject, we'll look for the * destructor in the vtable slot immediately after the ID3D11Resource vtable, but this is * actually an ID3D11Texture2D function implemented by the object! * @@ -441,7 +441,7 @@ struct GalliumComObject : public Base virtual HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, - void **ppvObject) + void **ppvObject) { /* see the initial comment for an explaination of this magic trick */ if(&riid == &IID_MAGIC_DELETE_THIS) @@ -487,9 +487,9 @@ struct GalliumMultiComObject : public BaseClass, SecondaryInterface return E_NOINTERFACE; } - virtual HRESULT STDMETHODCALLTYPE QueryInterface( + virtual HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, - void **ppvObject) + void **ppvObject) { /* see the initial comment for an explaination of this magic trick */ if(&riid == &IID_MAGIC_DELETE_THIS) @@ -836,77 +836,77 @@ struct GalliumPrivateDataComObject : public GalliumComObject } HRESULT get_private_data( - __in REFGUID guid, - __inout UINT *pDataSize, - __out_bcount_opt(*pDataSize) void *pData) - { + __in REFGUID guid, + __inout UINT *pDataSize, + __out_bcount_opt(*pDataSize) void *pData) + { lock_t lock(private_data_mutex); - private_data_map_t::iterator i = private_data_map.find(guid); - *pDataSize = 0; - if(i == private_data_map.end()) - return DXGI_ERROR_NOT_FOUND; - if(i->second.second == ~0u) - { - /* TODO: is GetPrivateData on interface data supposed to do this? */ - if(*pDataSize < sizeof(void*)) - return E_INVALIDARG; - if(pData) - { - memcpy(pData, &i->second.first, sizeof(void*)); + private_data_map_t::iterator i = private_data_map.find(guid); + *pDataSize = 0; + if(i == private_data_map.end()) + return DXGI_ERROR_NOT_FOUND; + if(i->second.second == ~0u) + { + /* TODO: is GetPrivateData on interface data supposed to do this? */ + if(*pDataSize < sizeof(void*)) + return E_INVALIDARG; + if(pData) + { + memcpy(pData, &i->second.first, sizeof(void*)); ((IUnknown*)i->second.first)->AddRef(); - } - *pDataSize = sizeof(void*); - } - else - { - unsigned size = std::min(*pDataSize, i->second.second); - if(pData) - memcpy(pData, i->second.first, size); - *pDataSize = size; - } - return S_OK; - } - - HRESULT set_private_data( - __in REFGUID guid, - __in UINT DataSize, - __in_bcount_opt( DataSize ) const void *pData) - { - void* p = 0; - - if(DataSize && pData) - { - p = malloc(DataSize); - if(!p) - return E_OUTOFMEMORY; - } - - lock_t lock(private_data_mutex); - std::pair& v = private_data_map[guid]; - if(v.first) - { - if(v.second == ~0u) - ((IUnknown*)v.first)->Release(); - else - free(v.first); - } - if(DataSize && pData) - { - memcpy(p, pData, DataSize); - v.first = p; - v.second = DataSize; - } - else - private_data_map.erase(guid); - return S_OK; - } - - HRESULT set_private_data_interface( - __in REFGUID guid, - __in_opt const IUnknown *pData) - { - lock_t lock(private_data_mutex); - std::pair& v = private_data_map[guid]; + } + *pDataSize = sizeof(void*); + } + else + { + unsigned size = std::min(*pDataSize, i->second.second); + if(pData) + memcpy(pData, i->second.first, size); + *pDataSize = size; + } + return S_OK; + } + + HRESULT set_private_data( + __in REFGUID guid, + __in UINT DataSize, + __in_bcount_opt( DataSize ) const void *pData) + { + void* p = 0; + + if(DataSize && pData) + { + p = malloc(DataSize); + if(!p) + return E_OUTOFMEMORY; + } + + lock_t lock(private_data_mutex); + std::pair& v = private_data_map[guid]; + if(v.first) + { + if(v.second == ~0u) + ((IUnknown*)v.first)->Release(); + else + free(v.first); + } + if(DataSize && pData) + { + memcpy(p, pData, DataSize); + v.first = p; + v.second = DataSize; + } + else + private_data_map.erase(guid); + return S_OK; + } + + HRESULT set_private_data_interface( + __in REFGUID guid, + __in_opt const IUnknown *pData) + { + lock_t lock(private_data_mutex); + std::pair& v = private_data_map[guid]; if(v.first) { if(v.second == ~0u) @@ -923,30 +923,30 @@ struct GalliumPrivateDataComObject : public GalliumComObject else private_data_map.erase(guid); return S_OK; - } + } virtual HRESULT STDMETHODCALLTYPE GetPrivateData( - __in REFGUID guid, - __inout UINT *pDataSize, - __out_bcount_opt(*pDataSize) void *pData) - { + __in REFGUID guid, + __inout UINT *pDataSize, + __out_bcount_opt(*pDataSize) void *pData) + { return get_private_data(guid, pDataSize, pData); - } - - virtual HRESULT STDMETHODCALLTYPE SetPrivateData( - __in REFGUID guid, - __in UINT DataSize, - __in_bcount_opt( DataSize ) const void *pData) - { - return set_private_data(guid, DataSize, pData); - } - - virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( - __in REFGUID guid, - __in_opt const IUnknown *pData) - { - return set_private_data_interface(guid, pData); - } + } + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + __in REFGUID guid, + __in UINT DataSize, + __in_bcount_opt( DataSize ) const void *pData) + { + return set_private_data(guid, DataSize, pData); + } + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + __in REFGUID guid, + __in_opt const IUnknown *pData) + { + return set_private_data_interface(guid, pData); + } }; template @@ -954,27 +954,27 @@ struct GalliumMultiPrivateDataComObject : public GalliumMultiComObjectQueryInterface(riid, ppParent); - } + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + return adapter.p->QueryInterface(riid, ppParent); + } virtual HRESULT STDMETHODCALLTYPE GetAdapter( - __out IDXGIAdapter **pAdapter) + __out IDXGIAdapter **pAdapter) { *pAdapter = adapter.ref(); return S_OK; } virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency( - __in_ecount(NumResources) IUnknown *const *ppResources, - __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, + __in_ecount(NumResources) IUnknown *const *ppResources, + __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, UINT NumResources) { for(unsigned i = 0; i < NumResources; ++i) @@ -1046,7 +1046,7 @@ struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObject + * Chia-I Wu */ #include "dxgi_private.h" @@ -38,153 +38,153 @@ extern "C" static const char * get_search_path(void) { - static const char *search_path; + static const char *search_path; - if (!search_path) { - static char buffer[1024]; - const char *p; - int ret; + if (!search_path) { + static char buffer[1024]; + const char *p; + int ret; - p = getenv("DXGI_DRIVERS_PATH"); - if(!p) - p = getenv("EGL_DRIVERS_PATH"); + p = getenv("DXGI_DRIVERS_PATH"); + if(!p) + p = getenv("EGL_DRIVERS_PATH"); #ifdef __unix__ - if (p && (geteuid() != getuid() || getegid() != getgid())) { - p = NULL; - } + if (p && (geteuid() != getuid() || getegid() != getgid())) { + p = NULL; + } #endif - if (p) { - ret = snprintf(buffer, sizeof(buffer), - "%s:%s", p, DXGI_DRIVER_SEARCH_DIR); - if (ret > 0 && ret < (int)sizeof(buffer)) - search_path = buffer; - } - } - if (!search_path) - search_path = DXGI_DRIVER_SEARCH_DIR; - - return search_path; + if (p) { + ret = snprintf(buffer, sizeof(buffer), + "%s:%s", p, DXGI_DRIVER_SEARCH_DIR); + if (ret > 0 && ret < (int)sizeof(buffer)) + search_path = buffer; + } + } + if (!search_path) + search_path = DXGI_DRIVER_SEARCH_DIR; + + return search_path; } static void for_each_colon_separated(const char *search_path, - bool (*loader)(const char *, size_t, void *), - void *loader_data) + bool (*loader)(const char *, size_t, void *), + void *loader_data) { - const char *cur, *next; - size_t len; + const char *cur, *next; + size_t len; - cur = search_path; - while (cur) { - next = strchr(cur, ':'); - len = (next) ? next - cur : strlen(cur); + cur = search_path; + while (cur) { + next = strchr(cur, ':'); + len = (next) ? next - cur : strlen(cur); - if (!loader(cur, len, loader_data)) - break; + if (!loader(cur, len, loader_data)) + break; - cur = (next) ? next + 1 : NULL; - } + cur = (next) ? next + 1 : NULL; + } } void for_each_in_search_path(bool (*callback)(const char *, size_t, void *), - void *callback_data) + void *callback_data) { - const char *search_path = get_search_path(); - for_each_colon_separated(search_path, callback, callback_data); + const char *search_path = get_search_path(); + for_each_colon_separated(search_path, callback, callback_data); } static struct pipe_module { - boolean initialized; - char *name; - struct util_dl_library *lib; - const struct drm_driver_descriptor *drmdd; - struct pipe_screen *(*swrast_create_screen)(struct sw_winsys *); + boolean initialized; + char *name; + struct util_dl_library *lib; + const struct drm_driver_descriptor *drmdd; + struct pipe_screen *(*swrast_create_screen)(struct sw_winsys *); } pipe_modules[16]; static bool dlopen_pipe_module_cb(const char *dir, size_t len, void *callback_data) { - struct pipe_module *pmod = (struct pipe_module *) callback_data; - char path[1024]; - int ret; - - if (len) { - ret = snprintf(path, sizeof(path), - "%.*s/" PIPE_PREFIX "%s" UTIL_DL_EXT, len, dir, pmod->name); - } - else { - ret = snprintf(path, sizeof(path), - PIPE_PREFIX "%s" UTIL_DL_EXT, pmod->name); - } - if (ret > 0 && ret < (int)sizeof(path)) { - pmod->lib = util_dl_open(path); - } - - return !(pmod->lib); + struct pipe_module *pmod = (struct pipe_module *) callback_data; + char path[1024]; + int ret; + + if (len) { + ret = snprintf(path, sizeof(path), + "%.*s/" PIPE_PREFIX "%s" UTIL_DL_EXT, len, dir, pmod->name); + } + else { + ret = snprintf(path, sizeof(path), + PIPE_PREFIX "%s" UTIL_DL_EXT, pmod->name); + } + if (ret > 0 && ret < (int)sizeof(path)) { + pmod->lib = util_dl_open(path); + } + + return !(pmod->lib); } static bool load_pipe_module(struct pipe_module *pmod, const char *name) { - pmod->name = strdup(name); - if (!pmod->name) - return FALSE; - - for_each_in_search_path(dlopen_pipe_module_cb, (void *) pmod); - if (pmod->lib) { - pmod->drmdd = (const struct drm_driver_descriptor *) - util_dl_get_proc_address(pmod->lib, "driver_descriptor"); - - /* sanity check on the name */ - if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) - pmod->drmdd = NULL; - - /* swrast */ - if (pmod->drmdd && !pmod->drmdd->driver_name) { - pmod->swrast_create_screen = - (struct pipe_screen *(*)(struct sw_winsys *)) - util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); - if (!pmod->swrast_create_screen) - pmod->drmdd = NULL; - } - - if (!pmod->drmdd) { - util_dl_close(pmod->lib); - pmod->lib = NULL; - } - } - - return (pmod->drmdd != NULL); + pmod->name = strdup(name); + if (!pmod->name) + return FALSE; + + for_each_in_search_path(dlopen_pipe_module_cb, (void *) pmod); + if (pmod->lib) { + pmod->drmdd = (const struct drm_driver_descriptor *) + util_dl_get_proc_address(pmod->lib, "driver_descriptor"); + + /* sanity check on the name */ + if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) + pmod->drmdd = NULL; + + /* swrast */ + if (pmod->drmdd && !pmod->drmdd->driver_name) { + pmod->swrast_create_screen = + (struct pipe_screen *(*)(struct sw_winsys *)) + util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); + if (!pmod->swrast_create_screen) + pmod->drmdd = NULL; + } + + if (!pmod->drmdd) { + util_dl_close(pmod->lib); + pmod->lib = NULL; + } + } + + return (pmod->drmdd != NULL); } static struct pipe_module * get_pipe_module(const char *name) { - struct pipe_module *pmod = NULL; - unsigned i; - - if (!name) - return NULL; - - for (i = 0; i < sizeof(pipe_modules) / sizeof(pipe_modules[0]); i++) { - if (!pipe_modules[i].initialized || - strcmp(pipe_modules[i].name, name) == 0) { - pmod = &pipe_modules[i]; - break; - } - } - if (!pmod) - return NULL; - - if (!pmod->initialized) { - load_pipe_module(pmod, name); - pmod->initialized = TRUE; - } - - return pmod; + struct pipe_module *pmod = NULL; + unsigned i; + + if (!name) + return NULL; + + for (i = 0; i < sizeof(pipe_modules) / sizeof(pipe_modules[0]); i++) { + if (!pipe_modules[i].initialized || + strcmp(pipe_modules[i].name, name) == 0) { + pmod = &pipe_modules[i]; + break; + } + } + if (!pmod) + return NULL; + + if (!pmod->initialized) { + load_pipe_module(pmod, name); + pmod->initialized = TRUE; + } + + return pmod; } struct native_display; @@ -192,15 +192,15 @@ struct native_display; struct pipe_screen * dxgi_loader_create_drm_screen(struct native_display* dpy, const char *name, int fd) { - struct pipe_module *pmod = get_pipe_module(name); - return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ? - pmod->drmdd->create_screen(fd) : NULL; + struct pipe_module *pmod = get_pipe_module(name); + return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ? + pmod->drmdd->create_screen(fd) : NULL; } struct pipe_screen * dxgi_loader_create_sw_screen(struct native_display* dpy, struct sw_winsys *ws) { - struct pipe_module *pmod = get_pipe_module("swrast"); - return (pmod && pmod->swrast_create_screen) ? - pmod->swrast_create_screen(ws) : NULL; + struct pipe_module *pmod = get_pipe_module("swrast"); + return (pmod && pmod->swrast_create_screen) ? + pmod->swrast_create_screen(ws) : NULL; } diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 2149d83a9c6..bf820e9b21b 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -55,12 +55,12 @@ struct GalliumDXGIObject : public GalliumPrivateDataComObject this->parent = p_parent; } - virtual HRESULT STDMETHODCALLTYPE GetParent( - __in REFIID riid, - __out void **ppParent) - { - return parent->QueryInterface(riid, ppParent); - } + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + return parent->QueryInterface(riid, ppParent); + } }; COM_INTERFACE(IGalliumDXGIBackend, IUnknown) @@ -96,7 +96,7 @@ struct GalliumDXGIIdentityBackend : public GalliumComObject struct GalliumDXGIFactory : public GalliumDXGIObject { - HWND associated_window; + HWND associated_window; const struct native_platform* platform; void* display; ComPtr backend; @@ -104,98 +104,98 @@ struct GalliumDXGIFactory : public GalliumDXGIObject GalliumDXGIFactory(const struct native_platform* platform, void* display, IGalliumDXGIBackend* p_backend) : GalliumDXGIObject((IUnknown*)NULL), platform(platform), display(display) - { + { if(p_backend) backend = p_backend; else backend.reset(new GalliumDXGIIdentityBackend()); } - virtual HRESULT STDMETHODCALLTYPE EnumAdapters( - UINT Adapter, - __out IDXGIAdapter **ppAdapter) + virtual HRESULT STDMETHODCALLTYPE EnumAdapters( + UINT Adapter, + __out IDXGIAdapter **ppAdapter) { return EnumAdapters1(Adapter, (IDXGIAdapter1**)ppAdapter); } - virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( - UINT Adapter, - __out IDXGIAdapter1 **ppAdapter) - { - *ppAdapter = 0; + virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( + UINT Adapter, + __out IDXGIAdapter1 **ppAdapter) + { + *ppAdapter = 0; if(Adapter == 0) { return GalliumDXGIAdapterCreate(this, platform, display, ppAdapter); } #if 0 // TODO: enable this - if(platform == native_get_x11_platform()) - { - unsigned nscreens = ScreenCount((Display*)display); - if(Adapter < nscreens) - { - unsigned def_screen = DefaultScreen(display); - if(Adapter <= def_screen) - --Adapter; - *ppAdapter = GalliumDXGIAdapterCreate(this, platform, display, Adapter); - return S_OK; - } - } + if(platform == native_get_x11_platform()) + { + unsigned nscreens = ScreenCount((Display*)display); + if(Adapter < nscreens) + { + unsigned def_screen = DefaultScreen(display); + if(Adapter <= def_screen) + --Adapter; + *ppAdapter = GalliumDXGIAdapterCreate(this, platform, display, Adapter); + return S_OK; + } + } #endif return DXGI_ERROR_NOT_FOUND; - } - - /* TODO: this is a mysterious underdocumented magic API - * Can we have multiple windows associated? - * Can we have multiple windows associated if we use multiple factories? - * If so, what should GetWindowAssociation return? - * If not, does a new swapchain steal the association? - * Does this act for existing swapchains? For new swapchains? - */ - virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( - HWND WindowHandle, - UINT Flags) - { - /* TODO: actually implement, for Wine, X11 and KMS*/ - associated_window = WindowHandle; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( - __out HWND *pWindowHandle) - { - *pWindowHandle = associated_window; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( - __in IUnknown *pDevice, - __in DXGI_SWAP_CHAIN_DESC *pDesc, - __out IDXGISwapChain **ppSwapChain) - { - return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); - } - - virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( - HMODULE Module, - __out IDXGIAdapter **ppAdapter) - { - /* TODO: ignore the module, and just create a Gallium software screen */ - *ppAdapter = 0; - return E_NOTIMPL; - } - - /* TODO: support hotplug */ - virtual BOOL STDMETHODCALLTYPE IsCurrent( void) - { - return TRUE; - } + } + + /* TODO: this is a mysterious underdocumented magic API + * Can we have multiple windows associated? + * Can we have multiple windows associated if we use multiple factories? + * If so, what should GetWindowAssociation return? + * If not, does a new swapchain steal the association? + * Does this act for existing swapchains? For new swapchains? + */ + virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( + HWND WindowHandle, + UINT Flags) + { + /* TODO: actually implement, for Wine, X11 and KMS*/ + associated_window = WindowHandle; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( + __out HWND *pWindowHandle) + { + *pWindowHandle = associated_window; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( + __in IUnknown *pDevice, + __in DXGI_SWAP_CHAIN_DESC *pDesc, + __out IDXGISwapChain **ppSwapChain) + { + return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); + } + + virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( + HMODULE Module, + __out IDXGIAdapter **ppAdapter) + { + /* TODO: ignore the module, and just create a Gallium software screen */ + *ppAdapter = 0; + return E_NOTIMPL; + } + + /* TODO: support hotplug */ + virtual BOOL STDMETHODCALLTYPE IsCurrent( void) + { + return TRUE; + } }; struct GalliumDXGIAdapter : public GalliumMultiComObject< - GalliumDXGIObject, - IGalliumAdapter> + GalliumDXGIObject, + IGalliumAdapter> { struct native_display* display; const struct native_config** configs; @@ -275,62 +275,62 @@ struct GalliumDXGIAdapter free(connectors); } - virtual HRESULT STDMETHODCALLTYPE EnumOutputs( - UINT Output, - __out IDXGIOutput **ppOutput) + virtual HRESULT STDMETHODCALLTYPE EnumOutputs( + UINT Output, + __out IDXGIOutput **ppOutput) { - if(Output >= (unsigned)num_outputs) - return DXGI_ERROR_NOT_FOUND; + if(Output >= (unsigned)num_outputs) + return DXGI_ERROR_NOT_FOUND; - if(connectors) - { - std::ostringstream ss; - ss << "Output #" << Output; + if(connectors) + { + std::ostringstream ss; + ss << "Output #" << Output; return GalliumDXGIOutputCreate(this, ss.str(), connectors[Output], ppOutput); - } - else - return GalliumDXGIOutputCreate(this, "Unique output", NULL, ppOutput); + } + else + return GalliumDXGIOutputCreate(this, "Unique output", NULL, ppOutput); + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + __out DXGI_ADAPTER_DESC *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + return S_OK; } - virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_ADAPTER_DESC *pDesc) - { - memcpy(pDesc, &desc, sizeof(*pDesc)); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetDesc1( - __out DXGI_ADAPTER_DESC1 *pDesc) - { - memcpy(pDesc, &desc, sizeof(*pDesc)); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( - __in REFGUID InterfaceName, - __out LARGE_INTEGER *pUMDVersion) - { - // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear - if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) - { - pUMDVersion->QuadPart = 0x00080011000a0411ULL; - return S_OK; - } - return DXGI_ERROR_UNSUPPORTED; - } - - pipe_screen* STDMETHODCALLTYPE GetGalliumScreen() - { - return display->screen; - } - - pipe_screen* STDMETHODCALLTYPE GetGalliumReferenceSoftwareScreen() - { - // TODO: give a softpipe screen - return display->screen; - } - - pipe_screen* STDMETHODCALLTYPE GetGalliumFastSoftwareScreen() + virtual HRESULT STDMETHODCALLTYPE GetDesc1( + __out DXGI_ADAPTER_DESC1 *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( + __in REFGUID InterfaceName, + __out LARGE_INTEGER *pUMDVersion) + { + // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear + if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) + { + pUMDVersion->QuadPart = 0x00080011000a0411ULL; + return S_OK; + } + return DXGI_ERROR_UNSUPPORTED; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumScreen() + { + return display->screen; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumReferenceSoftwareScreen() + { + // TODO: give a softpipe screen + return display->screen; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumFastSoftwareScreen() { // TODO: give an llvmpipe screen return display->screen; @@ -407,7 +407,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_OUTPUT_DESC *pDesc) + __out DXGI_OUTPUT_DESC *pDesc) { *pDesc = desc; return S_OK; @@ -416,8 +416,8 @@ use_fake_mode: virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( DXGI_FORMAT EnumFormat, UINT Flags, - __inout UINT *pNumModes, - __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) + __inout UINT *pNumModes, + __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) { /* TODO: should we return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE when we don't * support modesetting instead of fake modes? @@ -452,9 +452,9 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( - __in const DXGI_MODE_DESC *pModeToMatch, - __out DXGI_MODE_DESC *pClosestMatch, - __in_opt IUnknown *pConcernedDevice) + __in const DXGI_MODE_DESC *pModeToMatch, + __out DXGI_MODE_DESC *pClosestMatch, + __in_opt IUnknown *pConcernedDevice) { /* TODO: actually implement this */ DXGI_FORMAT dxgi_format = pModeToMatch->Format; @@ -482,7 +482,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE TakeOwnership( - __in IUnknown *pDevice, + __in IUnknown *pDevice, BOOL Exclusive) { return S_OK; @@ -493,14 +493,14 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( - __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) + __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) { memset(pGammaCaps, 0, sizeof(*pGammaCaps)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE SetGammaControl( - __in const DXGI_GAMMA_CONTROL *pArray) + __in const DXGI_GAMMA_CONTROL *pArray) { if(!gamma) gamma = new DXGI_GAMMA_CONTROL; @@ -509,7 +509,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControl( - __out DXGI_GAMMA_CONTROL *pArray) + __out DXGI_GAMMA_CONTROL *pArray) { if(gamma) *pArray = *gamma; @@ -528,19 +528,19 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( - __in IDXGISurface *pScanoutSurface) + __in IDXGISurface *pScanoutSurface) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( - __in IDXGISurface *pDestination) + __in IDXGISurface *pDestination) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - __out DXGI_FRAME_STATISTICS *pStats) + __out DXGI_FRAME_STATISTICS *pStats) { memset(pStats, 0, sizeof(*pStats)); #ifdef _WIN32 @@ -579,7 +579,7 @@ use_fake_mode: * GetBuffer(n) with n > 0 points to resources that are identical to buffer 0, but * are classified as "read-only resources" (due to DXGI_USAGE_READ_ONLY), * meaning that you can't create render target views on them, or use them as - * a CopyResource/CopySubresourceRegion destination. + * a CopyResource/CopySubresourceRegion destination. * It appears the only valid operation is to use them as a source for CopyResource * and CopySubresourceRegion as well as just waiting for them to become * buffer 0 again. @@ -620,17 +620,17 @@ use_fake_mode: * * There are three strategies: * 1. Use a single buffer, and always copy it to a window system provided buffer, or - * just give the buffer to the window system if it supports that + * just give the buffer to the window system if it supports that * 2. Rotate the buffers in the D3D1x implementation, and recreate and rebind the views. - * Don't support driver-provided command lists + * Don't support driver-provided command lists * 3. Add this rotation functionality to the Gallium driver, with the idea that it would rotate - * remap GPU virtual memory, so that virtual address are unchanged, but the physical - * ones are rotated (so that pushbuffers remain valid). - * If the driver does not support this, either fall back to (1), or have a layer doing this, - * putting a deferred context layer over this intermediate layer. + * remap GPU virtual memory, so that virtual address are unchanged, but the physical + * ones are rotated (so that pushbuffers remain valid). + * If the driver does not support this, either fall back to (1), or have a layer doing this, + * putting a deferred context layer over this intermediate layer. * * (2) is not acceptable since it prevents an optimal implementation. - * (3) is the ideal solution, but it is complicated. + * (3) is the ideal solution, but it is complicated. * * Hence, we implement (1) for now, and will switch to (3) later. * @@ -872,7 +872,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectdestroy(pipe); } - virtual HRESULT STDMETHODCALLTYPE GetDevice( - __in REFIID riid, - __out void **ppDevice) - { - return dxgi_device->QueryInterface(riid, ppDevice); - } + virtual HRESULT STDMETHODCALLTYPE GetDevice( + __in REFIID riid, + __out void **ppDevice) + { + return dxgi_device->QueryInterface(riid, ppDevice); + } - HRESULT create_buffer0() - { - HRESULT hr; + HRESULT create_buffer0() + { + HRESULT hr; ComPtr new_buffer0; DXGI_USAGE usage = DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_RENDER_TARGET_OUTPUT; if(desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD) @@ -987,7 +987,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectformat; gallium_buffer0_view = pipe->create_sampler_view(pipe, gallium_buffer0, &templat); return S_OK; - } + } bool validate() { @@ -1158,9 +1158,9 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetBuffer( - UINT Buffer, - __in REFIID riid, - __out void **ppSurface) + UINT Buffer, + __in REFIID riid, + __out void **ppSurface) { if(Buffer > 0) { @@ -1182,7 +1182,7 @@ end_present: /* TODO: implement somehow */ virtual HRESULT STDMETHODCALLTYPE SetFullscreenState( BOOL Fullscreen, - __in_opt IDXGIOutput *pTarget) + __in_opt IDXGIOutput *pTarget) { fullscreen = Fullscreen; target = pTarget; @@ -1190,8 +1190,8 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetFullscreenState( - __out BOOL *pFullscreen, - __out IDXGIOutput **ppTarget) + __out BOOL *pFullscreen, + __out IDXGIOutput **ppTarget) { if(pFullscreen) *pFullscreen = fullscreen; @@ -1201,7 +1201,7 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_SWAP_CHAIN_DESC *pDesc) + __out DXGI_SWAP_CHAIN_DESC *pDesc) { *pDesc = desc; return S_OK; @@ -1243,14 +1243,14 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetContainingOutput( - __out IDXGIOutput **ppOutput) + __out IDXGIOutput **ppOutput) { *ppOutput = adapter->outputs[0].ref(); return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - __out DXGI_FRAME_STATISTICS *pStats) + __out DXGI_FRAME_STATISTICS *pStats) { memset(pStats, 0, sizeof(*pStats)); #ifdef _WIN32 @@ -1263,7 +1263,7 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( - __out UINT *pLastPresentCount) + __out UINT *pLastPresentCount) { *pLastPresentCount = present_count; return S_OK; @@ -1389,11 +1389,11 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() } /* TODO: why did Microsoft add this? should we do something different for DXGI 1.0 and 1.1? - * Or perhaps what they actually mean is "only create a single factory in your application"? - * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ - HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( - __in REFIID riid, - __out void **ppFactory + * Or perhaps what they actually mean is "only create a single factory in your application"? + * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ + HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( + __in REFIID riid, + __out void **ppFactory ) { GalliumDXGIFactory* factory; @@ -1409,9 +1409,9 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() return hres; } - HRESULT STDMETHODCALLTYPE CreateDXGIFactory( - __in REFIID riid, - __out void **ppFactory + HRESULT STDMETHODCALLTYPE CreateDXGIFactory( + __in REFIID riid, + __out void **ppFactory ) { return CreateDXGIFactory1(riid, ppFactory); diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp index dd002261342..3ab8cda191f 100644 --- a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp @@ -30,13 +30,13 @@ #include #include -HRESULT D3D10CreateDevice1( +HRESULT D3D10CreateDevice1( __in_opt IDXGIAdapter *pAdapter, - __in D3D10_DRIVER_TYPE DriverType, - __in HMODULE Software, - __in unsigned Flags, - __in D3D10_FEATURE_LEVEL1 HardwareLevel, - __in unsigned SDKVersion, + __in D3D10_DRIVER_TYPE DriverType, + __in HMODULE Software, + __in unsigned Flags, + __in D3D10_FEATURE_LEVEL1 HardwareLevel, + __in unsigned SDKVersion, __out_opt ID3D10Device1 **ppDevice ) { @@ -87,7 +87,7 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( D3D10_DRIVER_TYPE DriverType, HMODULE Software, unsigned Flags, - __in D3D10_FEATURE_LEVEL1 HardwareLevel, + __in D3D10_FEATURE_LEVEL1 HardwareLevel, unsigned SDKVersion, __in_opt DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, __out_opt IDXGISwapChain** ppSwapChain, @@ -122,12 +122,12 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( return hr; } -HRESULT D3D10CreateDevice( +HRESULT D3D10CreateDevice( __in_opt IDXGIAdapter *pAdapter, - __in D3D10_DRIVER_TYPE DriverType, - __in HMODULE Software, - __in unsigned Flags, - __in unsigned SDKVersion, + __in D3D10_DRIVER_TYPE DriverType, + __in HMODULE Software, + __in unsigned Flags, + __in unsigned SDKVersion, __out_opt ID3D10Device **ppDevice ) { diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp index 86bb24baefd..66f69bb7306 100644 --- a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp @@ -30,17 +30,17 @@ #include #include -HRESULT D3D11CreateDevice( - __in_opt IDXGIAdapter *pAdapter, - __in D3D_DRIVER_TYPE DriverType, - __in HMODULE Software, - __in unsigned Flags, - __in_ecount_opt( FeatureLevels ) const D3D_FEATURE_LEVEL *pFeatureLevels, - __in unsigned FeatureLevels, - __in unsigned SDKVersion, - __out_opt ID3D11Device **ppDevice, - __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, - __out_opt ID3D11DeviceContext **ppImmediateContext +HRESULT D3D11CreateDevice( + __in_opt IDXGIAdapter *pAdapter, + __in D3D_DRIVER_TYPE DriverType, + __in HMODULE Software, + __in unsigned Flags, + __in_ecount_opt( FeatureLevels ) const D3D_FEATURE_LEVEL *pFeatureLevels, + __in unsigned FeatureLevels, + __in unsigned SDKVersion, + __out_opt ID3D11Device **ppDevice, + __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, + __out_opt ID3D11DeviceContext **ppImmediateContext ) { HRESULT hr; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 46a3905d8fc..3d3990a63ed 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -168,23 +168,23 @@ struct GalliumD3D11Screen : public GalliumD3D11ScreenBase #if API < 11 // we use a D3D11-like API internally virtual HRESULT STDMETHODCALLTYPE Map( - __in ID3D11Resource *pResource, - __in unsigned Subresource, - __in D3D11_MAP MapType, - __in unsigned MapFlags, - __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0; + __in ID3D11Resource *pResource, + __in unsigned Subresource, + __in D3D11_MAP MapType, + __in unsigned MapFlags, + __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0; virtual void STDMETHODCALLTYPE Unmap( - __in ID3D11Resource *pResource, - __in unsigned Subresource) = 0; + __in ID3D11Resource *pResource, + __in unsigned Subresource) = 0; virtual void STDMETHODCALLTYPE Begin( - __in ID3D11Asynchronous *pAsync) = 0; + __in ID3D11Asynchronous *pAsync) = 0; virtual void STDMETHODCALLTYPE End( - __in ID3D11Asynchronous *pAsync) = 0; + __in ID3D11Asynchronous *pAsync) = 0; virtual HRESULT STDMETHODCALLTYPE GetData( - __in ID3D11Asynchronous *pAsync, - __out_bcount_opt(DataSize) void *pData, - __in unsigned DataSize, - __in unsigned GetDataFlags) = 0; + __in ID3D11Asynchronous *pAsync, + __out_bcount_opt(DataSize) void *pData, + __in unsigned DataSize, + __in unsigned GetDataFlags) = 0; // TODO: maybe we should use function overloading, but that might risk silent errors, // and cannot be exported to a C interface diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 3c789d3af05..04d5b864967 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -303,11 +303,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } #if API >= 11 #define SET_SHADER_EXTRA_ARGS , \ - __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, \ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, \ unsigned NumClassInstances #define GET_SHADER_EXTRA_ARGS , \ - __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, \ - __inout_opt unsigned *pNumClassInstances + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, \ + __inout_opt unsigned *pNumClassInstances #else #define SET_SHADER_EXTRA_ARGS #define GET_SHADER_EXTRA_ARGS @@ -396,65 +396,65 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #define IMPLEMENT_SHADER_STAGE(XS, Stage) \ virtual void STDMETHODCALLTYPE XS##SetShader( \ - __in_opt ID3D11##Stage##Shader *pShader \ + __in_opt ID3D11##Stage##Shader *pShader \ SET_SHADER_EXTRA_ARGS) \ { \ SYNCHRONIZED; \ xs_set_shader((GalliumD3D11Shader<>*)pShader); \ } \ virtual void STDMETHODCALLTYPE XS##GetShader(\ - __out ID3D11##Stage##Shader **ppShader \ + __out ID3D11##Stage##Shader **ppShader \ GET_SHADER_EXTRA_ARGS) \ { \ SYNCHRONIZED; \ *ppShader = (ID3D11##Stage##Shader*)shaders[D3D11_STAGE_##XS].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetConstantBuffers(\ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ - __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) \ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) \ { \ SYNCHRONIZED; \ xs_set_constant_buffers(StartSlot, NumBuffers, (GalliumD3D11Buffer *const *)ppConstantBuffers); \ } \ virtual void STDMETHODCALLTYPE XS##GetConstantBuffers(\ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ - __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) \ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) \ { \ SYNCHRONIZED; \ for(unsigned i = 0; i < NumBuffers; ++i) \ ppConstantBuffers[i] = constant_buffers[D3D11_STAGE_##XS][StartSlot + i].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetShaderResources(\ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ - __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) \ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) \ { \ SYNCHRONIZED; \ xs_set_shader_resources(StartSlot, NumViews, (GalliumD3D11ShaderResourceView *const *)ppShaderResourceViews); \ } \ virtual void STDMETHODCALLTYPE XS##GetShaderResources(\ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ - __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) \ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) \ { \ SYNCHRONIZED; \ for(unsigned i = 0; i < NumViews; ++i) \ ppShaderResourceViews[i] = shader_resource_views[D3D11_STAGE_##XS][StartSlot + i].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetSamplers(\ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ - __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) \ { \ SYNCHRONIZED; \ xs_set_samplers(StartSlot, NumSamplers, (GalliumD3D11SamplerState *const *)ppSamplers); \ } \ virtual void STDMETHODCALLTYPE XS##GetSamplers( \ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ - __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ + __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) \ { \ SYNCHRONIZED; \ for(unsigned i = 0; i < NumSamplers; ++i) \ @@ -477,10 +477,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl IMPLEMENT_SHADER_STAGE(CS, Compute) virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews( - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, - __in_ecount(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - __in_ecount(NumUAVs) const unsigned *pUAVInitialCounts) + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, + __in_ecount(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + __in_ecount(NumUAVs) const unsigned *pUAVInitialCounts) { SYNCHRONIZED; for(unsigned i = 0; i < NumUAVs; ++i) @@ -488,9 +488,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews( - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, - __out_ecount(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, + __out_ecount(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) { SYNCHRONIZED; for(unsigned i = 0; i < NumUAVs; ++i) @@ -535,7 +535,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl if(s < caps.stages) { void* samplers_to_bind[PIPE_MAX_SAMPLERS]; - unsigned num_samplers_to_bind = shaders[s] ? shaders[s]->slot_to_sampler.size() : 0; + unsigned num_samplers_to_bind = shaders[s] ? shaders[s]->slot_to_sampler.size() : 0; for(unsigned i = 0; i < num_samplers_to_bind; ++i) { // index can be -1 to access sampler_csos[s].ld @@ -579,7 +579,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetInputLayout( - __in_opt ID3D11InputLayout *pInputLayout) + __in_opt ID3D11InputLayout *pInputLayout) { SYNCHRONIZED; if(pInputLayout != input_layout.p) @@ -590,18 +590,18 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetInputLayout( - __out ID3D11InputLayout **ppInputLayout) + __out ID3D11InputLayout **ppInputLayout) { SYNCHRONIZED; *ppInputLayout = input_layout.ref(); } virtual void STDMETHODCALLTYPE IASetVertexBuffers( - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, - __in_ecount(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, - __in_ecount(NumBuffers) const unsigned *pStrides, - __in_ecount(NumBuffers) const unsigned *pOffsets) + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, + __in_ecount(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, + __in_ecount(NumBuffers) const unsigned *pStrides, + __in_ecount(NumBuffers) const unsigned *pOffsets) { SYNCHRONIZED; int last_different = -1; @@ -629,11 +629,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetVertexBuffers( - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, - __out_ecount_opt(NumBuffers) ID3D11Buffer **ppVertexBuffers, - __out_ecount_opt(NumBuffers) unsigned *pStrides, - __out_ecount_opt(NumBuffers) unsigned *pOffsets) + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, + __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, + __out_ecount_opt(NumBuffers) ID3D11Buffer **ppVertexBuffers, + __out_ecount_opt(NumBuffers) unsigned *pStrides, + __out_ecount_opt(NumBuffers) unsigned *pOffsets) { SYNCHRONIZED; if(ppVertexBuffers) @@ -677,9 +677,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetIndexBuffer( - __in_opt ID3D11Buffer *pIndexBuffer, - __in DXGI_FORMAT Format, - __in unsigned Offset) + __in_opt ID3D11Buffer *pIndexBuffer, + __in DXGI_FORMAT Format, + __in unsigned Offset) { SYNCHRONIZED; if(index_buffer.p != pIndexBuffer || index_format != Format || index_offset != Offset) @@ -693,9 +693,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetIndexBuffer( - __out_opt ID3D11Buffer **pIndexBuffer, - __out_opt DXGI_FORMAT *Format, - __out_opt unsigned *Offset) + __out_opt ID3D11Buffer **pIndexBuffer, + __out_opt DXGI_FORMAT *Format, + __out_opt unsigned *Offset) { SYNCHRONIZED; if(pIndexBuffer) @@ -707,7 +707,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( - __in D3D11_PRIMITIVE_TOPOLOGY Topology) + __in D3D11_PRIMITIVE_TOPOLOGY Topology) { SYNCHRONIZED; if(primitive_topology != Topology) @@ -721,16 +721,16 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( - __out D3D11_PRIMITIVE_TOPOLOGY *pTopology) + __out D3D11_PRIMITIVE_TOPOLOGY *pTopology) { SYNCHRONIZED; *pTopology = primitive_topology; } virtual void STDMETHODCALLTYPE DrawIndexed( - __in unsigned IndexCount, - __in unsigned StartIndexLocation, - __in int BaseVertexLocation) + __in unsigned IndexCount, + __in unsigned StartIndexLocation, + __in int BaseVertexLocation) { SYNCHRONIZED; if(update_flags) @@ -751,8 +751,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE Draw( - __in unsigned VertexCount, - __in unsigned StartVertexLocation) + __in unsigned VertexCount, + __in unsigned StartVertexLocation) { SYNCHRONIZED; if(update_flags) @@ -773,11 +773,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawIndexedInstanced( - __in unsigned IndexCountPerInstance, - __in unsigned InstanceCount, - __in unsigned StartIndexLocation, - __in int BaseVertexLocation, - __in unsigned StartInstanceLocation) + __in unsigned IndexCountPerInstance, + __in unsigned InstanceCount, + __in unsigned StartIndexLocation, + __in int BaseVertexLocation, + __in unsigned StartInstanceLocation) { SYNCHRONIZED; if(update_flags) @@ -798,10 +798,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawInstanced( - __in unsigned VertexCountPerInstance, - __in unsigned InstanceCount, - __in unsigned StartVertexLocation, - __in unsigned StartInstanceLocation) + __in unsigned VertexCountPerInstance, + __in unsigned InstanceCount, + __in unsigned StartVertexLocation, + __in unsigned StartInstanceLocation) { SYNCHRONIZED; if(update_flags) @@ -834,8 +834,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect( - __in ID3D11Buffer *pBufferForArgs, - __in unsigned AlignedByteOffsetForArgs) + __in ID3D11Buffer *pBufferForArgs, + __in unsigned AlignedByteOffsetForArgs) { SYNCHRONIZED; if(update_flags) @@ -865,8 +865,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawInstancedIndirect( - __in ID3D11Buffer *pBufferForArgs, - __in unsigned AlignedByteOffsetForArgs) + __in ID3D11Buffer *pBufferForArgs, + __in unsigned AlignedByteOffsetForArgs) { SYNCHRONIZED; if(update_flags) @@ -896,9 +896,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #if API >= 11 virtual void STDMETHODCALLTYPE Dispatch( - __in unsigned ThreadGroupCountX, - __in unsigned ThreadGroupCountY, - __in unsigned ThreadGroupCountZ) + __in unsigned ThreadGroupCountX, + __in unsigned ThreadGroupCountY, + __in unsigned ThreadGroupCountZ) { // uncomment this when this is implemented // SYNCHRONIZED; @@ -907,8 +907,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DispatchIndirect( - __in ID3D11Buffer *pBufferForArgs, - __in unsigned AlignedByteOffsetForArgs) + __in ID3D11Buffer *pBufferForArgs, + __in unsigned AlignedByteOffsetForArgs) { // uncomment this when this is implemented // SYNCHRONIZED; @@ -926,7 +926,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetState( - __in_opt ID3D11RasterizerState *pRasterizerState) + __in_opt ID3D11RasterizerState *pRasterizerState) { SYNCHRONIZED; if(pRasterizerState != rasterizer_state.p) @@ -943,7 +943,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetState( - __out ID3D11RasterizerState **ppRasterizerState) + __out ID3D11RasterizerState **ppRasterizerState) { SYNCHRONIZED; *ppRasterizerState = rasterizer_state.ref(); @@ -968,8 +968,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetViewports( - __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumViewports, - __in_ecount_opt(NumViewports) const D3D11_VIEWPORT *pViewports) + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumViewports, + __in_ecount_opt(NumViewports) const D3D11_VIEWPORT *pViewports) { SYNCHRONIZED; if(NumViewports) @@ -992,8 +992,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetViewports( - __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumViewports, - __out_ecount_opt(*pNumViewports) D3D11_VIEWPORT *pViewports) + __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumViewports, + __out_ecount_opt(*pNumViewports) D3D11_VIEWPORT *pViewports) { SYNCHRONIZED; if(pViewports) @@ -1019,8 +1019,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetScissorRects( - __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumRects, - __in_ecount_opt(NumRects) const D3D11_RECT *pRects) + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumRects, + __in_ecount_opt(NumRects) const D3D11_RECT *pRects) { SYNCHRONIZED; if(NumRects) @@ -1044,8 +1044,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetScissorRects( - __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumRects, - __out_ecount_opt(*pNumRects) D3D11_RECT *pRects) + __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumRects, + __out_ecount_opt(*pNumRects) D3D11_RECT *pRects) { SYNCHRONIZED; if(pRects) @@ -1061,9 +1061,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMSetBlendState( - __in_opt ID3D11BlendState *pBlendState, - __in_opt const float BlendFactor[ 4 ], - __in unsigned SampleMask) + __in_opt ID3D11BlendState *pBlendState, + __in_opt const float BlendFactor[ 4 ], + __in unsigned SampleMask) { SYNCHRONIZED; float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -1092,9 +1092,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMGetBlendState( - __out_opt ID3D11BlendState **ppBlendState, - __out_opt float BlendFactor[ 4 ], - __out_opt unsigned *pSampleMask) + __out_opt ID3D11BlendState **ppBlendState, + __out_opt float BlendFactor[ 4 ], + __out_opt unsigned *pSampleMask) { SYNCHRONIZED; if(ppBlendState) @@ -1114,8 +1114,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMSetDepthStencilState( - __in_opt ID3D11DepthStencilState *pDepthStencilState, - __in unsigned StencilRef) + __in_opt ID3D11DepthStencilState *pDepthStencilState, + __in unsigned StencilRef) { SYNCHRONIZED; if(pDepthStencilState != depth_stencil_state.p) @@ -1132,8 +1132,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMGetDepthStencilState( - __out_opt ID3D11DepthStencilState **ppDepthStencilState, - __out_opt unsigned *pStencilRef) + __out_opt ID3D11DepthStencilState **ppDepthStencilState, + __out_opt unsigned *pStencilRef) { SYNCHRONIZED; if(*ppDepthStencilState) @@ -1178,9 +1178,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl */ virtual void STDMETHODCALLTYPE OMSetRenderTargets( - __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, - __in_ecount_opt(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, - __in_opt ID3D11DepthStencilView *pDepthStencilView) + __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, + __in_ecount_opt(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, + __in_opt ID3D11DepthStencilView *pDepthStencilView) { SYNCHRONIZED; if(!ppRenderTargetViews) @@ -1211,9 +1211,9 @@ changed: } virtual void STDMETHODCALLTYPE OMGetRenderTargets( - __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, - __out_ecount_opt(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, - __out_opt ID3D11DepthStencilView **ppDepthStencilView) + __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, + __out_ecount_opt(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, + __out_opt ID3D11DepthStencilView **ppDepthStencilView) { SYNCHRONIZED; if(ppRenderTargetViews) @@ -1233,13 +1233,13 @@ changed: #if API >= 11 /* TODO: what is this supposed to do _exactly_? are we doing the right thing? */ virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews( - __in unsigned NumRTVs, - __in_ecount_opt(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, - __in_opt ID3D11DepthStencilView *pDepthStencilView, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, - __in unsigned NumUAVs, - __in_ecount_opt(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - __in_ecount_opt(NumUAVs) const unsigned *pUAVInitialCounts) + __in unsigned NumRTVs, + __in_ecount_opt(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, + __in_opt ID3D11DepthStencilView *pDepthStencilView, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, + __in unsigned NumUAVs, + __in_ecount_opt(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + __in_ecount_opt(NumUAVs) const unsigned *pUAVInitialCounts) { SYNCHRONIZED; if(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL) @@ -1256,12 +1256,12 @@ changed: } virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews( - __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumRTVs, - __out_ecount_opt(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, - __out_opt ID3D11DepthStencilView **ppDepthStencilView, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot) unsigned NumUAVs, - __out_ecount_opt(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) + __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumRTVs, + __out_ecount_opt(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, + __out_opt ID3D11DepthStencilView **ppDepthStencilView, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, + __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot) unsigned NumUAVs, + __out_ecount_opt(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) { SYNCHRONIZED; if(ppRenderTargetViews) @@ -1276,9 +1276,9 @@ changed: #endif virtual void STDMETHODCALLTYPE SOSetTargets( - __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, - __in_ecount_opt(NumBuffers) ID3D11Buffer *const *ppSOTargets, - __in_ecount_opt(NumBuffers) const unsigned *pOffsets) + __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, + __in_ecount_opt(NumBuffers) ID3D11Buffer *const *ppSOTargets, + __in_ecount_opt(NumBuffers) const unsigned *pOffsets) { SYNCHRONIZED; unsigned i; @@ -1312,10 +1312,10 @@ changed: } virtual void STDMETHODCALLTYPE SOGetTargets( - __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, - __out_ecount(NumBuffers) ID3D11Buffer **ppSOTargets + __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, + __out_ecount(NumBuffers) ID3D11Buffer **ppSOTargets #if API < 11 - , __out_ecount(NumBuffers) UINT *pOffsets + , __out_ecount(NumBuffers) UINT *pOffsets #endif ) { @@ -1330,7 +1330,7 @@ changed: } virtual void STDMETHODCALLTYPE Begin( - __in ID3D11Asynchronous *pAsync) + __in ID3D11Asynchronous *pAsync) { SYNCHRONIZED; if(caps.queries) @@ -1338,7 +1338,7 @@ changed: } virtual void STDMETHODCALLTYPE End( - __in ID3D11Asynchronous *pAsync) + __in ID3D11Asynchronous *pAsync) { SYNCHRONIZED; if(caps.queries) @@ -1346,10 +1346,10 @@ changed: } virtual HRESULT STDMETHODCALLTYPE GetData( - __in ID3D11Asynchronous *pAsync, - __out_bcount_opt(DataSize) void *pData, - __in unsigned DataSize, - __in unsigned GetDataFlags) + __in ID3D11Asynchronous *pAsync, + __out_bcount_opt(DataSize) void *pData, + __in unsigned DataSize, + __in unsigned GetDataFlags) { SYNCHRONIZED; if(!caps.queries) @@ -1387,8 +1387,8 @@ changed: } virtual void STDMETHODCALLTYPE SetPredication( - __in_opt ID3D11Predicate *pPredicate, - __in BOOL PredicateValue) + __in_opt ID3D11Predicate *pPredicate, + __in BOOL PredicateValue) { SYNCHRONIZED; if(render_predicate.p != pPredicate || render_predicate_value != PredicateValue) @@ -1400,8 +1400,8 @@ changed: } virtual void STDMETHODCALLTYPE GetPredication( - __out_opt ID3D11Predicate **ppPredicate, - __out_opt BOOL *pPredicateValue) + __out_opt ID3D11Predicate **ppPredicate, + __out_opt BOOL *pPredicateValue) { SYNCHRONIZED; if(ppPredicate) @@ -1428,11 +1428,11 @@ changed: } virtual HRESULT STDMETHODCALLTYPE Map( - __in ID3D11Resource *pResource, - __in unsigned Subresource, - __in D3D11_MAP MapType, - __in unsigned MapFlags, - __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) + __in ID3D11Resource *pResource, + __in unsigned Subresource, + __in D3D11_MAP MapType, + __in unsigned MapFlags, + __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) { SYNCHRONIZED; GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; @@ -1472,8 +1472,8 @@ changed: } virtual void STDMETHODCALLTYPE Unmap( - __in ID3D11Resource *pResource, - __in unsigned Subresource) + __in ID3D11Resource *pResource, + __in unsigned Subresource) { SYNCHRONIZED; GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; @@ -1481,20 +1481,20 @@ changed: if(i != resource->transfers.end()) { pipe->transfer_unmap(pipe, i->second); - pipe->transfer_destroy(pipe, i->second); + pipe->transfer_destroy(pipe, i->second); resource->transfers.erase(i); } } virtual void STDMETHODCALLTYPE CopySubresourceRegion( - __in ID3D11Resource *pDstResource, - __in unsigned DstSubresource, - __in unsigned DstX, - __in unsigned DstY, - __in unsigned DstZ, - __in ID3D11Resource *pSrcResource, - __in unsigned SrcSubresource, - __in_opt const D3D11_BOX *pSrcBox) + __in ID3D11Resource *pDstResource, + __in unsigned DstSubresource, + __in unsigned DstX, + __in unsigned DstY, + __in unsigned DstZ, + __in ID3D11Resource *pSrcResource, + __in unsigned SrcSubresource, + __in_opt const D3D11_BOX *pSrcBox) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1512,8 +1512,8 @@ changed: } virtual void STDMETHODCALLTYPE CopyResource( - __in ID3D11Resource *pDstResource, - __in ID3D11Resource *pSrcResource) + __in ID3D11Resource *pDstResource, + __in ID3D11Resource *pSrcResource) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1540,12 +1540,12 @@ changed: } virtual void STDMETHODCALLTYPE UpdateSubresource( - __in ID3D11Resource *pDstResource, - __in unsigned DstSubresource, - __in_opt const D3D11_BOX *pDstBox, - __in const void *pSrcData, - __in unsigned SrcRowPitch, - __in unsigned SrcDepthPitch) + __in ID3D11Resource *pDstResource, + __in unsigned DstSubresource, + __in_opt const D3D11_BOX *pDstBox, + __in const void *pSrcData, + __in unsigned SrcRowPitch, + __in unsigned SrcDepthPitch) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1556,17 +1556,17 @@ changed: #if API >= 11 virtual void STDMETHODCALLTYPE CopyStructureCount( - __in ID3D11Buffer *pDstBuffer, - __in unsigned DstAlignedByteOffset, - __in ID3D11UnorderedAccessView *pSrcView) + __in ID3D11Buffer *pDstBuffer, + __in unsigned DstAlignedByteOffset, + __in ID3D11UnorderedAccessView *pSrcView) { SYNCHRONIZED; } #endif virtual void STDMETHODCALLTYPE ClearRenderTargetView( - __in ID3D11RenderTargetView *pRenderTargetView, - __in const float ColorRGBA[4]) + __in ID3D11RenderTargetView *pRenderTargetView, + __in const float ColorRGBA[4]) { SYNCHRONIZED; GalliumD3D11RenderTargetView* view = ((GalliumD3D11RenderTargetView*)pRenderTargetView); @@ -1574,10 +1574,10 @@ changed: } virtual void STDMETHODCALLTYPE ClearDepthStencilView( - __in ID3D11DepthStencilView *pDepthStencilView, - __in unsigned ClearFlags, - __in float Depth, - __in UINT8 Stencil) + __in ID3D11DepthStencilView *pDepthStencilView, + __in unsigned ClearFlags, + __in float Depth, + __in UINT8 Stencil) { SYNCHRONIZED; GalliumD3D11DepthStencilView* view = ((GalliumD3D11DepthStencilView*)pDepthStencilView); @@ -1591,15 +1591,15 @@ changed: #if API >= 11 virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint( - __in ID3D11UnorderedAccessView *pUnorderedAccessView, - __in const unsigned Values[ 4 ]) + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + __in const unsigned Values[ 4 ]) { SYNCHRONIZED; } virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat( - __in ID3D11UnorderedAccessView *pUnorderedAccessView, - __in const float Values[ 4 ]) + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + __in const float Values[ 4 ]) { SYNCHRONIZED; } @@ -1631,7 +1631,7 @@ changed: } virtual void STDMETHODCALLTYPE GenerateMips( - __in ID3D11ShaderResourceView *pShaderResourceView) + __in ID3D11ShaderResourceView *pShaderResourceView) { SYNCHRONIZED; @@ -1675,7 +1675,7 @@ changed: #if API >= 11 /* TODO: hack SRVs or sampler states to handle this, or add to Gallium */ virtual void STDMETHODCALLTYPE SetResourceMinLOD( - __in ID3D11Resource *pResource, + __in ID3D11Resource *pResource, float MinLOD) { SYNCHRONIZED; @@ -1688,7 +1688,7 @@ changed: } virtual float STDMETHODCALLTYPE GetResourceMinLOD( - __in ID3D11Resource *pResource) + __in ID3D11Resource *pResource) { SYNCHRONIZED; GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; @@ -1697,11 +1697,11 @@ changed: #endif virtual void STDMETHODCALLTYPE ResolveSubresource( - __in ID3D11Resource *pDstResource, - __in unsigned DstSubresource, - __in ID3D11Resource *pSrcResource, - __in unsigned SrcSubresource, - __in DXGI_FORMAT Format) + __in ID3D11Resource *pDstResource, + __in unsigned DstSubresource, + __in ID3D11Resource *pSrcResource, + __in unsigned SrcSubresource, + __in DXGI_FORMAT Format) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1713,7 +1713,7 @@ changed: #if API >= 11 virtual void STDMETHODCALLTYPE ExecuteCommandList( - __in ID3D11CommandList *pCommandList, + __in ID3D11CommandList *pCommandList, BOOL RestoreContextState) { SYNCHRONIZED; @@ -1721,7 +1721,7 @@ changed: virtual HRESULT STDMETHODCALLTYPE FinishCommandList( BOOL RestoreDeferredContextState, - __out_opt ID3D11CommandList **ppCommandList) + __out_opt ID3D11CommandList **ppCommandList) { SYNCHRONIZED; return E_NOTIMPL; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index f31b54ba8f3..f5cfd0cfab4 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -1,12 +1,12 @@ #if API < 11 extern "C" HRESULT STDMETHODCALLTYPE D3D10CreateBlob( - __in SIZE_T NumBytes, - __out LPD3D10BLOB *ppBuffer + __in SIZE_T NumBytes, + __out LPD3D10BLOB *ppBuffer ); HRESULT STDMETHODCALLTYPE D3D10CreateBlob( - __in SIZE_T NumBytes, - __out LPD3D10BLOB *ppBuffer + __in SIZE_T NumBytes, + __out LPD3D10BLOB *ppBuffer ) { void* data = malloc(NumBytes); @@ -17,21 +17,21 @@ HRESULT STDMETHODCALLTYPE D3D10CreateBlob( } LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile( - __in ID3D10Device *pDevice + __in ID3D10Device *pDevice ) { return "ps_4_0"; } LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile( - __in ID3D10Device *pDevice + __in ID3D10Device *pDevice ) { return "vs_4_0"; } LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile( - __in ID3D10Device *pDevice + __in ID3D10Device *pDevice ) { return "gs_4_0"; @@ -46,10 +46,10 @@ static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, unsigned return S_OK; } -HRESULT D3D10GetInputSignatureBlob( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __out ID3D10Blob **ppSignatureBlob +HRESULT D3D10GetInputSignatureBlob( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __out ID3D10Blob **ppSignatureBlob ) { dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, false); @@ -59,10 +59,10 @@ HRESULT D3D10GetInputSignatureBlob( return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); } -HRESULT D3D10GetOutputSignatureBlob( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __out ID3D10Blob **ppSignatureBlob +HRESULT D3D10GetOutputSignatureBlob( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __out ID3D10Blob **ppSignatureBlob ) { dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, true); @@ -72,10 +72,10 @@ HRESULT D3D10GetOutputSignatureBlob( return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); } -HRESULT D3D10GetInputAndOutputSignatureBlob( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __out ID3D10Blob **ppSignatureBlob +HRESULT D3D10GetInputAndOutputSignatureBlob( + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __out ID3D10Blob **ppSignatureBlob ) { dxbc_chunk_signature* sigs[2]; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h index b7542fd30e4..0cf2cf3cf7e 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h @@ -71,8 +71,8 @@ struct GalliumD3D11DeviceChild : public GalliumPrivateDataComObjectAddRef(); *ppDevice = device; @@ -242,7 +242,7 @@ struct GalliumD3D11ResourceBase : public GalliumD3D11DeviceChild unsigned eviction_priority; virtual void STDMETHODCALLTYPE SetEvictionPriority( - __in unsigned EvictionPriority) + __in unsigned EvictionPriority) { eviction_priority = EvictionPriority; } @@ -257,7 +257,7 @@ template struct GalliumDXGIResource : public IDXGIResource { virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( - __in unsigned EvictionPriority) + __in unsigned EvictionPriority) { static_cast(this)->eviction_priority = EvictionPriority; return S_OK; @@ -265,13 +265,13 @@ struct GalliumDXGIResource : public IDXGIResource virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority(unsigned* pEvictionPriority) { - *pEvictionPriority = static_cast(this)->eviction_priority; - return S_OK; + *pEvictionPriority = static_cast(this)->eviction_priority; + return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetDevice( - __in REFIID riid, - __out void **ppParent) + __in REFIID riid, + __out void **ppParent) { if(!static_cast(this)->device) return E_NOINTERFACE; @@ -279,8 +279,8 @@ struct GalliumDXGIResource : public IDXGIResource } virtual HRESULT STDMETHODCALLTYPE GetParent( - __in REFIID riid, - __out void **ppParent) + __in REFIID riid, + __out void **ppParent) { if(!static_cast(this)->device) return E_NOINTERFACE; @@ -322,8 +322,8 @@ struct GalliumD3D11Resource } virtual HRESULT STDMETHODCALLTYPE GetUsage( - __out DXGI_USAGE *pUsage - ) + __out DXGI_USAGE *pUsage + ) { *pUsage = this->dxgi_usage; return S_OK; @@ -349,7 +349,7 @@ struct GalliumD3D11TypedResource : public GalliumD3D11Resource : GalliumD3D11Resource(device, resource, dxgi_usage), desc(desc) {} virtual void STDMETHODCALLTYPE GetType( - __out D3D11_RESOURCE_DIMENSION *pResourceDimension) + __out D3D11_RESOURCE_DIMENSION *pResourceDimension) { *pResourceDimension = Dim; } @@ -381,23 +381,23 @@ struct GalliumD3D10Buffer : public GalliumD3D10BufferBase device->UnbindBuffer(this); } - virtual HRESULT STDMETHODCALLTYPE Map( - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out void **ppData) - { - D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, 0, MapType, MapFlags, &msr); - if(!SUCCEEDED(hr)) - return hr; - *ppData = msr.pData; - return S_OK; - } - - virtual void STDMETHODCALLTYPE Unmap() - { - device->Unmap(this, 0); - } + virtual HRESULT STDMETHODCALLTYPE Map( + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out void **ppData) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, 0, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + *ppData = msr.pData; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap() + { + device->Unmap(this, 0); + } }; struct GalliumD3D10Texture1D : public GalliumD3D10Texture1DBase @@ -407,25 +407,25 @@ struct GalliumD3D10Texture1D : public GalliumD3D10Texture1DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - __in unsigned Subresource, - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out void **ppData) - { - D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); - if(!SUCCEEDED(hr)) - return hr; - *ppData = msr.pData; - return S_OK; - } - - virtual void STDMETHODCALLTYPE Unmap( - __in unsigned Subresource - ) - { - device->Unmap(this, Subresource); - } + __in unsigned Subresource, + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out void **ppData) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + *ppData = msr.pData; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in unsigned Subresource + ) + { + device->Unmap(this, Subresource); + } }; struct GalliumD3D10Texture2D : public GalliumD3D10Texture2DBase @@ -436,26 +436,26 @@ struct GalliumD3D10Texture2D : public GalliumD3D10Texture2DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - __in unsigned Subresource, - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D) - { - D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); - if(!SUCCEEDED(hr)) - return hr; - pMappedTex2D->pData = msr.pData; - pMappedTex2D->RowPitch = msr.RowPitch; - return S_OK; - } - - virtual void STDMETHODCALLTYPE Unmap( - __in unsigned Subresource - ) - { - device->Unmap(this, Subresource); - } + __in unsigned Subresource, + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + pMappedTex2D->pData = msr.pData; + pMappedTex2D->RowPitch = msr.RowPitch; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in unsigned Subresource + ) + { + device->Unmap(this, Subresource); + } }; @@ -466,27 +466,27 @@ struct GalliumD3D10Texture3D : public GalliumD3D10Texture3DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - __in unsigned Subresource, - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D) - { - D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); - if(!SUCCEEDED(hr)) - return hr; - pMappedTex3D->pData = msr.pData; - pMappedTex3D->RowPitch = msr.RowPitch; - pMappedTex3D->DepthPitch = msr.DepthPitch; - return S_OK; - } - - virtual void STDMETHODCALLTYPE Unmap( - __in unsigned Subresource - ) - { - device->Unmap(this, Subresource); - } + __in unsigned Subresource, + __in D3D10_MAP MapType, + __in unsigned MapFlags, + __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D) + { + D3D10_MAPPED_SUBRESOURCE msr; + HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + if(!SUCCEEDED(hr)) + return hr; + pMappedTex3D->pData = msr.pData; + pMappedTex3D->RowPitch = msr.RowPitch; + pMappedTex3D->DepthPitch = msr.DepthPitch; + return S_OK; + } + + virtual void STDMETHODCALLTYPE Unmap( + __in unsigned Subresource + ) + { + device->Unmap(this, Subresource); + } }; #endif @@ -502,7 +502,7 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObjectFormat = this->desc.Format; pDesc->Width = this->desc.Width; @@ -512,8 +512,8 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObject } virtual HRESULT STDMETHODCALLTYPE GetData( - __out_bcount(DataSize) void *pData, - __in unsigned DataSize, - __in unsigned GetDataFlags) + __out_bcount(DataSize) void *pData, + __in unsigned DataSize, + __in unsigned GetDataFlags) { return this->device->GetData(this, pData, DataSize, GetDataFlags); } @@ -675,7 +675,7 @@ struct GalliumD3D11QueryOrPredicate : public GalliumD3D11Asynchronous {} virtual void STDMETHODCALLTYPE GetDesc( - __out D3D11_QUERY_DESC *pDesc) + __out D3D11_QUERY_DESC *pDesc) { *pDesc = desc; } @@ -708,7 +708,7 @@ struct GalliumD3D11Counter : public GalliumD3D11Asynchronous {} virtual void STDMETHODCALLTYPE GetDesc( - __out D3D11_COUNTER_DESC *pDesc) + __out D3D11_COUNTER_DESC *pDesc) { *pDesc = desc; } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 0c8d3ed9433..eea0e21f202 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -32,7 +32,7 @@ static unsigned caps_dx_9_1[] = { UTIL_CHECK_INT(MAX_RENDER_TARGETS, 1), UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12), /* 2048 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 8), /* 256 */ - UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ + UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ UTIL_CHECK_TERMINATE }; @@ -45,7 +45,7 @@ static unsigned caps_dx_9_2[] = { UTIL_CHECK_INT(MAX_RENDER_TARGETS, 1), UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12), /* 2048 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ - UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ + UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ UTIL_CHECK_TERMINATE }; @@ -61,7 +61,7 @@ static unsigned caps_dx_9_3[] = { UTIL_CHECK_INT(MAX_RENDER_TARGETS, 4), UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 13), /* 4096 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ - UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ + UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ UTIL_CHECK_TERMINATE }; @@ -166,7 +166,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual void STDMETHODCALLTYPE GetImmediateContext( - __out ID3D11DeviceContext **ppImmediateContext) + __out ID3D11DeviceContext **ppImmediateContext) { immediate_context->AddRef(); *ppImmediateContext = immediate_context; @@ -185,21 +185,21 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CheckCounter( - __in const D3D11_COUNTER_DESC *pDesc, - __out D3D11_COUNTER_TYPE *pType, - __out unsigned *pActiveCounters, - __out_ecount_opt(*pNameLength) LPSTR szName, - __inout_opt unsigned *pNameLength, - __out_ecount_opt(*pUnitsLength) LPSTR szUnits, - __inout_opt unsigned *pUnitsLength, - __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, - __inout_opt unsigned *pDescriptionLength) + __in const D3D11_COUNTER_DESC *pDesc, + __out D3D11_COUNTER_TYPE *pType, + __out unsigned *pActiveCounters, + __out_ecount_opt(*pNameLength) LPSTR szName, + __inout_opt unsigned *pNameLength, + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + __inout_opt unsigned *pUnitsLength, + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + __inout_opt unsigned *pDescriptionLength) { return E_NOTIMPL; } virtual void STDMETHODCALLTYPE CheckCounterInfo( - __out D3D11_COUNTER_INFO *pCounterInfo) + __out D3D11_COUNTER_INFO *pCounterInfo) { /* none supported at the moment */ pCounterInfo->LastDeviceDependentCounter = (D3D11_COUNTER)0; @@ -210,7 +210,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( D3D11_FEATURE Feature, - __out_bcount(FeatureSupportDataSize) void *pFeatureSupportData, + __out_bcount(FeatureSupportDataSize) void *pFeatureSupportData, unsigned FeatureSupportDataSize) { SYNCHRONIZED; @@ -360,13 +360,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - __in const D3D11_BLEND_DESC *pBlendStateDesc, - __out_opt ID3D11BlendState **ppBlendState + __in const D3D11_BLEND_DESC *pBlendStateDesc, + __out_opt ID3D11BlendState **ppBlendState ) #else virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( - __in const D3D10_BLEND_DESC1 *pBlendStateDesc, - __out_opt ID3D10BlendState1 **ppBlendState + __in const D3D10_BLEND_DESC1 *pBlendStateDesc, + __out_opt ID3D10BlendState1 **ppBlendState ) #endif { @@ -379,12 +379,12 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen assert(PIPE_MAX_COLOR_BUFS >= 8); for(unsigned i = 0; i < 8; ++i) { - if(!convert_blend_state( - state.rt[i], - pBlendStateDesc->RenderTarget[i], - pBlendStateDesc->RenderTarget[i].BlendEnable, - pBlendStateDesc->RenderTarget[i].RenderTargetWriteMask)) - return E_INVALIDARG; + if(!convert_blend_state( + state.rt[i], + pBlendStateDesc->RenderTarget[i], + pBlendStateDesc->RenderTarget[i].BlendEnable, + pBlendStateDesc->RenderTarget[i].RenderTargetWriteMask)) + return E_INVALIDARG; } if(!ppBlendState) @@ -400,8 +400,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API < 11 virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - __in const D3D10_BLEND_DESC *pBlendStateDesc, - __out_opt ID3D10BlendState **ppBlendState + __in const D3D10_BLEND_DESC *pBlendStateDesc, + __out_opt ID3D10BlendState **ppBlendState ) { SYNCHRONIZED; @@ -439,8 +439,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( - __in const D3D11_DEPTH_STENCIL_DESC *pDepthStencilStateDesc, - __out_opt ID3D11DepthStencilState **ppDepthStencilState + __in const D3D11_DEPTH_STENCIL_DESC *pDepthStencilStateDesc, + __out_opt ID3D11DepthStencilState **ppDepthStencilState ) { SYNCHRONIZED; @@ -477,8 +477,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( - __in const D3D11_RASTERIZER_DESC *pRasterizerDesc, - __out_opt ID3D11RasterizerState **ppRasterizerState) + __in const D3D11_RASTERIZER_DESC *pRasterizerDesc, + __out_opt ID3D11RasterizerState **ppRasterizerState) { SYNCHRONIZED; @@ -487,13 +487,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen state.gl_rasterization_rules = 1; /* D3D10/11 use GL rules */ state.fill_front = state.fill_back = (pRasterizerDesc->FillMode == D3D11_FILL_WIREFRAME) ? PIPE_POLYGON_MODE_LINE : PIPE_POLYGON_MODE_FILL; if(pRasterizerDesc->CullMode == D3D11_CULL_FRONT) - state.cull_face = PIPE_FACE_FRONT; + state.cull_face = PIPE_FACE_FRONT; else if(pRasterizerDesc->CullMode == D3D11_CULL_BACK) - state.cull_face = PIPE_FACE_BACK; + state.cull_face = PIPE_FACE_BACK; else - state.cull_face = PIPE_FACE_NONE; + state.cull_face = PIPE_FACE_NONE; state.front_ccw = !!pRasterizerDesc->FrontCounterClockwise; - /* TODO: is this correct? */ + /* TODO: is this correct? */ /* TODO: we are ignoring DepthBiasClamp! */ state.offset_tri = state.offset_line = state.offset_point = pRasterizerDesc->SlopeScaledDepthBias || pRasterizerDesc->DepthBias; state.offset_scale = pRasterizerDesc->SlopeScaledDepthBias; @@ -517,8 +517,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( - __in const D3D11_SAMPLER_DESC *pSamplerDesc, - __out_opt ID3D11SamplerState **ppSamplerState) + __in const D3D11_SAMPLER_DESC *pSamplerDesc, + __out_opt ID3D11SamplerState **ppSamplerState) { SYNCHRONIZED; @@ -555,11 +555,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( - __in_ecount(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, - __in_range(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) unsigned NumElements, - __in const void *pShaderBytecodeWithInputSignature, - __in SIZE_T BytecodeLength, - __out_opt ID3D11InputLayout **ppInputLayout) + __in_ecount(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + __in_range(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) unsigned NumElements, + __in const void *pShaderBytecodeWithInputSignature, + __in SIZE_T BytecodeLength, + __out_opt ID3D11InputLayout **ppInputLayout) { SYNCHRONIZED; @@ -738,9 +738,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( - __in const D3D11_TEXTURE1D_DESC *pDesc, - __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Texture1D **ppTexture1D) + __in const D3D11_TEXTURE1D_DESC *pDesc, + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Texture1D **ppTexture1D) { SYNCHRONIZED; @@ -754,9 +754,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( - __in const D3D11_TEXTURE2D_DESC *pDesc, - __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Texture2D **ppTexture2D) + __in const D3D11_TEXTURE2D_DESC *pDesc, + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Texture2D **ppTexture2D) { SYNCHRONIZED; @@ -773,9 +773,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( - __in const D3D11_TEXTURE3D_DESC *pDesc, - __in_xcount_opt(pDesc->MipLevels) const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Texture3D **ppTexture3D) + __in const D3D11_TEXTURE3D_DESC *pDesc, + __in_xcount_opt(pDesc->MipLevels) const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Texture3D **ppTexture3D) { SYNCHRONIZED; @@ -789,9 +789,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateBuffer( - __in const D3D11_BUFFER_DESC *pDesc, - __in_opt const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Buffer **ppBuffer) + __in const D3D11_BUFFER_DESC *pDesc, + __in_opt const D3D11_SUBRESOURCE_DATA *pInitialData, + __out_opt ID3D11Buffer **ppBuffer) { SYNCHRONIZED; @@ -809,8 +809,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE OpenGalliumResource( - __in struct pipe_resource* resource, - __out IUnknown** dxgi_resource) + __in struct pipe_resource* resource, + __out IUnknown** dxgi_resource) { SYNCHRONIZED; @@ -845,11 +845,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateSurface( - __in const DXGI_SURFACE_DESC *pDesc, + __in const DXGI_SURFACE_DESC *pDesc, unsigned NumSurfaces, DXGI_USAGE Usage, - __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, - __out IDXGISurface **ppSurface) + __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, + __out IDXGISurface **ppSurface) { SYNCHRONIZED; @@ -882,9 +882,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, - __out_opt ID3D11ShaderResourceView **ppSRView) + __in ID3D11Resource *pResource, + __in_opt const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + __out_opt ID3D11ShaderResourceView **ppSRView) { #if API >= 11 D3D11_SHADER_RESOURCE_VIEW_DESC def_desc; @@ -898,9 +898,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( - __in ID3D11Resource *pResource, - __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, - __out_opt ID3D10ShaderResourceView1 **ppSRView) + __in ID3D11Resource *pResource, + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + __out_opt ID3D10ShaderResourceView1 **ppSRView) { D3D10_SHADER_RESOURCE_VIEW_DESC1 def_desc; #endif @@ -988,9 +988,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, - __out_opt ID3D11UnorderedAccessView **ppUAView) + __in ID3D11Resource *pResource, + __in_opt const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + __out_opt ID3D11UnorderedAccessView **ppUAView) { SYNCHRONIZED; @@ -1001,9 +1001,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, - __out_opt ID3D11RenderTargetView **ppRTView) + __in ID3D11Resource *pResource, + __in_opt const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + __out_opt ID3D11RenderTargetView **ppRTView) { SYNCHRONIZED; @@ -1092,9 +1092,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, - __out_opt ID3D11DepthStencilView **ppDepthStencilView) + __in ID3D11Resource *pResource, + __in_opt const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + __out_opt ID3D11DepthStencilView **ppDepthStencilView) { SYNCHRONIZED; @@ -1168,7 +1168,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen GalliumD3D11Shader<>* create_stage_shader(unsigned type, const void *pShaderBytecode, SIZE_T BytecodeLength #if API >= 11 - , __in_opt ID3D11ClassLinkage *pClassLinkage + , __in_opt ID3D11ClassLinkage *pClassLinkage #endif ) { @@ -1221,21 +1221,21 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 #define CREATE_SHADER_ARGS \ - __in const void *pShaderBytecode, \ - __in SIZE_T BytecodeLength, \ - __in_opt ID3D11ClassLinkage *pClassLinkage + __in const void *pShaderBytecode, \ + __in SIZE_T BytecodeLength, \ + __in_opt ID3D11ClassLinkage *pClassLinkage #define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength, pClassLinkage #else #define CREATE_SHADER_ARGS \ - __in const void *pShaderBytecode, \ - __in SIZE_T BytecodeLength + __in const void *pShaderBytecode, \ + __in SIZE_T BytecodeLength #define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength #endif #define IMPLEMENT_CREATE_SHADER(Stage, GALLIUM) \ virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ CREATE_SHADER_ARGS, \ - __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ + __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ { \ SYNCHRONIZED; \ GalliumD3D11##Stage##Shader* shader = (GalliumD3D11##Stage##Shader*)create_stage_shader(PIPE_SHADER_##GALLIUM, PASS_SHADER_ARGS); \ @@ -1256,7 +1256,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #define IMPLEMENT_NOTIMPL_CREATE_SHADER(Stage) \ virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ CREATE_SHADER_ARGS, \ - __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ + __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ { \ return E_NOTIMPL; \ } @@ -1271,19 +1271,19 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __in_ecount_opt(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, - __in_range(0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT) unsigned NumEntries, + __in const void *pShaderBytecode, + __in SIZE_T BytecodeLength, + __in_ecount_opt(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + __in_range(0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT) unsigned NumEntries, #if API >= 11 - __in_ecount_opt(NumStrides) const unsigned *pBufferStrides, - __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumStrides, - __in unsigned RasterizedStream, - __in_opt ID3D11ClassLinkage *pClassLinkage, + __in_ecount_opt(NumStrides) const unsigned *pBufferStrides, + __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumStrides, + __in unsigned RasterizedStream, + __in_opt ID3D11ClassLinkage *pClassLinkage, #else - __in UINT OutputStreamStride, + __in UINT OutputStreamStride, #endif - __out_opt ID3D11GeometryShader **ppGeometryShader) + __out_opt ID3D11GeometryShader **ppGeometryShader) { SYNCHRONIZED; @@ -1297,7 +1297,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateClassLinkage( - __out ID3D11ClassLinkage **ppLinkage) + __out ID3D11ClassLinkage **ppLinkage) { SYNCHRONIZED; @@ -1309,8 +1309,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateQuery( - __in const D3D11_QUERY_DESC *pQueryDesc, - __out_opt ID3D11Query **ppQuery) + __in const D3D11_QUERY_DESC *pQueryDesc, + __out_opt ID3D11Query **ppQuery) { SYNCHRONIZED; @@ -1332,8 +1332,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreatePredicate( - __in const D3D11_QUERY_DESC *pPredicateDesc, - __out_opt ID3D11Predicate **ppPredicate) + __in const D3D11_QUERY_DESC *pPredicateDesc, + __out_opt ID3D11Predicate **ppPredicate) { SYNCHRONIZED; @@ -1362,8 +1362,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen virtual HRESULT STDMETHODCALLTYPE CreateCounter( - __in const D3D11_COUNTER_DESC *pCounterDesc, - __out_opt ID3D11Counter **ppCounter) + __in const D3D11_COUNTER_DESC *pCounterDesc, + __out_opt ID3D11Counter **ppCounter) { SYNCHRONIZED; @@ -1375,7 +1375,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext( unsigned ContextFlags, - __out_opt ID3D11DeviceContext **ppDeferredContext) + __out_opt ID3D11DeviceContext **ppDeferredContext) { SYNCHRONIZED; @@ -1387,9 +1387,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( - __in HANDLE hResource, - __in REFIID ReturnedInterface, - __out_opt void **ppResource) + __in HANDLE hResource, + __in REFIID ReturnedInterface, + __out_opt void **ppResource) { SYNCHRONIZED; @@ -1414,14 +1414,14 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen * Probably nothing uses these, assuming it has ever been implemented anywhere. */ void STDMETHODCALLTYPE SetTextFilterSize( - __in UINT Width, - __in UINT Height + __in UINT Width, + __in UINT Height ) {} virtual void STDMETHODCALLTYPE GetTextFilterSize( - __in UINT *Width, - __in UINT *Height + __in UINT *Width, + __in UINT *Height ) {} #endif diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp index 7932e438c99..37113a6ec91 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp @@ -41,7 +41,7 @@ unsigned d3d11_to_pipe_blend[D3D11_BLEND_COUNT] = PIPE_BLENDFACTOR_INV_DST_COLOR, PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE, 0, /* absent in D3D11 */ - 0, /* absent in D3D11 */ + 0, /* absent in D3D11 */ PIPE_BLENDFACTOR_CONST_COLOR, PIPE_BLENDFACTOR_INV_CONST_COLOR, PIPE_BLENDFACTOR_SRC1_COLOR, diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp index 995059e15b3..4b43a3325ca 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -220,7 +220,7 @@ struct sm4_to_tgsi_converter #define OP1(n) OP1_(n, n) #define OP2(n) OP2_(n, n) #define OP3(n) OP3_(n, n) -#define OP_CF(d, g) case SM4_OPCODE_##d: ureg_##g(ureg, &label); label_to_sm4_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); break; +#define OP_CF(d, g) case SM4_OPCODE_##d: ureg_##g(ureg, &label); label_to_sm4_insn_num.push_back(std::make_pair(label, program.cf_insn_linked[insn_num])); break; void translate_insns(unsigned begin, unsigned end) { diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl index c42e10cb665..96faf1c0701 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumcom.idl @@ -42,7 +42,7 @@ interface IGalliumDevice : IUnknown { // turn Gallium resource into API resource HRESULT OpenGalliumResource( - [in] struct pipe_resource* resource, + [in] struct pipe_resource* resource, [out] IUnknown** api_resource ); diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl index e6f51472096..92fda3385b9 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl @@ -90,7 +90,7 @@ interface IGalliumDXGIBackend : IUnknown * EndPresent is still called even if you return 0 in window. */ void* BeginPresent( - [in] HWND hwnd, + [in] HWND hwnd, [out] void** window, [out] RECT* rect, [out] struct _RGNDATA** rgndata, @@ -98,7 +98,7 @@ interface IGalliumDXGIBackend : IUnknown ); void EndPresent( - [in] HWND hwnd, + [in] HWND hwnd, [out] void* present_cookie ); } diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp index 0fcef0d7b69..a8f24ae3031 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp @@ -86,7 +86,7 @@ int main(int argc, char** argv) HRESULT hr; if(0) { - hr = D3D10CreateDeviceAndSwapChain( + hr = D3D10CreateDeviceAndSwapChain( NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, @@ -98,7 +98,7 @@ int main(int argc, char** argv) } else { - hr = D3D10CreateDeviceAndSwapChain1( + hr = D3D10CreateDeviceAndSwapChain1( NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp index 4e92f0a544c..06ad811dec0 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp @@ -29,24 +29,24 @@ #include "d3d10tri.hlsl.vs.h" struct vertex { - float position[4]; - float color[4]; + float position[4]; + float color[4]; }; static struct vertex vertices[3] = { - { - { 0.0f, 0.9f, 0.5f, 1.0f }, - { 1.0f, 0.0f, 0.0f, 1.0f } - }, - { - { 0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 0.0f, 1.0f, 1.0f } - }, - { - { -0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 1.0f, 0.0f, 1.0f } - }, + { + { 0.0f, 0.9f, 0.5f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + }, + { + { 0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } + }, + { + { -0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } + }, }; struct d3d10tri : public d3d10_application diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h index 3b0644a573d..e67fa096060 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h @@ -104,7 +104,7 @@ struct mesh this->vertex_size = vertex_size; index_offset = vertex_size * num_vertices; - D3D11_BUFFER_DESC bufferd; + D3D11_BUFFER_DESC bufferd; memset(&bufferd, 0, sizeof(bufferd)); bufferd.Usage = D3D11_USAGE_IMMUTABLE; bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp index 7055da941b7..8eb51d36387 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp @@ -57,7 +57,7 @@ int main(int argc, char** argv) D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; - HRESULT hr =D3D11CreateDeviceAndSwapChain( + HRESULT hr =D3D11CreateDeviceAndSwapChain( NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp index 32a63ae6dd5..de9946c67e8 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp @@ -1,6 +1,6 @@ /* -* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. -* Copyright (C) 2009-2010 Luca Barbieri All Rights Reserved. +* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +* Copyright (C) 2009-2010 Luca Barbieri 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"), @@ -14,7 +14,7 @@ * * 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 NONINFRINGEMENT. IN NO EVENT SHALL +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL 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. @@ -518,7 +518,7 @@ struct d3d11gears : public d3d11_application gears[2].mesh = build_gear(dev, triangles / 4, 1.3f, 2.0f, 0.5f, 10, 0.7f); gears[0].x = -3.0f; - gears[0].y = -2.0f; + gears[0].y = -2.0f; gears[0].wmul = 1.0f; gears[0].t0 = 0.0 * M_PI / 180.0f; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp index 5622074e19d..30c2ffa5cca 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp @@ -29,24 +29,24 @@ #include "d3d11tri.hlsl.vs.h" struct vertex { - float position[4]; - float color[4]; + float position[4]; + float color[4]; }; static struct vertex vertices[3] = { - { - { 0.0f, 0.9f, 0.5f, 1.0f }, - { 1.0f, 0.0f, 0.0f, 1.0f } - }, - { - { 0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 0.0f, 1.0f, 1.0f } - }, - { - { -0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 1.0f, 0.0f, 1.0f } - }, + { + { 0.0f, 0.9f, 0.5f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + }, + { + { 0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } + }, + { + { -0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } + }, }; struct d3d11tri : public d3d11_application -- cgit v1.2.3 From 8224256946619fb25278718bbf4703e3b9d60c93 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 13:52:34 +0200 Subject: d3d1x: remove specstrings --- .../state_trackers/d3d1x/d3d1xshader/include/sm4.h | 2 +- .../d3d1x/d3d1xstutil/include/d3d1xstutil.h | 61 ++-- .../state_trackers/d3d1x/d3dapi/specstrings.h | 25 -- .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 84 ++--- .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp | 44 +-- .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp | 34 +- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 26 +- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 348 ++++++++++----------- .../state_trackers/d3d1x/gd3d11/d3d11_misc.h | 32 +- .../state_trackers/d3d1x/gd3d11/d3d11_objects.h | 80 ++--- .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 188 +++++------ 11 files changed, 449 insertions(+), 475 deletions(-) delete mode 100644 src/gallium/state_trackers/d3d1x/d3dapi/specstrings.h (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h index c8404d96918..d3ca2742a9e 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h @@ -42,7 +42,7 @@ extern const char* sm4_opcode_names[]; extern const char* sm4_file_names[]; -extern const char* sm4_file_ms_names[]; +extern const char* sm4_shortfile_names[]; extern const char* sm4_target_names[]; extern const char* sm4_interpolation_names[]; extern const char* sm4_sv_names[]; diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index eebabaa9af5..313aa10a377 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -43,7 +43,6 @@ namespace std #define WIN32_LEAN_AND_MEAN #include -#include #include "galliumdxgi.h" #include @@ -836,9 +835,9 @@ struct GalliumPrivateDataComObject : public GalliumComObject } HRESULT get_private_data( - __in REFGUID guid, - __inout UINT *pDataSize, - __out_bcount_opt(*pDataSize) void *pData) + REFGUID guid, + UINT *pDataSize, + void *pData) { lock_t lock(private_data_mutex); private_data_map_t::iterator i = private_data_map.find(guid); @@ -868,9 +867,9 @@ struct GalliumPrivateDataComObject : public GalliumComObject } HRESULT set_private_data( - __in REFGUID guid, - __in UINT DataSize, - __in_bcount_opt( DataSize ) const void *pData) + REFGUID guid, + UINT DataSize, + const void *pData) { void* p = 0; @@ -902,8 +901,8 @@ struct GalliumPrivateDataComObject : public GalliumComObject } HRESULT set_private_data_interface( - __in REFGUID guid, - __in_opt const IUnknown *pData) + REFGUID guid, + const IUnknown *pData) { lock_t lock(private_data_mutex); std::pair& v = private_data_map[guid]; @@ -926,24 +925,24 @@ struct GalliumPrivateDataComObject : public GalliumComObject } virtual HRESULT STDMETHODCALLTYPE GetPrivateData( - __in REFGUID guid, - __inout UINT *pDataSize, - __out_bcount_opt(*pDataSize) void *pData) + REFGUID guid, + UINT *pDataSize, + void *pData) { return get_private_data(guid, pDataSize, pData); } virtual HRESULT STDMETHODCALLTYPE SetPrivateData( - __in REFGUID guid, - __in UINT DataSize, - __in_bcount_opt( DataSize ) const void *pData) + REFGUID guid, + UINT DataSize, + const void *pData) { return set_private_data(guid, DataSize, pData); } virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( - __in REFGUID guid, - __in_opt const IUnknown *pData) + REFGUID guid, + const IUnknown *pData) { return set_private_data_interface(guid, pData); } @@ -954,24 +953,24 @@ struct GalliumMultiPrivateDataComObject : public GalliumMultiComObjectQueryInterface(riid, ppParent); } virtual HRESULT STDMETHODCALLTYPE GetAdapter( - __out IDXGIAdapter **pAdapter) + IDXGIAdapter **pAdapter) { *pAdapter = adapter.ref(); return S_OK; } virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency( - __in_ecount(NumResources) IUnknown *const *ppResources, - __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, + IUnknown *const *ppResources, + DXGI_RESIDENCY *pResidencyStatus, UINT NumResources) { for(unsigned i = 0; i < NumResources; ++i) @@ -1046,7 +1045,7 @@ struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObject } virtual HRESULT STDMETHODCALLTYPE GetParent( - __in REFIID riid, - __out void **ppParent) + REFIID riid, + void **ppParent) { return parent->QueryInterface(riid, ppParent); } @@ -113,14 +113,14 @@ struct GalliumDXGIFactory : public GalliumDXGIObject virtual HRESULT STDMETHODCALLTYPE EnumAdapters( UINT Adapter, - __out IDXGIAdapter **ppAdapter) + IDXGIAdapter **ppAdapter) { return EnumAdapters1(Adapter, (IDXGIAdapter1**)ppAdapter); } virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( UINT Adapter, - __out IDXGIAdapter1 **ppAdapter) + IDXGIAdapter1 **ppAdapter) { *ppAdapter = 0; if(Adapter == 0) @@ -162,23 +162,23 @@ struct GalliumDXGIFactory : public GalliumDXGIObject } virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( - __out HWND *pWindowHandle) + HWND *pWindowHandle) { *pWindowHandle = associated_window; return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( - __in IUnknown *pDevice, - __in DXGI_SWAP_CHAIN_DESC *pDesc, - __out IDXGISwapChain **ppSwapChain) + IUnknown *pDevice, + DXGI_SWAP_CHAIN_DESC *pDesc, + IDXGISwapChain **ppSwapChain) { return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); } virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( HMODULE Module, - __out IDXGIAdapter **ppAdapter) + IDXGIAdapter **ppAdapter) { /* TODO: ignore the module, and just create a Gallium software screen */ *ppAdapter = 0; @@ -277,7 +277,7 @@ struct GalliumDXGIAdapter virtual HRESULT STDMETHODCALLTYPE EnumOutputs( UINT Output, - __out IDXGIOutput **ppOutput) + IDXGIOutput **ppOutput) { if(Output >= (unsigned)num_outputs) return DXGI_ERROR_NOT_FOUND; @@ -293,22 +293,22 @@ struct GalliumDXGIAdapter } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_ADAPTER_DESC *pDesc) + DXGI_ADAPTER_DESC *pDesc) { memcpy(pDesc, &desc, sizeof(*pDesc)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetDesc1( - __out DXGI_ADAPTER_DESC1 *pDesc) + DXGI_ADAPTER_DESC1 *pDesc) { memcpy(pDesc, &desc, sizeof(*pDesc)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( - __in REFGUID InterfaceName, - __out LARGE_INTEGER *pUMDVersion) + REFGUID InterfaceName, + LARGE_INTEGER *pUMDVersion) { // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) @@ -407,7 +407,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_OUTPUT_DESC *pDesc) + DXGI_OUTPUT_DESC *pDesc) { *pDesc = desc; return S_OK; @@ -416,8 +416,8 @@ use_fake_mode: virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( DXGI_FORMAT EnumFormat, UINT Flags, - __inout UINT *pNumModes, - __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) + UINT *pNumModes, + DXGI_MODE_DESC *pDesc) { /* TODO: should we return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE when we don't * support modesetting instead of fake modes? @@ -452,9 +452,9 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( - __in const DXGI_MODE_DESC *pModeToMatch, - __out DXGI_MODE_DESC *pClosestMatch, - __in_opt IUnknown *pConcernedDevice) + const DXGI_MODE_DESC *pModeToMatch, + DXGI_MODE_DESC *pClosestMatch, + IUnknown *pConcernedDevice) { /* TODO: actually implement this */ DXGI_FORMAT dxgi_format = pModeToMatch->Format; @@ -482,7 +482,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE TakeOwnership( - __in IUnknown *pDevice, + IUnknown *pDevice, BOOL Exclusive) { return S_OK; @@ -493,14 +493,14 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( - __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) + DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) { memset(pGammaCaps, 0, sizeof(*pGammaCaps)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE SetGammaControl( - __in const DXGI_GAMMA_CONTROL *pArray) + const DXGI_GAMMA_CONTROL *pArray) { if(!gamma) gamma = new DXGI_GAMMA_CONTROL; @@ -509,7 +509,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControl( - __out DXGI_GAMMA_CONTROL *pArray) + DXGI_GAMMA_CONTROL *pArray) { if(gamma) *pArray = *gamma; @@ -528,19 +528,19 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( - __in IDXGISurface *pScanoutSurface) + IDXGISurface *pScanoutSurface) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( - __in IDXGISurface *pDestination) + IDXGISurface *pDestination) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - __out DXGI_FRAME_STATISTICS *pStats) + DXGI_FRAME_STATISTICS *pStats) { memset(pStats, 0, sizeof(*pStats)); #ifdef _WIN32 @@ -941,8 +941,8 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectQueryInterface(riid, ppDevice); } @@ -1159,8 +1159,8 @@ end_present: virtual HRESULT STDMETHODCALLTYPE GetBuffer( UINT Buffer, - __in REFIID riid, - __out void **ppSurface) + REFIID riid, + void **ppSurface) { if(Buffer > 0) { @@ -1182,7 +1182,7 @@ end_present: /* TODO: implement somehow */ virtual HRESULT STDMETHODCALLTYPE SetFullscreenState( BOOL Fullscreen, - __in_opt IDXGIOutput *pTarget) + IDXGIOutput *pTarget) { fullscreen = Fullscreen; target = pTarget; @@ -1190,8 +1190,8 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetFullscreenState( - __out BOOL *pFullscreen, - __out IDXGIOutput **ppTarget) + BOOL *pFullscreen, + IDXGIOutput **ppTarget) { if(pFullscreen) *pFullscreen = fullscreen; @@ -1201,7 +1201,7 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_SWAP_CHAIN_DESC *pDesc) + DXGI_SWAP_CHAIN_DESC *pDesc) { *pDesc = desc; return S_OK; @@ -1243,14 +1243,14 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetContainingOutput( - __out IDXGIOutput **ppOutput) + IDXGIOutput **ppOutput) { *ppOutput = adapter->outputs[0].ref(); return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - __out DXGI_FRAME_STATISTICS *pStats) + DXGI_FRAME_STATISTICS *pStats) { memset(pStats, 0, sizeof(*pStats)); #ifdef _WIN32 @@ -1263,7 +1263,7 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( - __out UINT *pLastPresentCount) + UINT *pLastPresentCount) { *pLastPresentCount = present_count; return S_OK; @@ -1392,8 +1392,8 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() * Or perhaps what they actually mean is "only create a single factory in your application"? * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( - __in REFIID riid, - __out void **ppFactory + REFIID riid, + void **ppFactory ) { GalliumDXGIFactory* factory; @@ -1410,8 +1410,8 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() } HRESULT STDMETHODCALLTYPE CreateDXGIFactory( - __in REFIID riid, - __out void **ppFactory + REFIID riid, + void **ppFactory ) { return CreateDXGIFactory1(riid, ppFactory); diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp index 3ab8cda191f..98ed6ac66ac 100644 --- a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp @@ -31,13 +31,13 @@ #include HRESULT D3D10CreateDevice1( - __in_opt IDXGIAdapter *pAdapter, - __in D3D10_DRIVER_TYPE DriverType, - __in HMODULE Software, - __in unsigned Flags, - __in D3D10_FEATURE_LEVEL1 HardwareLevel, - __in unsigned SDKVersion, - __out_opt ID3D10Device1 **ppDevice + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + unsigned Flags, + D3D10_FEATURE_LEVEL1 HardwareLevel, + unsigned SDKVersion, + ID3D10Device1 **ppDevice ) { HRESULT hr; @@ -83,15 +83,15 @@ HRESULT D3D10CreateDevice1( } HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( - __in_opt IDXGIAdapter* pAdapter, + IDXGIAdapter* pAdapter, D3D10_DRIVER_TYPE DriverType, HMODULE Software, unsigned Flags, - __in D3D10_FEATURE_LEVEL1 HardwareLevel, + D3D10_FEATURE_LEVEL1 HardwareLevel, unsigned SDKVersion, - __in_opt DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - __out_opt IDXGISwapChain** ppSwapChain, - __out_opt ID3D10Device1** ppDevice + DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + IDXGISwapChain** ppSwapChain, + ID3D10Device1** ppDevice ) { ComPtr dev; @@ -123,26 +123,26 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( } HRESULT D3D10CreateDevice( - __in_opt IDXGIAdapter *pAdapter, - __in D3D10_DRIVER_TYPE DriverType, - __in HMODULE Software, - __in unsigned Flags, - __in unsigned SDKVersion, - __out_opt ID3D10Device **ppDevice + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + unsigned Flags, + unsigned SDKVersion, + ID3D10Device **ppDevice ) { return D3D10CreateDevice1(pAdapter, DriverType, Software, Flags, D3D10_FEATURE_LEVEL_10_0, SDKVersion, (ID3D10Device1**)ppDevice); } HRESULT WINAPI D3D10CreateDeviceAndSwapChain( - __in_opt IDXGIAdapter* pAdapter, + IDXGIAdapter* pAdapter, D3D10_DRIVER_TYPE DriverType, HMODULE Software, unsigned Flags, unsigned SDKVersion, - __in_opt DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - __out_opt IDXGISwapChain** ppSwapChain, - __out_opt ID3D10Device** ppDevice + DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + IDXGISwapChain** ppSwapChain, + ID3D10Device** ppDevice ) { return D3D10CreateDeviceAndSwapChain1(pAdapter, DriverType, Software, Flags, D3D10_FEATURE_LEVEL_10_0, SDKVersion, pSwapChainDesc, ppSwapChain, (ID3D10Device1**)ppDevice); diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp index 66f69bb7306..2fc3b7f4113 100644 --- a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp @@ -31,16 +31,16 @@ #include HRESULT D3D11CreateDevice( - __in_opt IDXGIAdapter *pAdapter, - __in D3D_DRIVER_TYPE DriverType, - __in HMODULE Software, - __in unsigned Flags, - __in_ecount_opt( FeatureLevels ) const D3D_FEATURE_LEVEL *pFeatureLevels, - __in unsigned FeatureLevels, - __in unsigned SDKVersion, - __out_opt ID3D11Device **ppDevice, - __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, - __out_opt ID3D11DeviceContext **ppImmediateContext + IDXGIAdapter *pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + unsigned Flags, + const D3D_FEATURE_LEVEL *pFeatureLevels, + unsigned FeatureLevels, + unsigned SDKVersion, + ID3D11Device **ppDevice, + D3D_FEATURE_LEVEL *pFeatureLevel, + ID3D11DeviceContext **ppImmediateContext ) { HRESULT hr; @@ -90,18 +90,18 @@ HRESULT D3D11CreateDevice( } HRESULT WINAPI D3D11CreateDeviceAndSwapChain( - __in_opt IDXGIAdapter* pAdapter, + IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, unsigned Flags, - __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, + CONST D3D_FEATURE_LEVEL* pFeatureLevels, unsigned FeatureLevels, unsigned SDKVersion, - __in_opt CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - __out_opt IDXGISwapChain** ppSwapChain, - __out_opt ID3D11Device** ppDevice, - __out_opt D3D_FEATURE_LEVEL* pFeatureLevel, - __out_opt ID3D11DeviceContext** ppImmediateContext ) + CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + IDXGISwapChain** ppSwapChain, + ID3D11Device** ppDevice, + D3D_FEATURE_LEVEL* pFeatureLevel, + ID3D11DeviceContext** ppImmediateContext ) { ComPtr dev; ComPtr ctx; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 3d3990a63ed..962bea5ce95 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -168,23 +168,23 @@ struct GalliumD3D11Screen : public GalliumD3D11ScreenBase #if API < 11 // we use a D3D11-like API internally virtual HRESULT STDMETHODCALLTYPE Map( - __in ID3D11Resource *pResource, - __in unsigned Subresource, - __in D3D11_MAP MapType, - __in unsigned MapFlags, - __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0; + ID3D11Resource *pResource, + unsigned Subresource, + D3D11_MAP MapType, + unsigned MapFlags, + D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0; virtual void STDMETHODCALLTYPE Unmap( - __in ID3D11Resource *pResource, - __in unsigned Subresource) = 0; + ID3D11Resource *pResource, + unsigned Subresource) = 0; virtual void STDMETHODCALLTYPE Begin( - __in ID3D11Asynchronous *pAsync) = 0; + ID3D11Asynchronous *pAsync) = 0; virtual void STDMETHODCALLTYPE End( - __in ID3D11Asynchronous *pAsync) = 0; + ID3D11Asynchronous *pAsync) = 0; virtual HRESULT STDMETHODCALLTYPE GetData( - __in ID3D11Asynchronous *pAsync, - __out_bcount_opt(DataSize) void *pData, - __in unsigned DataSize, - __in unsigned GetDataFlags) = 0; + ID3D11Asynchronous *pAsync, + void *pData, + unsigned DataSize, + unsigned GetDataFlags) = 0; // TODO: maybe we should use function overloading, but that might risk silent errors, // and cannot be exported to a C interface diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 04d5b864967..c2b3bf45703 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -303,11 +303,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } #if API >= 11 #define SET_SHADER_EXTRA_ARGS , \ - __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, \ + ID3D11ClassInstance *const *ppClassInstances, \ unsigned NumClassInstances #define GET_SHADER_EXTRA_ARGS , \ - __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, \ - __inout_opt unsigned *pNumClassInstances + ID3D11ClassInstance **ppClassInstances, \ + unsigned *pNumClassInstances #else #define SET_SHADER_EXTRA_ARGS #define GET_SHADER_EXTRA_ARGS @@ -396,65 +396,65 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #define IMPLEMENT_SHADER_STAGE(XS, Stage) \ virtual void STDMETHODCALLTYPE XS##SetShader( \ - __in_opt ID3D11##Stage##Shader *pShader \ + ID3D11##Stage##Shader *pShader \ SET_SHADER_EXTRA_ARGS) \ { \ SYNCHRONIZED; \ xs_set_shader((GalliumD3D11Shader<>*)pShader); \ } \ virtual void STDMETHODCALLTYPE XS##GetShader(\ - __out ID3D11##Stage##Shader **ppShader \ + ID3D11##Stage##Shader **ppShader \ GET_SHADER_EXTRA_ARGS) \ { \ SYNCHRONIZED; \ *ppShader = (ID3D11##Stage##Shader*)shaders[D3D11_STAGE_##XS].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetConstantBuffers(\ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ - __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) \ + unsigned StartSlot, \ + unsigned NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers) \ { \ SYNCHRONIZED; \ xs_set_constant_buffers(StartSlot, NumBuffers, (GalliumD3D11Buffer *const *)ppConstantBuffers); \ } \ virtual void STDMETHODCALLTYPE XS##GetConstantBuffers(\ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot) unsigned NumBuffers, \ - __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) \ + unsigned StartSlot, \ + unsigned NumBuffers, \ + ID3D11Buffer **ppConstantBuffers) \ { \ SYNCHRONIZED; \ for(unsigned i = 0; i < NumBuffers; ++i) \ ppConstantBuffers[i] = constant_buffers[D3D11_STAGE_##XS][StartSlot + i].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetShaderResources(\ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ - __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) \ + unsigned StartSlot, \ + unsigned NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews) \ { \ SYNCHRONIZED; \ xs_set_shader_resources(StartSlot, NumViews, (GalliumD3D11ShaderResourceView *const *)ppShaderResourceViews); \ } \ virtual void STDMETHODCALLTYPE XS##GetShaderResources(\ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumViews, \ - __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) \ + unsigned StartSlot, \ + unsigned NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews) \ { \ SYNCHRONIZED; \ for(unsigned i = 0; i < NumViews; ++i) \ ppShaderResourceViews[i] = shader_resource_views[D3D11_STAGE_##XS][StartSlot + i].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetSamplers(\ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ - __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) \ + unsigned StartSlot, \ + unsigned NumSamplers, \ + ID3D11SamplerState *const *ppSamplers) \ { \ SYNCHRONIZED; \ xs_set_samplers(StartSlot, NumSamplers, (GalliumD3D11SamplerState *const *)ppSamplers); \ } \ virtual void STDMETHODCALLTYPE XS##GetSamplers( \ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1) unsigned StartSlot, \ - __in_range(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot) unsigned NumSamplers, \ - __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) \ + unsigned StartSlot, \ + unsigned NumSamplers, \ + ID3D11SamplerState **ppSamplers) \ { \ SYNCHRONIZED; \ for(unsigned i = 0; i < NumSamplers; ++i) \ @@ -477,10 +477,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl IMPLEMENT_SHADER_STAGE(CS, Compute) virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews( - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, - __in_ecount(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - __in_ecount(NumUAVs) const unsigned *pUAVInitialCounts) + unsigned StartSlot, + unsigned NumUAVs, + ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + const unsigned *pUAVInitialCounts) { SYNCHRONIZED; for(unsigned i = 0; i < NumUAVs; ++i) @@ -488,9 +488,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews( - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot) unsigned NumUAVs, - __out_ecount(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) + unsigned StartSlot, + unsigned NumUAVs, + ID3D11UnorderedAccessView **ppUnorderedAccessViews) { SYNCHRONIZED; for(unsigned i = 0; i < NumUAVs; ++i) @@ -579,7 +579,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetInputLayout( - __in_opt ID3D11InputLayout *pInputLayout) + ID3D11InputLayout *pInputLayout) { SYNCHRONIZED; if(pInputLayout != input_layout.p) @@ -590,18 +590,18 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetInputLayout( - __out ID3D11InputLayout **ppInputLayout) + ID3D11InputLayout **ppInputLayout) { SYNCHRONIZED; *ppInputLayout = input_layout.ref(); } virtual void STDMETHODCALLTYPE IASetVertexBuffers( - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, - __in_ecount(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, - __in_ecount(NumBuffers) const unsigned *pStrides, - __in_ecount(NumBuffers) const unsigned *pOffsets) + unsigned StartSlot, + unsigned NumBuffers, + ID3D11Buffer *const *ppVertexBuffers, + const unsigned *pStrides, + const unsigned *pOffsets) { SYNCHRONIZED; int last_different = -1; @@ -629,11 +629,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetVertexBuffers( - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1) unsigned StartSlot, - __in_range(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot) unsigned NumBuffers, - __out_ecount_opt(NumBuffers) ID3D11Buffer **ppVertexBuffers, - __out_ecount_opt(NumBuffers) unsigned *pStrides, - __out_ecount_opt(NumBuffers) unsigned *pOffsets) + unsigned StartSlot, + unsigned NumBuffers, + ID3D11Buffer **ppVertexBuffers, + unsigned *pStrides, + unsigned *pOffsets) { SYNCHRONIZED; if(ppVertexBuffers) @@ -677,9 +677,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetIndexBuffer( - __in_opt ID3D11Buffer *pIndexBuffer, - __in DXGI_FORMAT Format, - __in unsigned Offset) + ID3D11Buffer *pIndexBuffer, + DXGI_FORMAT Format, + unsigned Offset) { SYNCHRONIZED; if(index_buffer.p != pIndexBuffer || index_format != Format || index_offset != Offset) @@ -693,9 +693,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetIndexBuffer( - __out_opt ID3D11Buffer **pIndexBuffer, - __out_opt DXGI_FORMAT *Format, - __out_opt unsigned *Offset) + ID3D11Buffer **pIndexBuffer, + DXGI_FORMAT *Format, + unsigned *Offset) { SYNCHRONIZED; if(pIndexBuffer) @@ -707,7 +707,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( - __in D3D11_PRIMITIVE_TOPOLOGY Topology) + D3D11_PRIMITIVE_TOPOLOGY Topology) { SYNCHRONIZED; if(primitive_topology != Topology) @@ -721,16 +721,16 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( - __out D3D11_PRIMITIVE_TOPOLOGY *pTopology) + D3D11_PRIMITIVE_TOPOLOGY *pTopology) { SYNCHRONIZED; *pTopology = primitive_topology; } virtual void STDMETHODCALLTYPE DrawIndexed( - __in unsigned IndexCount, - __in unsigned StartIndexLocation, - __in int BaseVertexLocation) + unsigned IndexCount, + unsigned StartIndexLocation, + int BaseVertexLocation) { SYNCHRONIZED; if(update_flags) @@ -751,8 +751,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE Draw( - __in unsigned VertexCount, - __in unsigned StartVertexLocation) + unsigned VertexCount, + unsigned StartVertexLocation) { SYNCHRONIZED; if(update_flags) @@ -773,11 +773,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawIndexedInstanced( - __in unsigned IndexCountPerInstance, - __in unsigned InstanceCount, - __in unsigned StartIndexLocation, - __in int BaseVertexLocation, - __in unsigned StartInstanceLocation) + unsigned IndexCountPerInstance, + unsigned InstanceCount, + unsigned StartIndexLocation, + int BaseVertexLocation, + unsigned StartInstanceLocation) { SYNCHRONIZED; if(update_flags) @@ -798,10 +798,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawInstanced( - __in unsigned VertexCountPerInstance, - __in unsigned InstanceCount, - __in unsigned StartVertexLocation, - __in unsigned StartInstanceLocation) + unsigned VertexCountPerInstance, + unsigned InstanceCount, + unsigned StartVertexLocation, + unsigned StartInstanceLocation) { SYNCHRONIZED; if(update_flags) @@ -834,8 +834,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect( - __in ID3D11Buffer *pBufferForArgs, - __in unsigned AlignedByteOffsetForArgs) + ID3D11Buffer *pBufferForArgs, + unsigned AlignedByteOffsetForArgs) { SYNCHRONIZED; if(update_flags) @@ -865,8 +865,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawInstancedIndirect( - __in ID3D11Buffer *pBufferForArgs, - __in unsigned AlignedByteOffsetForArgs) + ID3D11Buffer *pBufferForArgs, + unsigned AlignedByteOffsetForArgs) { SYNCHRONIZED; if(update_flags) @@ -896,9 +896,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #if API >= 11 virtual void STDMETHODCALLTYPE Dispatch( - __in unsigned ThreadGroupCountX, - __in unsigned ThreadGroupCountY, - __in unsigned ThreadGroupCountZ) + unsigned ThreadGroupCountX, + unsigned ThreadGroupCountY, + unsigned ThreadGroupCountZ) { // uncomment this when this is implemented // SYNCHRONIZED; @@ -907,8 +907,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DispatchIndirect( - __in ID3D11Buffer *pBufferForArgs, - __in unsigned AlignedByteOffsetForArgs) + ID3D11Buffer *pBufferForArgs, + unsigned AlignedByteOffsetForArgs) { // uncomment this when this is implemented // SYNCHRONIZED; @@ -926,7 +926,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetState( - __in_opt ID3D11RasterizerState *pRasterizerState) + ID3D11RasterizerState *pRasterizerState) { SYNCHRONIZED; if(pRasterizerState != rasterizer_state.p) @@ -943,7 +943,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetState( - __out ID3D11RasterizerState **ppRasterizerState) + ID3D11RasterizerState **ppRasterizerState) { SYNCHRONIZED; *ppRasterizerState = rasterizer_state.ref(); @@ -968,8 +968,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetViewports( - __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumViewports, - __in_ecount_opt(NumViewports) const D3D11_VIEWPORT *pViewports) + unsigned NumViewports, + const D3D11_VIEWPORT *pViewports) { SYNCHRONIZED; if(NumViewports) @@ -992,8 +992,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetViewports( - __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumViewports, - __out_ecount_opt(*pNumViewports) D3D11_VIEWPORT *pViewports) + unsigned *pNumViewports, + D3D11_VIEWPORT *pViewports) { SYNCHRONIZED; if(pViewports) @@ -1019,8 +1019,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetScissorRects( - __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned NumRects, - __in_ecount_opt(NumRects) const D3D11_RECT *pRects) + unsigned NumRects, + const D3D11_RECT *pRects) { SYNCHRONIZED; if(NumRects) @@ -1044,8 +1044,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetScissorRects( - __inout_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) unsigned *pNumRects, - __out_ecount_opt(*pNumRects) D3D11_RECT *pRects) + unsigned *pNumRects, + D3D11_RECT *pRects) { SYNCHRONIZED; if(pRects) @@ -1061,9 +1061,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMSetBlendState( - __in_opt ID3D11BlendState *pBlendState, - __in_opt const float BlendFactor[ 4 ], - __in unsigned SampleMask) + ID3D11BlendState *pBlendState, + const float BlendFactor[ 4 ], + unsigned SampleMask) { SYNCHRONIZED; float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -1092,9 +1092,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMGetBlendState( - __out_opt ID3D11BlendState **ppBlendState, - __out_opt float BlendFactor[ 4 ], - __out_opt unsigned *pSampleMask) + ID3D11BlendState **ppBlendState, + float BlendFactor[ 4 ], + unsigned *pSampleMask) { SYNCHRONIZED; if(ppBlendState) @@ -1114,8 +1114,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMSetDepthStencilState( - __in_opt ID3D11DepthStencilState *pDepthStencilState, - __in unsigned StencilRef) + ID3D11DepthStencilState *pDepthStencilState, + unsigned StencilRef) { SYNCHRONIZED; if(pDepthStencilState != depth_stencil_state.p) @@ -1132,8 +1132,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMGetDepthStencilState( - __out_opt ID3D11DepthStencilState **ppDepthStencilState, - __out_opt unsigned *pStencilRef) + ID3D11DepthStencilState **ppDepthStencilState, + unsigned *pStencilRef) { SYNCHRONIZED; if(*ppDepthStencilState) @@ -1178,9 +1178,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl */ virtual void STDMETHODCALLTYPE OMSetRenderTargets( - __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, - __in_ecount_opt(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, - __in_opt ID3D11DepthStencilView *pDepthStencilView) + unsigned NumViews, + ID3D11RenderTargetView *const *ppRenderTargetViews, + ID3D11DepthStencilView *pDepthStencilView) { SYNCHRONIZED; if(!ppRenderTargetViews) @@ -1211,9 +1211,9 @@ changed: } virtual void STDMETHODCALLTYPE OMGetRenderTargets( - __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumViews, - __out_ecount_opt(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, - __out_opt ID3D11DepthStencilView **ppDepthStencilView) + unsigned NumViews, + ID3D11RenderTargetView **ppRenderTargetViews, + ID3D11DepthStencilView **ppDepthStencilView) { SYNCHRONIZED; if(ppRenderTargetViews) @@ -1233,13 +1233,13 @@ changed: #if API >= 11 /* TODO: what is this supposed to do _exactly_? are we doing the right thing? */ virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews( - __in unsigned NumRTVs, - __in_ecount_opt(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, - __in_opt ID3D11DepthStencilView *pDepthStencilView, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, - __in unsigned NumUAVs, - __in_ecount_opt(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - __in_ecount_opt(NumUAVs) const unsigned *pUAVInitialCounts) + unsigned NumRTVs, + ID3D11RenderTargetView *const *ppRenderTargetViews, + ID3D11DepthStencilView *pDepthStencilView, + unsigned UAVStartSlot, + unsigned NumUAVs, + ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + const unsigned *pUAVInitialCounts) { SYNCHRONIZED; if(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL) @@ -1256,12 +1256,12 @@ changed: } virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews( - __in_range(0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT) unsigned NumRTVs, - __out_ecount_opt(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, - __out_opt ID3D11DepthStencilView **ppDepthStencilView, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1) unsigned UAVStartSlot, - __in_range(0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot) unsigned NumUAVs, - __out_ecount_opt(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) + unsigned NumRTVs, + ID3D11RenderTargetView **ppRenderTargetViews, + ID3D11DepthStencilView **ppDepthStencilView, + unsigned UAVStartSlot, + unsigned NumUAVs, + ID3D11UnorderedAccessView **ppUnorderedAccessViews) { SYNCHRONIZED; if(ppRenderTargetViews) @@ -1276,9 +1276,9 @@ changed: #endif virtual void STDMETHODCALLTYPE SOSetTargets( - __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, - __in_ecount_opt(NumBuffers) ID3D11Buffer *const *ppSOTargets, - __in_ecount_opt(NumBuffers) const unsigned *pOffsets) + unsigned NumBuffers, + ID3D11Buffer *const *ppSOTargets, + const unsigned *pOffsets) { SYNCHRONIZED; unsigned i; @@ -1312,10 +1312,10 @@ changed: } virtual void STDMETHODCALLTYPE SOGetTargets( - __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumBuffers, - __out_ecount(NumBuffers) ID3D11Buffer **ppSOTargets + unsigned NumBuffers, + ID3D11Buffer **ppSOTargets #if API < 11 - , __out_ecount(NumBuffers) UINT *pOffsets + , UINT *pOffsets #endif ) { @@ -1330,7 +1330,7 @@ changed: } virtual void STDMETHODCALLTYPE Begin( - __in ID3D11Asynchronous *pAsync) + ID3D11Asynchronous *pAsync) { SYNCHRONIZED; if(caps.queries) @@ -1338,7 +1338,7 @@ changed: } virtual void STDMETHODCALLTYPE End( - __in ID3D11Asynchronous *pAsync) + ID3D11Asynchronous *pAsync) { SYNCHRONIZED; if(caps.queries) @@ -1346,10 +1346,10 @@ changed: } virtual HRESULT STDMETHODCALLTYPE GetData( - __in ID3D11Asynchronous *pAsync, - __out_bcount_opt(DataSize) void *pData, - __in unsigned DataSize, - __in unsigned GetDataFlags) + ID3D11Asynchronous *pAsync, + void *pData, + unsigned DataSize, + unsigned GetDataFlags) { SYNCHRONIZED; if(!caps.queries) @@ -1387,8 +1387,8 @@ changed: } virtual void STDMETHODCALLTYPE SetPredication( - __in_opt ID3D11Predicate *pPredicate, - __in BOOL PredicateValue) + ID3D11Predicate *pPredicate, + BOOL PredicateValue) { SYNCHRONIZED; if(render_predicate.p != pPredicate || render_predicate_value != PredicateValue) @@ -1400,8 +1400,8 @@ changed: } virtual void STDMETHODCALLTYPE GetPredication( - __out_opt ID3D11Predicate **ppPredicate, - __out_opt BOOL *pPredicateValue) + ID3D11Predicate **ppPredicate, + BOOL *pPredicateValue) { SYNCHRONIZED; if(ppPredicate) @@ -1428,11 +1428,11 @@ changed: } virtual HRESULT STDMETHODCALLTYPE Map( - __in ID3D11Resource *pResource, - __in unsigned Subresource, - __in D3D11_MAP MapType, - __in unsigned MapFlags, - __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) + ID3D11Resource *pResource, + unsigned Subresource, + D3D11_MAP MapType, + unsigned MapFlags, + D3D11_MAPPED_SUBRESOURCE *pMappedResource) { SYNCHRONIZED; GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; @@ -1472,8 +1472,8 @@ changed: } virtual void STDMETHODCALLTYPE Unmap( - __in ID3D11Resource *pResource, - __in unsigned Subresource) + ID3D11Resource *pResource, + unsigned Subresource) { SYNCHRONIZED; GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; @@ -1487,14 +1487,14 @@ changed: } virtual void STDMETHODCALLTYPE CopySubresourceRegion( - __in ID3D11Resource *pDstResource, - __in unsigned DstSubresource, - __in unsigned DstX, - __in unsigned DstY, - __in unsigned DstZ, - __in ID3D11Resource *pSrcResource, - __in unsigned SrcSubresource, - __in_opt const D3D11_BOX *pSrcBox) + ID3D11Resource *pDstResource, + unsigned DstSubresource, + unsigned DstX, + unsigned DstY, + unsigned DstZ, + ID3D11Resource *pSrcResource, + unsigned SrcSubresource, + const D3D11_BOX *pSrcBox) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1512,8 +1512,8 @@ changed: } virtual void STDMETHODCALLTYPE CopyResource( - __in ID3D11Resource *pDstResource, - __in ID3D11Resource *pSrcResource) + ID3D11Resource *pDstResource, + ID3D11Resource *pSrcResource) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1540,12 +1540,12 @@ changed: } virtual void STDMETHODCALLTYPE UpdateSubresource( - __in ID3D11Resource *pDstResource, - __in unsigned DstSubresource, - __in_opt const D3D11_BOX *pDstBox, - __in const void *pSrcData, - __in unsigned SrcRowPitch, - __in unsigned SrcDepthPitch) + ID3D11Resource *pDstResource, + unsigned DstSubresource, + const D3D11_BOX *pDstBox, + const void *pSrcData, + unsigned SrcRowPitch, + unsigned SrcDepthPitch) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1556,17 +1556,17 @@ changed: #if API >= 11 virtual void STDMETHODCALLTYPE CopyStructureCount( - __in ID3D11Buffer *pDstBuffer, - __in unsigned DstAlignedByteOffset, - __in ID3D11UnorderedAccessView *pSrcView) + ID3D11Buffer *pDstBuffer, + unsigned DstAlignedByteOffset, + ID3D11UnorderedAccessView *pSrcView) { SYNCHRONIZED; } #endif virtual void STDMETHODCALLTYPE ClearRenderTargetView( - __in ID3D11RenderTargetView *pRenderTargetView, - __in const float ColorRGBA[4]) + ID3D11RenderTargetView *pRenderTargetView, + const float ColorRGBA[4]) { SYNCHRONIZED; GalliumD3D11RenderTargetView* view = ((GalliumD3D11RenderTargetView*)pRenderTargetView); @@ -1574,10 +1574,10 @@ changed: } virtual void STDMETHODCALLTYPE ClearDepthStencilView( - __in ID3D11DepthStencilView *pDepthStencilView, - __in unsigned ClearFlags, - __in float Depth, - __in UINT8 Stencil) + ID3D11DepthStencilView *pDepthStencilView, + unsigned ClearFlags, + float Depth, + UINT8 Stencil) { SYNCHRONIZED; GalliumD3D11DepthStencilView* view = ((GalliumD3D11DepthStencilView*)pDepthStencilView); @@ -1591,15 +1591,15 @@ changed: #if API >= 11 virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint( - __in ID3D11UnorderedAccessView *pUnorderedAccessView, - __in const unsigned Values[ 4 ]) + ID3D11UnorderedAccessView *pUnorderedAccessView, + const unsigned Values[ 4 ]) { SYNCHRONIZED; } virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat( - __in ID3D11UnorderedAccessView *pUnorderedAccessView, - __in const float Values[ 4 ]) + ID3D11UnorderedAccessView *pUnorderedAccessView, + const float Values[ 4 ]) { SYNCHRONIZED; } @@ -1631,7 +1631,7 @@ changed: } virtual void STDMETHODCALLTYPE GenerateMips( - __in ID3D11ShaderResourceView *pShaderResourceView) + ID3D11ShaderResourceView *pShaderResourceView) { SYNCHRONIZED; @@ -1675,7 +1675,7 @@ changed: #if API >= 11 /* TODO: hack SRVs or sampler states to handle this, or add to Gallium */ virtual void STDMETHODCALLTYPE SetResourceMinLOD( - __in ID3D11Resource *pResource, + ID3D11Resource *pResource, float MinLOD) { SYNCHRONIZED; @@ -1688,7 +1688,7 @@ changed: } virtual float STDMETHODCALLTYPE GetResourceMinLOD( - __in ID3D11Resource *pResource) + ID3D11Resource *pResource) { SYNCHRONIZED; GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; @@ -1697,11 +1697,11 @@ changed: #endif virtual void STDMETHODCALLTYPE ResolveSubresource( - __in ID3D11Resource *pDstResource, - __in unsigned DstSubresource, - __in ID3D11Resource *pSrcResource, - __in unsigned SrcSubresource, - __in DXGI_FORMAT Format) + ID3D11Resource *pDstResource, + unsigned DstSubresource, + ID3D11Resource *pSrcResource, + unsigned SrcSubresource, + DXGI_FORMAT Format) { SYNCHRONIZED; GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; @@ -1713,7 +1713,7 @@ changed: #if API >= 11 virtual void STDMETHODCALLTYPE ExecuteCommandList( - __in ID3D11CommandList *pCommandList, + ID3D11CommandList *pCommandList, BOOL RestoreContextState) { SYNCHRONIZED; @@ -1721,7 +1721,7 @@ changed: virtual HRESULT STDMETHODCALLTYPE FinishCommandList( BOOL RestoreDeferredContextState, - __out_opt ID3D11CommandList **ppCommandList) + ID3D11CommandList **ppCommandList) { SYNCHRONIZED; return E_NOTIMPL; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index f5cfd0cfab4..9ad293b7fc7 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -1,12 +1,12 @@ #if API < 11 extern "C" HRESULT STDMETHODCALLTYPE D3D10CreateBlob( - __in SIZE_T NumBytes, - __out LPD3D10BLOB *ppBuffer + SIZE_T NumBytes, + LPD3D10BLOB *ppBuffer ); HRESULT STDMETHODCALLTYPE D3D10CreateBlob( - __in SIZE_T NumBytes, - __out LPD3D10BLOB *ppBuffer + SIZE_T NumBytes, + LPD3D10BLOB *ppBuffer ) { void* data = malloc(NumBytes); @@ -17,21 +17,21 @@ HRESULT STDMETHODCALLTYPE D3D10CreateBlob( } LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile( - __in ID3D10Device *pDevice + ID3D10Device *pDevice ) { return "ps_4_0"; } LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile( - __in ID3D10Device *pDevice + ID3D10Device *pDevice ) { return "vs_4_0"; } LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile( - __in ID3D10Device *pDevice + ID3D10Device *pDevice ) { return "gs_4_0"; @@ -47,9 +47,9 @@ static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, unsigned } HRESULT D3D10GetInputSignatureBlob( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __out ID3D10Blob **ppSignatureBlob + const void *pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10Blob **ppSignatureBlob ) { dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, false); @@ -60,9 +60,9 @@ HRESULT D3D10GetInputSignatureBlob( } HRESULT D3D10GetOutputSignatureBlob( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __out ID3D10Blob **ppSignatureBlob + const void *pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10Blob **ppSignatureBlob ) { dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, true); @@ -73,9 +73,9 @@ HRESULT D3D10GetOutputSignatureBlob( } HRESULT D3D10GetInputAndOutputSignatureBlob( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __out ID3D10Blob **ppSignatureBlob + const void *pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10Blob **ppSignatureBlob ) { dxbc_chunk_signature* sigs[2]; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h index 0cf2cf3cf7e..1a559494dc6 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h @@ -71,7 +71,7 @@ struct GalliumD3D11DeviceChild : public GalliumPrivateDataComObjectAddRef(); @@ -242,7 +242,7 @@ struct GalliumD3D11ResourceBase : public GalliumD3D11DeviceChild unsigned eviction_priority; virtual void STDMETHODCALLTYPE SetEvictionPriority( - __in unsigned EvictionPriority) + unsigned EvictionPriority) { eviction_priority = EvictionPriority; } @@ -257,7 +257,7 @@ template struct GalliumDXGIResource : public IDXGIResource { virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( - __in unsigned EvictionPriority) + unsigned EvictionPriority) { static_cast(this)->eviction_priority = EvictionPriority; return S_OK; @@ -270,8 +270,8 @@ struct GalliumDXGIResource : public IDXGIResource } virtual HRESULT STDMETHODCALLTYPE GetDevice( - __in REFIID riid, - __out void **ppParent) + REFIID riid, + void **ppParent) { if(!static_cast(this)->device) return E_NOINTERFACE; @@ -279,8 +279,8 @@ struct GalliumDXGIResource : public IDXGIResource } virtual HRESULT STDMETHODCALLTYPE GetParent( - __in REFIID riid, - __out void **ppParent) + REFIID riid, + void **ppParent) { if(!static_cast(this)->device) return E_NOINTERFACE; @@ -322,7 +322,7 @@ struct GalliumD3D11Resource } virtual HRESULT STDMETHODCALLTYPE GetUsage( - __out DXGI_USAGE *pUsage + DXGI_USAGE *pUsage ) { *pUsage = this->dxgi_usage; @@ -349,7 +349,7 @@ struct GalliumD3D11TypedResource : public GalliumD3D11Resource : GalliumD3D11Resource(device, resource, dxgi_usage), desc(desc) {} virtual void STDMETHODCALLTYPE GetType( - __out D3D11_RESOURCE_DIMENSION *pResourceDimension) + D3D11_RESOURCE_DIMENSION *pResourceDimension) { *pResourceDimension = Dim; } @@ -382,9 +382,9 @@ struct GalliumD3D10Buffer : public GalliumD3D10BufferBase } virtual HRESULT STDMETHODCALLTYPE Map( - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out void **ppData) + D3D10_MAP MapType, + unsigned MapFlags, + void **ppData) { D3D10_MAPPED_SUBRESOURCE msr; HRESULT hr = device->Map(this, 0, MapType, MapFlags, &msr); @@ -407,10 +407,10 @@ struct GalliumD3D10Texture1D : public GalliumD3D10Texture1DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - __in unsigned Subresource, - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out void **ppData) + unsigned Subresource, + D3D10_MAP MapType, + unsigned MapFlags, + void **ppData) { D3D10_MAPPED_SUBRESOURCE msr; HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); @@ -421,7 +421,7 @@ struct GalliumD3D10Texture1D : public GalliumD3D10Texture1DBase } virtual void STDMETHODCALLTYPE Unmap( - __in unsigned Subresource + unsigned Subresource ) { device->Unmap(this, Subresource); @@ -436,10 +436,10 @@ struct GalliumD3D10Texture2D : public GalliumD3D10Texture2DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - __in unsigned Subresource, - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D) + unsigned Subresource, + D3D10_MAP MapType, + unsigned MapFlags, + D3D10_MAPPED_TEXTURE2D *pMappedTex2D) { D3D10_MAPPED_SUBRESOURCE msr; HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); @@ -451,7 +451,7 @@ struct GalliumD3D10Texture2D : public GalliumD3D10Texture2DBase } virtual void STDMETHODCALLTYPE Unmap( - __in unsigned Subresource + unsigned Subresource ) { device->Unmap(this, Subresource); @@ -466,10 +466,10 @@ struct GalliumD3D10Texture3D : public GalliumD3D10Texture3DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - __in unsigned Subresource, - __in D3D10_MAP MapType, - __in unsigned MapFlags, - __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D) + unsigned Subresource, + D3D10_MAP MapType, + unsigned MapFlags, + D3D10_MAPPED_TEXTURE3D *pMappedTex3D) { D3D10_MAPPED_SUBRESOURCE msr; HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); @@ -482,7 +482,7 @@ struct GalliumD3D10Texture3D : public GalliumD3D10Texture3DBase } virtual void STDMETHODCALLTYPE Unmap( - __in unsigned Subresource + unsigned Subresource ) { device->Unmap(this, Subresource); @@ -502,7 +502,7 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObjectFormat = this->desc.Format; pDesc->Width = this->desc.Width; @@ -512,8 +512,8 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObject } virtual HRESULT STDMETHODCALLTYPE GetData( - __out_bcount(DataSize) void *pData, - __in unsigned DataSize, - __in unsigned GetDataFlags) + void *pData, + unsigned DataSize, + unsigned GetDataFlags) { return this->device->GetData(this, pData, DataSize, GetDataFlags); } @@ -675,7 +675,7 @@ struct GalliumD3D11QueryOrPredicate : public GalliumD3D11Asynchronous {} virtual void STDMETHODCALLTYPE GetDesc( - __out D3D11_QUERY_DESC *pDesc) + D3D11_QUERY_DESC *pDesc) { *pDesc = desc; } @@ -708,7 +708,7 @@ struct GalliumD3D11Counter : public GalliumD3D11Asynchronous {} virtual void STDMETHODCALLTYPE GetDesc( - __out D3D11_COUNTER_DESC *pDesc) + D3D11_COUNTER_DESC *pDesc) { *pDesc = desc; } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index eea0e21f202..9ea38c3f2a6 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -166,7 +166,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual void STDMETHODCALLTYPE GetImmediateContext( - __out ID3D11DeviceContext **ppImmediateContext) + ID3D11DeviceContext **ppImmediateContext) { immediate_context->AddRef(); *ppImmediateContext = immediate_context; @@ -185,21 +185,21 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CheckCounter( - __in const D3D11_COUNTER_DESC *pDesc, - __out D3D11_COUNTER_TYPE *pType, - __out unsigned *pActiveCounters, - __out_ecount_opt(*pNameLength) LPSTR szName, - __inout_opt unsigned *pNameLength, - __out_ecount_opt(*pUnitsLength) LPSTR szUnits, - __inout_opt unsigned *pUnitsLength, - __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, - __inout_opt unsigned *pDescriptionLength) + const D3D11_COUNTER_DESC *pDesc, + D3D11_COUNTER_TYPE *pType, + unsigned *pActiveCounters, + LPSTR szName, + unsigned *pNameLength, + LPSTR szUnits, + unsigned *pUnitsLength, + LPSTR szDescription, + unsigned *pDescriptionLength) { return E_NOTIMPL; } virtual void STDMETHODCALLTYPE CheckCounterInfo( - __out D3D11_COUNTER_INFO *pCounterInfo) + D3D11_COUNTER_INFO *pCounterInfo) { /* none supported at the moment */ pCounterInfo->LastDeviceDependentCounter = (D3D11_COUNTER)0; @@ -210,7 +210,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( D3D11_FEATURE Feature, - __out_bcount(FeatureSupportDataSize) void *pFeatureSupportData, + void *pFeatureSupportData, unsigned FeatureSupportDataSize) { SYNCHRONIZED; @@ -360,13 +360,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - __in const D3D11_BLEND_DESC *pBlendStateDesc, - __out_opt ID3D11BlendState **ppBlendState + const D3D11_BLEND_DESC *pBlendStateDesc, + ID3D11BlendState **ppBlendState ) #else virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( - __in const D3D10_BLEND_DESC1 *pBlendStateDesc, - __out_opt ID3D10BlendState1 **ppBlendState + const D3D10_BLEND_DESC1 *pBlendStateDesc, + ID3D10BlendState1 **ppBlendState ) #endif { @@ -400,8 +400,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API < 11 virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - __in const D3D10_BLEND_DESC *pBlendStateDesc, - __out_opt ID3D10BlendState **ppBlendState + const D3D10_BLEND_DESC *pBlendStateDesc, + ID3D10BlendState **ppBlendState ) { SYNCHRONIZED; @@ -439,8 +439,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( - __in const D3D11_DEPTH_STENCIL_DESC *pDepthStencilStateDesc, - __out_opt ID3D11DepthStencilState **ppDepthStencilState + const D3D11_DEPTH_STENCIL_DESC *pDepthStencilStateDesc, + ID3D11DepthStencilState **ppDepthStencilState ) { SYNCHRONIZED; @@ -477,8 +477,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( - __in const D3D11_RASTERIZER_DESC *pRasterizerDesc, - __out_opt ID3D11RasterizerState **ppRasterizerState) + const D3D11_RASTERIZER_DESC *pRasterizerDesc, + ID3D11RasterizerState **ppRasterizerState) { SYNCHRONIZED; @@ -517,8 +517,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( - __in const D3D11_SAMPLER_DESC *pSamplerDesc, - __out_opt ID3D11SamplerState **ppSamplerState) + const D3D11_SAMPLER_DESC *pSamplerDesc, + ID3D11SamplerState **ppSamplerState) { SYNCHRONIZED; @@ -555,11 +555,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( - __in_ecount(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, - __in_range(0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) unsigned NumElements, - __in const void *pShaderBytecodeWithInputSignature, - __in SIZE_T BytecodeLength, - __out_opt ID3D11InputLayout **ppInputLayout) + const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + unsigned NumElements, + const void *pShaderBytecodeWithInputSignature, + SIZE_T BytecodeLength, + ID3D11InputLayout **ppInputLayout) { SYNCHRONIZED; @@ -738,9 +738,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( - __in const D3D11_TEXTURE1D_DESC *pDesc, - __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Texture1D **ppTexture1D) + const D3D11_TEXTURE1D_DESC *pDesc, + const D3D11_SUBRESOURCE_DATA *pInitialData, + ID3D11Texture1D **ppTexture1D) { SYNCHRONIZED; @@ -754,9 +754,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( - __in const D3D11_TEXTURE2D_DESC *pDesc, - __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Texture2D **ppTexture2D) + const D3D11_TEXTURE2D_DESC *pDesc, + const D3D11_SUBRESOURCE_DATA *pInitialData, + ID3D11Texture2D **ppTexture2D) { SYNCHRONIZED; @@ -773,9 +773,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( - __in const D3D11_TEXTURE3D_DESC *pDesc, - __in_xcount_opt(pDesc->MipLevels) const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Texture3D **ppTexture3D) + const D3D11_TEXTURE3D_DESC *pDesc, + const D3D11_SUBRESOURCE_DATA *pInitialData, + ID3D11Texture3D **ppTexture3D) { SYNCHRONIZED; @@ -789,9 +789,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateBuffer( - __in const D3D11_BUFFER_DESC *pDesc, - __in_opt const D3D11_SUBRESOURCE_DATA *pInitialData, - __out_opt ID3D11Buffer **ppBuffer) + const D3D11_BUFFER_DESC *pDesc, + const D3D11_SUBRESOURCE_DATA *pInitialData, + ID3D11Buffer **ppBuffer) { SYNCHRONIZED; @@ -809,8 +809,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE OpenGalliumResource( - __in struct pipe_resource* resource, - __out IUnknown** dxgi_resource) + struct pipe_resource* resource, + IUnknown** dxgi_resource) { SYNCHRONIZED; @@ -845,11 +845,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateSurface( - __in const DXGI_SURFACE_DESC *pDesc, + const DXGI_SURFACE_DESC *pDesc, unsigned NumSurfaces, DXGI_USAGE Usage, - __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, - __out IDXGISurface **ppSurface) + const DXGI_SHARED_RESOURCE *pSharedResource, + IDXGISurface **ppSurface) { SYNCHRONIZED; @@ -882,9 +882,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, - __out_opt ID3D11ShaderResourceView **ppSRView) + ID3D11Resource *pResource, + const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + ID3D11ShaderResourceView **ppSRView) { #if API >= 11 D3D11_SHADER_RESOURCE_VIEW_DESC def_desc; @@ -898,9 +898,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( - __in ID3D11Resource *pResource, - __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, - __out_opt ID3D10ShaderResourceView1 **ppSRView) + ID3D11Resource *pResource, + const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + ID3D10ShaderResourceView1 **ppSRView) { D3D10_SHADER_RESOURCE_VIEW_DESC1 def_desc; #endif @@ -988,9 +988,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, - __out_opt ID3D11UnorderedAccessView **ppUAView) + ID3D11Resource *pResource, + const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + ID3D11UnorderedAccessView **ppUAView) { SYNCHRONIZED; @@ -1001,9 +1001,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, - __out_opt ID3D11RenderTargetView **ppRTView) + ID3D11Resource *pResource, + const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + ID3D11RenderTargetView **ppRTView) { SYNCHRONIZED; @@ -1092,9 +1092,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( - __in ID3D11Resource *pResource, - __in_opt const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, - __out_opt ID3D11DepthStencilView **ppDepthStencilView) + ID3D11Resource *pResource, + const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + ID3D11DepthStencilView **ppDepthStencilView) { SYNCHRONIZED; @@ -1168,7 +1168,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen GalliumD3D11Shader<>* create_stage_shader(unsigned type, const void *pShaderBytecode, SIZE_T BytecodeLength #if API >= 11 - , __in_opt ID3D11ClassLinkage *pClassLinkage + , ID3D11ClassLinkage *pClassLinkage #endif ) { @@ -1221,21 +1221,21 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 #define CREATE_SHADER_ARGS \ - __in const void *pShaderBytecode, \ - __in SIZE_T BytecodeLength, \ - __in_opt ID3D11ClassLinkage *pClassLinkage + const void *pShaderBytecode, \ + SIZE_T BytecodeLength, \ + ID3D11ClassLinkage *pClassLinkage #define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength, pClassLinkage #else #define CREATE_SHADER_ARGS \ - __in const void *pShaderBytecode, \ - __in SIZE_T BytecodeLength + const void *pShaderBytecode, \ + SIZE_T BytecodeLength #define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength #endif #define IMPLEMENT_CREATE_SHADER(Stage, GALLIUM) \ virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ CREATE_SHADER_ARGS, \ - __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ + ID3D11##Stage##Shader **pp##Stage##Shader) \ { \ SYNCHRONIZED; \ GalliumD3D11##Stage##Shader* shader = (GalliumD3D11##Stage##Shader*)create_stage_shader(PIPE_SHADER_##GALLIUM, PASS_SHADER_ARGS); \ @@ -1256,7 +1256,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #define IMPLEMENT_NOTIMPL_CREATE_SHADER(Stage) \ virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ CREATE_SHADER_ARGS, \ - __out_opt ID3D11##Stage##Shader **pp##Stage##Shader) \ + ID3D11##Stage##Shader **pp##Stage##Shader) \ { \ return E_NOTIMPL; \ } @@ -1271,19 +1271,19 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( - __in const void *pShaderBytecode, - __in SIZE_T BytecodeLength, - __in_ecount_opt(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, - __in_range(0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT) unsigned NumEntries, + const void *pShaderBytecode, + SIZE_T BytecodeLength, + const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + unsigned NumEntries, #if API >= 11 - __in_ecount_opt(NumStrides) const unsigned *pBufferStrides, - __in_range(0, D3D11_SO_BUFFER_SLOT_COUNT) unsigned NumStrides, - __in unsigned RasterizedStream, - __in_opt ID3D11ClassLinkage *pClassLinkage, + const unsigned *pBufferStrides, + unsigned NumStrides, + unsigned RasterizedStream, + ID3D11ClassLinkage *pClassLinkage, #else - __in UINT OutputStreamStride, + UINT OutputStreamStride, #endif - __out_opt ID3D11GeometryShader **ppGeometryShader) + ID3D11GeometryShader **ppGeometryShader) { SYNCHRONIZED; @@ -1297,7 +1297,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateClassLinkage( - __out ID3D11ClassLinkage **ppLinkage) + ID3D11ClassLinkage **ppLinkage) { SYNCHRONIZED; @@ -1309,8 +1309,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateQuery( - __in const D3D11_QUERY_DESC *pQueryDesc, - __out_opt ID3D11Query **ppQuery) + const D3D11_QUERY_DESC *pQueryDesc, + ID3D11Query **ppQuery) { SYNCHRONIZED; @@ -1332,8 +1332,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreatePredicate( - __in const D3D11_QUERY_DESC *pPredicateDesc, - __out_opt ID3D11Predicate **ppPredicate) + const D3D11_QUERY_DESC *pPredicateDesc, + ID3D11Predicate **ppPredicate) { SYNCHRONIZED; @@ -1362,8 +1362,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen virtual HRESULT STDMETHODCALLTYPE CreateCounter( - __in const D3D11_COUNTER_DESC *pCounterDesc, - __out_opt ID3D11Counter **ppCounter) + const D3D11_COUNTER_DESC *pCounterDesc, + ID3D11Counter **ppCounter) { SYNCHRONIZED; @@ -1375,7 +1375,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext( unsigned ContextFlags, - __out_opt ID3D11DeviceContext **ppDeferredContext) + ID3D11DeviceContext **ppDeferredContext) { SYNCHRONIZED; @@ -1387,9 +1387,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( - __in HANDLE hResource, - __in REFIID ReturnedInterface, - __out_opt void **ppResource) + HANDLE hResource, + REFIID ReturnedInterface, + void **ppResource) { SYNCHRONIZED; @@ -1414,14 +1414,14 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen * Probably nothing uses these, assuming it has ever been implemented anywhere. */ void STDMETHODCALLTYPE SetTextFilterSize( - __in UINT Width, - __in UINT Height + UINT Width, + UINT Height ) {} virtual void STDMETHODCALLTYPE GetTextFilterSize( - __in UINT *Width, - __in UINT *Height + UINT *Width, + UINT *Height ) {} #endif -- cgit v1.2.3 From 6b485d85188f7a0499b921fbce4f05f1f5f4882b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 13:55:36 +0200 Subject: d3d1x: minifix --- src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl | 2 +- src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl index 94da622b325..7efcae5f431 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl @@ -171,7 +171,7 @@ typedef HRESULT (* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)( D3D10_DRIVER_TYPE, HMODULE, UINT, - D3D10_FEATURE_LEVEL1 HardwareLevels, + D3D10_FEATURE_LEVEL1, UINT, [in, optional] DXGI_SWAP_CHAIN_DESC*, [out,optional] IDXGISwapChain**, diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl index d916c20f193..e23c2f83527 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl @@ -2467,7 +2467,7 @@ typedef HRESULT (* PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)( HMODULE, UINT, [in,optional] const D3D_FEATURE_LEVEL*, - UINT FeatureLevels, + UINT, UINT, [in, optional] const DXGI_SWAP_CHAIN_DESC*, [out,optional] IDXGISwapChain**, -- cgit v1.2.3 From 3e0f57b6401e7ddd0a5dc89b5b7fdd6c8d85818d Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 14:22:10 +0200 Subject: d3d1x: rename context params --- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 774 ++++++++++----------- 1 file changed, 387 insertions(+), 387 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index c2b3bf45703..d7c1c921b71 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -304,10 +304,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #if API >= 11 #define SET_SHADER_EXTRA_ARGS , \ ID3D11ClassInstance *const *ppClassInstances, \ - unsigned NumClassInstances + unsigned count #define GET_SHADER_EXTRA_ARGS , \ ID3D11ClassInstance **ppClassInstances, \ - unsigned *pNumClassInstances + unsigned *out_count #else #define SET_SHADER_EXTRA_ARGS #define GET_SHADER_EXTRA_ARGS @@ -410,55 +410,55 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl *ppShader = (ID3D11##Stage##Shader*)shaders[D3D11_STAGE_##XS].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetConstantBuffers(\ - unsigned StartSlot, \ - unsigned NumBuffers, \ - ID3D11Buffer *const *ppConstantBuffers) \ + unsigned start, \ + unsigned count, \ + ID3D11Buffer *const* constant_buffers) \ { \ SYNCHRONIZED; \ - xs_set_constant_buffers(StartSlot, NumBuffers, (GalliumD3D11Buffer *const *)ppConstantBuffers); \ + xs_set_constant_buffers(start, count, (GalliumD3D11Buffer *const *)constant_buffers); \ } \ virtual void STDMETHODCALLTYPE XS##GetConstantBuffers(\ - unsigned StartSlot, \ - unsigned NumBuffers, \ - ID3D11Buffer **ppConstantBuffers) \ + unsigned start, \ + unsigned count, \ + ID3D11Buffer **out_constant_buffers) \ { \ SYNCHRONIZED; \ - for(unsigned i = 0; i < NumBuffers; ++i) \ - ppConstantBuffers[i] = constant_buffers[D3D11_STAGE_##XS][StartSlot + i].ref(); \ + for(unsigned i = 0; i < count; ++i) \ + out_constant_buffers[i] = constant_buffers[D3D11_STAGE_##XS][start + i].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetShaderResources(\ - unsigned StartSlot, \ - unsigned NumViews, \ - ID3D11ShaderResourceView *const *ppShaderResourceViews) \ + unsigned start, \ + unsigned count, \ + ID3D11ShaderResourceView *const *new_shader_resource_views) \ { \ SYNCHRONIZED; \ - xs_set_shader_resources(StartSlot, NumViews, (GalliumD3D11ShaderResourceView *const *)ppShaderResourceViews); \ + xs_set_shader_resources(start, count, (GalliumD3D11ShaderResourceView *const *)new_shader_resource_views); \ } \ virtual void STDMETHODCALLTYPE XS##GetShaderResources(\ - unsigned StartSlot, \ - unsigned NumViews, \ - ID3D11ShaderResourceView **ppShaderResourceViews) \ + unsigned start, \ + unsigned count, \ + ID3D11ShaderResourceView **out_shader_resource_views) \ { \ SYNCHRONIZED; \ - for(unsigned i = 0; i < NumViews; ++i) \ - ppShaderResourceViews[i] = shader_resource_views[D3D11_STAGE_##XS][StartSlot + i].ref(); \ + for(unsigned i = 0; i < count; ++i) \ + out_shader_resource_views[i] = shader_resource_views[D3D11_STAGE_##XS][start + i].ref(); \ } \ virtual void STDMETHODCALLTYPE XS##SetSamplers(\ - unsigned StartSlot, \ - unsigned NumSamplers, \ - ID3D11SamplerState *const *ppSamplers) \ + unsigned start, \ + unsigned count, \ + ID3D11SamplerState *const *new_samplers) \ { \ SYNCHRONIZED; \ - xs_set_samplers(StartSlot, NumSamplers, (GalliumD3D11SamplerState *const *)ppSamplers); \ + xs_set_samplers(start, count, (GalliumD3D11SamplerState *const *)new_samplers); \ } \ virtual void STDMETHODCALLTYPE XS##GetSamplers( \ - unsigned StartSlot, \ - unsigned NumSamplers, \ - ID3D11SamplerState **ppSamplers) \ + unsigned start, \ + unsigned count, \ + ID3D11SamplerState **out_samplers) \ { \ SYNCHRONIZED; \ - for(unsigned i = 0; i < NumSamplers; ++i) \ - ppSamplers[i] = samplers[D3D11_STAGE_##XS][StartSlot + i].ref(); \ + for(unsigned i = 0; i < count; ++i) \ + out_samplers[i] = samplers[D3D11_STAGE_##XS][start + i].ref(); \ } #define DO_VS(x) x @@ -477,24 +477,24 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl IMPLEMENT_SHADER_STAGE(CS, Compute) virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews( - unsigned StartSlot, - unsigned NumUAVs, - ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - const unsigned *pUAVInitialCounts) + unsigned start, + unsigned count, + ID3D11UnorderedAccessView *const *new_unordered_access_views, + const unsigned *new_uav_initial_counts) { SYNCHRONIZED; - for(unsigned i = 0; i < NumUAVs; ++i) - cs_unordered_access_views[StartSlot + i] = ppUnorderedAccessViews[i]; + for(unsigned i = 0; i < count; ++i) + cs_unordered_access_views[start + i] = new_unordered_access_views[i]; } virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews( - unsigned StartSlot, - unsigned NumUAVs, - ID3D11UnorderedAccessView **ppUnorderedAccessViews) + unsigned start, + unsigned count, + ID3D11UnorderedAccessView **out_unordered_access_views) { SYNCHRONIZED; - for(unsigned i = 0; i < NumUAVs; ++i) - ppUnorderedAccessViews[i] = cs_unordered_access_views[StartSlot + i].ref(); + for(unsigned i = 0; i < count; ++i) + out_unordered_access_views[i] = cs_unordered_access_views[start + i].ref(); } #endif @@ -579,79 +579,79 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetInputLayout( - ID3D11InputLayout *pInputLayout) + ID3D11InputLayout *new_input_layout) { SYNCHRONIZED; - if(pInputLayout != input_layout.p) + if(new_input_layout != input_layout.p) { - input_layout = pInputLayout; - pipe->bind_vertex_elements_state(pipe, pInputLayout ? ((GalliumD3D11InputLayout*)pInputLayout)->object : default_input_layout); + input_layout = new_input_layout; + pipe->bind_vertex_elements_state(pipe, new_input_layout ? ((GalliumD3D11InputLayout*)new_input_layout)->object : default_input_layout); } } virtual void STDMETHODCALLTYPE IAGetInputLayout( - ID3D11InputLayout **ppInputLayout) + ID3D11InputLayout **out_input_layout) { SYNCHRONIZED; - *ppInputLayout = input_layout.ref(); + *out_input_layout = input_layout.ref(); } virtual void STDMETHODCALLTYPE IASetVertexBuffers( - unsigned StartSlot, - unsigned NumBuffers, - ID3D11Buffer *const *ppVertexBuffers, - const unsigned *pStrides, - const unsigned *pOffsets) + unsigned start, + unsigned count, + ID3D11Buffer *const *new_vertex_buffers, + const unsigned *new_strides, + const unsigned *new_offsets) { SYNCHRONIZED; int last_different = -1; - for(unsigned i = 0; i < NumBuffers; ++i) + for(unsigned i = 0; i < count; ++i) { - ID3D11Buffer* buffer = ppVertexBuffers[i]; - if(buffer != input_buffers[StartSlot + i].p - || vertex_buffers[StartSlot + i].buffer_offset != pOffsets[i] - || vertex_buffers[StartSlot + i].stride != pOffsets[i] + ID3D11Buffer* buffer = new_vertex_buffers[i]; + if(buffer != input_buffers[start + i].p + || vertex_buffers[start + i].buffer_offset != new_offsets[i] + || vertex_buffers[start + i].stride != new_offsets[i] ) { - input_buffers[StartSlot + i] = buffer; - vertex_buffers[StartSlot + i].buffer = buffer ? ((GalliumD3D11Buffer*)buffer)->resource : 0; - vertex_buffers[StartSlot + i].buffer_offset = pOffsets[i]; - vertex_buffers[StartSlot + i].stride = pStrides[i]; - vertex_buffers[StartSlot + i].max_index = ~0; + input_buffers[start + i] = buffer; + vertex_buffers[start + i].buffer = buffer ? ((GalliumD3D11Buffer*)buffer)->resource : 0; + vertex_buffers[start + i].buffer_offset = new_offsets[i]; + vertex_buffers[start + i].stride = new_strides[i]; + vertex_buffers[start + i].max_index = ~0; last_different = i; } } if(last_different >= 0) { - num_vertex_buffers = std::max(num_vertex_buffers, StartSlot + NumBuffers); + num_vertex_buffers = std::max(num_vertex_buffers, start + count); update_flags |= UPDATE_VERTEX_BUFFERS; } } virtual void STDMETHODCALLTYPE IAGetVertexBuffers( - unsigned StartSlot, - unsigned NumBuffers, - ID3D11Buffer **ppVertexBuffers, - unsigned *pStrides, - unsigned *pOffsets) + unsigned start, + unsigned count, + ID3D11Buffer **out_vertex_buffers, + unsigned *out_strides, + unsigned *out_offsets) { SYNCHRONIZED; - if(ppVertexBuffers) + if(out_vertex_buffers) { - for(unsigned i = 0; i < NumBuffers; ++i) - ppVertexBuffers[i] = input_buffers[StartSlot + i].ref(); + for(unsigned i = 0; i < count; ++i) + out_vertex_buffers[i] = input_buffers[start + i].ref(); } - if(pOffsets) + if(out_offsets) { - for(unsigned i = 0; i < NumBuffers; ++i) - pOffsets[i] = vertex_buffers[StartSlot + i].buffer_offset; + for(unsigned i = 0; i < count; ++i) + out_offsets[i] = vertex_buffers[start + i].buffer_offset; } - if(pStrides) + if(out_strides) { - for(unsigned i = 0; i < NumBuffers; ++i) - pStrides[i] = vertex_buffers[StartSlot + i].stride; + for(unsigned i = 0; i < count; ++i) + out_strides[i] = vertex_buffers[start + i].stride; } } @@ -677,60 +677,60 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE IASetIndexBuffer( - ID3D11Buffer *pIndexBuffer, - DXGI_FORMAT Format, - unsigned Offset) + ID3D11Buffer *new_index_buffer, + DXGI_FORMAT new_index_format, + unsigned new_index_offset) { SYNCHRONIZED; - if(index_buffer.p != pIndexBuffer || index_format != Format || index_offset != Offset) + if(index_buffer.p != new_index_buffer || index_format != new_index_format || index_offset != new_index_offset) { - index_buffer = pIndexBuffer; - index_format = Format; - index_offset = Offset; + index_buffer = new_index_buffer; + index_format = new_index_format; + index_offset = new_index_offset; set_index_buffer(); } } virtual void STDMETHODCALLTYPE IAGetIndexBuffer( - ID3D11Buffer **pIndexBuffer, - DXGI_FORMAT *Format, - unsigned *Offset) + ID3D11Buffer **out_index_buffer, + DXGI_FORMAT *out_index_format, + unsigned *out_index_offset) { SYNCHRONIZED; - if(pIndexBuffer) - *pIndexBuffer = index_buffer.ref(); - if(Format) - *Format = index_format; - if(Offset) - *Offset = index_offset; + if(out_index_buffer) + *out_index_buffer = index_buffer.ref(); + if(out_index_format) + *out_index_format = index_format; + if(out_index_offset) + *out_index_offset = index_offset; } virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( - D3D11_PRIMITIVE_TOPOLOGY Topology) + D3D11_PRIMITIVE_TOPOLOGY new_primitive_topology) { SYNCHRONIZED; - if(primitive_topology != Topology) + if(primitive_topology != new_primitive_topology) { - if(Topology < D3D_PRIMITIVE_TOPOLOGY_COUNT) - primitive_mode = d3d_to_pipe_prim[Topology]; + if(new_primitive_topology < D3D_PRIMITIVE_TOPOLOGY_COUNT) + primitive_mode = d3d_to_pipe_prim[new_primitive_topology]; else primitive_mode = 0; - primitive_topology = Topology; + primitive_topology = new_primitive_topology; } } virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( - D3D11_PRIMITIVE_TOPOLOGY *pTopology) + D3D11_PRIMITIVE_TOPOLOGY *out_primitive_topology) { SYNCHRONIZED; - *pTopology = primitive_topology; + *out_primitive_topology = primitive_topology; } virtual void STDMETHODCALLTYPE DrawIndexed( - unsigned IndexCount, - unsigned StartIndexLocation, - int BaseVertexLocation) + unsigned index_count, + unsigned start_index_location, + int base_vertex_location) { SYNCHRONIZED; if(update_flags) @@ -739,9 +739,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl pipe_draw_info info; info.mode = primitive_mode; info.indexed = TRUE; - info.count = IndexCount; - info.start = StartIndexLocation; - info.index_bias = BaseVertexLocation; + info.count = index_count; + info.start = start_index_location; + info.index_bias = base_vertex_location; info.min_index = 0; info.max_index = ~0; info.start_instance = 0; @@ -751,8 +751,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE Draw( - unsigned VertexCount, - unsigned StartVertexLocation) + unsigned vertex_count, + unsigned start_vertex_location) { SYNCHRONIZED; if(update_flags) @@ -761,8 +761,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl pipe_draw_info info; info.mode = primitive_mode; info.indexed = FALSE; - info.count = VertexCount; - info.start = StartVertexLocation; + info.count = vertex_count; + info.start = start_vertex_location; info.index_bias = 0; info.min_index = 0; info.max_index = ~0; @@ -773,11 +773,11 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawIndexedInstanced( - unsigned IndexCountPerInstance, - unsigned InstanceCount, - unsigned StartIndexLocation, - int BaseVertexLocation, - unsigned StartInstanceLocation) + unsigned index_countPerInstance, + unsigned instance_count, + unsigned start_index_location, + int base_vertex_location, + unsigned start_instance_location) { SYNCHRONIZED; if(update_flags) @@ -786,22 +786,22 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl pipe_draw_info info; info.mode = primitive_mode; info.indexed = TRUE; - info.count = IndexCountPerInstance; - info.start = StartIndexLocation; - info.index_bias = BaseVertexLocation; + info.count = index_countPerInstance; + info.start = start_index_location; + info.index_bias = base_vertex_location; info.min_index = 0; info.max_index = ~0; - info.start_instance = StartInstanceLocation; - info.instance_count = InstanceCount; + info.start_instance = start_instance_location; + info.instance_count = instance_count; pipe->draw_vbo(pipe, &info); } virtual void STDMETHODCALLTYPE DrawInstanced( - unsigned VertexCountPerInstance, - unsigned InstanceCount, - unsigned StartVertexLocation, - unsigned StartInstanceLocation) + unsigned vertex_countPerInstance, + unsigned instance_count, + unsigned start_vertex_location, + unsigned start_instance_location) { SYNCHRONIZED; if(update_flags) @@ -810,13 +810,13 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl pipe_draw_info info; info.mode = primitive_mode; info.indexed = FALSE; - info.count = VertexCountPerInstance; - info.start = StartVertexLocation; + info.count = vertex_countPerInstance; + info.start = start_vertex_location; info.index_bias = 0; info.min_index = 0; info.max_index = ~0; - info.start_instance = StartInstanceLocation; - info.instance_count = InstanceCount; + info.start_instance = start_instance_location; + info.instance_count = instance_count; pipe->draw_vbo(pipe, &info); } @@ -834,8 +834,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect( - ID3D11Buffer *pBufferForArgs, - unsigned AlignedByteOffsetForArgs) + ID3D11Buffer *buffer, + unsigned aligned_byte_offset) { SYNCHRONIZED; if(update_flags) @@ -848,7 +848,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl unsigned index_bias; } data; - pipe_buffer_read(pipe, ((GalliumD3D11Buffer*)pBufferForArgs)->resource, AlignedByteOffsetForArgs, sizeof(data), &data); + pipe_buffer_read(pipe, ((GalliumD3D11Buffer*)buffer)->resource, aligned_byte_offset, sizeof(data), &data); pipe_draw_info info; info.mode = primitive_mode; @@ -865,8 +865,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DrawInstancedIndirect( - ID3D11Buffer *pBufferForArgs, - unsigned AlignedByteOffsetForArgs) + ID3D11Buffer *buffer, + unsigned aligned_byte_offset) { SYNCHRONIZED; if(update_flags) @@ -878,7 +878,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl unsigned start; } data; - pipe_buffer_read(pipe, ((GalliumD3D11Buffer*)pBufferForArgs)->resource, AlignedByteOffsetForArgs, sizeof(data), &data); + pipe_buffer_read(pipe, ((GalliumD3D11Buffer*)buffer)->resource, aligned_byte_offset, sizeof(data), &data); pipe_draw_info info; info.mode = primitive_mode; @@ -896,9 +896,9 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl #if API >= 11 virtual void STDMETHODCALLTYPE Dispatch( - unsigned ThreadGroupCountX, - unsigned ThreadGroupCountY, - unsigned ThreadGroupCountZ) + unsigned thread_group_count_x, + unsigned thread_group_count_y, + unsigned thread_group_count_z) { // uncomment this when this is implemented // SYNCHRONIZED; @@ -907,8 +907,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE DispatchIndirect( - ID3D11Buffer *pBufferForArgs, - unsigned AlignedByteOffsetForArgs) + ID3D11Buffer *buffer, + unsigned aligned_byte_offset) { // uncomment this when this is implemented // SYNCHRONIZED; @@ -926,14 +926,14 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetState( - ID3D11RasterizerState *pRasterizerState) + ID3D11RasterizerState *new_rasterizer_state) { SYNCHRONIZED; - if(pRasterizerState != rasterizer_state.p) + if(new_rasterizer_state != rasterizer_state.p) { - rasterizer_state = pRasterizerState; - pipe->bind_rasterizer_state(pipe, pRasterizerState ? ((GalliumD3D11RasterizerState*)pRasterizerState)->object : default_rasterizer); - bool new_depth_clamp = pRasterizerState ? ((GalliumD3D11RasterizerState*)pRasterizerState)->depth_clamp : false; + rasterizer_state = new_rasterizer_state; + pipe->bind_rasterizer_state(pipe, new_rasterizer_state ? ((GalliumD3D11RasterizerState*)new_rasterizer_state)->object : default_rasterizer); + bool new_depth_clamp = new_rasterizer_state ? ((GalliumD3D11RasterizerState*)new_rasterizer_state)->depth_clamp : false; if(depth_clamp != new_depth_clamp) { depth_clamp = new_depth_clamp; @@ -943,10 +943,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSGetState( - ID3D11RasterizerState **ppRasterizerState) + ID3D11RasterizerState **out_rasterizer_state) { SYNCHRONIZED; - *ppRasterizerState = rasterizer_state.ref(); + *out_rasterizer_state = rasterizer_state.ref(); } void set_viewport() @@ -968,19 +968,19 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetViewports( - unsigned NumViewports, - const D3D11_VIEWPORT *pViewports) + unsigned count, + const D3D11_VIEWPORT *new_viewports) { SYNCHRONIZED; - if(NumViewports) + if(count) { - if(memcmp(&viewports[0], &pViewports[0], sizeof(viewports[0]))) + if(memcmp(&viewports[0], &new_viewports[0], sizeof(viewports[0]))) { - viewports[0] = pViewports[0]; + viewports[0] = new_viewports[0]; set_viewport(); } - for(unsigned i = 1; i < NumViewports; ++i) - viewports[i] = pViewports[i]; + for(unsigned i = 1; i < count; ++i) + viewports[i] = new_viewports[i]; } else if(num_viewports) { @@ -988,24 +988,24 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl memset(&viewports[0], 0, sizeof(viewports[0])); set_viewport(); } - num_viewports = NumViewports; + num_viewports = count; } virtual void STDMETHODCALLTYPE RSGetViewports( - unsigned *pNumViewports, - D3D11_VIEWPORT *pViewports) + unsigned *out_count, + D3D11_VIEWPORT *out_viewports) { SYNCHRONIZED; - if(pViewports) + if(out_viewports) { unsigned i; - for(i = 0; i < std::min(*pNumViewports, num_viewports); ++i) - pViewports[i] = viewports[i]; + for(i = 0; i < std::min(*out_count, num_viewports); ++i) + out_viewports[i] = viewports[i]; - memset(pViewports + i, 0, (*pNumViewports - i) * sizeof(D3D11_VIEWPORT)); + memset(out_viewports + i, 0, (*out_count - i) * sizeof(D3D11_VIEWPORT)); } - *pNumViewports = num_viewports; + *out_count = num_viewports; } void set_scissor() @@ -1019,19 +1019,19 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE RSSetScissorRects( - unsigned NumRects, - const D3D11_RECT *pRects) + unsigned count, + const D3D11_RECT *new_rects) { SYNCHRONIZED; - if(NumRects) + if(count) { - if(memcmp(&scissor_rects[0], &pRects[0], sizeof(scissor_rects[0]))) + if(memcmp(&scissor_rects[0], &new_rects[0], sizeof(scissor_rects[0]))) { - scissor_rects[0] = pRects[0]; + scissor_rects[0] = new_rects[0]; set_scissor(); } - for(unsigned i = 1; i < NumRects; ++i) - scissor_rects[i] = pRects[i]; + for(unsigned i = 1; i < count; ++i) + scissor_rects[i] = new_rects[i]; } else if(num_scissor_rects) { @@ -1040,69 +1040,69 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl set_scissor(); } - num_scissor_rects = NumRects; + num_scissor_rects = count; } virtual void STDMETHODCALLTYPE RSGetScissorRects( - unsigned *pNumRects, - D3D11_RECT *pRects) + unsigned *out_count, + D3D11_RECT *out_rects) { SYNCHRONIZED; - if(pRects) + if(out_rects) { unsigned i; - for(i = 0; i < std::min(*pNumRects, num_scissor_rects); ++i) - pRects[i] = scissor_rects[i]; + for(i = 0; i < std::min(*out_count, num_scissor_rects); ++i) + out_rects[i] = scissor_rects[i]; - memset(pRects + i, 0, (*pNumRects - i) * sizeof(D3D11_RECT)); + memset(out_rects + i, 0, (*out_count - i) * sizeof(D3D11_RECT)); } - *pNumRects = num_scissor_rects; + *out_count = num_scissor_rects; } virtual void STDMETHODCALLTYPE OMSetBlendState( - ID3D11BlendState *pBlendState, - const float BlendFactor[ 4 ], - unsigned SampleMask) + ID3D11BlendState *new_blend_state, + const float new_blend_factor[4], + unsigned new_sample_mask) { SYNCHRONIZED; float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - if(blend_state.p != pBlendState) + if(blend_state.p != new_blend_state) { - pipe->bind_blend_state(pipe, pBlendState ? ((GalliumD3D11BlendState*)pBlendState)->object : default_blend); - blend_state = pBlendState; + pipe->bind_blend_state(pipe, new_blend_state ? ((GalliumD3D11BlendState*)new_blend_state)->object : default_blend); + blend_state = new_blend_state; } // Windows D3D11 does this, even though it's apparently undocumented - if(!BlendFactor) - BlendFactor = white; + if(!new_blend_factor) + new_blend_factor = white; - if(memcmp(blend_color, BlendFactor, sizeof(blend_color))) + if(memcmp(blend_color, new_blend_factor, sizeof(blend_color))) { - pipe->set_blend_color(pipe, (struct pipe_blend_color*)BlendFactor); - memcpy(blend_color, BlendFactor, sizeof(blend_color)); + pipe->set_blend_color(pipe, (struct pipe_blend_color*)new_blend_factor); + memcpy(blend_color, new_blend_factor, sizeof(blend_color)); } - if(sample_mask != SampleMask) + if(sample_mask != new_sample_mask) { - pipe->set_sample_mask(pipe, sample_mask); - sample_mask = SampleMask; + pipe->set_sample_mask(pipe, new_sample_mask); + sample_mask = new_sample_mask; } } virtual void STDMETHODCALLTYPE OMGetBlendState( - ID3D11BlendState **ppBlendState, - float BlendFactor[ 4 ], - unsigned *pSampleMask) + ID3D11BlendState **out_blend_state, + float out_blend_factor[4], + unsigned *out_sample_mask) { SYNCHRONIZED; - if(ppBlendState) - *ppBlendState = blend_state.ref(); - if(BlendFactor) - memcpy(BlendFactor, blend_color, sizeof(blend_color)); - if(pSampleMask) - *pSampleMask = sample_mask; + if(out_blend_state) + *out_blend_state = blend_state.ref(); + if(out_blend_factor) + memcpy(out_blend_factor, blend_color, sizeof(blend_color)); + if(out_sample_mask) + *out_sample_mask = sample_mask; } void set_stencil_ref() @@ -1114,32 +1114,32 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } virtual void STDMETHODCALLTYPE OMSetDepthStencilState( - ID3D11DepthStencilState *pDepthStencilState, - unsigned StencilRef) + ID3D11DepthStencilState *new_depth_stencil_state, + unsigned new_stencil_ref) { SYNCHRONIZED; - if(pDepthStencilState != depth_stencil_state.p) + if(new_depth_stencil_state != depth_stencil_state.p) { - pipe->bind_depth_stencil_alpha_state(pipe, pDepthStencilState ? ((GalliumD3D11DepthStencilState*)pDepthStencilState)->object : default_depth_stencil); - depth_stencil_state = pDepthStencilState; + pipe->bind_depth_stencil_alpha_state(pipe, new_depth_stencil_state ? ((GalliumD3D11DepthStencilState*)new_depth_stencil_state)->object : default_depth_stencil); + depth_stencil_state = new_depth_stencil_state; } - if(StencilRef != stencil_ref) + if(new_stencil_ref != stencil_ref) { - stencil_ref = StencilRef; + stencil_ref = new_stencil_ref; set_stencil_ref(); } } virtual void STDMETHODCALLTYPE OMGetDepthStencilState( - ID3D11DepthStencilState **ppDepthStencilState, - unsigned *pStencilRef) + ID3D11DepthStencilState **out_depth_stencil_state, + unsigned *out_stencil_ref) { SYNCHRONIZED; - if(*ppDepthStencilState) - *ppDepthStencilState = depth_stencil_state.ref(); - if(pStencilRef) - *pStencilRef = stencil_ref; + if(*out_depth_stencil_state) + *out_depth_stencil_state = depth_stencil_state.ref(); + if(out_stencil_ref) + *out_stencil_ref = stencil_ref; } void set_framebuffer() @@ -1178,121 +1178,121 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl */ virtual void STDMETHODCALLTYPE OMSetRenderTargets( - unsigned NumViews, - ID3D11RenderTargetView *const *ppRenderTargetViews, - ID3D11DepthStencilView *pDepthStencilView) + unsigned count, + ID3D11RenderTargetView *const *new_render_target_views, + ID3D11DepthStencilView *new_depth_stencil_view) { SYNCHRONIZED; - if(!ppRenderTargetViews) - NumViews = 0; - if(NumViews == num_render_target_views) + if(!new_render_target_views) + count = 0; + if(count == num_render_target_views) { - for(unsigned i = 0; i < NumViews; ++i) + for(unsigned i = 0; i < count; ++i) { - if(ppRenderTargetViews[i] != render_target_views[i].p) + if(new_render_target_views[i] != render_target_views[i].p) goto changed; } return; } changed: - depth_stencil_view = pDepthStencilView; + depth_stencil_view = new_depth_stencil_view; unsigned i; - for(i = 0; i < NumViews; ++i) + for(i = 0; i < count; ++i) { - render_target_views[i] = ppRenderTargetViews[i]; + render_target_views[i] = new_render_target_views[i]; #if API >= 11 om_unordered_access_views[i] = (ID3D11UnorderedAccessView*)NULL; #endif } for(; i < num_render_target_views; ++i) render_target_views[i] = (ID3D11RenderTargetView*)NULL; - num_render_target_views = NumViews; + num_render_target_views = count; set_framebuffer(); } virtual void STDMETHODCALLTYPE OMGetRenderTargets( - unsigned NumViews, - ID3D11RenderTargetView **ppRenderTargetViews, - ID3D11DepthStencilView **ppDepthStencilView) + unsigned count, + ID3D11RenderTargetView **out_render_target_views, + ID3D11DepthStencilView **out_depth_stencil_view) { SYNCHRONIZED; - if(ppRenderTargetViews) + if(out_render_target_views) { unsigned i; - for(i = 0; i < std::min(num_render_target_views, NumViews); ++i) - ppRenderTargetViews[i] = render_target_views[i].ref(); + for(i = 0; i < std::min(num_render_target_views, count); ++i) + out_render_target_views[i] = render_target_views[i].ref(); - for(; i < NumViews; ++i) - ppRenderTargetViews[i] = 0; + for(; i < count; ++i) + out_render_target_views[i] = 0; } - if(ppDepthStencilView) - *ppDepthStencilView = depth_stencil_view.ref(); + if(out_depth_stencil_view) + *out_depth_stencil_view = depth_stencil_view.ref(); } #if API >= 11 /* TODO: what is this supposed to do _exactly_? are we doing the right thing? */ virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews( - unsigned NumRTVs, - ID3D11RenderTargetView *const *ppRenderTargetViews, - ID3D11DepthStencilView *pDepthStencilView, - unsigned UAVStartSlot, - unsigned NumUAVs, - ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - const unsigned *pUAVInitialCounts) + unsigned rtv_count, + ID3D11RenderTargetView *const *new_render_target_views, + ID3D11DepthStencilView *new_depth_stencil_view, + unsigned uav_start, + unsigned uav_count, + ID3D11UnorderedAccessView *const *new_unordered_access_views, + const unsigned *new_uav_initial_counts) { SYNCHRONIZED; - if(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL) - OMSetRenderTargets(NumRTVs, ppRenderTargetViews, pDepthStencilView); + if(rtv_count != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL) + OMSetRenderTargets(rtv_count, new_render_target_views, new_depth_stencil_view); - if(NumUAVs != D3D11_KEEP_UNORDERED_ACCESS_VIEWS) + if(uav_count != D3D11_KEEP_UNORDERED_ACCESS_VIEWS) { - for(unsigned i = 0; i < NumUAVs; ++i) + for(unsigned i = 0; i < uav_count; ++i) { - om_unordered_access_views[UAVStartSlot + i] = ppUnorderedAccessViews[i]; - render_target_views[UAVStartSlot + i] = (ID3D11RenderTargetView*)0; + om_unordered_access_views[uav_start + i] = new_unordered_access_views[i]; + render_target_views[uav_start + i] = (ID3D11RenderTargetView*)0; } } } virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews( - unsigned NumRTVs, - ID3D11RenderTargetView **ppRenderTargetViews, - ID3D11DepthStencilView **ppDepthStencilView, - unsigned UAVStartSlot, - unsigned NumUAVs, - ID3D11UnorderedAccessView **ppUnorderedAccessViews) + unsigned rtv_count, + ID3D11RenderTargetView **out_render_target_views, + ID3D11DepthStencilView **out_depth_stencil_view, + unsigned uav_start, + unsigned uav_count, + ID3D11UnorderedAccessView **out_unordered_access_views) { SYNCHRONIZED; - if(ppRenderTargetViews) - OMGetRenderTargets(NumRTVs, ppRenderTargetViews, ppDepthStencilView); + if(out_render_target_views) + OMGetRenderTargets(rtv_count, out_render_target_views, out_depth_stencil_view); - if(ppUnorderedAccessViews) + if(out_unordered_access_views) { - for(unsigned i = 0; i < NumUAVs; ++i) - ppUnorderedAccessViews[i] = om_unordered_access_views[UAVStartSlot + i].ref(); + for(unsigned i = 0; i < uav_count; ++i) + out_unordered_access_views[i] = om_unordered_access_views[uav_start + i].ref(); } } #endif virtual void STDMETHODCALLTYPE SOSetTargets( - unsigned NumBuffers, - ID3D11Buffer *const *ppSOTargets, - const unsigned *pOffsets) + unsigned count, + ID3D11Buffer *const *new_so_targets, + const unsigned *new_offsets) { SYNCHRONIZED; unsigned i; - if(!ppSOTargets) - NumBuffers = 0; + if(!new_so_targets) + count = 0; bool changed = false; - for(i = 0; i < NumBuffers; ++i) + for(i = 0; i < count; ++i) { - ID3D11Buffer* buffer = ppSOTargets[i]; - if(buffer != so_targets[i].p || pOffsets[i] != so_offsets[i]) + ID3D11Buffer* buffer = new_so_targets[i]; + if(buffer != so_targets[i].p || new_offsets[i] != so_offsets[i]) { so_buffers[i] = buffer ? ((GalliumD3D11Buffer*)buffer)->resource : 0; so_targets[i] = buffer; - so_offsets[i] = pOffsets[i]; + so_offsets[i] = new_offsets[i]; changed = true; } } @@ -1305,61 +1305,61 @@ changed: so_offsets[i] = 0; } } - num_so_targets = NumBuffers; + num_so_targets = count; if(changed && caps.so) pipe->set_stream_output_buffers(pipe, so_buffers, (int*)so_offsets, num_so_targets); } virtual void STDMETHODCALLTYPE SOGetTargets( - unsigned NumBuffers, - ID3D11Buffer **ppSOTargets + unsigned count, + ID3D11Buffer **out_so_targets #if API < 11 - , UINT *pOffsets + , UINT *out_offsets #endif ) { SYNCHRONIZED; - for(unsigned i = 0; i < NumBuffers; ++i) + for(unsigned i = 0; i < count; ++i) { - ppSOTargets[i] = so_targets[i].ref(); + out_so_targets[i] = so_targets[i].ref(); #if API < 11 - pOffsets[i] = so_offsets[i]; + out_offsets[i] = so_offsets[i]; #endif } } virtual void STDMETHODCALLTYPE Begin( - ID3D11Asynchronous *pAsync) + ID3D11Asynchronous *async) { SYNCHRONIZED; if(caps.queries) - pipe->begin_query(pipe, ((GalliumD3D11Asynchronous<>*)pAsync)->query); + pipe->begin_query(pipe, ((GalliumD3D11Asynchronous<>*)async)->query); } virtual void STDMETHODCALLTYPE End( - ID3D11Asynchronous *pAsync) + ID3D11Asynchronous *async) { SYNCHRONIZED; if(caps.queries) - pipe->end_query(pipe, ((GalliumD3D11Asynchronous<>*)pAsync)->query); + pipe->end_query(pipe, ((GalliumD3D11Asynchronous<>*)async)->query); } virtual HRESULT STDMETHODCALLTYPE GetData( - ID3D11Asynchronous *pAsync, - void *pData, - unsigned DataSize, - unsigned GetDataFlags) + ID3D11Asynchronous *iasync, + void *out_data, + unsigned data_size, + unsigned get_data_flags) { SYNCHRONIZED; if(!caps.queries) return E_NOTIMPL; - GalliumD3D11Asynchronous<>* async = (GalliumD3D11Asynchronous<>*)pAsync; - void* data = alloca(async->data_size); - boolean ret = pipe->get_query_result(pipe, ((GalliumD3D11Asynchronous<>*)pAsync)->query, !(GetDataFlags & D3D11_ASYNC_GETDATA_DONOTFLUSH), data); - if(pData) - memcpy(pData, data, std::min(async->data_size, DataSize)); + GalliumD3D11Asynchronous<>* async = (GalliumD3D11Asynchronous<>*)iasync; + void* tmp_data = alloca(async->data_size); + boolean ret = pipe->get_query_result(pipe, async->query, !(get_data_flags & D3D11_ASYNC_GETDATA_DONOTFLUSH), tmp_data); + if(out_data) + memcpy(out_data, tmp_data, std::min(async->data_size, data_size)); return ret ? S_OK : S_FALSE; } @@ -1387,27 +1387,27 @@ changed: } virtual void STDMETHODCALLTYPE SetPredication( - ID3D11Predicate *pPredicate, - BOOL PredicateValue) + ID3D11Predicate *new_predicate, + BOOL new_predicate_value) { SYNCHRONIZED; - if(render_predicate.p != pPredicate || render_predicate_value != PredicateValue) + if(render_predicate.p != new_predicate || render_predicate_value != new_predicate_value) { - render_predicate = pPredicate; - render_predicate_value = PredicateValue; + render_predicate = new_predicate; + render_predicate_value = new_predicate_value; set_render_condition(); } } virtual void STDMETHODCALLTYPE GetPredication( - ID3D11Predicate **ppPredicate, - BOOL *pPredicateValue) + ID3D11Predicate **out_predicate, + BOOL *out_predicate_value) { SYNCHRONIZED; - if(ppPredicate) - *ppPredicate = render_predicate.ref(); - if(pPredicateValue) - *pPredicateValue = render_predicate_value; + if(out_predicate) + *out_predicate = render_predicate.ref(); + if(out_predicate_value) + *out_predicate_value = render_predicate_value; } static pipe_subresource d3d11_to_pipe_subresource(struct pipe_resource* resource, unsigned subresource) @@ -1428,56 +1428,56 @@ changed: } virtual HRESULT STDMETHODCALLTYPE Map( - ID3D11Resource *pResource, - unsigned Subresource, - D3D11_MAP MapType, - unsigned MapFlags, - D3D11_MAPPED_SUBRESOURCE *pMappedResource) + ID3D11Resource *iresource, + unsigned subresource, + D3D11_MAP map_type, + unsigned map_flags, + D3D11_MAPPED_SUBRESOURCE *mapped_resource) { SYNCHRONIZED; - GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; - if(resource->transfers.count(Subresource)) + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)iresource; + if(resource->transfers.count(subresource)) return E_FAIL; - pipe_subresource sr = d3d11_to_pipe_subresource(resource->resource, Subresource); + pipe_subresource sr = d3d11_to_pipe_subresource(resource->resource, subresource); pipe_box box; d3d11_to_pipe_box(resource->resource, sr.level, 0); unsigned usage = 0; - if(MapType == D3D11_MAP_READ) + if(map_type == D3D11_MAP_READ) usage = PIPE_TRANSFER_READ; - else if(MapType == D3D11_MAP_WRITE) + else if(map_type == D3D11_MAP_WRITE) usage = PIPE_TRANSFER_WRITE; - else if(MapType == D3D11_MAP_READ_WRITE) + else if(map_type == D3D11_MAP_READ_WRITE) usage = PIPE_TRANSFER_READ_WRITE; - else if(MapType == D3D11_MAP_WRITE_DISCARD) + else if(map_type == D3D11_MAP_WRITE_DISCARD) usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD; - else if(MapType == D3D11_MAP_WRITE_NO_OVERWRITE) + else if(map_type == D3D11_MAP_WRITE_NO_OVERWRITE) usage = PIPE_TRANSFER_WRITE | PIPE_TRANSFER_NOOVERWRITE; else return E_INVALIDARG; - if(MapType & D3D10_MAP_FLAG_DO_NOT_WAIT) + if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT) usage |= PIPE_TRANSFER_DONTBLOCK; struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, sr, usage, &box); if(!transfer) { - if(MapType & D3D10_MAP_FLAG_DO_NOT_WAIT) + if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT) return DXGI_ERROR_WAS_STILL_DRAWING; else return E_FAIL; } - resource->transfers[Subresource] = transfer; + resource->transfers[subresource] = transfer; pipe->transfer_map(pipe, transfer); - pMappedResource->pData = transfer->data; - pMappedResource->RowPitch = transfer->stride; - pMappedResource->DepthPitch = transfer->slice_stride; + mapped_resource->pData = transfer->data; + mapped_resource->RowPitch = transfer->stride; + mapped_resource->DepthPitch = transfer->slice_stride; return S_OK; } virtual void STDMETHODCALLTYPE Unmap( - ID3D11Resource *pResource, - unsigned Subresource) + ID3D11Resource *iresource, + unsigned subresource) { SYNCHRONIZED; - GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; - std::unordered_map::iterator i = resource->transfers.find(Subresource); + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)iresource; + std::unordered_map::iterator i = resource->transfers.find(subresource); if(i != resource->transfers.end()) { pipe->transfer_unmap(pipe, i->second); @@ -1487,37 +1487,37 @@ changed: } virtual void STDMETHODCALLTYPE CopySubresourceRegion( - ID3D11Resource *pDstResource, - unsigned DstSubresource, - unsigned DstX, - unsigned DstY, - unsigned DstZ, - ID3D11Resource *pSrcResource, - unsigned SrcSubresource, - const D3D11_BOX *pSrcBox) + ID3D11Resource *dst_resource, + unsigned dst_subresource, + unsigned dst_x, + unsigned dst_y, + unsigned dst_z, + ID3D11Resource *src_resource, + unsigned src_subresource, + const D3D11_BOX *src_box) { SYNCHRONIZED; - GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; - GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)pSrcResource; - pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, DstSubresource); - pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, SrcSubresource); - pipe_box box = d3d11_to_pipe_box(src->resource, subsrc.level, pSrcBox); + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource; + GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource; + pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource); + pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, src_subresource); + pipe_box box = d3d11_to_pipe_box(src->resource, subsrc.level, src_box); for(unsigned i = 0; i < box.depth; ++i) { pipe->resource_copy_region(pipe, - dst->resource, subdst, DstX, DstY, DstZ + i, + dst->resource, subdst, dst_x, dst_y, dst_z + i, src->resource, subsrc, box.x, box.y, box.z + i, box.width, box.height); } } virtual void STDMETHODCALLTYPE CopyResource( - ID3D11Resource *pDstResource, - ID3D11Resource *pSrcResource) + ID3D11Resource *dst_resource, + ID3D11Resource *src_resource) { SYNCHRONIZED; - GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; - GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)pSrcResource; + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource; + GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource; pipe_subresource sr; unsigned faces = dst->resource->target == PIPE_TEXTURE_CUBE ? 6 : 1; @@ -1540,66 +1540,66 @@ changed: } virtual void STDMETHODCALLTYPE UpdateSubresource( - ID3D11Resource *pDstResource, - unsigned DstSubresource, + ID3D11Resource *dst_resource, + unsigned dst_subresource, const D3D11_BOX *pDstBox, const void *pSrcData, - unsigned SrcRowPitch, - unsigned SrcDepthPitch) + unsigned src_row_pitch, + unsigned src_depth_pitch) { SYNCHRONIZED; - GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; - pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, DstSubresource); + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource; + pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource); pipe_box box = d3d11_to_pipe_box(dst->resource, subdst.level, pDstBox); - pipe->transfer_inline_write(pipe, dst->resource, subdst, PIPE_TRANSFER_WRITE, &box, pSrcData, SrcRowPitch, SrcDepthPitch); + pipe->transfer_inline_write(pipe, dst->resource, subdst, PIPE_TRANSFER_WRITE, &box, pSrcData, src_row_pitch, src_depth_pitch); } #if API >= 11 virtual void STDMETHODCALLTYPE CopyStructureCount( - ID3D11Buffer *pDstBuffer, - unsigned DstAlignedByteOffset, - ID3D11UnorderedAccessView *pSrcView) + ID3D11Buffer *dst_buffer, + unsigned dst_aligned_byte_offset, + ID3D11UnorderedAccessView *src_view) { SYNCHRONIZED; } #endif virtual void STDMETHODCALLTYPE ClearRenderTargetView( - ID3D11RenderTargetView *pRenderTargetView, - const float ColorRGBA[4]) + ID3D11RenderTargetView *render_target_view, + const float color[4]) { SYNCHRONIZED; - GalliumD3D11RenderTargetView* view = ((GalliumD3D11RenderTargetView*)pRenderTargetView); - pipe->clear_render_target(pipe, view->object, ColorRGBA, 0, 0, view->object->width, view->object->height); + GalliumD3D11RenderTargetView* view = ((GalliumD3D11RenderTargetView*)render_target_view); + pipe->clear_render_target(pipe, view->object, color, 0, 0, view->object->width, view->object->height); } virtual void STDMETHODCALLTYPE ClearDepthStencilView( - ID3D11DepthStencilView *pDepthStencilView, - unsigned ClearFlags, - float Depth, - UINT8 Stencil) + ID3D11DepthStencilView *depth_stencil_view, + unsigned clear_flags, + float depth, + UINT8 stencil) { SYNCHRONIZED; - GalliumD3D11DepthStencilView* view = ((GalliumD3D11DepthStencilView*)pDepthStencilView); + GalliumD3D11DepthStencilView* view = ((GalliumD3D11DepthStencilView*)depth_stencil_view); unsigned flags = 0; - if(ClearFlags & D3D11_CLEAR_DEPTH) + if(clear_flags & D3D11_CLEAR_DEPTH) flags |= PIPE_CLEAR_DEPTH; - if(ClearFlags & D3D11_CLEAR_STENCIL) + if(clear_flags & D3D11_CLEAR_STENCIL) flags |= PIPE_CLEAR_STENCIL; - pipe->clear_depth_stencil(pipe, view->object, flags, Depth, Stencil, 0, 0, view->object->width, view->object->height); + pipe->clear_depth_stencil(pipe, view->object, flags, depth, stencil, 0, 0, view->object->width, view->object->height); } #if API >= 11 virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint( - ID3D11UnorderedAccessView *pUnorderedAccessView, - const unsigned Values[ 4 ]) + ID3D11UnorderedAccessView *unordered_access_view, + const unsigned values[4]) { SYNCHRONIZED; } virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat( - ID3D11UnorderedAccessView *pUnorderedAccessView, - const float Values[ 4 ]) + ID3D11UnorderedAccessView *unordered_access_view, + const float values[4]) { SYNCHRONIZED; } @@ -1631,11 +1631,11 @@ changed: } virtual void STDMETHODCALLTYPE GenerateMips( - ID3D11ShaderResourceView *pShaderResourceView) + ID3D11ShaderResourceView *shader_resource_view) { SYNCHRONIZED; - GalliumD3D11ShaderResourceView* view = (GalliumD3D11ShaderResourceView*)pShaderResourceView; + GalliumD3D11ShaderResourceView* view = (GalliumD3D11ShaderResourceView*)shader_resource_view; if(caps.gs) pipe->bind_gs_state(pipe, 0); if(caps.so) @@ -1675,53 +1675,53 @@ changed: #if API >= 11 /* TODO: hack SRVs or sampler states to handle this, or add to Gallium */ virtual void STDMETHODCALLTYPE SetResourceMinLOD( - ID3D11Resource *pResource, - float MinLOD) + ID3D11Resource *iresource, + float min_lod) { SYNCHRONIZED; - GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; - if(resource->min_lod != MinLOD) + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)iresource; + if(resource->min_lod != min_lod) { // TODO: actually do anything? - resource->min_lod = MinLOD; + resource->min_lod = min_lod; } } virtual float STDMETHODCALLTYPE GetResourceMinLOD( - ID3D11Resource *pResource) + ID3D11Resource *iresource) { SYNCHRONIZED; - GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)pResource; + GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)iresource; return resource->min_lod; } #endif virtual void STDMETHODCALLTYPE ResolveSubresource( - ID3D11Resource *pDstResource, - unsigned DstSubresource, - ID3D11Resource *pSrcResource, - unsigned SrcSubresource, - DXGI_FORMAT Format) + ID3D11Resource *dst_resource, + unsigned dst_subresource, + ID3D11Resource *src_resource, + unsigned src_subresource, + DXGI_FORMAT format) { SYNCHRONIZED; - GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)pDstResource; - GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)pSrcResource; - pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, DstSubresource); - pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, SrcSubresource); + GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource; + GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource; + pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource); + pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, src_subresource); pipe->resource_resolve(pipe, dst->resource, subdst, src->resource, subsrc); } #if API >= 11 virtual void STDMETHODCALLTYPE ExecuteCommandList( - ID3D11CommandList *pCommandList, - BOOL RestoreContextState) + ID3D11CommandList *command_list, + BOOL restore_context_state) { SYNCHRONIZED; } virtual HRESULT STDMETHODCALLTYPE FinishCommandList( - BOOL RestoreDeferredContextState, - ID3D11CommandList **ppCommandList) + BOOL restore_deferred_context_state, + ID3D11CommandList **out_command_list) { SYNCHRONIZED; return E_NOTIMPL; @@ -1898,7 +1898,7 @@ changed: } } - void UnbindDepthStencilView(ID3D11DepthStencilView* view) + void UnbindDepthStencilView(ID3D11DepthStencilView * view) { SYNCHRONIZED; if(view == depth_stencil_view) -- cgit v1.2.3 From 4f700d23fd5d7277f4379454c0d85ff960e73810 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 15:02:59 +0200 Subject: d3d11: rename screen params --- .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 654 ++++++++++----------- 1 file changed, 321 insertions(+), 333 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 9ea38c3f2a6..61b1ba2bd3e 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -166,10 +166,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual void STDMETHODCALLTYPE GetImmediateContext( - ID3D11DeviceContext **ppImmediateContext) + ID3D11DeviceContext **out_immediate_context) { immediate_context->AddRef(); - *ppImmediateContext = immediate_context; + *out_immediate_context = immediate_context; } #endif @@ -185,42 +185,42 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CheckCounter( - const D3D11_COUNTER_DESC *pDesc, - D3D11_COUNTER_TYPE *pType, - unsigned *pActiveCounters, - LPSTR szName, - unsigned *pNameLength, - LPSTR szUnits, - unsigned *pUnitsLength, - LPSTR szDescription, - unsigned *pDescriptionLength) + const D3D11_COUNTER_DESC *desc, + D3D11_COUNTER_TYPE *type, + unsigned *active_counters, + LPSTR sz_name, + unsigned *name_length, + LPSTR sz_units, + unsigned *units_length, + LPSTR sz_description, + unsigned *description_length) { return E_NOTIMPL; } virtual void STDMETHODCALLTYPE CheckCounterInfo( - D3D11_COUNTER_INFO *pCounterInfo) + D3D11_COUNTER_INFO *counter_info) { /* none supported at the moment */ - pCounterInfo->LastDeviceDependentCounter = (D3D11_COUNTER)0; - pCounterInfo->NumSimultaneousCounters = 0; - pCounterInfo->NumDetectableParallelUnits = 1; + counter_info->LastDeviceDependentCounter = (D3D11_COUNTER)0; + counter_info->NumDetectableParallelUnits = 1; + counter_info->NumSimultaneousCounters = 0; } #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( - D3D11_FEATURE Feature, - void *pFeatureSupportData, - unsigned FeatureSupportDataSize) + D3D11_FEATURE feature, + void *out_feature_support_data, + unsigned feature_support_data_size) { SYNCHRONIZED; - switch(Feature) + switch(feature) { case D3D11_FEATURE_THREADING: { - D3D11_FEATURE_DATA_THREADING* data = (D3D11_FEATURE_DATA_THREADING*)pFeatureSupportData; - if(FeatureSupportDataSize != sizeof(*data)) + D3D11_FEATURE_DATA_THREADING* data = (D3D11_FEATURE_DATA_THREADING*)out_feature_support_data; + if(feature_support_data_size != sizeof(*data)) return E_INVALIDARG; data->DriverCommandLists = FALSE; @@ -229,8 +229,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } case D3D11_FEATURE_DOUBLES: { - D3D11_FEATURE_DATA_DOUBLES* data = (D3D11_FEATURE_DATA_DOUBLES*)pFeatureSupportData; - if(FeatureSupportDataSize != sizeof(*data)) + D3D11_FEATURE_DATA_DOUBLES* data = (D3D11_FEATURE_DATA_DOUBLES*)out_feature_support_data; + if(feature_support_data_size != sizeof(*data)) return E_INVALIDARG; data->DoublePrecisionFloatShaderOps = FALSE; @@ -238,16 +238,16 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } case D3D11_FEATURE_FORMAT_SUPPORT: { - D3D11_FEATURE_DATA_FORMAT_SUPPORT* data = (D3D11_FEATURE_DATA_FORMAT_SUPPORT*)pFeatureSupportData; - if(FeatureSupportDataSize != sizeof(*data)) + D3D11_FEATURE_DATA_FORMAT_SUPPORT* data = (D3D11_FEATURE_DATA_FORMAT_SUPPORT*)out_feature_support_data; + if(feature_support_data_size != sizeof(*data)) return E_INVALIDARG; return this->CheckFormatSupport(data->InFormat, &data->OutFormatSupport); } case D3D11_FEATURE_FORMAT_SUPPORT2: { - D3D11_FEATURE_DATA_FORMAT_SUPPORT* data = (D3D11_FEATURE_DATA_FORMAT_SUPPORT*)pFeatureSupportData; - if(FeatureSupportDataSize != sizeof(*data)) + D3D11_FEATURE_DATA_FORMAT_SUPPORT* data = (D3D11_FEATURE_DATA_FORMAT_SUPPORT*)out_feature_support_data; + if(feature_support_data_size != sizeof(*data)) return E_INVALIDARG; data->OutFormatSupport = 0; @@ -256,8 +256,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS: { - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS* data = (D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS*)pFeatureSupportData; - if(FeatureSupportDataSize != sizeof(*data)) + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS* data = (D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS*)out_feature_support_data; + if(feature_support_data_size != sizeof(*data)) return E_INVALIDARG; data->ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = FALSE; @@ -270,14 +270,14 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport( - DXGI_FORMAT Format, - unsigned *pFormatSupport + DXGI_FORMAT dxgi_format, + unsigned *out_format_support ) { SYNCHRONIZED; /* TODO: MSAA, advanced features */ - pipe_format format = dxgi_to_pipe_format[Format]; + pipe_format format = dxgi_to_pipe_format[dxgi_format]; if(!format) return E_INVALIDARG; @@ -313,19 +313,19 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen support |= D3D11_FORMAT_SUPPORT_DISPLAY; format_support[format] = support; } - *pFormatSupport = support; + *out_format_support = support; return S_OK; } virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( - DXGI_FORMAT Format, - unsigned SampleCount, - unsigned *pNumQualityLevels + DXGI_FORMAT format, + unsigned sample_count, + unsigned *pcount ) { SYNCHRONIZED; - *pNumQualityLevels = 0; + *pcount = 0; return S_OK; } @@ -360,13 +360,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - const D3D11_BLEND_DESC *pBlendStateDesc, - ID3D11BlendState **ppBlendState + const D3D11_BLEND_DESC *blend_state_desc, + ID3D11BlendState **out_blend_state ) #else virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( - const D3D10_BLEND_DESC1 *pBlendStateDesc, - ID3D10BlendState1 **ppBlendState + const D3D10_BLEND_DESC1 *blend_state_desc, + ID3D10BlendState1 **out_blend_state ) #endif { @@ -374,49 +374,49 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen pipe_blend_state state; memset(&state, 0, sizeof(state)); - state.alpha_to_coverage = !!pBlendStateDesc->AlphaToCoverageEnable; - state.independent_blend_enable = !!pBlendStateDesc->IndependentBlendEnable; + state.alpha_to_coverage = !!blend_state_desc->AlphaToCoverageEnable; + state.independent_blend_enable = !!blend_state_desc->IndependentBlendEnable; assert(PIPE_MAX_COLOR_BUFS >= 8); for(unsigned i = 0; i < 8; ++i) { if(!convert_blend_state( state.rt[i], - pBlendStateDesc->RenderTarget[i], - pBlendStateDesc->RenderTarget[i].BlendEnable, - pBlendStateDesc->RenderTarget[i].RenderTargetWriteMask)) + blend_state_desc->RenderTarget[i], + blend_state_desc->RenderTarget[i].BlendEnable, + blend_state_desc->RenderTarget[i].RenderTargetWriteMask)) return E_INVALIDARG; } - if(!ppBlendState) + if(!out_blend_state) return S_FALSE; void* object = immediate_pipe->create_blend_state(immediate_pipe, &state); if(!object) return E_FAIL; - *ppBlendState = new GalliumD3D11BlendState(this, object, *pBlendStateDesc); + *out_blend_state = new GalliumD3D11BlendState(this, object, *blend_state_desc); return S_OK; } #if API < 11 virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - const D3D10_BLEND_DESC *pBlendStateDesc, - ID3D10BlendState **ppBlendState + const D3D10_BLEND_DESC *blend_state_desc, + ID3D10BlendState **out_blend_state ) { SYNCHRONIZED; pipe_blend_state state; memset(&state, 0, sizeof(state)); - state.alpha_to_coverage = !!pBlendStateDesc->AlphaToCoverageEnable; + state.alpha_to_coverage = !!blend_state_desc->AlphaToCoverageEnable; assert(PIPE_MAX_COLOR_BUFS >= 8); for(unsigned i = 0; i < 8; ++i) { if(!convert_blend_state( state.rt[i], - *pBlendStateDesc, - pBlendStateDesc->BlendEnable[i], - pBlendStateDesc->RenderTargetWriteMask[i])) + *blend_state_desc, + blend_state_desc->BlendEnable[i], + blend_state_desc->RenderTargetWriteMask[i])) return E_INVALIDARG; } @@ -433,150 +433,150 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen if(!object) return E_FAIL; - *ppBlendState = new GalliumD3D11BlendState(this, object, *pBlendStateDesc); + *out_blend_state = new GalliumD3D11BlendState(this, object, *blend_state_desc); return S_OK; } #endif virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( - const D3D11_DEPTH_STENCIL_DESC *pDepthStencilStateDesc, - ID3D11DepthStencilState **ppDepthStencilState + const D3D11_DEPTH_STENCIL_DESC *depth_stencil_state_desc, + ID3D11DepthStencilState **depth_stencil_state ) { SYNCHRONIZED; pipe_depth_stencil_alpha_state state; memset(&state, 0, sizeof(state)); - state.depth.enabled = !!pDepthStencilStateDesc->DepthEnable; - state.depth.writemask = pDepthStencilStateDesc->DepthWriteMask; - state.depth.func = pDepthStencilStateDesc->DepthFunc - 1; - state.stencil[0].enabled = !!pDepthStencilStateDesc->StencilEnable; - state.stencil[0].writemask = pDepthStencilStateDesc->StencilWriteMask; - state.stencil[0].valuemask = pDepthStencilStateDesc->StencilReadMask; - state.stencil[0].zpass_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->FrontFace.StencilPassOp]; - state.stencil[0].fail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->FrontFace.StencilFailOp]; - state.stencil[0].zfail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->FrontFace.StencilDepthFailOp]; - state.stencil[0].func = pDepthStencilStateDesc->FrontFace.StencilFunc - 1; - state.stencil[1].enabled = !!pDepthStencilStateDesc->StencilEnable; - state.stencil[1].writemask = pDepthStencilStateDesc->StencilWriteMask; - state.stencil[1].valuemask = pDepthStencilStateDesc->StencilReadMask; - state.stencil[1].zpass_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->BackFace.StencilPassOp]; - state.stencil[1].fail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->BackFace.StencilFailOp]; - state.stencil[1].zfail_op = d3d11_to_pipe_stencil_op[pDepthStencilStateDesc->BackFace.StencilDepthFailOp]; - state.stencil[1].func = pDepthStencilStateDesc->BackFace.StencilFunc - 1; - - if(!ppDepthStencilState) + state.depth.enabled = !!depth_stencil_state_desc->DepthEnable; + state.depth.writemask = depth_stencil_state_desc->DepthWriteMask; + state.depth.func = depth_stencil_state_desc->DepthFunc - 1; + state.stencil[0].enabled = !!depth_stencil_state_desc->StencilEnable; + state.stencil[0].writemask = depth_stencil_state_desc->StencilWriteMask; + state.stencil[0].valuemask = depth_stencil_state_desc->StencilReadMask; + state.stencil[0].zpass_op = d3d11_to_pipe_stencil_op[depth_stencil_state_desc->FrontFace.StencilPassOp]; + state.stencil[0].fail_op = d3d11_to_pipe_stencil_op[depth_stencil_state_desc->FrontFace.StencilFailOp]; + state.stencil[0].zfail_op = d3d11_to_pipe_stencil_op[depth_stencil_state_desc->FrontFace.StencilDepthFailOp]; + state.stencil[0].func = depth_stencil_state_desc->FrontFace.StencilFunc - 1; + state.stencil[1].enabled = !!depth_stencil_state_desc->StencilEnable; + state.stencil[1].writemask = depth_stencil_state_desc->StencilWriteMask; + state.stencil[1].valuemask = depth_stencil_state_desc->StencilReadMask; + state.stencil[1].zpass_op = d3d11_to_pipe_stencil_op[depth_stencil_state_desc->BackFace.StencilPassOp]; + state.stencil[1].fail_op = d3d11_to_pipe_stencil_op[depth_stencil_state_desc->BackFace.StencilFailOp]; + state.stencil[1].zfail_op = d3d11_to_pipe_stencil_op[depth_stencil_state_desc->BackFace.StencilDepthFailOp]; + state.stencil[1].func = depth_stencil_state_desc->BackFace.StencilFunc - 1; + + if(!depth_stencil_state) return S_FALSE; void* object = immediate_pipe->create_depth_stencil_alpha_state(immediate_pipe, &state); if(!object) return E_FAIL; - *ppDepthStencilState = new GalliumD3D11DepthStencilState(this, object, *pDepthStencilStateDesc); + *depth_stencil_state = new GalliumD3D11DepthStencilState(this, object, *depth_stencil_state_desc); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( - const D3D11_RASTERIZER_DESC *pRasterizerDesc, - ID3D11RasterizerState **ppRasterizerState) + const D3D11_RASTERIZER_DESC *rasterizer_desc, + ID3D11RasterizerState **out_rasterizer_state) { SYNCHRONIZED; pipe_rasterizer_state state; memset(&state, 0, sizeof(state)); state.gl_rasterization_rules = 1; /* D3D10/11 use GL rules */ - state.fill_front = state.fill_back = (pRasterizerDesc->FillMode == D3D11_FILL_WIREFRAME) ? PIPE_POLYGON_MODE_LINE : PIPE_POLYGON_MODE_FILL; - if(pRasterizerDesc->CullMode == D3D11_CULL_FRONT) + state.fill_front = state.fill_back = (rasterizer_desc->FillMode == D3D11_FILL_WIREFRAME) ? PIPE_POLYGON_MODE_LINE : PIPE_POLYGON_MODE_FILL; + if(rasterizer_desc->CullMode == D3D11_CULL_FRONT) state.cull_face = PIPE_FACE_FRONT; - else if(pRasterizerDesc->CullMode == D3D11_CULL_BACK) + else if(rasterizer_desc->CullMode == D3D11_CULL_BACK) state.cull_face = PIPE_FACE_BACK; else state.cull_face = PIPE_FACE_NONE; - state.front_ccw = !!pRasterizerDesc->FrontCounterClockwise; + state.front_ccw = !!rasterizer_desc->FrontCounterClockwise; /* TODO: is this correct? */ - /* TODO: we are ignoring DepthBiasClamp! */ - state.offset_tri = state.offset_line = state.offset_point = pRasterizerDesc->SlopeScaledDepthBias || pRasterizerDesc->DepthBias; - state.offset_scale = pRasterizerDesc->SlopeScaledDepthBias; - state.offset_units = pRasterizerDesc->DepthBias; - state.scissor = !!pRasterizerDesc->ScissorEnable; - state.multisample = !!pRasterizerDesc->MultisampleEnable; - state.line_smooth = !!pRasterizerDesc->AntialiasedLineEnable; + /* TODO: we are ignoring depthBiasClamp! */ + state.offset_tri = state.offset_line = state.offset_point = rasterizer_desc->SlopeScaledDepthBias || rasterizer_desc->DepthBias; + state.offset_scale = rasterizer_desc->SlopeScaledDepthBias; + state.offset_units = rasterizer_desc->DepthBias; + state.scissor = !!rasterizer_desc->ScissorEnable; + state.multisample = !!rasterizer_desc->MultisampleEnable; + state.line_smooth = !!rasterizer_desc->AntialiasedLineEnable; /* TODO: is this correct? */ state.point_quad_rasterization = 1; - if(!ppRasterizerState) + if(!out_rasterizer_state) return S_FALSE; void* object = immediate_pipe->create_rasterizer_state(immediate_pipe, &state); if(!object) return E_FAIL; - *ppRasterizerState = new GalliumD3D11RasterizerState(this, object, *pRasterizerDesc, !pRasterizerDesc->DepthClipEnable); + *out_rasterizer_state = new GalliumD3D11RasterizerState(this, object, *rasterizer_desc, !rasterizer_desc->DepthClipEnable); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( - const D3D11_SAMPLER_DESC *pSamplerDesc, - ID3D11SamplerState **ppSamplerState) + const D3D11_SAMPLER_DESC *sampler_desc, + ID3D11SamplerState **out_sampler_state) { SYNCHRONIZED; pipe_sampler_state state; memset(&state, 0, sizeof(state)); state.normalized_coords = 1; - state.min_mip_filter = (pSamplerDesc->Filter & 1); - state.mag_img_filter = ((pSamplerDesc->Filter >> 2) & 1); - state.min_img_filter = ((pSamplerDesc->Filter >> 4) & 1); - if(pSamplerDesc->Filter & 0x40) - state.max_anisotropy = pSamplerDesc->MaxAnisotropy; - if(pSamplerDesc->Filter & 0x80) + state.min_mip_filter = (sampler_desc->Filter & 1); + state.mag_img_filter = ((sampler_desc->Filter >> 2) & 1); + state.min_img_filter = ((sampler_desc->Filter >> 4) & 1); + if(sampler_desc->Filter & 0x40) + state.max_anisotropy = sampler_desc->MaxAnisotropy; + if(sampler_desc->Filter & 0x80) { state.compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE; - state.compare_func = pSamplerDesc->ComparisonFunc; + state.compare_func = sampler_desc->ComparisonFunc; } - state.wrap_s = d3d11_to_pipe_wrap[pSamplerDesc->AddressU]; - state.wrap_t = d3d11_to_pipe_wrap[pSamplerDesc->AddressV]; - state.wrap_r = d3d11_to_pipe_wrap[pSamplerDesc->AddressW]; - state.lod_bias = pSamplerDesc->MipLODBias; - memcpy(state.border_color, pSamplerDesc->BorderColor, sizeof(state.border_color)); - state.min_lod = pSamplerDesc->MinLOD; - state.max_lod = pSamplerDesc->MaxLOD; - - if(!ppSamplerState) + state.wrap_s = d3d11_to_pipe_wrap[sampler_desc->AddressU]; + state.wrap_t = d3d11_to_pipe_wrap[sampler_desc->AddressV]; + state.wrap_r = d3d11_to_pipe_wrap[sampler_desc->AddressW]; + state.lod_bias = sampler_desc->MipLODBias; + memcpy(state.border_color, sampler_desc->BorderColor, sizeof(state.border_color)); + state.min_lod = sampler_desc->MinLOD; + state.max_lod = sampler_desc->MaxLOD; + + if(!out_sampler_state) return S_FALSE; void* object = immediate_pipe->create_sampler_state(immediate_pipe, &state); if(!object) return E_FAIL; - *ppSamplerState = new GalliumD3D11SamplerState(this, object, *pSamplerDesc); + *out_sampler_state = new GalliumD3D11SamplerState(this, object, *sampler_desc); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( - const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, - unsigned NumElements, - const void *pShaderBytecodeWithInputSignature, - SIZE_T BytecodeLength, - ID3D11InputLayout **ppInputLayout) + const D3D11_INPUT_ELEMENT_DESC *input_element_descs, + unsigned count, + const void *shader_bytecode_with_input_signature, + SIZE_T bytecode_length, + ID3D11InputLayout **out_input_layout) { SYNCHRONIZED; - if(NumElements > D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) + if(count > D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT) return E_INVALIDARG; assert(D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT <= PIPE_MAX_ATTRIBS); // putting semantics matching in the core API seems to be a (minor) design mistake - struct dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecodeWithInputSignature, BytecodeLength, false); + struct dxbc_chunk_signature* sig = dxbc_find_signature(shader_bytecode_with_input_signature, bytecode_length, false); D3D11_SIGNATURE_PARAMETER_DESC* params; unsigned num_params = dxbc_parse_signature(sig, ¶ms); typedef std::unordered_map, unsigned> semantic_to_idx_map_t; semantic_to_idx_map_t semantic_to_idx_map; - for(unsigned i = 0; i < NumElements; ++i) - semantic_to_idx_map[std::make_pair(c_string(pInputElementDescs[i].SemanticName), pInputElementDescs[i].SemanticIndex)] = i; + for(unsigned i = 0; i < count; ++i) + semantic_to_idx_map[std::make_pair(c_string(input_element_descs[i].SemanticName), input_element_descs[i].SemanticIndex)] = i; struct pipe_vertex_element elements[D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT]; @@ -593,102 +593,102 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen memset(&elements[i], 0, sizeof(elements[i])); if(idx >= 0) { - elements[i].src_format = dxgi_to_pipe_format[pInputElementDescs[idx].Format]; - elements[i].src_offset = pInputElementDescs[idx].AlignedByteOffset; - elements[i].vertex_buffer_index = pInputElementDescs[idx].InputSlot; - elements[i].instance_divisor = pInputElementDescs[idx].InstanceDataStepRate; + elements[i].src_format = dxgi_to_pipe_format[input_element_descs[idx].Format]; + elements[i].src_offset = input_element_descs[idx].AlignedByteOffset; + elements[i].vertex_buffer_index = input_element_descs[idx].InputSlot; + elements[i].instance_divisor = input_element_descs[idx].InstanceDataStepRate; } } free(params); - if(!ppInputLayout) + if(!out_input_layout) return S_FALSE; void* object = immediate_pipe->create_vertex_elements_state(immediate_pipe, num_params_to_use, elements); if(!object) return E_FAIL; - *ppInputLayout = new GalliumD3D11InputLayout(this, object); + *out_input_layout = new GalliumD3D11InputLayout(this, object); return S_OK; } - static unsigned d3d11_to_pipe_bind_flags(unsigned BindFlags) + static unsigned d3d11_to_pipe_bind_flags(unsigned bind_flags) { unsigned bind = 0; - if(BindFlags & D3D11_BIND_VERTEX_BUFFER) + if(bind_flags & D3D11_BIND_VERTEX_BUFFER) bind |= PIPE_BIND_VERTEX_BUFFER; - if(BindFlags & D3D11_BIND_INDEX_BUFFER) + if(bind_flags & D3D11_BIND_INDEX_BUFFER) bind |= PIPE_BIND_INDEX_BUFFER; - if(BindFlags & D3D11_BIND_CONSTANT_BUFFER) + if(bind_flags & D3D11_BIND_CONSTANT_BUFFER) bind |= PIPE_BIND_CONSTANT_BUFFER; - if(BindFlags & D3D11_BIND_SHADER_RESOURCE) + if(bind_flags & D3D11_BIND_SHADER_RESOURCE) bind |= PIPE_BIND_SAMPLER_VIEW; - if(BindFlags & D3D11_BIND_STREAM_OUTPUT) + if(bind_flags & D3D11_BIND_STREAM_OUTPUT) bind |= PIPE_BIND_STREAM_OUTPUT; - if(BindFlags & D3D11_BIND_RENDER_TARGET) + if(bind_flags & D3D11_BIND_RENDER_TARGET) bind |= PIPE_BIND_RENDER_TARGET; - if(BindFlags & D3D11_BIND_DEPTH_STENCIL) + if(bind_flags & D3D11_BIND_DEPTH_STENCIL) bind |= PIPE_BIND_DEPTH_STENCIL; return bind; } inline HRESULT create_resource( pipe_texture_target target, - unsigned Width, - unsigned Height, - unsigned Depth, - unsigned MipLevels, - unsigned ArraySize, - DXGI_FORMAT Format, + unsigned width, + unsigned height, + unsigned depth, + unsigned mip_levels, + unsigned array_size, + DXGI_FORMAT format, const DXGI_SAMPLE_DESC* SampleDesc, - D3D11_USAGE Usage, - unsigned BindFlags, - unsigned CPUAccessFlags, - unsigned MiscFlags, - const D3D11_SUBRESOURCE_DATA *pInitialData, + D3D11_USAGE usage, + unsigned bind_flags, + unsigned c_p_u_access_flags, + unsigned misc_flags, + const D3D11_SUBRESOURCE_DATA *initial_data, DXGI_USAGE dxgi_usage, struct pipe_resource** ppresource ) { - if(invalid(Format >= DXGI_FORMAT_COUNT)) + if(invalid(format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - if(MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE) + if(misc_flags & D3D11_RESOURCE_MISC_TEXTURECUBE) { if(target != PIPE_TEXTURE_2D) return E_INVALIDARG; target = PIPE_TEXTURE_CUBE; - if(ArraySize != 6) + if(array_size != 6) return E_NOTIMPL; } else { - if(ArraySize > 1) + if(array_size > 1) return E_NOTIMPL; - ArraySize = 1; + array_size = 1; } /* TODO: msaa */ struct pipe_resource templat; memset(&templat, 0, sizeof(templat)); templat.target = target; - templat.width0 = Width; - templat.height0 = Height; - templat.depth0 = Depth; - templat.last_level = MipLevels ? (MipLevels - 1) : 0; - templat.format = dxgi_to_pipe_format[Format]; - templat.bind = d3d11_to_pipe_bind_flags(BindFlags); - if(CPUAccessFlags & D3D11_CPU_ACCESS_READ) + templat.width0 = width; + templat.height0 = height; + templat.depth0 = depth; + templat.last_level = mip_levels ? (mip_levels - 1) : 0; + templat.format = dxgi_to_pipe_format[format]; + templat.bind = d3d11_to_pipe_bind_flags(bind_flags); + if(c_p_u_access_flags & D3D11_CPU_ACCESS_READ) templat.bind |= PIPE_BIND_TRANSFER_READ; - if(CPUAccessFlags & D3D11_CPU_ACCESS_WRITE) + if(c_p_u_access_flags & D3D11_CPU_ACCESS_WRITE) templat.bind |= PIPE_BIND_TRANSFER_WRITE; - if(MiscFlags & D3D11_RESOURCE_MISC_SHARED) + if(misc_flags & D3D11_RESOURCE_MISC_SHARED) templat.bind |= PIPE_BIND_SHARED; - if(MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE) + if(misc_flags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE) templat.bind |= PIPE_BIND_TRANSFER_READ | PIPE_BIND_TRANSFER_WRITE; if(dxgi_usage & DXGI_USAGE_BACK_BUFFER) templat.bind |= PIPE_BIND_DISPLAY_TARGET; - templat.usage = d3d11_to_pipe_usage[Usage]; + templat.usage = d3d11_to_pipe_usage[usage]; if(invalid(!templat.format)) return E_NOTIMPL; @@ -698,9 +698,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen struct pipe_resource* resource = screen->resource_create(screen, &templat); if(!resource) return E_FAIL; - if(pInitialData) + if(initial_data) { - for(unsigned slice = 0; slice < ArraySize; ++slice) + for(unsigned slice = 0; slice < array_size; ++slice) { for(unsigned level = 0; level <= templat.last_level; ++level) { @@ -709,11 +709,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen sr.face = slice; struct pipe_box box; box.x = box.y = box.z = 0; - box.width = u_minify(Width, level); - box.height = u_minify(Height, level); - box.depth = u_minify(Depth, level); - immediate_pipe->transfer_inline_write(immediate_pipe, resource, sr, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, pInitialData->pSysMem, pInitialData->SysMemPitch, pInitialData->SysMemSlicePitch); - ++pInitialData; + box.width = u_minify(width, level); + box.height = u_minify(height, level); + box.depth = u_minify(depth, level); + immediate_pipe->transfer_inline_write(immediate_pipe, resource, sr, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, initial_data->pSysMem, initial_data->SysMemPitch, initial_data->SysMemSlicePitch); + ++initial_data; } } } @@ -738,73 +738,73 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( - const D3D11_TEXTURE1D_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture1D **ppTexture1D) + const D3D11_TEXTURE1D_DESC *desc, + const D3D11_SUBRESOURCE_DATA *initial_data, + ID3D11Texture1D **out_texture1d) { SYNCHRONIZED; struct pipe_resource* resource; - DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); - HRESULT hr = create_resource(PIPE_TEXTURE_1D, pDesc->Width, 1, 1, pDesc->MipLevels, pDesc->ArraySize, pDesc->Format, 0, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppTexture1D ? &resource : 0); + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc->BindFlags, desc->MiscFlags); + HRESULT hr = create_resource(PIPE_TEXTURE_1D, desc->Width, 1, 1, desc->MipLevels, desc->ArraySize, desc->Format, 0, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_texture1d ? &resource : 0); if(hr != S_OK) return hr; - *ppTexture1D = new GalliumD3D11Texture1D(this, resource, *pDesc, dxgi_usage); + *out_texture1d = new GalliumD3D11Texture1D(this, resource, *desc, dxgi_usage); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( - const D3D11_TEXTURE2D_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture2D **ppTexture2D) + const D3D11_TEXTURE2D_DESC *desc, + const D3D11_SUBRESOURCE_DATA *initial_data, + ID3D11Texture2D **out_texture2d) { SYNCHRONIZED; struct pipe_resource* resource; - DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); - HRESULT hr = create_resource(PIPE_TEXTURE_2D, pDesc->Width, pDesc->Height, 1, pDesc->MipLevels, pDesc->ArraySize, pDesc->Format, &pDesc->SampleDesc, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppTexture2D ? &resource : 0); + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc->BindFlags, desc->MiscFlags); + HRESULT hr = create_resource(PIPE_TEXTURE_2D, desc->Width, desc->Height, 1, desc->MipLevels, desc->ArraySize, desc->Format, &desc->SampleDesc, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_texture2d ? &resource : 0); if(hr != S_OK) return hr; - if(pDesc->MipLevels == 1 && pDesc->ArraySize == 1) - *ppTexture2D = new GalliumD3D11Surface(this, resource, *pDesc, dxgi_usage); + if(desc->MipLevels == 1 && desc->ArraySize == 1) + *out_texture2d = new GalliumD3D11Surface(this, resource, *desc, dxgi_usage); else - *ppTexture2D = new GalliumD3D11Texture2D(this, resource, *pDesc, dxgi_usage); + *out_texture2d = new GalliumD3D11Texture2D(this, resource, *desc, dxgi_usage); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( - const D3D11_TEXTURE3D_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture3D **ppTexture3D) + const D3D11_TEXTURE3D_DESC *desc, + const D3D11_SUBRESOURCE_DATA *initial_data, + ID3D11Texture3D **out_texture3d) { SYNCHRONIZED; struct pipe_resource* resource; - DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); - HRESULT hr = create_resource(PIPE_TEXTURE_3D, pDesc->Width, pDesc->Height, pDesc->Depth, pDesc->MipLevels, 1, pDesc->Format, 0, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppTexture3D ? &resource : 0); + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc->BindFlags, desc->MiscFlags); + HRESULT hr = create_resource(PIPE_TEXTURE_3D, desc->Width, desc->Height, desc->Depth, desc->MipLevels, 1, desc->Format, 0, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_texture3d ? &resource : 0); if(hr != S_OK) return hr; - *ppTexture3D = new GalliumD3D11Texture3D(this, resource, *pDesc, dxgi_usage); + *out_texture3d = new GalliumD3D11Texture3D(this, resource, *desc, dxgi_usage); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateBuffer( - const D3D11_BUFFER_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Buffer **ppBuffer) + const D3D11_BUFFER_DESC *desc, + const D3D11_SUBRESOURCE_DATA *initial_data, + ID3D11Buffer **out_buffer) { SYNCHRONIZED; #if API >= 11 - if(pDesc->StructureByteStride > 1) + if(desc->StructureByteStride > 1) return E_NOTIMPL; #endif struct pipe_resource* resource; - DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(pDesc->BindFlags, pDesc->MiscFlags); - HRESULT hr = create_resource(PIPE_BUFFER, pDesc->ByteWidth, 1, 1, 1, 1, DXGI_FORMAT_R8_UNORM, 0, pDesc->Usage, pDesc->BindFlags, pDesc->CPUAccessFlags, pDesc->MiscFlags, pInitialData, dxgi_usage, ppBuffer ? &resource : 0); + DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc->BindFlags, desc->MiscFlags); + HRESULT hr = create_resource(PIPE_BUFFER, desc->ByteWidth, 1, 1, 1, 1, DXGI_FORMAT_R8_UNORM, 0, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_buffer ? &resource : 0); if(hr != S_OK) return hr; - *ppBuffer = new GalliumD3D11Buffer(this, resource, *pDesc, dxgi_usage); + *out_buffer = new GalliumD3D11Buffer(this, resource, *desc, dxgi_usage); return S_OK; } @@ -845,11 +845,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen } virtual HRESULT STDMETHODCALLTYPE CreateSurface( - const DXGI_SURFACE_DESC *pDesc, - unsigned NumSurfaces, - DXGI_USAGE Usage, - const DXGI_SHARED_RESOURCE *pSharedResource, - IDXGISurface **ppSurface) + const DXGI_SURFACE_DESC *dxgi_desc, + unsigned count, + DXGI_USAGE usage, + const DXGI_SHARED_RESOURCE *shared_resource, + IDXGISurface **out_surface) { SYNCHRONIZED; @@ -857,58 +857,58 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen memset(&desc, 0, sizeof(desc)); struct pipe_resource* resource; - desc.Width = pDesc->Width; - desc.Height = pDesc->Height; - desc.Format = pDesc->Format; - desc.SampleDesc = pDesc->SampleDesc; - desc.ArraySize = NumSurfaces; + desc.Width = dxgi_desc->Width; + desc.Height = dxgi_desc->Height; + desc.Format = dxgi_desc->Format; + desc.SampleDesc = dxgi_desc->SampleDesc; + desc.ArraySize = count; desc.MipLevels = 1; desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; - if(Usage & DXGI_USAGE_RENDER_TARGET_OUTPUT) + if(usage & DXGI_USAGE_RENDER_TARGET_OUTPUT) desc.BindFlags |= D3D11_BIND_RENDER_TARGET; - if(Usage & DXGI_USAGE_SHADER_INPUT) + if(usage & DXGI_USAGE_SHADER_INPUT) desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; #if API >= 11 - if(Usage & DXGI_USAGE_UNORDERED_ACCESS) + if(usage & DXGI_USAGE_UNORDERED_ACCESS) desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS; #endif - if(Usage & DXGI_USAGE_SHARED) + if(usage & DXGI_USAGE_SHARED) desc.MiscFlags |= D3D11_RESOURCE_MISC_SHARED; - HRESULT hr = create_resource(PIPE_TEXTURE_2D, pDesc->Width, pDesc->Height, 1, 1, NumSurfaces, pDesc->Format, &pDesc->SampleDesc, D3D11_USAGE_DEFAULT, desc.BindFlags, D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE, desc.MiscFlags, 0, Usage, &resource); + HRESULT hr = create_resource(PIPE_TEXTURE_2D, dxgi_desc->Width, dxgi_desc->Height, 1, 1, count, dxgi_desc->Format, &dxgi_desc->SampleDesc, D3D11_USAGE_DEFAULT, desc.BindFlags, D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE, desc.MiscFlags, 0, usage, &resource); if(hr != S_OK) return hr; - *ppSurface = new GalliumD3D11Surface(this, resource, desc, Usage); + *out_surface = new GalliumD3D11Surface(this, resource, desc, usage); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( - ID3D11Resource *pResource, - const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, - ID3D11ShaderResourceView **ppSRView) + ID3D11Resource *iresource, + const D3D11_SHADER_RESOURCE_VIEW_DESC *desc, + ID3D11ShaderResourceView **out_srv) { #if API >= 11 D3D11_SHADER_RESOURCE_VIEW_DESC def_desc; #else - if(pDesc->ViewDimension == D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY) + if(desc->ViewDimension == D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY) return E_INVALIDARG; D3D10_SHADER_RESOURCE_VIEW_DESC1 desc1; memset(&desc1, 0, sizeof(desc1)); - memcpy(&desc1, pDesc, sizeof(*pDesc)); - return CreateShaderResourceView1(pResource, &desc1, (ID3D10ShaderResourceView1**)ppSRView); + memcpy(&desc1, desc, sizeof(*desc)); + return CreateShaderResourceView1(iresource, &desc1, (ID3D10ShaderResourceView1**)out_srv); } virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( - ID3D11Resource *pResource, - const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, - ID3D10ShaderResourceView1 **ppSRView) + ID3D11Resource *iresource, + const D3D10_SHADER_RESOURCE_VIEW_DESC1 *desc, + ID3D10ShaderResourceView1 **out_srv) { D3D10_SHADER_RESOURCE_VIEW_DESC1 def_desc; #endif SYNCHRONIZED; - if(!pDesc) + if(!desc) { - struct pipe_resource* resource = ((GalliumD3D11Resource<>*)pResource)->resource; + struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; init_pipe_to_dxgi_format(); memset(&def_desc, 0, sizeof(def_desc)); def_desc.Format = pipe_to_dxgi_format[resource->format]; @@ -916,10 +916,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen { case PIPE_BUFFER: def_desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; - def_desc.Buffer.ElementWidth = 1; -#if API >= 11 - def_desc.Buffer.NumElements = resource->width0; -#endif + def_desc.Buffer.ElementWidth = resource->width0; break; case PIPE_TEXTURE_1D: def_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D; @@ -941,14 +938,14 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen default: return E_INVALIDARG; } - pDesc = &def_desc; + desc = &def_desc; } struct pipe_sampler_view templat; memset(&templat, 0, sizeof(templat)); - if(invalid(Format >= DXGI_FORMAT_COUNT)) + if(invalid(format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - templat.format = dxgi_to_pipe_format[pDesc->Format]; + templat.format = dxgi_to_pipe_format[desc->Format]; if(!templat.format) return E_NOTIMPL; templat.swizzle_r = PIPE_SWIZZLE_RED; @@ -956,8 +953,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen templat.swizzle_b = PIPE_SWIZZLE_BLUE; templat.swizzle_a = PIPE_SWIZZLE_ALPHA; - templat.texture = ((GalliumD3D11Resource<>*)pResource)->resource; - switch(pDesc->ViewDimension) + templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource; + switch(desc->ViewDimension) { case D3D11_SRV_DIMENSION_TEXTURE1D: case D3D11_SRV_DIMENSION_TEXTURE2D: @@ -965,8 +962,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen case D3D11_SRV_DIMENSION_TEXTURE1DARRAY: case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: /* yes, this works for all of these types (but TODO: texture arrays) */ - templat.first_level = pDesc->Texture1D.MostDetailedMip; - templat.last_level = templat.first_level + pDesc->Texture1D.MipLevels - 1; + templat.first_level = desc->Texture1D.MostDetailedMip; + templat.last_level = templat.first_level + desc->Texture1D.MipLevels - 1; break; case D3D11_SRV_DIMENSION_BUFFER: case D3D11_SRV_DIMENSION_TEXTURE2DMS: @@ -976,41 +973,41 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen return E_INVALIDARG; } - if(!ppSRView) + if(!out_srv) return S_FALSE; struct pipe_sampler_view* view = immediate_pipe->create_sampler_view(immediate_pipe, templat.texture, &templat); if(!view) return E_FAIL; - *ppSRView = new GalliumD3D11ShaderResourceView(this, (GalliumD3D11Resource<>*)pResource, view, *pDesc); + *out_srv = new GalliumD3D11ShaderResourceView(this, (GalliumD3D11Resource<>*)iresource, view, *desc); return S_OK; } #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView( - ID3D11Resource *pResource, - const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, - ID3D11UnorderedAccessView **ppUAView) + ID3D11Resource *resource, + const D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, + ID3D11UnorderedAccessView **out_uav) { SYNCHRONIZED; return E_NOTIMPL; - // remember to return S_FALSE and not crash if ppUAView == 0 and parameters are valid + // remember to return S_FALSE and not crash if out_u_a_view == 0 and parameters are valid } #endif virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( - ID3D11Resource *pResource, - const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, - ID3D11RenderTargetView **ppRTView) + ID3D11Resource *iresource, + const D3D11_RENDER_TARGET_VIEW_DESC *desc, + ID3D11RenderTargetView **out_rtv) { SYNCHRONIZED; D3D11_RENDER_TARGET_VIEW_DESC def_desc; - if(!pDesc) + if(!desc) { - struct pipe_resource* resource = ((GalliumD3D11Resource<>*)pResource)->resource; + struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; init_pipe_to_dxgi_format(); memset(&def_desc, 0, sizeof(def_desc)); def_desc.Format = pipe_to_dxgi_format[resource->format]; @@ -1018,10 +1015,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen { case PIPE_BUFFER: def_desc.ViewDimension = D3D11_RTV_DIMENSION_BUFFER; - def_desc.Buffer.ElementWidth = 1; -#if API >= 11 - def_desc.Buffer.NumElements = resource->width0; -#endif + def_desc.Buffer.ElementWidth = resource->width0; break; case PIPE_TEXTURE_1D: def_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1D; @@ -1041,33 +1035,33 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen default: return E_INVALIDARG; } - pDesc = &def_desc; + desc = &def_desc; } unsigned zslice = 0; unsigned face = 0; unsigned level; enum pipe_format format; - if(invalid(pDesc->Format >= DXGI_FORMAT_COUNT)) + if(invalid(desc->format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - format = dxgi_to_pipe_format[pDesc->Format]; + format = dxgi_to_pipe_format[desc->Format]; if(!format) return E_NOTIMPL; - switch(pDesc->ViewDimension) + switch(desc->ViewDimension) { case D3D11_RTV_DIMENSION_TEXTURE1D: case D3D11_RTV_DIMENSION_TEXTURE2D: - level = pDesc->Texture1D.MipSlice; + level = desc->Texture1D.MipSlice; break; case D3D11_RTV_DIMENSION_TEXTURE3D: - level = pDesc->Texture3D.MipSlice; - zslice = pDesc->Texture3D.FirstWSlice; + level = desc->Texture3D.MipSlice; + zslice = desc->Texture3D.FirstWSlice; break; case D3D11_RTV_DIMENSION_TEXTURE1DARRAY: case D3D11_RTV_DIMENSION_TEXTURE2DARRAY: - level = pDesc->Texture1DArray.MipSlice; - face = pDesc->Texture1DArray.FirstArraySlice; + level = desc->Texture1DArray.MipSlice; + face = desc->Texture1DArray.FirstArraySlice; break; case D3D11_RTV_DIMENSION_BUFFER: case D3D11_RTV_DIMENSION_TEXTURE2DMS: @@ -1077,31 +1071,31 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen return E_INVALIDARG; } - if(!ppRTView) + if(!out_rtv) return S_FALSE; struct pipe_surface* surface = screen->get_tex_surface(screen, - ((GalliumD3D11Resource<>*)pResource)->resource, + ((GalliumD3D11Resource<>*)iresource)->resource, face, level, zslice, PIPE_BIND_RENDER_TARGET); if(!surface) return E_FAIL; /* muhahahahaha, let's hope this actually works */ surface->format = format; - *ppRTView = new GalliumD3D11RenderTargetView(this, (GalliumD3D11Resource<>*)pResource, surface, *pDesc); + *out_rtv = new GalliumD3D11RenderTargetView(this, (GalliumD3D11Resource<>*)iresource, surface, *desc); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( - ID3D11Resource *pResource, - const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, - ID3D11DepthStencilView **ppDepthStencilView) + ID3D11Resource *iresource, + const D3D11_DEPTH_STENCIL_VIEW_DESC *desc, + ID3D11DepthStencilView **out_depth_stencil_view) { SYNCHRONIZED; D3D11_DEPTH_STENCIL_VIEW_DESC def_desc; - if(!pDesc) + if(!desc) { - struct pipe_resource* resource = ((GalliumD3D11Resource<>*)pResource)->resource; + struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; init_pipe_to_dxgi_format(); memset(&def_desc, 0, sizeof(def_desc)); def_desc.Format = pipe_to_dxgi_format[resource->format]; @@ -1121,29 +1115,29 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen default: return E_INVALIDARG; } - pDesc = &def_desc; + desc = &def_desc; } unsigned zslice = 0; unsigned face = 0; unsigned level; enum pipe_format format; - if(invalid(pDesc->Format >= DXGI_FORMAT_COUNT)) + if(invalid(desc->format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - format = dxgi_to_pipe_format[pDesc->Format]; + format = dxgi_to_pipe_format[desc->Format]; if(!format) return E_NOTIMPL; - switch(pDesc->ViewDimension) + switch(desc->ViewDimension) { case D3D11_DSV_DIMENSION_TEXTURE1D: case D3D11_DSV_DIMENSION_TEXTURE2D: - level = pDesc->Texture1D.MipSlice; + level = desc->Texture1D.MipSlice; break; case D3D11_DSV_DIMENSION_TEXTURE1DARRAY: case D3D11_DSV_DIMENSION_TEXTURE2DARRAY: - level = pDesc->Texture1DArray.MipSlice; - face = pDesc->Texture1DArray.FirstArraySlice; + level = desc->Texture1DArray.MipSlice; + face = desc->Texture1DArray.FirstArraySlice; break; case D3D11_DSV_DIMENSION_TEXTURE2DMS: case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY: @@ -1152,27 +1146,27 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen return E_INVALIDARG; } - if(!ppDepthStencilView) + if(!out_depth_stencil_view) return S_FALSE; struct pipe_surface* surface = screen->get_tex_surface(screen, - ((GalliumD3D11Resource<>*)pResource)->resource, + ((GalliumD3D11Resource<>*)iresource)->resource, face, level, zslice, PIPE_BIND_DEPTH_STENCIL); if(!surface) return E_FAIL; /* muhahahahaha, let's hope this actually works */ surface->format = format; - *ppDepthStencilView = new GalliumD3D11DepthStencilView(this, (GalliumD3D11Resource<>*)pResource, surface, *pDesc); + *out_depth_stencil_view = new GalliumD3D11DepthStencilView(this, (GalliumD3D11Resource<>*)iresource, surface, *desc); return S_OK; } - GalliumD3D11Shader<>* create_stage_shader(unsigned type, const void *pShaderBytecode, SIZE_T BytecodeLength + GalliumD3D11Shader<>* create_stage_shader(unsigned type, const void* shader_bytecode, SIZE_T bytecode_length #if API >= 11 - , ID3D11ClassLinkage *pClassLinkage + , ID3D11ClassLinkage *class_linkage #endif ) { - dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(pShaderBytecode, BytecodeLength); + dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(shader_bytecode, bytecode_length); if(!sm4_chunk) return 0; @@ -1221,29 +1215,29 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 #define CREATE_SHADER_ARGS \ - const void *pShaderBytecode, \ - SIZE_T BytecodeLength, \ - ID3D11ClassLinkage *pClassLinkage -#define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength, pClassLinkage + const void *shader_bytecode, \ + SIZE_T bytecode_length, \ + ID3D11ClassLinkage *class_linkage +#define PASS_SHADER_ARGS shader_bytecode, bytecode_length, class_linkage #else #define CREATE_SHADER_ARGS \ - const void *pShaderBytecode, \ - SIZE_T BytecodeLength -#define PASS_SHADER_ARGS pShaderBytecode, BytecodeLength + const void *shader_bytecode, \ + SIZE_T bytecode_length +#define PASS_SHADER_ARGS shader_bytecode, bytecode_length #endif #define IMPLEMENT_CREATE_SHADER(Stage, GALLIUM) \ virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ CREATE_SHADER_ARGS, \ - ID3D11##Stage##Shader **pp##Stage##Shader) \ + ID3D11##Stage##Shader **out_shader) \ { \ SYNCHRONIZED; \ GalliumD3D11##Stage##Shader* shader = (GalliumD3D11##Stage##Shader*)create_stage_shader(PIPE_SHADER_##GALLIUM, PASS_SHADER_ARGS); \ if(!shader) \ return E_FAIL; \ - if(pp##Stage##Shader) \ + if(out_shader) \ { \ - *pp##Stage##Shader = shader; \ + *out_shader = shader; \ return S_OK; \ } \ else \ @@ -1256,7 +1250,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #define IMPLEMENT_NOTIMPL_CREATE_SHADER(Stage) \ virtual HRESULT STDMETHODCALLTYPE Create##Stage##Shader( \ CREATE_SHADER_ARGS, \ - ID3D11##Stage##Shader **pp##Stage##Shader) \ + ID3D11##Stage##Shader **out_shader) \ { \ return E_NOTIMPL; \ } @@ -1271,25 +1265,22 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( - const void *pShaderBytecode, - SIZE_T BytecodeLength, - const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, - unsigned NumEntries, + const void *shader_bytecode, + SIZE_T bytecode_length, + const D3D11_SO_DECLARATION_ENTRY *so_declaration, + unsigned num_entries, #if API >= 11 - const unsigned *pBufferStrides, - unsigned NumStrides, - unsigned RasterizedStream, - ID3D11ClassLinkage *pClassLinkage, + const unsigned *buffer_strides, + unsigned num_strides, + unsigned rasterized_stream, + ID3D11ClassLinkage *class_linkage, #else - UINT OutputStreamStride, + UINT output_stream_stride, #endif - ID3D11GeometryShader **ppGeometryShader) + ID3D11GeometryShader **out_geometry_shader) { SYNCHRONIZED; - if(!ppGeometryShader) - return S_FALSE; - return E_NOTIMPL; // remember to return S_FALSE if ppGeometyShader == NULL and the shader is OK @@ -1297,48 +1288,45 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateClassLinkage( - ID3D11ClassLinkage **ppLinkage) + ID3D11ClassLinkage **out_linkage) { SYNCHRONIZED; - if(!ppLinkage) - return S_FALSE; - return E_NOTIMPL; } #endif virtual HRESULT STDMETHODCALLTYPE CreateQuery( - const D3D11_QUERY_DESC *pQueryDesc, - ID3D11Query **ppQuery) + const D3D11_QUERY_DESC *query_desc, + ID3D11Query **out_query) { SYNCHRONIZED; - if(invalid(pQueryDesc->Query >= D3D11_QUERY_COUNT)) + if(invalid(query_desc->Query >= D3D11_QUERY_COUNT)) return E_INVALIDARG; - unsigned query_type = d3d11_to_pipe_query[pQueryDesc->Query]; + unsigned query_type = d3d11_to_pipe_query[query_desc->Query]; if(!query_type) return E_NOTIMPL; - if(ppQuery) + if(out_query) return S_FALSE; struct pipe_query* query = immediate_pipe->create_query(immediate_pipe, query_type); if(!query) return E_FAIL; - *ppQuery = new GalliumD3D11Query(this, query, d3d11_query_size[pQueryDesc->Query], *pQueryDesc); + *out_query = new GalliumD3D11Query(this, query, d3d11_query_size[query_desc->Query], *query_desc); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreatePredicate( - const D3D11_QUERY_DESC *pPredicateDesc, - ID3D11Predicate **ppPredicate) + const D3D11_QUERY_DESC *predicate_desc, + ID3D11Predicate **out_predicate) { SYNCHRONIZED; unsigned query_type; - switch(pPredicateDesc->Query) + switch(predicate_desc->Query) { case D3D11_QUERY_SO_OVERFLOW_PREDICATE: return E_NOTIMPL; @@ -1349,59 +1337,59 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen return E_INVALIDARG; } - if(ppPredicate) + if(out_predicate) return S_FALSE; struct pipe_query* query = immediate_pipe->create_query(immediate_pipe, query_type); if(!query) return E_FAIL; - *ppPredicate = new GalliumD3D11Predicate(this, query, sizeof(BOOL), *pPredicateDesc); + *out_predicate = new GalliumD3D11Predicate(this, query, sizeof(BOOL), *predicate_desc); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateCounter( - const D3D11_COUNTER_DESC *pCounterDesc, - ID3D11Counter **ppCounter) + const D3D11_COUNTER_DESC *counter_desc, + ID3D11Counter **out_counter) { SYNCHRONIZED; return E_NOTIMPL; - // remember to return S_FALSE if ppCounter == NULL and everything is OK + // remember to return S_FALSE if out_counter == NULL and everything is OK } #if API >= 11 virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext( - unsigned ContextFlags, - ID3D11DeviceContext **ppDeferredContext) + unsigned context_flags, + ID3D11DeviceContext **out_deferred_context) { SYNCHRONIZED; // TODO: this will have to be implemented using a new Gallium util module return E_NOTIMPL; - // remember to return S_FALSE if ppCounter == NULL and everything is OK + // remember to return S_FALSE if out_counter == NULL and everything is OK } #endif virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( - HANDLE hResource, - REFIID ReturnedInterface, - void **ppResource) + HANDLE resource, + REFIID iid, + void **out_resource) { SYNCHRONIZED; // TODO: the problem here is that we need to communicate dimensions somehow return E_NOTIMPL; - // remember to return S_FALSE if ppCounter == NULL and everything is OK + // remember to return S_FALSE if out_counter == NULL and everything is OK #if 0 struct pipe_resou rce templat; struct winsys_handle handle; handle.stride = 0; - handle.handle = hResource; + handle.handle = resource; handle.type = DRM_API_HANDLE_TYPE_SHARED; screen->resource_from_handle(screen, &templat, &handle); #endif @@ -1410,18 +1398,18 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API < 11 /* these are documented as "Not implemented". * According to the UMDDI documentation, they apparently turn on a - * (Width + 1) x (Height + 1) convolution filter for 1-bit textures. + * (width + 1) x (height + 1) convolution filter for 1-bit textures. * Probably nothing uses these, assuming it has ever been implemented anywhere. */ void STDMETHODCALLTYPE SetTextFilterSize( - UINT Width, - UINT Height + UINT width, + UINT height ) {} virtual void STDMETHODCALLTYPE GetTextFilterSize( - UINT *Width, - UINT *Height + UINT *width, + UINT *height ) {} #endif -- cgit v1.2.3 From 9cd0e624b460bc361287f7d39bfe9aa61d90a457 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 15:22:54 +0200 Subject: d3d1x: rename params in misc and objects --- .../state_trackers/d3d1x/gd3d11/d3d11_misc.h | 50 +++--- .../state_trackers/d3d1x/gd3d11/d3d11_objects.h | 182 +++++++++++---------- 2 files changed, 117 insertions(+), 115 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index 9ad293b7fc7..357f51bcb9b 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h @@ -1,37 +1,37 @@ #if API < 11 extern "C" HRESULT STDMETHODCALLTYPE D3D10CreateBlob( - SIZE_T NumBytes, - LPD3D10BLOB *ppBuffer + SIZE_T num_bytes, + LPD3D10BLOB *out_buffer ); HRESULT STDMETHODCALLTYPE D3D10CreateBlob( - SIZE_T NumBytes, - LPD3D10BLOB *ppBuffer + SIZE_T num_bytes, + LPD3D10BLOB *out_buffer ) { - void* data = malloc(NumBytes); + void* data = malloc(num_bytes); if(!data) return E_OUTOFMEMORY; - *ppBuffer = new GalliumD3DBlob(data, NumBytes); + *out_buffer = new GalliumD3DBlob(data, num_bytes); return S_OK; } LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile( - ID3D10Device *pDevice + ID3D10Device *device ) { return "ps_4_0"; } LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile( - ID3D10Device *pDevice + ID3D10Device *device ) { return "vs_4_0"; } LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile( - ID3D10Device *pDevice + ID3D10Device *device ) { return "gs_4_0"; @@ -47,46 +47,46 @@ static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, unsigned } HRESULT D3D10GetInputSignatureBlob( - const void *pShaderBytecode, - SIZE_T BytecodeLength, - ID3D10Blob **ppSignatureBlob + const void *shader_bytecode, + SIZE_T bytecode_length, + ID3D10Blob **signature_blob ) { - dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, false); + dxbc_chunk_signature* sig = dxbc_find_signature(shader_bytecode, bytecode_length, false); if(!sig) return E_FAIL; - return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); + return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, signature_blob); } HRESULT D3D10GetOutputSignatureBlob( - const void *pShaderBytecode, - SIZE_T BytecodeLength, - ID3D10Blob **ppSignatureBlob + const void *shader_bytecode, + SIZE_T bytecode_length, + ID3D10Blob **signature_blob ) { - dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, BytecodeLength, true); + dxbc_chunk_signature* sig = dxbc_find_signature(shader_bytecode, bytecode_length, true); if(!sig) return E_FAIL; - return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, ppSignatureBlob); + return dxbc_assemble_as_blob((dxbc_chunk_header**)&sig, 1, signature_blob); } HRESULT D3D10GetInputAndOutputSignatureBlob( - const void *pShaderBytecode, - SIZE_T BytecodeLength, - ID3D10Blob **ppSignatureBlob + const void *shader_bytecode, + SIZE_T bytecode_length, + ID3D10Blob **signature_blob ) { dxbc_chunk_signature* sigs[2]; - sigs[0] = dxbc_find_signature(pShaderBytecode, BytecodeLength, false); + sigs[0] = dxbc_find_signature(shader_bytecode, bytecode_length, false); if(!sigs[0]) return E_FAIL; - sigs[1] = dxbc_find_signature(pShaderBytecode, BytecodeLength, true); + sigs[1] = dxbc_find_signature(shader_bytecode, bytecode_length, true); if(!sigs[1]) return E_FAIL; - return dxbc_assemble_as_blob((dxbc_chunk_header**)&sigs, 2, ppSignatureBlob); + return dxbc_assemble_as_blob((dxbc_chunk_header**)&sigs, 2, signature_blob); } #endif diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h index 1a559494dc6..836603eccc3 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h @@ -71,11 +71,11 @@ struct GalliumD3D11DeviceChild : public GalliumPrivateDataComObjectAddRef(); - *ppDevice = device; + *out_device = device; } }; @@ -137,9 +137,9 @@ struct GalliumD3D11DescribedObject : public GalliumD3D11Object : GalliumD3D11Object(device, object), desc(desc) {} - virtual void STDMETHODCALLTYPE GetDesc(Desc *pDesc) + virtual void STDMETHODCALLTYPE GetDesc(Desc *out_desc) { - memcpy(pDesc, &desc, sizeof(desc)); + memcpy(out_desc, &desc, sizeof(desc)); } }; @@ -197,9 +197,9 @@ struct GalliumD3D10BlendState : public GalliumD3D10BlendStateBase : GalliumD3D10BlendStateBase(device, object, convert_to_d3d10(desc)), desc1(desc1) {} - virtual void STDMETHODCALLTYPE GetDesc1(D3D10_BLEND_DESC1 *pDesc) + virtual void STDMETHODCALLTYPE GetDesc1(D3D10_BLEND_DESC1 *out_desc) { - memcpy(pDesc, &desc1, sizeof(desc1)); + memcpy(out_desc, &desc1, sizeof(desc1)); } }; #endif @@ -242,9 +242,10 @@ struct GalliumD3D11ResourceBase : public GalliumD3D11DeviceChild unsigned eviction_priority; virtual void STDMETHODCALLTYPE SetEvictionPriority( - unsigned EvictionPriority) + unsigned new_eviction_priority + ) { - eviction_priority = EvictionPriority; + eviction_priority = new_eviction_priority; } virtual unsigned STDMETHODCALLTYPE GetEvictionPriority() @@ -257,34 +258,35 @@ template struct GalliumDXGIResource : public IDXGIResource { virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( - unsigned EvictionPriority) + unsigned new_eviction_priority + ) { - static_cast(this)->eviction_priority = EvictionPriority; + static_cast(this)->eviction_priority = new_eviction_priority; return S_OK; } - virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority(unsigned* pEvictionPriority) + virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority(unsigned* out_eviction_priority) { - *pEvictionPriority = static_cast(this)->eviction_priority; - return S_OK; + *out_eviction_priority = static_cast(this)->eviction_priority; + return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetDevice( REFIID riid, - void **ppParent) + void **out_parent) { if(!static_cast(this)->device) return E_NOINTERFACE; - return static_cast(this)->device->QueryInterface(riid, ppParent); + return static_cast(this)->device->QueryInterface(riid, out_parent); } virtual HRESULT STDMETHODCALLTYPE GetParent( REFIID riid, - void **ppParent) + void **out_parent) { if(!static_cast(this)->device) return E_NOINTERFACE; - return static_cast(this)->device->QueryInterface(riid, ppParent); + return static_cast(this)->device->QueryInterface(riid, out_parent); } }; @@ -322,14 +324,14 @@ struct GalliumD3D11Resource } virtual HRESULT STDMETHODCALLTYPE GetUsage( - DXGI_USAGE *pUsage + DXGI_USAGE *out_usage ) { - *pUsage = this->dxgi_usage; + *out_usage = this->dxgi_usage; return S_OK; } - virtual HRESULT STDMETHODCALLTYPE GetSharedHandle(HANDLE *pSharedHandle) + virtual HRESULT STDMETHODCALLTYPE GetSharedHandle(HANDLE *out_shared_handle) { return E_NOTIMPL; } @@ -349,13 +351,13 @@ struct GalliumD3D11TypedResource : public GalliumD3D11Resource : GalliumD3D11Resource(device, resource, dxgi_usage), desc(desc) {} virtual void STDMETHODCALLTYPE GetType( - D3D11_RESOURCE_DIMENSION *pResourceDimension) + D3D11_RESOURCE_DIMENSION *out_resource_dimension) { - *pResourceDimension = Dim; + *out_resource_dimension = Dim; } - virtual void STDMETHODCALLTYPE GetDesc(Desc *pDesc) + virtual void STDMETHODCALLTYPE GetDesc(Desc *out_desc) { - memcpy(pDesc, &desc, sizeof(desc)); + memcpy(out_desc, &desc, sizeof(desc)); } }; @@ -382,15 +384,15 @@ struct GalliumD3D10Buffer : public GalliumD3D10BufferBase } virtual HRESULT STDMETHODCALLTYPE Map( - D3D10_MAP MapType, - unsigned MapFlags, - void **ppData) + D3D10_MAP map_type, + unsigned map_flags, + void **out_data) { D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, 0, MapType, MapFlags, &msr); + HRESULT hr = device->Map(this, 0, map_type, map_flags, &msr); if(!SUCCEEDED(hr)) return hr; - *ppData = msr.pData; + *out_data = msr.pData; return S_OK; } @@ -407,24 +409,24 @@ struct GalliumD3D10Texture1D : public GalliumD3D10Texture1DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - unsigned Subresource, - D3D10_MAP MapType, - unsigned MapFlags, - void **ppData) + unsigned subresource, + D3D10_MAP map_type, + unsigned map_flags, + void **out_data) { D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + HRESULT hr = device->Map(this, subresource, map_type, map_flags, &msr); if(!SUCCEEDED(hr)) return hr; - *ppData = msr.pData; + *out_data = msr.pData; return S_OK; } virtual void STDMETHODCALLTYPE Unmap( - unsigned Subresource + unsigned subresource ) { - device->Unmap(this, Subresource); + device->Unmap(this, subresource); } }; @@ -436,25 +438,25 @@ struct GalliumD3D10Texture2D : public GalliumD3D10Texture2DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - unsigned Subresource, - D3D10_MAP MapType, - unsigned MapFlags, - D3D10_MAPPED_TEXTURE2D *pMappedTex2D) + unsigned subresource, + D3D10_MAP map_type, + unsigned map_flags, + D3D10_MAPPED_TEXTURE2D *out_mapped_subresource) { D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + HRESULT hr = device->Map(this, subresource, map_type, map_flags, &msr); if(!SUCCEEDED(hr)) return hr; - pMappedTex2D->pData = msr.pData; - pMappedTex2D->RowPitch = msr.RowPitch; + out_mapped_subresource->pData = msr.pData; + out_mapped_subresource->RowPitch = msr.RowPitch; return S_OK; } virtual void STDMETHODCALLTYPE Unmap( - unsigned Subresource + unsigned subresource ) { - device->Unmap(this, Subresource); + device->Unmap(this, subresource); } }; @@ -466,26 +468,26 @@ struct GalliumD3D10Texture3D : public GalliumD3D10Texture3DBase {} virtual HRESULT STDMETHODCALLTYPE Map( - unsigned Subresource, - D3D10_MAP MapType, - unsigned MapFlags, - D3D10_MAPPED_TEXTURE3D *pMappedTex3D) + unsigned subresource, + D3D10_MAP map_type, + unsigned map_flags, + D3D10_MAPPED_TEXTURE3D *out_mapped_subresource) { D3D10_MAPPED_SUBRESOURCE msr; - HRESULT hr = device->Map(this, Subresource, MapType, MapFlags, &msr); + HRESULT hr = device->Map(this, subresource, map_type, map_flags, &msr); if(!SUCCEEDED(hr)) return hr; - pMappedTex3D->pData = msr.pData; - pMappedTex3D->RowPitch = msr.RowPitch; - pMappedTex3D->DepthPitch = msr.DepthPitch; + out_mapped_subresource->pData = msr.pData; + out_mapped_subresource->RowPitch = msr.RowPitch; + out_mapped_subresource->DepthPitch = msr.DepthPitch; return S_OK; } virtual void STDMETHODCALLTYPE Unmap( - unsigned Subresource + unsigned subresource ) { - device->Unmap(this, Subresource); + device->Unmap(this, subresource); } }; #endif @@ -502,51 +504,51 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObjectFormat = this->desc.Format; - pDesc->Width = this->desc.Width; - pDesc->Height = this->desc.Height; - pDesc->SampleDesc = this->desc.SampleDesc; + out_desc->Format = this->desc.Format; + out_desc->Width = this->desc.Width; + out_desc->Height = this->desc.Height; + out_desc->SampleDesc = this->desc.SampleDesc; return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetParent( REFIID riid, - void **ppParent) + void **out_parent) { if(!device) return E_NOINTERFACE; - return device->QueryInterface(riid, ppParent); + return device->QueryInterface(riid, out_parent); } /* TODO: somehow implement these */ virtual HRESULT STDMETHODCALLTYPE GetDC( - BOOL Discard, - HDC *phdc) + BOOL discard, + HDC *out_hdc) { - *phdc = 0; + *out_hdc = 0; return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE ReleaseDC( - RECT *pDirtyRect) + RECT *out_dirty_rect) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE Map( - DXGI_MAPPED_RECT *pLockedRect, - unsigned MapFlags) + DXGI_MAPPED_RECT *out_locked_rect, + unsigned map_flags) { D3D11_MAP d3d_map; - if(MapFlags & DXGI_MAP_DISCARD) + if(map_flags & DXGI_MAP_DISCARD) d3d_map = D3D11_MAP_WRITE_DISCARD; else { - if(MapFlags & DXGI_MAP_READ) + if(map_flags & DXGI_MAP_READ) { - if(MapFlags & DXGI_MAP_WRITE) + if(map_flags & DXGI_MAP_WRITE) d3d_map = D3D11_MAP_READ_WRITE; else d3d_map = D3D11_MAP_READ; @@ -556,8 +558,8 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObjectdevice->get_immediate_context()->Map(this, 0, d3d_map, 0, &d3d_mapped); - pLockedRect->pBits = (uint8_t*)d3d_mapped.pData; - pLockedRect->Pitch = d3d_mapped.RowPitch; + out_locked_rect->pBits = (uint8_t*)d3d_mapped.pData; + out_locked_rect->Pitch = d3d_mapped.RowPitch; return hres; } @@ -569,11 +571,11 @@ struct GalliumD3D11Surface : public GalliumMultiPrivateDataComObjectQueryInterface(riid, ppParent); + return device->QueryInterface(riid, out_parent); } }; @@ -592,10 +594,10 @@ struct GalliumD3D11View : public GalliumD3D11DescribedObject resource->Release(); } - virtual void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) + virtual void STDMETHODCALLTYPE GetResource(ID3D11Resource** out_resource) { resource->AddRef(); - *ppResource = resource; + *out_resource = resource; } }; @@ -613,14 +615,14 @@ struct GalliumD3D10ShaderResourceView : public GalliumD3D10ShaderResourceViewBas : GalliumD3D10ShaderResourceViewBase(device, resource, view, desc) {} - virtual void STDMETHODCALLTYPE GetDesc1(D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc) + virtual void STDMETHODCALLTYPE GetDesc1(D3D10_SHADER_RESOURCE_VIEW_DESC1 *out_desc) { - memcpy(pDesc, &desc, sizeof(*pDesc)); + memcpy(out_desc, &desc, sizeof(*out_desc)); } - virtual void STDMETHODCALLTYPE GetDesc(D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc) + virtual void STDMETHODCALLTYPE GetDesc(D3D10_SHADER_RESOURCE_VIEW_DESC *out_desc) { - memcpy(pDesc, &desc, sizeof(*pDesc)); + memcpy(out_desc, &desc, sizeof(*out_desc)); } }; #endif @@ -657,11 +659,11 @@ struct GalliumD3D11Asynchronous : public GalliumD3D11DeviceChild } virtual HRESULT STDMETHODCALLTYPE GetData( - void *pData, - unsigned DataSize, - unsigned GetDataFlags) + void * out_data, + unsigned data_size, + unsigned get_data_flags) { - return this->device->GetData(this, pData, DataSize, GetDataFlags); + return this->device->GetData(this, out_data, data_size, get_data_flags); } #endif }; @@ -675,9 +677,9 @@ struct GalliumD3D11QueryOrPredicate : public GalliumD3D11Asynchronous {} virtual void STDMETHODCALLTYPE GetDesc( - D3D11_QUERY_DESC *pDesc) + D3D11_QUERY_DESC *out_desc) { - *pDesc = desc; + *out_desc = desc; } }; @@ -708,8 +710,8 @@ struct GalliumD3D11Counter : public GalliumD3D11Asynchronous {} virtual void STDMETHODCALLTYPE GetDesc( - D3D11_COUNTER_DESC *pDesc) + D3D11_COUNTER_DESC *out_desc) { - *pDesc = desc; + *out_desc = desc; } }; -- cgit v1.2.3 From 0525384c11a6bc95f9fc8f621ea22e13355c2ac8 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 15:38:33 +0200 Subject: d3d1x: rename parameters in dxgi --- .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 252 ++++++++++----------- .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp | 98 ++++---- .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp | 88 +++---- 3 files changed, 219 insertions(+), 219 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 98ea972b656..89be7f5b17b 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -40,9 +40,9 @@ struct GalliumDXGIAdapter; struct GalliumDXGISwapChain; struct GalliumDXGIFactory; -static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, IUnknown* device, const DXGI_SWAP_CHAIN_DESC& desc, IDXGISwapChain** ppSwapChain); -static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* adapter, const struct native_platform* platform, void* dpy, IDXGIAdapter1** ppAdapter); -static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::string& name, const struct native_connector* connector, IDXGIOutput** ppOutput); +static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, IUnknown* device, const DXGI_SWAP_CHAIN_DESC& desc, IDXGISwapChain** out_swap_chain); +static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* adapter, const struct native_platform* platform, void* dpy, IDXGIAdapter1** out_adapter); +static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::string& name, const struct native_connector* connector, IDXGIOutput** out_output); static void GalliumDXGISwapChainRevalidate(IDXGISwapChain* swap_chain); template @@ -57,9 +57,9 @@ struct GalliumDXGIObject : public GalliumPrivateDataComObject virtual HRESULT STDMETHODCALLTYPE GetParent( REFIID riid, - void **ppParent) + void **out_parent) { - return parent->QueryInterface(riid, ppParent); + return parent->QueryInterface(riid, out_parent); } }; @@ -112,32 +112,32 @@ struct GalliumDXGIFactory : public GalliumDXGIObject } virtual HRESULT STDMETHODCALLTYPE EnumAdapters( - UINT Adapter, - IDXGIAdapter **ppAdapter) + UINT adapter, + IDXGIAdapter **out_adapter) { - return EnumAdapters1(Adapter, (IDXGIAdapter1**)ppAdapter); + return EnumAdapters1(adapter, (IDXGIAdapter1**)out_adapter); } virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( - UINT Adapter, - IDXGIAdapter1 **ppAdapter) + UINT adapter, + IDXGIAdapter1 **out_adapter) { - *ppAdapter = 0; - if(Adapter == 0) + *out_adapter = 0; + if(adapter == 0) { - return GalliumDXGIAdapterCreate(this, platform, display, ppAdapter); + return GalliumDXGIAdapterCreate(this, platform, display, out_adapter); } #if 0 // TODO: enable this if(platform == native_get_x11_platform()) { unsigned nscreens = ScreenCount((Display*)display); - if(Adapter < nscreens) + if(adapter < nscreens) { unsigned def_screen = DefaultScreen(display); - if(Adapter <= def_screen) - --Adapter; - *ppAdapter = GalliumDXGIAdapterCreate(this, platform, display, Adapter); + if(adapter <= def_screen) + --adapter; + *out_adapter = GalliumDXGIAdapterCreate(this, platform, display, adapter); return S_OK; } } @@ -153,35 +153,35 @@ struct GalliumDXGIFactory : public GalliumDXGIObject * Does this act for existing swapchains? For new swapchains? */ virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( - HWND WindowHandle, - UINT Flags) + HWND window_handle, + UINT flags) { /* TODO: actually implement, for Wine, X11 and KMS*/ - associated_window = WindowHandle; + associated_window = window_handle; return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( - HWND *pWindowHandle) + HWND *pwindow_handle) { - *pWindowHandle = associated_window; + *pwindow_handle = associated_window; return S_OK; } virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( - IUnknown *pDevice, - DXGI_SWAP_CHAIN_DESC *pDesc, - IDXGISwapChain **ppSwapChain) + IUnknown *device, + DXGI_SWAP_CHAIN_DESC *desc, + IDXGISwapChain **out_swap_chain) { - return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); + return GalliumDXGISwapChainCreate(this, device, *desc, out_swap_chain); } virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( - HMODULE Module, - IDXGIAdapter **ppAdapter) + HMODULE module, + IDXGIAdapter **out_adapter) { /* TODO: ignore the module, and just create a Gallium software screen */ - *ppAdapter = 0; + *out_adapter = 0; return E_NOTIMPL; } @@ -276,44 +276,44 @@ struct GalliumDXGIAdapter } virtual HRESULT STDMETHODCALLTYPE EnumOutputs( - UINT Output, - IDXGIOutput **ppOutput) + UINT output, + IDXGIOutput **out_output) { - if(Output >= (unsigned)num_outputs) + if(output >= (unsigned)num_outputs) return DXGI_ERROR_NOT_FOUND; if(connectors) { std::ostringstream ss; - ss << "Output #" << Output; - return GalliumDXGIOutputCreate(this, ss.str(), connectors[Output], ppOutput); + ss << "output #" << output; + return GalliumDXGIOutputCreate(this, ss.str(), connectors[output], out_output); } else - return GalliumDXGIOutputCreate(this, "Unique output", NULL, ppOutput); + return GalliumDXGIOutputCreate(this, "Unique output", NULL, out_output); } virtual HRESULT STDMETHODCALLTYPE GetDesc( - DXGI_ADAPTER_DESC *pDesc) + DXGI_ADAPTER_DESC *desc) { - memcpy(pDesc, &desc, sizeof(*pDesc)); + memcpy(desc, &desc, sizeof(*desc)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetDesc1( - DXGI_ADAPTER_DESC1 *pDesc) + DXGI_ADAPTER_DESC1 *desc) { - memcpy(pDesc, &desc, sizeof(*pDesc)); + memcpy(desc, &desc, sizeof(*desc)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( - REFGUID InterfaceName, - LARGE_INTEGER *pUMDVersion) + REFGUID interface_name, + LARGE_INTEGER *u_m_d_version) { // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear - if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) + if(interface_name == IID_ID3D11Device || interface_name == IID_ID3D10Device1 || interface_name == IID_ID3D10Device) { - pUMDVersion->QuadPart = 0x00080011000a0411ULL; + u_m_d_version->QuadPart = 0x00080011000a0411ULL; return S_OK; } return DXGI_ERROR_UNSUPPORTED; @@ -407,37 +407,37 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - DXGI_OUTPUT_DESC *pDesc) + DXGI_OUTPUT_DESC *out_desc) { - *pDesc = desc; + *out_desc = desc; return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( - DXGI_FORMAT EnumFormat, - UINT Flags, - UINT *pNumModes, - DXGI_MODE_DESC *pDesc) + DXGI_FORMAT enum_format, + UINT flags, + UINT *pcount, + DXGI_MODE_DESC *desc) { /* TODO: should we return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE when we don't * support modesetting instead of fake modes? */ - pipe_format format = dxgi_to_pipe_format[EnumFormat]; + pipe_format format = dxgi_to_pipe_format[enum_format]; if(parent->configs_by_pipe_format.count(format)) { - if(!pDesc) + if(!desc) { - *pNumModes = num_modes; + *pcount = num_modes; return S_OK; } - unsigned copy_modes = std::min(num_modes, *pNumModes); + unsigned copy_modes = std::min(num_modes, *pcount); for(unsigned i = 0; i < copy_modes; ++i) { - pDesc[i] = dxgi_modes[i]; - pDesc[i].Format = EnumFormat; + desc[i] = dxgi_modes[i]; + desc[i].Format = enum_format; } - *pNumModes = num_modes; + *pcount = num_modes; if(copy_modes < num_modes) return DXGI_ERROR_MORE_DATA; @@ -446,15 +446,15 @@ use_fake_mode: } else { - *pNumModes = 0; + *pcount = 0; return S_OK; } } virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( const DXGI_MODE_DESC *pModeToMatch, - DXGI_MODE_DESC *pClosestMatch, - IUnknown *pConcernedDevice) + DXGI_MODE_DESC *closest_match, + IUnknown *concerned_device) { /* TODO: actually implement this */ DXGI_FORMAT dxgi_format = pModeToMatch->Format; @@ -462,7 +462,7 @@ use_fake_mode: init_pipe_to_dxgi_format(); if(!parent->configs_by_pipe_format.count(format)) { - if(!pConcernedDevice) + if(!concerned_device) return E_FAIL; else { @@ -471,8 +471,8 @@ use_fake_mode: } } - *pClosestMatch = dxgi_modes[0]; - pClosestMatch->Format = dxgi_format; + *closest_match = dxgi_modes[0]; + closest_match->Format = dxgi_format; return S_OK; } @@ -482,8 +482,8 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE TakeOwnership( - IUnknown *pDevice, - BOOL Exclusive) + IUnknown *device, + BOOL exclusive) { return S_OK; } @@ -493,9 +493,9 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( - DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) + DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps) { - memset(pGammaCaps, 0, sizeof(*pGammaCaps)); + memset(gamma_caps, 0, sizeof(*gamma_caps)); return S_OK; } @@ -528,23 +528,23 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( - IDXGISurface *pScanoutSurface) + IDXGISurface *scanout_surface) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( - IDXGISurface *pDestination) + IDXGISurface *destination) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - DXGI_FRAME_STATISTICS *pStats) + DXGI_FRAME_STATISTICS *stats) { - memset(pStats, 0, sizeof(*pStats)); + memset(stats, 0, sizeof(*stats)); #ifdef _WIN32 - QueryPerformanceCounter(&pStats->SyncQPCTime); + QueryPerformanceCounter(&stats->SyncQPCTime); #endif return E_NOTIMPL; } @@ -567,12 +567,12 @@ use_fake_mode: * surface and the contents become undefined. * D3D may internally use multiple buffers, but you can't observe this, except * by looking at the buffer contents after Present (but those are undefined). - * If it uses multiple buffers internally, then it will normally use BufferCount buffers + * If it uses multiple buffers internally, then it will normally use buffer_count buffers * (this has latency implications). * Discard mode seems to internally use a single buffer in windowed mode, - * even if DWM is enabled, and BufferCount buffers in fullscreen mode. + * even if DWM is enabled, and buffer_count buffers in fullscreen mode. * - * In sequential mode, the runtime alllocates BufferCount buffers. + * In sequential mode, the runtime alllocates buffer_count buffers. * You can get each with GetBuffers(n). * GetBuffers(0) ALWAYS points to the backbuffer to be presented and has the * same usage constraints as the discard mode. @@ -646,11 +646,11 @@ use_fake_mode: * I was unable to find any code using it either in DirectX SDK examples, or on the web. * * It seems the only reason you would use it is to not have to redraw from scratch, while - * also possibly avoid a copy compared to BufferCount == 1, assuming that your + * also possibly avoid a copy compared to buffer_count == 1, assuming that your * application is OK with having to redraw starting not from the last frame, but from * one/two/more frames behind it. * - * A better design would forbid the user specifying BufferCount explicitly, and + * A better design would forbid the user specifying buffer_count explicitly, and * would instead let the application give an upper bound on how old the buffer can * become after presentation, with "infinite" being equivalent to discard. * The runtime would then tell the application with frame number the buffer switched to @@ -872,7 +872,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectQueryInterface(riid, ppDevice); + return dxgi_device->QueryInterface(riid, pdevice); } HRESULT create_buffer0() @@ -1006,10 +1006,10 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectoutputs[0].ref(); + *out_output = adapter->outputs[0].ref(); return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - DXGI_FRAME_STATISTICS *pStats) + DXGI_FRAME_STATISTICS *out_stats) { - memset(pStats, 0, sizeof(*pStats)); + memset(out_stats, 0, sizeof(*out_stats)); #ifdef _WIN32 - QueryPerformanceCounter(&pStats->SyncQPCTime); + QueryPerformanceCounter(&out_stats->SyncQPCTime); #endif - pStats->PresentCount = present_count; - pStats->PresentRefreshCount = present_count; - pStats->SyncRefreshCount = present_count; + out_stats->PresentCount = present_count; + out_stats->PresentRefreshCount = present_count; + out_stats->SyncRefreshCount = present_count; return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( - UINT *pLastPresentCount) + UINT *last_present_count) { - *pLastPresentCount = present_count; + *last_present_count = present_count; return S_OK; } }; @@ -1275,11 +1275,11 @@ static void GalliumDXGISwapChainRevalidate(IDXGISwapChain* swap_chain) ((GalliumDXGISwapChain*)swap_chain)->needs_validation = true; } -static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* factory, const struct native_platform* platform, void* dpy, IDXGIAdapter1** pAdapter) +static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* factory, const struct native_platform* platform, void* dpy, IDXGIAdapter1** out_adapter) { try { - *pAdapter = new GalliumDXGIAdapter(factory, platform, dpy); + *out_adapter = new GalliumDXGIAdapter(factory, platform, dpy); return S_OK; } catch(HRESULT hr) @@ -1288,11 +1288,11 @@ static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* factory, const struc } } -static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::string& name, const struct native_connector* connector, IDXGIOutput** pOutput) +static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::string& name, const struct native_connector* connector, IDXGIOutput** out_output) { try { - *pOutput = new GalliumDXGIOutput(adapter, name, connector); + *out_output = new GalliumDXGIOutput(adapter, name, connector); return S_OK; } catch(HRESULT hr) @@ -1301,11 +1301,11 @@ static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const std::s } } -static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, IUnknown* device, const DXGI_SWAP_CHAIN_DESC& desc, IDXGISwapChain** pSwapChain) +static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, IUnknown* device, const DXGI_SWAP_CHAIN_DESC& desc, IDXGISwapChain** out_swap_chain) { try { - *pSwapChain = new GalliumDXGISwapChain(factory, device, desc); + *out_swap_chain = new GalliumDXGISwapChain(factory, device, desc); return S_OK; } catch(HRESULT hr) @@ -1393,26 +1393,26 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( REFIID riid, - void **ppFactory + void **out_factory ) { GalliumDXGIFactory* factory; - *ppFactory = 0; + *out_factory = 0; if(dxgi_thread_binding.platform) factory = new GalliumDXGIFactory(dxgi_thread_binding.platform, dxgi_thread_binding.display, dxgi_thread_binding.backend); else if(dxgi_default_binding.platform) factory = new GalliumDXGIFactory(dxgi_default_binding.platform, dxgi_default_binding.display, dxgi_default_binding.backend); else factory = new GalliumDXGIFactory(native_get_x11_platform(), NULL, NULL); - HRESULT hres = factory->QueryInterface(riid, ppFactory); + HRESULT hres = factory->QueryInterface(riid, out_factory); factory->Release(); return hres; } HRESULT STDMETHODCALLTYPE CreateDXGIFactory( REFIID riid, - void **ppFactory + void **out_factor ) { - return CreateDXGIFactory1(riid, ppFactory); + return CreateDXGIFactory1(riid, out_factor); } diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp index 98ed6ac66ac..96073d4ebc6 100644 --- a/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp @@ -4,15 +4,15 @@ * * 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 + * "software"), to deal in the software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to + * distribute, sublicense, 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. + * 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 @@ -31,18 +31,18 @@ #include HRESULT D3D10CreateDevice1( - IDXGIAdapter *pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - unsigned Flags, - D3D10_FEATURE_LEVEL1 HardwareLevel, - unsigned SDKVersion, - ID3D10Device1 **ppDevice + IDXGIAdapter *adapter, + D3D10_DRIVER_TYPE driver_type, + HMODULE software, + unsigned flags, + D3D10_FEATURE_LEVEL1 hardware_level, + unsigned sdk_version, + ID3D10Device1 **out_device ) { HRESULT hr; ComPtr adapter_to_release; - if(!pAdapter) + if(!adapter) { ComPtr factory; hr = CreateDXGIFactory1(IID_IDXGIFactory1, (void**)&factory); @@ -51,17 +51,17 @@ HRESULT D3D10CreateDevice1( hr = factory->EnumAdapters1(0, &adapter_to_release); if(!SUCCEEDED(hr)) return hr; - pAdapter = adapter_to_release.p; + adapter = adapter_to_release.p; } ComPtr gallium_adapter; - hr = pAdapter->QueryInterface(IID_IGalliumAdapter, (void**)&gallium_adapter); + hr = adapter->QueryInterface(IID_IGalliumAdapter, (void**)&gallium_adapter); if(!SUCCEEDED(hr)) return hr; struct pipe_screen* screen; // TODO: what should D3D_DRIVER_TYPE_SOFTWARE return? fast or reference? - if(DriverType == D3D10_DRIVER_TYPE_REFERENCE) + if(driver_type == D3D10_DRIVER_TYPE_REFERENCE) screen = gallium_adapter->GetGalliumReferenceSoftwareScreen(); - else if(DriverType == D3D10_DRIVER_TYPE_SOFTWARE || DriverType == D3D10_DRIVER_TYPE_WARP) + else if(driver_type == D3D10_DRIVER_TYPE_SOFTWARE || driver_type == D3D10_DRIVER_TYPE_WARP) screen = gallium_adapter->GetGalliumFastSoftwareScreen(); else screen = gallium_adapter->GetGalliumScreen(); @@ -71,35 +71,35 @@ HRESULT D3D10CreateDevice1( if(!context) return E_FAIL; ComPtr device; - hr = GalliumD3D10DeviceCreate1(screen, context, TRUE, Flags, pAdapter, &device); + hr = GalliumD3D10DeviceCreate1(screen, context, TRUE, flags, adapter, &device); if(!SUCCEEDED(hr)) { context->destroy(context); return hr; } - if(ppDevice) - *ppDevice = device.steal(); + if(out_device) + *out_device = device.steal(); return S_OK; } HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( - IDXGIAdapter* pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - unsigned Flags, - D3D10_FEATURE_LEVEL1 HardwareLevel, - unsigned SDKVersion, - DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - IDXGISwapChain** ppSwapChain, - ID3D10Device1** ppDevice + IDXGIAdapter* adapter, + D3D10_DRIVER_TYPE driver_type, + HMODULE software, + unsigned flags, + D3D10_FEATURE_LEVEL1 hardware_level, + unsigned sdk_version, + DXGI_SWAP_CHAIN_DESC* swap_chain_desc, + IDXGISwapChain** out_swap_chain, + ID3D10Device1** out_device ) { ComPtr dev; HRESULT hr; - hr = D3D10CreateDevice1(pAdapter, DriverType, Software, Flags, HardwareLevel, SDKVersion, &dev); + hr = D3D10CreateDevice1(adapter, driver_type, software, flags, hardware_level, sdk_version, &dev); if(!SUCCEEDED(hr)) return hr; - if(ppSwapChain) + if(out_swap_chain) { ComPtr factory; ComPtr dxgi_device; @@ -113,37 +113,37 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( return hr; adapter->GetParent(IID_IDXGIFactory, (void**)&factory); - hr = factory->CreateSwapChain(dev.p, (DXGI_SWAP_CHAIN_DESC*)pSwapChainDesc, ppSwapChain); + hr = factory->CreateSwapChain(dev.p, (DXGI_SWAP_CHAIN_DESC*)swap_chain_desc, out_swap_chain); if(!SUCCEEDED(hr)) return hr; } - if(ppDevice) - *ppDevice = dev.steal(); + if(out_device) + *out_device = dev.steal(); return hr; } HRESULT D3D10CreateDevice( - IDXGIAdapter *pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - unsigned Flags, - unsigned SDKVersion, - ID3D10Device **ppDevice + IDXGIAdapter *adapter, + D3D10_DRIVER_TYPE driver_type, + HMODULE software, + unsigned flags, + unsigned sdk_version, + ID3D10Device **out_device ) { - return D3D10CreateDevice1(pAdapter, DriverType, Software, Flags, D3D10_FEATURE_LEVEL_10_0, SDKVersion, (ID3D10Device1**)ppDevice); + return D3D10CreateDevice1(adapter, driver_type, software, flags, D3D10_FEATURE_LEVEL_10_0, sdk_version, (ID3D10Device1**)out_device); } HRESULT WINAPI D3D10CreateDeviceAndSwapChain( - IDXGIAdapter* pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - unsigned Flags, - unsigned SDKVersion, - DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - IDXGISwapChain** ppSwapChain, - ID3D10Device** ppDevice + IDXGIAdapter* adapter, + D3D10_DRIVER_TYPE driver_type, + HMODULE software, + unsigned flags, + unsigned sdk_version, + DXGI_SWAP_CHAIN_DESC* swap_chain_desc, + IDXGISwapChain** out_swap_chain, + ID3D10Device** out_device ) { - return D3D10CreateDeviceAndSwapChain1(pAdapter, DriverType, Software, Flags, D3D10_FEATURE_LEVEL_10_0, SDKVersion, pSwapChainDesc, ppSwapChain, (ID3D10Device1**)ppDevice); + return D3D10CreateDeviceAndSwapChain1(adapter, driver_type, software, flags, D3D10_FEATURE_LEVEL_10_0, sdk_version, swap_chain_desc, out_swap_chain, (ID3D10Device1**)out_device); } diff --git a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp index 2fc3b7f4113..1b1cb907d37 100644 --- a/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp @@ -4,15 +4,15 @@ * * 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 + * "software"), to deal in the software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to + * distribute, sublicense, 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. + * 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 @@ -31,21 +31,21 @@ #include HRESULT D3D11CreateDevice( - IDXGIAdapter *pAdapter, - D3D_DRIVER_TYPE DriverType, - HMODULE Software, - unsigned Flags, - const D3D_FEATURE_LEVEL *pFeatureLevels, - unsigned FeatureLevels, - unsigned SDKVersion, - ID3D11Device **ppDevice, - D3D_FEATURE_LEVEL *pFeatureLevel, - ID3D11DeviceContext **ppImmediateContext + IDXGIAdapter *adapter, + D3D_DRIVER_TYPE driver_type, + HMODULE software, + unsigned flags, + const D3D_FEATURE_LEVEL *feature_levels, + unsigned num_feature_levels, + unsigned sdk_version, + ID3D11Device **out_device, + D3D_FEATURE_LEVEL *feature_level, + ID3D11DeviceContext **out_immediate_context ) { HRESULT hr; ComPtr adapter_to_release; - if(!pAdapter) + if(!adapter) { ComPtr factory; hr = CreateDXGIFactory1(IID_IDXGIFactory1, (void**)&factory); @@ -54,17 +54,17 @@ HRESULT D3D11CreateDevice( hr = factory->EnumAdapters1(0, &adapter_to_release); if(!SUCCEEDED(hr)) return hr; - pAdapter = adapter_to_release.p; + adapter = adapter_to_release.p; } ComPtr gallium_adapter; - hr = pAdapter->QueryInterface(IID_IGalliumAdapter, (void**)&gallium_adapter); + hr = adapter->QueryInterface(IID_IGalliumAdapter, (void**)&gallium_adapter); if(!SUCCEEDED(hr)) return hr; struct pipe_screen* screen; // TODO: what should D3D_DRIVER_TYPE_SOFTWARE return? fast or reference? - if(DriverType == D3D_DRIVER_TYPE_REFERENCE) + if(driver_type == D3D_DRIVER_TYPE_REFERENCE) screen = gallium_adapter->GetGalliumReferenceSoftwareScreen(); - else if(DriverType == D3D_DRIVER_TYPE_SOFTWARE || DriverType == D3D_DRIVER_TYPE_WARP) + else if(driver_type == D3D_DRIVER_TYPE_SOFTWARE || driver_type == D3D_DRIVER_TYPE_WARP) screen = gallium_adapter->GetGalliumFastSoftwareScreen(); else screen = gallium_adapter->GetGalliumScreen(); @@ -74,42 +74,42 @@ HRESULT D3D11CreateDevice( if(!context) return E_FAIL; ComPtr device; - hr = GalliumD3D11DeviceCreate(screen, context, TRUE, Flags, pAdapter, &device); + hr = GalliumD3D11DeviceCreate(screen, context, TRUE, flags, adapter, &device); if(!SUCCEEDED(hr)) { context->destroy(context); return hr; } - if(ppImmediateContext) - device->GetImmediateContext(ppImmediateContext); - if(pFeatureLevel) - *pFeatureLevel = device->GetFeatureLevel(); - if(ppDevice) - *ppDevice = device.steal(); + if(out_immediate_context) + device->GetImmediateContext(out_immediate_context); + if(feature_level) + *feature_level = device->GetFeatureLevel(); + if(out_device) + *out_device = device.steal(); return S_OK; } HRESULT WINAPI D3D11CreateDeviceAndSwapChain( - IDXGIAdapter* pAdapter, - D3D_DRIVER_TYPE DriverType, - HMODULE Software, - unsigned Flags, - CONST D3D_FEATURE_LEVEL* pFeatureLevels, - unsigned FeatureLevels, - unsigned SDKVersion, + IDXGIAdapter* adapter, + D3D_DRIVER_TYPE driver_type, + HMODULE software, + unsigned flags, + CONST D3D_FEATURE_LEVEL* feature_levels, + unsigned num_feature_levels, + unsigned sdk_version, CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - IDXGISwapChain** ppSwapChain, - ID3D11Device** ppDevice, - D3D_FEATURE_LEVEL* pFeatureLevel, - ID3D11DeviceContext** ppImmediateContext ) + IDXGISwapChain** out_swap_chain, + ID3D11Device** out_device, + D3D_FEATURE_LEVEL* feature_level, + ID3D11DeviceContext** out_immediate_context ) { ComPtr dev; ComPtr ctx; HRESULT hr; - hr = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, (ID3D11Device**)&dev, pFeatureLevel, (ID3D11DeviceContext**)&ctx); + hr = D3D11CreateDevice(adapter, driver_type, software, flags, feature_levels, num_feature_levels, sdk_version, (ID3D11Device**)&dev, feature_level, (ID3D11DeviceContext**)&ctx); if(!SUCCEEDED(hr)) return hr; - if(ppSwapChain) + if(out_swap_chain) { ComPtr factory; ComPtr dxgi_device; @@ -123,13 +123,13 @@ HRESULT WINAPI D3D11CreateDeviceAndSwapChain( return hr; adapter->GetParent(IID_IDXGIFactory, (void**)&factory); - hr = factory->CreateSwapChain(dev.p, (DXGI_SWAP_CHAIN_DESC*)pSwapChainDesc, ppSwapChain); + hr = factory->CreateSwapChain(dev.p, (DXGI_SWAP_CHAIN_DESC*)pSwapChainDesc, out_swap_chain); if(!SUCCEEDED(hr)) return hr; } - if(ppDevice) - *ppDevice = dev.steal(); - if(ppImmediateContext) - *ppImmediateContext = ctx.steal(); + if(out_device) + *out_device = dev.steal(); + if(out_immediate_context) + *out_immediate_context = ctx.steal(); return hr; } -- cgit v1.2.3 From b6b3fbcdb14faf5a5be66112a06d3406e7a46998 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 15:45:13 +0200 Subject: d3d11: obliterate IDL parameter names --- .../state_trackers/d3d1x/d3dapi/d3d10_1.idl | 50 +- .../state_trackers/d3d1x/d3dapi/d3d10shader.idl | 34 +- src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl | 948 ++++++++++----------- .../state_trackers/d3d1x/d3dapi/d3d11shader.idl | 62 +- .../state_trackers/d3d1x/d3dapi/d3dcommon.idl | 12 +- src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl | 176 ++-- 6 files changed, 641 insertions(+), 641 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl index 7efcae5f431..7edeff94f79 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl @@ -123,7 +123,7 @@ typedef enum D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS interface ID3D10BlendState1 : ID3D10BlendState { void GetDesc1( - [out] D3D10_BLEND_DESC1 *pDesc + [out] D3D10_BLEND_DESC1 *a ); }; @@ -131,7 +131,7 @@ interface ID3D10BlendState1 : ID3D10BlendState interface ID3D10ShaderResourceView1 : ID3D10ShaderResourceView { void GetDesc1( - [out] D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc + [out] D3D10_SHADER_RESOURCE_VIEW_DESC1 *a ); }; @@ -139,14 +139,14 @@ interface ID3D10ShaderResourceView1 : ID3D10ShaderResourceView interface ID3D10Device1 : ID3D10Device { HRESULT CreateShaderResourceView1( - [in] ID3D10Resource *pResource, - [in] const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, - [out,optional] ID3D10ShaderResourceView1 **ppSRView + [in] ID3D10Resource *a, + [in] const D3D10_SHADER_RESOURCE_VIEW_DESC1 *b, + [out,optional] ID3D10ShaderResourceView1 **c ); HRESULT CreateBlendState1( - [in] const D3D10_BLEND_DESC1 *pBlendStateDesc, - [out, optional] ID3D10BlendState1 **ppBlendState + [in] const D3D10_BLEND_DESC1 *a, + [out, optional] ID3D10BlendState1 **b ); D3D10_FEATURE_LEVEL1 GetFeatureLevel(); @@ -157,35 +157,35 @@ interface ID3D10Device1 : ID3D10Device typedef enum D3D10_DRIVER_TYPE D3D10_DRIVER_TYPE; HRESULT D3D10CreateDevice1( - [in,optional] IDXGIAdapter* pAdapter, - [in] D3D10_DRIVER_TYPE DriverType, - [in] HMODULE Software, - [in] UINT Flags, - [in] D3D10_FEATURE_LEVEL1 HardwareLevel, - [in] UINT SDKVersion, - [out,optional] ID3D10Device1** ppDevice + [in,optional] IDXGIAdapter* a, + [in] D3D10_DRIVER_TYPE b, + [in] HMODULE c, + [in] UINT d, + [in] D3D10_FEATURE_LEVEL1 e, + [in] UINT f, + [out,optional] ID3D10Device1** g ); typedef HRESULT (* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)( - [in,optional] IDXGIAdapter*, + [in,optional] IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, - [in, optional] DXGI_SWAP_CHAIN_DESC*, + [in, optional] DXGI_SWAP_CHAIN_DESC*, [out,optional] IDXGISwapChain**, [out,optional] ID3D10Device1** ); HRESULT D3D10CreateDeviceAndSwapChain1( - [in,optional] IDXGIAdapter* pAdapter, - [in] D3D10_DRIVER_TYPE DriverType, - [in] HMODULE Software, - [in] UINT Flags, - [in] D3D10_FEATURE_LEVEL1 HardwareLevel, - [in] UINT SDKVersion, - [in,optional] DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - [out,optional] IDXGISwapChain** ppSwapChain, - [out,optional] ID3D10Device1** ppDevice + [in,optional] IDXGIAdapter* a, + [in] D3D10_DRIVER_TYPE b, + [in] HMODULE c, + [in] UINT d, + [in] D3D10_FEATURE_LEVEL1 e, + [in] UINT f, + [in,optional] DXGI_SWAP_CHAIN_DESC* g, + [out,optional] IDXGISwapChain** h, + [out,optional] ID3D10Device1** i ); diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl index d3f8b75db85..6088a8894a2 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10shader.idl @@ -178,19 +178,19 @@ typedef struct _D3D10_SHADER_INPUT_BIND_DESC interface ID3D10ShaderReflectionType { HRESULT GetDesc( - [out] D3D10_SHADER_TYPE_DESC *pDesc + [out] D3D10_SHADER_TYPE_DESC *a ); ID3D10ShaderReflectionType* GetMemberTypeByIndex( - [in] UINT Index + [in] UINT a ); ID3D10ShaderReflectionType* GetMemberTypeByName( - [in] LPCSTR Name + [in] LPCSTR a ); LPCSTR GetMemberTypeName( - [in] UINT Index + [in] UINT a ); }; @@ -200,7 +200,7 @@ interface ID3D10ShaderReflectionConstantBuffer; interface ID3D10ShaderReflectionVariable { HRESULT GetDesc( - [out] D3D10_SHADER_VARIABLE_DESC *pDesc + [out] D3D10_SHADER_VARIABLE_DESC *a ); ID3D10ShaderReflectionType* GetType(); @@ -210,15 +210,15 @@ interface ID3D10ShaderReflectionVariable interface ID3D10ShaderReflectionConstantBuffer { HRESULT GetDesc( - [out] D3D10_SHADER_BUFFER_DESC *pDesc + [out] D3D10_SHADER_BUFFER_DESC *a ); ID3D10ShaderReflectionVariable* GetVariableByIndex( - [in] UINT Index + [in] UINT a ); ID3D10ShaderReflectionVariable* GetVariableByName( - [in] LPCSTR Name + [in] LPCSTR a ); }; @@ -226,31 +226,31 @@ interface ID3D10ShaderReflectionConstantBuffer interface ID3D10ShaderReflection : IUnknown { HRESULT GetDesc( - [out] D3D10_SHADER_DESC *pDesc + [out] D3D10_SHADER_DESC *a ); ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByIndex( - [in] UINT Index + [in] UINT a ); ID3D10ShaderReflectionConstantBuffer* GetConstantBufferByName( - [in] LPCSTR Name + [in] LPCSTR a ); HRESULT GetResourceBindingDesc( - [in] UINT ResourceIndex, - [out] D3D10_SHADER_INPUT_BIND_DESC *pDesc + [in] UINT a, + [out] D3D10_SHADER_INPUT_BIND_DESC *b ); HRESULT GetInputParameterDesc( - [in] UINT ParameterIndex, - [out] D3D10_SIGNATURE_PARAMETER_DESC *pDesc + [in] UINT a, + [out] D3D10_SIGNATURE_PARAMETER_DESC *b ); HRESULT GetOutputParameterDesc ( - [in] UINT ParameterIndex, - [out] D3D10_SIGNATURE_PARAMETER_DESC *pDesc + [in] UINT a, + [out] D3D10_SIGNATURE_PARAMETER_DESC *b ); }; diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl index e23c2f83527..cac046fac77 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl @@ -1335,24 +1335,24 @@ interface ID3D11Device; [object, local, uuid("1841e5c8-16b0-489b-bcc8-44cfb0d5deae")] interface ID3D11DeviceChild : IUnknown { void GetDevice( - [out] ID3D11Device **ppDevice + [out] ID3D11Device **a ); HRESULT GetPrivateData( - [in] REFGUID guid, - [in, out] UINT *pDataSize, - [out] void *pData + [in] REFGUID a, + [in, out] UINT *b, + [out] void *c ); HRESULT SetPrivateData( - [in] REFGUID guid, - [in] UINT DataSize, - [in] const void *pData + [in] REFGUID a, + [in] UINT b, + [in] const void *c ); HRESULT SetPrivateDataInterface( - [in] REFGUID guid, - [in] const IUnknown *pData + [in] REFGUID a, + [in] const IUnknown *b ); }; @@ -1364,21 +1364,21 @@ interface ID3D11InputLayout : ID3D11DeviceChild [object, local, uuid("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1")] interface ID3D11DepthStencilState : ID3D11DeviceChild { void GetDesc( - [out] D3D11_DEPTH_STENCIL_DESC *pDesc + [out] D3D11_DEPTH_STENCIL_DESC *a ); }; [object, local, uuid("75b68faa-347d-4159-8f45-a0640f01cd9a")] interface ID3D11BlendState : ID3D11DeviceChild { void GetDesc( - [out] D3D11_BLEND_DESC *pDesc + [out] D3D11_BLEND_DESC *a ); }; [object, local, uuid("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7")] interface ID3D11RasterizerState : ID3D11DeviceChild { void GetDesc( - [out] D3D11_RASTERIZER_DESC *pDesc + [out] D3D11_RASTERIZER_DESC *a ); }; @@ -1386,7 +1386,7 @@ interface ID3D11RasterizerState : ID3D11DeviceChild { interface ID3D11SamplerState : ID3D11DeviceChild { void GetDesc( - [out] D3D11_SAMPLER_DESC *pDesc + [out] D3D11_SAMPLER_DESC *a ); }; @@ -1394,11 +1394,11 @@ interface ID3D11SamplerState : ID3D11DeviceChild [object, local, uuid("dc8e63f3-d12b-4952-b47b-5e45026a862d")] interface ID3D11Resource : ID3D11DeviceChild { void GetType( - [out] D3D11_RESOURCE_DIMENSION *pResourceDimension + [out] D3D11_RESOURCE_DIMENSION *a ); void SetEvictionPriority( - [in] UINT EvictionPriority + [in] UINT a ); UINT GetEvictionPriority( @@ -1408,7 +1408,7 @@ interface ID3D11Resource : ID3D11DeviceChild { [object, local, uuid("48570b85-d1ee-4fcd-a250-eb350722b037")] interface ID3D11Buffer : ID3D11Resource { void GetDesc( - [out] D3D11_BUFFER_DESC *pDesc + [out] D3D11_BUFFER_DESC *a ); }; @@ -1416,28 +1416,28 @@ interface ID3D11Buffer : ID3D11Resource { [object, local, uuid("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c")] interface ID3D11Texture1D : ID3D11Resource { void GetDesc( - [out] D3D11_TEXTURE1D_DESC *pDesc + [out] D3D11_TEXTURE1D_DESC *a ); }; [object, local, uuid("6f15aaf2-d208-4e89-9ab4-489535d34f9c")] interface ID3D11Texture2D : ID3D11Resource { void GetDesc( - [out] D3D11_TEXTURE2D_DESC *pDesc + [out] D3D11_TEXTURE2D_DESC *a ); }; [object, local, uuid("037e866e-f56d-4357-a8af-9dabbe6e250e")] interface ID3D11Texture3D : ID3D11Resource { void GetDesc( - [out] D3D11_TEXTURE3D_DESC *pDesc + [out] D3D11_TEXTURE3D_DESC *a ); }; [object, local, uuid("839d1216-bb2e-412b-b7f4-a9dbebe08ed1")] interface ID3D11View : ID3D11DeviceChild { void GetResource( - [out] ID3D11Resource **ppResource + [out] ID3D11Resource **a ); }; @@ -1445,7 +1445,7 @@ interface ID3D11View : ID3D11DeviceChild { [object, local, uuid("b0e06fe0-8192-4e1a-b1ca-36d7414710b2")] interface ID3D11ShaderResourceView : ID3D11View { void GetDesc( - [out] D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc + [out] D3D11_SHADER_RESOURCE_VIEW_DESC *a ); }; @@ -1453,7 +1453,7 @@ interface ID3D11ShaderResourceView : ID3D11View { interface ID3D11RenderTargetView : ID3D11View { void GetDesc( - [out] D3D11_RENDER_TARGET_VIEW_DESC *pDesc + [out] D3D11_RENDER_TARGET_VIEW_DESC *a ); }; @@ -1461,7 +1461,7 @@ interface ID3D11RenderTargetView : ID3D11View interface ID3D11DepthStencilView : ID3D11View { void GetDesc( - [out] D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc + [out] D3D11_DEPTH_STENCIL_VIEW_DESC *a ); }; @@ -1469,7 +1469,7 @@ interface ID3D11DepthStencilView : ID3D11View interface ID3D11UnorderedAccessView : ID3D11View { void GetDesc( - [out] D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc + [out] D3D11_UNORDERED_ACCESS_VIEW_DESC *a ); }; @@ -1514,7 +1514,7 @@ interface ID3D11Asynchronous : ID3D11DeviceChild interface ID3D11Query : ID3D11Asynchronous { void GetDesc( - [out] D3D11_QUERY_DESC *pDesc + [out] D3D11_QUERY_DESC *a ); }; @@ -1527,7 +1527,7 @@ interface ID3D11Predicate : ID3D11Query interface ID3D11Counter : ID3D11Asynchronous { void GetDesc( - [out] D3D11_COUNTER_DESC *pDesc + [out] D3D11_COUNTER_DESC *a ); }; @@ -1537,21 +1537,21 @@ interface ID3D11ClassLinkage; interface ID3D11ClassInstance : ID3D11DeviceChild { void GetClassLinkage( - [out] ID3D11ClassLinkage **ppLinkage + [out] ID3D11ClassLinkage **a ); void GetDesc( - [out] D3D11_CLASS_INSTANCE_DESC *pDesc + [out] D3D11_CLASS_INSTANCE_DESC *a ); void GetInstanceName( - [out] LPSTR pInstanceName, - [in, out] SIZE_T *pBufferLength + [out] LPSTR a, + [in, out] SIZE_T *b ); void GetTypeName( - [out] LPSTR pTypeName, - [in, out] SIZE_T *pBufferLength + [out] LPSTR a, + [in, out] SIZE_T *b ); }; @@ -1559,18 +1559,18 @@ interface ID3D11ClassInstance : ID3D11DeviceChild interface ID3D11ClassLinkage : ID3D11DeviceChild { HRESULT GetClassInstance( - [in] LPCSTR pClassInstanceName, - [in] UINT InstanceIndex, - [out] ID3D11ClassInstance **ppInstance + [in] LPCSTR a, + [in] UINT b, + [out] ID3D11ClassInstance **c ); HRESULT CreateClassInstance( - [in] LPCSTR pClassTypeName, - [in] UINT ConstantBufferOffset, - [in] UINT ConstantVectorOffset, - [in] UINT TextureOffset, - [in] UINT SamplerOffset, - [out] ID3D11ClassInstance **ppInstance + [in] LPCSTR a, + [in] UINT b, + [in] UINT c, + [in] UINT d, + [in] UINT e, + [out] ID3D11ClassInstance **f ); }; @@ -1586,213 +1586,213 @@ interface ID3D11DeviceContext; interface ID3D11Device : IUnknown { HRESULT CreateBuffer( - [in] const D3D11_BUFFER_DESC *pDesc, - [in] const D3D11_SUBRESOURCE_DATA *pInitialData, - [out] ID3D11Buffer **ppBuffer + [in] const D3D11_BUFFER_DESC *a, + [in] const D3D11_SUBRESOURCE_DATA *b, + [out] ID3D11Buffer **c ); HRESULT CreateTexture1D( - [in] const D3D11_TEXTURE1D_DESC *pDesc, - [in] const D3D11_SUBRESOURCE_DATA *pInitialData, - [out] ID3D11Texture1D **ppTexture1D + [in] const D3D11_TEXTURE1D_DESC *a, + [in] const D3D11_SUBRESOURCE_DATA *b, + [out] ID3D11Texture1D **c ); HRESULT CreateTexture2D( - [in] const D3D11_TEXTURE2D_DESC *pDesc, - [in] const D3D11_SUBRESOURCE_DATA *pInitialData, - [out] ID3D11Texture2D **ppTexture2D + [in] const D3D11_TEXTURE2D_DESC *a, + [in] const D3D11_SUBRESOURCE_DATA *b, + [out] ID3D11Texture2D **c ); HRESULT CreateTexture3D( - [in] const D3D11_TEXTURE3D_DESC *pDesc, - [in] const D3D11_SUBRESOURCE_DATA *pInitialData, - [out] ID3D11Texture3D **ppTexture3D + [in] const D3D11_TEXTURE3D_DESC *a, + [in] const D3D11_SUBRESOURCE_DATA *b, + [out] ID3D11Texture3D **c ); HRESULT CreateShaderResourceView( - [in] ID3D11Resource *pResource, - [in] const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, - [out] ID3D11ShaderResourceView **ppSRView + [in] ID3D11Resource *a, + [in] const D3D11_SHADER_RESOURCE_VIEW_DESC *b, + [out] ID3D11ShaderResourceView **c ); HRESULT CreateUnorderedAccessView( - [in] ID3D11Resource *pResource, - [in] const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, - [out] ID3D11UnorderedAccessView **ppUAView + [in] ID3D11Resource *a, + [in] const D3D11_UNORDERED_ACCESS_VIEW_DESC *b, + [out] ID3D11UnorderedAccessView **c ); HRESULT CreateRenderTargetView( - [in] ID3D11Resource *pResource, - [in] const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, - [out] ID3D11RenderTargetView **ppRTView + [in] ID3D11Resource *a, + [in] const D3D11_RENDER_TARGET_VIEW_DESC *b, + [out] ID3D11RenderTargetView **c ); HRESULT CreateDepthStencilView( - [in] ID3D11Resource *pResource, - [in] const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, - [out] ID3D11DepthStencilView **ppDepthStencilView + [in] ID3D11Resource *a, + [in] const D3D11_DEPTH_STENCIL_VIEW_DESC *b, + [out] ID3D11DepthStencilView **c ); HRESULT CreateInputLayout( - [in] const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, - [in] UINT NumElements, - [in] const void *pShaderBytecodeWithInputSignature, - [in] SIZE_T BytecodeLength, - [out] ID3D11InputLayout **ppInputLayout + [in] const D3D11_INPUT_ELEMENT_DESC *a, + [in] UINT b, + [in] const void *c, + [in] SIZE_T d, + [out] ID3D11InputLayout **e ); HRESULT CreateVertexShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11VertexShader **ppVertexShader + [in] const void *a, + [in] SIZE_T b, + [in] ID3D11ClassLinkage *c, + [out] ID3D11VertexShader **d ); HRESULT CreateGeometryShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11GeometryShader **ppGeometryShader + [in] const void *a, + [in] SIZE_T b, + [in] ID3D11ClassLinkage *c, + [out] ID3D11GeometryShader **d ); HRESULT CreateGeometryShaderWithStreamOutput( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, - [in] UINT NumEntries, - [in] const UINT *pBufferStrides, - [in] UINT NumStrides, - [in] UINT RasterizedStream, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11GeometryShader **ppGeometryShader + [in] const void *a, + [in] SIZE_T b, + [in] const D3D11_SO_DECLARATION_ENTRY *c, + [in] UINT d, + [in] const UINT *e, + [in] UINT f, + [in] UINT g, + [in] ID3D11ClassLinkage *h, + [out] ID3D11GeometryShader **i ); HRESULT CreatePixelShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11PixelShader **ppPixelShader + [in] const void *a, + [in] SIZE_T b, + [in] ID3D11ClassLinkage *c, + [out] ID3D11PixelShader **d ); HRESULT CreateHullShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11HullShader **ppHullShader + [in] const void *a, + [in] SIZE_T b, + [in] ID3D11ClassLinkage *c, + [out] ID3D11HullShader **d ); HRESULT CreateDomainShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11DomainShader **ppDomainShader + [in] const void *a, + [in] SIZE_T b, + [in] ID3D11ClassLinkage *c, + [out] ID3D11DomainShader **d ); HRESULT CreateComputeShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] ID3D11ClassLinkage *pClassLinkage, - [out] ID3D11ComputeShader **ppComputeShader + [in] const void *a, + [in] SIZE_T b, + [in] ID3D11ClassLinkage *c, + [out] ID3D11ComputeShader **d ); HRESULT CreateClassLinkage( - [out] ID3D11ClassLinkage **ppLinkage + [out] ID3D11ClassLinkage **a ); HRESULT CreateBlendState( - [in] const D3D11_BLEND_DESC *pBlendStateDesc, - [out] ID3D11BlendState **ppBlendState + [in] const D3D11_BLEND_DESC *a, + [out] ID3D11BlendState **b ); HRESULT CreateDepthStencilState( - [in] const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, - [out] ID3D11DepthStencilState **ppDepthStencilState + [in] const D3D11_DEPTH_STENCIL_DESC *a, + [out] ID3D11DepthStencilState **b ); HRESULT CreateRasterizerState( - [in] const D3D11_RASTERIZER_DESC *pRasterizerDesc, - [out] ID3D11RasterizerState **ppRasterizerState + [in] const D3D11_RASTERIZER_DESC *a, + [out] ID3D11RasterizerState **b ); HRESULT CreateSamplerState( - [in] const D3D11_SAMPLER_DESC *pSamplerDesc, - [out] ID3D11SamplerState **ppSamplerState + [in] const D3D11_SAMPLER_DESC *a, + [out] ID3D11SamplerState **b ); HRESULT CreateQuery( - [in] const D3D11_QUERY_DESC *pQueryDesc, - [out] ID3D11Query **ppQuery + [in] const D3D11_QUERY_DESC *a, + [out] ID3D11Query **b ); HRESULT CreatePredicate( - [in] const D3D11_QUERY_DESC *pPredicateDesc, - [out] ID3D11Predicate **ppPredicate + [in] const D3D11_QUERY_DESC *a, + [out] ID3D11Predicate **b ); HRESULT CreateCounter( - [in] const D3D11_COUNTER_DESC *pCounterDesc, - [out] ID3D11Counter **ppCounter + [in] const D3D11_COUNTER_DESC *a, + [out] ID3D11Counter **b ); HRESULT CreateDeferredContext( - [in] UINT ContextFlags, - [out] ID3D11DeviceContext **ppDeferredContext + [in] UINT a, + [out] ID3D11DeviceContext **b ); HRESULT OpenSharedResource( - [in] HANDLE hResource, - [in] REFIID ReturnedInterface, - [out] void **ppResource + [in] HANDLE a, + [in] REFIID b, + [out] void **c ); HRESULT CheckFormatSupport( - [in] DXGI_FORMAT Format, - [out] UINT *pFormatSupport + [in] DXGI_FORMAT a, + [out] UINT *b ); HRESULT CheckMultisampleQualityLevels( - [in] DXGI_FORMAT Format, - [in] UINT SampleCount, - [out] UINT *pNumQualityLevels + [in] DXGI_FORMAT a, + [in] UINT b, + [out] UINT *c ); void CheckCounterInfo( - [out] D3D11_COUNTER_INFO *pCounterInfo + [out] D3D11_COUNTER_INFO *a ); HRESULT CheckCounter( - [in] const D3D11_COUNTER_DESC *pDesc, - [out] D3D11_COUNTER_TYPE *pType, - [out] UINT *pActiveCounters, - [out] LPSTR szName, - [in, out, optional] UINT *pNameLength, - [out] LPSTR szUnits, - [in, out, optional] UINT *pUnitsLength, - [out] LPSTR szDescription, - [in, out, optional] UINT *pDescriptionLength + [in] const D3D11_COUNTER_DESC *a, + [out] D3D11_COUNTER_TYPE *b, + [out] UINT *c, + [out] LPSTR d, + [in, out, optional] UINT *e, + [out] LPSTR f, + [in, out, optional] UINT *g, + [out] LPSTR h, + [in, out, optional] UINT *i ); HRESULT CheckFeatureSupport( - [in] D3D11_FEATURE Feature, - [out] void *pFeatureSupportData, - [in] UINT FeatureSupportDataSize + [in] D3D11_FEATURE a, + [out] void *b, + [in] UINT c ); HRESULT GetPrivateData( - [in] REFGUID guid, - [in, out] UINT *pDataSize, - [out] void *pData + [in] REFGUID a, + [in, out] UINT *b, + [out] void *c ); HRESULT SetPrivateData( - [in] REFGUID guid, - [in] UINT DataSize, - [in] const void *pData + [in] REFGUID a, + [in] UINT b, + [in] const void *c ); HRESULT SetPrivateDataInterface( - [in] REFGUID guid, - [in] const IUnknown *pData + [in] REFGUID a, + [in] const IUnknown *b ); D3D_FEATURE_LEVEL GetFeatureLevel(); @@ -1802,11 +1802,11 @@ interface ID3D11Device : IUnknown HRESULT GetDeviceRemovedReason(); void GetImmediateContext( - [out] ID3D11DeviceContext **ppImmediateContext + [out] ID3D11DeviceContext **a ); HRESULT SetExceptionMode( - [in] UINT RaiseFlags + [in] UINT a ); UINT GetExceptionMode(); @@ -1816,607 +1816,607 @@ interface ID3D11Device : IUnknown interface ID3D11DeviceContext : ID3D11DeviceChild { void VSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppConstantBuffers + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c ); void PSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [in] ID3D11ShaderResourceView *const *c ); void PSSetShader( - [in] ID3D11PixelShader *pPixelShader, - [in] ID3D11ClassInstance *const *ppClassInstances, - [in] UINT NumClassInstances + [in] ID3D11PixelShader *a, + [in] ID3D11ClassInstance *const *b, + [in] UINT c ); void PSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D11SamplerState *const *ppSamplers + [in] UINT a, + [in] UINT b, + [in] ID3D11SamplerState *const *c ); void VSSetShader( - [in] ID3D11VertexShader *pVertexShader, - [in] ID3D11ClassInstance *const *ppClassInstances, - [in] UINT NumClassInstances + [in] ID3D11VertexShader *a, + [in] ID3D11ClassInstance *const *b, + [in] UINT c ); void DrawIndexed( - [in] UINT IndexCount, - [in] UINT StartIndexLocation, - [in] INT BaseVertexLocation + [in] UINT a, + [in] UINT b, + [in] INT c ); void Draw( - [in] UINT VertexCount, - [in] UINT StartVertexLocation + [in] UINT a, + [in] UINT b ); HRESULT Map( - [in] ID3D11Resource *pResource, - [in] UINT Subresource, - [in] D3D11_MAP MapType, - [in] UINT MapFlags, - [out] D3D11_MAPPED_SUBRESOURCE *pMappedResource + [in] ID3D11Resource *a, + [in] UINT b, + [in] D3D11_MAP c, + [in] UINT d, + [out] D3D11_MAPPED_SUBRESOURCE *e ); void Unmap( - [in] ID3D11Resource *pResource, - [in] UINT Subresource + [in] ID3D11Resource *a, + [in] UINT b ); void PSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppConstantBuffers + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c ); void IASetInputLayout( - [in] ID3D11InputLayout *pInputLayout + [in] ID3D11InputLayout *a ); void IASetVertexBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppVertexBuffers, - [in] const UINT *pStrides, - [in] const UINT *pOffsets + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c, + [in] const UINT *d, + [in] const UINT *e ); void IASetIndexBuffer( - [in] ID3D11Buffer *pIndexBuffer, - [in] DXGI_FORMAT Format, - [in] UINT Offset + [in] ID3D11Buffer *a, + [in] DXGI_FORMAT b, + [in] UINT c ); void DrawIndexedInstanced( - [in] UINT IndexCountPerInstance, - [in] UINT InstanceCount, - [in] UINT StartIndexLocation, - [in] INT BaseVertexLocation, - [in] UINT StartInstanceLocation + [in] UINT a, + [in] UINT b, + [in] UINT c, + [in] INT d, + [in] UINT e ); void DrawInstanced( - [in] UINT VertexCountPerInstance, - [in] UINT InstanceCount, - [in] UINT StartVertexLocation, - [in] UINT StartInstanceLocation + [in] UINT a, + [in] UINT b, + [in] UINT c, + [in] UINT d ); void GSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppConstantBuffers + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c ); void GSSetShader( - [in] ID3D11GeometryShader *pShader, - [in] ID3D11ClassInstance *const *ppClassInstances, - [in] UINT NumClassInstances + [in] ID3D11GeometryShader *a, + [in] ID3D11ClassInstance *const *b, + [in] UINT c ); void IASetPrimitiveTopology( - [in] D3D11_PRIMITIVE_TOPOLOGY Topology + [in] D3D11_PRIMITIVE_TOPOLOGY a ); void VSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [in] ID3D11ShaderResourceView *const *c ); void VSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D11SamplerState *const *ppSamplers + [in] UINT a, + [in] UINT b, + [in] ID3D11SamplerState *const *c ); void Begin( - [in] ID3D11Asynchronous *pAsync + [in] ID3D11Asynchronous *a ); void End( - [in] ID3D11Asynchronous *pAsync + [in] ID3D11Asynchronous *a ); HRESULT GetData( - [in] ID3D11Asynchronous *pAsync, - [out] void *pData, - [in] UINT DataSize, - [in] UINT GetDataFlags + [in] ID3D11Asynchronous *a, + [out] void *b, + [in] UINT c, + [in] UINT d ); void SetPredication( - [in] ID3D11Predicate *pPredicate, - [in] BOOL PredicateValue + [in] ID3D11Predicate *a, + [in] BOOL b ); void GSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [in] ID3D11ShaderResourceView *const *c ); void GSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D11SamplerState *const *ppSamplers + [in] UINT a, + [in] UINT b, + [in] ID3D11SamplerState *const *c ); void OMSetRenderTargets( - [in] UINT NumViews, - [in] ID3D11RenderTargetView *const *ppRenderTargetViews, - [in] ID3D11DepthStencilView *pDepthStencilView + [in] UINT a, + [in] ID3D11RenderTargetView *const *b, + [in] ID3D11DepthStencilView *c ); void OMSetRenderTargetsAndUnorderedAccessViews( - [in] UINT NumRTVs, - [in] ID3D11RenderTargetView *const *ppRenderTargetViews, - [in] ID3D11DepthStencilView *pDepthStencilView, - [in] UINT UAVStartSlot, - [in] UINT NumUAVs, - [in] ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - [in] const UINT *pUAVInitialCounts + [in] UINT a, + [in] ID3D11RenderTargetView *const *b, + [in] ID3D11DepthStencilView *c, + [in] UINT d, + [in] UINT e, + [in] ID3D11UnorderedAccessView *const *f, + [in] const UINT *g ); void OMSetBlendState( - [in] ID3D11BlendState *pBlendState, - [in] const FLOAT BlendFactor[ 4 ], - [in] UINT SampleMask + [in] ID3D11BlendState *a, + [in] const FLOAT b[4], + [in] UINT c ); void OMSetDepthStencilState( - [in] ID3D11DepthStencilState *pDepthStencilState, - [in] UINT StencilRef + [in] ID3D11DepthStencilState *a, + [in] UINT b ); void SOSetTargets( - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppSOTargets, - [in] const UINT *pOffsets + [in] UINT a, + [in] ID3D11Buffer *const *b, + [in] const UINT *c ); void DrawAuto( ); void DrawIndexedInstancedIndirect( - [in] ID3D11Buffer *pBufferForArgs, - [in] UINT AlignedByteOffsetForArgs + [in] ID3D11Buffer *a, + [in] UINT b ); void DrawInstancedIndirect( - [in] ID3D11Buffer *pBufferForArgs, - [in] UINT AlignedByteOffsetForArgs + [in] ID3D11Buffer *a, + [in] UINT b ); void Dispatch( - [in] UINT ThreadGroupCountX, - [in] UINT ThreadGroupCountY, - [in] UINT ThreadGroupCountZ + [in] UINT a, + [in] UINT b, + [in] UINT c ); void DispatchIndirect( - [in] ID3D11Buffer *pBufferForArgs, - [in] UINT AlignedByteOffsetForArgs + [in] ID3D11Buffer *a, + [in] UINT b ); void RSSetState( - [in] ID3D11RasterizerState *pRasterizerState + [in] ID3D11RasterizerState *a ); void RSSetViewports( - [in] UINT NumViewports, - [in] const D3D11_VIEWPORT *pViewports + [in] UINT a, + [in] const D3D11_VIEWPORT *b ); void RSSetScissorRects( - [in] UINT NumRects, - [in] const D3D11_RECT *pRects + [in] UINT a, + [in] const D3D11_RECT *b ); void CopySubresourceRegion( - [in] ID3D11Resource *pDstResource, - [in] UINT DstSubresource, - [in] UINT DstX, - [in] UINT DstY, - [in] UINT DstZ, - [in] ID3D11Resource *pSrcResource, - [in] UINT SrcSubresource, - [in] const D3D11_BOX *pSrcBox + [in] ID3D11Resource *a, + [in] UINT b, + [in] UINT c, + [in] UINT d, + [in] UINT e, + [in] ID3D11Resource *f, + [in] UINT g, + [in] const D3D11_BOX *h ); void CopyResource( - [in] ID3D11Resource *pDstResource, - [in] ID3D11Resource *pSrcResource + [in] ID3D11Resource *a, + [in] ID3D11Resource *b ); void UpdateSubresource( - [in] ID3D11Resource *pDstResource, - [in] UINT DstSubresource, - [in] const D3D11_BOX *pDstBox, - [in] const void *pSrcData, - [in] UINT SrcRowPitch, - [in] UINT SrcDepthPitch + [in] ID3D11Resource *a, + [in] UINT b, + [in] const D3D11_BOX *c, + [in] const void *d, + [in] UINT e, + [in] UINT f ); void CopyStructureCount( - [in] ID3D11Buffer *pDstBuffer, - [in] UINT DstAlignedByteOffset, - [in] ID3D11UnorderedAccessView *pSrcView + [in] ID3D11Buffer *a, + [in] UINT b, + [in] ID3D11UnorderedAccessView *c ); void ClearRenderTargetView( - [in] ID3D11RenderTargetView *pRenderTargetView, - [in] const FLOAT ColorRGBA[ 4 ] + [in] ID3D11RenderTargetView *a, + [in] const FLOAT b[4] ); void ClearUnorderedAccessViewUint( - [in] ID3D11UnorderedAccessView *pUnorderedAccessView, - [in] const UINT Values[ 4 ] + [in] ID3D11UnorderedAccessView *a, + [in] const UINT b[4] ); void ClearUnorderedAccessViewFloat( - [in] ID3D11UnorderedAccessView *pUnorderedAccessView, - [in] const FLOAT Values[ 4 ] + [in] ID3D11UnorderedAccessView *a, + [in] const FLOAT b[4] ); void ClearDepthStencilView( - [in] ID3D11DepthStencilView *pDepthStencilView, - [in] UINT ClearFlags, - [in] FLOAT Depth, - [in] UINT8 Stencil + [in] ID3D11DepthStencilView *a, + [in] UINT b, + [in] FLOAT c, + [in] UINT8 d ); void GenerateMips( - [in] ID3D11ShaderResourceView *pShaderResourceView + [in] ID3D11ShaderResourceView *a ); void SetResourceMinLOD( - [in] ID3D11Resource *pResource, - [in] FLOAT MinLOD + [in] ID3D11Resource *a, + [in] FLOAT b ); FLOAT GetResourceMinLOD( - [in] ID3D11Resource *pResource + [in] ID3D11Resource *a ); void ResolveSubresource( - [in] ID3D11Resource *pDstResource, - [in] UINT DstSubresource, - [in] ID3D11Resource *pSrcResource, - [in] UINT SrcSubresource, - [in] DXGI_FORMAT Format + [in] ID3D11Resource *a, + [in] UINT b, + [in] ID3D11Resource *c, + [in] UINT d, + [in] DXGI_FORMAT e ); void ExecuteCommandList( - [in] ID3D11CommandList *pCommandList, - [in] BOOL RestoreContextState + [in] ID3D11CommandList *a, + [in] BOOL b ); void HSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [in] ID3D11ShaderResourceView *const *c ); void HSSetShader( - [in] ID3D11HullShader *pHullShader, - [in] ID3D11ClassInstance *const *ppClassInstances, - [in] UINT NumClassInstances + [in] ID3D11HullShader *a, + [in] ID3D11ClassInstance *const *b, + [in] UINT c ); void HSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D11SamplerState *const *ppSamplers + [in] UINT a, + [in] UINT b, + [in] ID3D11SamplerState *const *c ); void HSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppConstantBuffers + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c ); void DSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [in] ID3D11ShaderResourceView *const *c ); void DSSetShader( - [in] ID3D11DomainShader *pDomainShader, - [in] ID3D11ClassInstance *const *ppClassInstances, - [in] UINT NumClassInstances + [in] ID3D11DomainShader *a, + [in] ID3D11ClassInstance *const *b, + [in] UINT c ); void DSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D11SamplerState *const *ppSamplers + [in] UINT a, + [in] UINT b, + [in] ID3D11SamplerState *const *c ); void DSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppConstantBuffers + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c ); void CSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D11ShaderResourceView *const *ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [in] ID3D11ShaderResourceView *const *c ); void CSSetUnorderedAccessViews( - [in] UINT StartSlot, - [in] UINT NumUAVs, - [in] ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - [in] const UINT *pUAVInitialCounts + [in] UINT a, + [in] UINT b, + [in] ID3D11UnorderedAccessView *const *c, + [in] const UINT *d ); void CSSetShader( - [in] ID3D11ComputeShader *pComputeShader, - [in] ID3D11ClassInstance *const *ppClassInstances, - [in] UINT NumClassInstances + [in] ID3D11ComputeShader *a, + [in] ID3D11ClassInstance *const *b, + [in] UINT c ); void CSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D11SamplerState *const *ppSamplers + [in] UINT a, + [in] UINT b, + [in] ID3D11SamplerState *const *c ); void CSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D11Buffer *const *ppConstantBuffers + [in] UINT a, + [in] UINT b, + [in] ID3D11Buffer *const *c ); void VSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppConstantBuffers + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c ); void PSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D11ShaderResourceView **ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [out] ID3D11ShaderResourceView **c ); void PSGetShader( - [out] ID3D11PixelShader **ppPixelShader, - [out] ID3D11ClassInstance **ppClassInstances, - [in, out, optional] UINT *pNumClassInstances + [out] ID3D11PixelShader **a, + [out] ID3D11ClassInstance **b, + [in, out, optional] UINT *c ); void PSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D11SamplerState **ppSamplers + [in] UINT a, + [in] UINT b, + [out] ID3D11SamplerState **c ); void VSGetShader( - [out] ID3D11VertexShader **ppVertexShader, - [out] ID3D11ClassInstance **ppClassInstances, - [in, out, optional] UINT *pNumClassInstances + [out] ID3D11VertexShader **a, + [out] ID3D11ClassInstance **b, + [in, out, optional] UINT *c ); void PSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppConstantBuffers + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c ); void IAGetInputLayout( - [out] ID3D11InputLayout **ppInputLayout + [out] ID3D11InputLayout **a ); void IAGetVertexBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppVertexBuffers, - [out] UINT *pStrides, - [out] UINT *pOffsets + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c, + [out] UINT *d, + [out] UINT *e ); void IAGetIndexBuffer( - [out] ID3D11Buffer **pIndexBuffer, - [out] DXGI_FORMAT *Format, - [out] UINT *Offset + [out] ID3D11Buffer **a, + [out] DXGI_FORMAT *b, + [out] UINT *c ); void GSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppConstantBuffers + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c ); void GSGetShader( - [out] ID3D11GeometryShader **ppGeometryShader, - [out] ID3D11ClassInstance **ppClassInstances, - [in, out, optional] UINT *pNumClassInstances + [out] ID3D11GeometryShader **a, + [out] ID3D11ClassInstance **b, + [in, out, optional] UINT *c ); void IAGetPrimitiveTopology( - [out] D3D11_PRIMITIVE_TOPOLOGY *pTopology + [out] D3D11_PRIMITIVE_TOPOLOGY *a ); void VSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D11ShaderResourceView **ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [out] ID3D11ShaderResourceView **c ); void VSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D11SamplerState **ppSamplers + [in] UINT a, + [in] UINT b, + [out] ID3D11SamplerState **c ); void GetPredication( - [out] ID3D11Predicate **ppPredicate, - [out] BOOL *pPredicateValue + [out] ID3D11Predicate **a, + [out] BOOL *b ); void GSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D11ShaderResourceView **ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [out] ID3D11ShaderResourceView **c ); void GSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D11SamplerState **ppSamplers + [in] UINT a, + [in] UINT b, + [out] ID3D11SamplerState **c ); void OMGetRenderTargets( - [in] UINT NumViews, - [out] ID3D11RenderTargetView **ppRenderTargetViews, - [out] ID3D11DepthStencilView **ppDepthStencilView + [in] UINT a, + [out] ID3D11RenderTargetView **b, + [out] ID3D11DepthStencilView **c ); void OMGetRenderTargetsAndUnorderedAccessViews( - [in] UINT NumRTVs, - [out] ID3D11RenderTargetView **ppRenderTargetViews, - [out] ID3D11DepthStencilView **ppDepthStencilView, - [in] UINT UAVStartSlot, - [in] UINT NumUAVs, - [out] ID3D11UnorderedAccessView **ppUnorderedAccessViews + [in] UINT a, + [out] ID3D11RenderTargetView **b, + [out] ID3D11DepthStencilView **c, + [in] UINT d, + [in] UINT e, + [out] ID3D11UnorderedAccessView **f ); void OMGetBlendState( - [out] ID3D11BlendState **ppBlendState, - [out] FLOAT BlendFactor[ 4 ], - [out] UINT *pSampleMask + [out] ID3D11BlendState **a, + [out] FLOAT b[4], + [out] UINT *c ); void OMGetDepthStencilState( - [out] ID3D11DepthStencilState **ppDepthStencilState, - [out] UINT *pStencilRef + [out] ID3D11DepthStencilState **a, + [out] UINT *b ); void SOGetTargets( - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppSOTargets + [in] UINT a, + [out] ID3D11Buffer **b ); void RSGetState( - [out] ID3D11RasterizerState **ppRasterizerState + [out] ID3D11RasterizerState **a ); void RSGetViewports( - [in, out] /*_range*/ UINT *pNumViewports, - [out] D3D11_VIEWPORT *pViewports + [in, out] UINT *a, + [out] D3D11_VIEWPORT *b ); void RSGetScissorRects( - [in, out] /*_range*/ UINT *pNumRects, - [out] D3D11_RECT *pRects + [in, out] UINT *a, + [out] D3D11_RECT *b ); void HSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D11ShaderResourceView **ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [out] ID3D11ShaderResourceView **c ); void HSGetShader( - [out] ID3D11HullShader **ppHullShader, - [out] ID3D11ClassInstance **ppClassInstances, - [in, out, optional] UINT *pNumClassInstances + [out] ID3D11HullShader **a, + [out] ID3D11ClassInstance **b, + [in, out, optional] UINT *c ); void HSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D11SamplerState **ppSamplers + [in] UINT a, + [in] UINT b, + [out] ID3D11SamplerState **c ); void HSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppConstantBuffers + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c ); void DSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D11ShaderResourceView **ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [out] ID3D11ShaderResourceView **c ); void DSGetShader( - [out] ID3D11DomainShader **ppDomainShader, - [out] ID3D11ClassInstance **ppClassInstances, - [in, out, optional] UINT *pNumClassInstances + [out] ID3D11DomainShader **a, + [out] ID3D11ClassInstance **b, + [in, out, optional] UINT *c ); void DSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D11SamplerState **ppSamplers + [in] UINT a, + [in] UINT b, + [out] ID3D11SamplerState **c ); void DSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppConstantBuffers + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c ); void CSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D11ShaderResourceView **ppShaderResourceViews + [in] UINT a, + [in] UINT b, + [out] ID3D11ShaderResourceView **c ); void CSGetUnorderedAccessViews( - [in] UINT StartSlot, - [in] UINT NumUAVs, - [out] ID3D11UnorderedAccessView **ppUnorderedAccessViews + [in] UINT a, + [in] UINT b, + [out] ID3D11UnorderedAccessView **c ); void CSGetShader( - [out] ID3D11ComputeShader **ppComputeShader, - [out] ID3D11ClassInstance **ppClassInstances, - [in, out, optional] UINT *pNumClassInstances + [out] ID3D11ComputeShader **a, + [out] ID3D11ClassInstance **b, + [in, out, optional] UINT *c ); void CSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D11SamplerState **ppSamplers + [in] UINT a, + [in] UINT b, + [out] ID3D11SamplerState **c ); void CSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D11Buffer **ppConstantBuffers + [in] UINT a, + [in] UINT b, + [out] ID3D11Buffer **c ); void ClearState(); @@ -2428,8 +2428,8 @@ interface ID3D11DeviceContext : ID3D11DeviceChild UINT GetContextFlags(); HRESULT FinishCommandList( - [in] BOOL RestoreDeferredContextState, - [out] ID3D11CommandList **ppCommandList + [in] BOOL a, + [out] ID3D11CommandList **b ); }; @@ -2449,44 +2449,44 @@ typedef enum D3D11_CREATE_DEVICE_FLAG HRESULT D3D11CreateDevice( - [in,optional] IDXGIAdapter* pAdapter, - [in] D3D_DRIVER_TYPE DriverType, - [in] HMODULE Software, - [in] UINT Flags, - [in,optional] const D3D_FEATURE_LEVEL* pFeatureLevels, - [in] UINT FeatureLevels, - [in] UINT SDKVersion, - [out,optional] ID3D11Device** ppDevice, - [out,optional] D3D_FEATURE_LEVEL* pFeatureLevel, - [out,optional] ID3D11DeviceContext** ppImmediateContext + [in,optional] IDXGIAdapter* a, + [in] D3D_DRIVER_TYPE b, + [in] HMODULE c, + [in] UINT d, + [in,optional] const D3D_FEATURE_LEVEL* e, + [in] UINT f, + [in] UINT g, + [out,optional] ID3D11Device** h, + [out,optional] D3D_FEATURE_LEVEL* i, + [out,optional] ID3D11DeviceContext** j ); typedef HRESULT (* PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)( - [in,optional] IDXGIAdapter*, + [in,optional] IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, - [in,optional] const D3D_FEATURE_LEVEL*, + [in,optional] const D3D_FEATURE_LEVEL*, UINT, UINT, - [in, optional] const DXGI_SWAP_CHAIN_DESC*, + [in, optional] const DXGI_SWAP_CHAIN_DESC*, [out,optional] IDXGISwapChain**, - [out,optional] ID3D11Device**, + [out,optional] ID3D11Device**, [out,optional] D3D_FEATURE_LEVEL*, [out,optional] ID3D11DeviceContext** ); HRESULT D3D11CreateDeviceAndSwapChain( - [in,optional] IDXGIAdapter* pAdapter, - [in] D3D_DRIVER_TYPE DriverType, - [in] HMODULE Software, - [in] UINT Flags, - [in,optional] const D3D_FEATURE_LEVEL* pFeatureLevels, - [in] UINT FeatureLevels, - [in] UINT SDKVersion, - [in,optional] const DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, - [out,optional] IDXGISwapChain** ppSwapChain, - [out,optional] ID3D11Device** ppDevice, - [out,optional] D3D_FEATURE_LEVEL* pFeatureLevel, - [out,optional] ID3D11DeviceContext** ppImmediateContext + [in,optional] IDXGIAdapter* a, + [in] D3D_DRIVER_TYPE b, + [in] HMODULE c, + [in] UINT d, + [in,optional] const D3D_FEATURE_LEVEL* e, + [in] UINT f, + [in] UINT g, + [in,optional] const DXGI_SWAP_CHAIN_DESC* h, + [out,optional] IDXGISwapChain** i, + [out,optional] ID3D11Device** j, + [out,optional] D3D_FEATURE_LEVEL* k, + [out,optional] ID3D11DeviceContext** l ); diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl index cf4ae1b68ee..bb20d91053e 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11shader.idl @@ -156,35 +156,35 @@ typedef struct _D3D11_SHADER_INPUT_BIND_DESC interface ID3D11ShaderReflectionType { HRESULT GetDesc( - [out] D3D11_SHADER_TYPE_DESC *pDesc + [out] D3D11_SHADER_TYPE_DESC *a ); ID3D11ShaderReflectionType* GetMemberTypeByIndex( - [in] UINT Index + [in] UINT a ); ID3D11ShaderReflectionType* GetMemberTypeByName( - [in] LPCSTR Name + [in] LPCSTR a ); LPCSTR GetMemberTypeName( - [in] UINT Index + [in] UINT a ); HRESULT IsEqual( - [in] ID3D11ShaderReflectionType* pType + [in] ID3D11ShaderReflectionType* a ); ID3D11ShaderReflectionType* GetSubType(); ID3D11ShaderReflectionType* GetBaseClass(); UINT GetNumInterfaces(); ID3D11ShaderReflectionType* GetInterfaceByIndex( - [in] UINT uIndex + [in] UINT a ); HRESULT IsOfType( - [in] ID3D11ShaderReflectionType* pType + [in] ID3D11ShaderReflectionType* a ); HRESULT ImplementsInterface( - [in] ID3D11ShaderReflectionType* pBase + [in] ID3D11ShaderReflectionType* a ); }; @@ -194,14 +194,14 @@ interface ID3D11ShaderReflectionConstantBuffer; interface ID3D11ShaderReflectionVariable { HRESULT GetDesc( - [out] D3D11_SHADER_VARIABLE_DESC *pDesc + [out] D3D11_SHADER_VARIABLE_DESC *a ); ID3D11ShaderReflectionType* GetType(); ID3D11ShaderReflectionConstantBuffer* GetBuffer(); UINT GetInterfaceSlot( - [in] UINT uArrayIndex + [in] UINT a ); }; @@ -209,15 +209,15 @@ interface ID3D11ShaderReflectionVariable interface ID3D11ShaderReflectionConstantBuffer { HRESULT GetDesc( - [out] D3D11_SHADER_BUFFER_DESC *pDesc + [out] D3D11_SHADER_BUFFER_DESC *a ); ID3D11ShaderReflectionVariable* GetVariableByIndex( - [in] UINT Index + [in] UINT a ); ID3D11ShaderReflectionVariable* GetVariableByName( - [in] LPCSTR Name + [in] LPCSTR a ); }; @@ -225,45 +225,45 @@ interface ID3D11ShaderReflectionConstantBuffer interface ID3D11ShaderReflection { HRESULT GetDesc( - [out] D3D11_SHADER_DESC *pDesc + [out] D3D11_SHADER_DESC *a ); ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByIndex( - [in] UINT Index + [in] UINT a ); ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByName( - [in] LPCSTR Name + [in] LPCSTR a ); HRESULT GetResourceBindingDesc( - [in] UINT ResourceIndex, - [out] D3D11_SHADER_INPUT_BIND_DESC *pDesc + [in] UINT a, + [out] D3D11_SHADER_INPUT_BIND_DESC *b ); HRESULT GetInputParameterDesc( - [in] UINT ParameterIndex, - [out] D3D11_SIGNATURE_PARAMETER_DESC *pDesc + [in] UINT a, + [out] D3D11_SIGNATURE_PARAMETER_DESC *b ); HRESULT GetOutputParameterDesc ( - [in] UINT ParameterIndex, - [out] D3D11_SIGNATURE_PARAMETER_DESC *pDesc + [in] UINT a, + [out] D3D11_SIGNATURE_PARAMETER_DESC *b ); HRESULT GetPatchConstantParameterDesc( - [in] UINT ParameterIndex, - [out] D3D11_SIGNATURE_PARAMETER_DESC *pDesc + [in] UINT a, + [out] D3D11_SIGNATURE_PARAMETER_DESC *b ); ID3D11ShaderReflectionVariable* GetVariableByName( - [in] LPCSTR Name + [in] LPCSTR a ); HRESULT GetResourceBindingDescByName( - [in] LPCSTR Name, - [out] D3D11_SHADER_INPUT_BIND_DESC *pDesc + [in] LPCSTR a, + [out] D3D11_SHADER_INPUT_BIND_DESC *b ); UINT GetMovInstructionCount(); @@ -275,13 +275,13 @@ interface ID3D11ShaderReflection UINT GetNumInterfaceSlots(); HRESULT GetMinFeatureLevel( - [out] D3D_FEATURE_LEVEL* pLevel + [out] D3D_FEATURE_LEVEL* a ); UINT GetThreadGroupSize( - [out,optional] UINT* pSizeX, - [out,optional] UINT* pSizeY, - [out,optional] UINT* pSizeZ + [out,optional] UINT* a, + [out,optional] UINT* b, + [out,optional] UINT* c ); }; diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl index d95a351eaf2..dd901431684 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3dcommon.idl @@ -333,14 +333,14 @@ typedef enum _D3D_INCLUDE_TYPE interface ID3DInclude : IUnknown { HRESULT Open( - [in] D3D_INCLUDE_TYPE IncludeType, - [in] LPCSTR pFileName, - [in] LPCVOID pParentData, - [out] LPCVOID *ppData, - [in] UINT *pBytes + [in] D3D_INCLUDE_TYPE a, + [in] LPCSTR b, + [in] LPCVOID c, + [out] LPCVOID *d, + [in] UINT *e ); HRESULT Close( - [in] LPCVOID pData + [in] LPCVOID a ); }; diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl b/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl index 247a7ddd11f..86ef261f671 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl @@ -135,22 +135,22 @@ typedef struct DXGI_SHARED_RESOURCE { interface IDXGIObject : IUnknown { HRESULT SetPrivateData( - [in] REFGUID guid, - [in] UINT data_size, - [in] const void *data + [in] REFGUID a, + [in] UINT b, + [in] const void *c ); HRESULT SetPrivateDataInterface( - [in] REFGUID guid, - [in] const IUnknown *object + [in] REFGUID a, + [in] const IUnknown *b ); HRESULT GetPrivateData( - [in] REFGUID guid, - [in, out] UINT *data_size, - [out] void *data + [in] REFGUID a, + [in, out] UINT *b, + [out] void *c ); HRESULT GetParent( - [in] REFIID riid, - [out] void **parent + [in] REFIID a, + [out] void **b ); } @@ -162,8 +162,8 @@ interface IDXGIObject : IUnknown interface IDXGIDeviceSubObject : IDXGIObject { HRESULT GetDevice( - [in] REFIID riid, - [out] void **device + [in] REFIID a, + [out] void **b ); } @@ -175,11 +175,11 @@ interface IDXGIDeviceSubObject : IDXGIObject interface IDXGISurface : IDXGIDeviceSubObject { HRESULT GetDesc( - [out] DXGI_SURFACE_DESC *desc + [out] DXGI_SURFACE_DESC *a ); HRESULT Map( - [out] DXGI_MAPPED_RECT *mapped_rect, - [in] UINT flags + [out] DXGI_MAPPED_RECT *a, + [in] UINT b ); HRESULT Unmap( ); @@ -193,44 +193,44 @@ interface IDXGISurface : IDXGIDeviceSubObject interface IDXGIOutput : IDXGIObject { HRESULT GetDesc( - [out] DXGI_OUTPUT_DESC *desc + [out] DXGI_OUTPUT_DESC *a ); HRESULT GetDisplayModeList( - [in] DXGI_FORMAT format, - [in] UINT flags, - [in, out] UINT *mode_count, - [out] DXGI_MODE_DESC *desc + [in] DXGI_FORMAT a, + [in] UINT b, + [in, out] UINT *c, + [out] DXGI_MODE_DESC *d ); HRESULT FindClosestMatchingMode( - [in] const DXGI_MODE_DESC *mode, - [out] DXGI_MODE_DESC *closest_match, - [in] IUnknown *device + [in] const DXGI_MODE_DESC *a, + [out] DXGI_MODE_DESC *b, + [in] IUnknown *c ); HRESULT WaitForVBlank( ); HRESULT TakeOwnership( - [in] IUnknown *device, - [in] BOOL exclusive + [in] IUnknown *a, + [in] BOOL b ); void ReleaseOwnership( ); HRESULT GetGammaControlCapabilities( - [out] DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps + [out] DXGI_GAMMA_CONTROL_CAPABILITIES *a ); HRESULT SetGammaControl( - [in] const DXGI_GAMMA_CONTROL *gamma_control + [in] const DXGI_GAMMA_CONTROL *a ); HRESULT GetGammaControl( - [out] DXGI_GAMMA_CONTROL *gamma_control + [out] DXGI_GAMMA_CONTROL *a ); HRESULT SetDisplaySurface( - [in] IDXGISurface *surface + [in] IDXGISurface *a ); HRESULT GetDisplaySurfaceData( - [in] IDXGISurface *surface + [in] IDXGISurface *a ); HRESULT GetFrameStatistics( - [out] DXGI_FRAME_STATISTICS *stats + [out] DXGI_FRAME_STATISTICS *a ); } @@ -242,15 +242,15 @@ interface IDXGIOutput : IDXGIObject interface IDXGIAdapter : IDXGIObject { HRESULT EnumOutputs( - [in] UINT output_idx, - [in, out] IDXGIOutput **output + [in] UINT a, + [in, out] IDXGIOutput **b ); HRESULT GetDesc( - [out] DXGI_ADAPTER_DESC *desc + [out] DXGI_ADAPTER_DESC *a ); HRESULT CheckInterfaceSupport( - [in] REFGUID guid, - [out] LARGE_INTEGER *umd_version + [in] REFGUID a, + [out] LARGE_INTEGER *b ); } @@ -262,43 +262,43 @@ interface IDXGIAdapter : IDXGIObject interface IDXGISwapChain : IDXGIDeviceSubObject { HRESULT Present( - [in] UINT sync_interval, - [in] UINT flags + [in] UINT a, + [in] UINT b ); HRESULT GetBuffer( - [in] UINT buffer_idx, - [in] REFIID riid, - [in, out] void **surface + [in] UINT a, + [in] REFIID b, + [in, out] void **c ); HRESULT SetFullscreenState( - [in] BOOL fullscreen, - [in] IDXGIOutput *target + [in] BOOL a, + [in] IDXGIOutput *b ); HRESULT GetFullscreenState( - [out] BOOL *fullscreen, - [out] IDXGIOutput **target + [out] BOOL *a, + [out] IDXGIOutput **b ); HRESULT GetDesc( - [out] DXGI_SWAP_CHAIN_DESC *desc + [out] DXGI_SWAP_CHAIN_DESC *a ); HRESULT ResizeBuffers( - [in] UINT buffer_count, - [in] UINT width, - [in] UINT height, - [in] DXGI_FORMAT format, - [in] UINT flags + [in] UINT a, + [in] UINT b, + [in] UINT c, + [in] DXGI_FORMAT d, + [in] UINT e ); HRESULT ResizeTarget( - [in] const DXGI_MODE_DESC *target_mode_desc + [in] const DXGI_MODE_DESC *a ); HRESULT GetContainingOutput( - [out] IDXGIOutput **output + [out] IDXGIOutput **a ); HRESULT GetFrameStatistics( - [out] DXGI_FRAME_STATISTICS *stats + [out] DXGI_FRAME_STATISTICS *a ); HRESULT GetLastPresentCount( - [out] UINT *last_present_count + [out] UINT *a ); } @@ -310,24 +310,24 @@ interface IDXGISwapChain : IDXGIDeviceSubObject interface IDXGIFactory : IDXGIObject { HRESULT EnumAdapters( - [in] UINT adapter_idx, - [out] IDXGIAdapter **adapter + [in] UINT a, + [out] IDXGIAdapter **b ); HRESULT MakeWindowAssociation( - [in] HWND window, - [in] UINT flags + [in] HWND a, + [in] UINT b ); HRESULT GetWindowAssociation( - [in] HWND *window + [in] HWND *a ); HRESULT CreateSwapChain( - [in] IUnknown *device, - [in] DXGI_SWAP_CHAIN_DESC *desc, - [out] IDXGISwapChain **swapchain + [in] IUnknown *a, + [in] DXGI_SWAP_CHAIN_DESC *b, + [out] IDXGISwapChain **c ); HRESULT CreateSoftwareAdapter( - [in] HMODULE swrast, - [out] IDXGIAdapter **adapter + [in] HMODULE a, + [out] IDXGIAdapter **b ); } @@ -341,25 +341,25 @@ interface IDXGIFactory : IDXGIObject interface IDXGIDevice : IDXGIObject { HRESULT GetAdapter( - [out] IDXGIAdapter **adapter + [out] IDXGIAdapter **a ); HRESULT CreateSurface( - [in] const DXGI_SURFACE_DESC *desc, - [in] UINT surface_count, - [in] DXGI_USAGE usage, - [in] const DXGI_SHARED_RESOURCE *shared_resource, - [out] IDXGISurface **surface + [in] const DXGI_SURFACE_DESC *a, + [in] UINT b, + [in] DXGI_USAGE c, + [in] const DXGI_SHARED_RESOURCE *d, + [out] IDXGISurface **e ); HRESULT QueryResourceResidency( - [in] IUnknown *const *resources, - [out] DXGI_RESIDENCY *residency, - [in] UINT resource_count + [in] IUnknown *const *a, + [out] DXGI_RESIDENCY *b, + [in] UINT c ); HRESULT SetGPUThreadPriority( - [in] INT priority + [in] INT a ); HRESULT GetGPUThreadPriority( - [out] INT *priority + [out] INT *a ); } @@ -407,19 +407,19 @@ typedef struct DXGI_ADAPTER_DESC1 interface IDXGIResource : IDXGIDeviceSubObject { HRESULT GetSharedHandle( - [out] HANDLE *pSharedHandle + [out] HANDLE *a ); HRESULT GetUsage( - [out] DXGI_USAGE *pUsage + [out] DXGI_USAGE *a ); HRESULT SetEvictionPriority( - [in] UINT EvictionPriority + [in] UINT a ); HRESULT GetEvictionPriority( - [out] UINT *pEvictionPriority + [out] UINT *a ); }; @@ -427,12 +427,12 @@ interface IDXGIResource : IDXGIDeviceSubObject interface IDXGISurface1 : IDXGISurface { HRESULT GetDC( - [in] BOOL Discard, - [out] HDC *phdc + [in] BOOL a, + [out] HDC *b ); HRESULT ReleaseDC( - [in, optional] RECT *pDirtyRect + [in, optional] RECT *a ); }; @@ -440,11 +440,11 @@ interface IDXGISurface1 : IDXGISurface interface IDXGIDevice1 : IDXGIDevice { HRESULT SetMaximumFrameLatency( - [in] UINT MaxLatency + [in] UINT a ); HRESULT GetMaximumFrameLatency( - [out] UINT *pMaxLatency + [out] UINT *a ); }; @@ -452,7 +452,7 @@ interface IDXGIDevice1 : IDXGIDevice interface IDXGIAdapter1 : IDXGIAdapter { HRESULT GetDesc1( - [out] DXGI_ADAPTER_DESC1 *pDesc + [out] DXGI_ADAPTER_DESC1 *a ); }; @@ -460,8 +460,8 @@ interface IDXGIAdapter1 : IDXGIAdapter interface IDXGIFactory1 : IDXGIFactory { HRESULT EnumAdapters1( - [in] UINT Adapter, - [out] IDXGIAdapter1 **ppAdapter + [in] UINT a, + [out] IDXGIAdapter1 **b ); BOOL IsCurrent(); -- cgit v1.2.3 From 9a97b9af68ef1e555d7581c1997c947d78b30ca7 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:02:45 +0200 Subject: d3d1x: remove specstrings.h include --- src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h index 0274a1baf66..d4b6a8fc957 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h @@ -41,9 +41,6 @@ #include #include - -#include - extern "C" { #include -- cgit v1.2.3 From 681f87e09bc278924a19fc960809556e607886f1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:02:58 +0200 Subject: d3d1x: flush the pipe context when presenting --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 89be7f5b17b..99d80eae319 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -1139,6 +1139,8 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectscreen->tex_surface_destroy(dst_surface); + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME); + if(db) { if(!surface->swap_buffers(surface)) -- cgit v1.2.3 From 206c4cc8787ca4a635ed0248b8c17e0d833cc526 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:07:33 +0200 Subject: d3d1x: remove another include specstrings.h --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h index 30a69326357..187a0f986a5 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h @@ -37,7 +37,6 @@ #include #include #include -#include struct native_display; -- cgit v1.2.3 From 1734a785384430f022de453dc5cb59b8c4999833 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:08:37 +0200 Subject: d3d1x: flush properly --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 99d80eae319..74bce598ae2 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -1139,7 +1139,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectscreen->tex_surface_destroy(dst_surface); - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME); + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 0); if(db) { -- cgit v1.2.3 From eaf8fe84614f4881ddb03568de11cb4ed3ea5322 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:17:36 +0200 Subject: d3d1x: add missing guid.cpp --- src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp new file mode 100644 index 00000000000..ec45035b825 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp @@ -0,0 +1,6 @@ +#define INITGUID +#include "d3d1xstutil.h" +#include +#include +#include +#include -- cgit v1.2.3 From 36a64bfe541c1c8149db08c559e044dfd835c69a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:18:52 +0200 Subject: d3d1x: fix build without system EGL/egl.h --- src/gallium/state_trackers/d3d1x/dxgi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/Makefile b/src/gallium/state_trackers/d3d1x/dxgi/Makefile index 323f6f7bbe7..6cdc33b8c4b 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/Makefile +++ b/src/gallium/state_trackers/d3d1x/dxgi/Makefile @@ -1,5 +1,5 @@ LIBNAME=dxgi -LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common +LIBRARY_INCLUDES=-I../../../../../include -Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common LIBRARY_DEFINES=-DDXGI_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" CPP_SOURCES=$(wildcard src/*.cpp) -- cgit v1.2.3 From bccd4eb824d32256dd0f9234df9ddf9ab5ed90fd Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:21:14 +0200 Subject: d3d1x: add autogenerated files as prerequisites, so make builds them --- src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 4f67145b6fa..3754c23983a 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile @@ -1,11 +1,13 @@ LIBNAME=d3d1xshader -CPP_SOURCES=$(wildcard src/*.cpp) +CPP_SOURCES=$(wildcard src/*.cpp) src/sm4_text.cpp LIBRARY_INCLUDES=-Iinclude -I../d3dapi -I../w32api PROGS=tools/fxdis LIBS=libd3d1xshader.a include ../Makefile.inc +include/sm4.h: include/sm4_defs.h + include/sm4_defs.h: $(wildcard defs/*.txt) ./gen-header.sh $^ > $@ -- cgit v1.2.3 From 96da9b28c838af00f15d6c0a5973857019d3aecc Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 16:29:29 +0200 Subject: d3d1x: obliterate IDL parameter names from d3d10.idl from Wine too --- src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl | 582 +++++++++++----------- 1 file changed, 291 insertions(+), 291 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl index c371bbea134..91b1abc24ad 100644 --- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl +++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl @@ -912,18 +912,18 @@ interface ID3D10Device; interface ID3D10DeviceChild : IUnknown { void GetDevice( - [out] ID3D10Device **ppDevice); + [out] ID3D10Device **a); HRESULT GetPrivateData( - [in] REFGUID guid, - [in, out] UINT *pDataSize, - [out] void *pData); + [in] REFGUID a, + [in, out] UINT *b, + [out] void *c); HRESULT SetPrivateData( - [in] REFGUID guid, - [in] UINT DataSize, - [in] const void *pData); + [in] REFGUID a, + [in] UINT b, + [in] const void *c); HRESULT SetPrivateDataInterface( - [in] REFGUID guid, - [in] const IUnknown *pData); + [in] REFGUID a, + [in] const IUnknown *b); } /* Resource */ @@ -936,9 +936,9 @@ interface ID3D10DeviceChild : IUnknown interface ID3D10Resource : ID3D10DeviceChild { void GetType( - [out] D3D10_RESOURCE_DIMENSION *rType); + [out] D3D10_RESOURCE_DIMENSION *a); void SetEvictionPriority( - [in] UINT EvictionPriority); + [in] UINT a); UINT GetEvictionPriority(); } @@ -950,12 +950,12 @@ interface ID3D10Resource : ID3D10DeviceChild interface ID3D10Buffer : ID3D10Resource { HRESULT Map( - [in] D3D10_MAP MapType, - [in] UINT MapFlags, - [out] void **ppData); + [in] D3D10_MAP a, + [in] UINT b, + [out] void **c); void Unmap(); void GetDesc( - [out] D3D10_BUFFER_DESC *pDesc); + [out] D3D10_BUFFER_DESC *a); } [ @@ -966,14 +966,14 @@ interface ID3D10Buffer : ID3D10Resource interface ID3D10Texture1D : ID3D10Resource { HRESULT Map( - [in] UINT Subresource, - [in] D3D10_MAP MapType, - [in] UINT MapFlags, - [out] void **ppData); + [in] UINT a, + [in] D3D10_MAP b, + [in] UINT c, + [out] void **d); void Unmap( - [in] UINT Subresource); + [in] UINT a); void GetDesc( - [out] D3D10_TEXTURE1D_DESC *pDesc); + [out] D3D10_TEXTURE1D_DESC *a); } [ @@ -984,14 +984,14 @@ interface ID3D10Texture1D : ID3D10Resource interface ID3D10Texture2D : ID3D10Resource { HRESULT Map( - [in] UINT Subresource, - [in] D3D10_MAP MapType, - [in] UINT MapFlags, - [out] D3D10_MAPPED_TEXTURE2D *pMappedTex2D); + [in] UINT a, + [in] D3D10_MAP b, + [in] UINT c, + [out] D3D10_MAPPED_TEXTURE2D *d); void Unmap( - [in] UINT Subresource); + [in] UINT a); void GetDesc( - [out] D3D10_TEXTURE2D_DESC *pDesc); + [out] D3D10_TEXTURE2D_DESC *a); } [ @@ -1002,14 +1002,14 @@ interface ID3D10Texture2D : ID3D10Resource interface ID3D10Texture3D : ID3D10Resource { HRESULT Map( - [in] UINT Subresource, - [in] D3D10_MAP MapType, - [in] UINT MapFlags, - [out] D3D10_MAPPED_TEXTURE3D *pMappedTex3D); + [in] UINT a, + [in] D3D10_MAP b, + [in] UINT c, + [out] D3D10_MAPPED_TEXTURE3D *d); void Unmap( - [in] UINT Subresource); + [in] UINT a); void GetDesc( - [out] D3D10_TEXTURE3D_DESC *pDesc); + [out] D3D10_TEXTURE3D_DESC *a); } [ @@ -1020,7 +1020,7 @@ interface ID3D10Texture3D : ID3D10Resource interface ID3D10View : ID3D10DeviceChild { void GetResource( - [out] ID3D10Resource **ppResource); + [out] ID3D10Resource **a); } [ @@ -1031,7 +1031,7 @@ interface ID3D10View : ID3D10DeviceChild interface ID3D10DepthStencilView : ID3D10View { void GetDesc( - [out] D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc); + [out] D3D10_DEPTH_STENCIL_VIEW_DESC *a); } @@ -1043,7 +1043,7 @@ interface ID3D10DepthStencilView : ID3D10View interface ID3D10RenderTargetView : ID3D10View { void GetDesc( - [out] D3D10_RENDER_TARGET_VIEW_DESC *pDesc); + [out] D3D10_RENDER_TARGET_VIEW_DESC *a); } [ @@ -1054,7 +1054,7 @@ interface ID3D10RenderTargetView : ID3D10View interface ID3D10ShaderResourceView : ID3D10View { void GetDesc( - [out] D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); + [out] D3D10_SHADER_RESOURCE_VIEW_DESC *a); } /* Resource End */ @@ -1067,7 +1067,7 @@ interface ID3D10ShaderResourceView : ID3D10View interface ID3D10BlendState : ID3D10DeviceChild { void GetDesc( - [out] D3D10_BLEND_DESC *pDesc); + [out] D3D10_BLEND_DESC *a); } [ @@ -1078,7 +1078,7 @@ interface ID3D10BlendState : ID3D10DeviceChild interface ID3D10DepthStencilState : ID3D10DeviceChild { void GetDesc( - [out] D3D10_DEPTH_STENCIL_DESC *pDesc); + [out] D3D10_DEPTH_STENCIL_DESC *a); } [ @@ -1116,7 +1116,7 @@ interface ID3D10PixelShader : ID3D10DeviceChild interface ID3D10RasterizerState : ID3D10DeviceChild { void GetDesc( - [out] D3D10_RASTERIZER_DESC *pDesc); + [out] D3D10_RASTERIZER_DESC *a); } [ @@ -1127,7 +1127,7 @@ interface ID3D10RasterizerState : ID3D10DeviceChild interface ID3D10SamplerState : ID3D10DeviceChild { void GetDesc( - [out] D3D10_SAMPLER_DESC *pDesc); + [out] D3D10_SAMPLER_DESC *a); } [ @@ -1149,9 +1149,9 @@ interface ID3D10Asynchronous : ID3D10DeviceChild void Begin(); void End(); HRESULT GetData( - [out] void *pData, - [in] UINT DataSize, - [in] UINT GetDataFlags); + [out] void *a, + [in] UINT b, + [in] UINT c); UINT GetDataSize(); } @@ -1163,7 +1163,7 @@ interface ID3D10Asynchronous : ID3D10DeviceChild interface ID3D10Counter : ID3D10Asynchronous { void GetDesc( - [out] D3D10_COUNTER_DESC *pDesc); + [out] D3D10_COUNTER_DESC *a); } [ @@ -1174,7 +1174,7 @@ interface ID3D10Counter : ID3D10Asynchronous interface ID3D10Query : ID3D10Asynchronous { void GetDesc( - [out] D3D10_QUERY_DESC *pDesc); + [out] D3D10_QUERY_DESC *a); } [ @@ -1194,344 +1194,344 @@ interface ID3D10Predicate : ID3D10Query interface ID3D10Device : IUnknown { void VSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D10Buffer *const *ppConstantBuffers); + [in] UINT a, + [in] UINT b, + [in] ID3D10Buffer *const *c); void PSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D10ShaderResourceView *const *ppShaderResourceViews); + [in] UINT a, + [in] UINT b, + [in] ID3D10ShaderResourceView *const *c); void PSSetShader( - [in] ID3D10PixelShader *pPixelShader); + [in] ID3D10PixelShader *a); void PSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in]ID3D10SamplerState *const *ppSamplers); + [in] UINT a, + [in] UINT b, + [in]ID3D10SamplerState *const *c); void VSSetShader( - [in] ID3D10VertexShader *pVertexShader); + [in] ID3D10VertexShader *a); void DrawIndexed( - [in] UINT IndexCount, - [in] UINT StartIndexLocation, - [in] INT BaseVertexLocation); + [in] UINT a, + [in] UINT b, + [in] INT c); void Draw( - [in] UINT VertexCount, - [in] UINT StartVertexLocation); + [in] UINT a, + [in] UINT b); void PSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D10Buffer *const *ppConstantBuffers); + [in] UINT a, + [in] UINT b, + [in] ID3D10Buffer *const *c); void IASetInputLayout( - [in] ID3D10InputLayout *pInputLayout); + [in] ID3D10InputLayout *a); void IASetVertexBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D10Buffer *const *ppVertexBuffers, - [in] const UINT *pStrides, - [in] const UINT *pOffsets); + [in] UINT a, + [in] UINT b, + [in] ID3D10Buffer *const *c, + [in] const UINT *d, + [in] const UINT *e); void IASetIndexBuffer( - [in] ID3D10Buffer *pIndexBuffer, - [in] DXGI_FORMAT Format, - [in] UINT Offset); + [in] ID3D10Buffer *a, + [in] DXGI_FORMAT b, + [in] UINT c); void DrawIndexedInstanced( - [in] UINT IndexCountPerInstance, - [in] UINT InstanceCount, - [in] UINT StartIndexLocation, - [in] INT BaseVertexLocation, - [in] UINT StartInstanceLocation); + [in] UINT a, + [in] UINT b, + [in] UINT c, + [in] INT d, + [in] UINT e); void DrawInstanced( - [in] UINT VertexCountPerInstance, - [in] UINT InstanceCount, - [in] UINT StartVertexLocation, - [in] UINT StartInstanceLocation); + [in] UINT a, + [in] UINT b, + [in] UINT c, + [in] UINT d); void GSSetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [in] ID3D10Buffer *const *ppConstantBuffers); + [in] UINT a, + [in] UINT b, + [in] ID3D10Buffer *const *c); void GSSetShader( - [in] ID3D10GeometryShader *pShader); + [in] ID3D10GeometryShader *a); void IASetPrimitiveTopology( - [in] D3D10_PRIMITIVE_TOPOLOGY Topology); + [in] D3D10_PRIMITIVE_TOPOLOGY a); void VSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D10ShaderResourceView *const *ppShaderResourceViews); + [in] UINT a, + [in] UINT b, + [in] ID3D10ShaderResourceView *const *c); void VSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D10SamplerState *const *ppSamplers); + [in] UINT a, + [in] UINT b, + [in] ID3D10SamplerState *const *c); void SetPredication( - [in] ID3D10Predicate *pPredicate, - [in] BOOL PredicateValue); + [in] ID3D10Predicate *a, + [in] BOOL b); void GSSetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [in] ID3D10ShaderResourceView * const *ppShaderResourceViews); + [in] UINT a, + [in] UINT b, + [in] ID3D10ShaderResourceView * const *c); void GSSetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [in] ID3D10SamplerState *const *ppSamplers); + [in] UINT a, + [in] UINT b, + [in] ID3D10SamplerState *const *c); void OMSetRenderTargets( - [in] UINT NumViews, - [in] ID3D10RenderTargetView *const *ppRenderTargetViews, - [in] ID3D10DepthStencilView *pDepthStencilView); + [in] UINT a, + [in] ID3D10RenderTargetView *const *b, + [in] ID3D10DepthStencilView *c); void OMSetBlendState( - [in] ID3D10BlendState *pBlendState, - [in] const FLOAT BlendFactor[4], - [in] UINT SampleMask); + [in] ID3D10BlendState *a, + [in] const FLOAT b[4], + [in] UINT c); void OMSetDepthStencilState( - [in] ID3D10DepthStencilState *pDepthStencilState, - [in] UINT StencilRef); + [in] ID3D10DepthStencilState *a, + [in] UINT b); void SOSetTargets( - [in] UINT NumBuffers, - [in] ID3D10Buffer *const *ppSOTargets, - [in] const UINT *pOffsets); + [in] UINT a, + [in] ID3D10Buffer *const *b, + [in] const UINT *c); void DrawAuto(); void RSSetState( - [in] ID3D10RasterizerState *pRasterizerState); + [in] ID3D10RasterizerState *a); void RSSetViewports( - [in] UINT NumViewports, - [in] const D3D10_VIEWPORT *pViewports); + [in] UINT a, + [in] const D3D10_VIEWPORT *b); void RSSetScissorRects( - [in] UINT NumRects, - [in] const D3D10_RECT *pRects); + [in] UINT a, + [in] const D3D10_RECT *b); void CopySubresourceRegion( - [in] ID3D10Resource *pDstResource, - [in] UINT DstSubresource, - [in] UINT DstX, - [in] UINT DstY, - [in] UINT DstZ, - [in] ID3D10Resource *pSrcResource, - [in] UINT SrcSubresource, - [in] const D3D10_BOX *pSrcBox); + [in] ID3D10Resource *a, + [in] UINT b, + [in] UINT c, + [in] UINT d, + [in] UINT e, + [in] ID3D10Resource *f, + [in] UINT g, + [in] const D3D10_BOX *h); void CopyResource( - [in] ID3D10Resource *pDstResource, - [in] ID3D10Resource *pSrcResource); + [in] ID3D10Resource *a, + [in] ID3D10Resource *b); void UpdateSubresource( - [in] ID3D10Resource *pDstResource, - [in] UINT DstSubresource, - [in] const D3D10_BOX *pDstBox, - [in] const void *pSrcData, - [in] UINT SrcRowPitch, - [in] UINT SrcDepthPitch); + [in] ID3D10Resource *a, + [in] UINT b, + [in] const D3D10_BOX *c, + [in] const void *d, + [in] UINT e, + [in] UINT f); void ClearRenderTargetView( - [in] ID3D10RenderTargetView *pRenderTargetView, - [in] const FLOAT ColorRGBA[4]); + [in] ID3D10RenderTargetView *a, + [in] const FLOAT b[4]); void ClearDepthStencilView( - [in] ID3D10DepthStencilView *pDepthStencilView, - [in] UINT ClearFlags, - [in] FLOAT Depth, - [in] UINT8 Stencil); + [in] ID3D10DepthStencilView *a, + [in] UINT b, + [in] FLOAT c, + [in] UINT8 d); void GenerateMips( - [in] ID3D10ShaderResourceView *pShaderResourceView); + [in] ID3D10ShaderResourceView *a); void ResolveSubresource( - [in] ID3D10Resource *pDstResource, - [in] UINT DstSubresource, - [in] ID3D10Resource *pSrcResource, - [in] UINT SrcSubresource, - [in] DXGI_FORMAT Format); + [in] ID3D10Resource *a, + [in] UINT b, + [in] ID3D10Resource *c, + [in] UINT d, + [in] DXGI_FORMAT e); void VSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D10Buffer **ppConstantBuffers); + [in] UINT a, + [in] UINT b, + [out] ID3D10Buffer **c); void PSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D10ShaderResourceView **ppShaderResourceViews); + [in] UINT a, + [in] UINT b, + [out] ID3D10ShaderResourceView **c); void PSGetShader( - [out] ID3D10PixelShader **ppPixelShader); + [out] ID3D10PixelShader **a); void PSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D10SamplerState **ppSamplers); + [in] UINT a, + [in] UINT b, + [out] ID3D10SamplerState **c); void VSGetShader( - [out] ID3D10VertexShader **ppVertexShader); + [out] ID3D10VertexShader **a); void PSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D10Buffer **ppConstantBuffers); + [in] UINT a, + [in] UINT b, + [out] ID3D10Buffer **c); void IAGetInputLayout( - [out] ID3D10InputLayout **ppInputLayout); + [out] ID3D10InputLayout **a); void IAGetVertexBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D10Buffer **ppVertexBuffers, - [out] UINT *pStrides, - [out] UINT *pOffsets); + [in] UINT a, + [in] UINT b, + [out] ID3D10Buffer **c, + [out] UINT *d, + [out] UINT *e); void IAGetIndexBuffer( - [out] ID3D10Buffer **pIndexBuffer, - [out] DXGI_FORMAT *Format, - [out] UINT *Offset); + [out] ID3D10Buffer **a, + [out] DXGI_FORMAT *b, + [out] UINT *c); void GSGetConstantBuffers( - [in] UINT StartSlot, - [in] UINT NumBuffers, - [out] ID3D10Buffer **ppConstantBuffers); + [in] UINT a, + [in] UINT b, + [out] ID3D10Buffer **c); void GSGetShader( - [out] ID3D10GeometryShader **ppGeometryShader); + [out] ID3D10GeometryShader **a); void IAGetPrimitiveTopology( - [out] D3D10_PRIMITIVE_TOPOLOGY *pTopology); + [out] D3D10_PRIMITIVE_TOPOLOGY *a); void VSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D10ShaderResourceView **ppShaderResourceViews); + [in] UINT a, + [in] UINT b, + [out] ID3D10ShaderResourceView **c); void VSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D10SamplerState **ppSamplers); + [in] UINT a, + [in] UINT b, + [out] ID3D10SamplerState **c); void GetPredication( - [out] ID3D10Predicate **ppPredicate, - [out] BOOL *pPredicateValue); + [out] ID3D10Predicate **a, + [out] BOOL *b); void GSGetShaderResources( - [in] UINT StartSlot, - [in] UINT NumViews, - [out] ID3D10ShaderResourceView **ppShaderResourceViews); + [in] UINT a, + [in] UINT b, + [out] ID3D10ShaderResourceView **c); void GSGetSamplers( - [in] UINT StartSlot, - [in] UINT NumSamplers, - [out] ID3D10SamplerState **ppSamplers); + [in] UINT a, + [in] UINT b, + [out] ID3D10SamplerState **c); void OMGetRenderTargets( - [in] UINT NumViews, - [out] ID3D10RenderTargetView **ppRenderTargetViews, - [out] ID3D10DepthStencilView **ppDepthStencilView); + [in] UINT a, + [out] ID3D10RenderTargetView **b, + [out] ID3D10DepthStencilView **c); void OMGetBlendState( - [out] ID3D10BlendState **ppBlendState, - [out] FLOAT BlendFactor[4], - [out] UINT *pSampleMask); + [out] ID3D10BlendState **a, + [out] FLOAT b[4], + [out] UINT *c); void OMGetDepthStencilState( - [out] ID3D10DepthStencilState **ppDepthStencilState, - [out] UINT *pStencilRef); + [out] ID3D10DepthStencilState **a, + [out] UINT *b); void SOGetTargets( - [in] UINT NumBuffers, - [out] ID3D10Buffer **ppSOTargets, - [out] UINT *pOffsets); + [in] UINT a, + [out] ID3D10Buffer **b, + [out] UINT *c); void RSGetState( - [out] ID3D10RasterizerState **ppRasterizerState); + [out] ID3D10RasterizerState **a); void RSGetViewports( - [in, out] UINT *NumViewports, - [out] D3D10_VIEWPORT *pViewports); + [in, out] UINT *a, + [out] D3D10_VIEWPORT *b); void RSGetScissorRects( - [in, out] UINT *NumRects, - [out] D3D10_RECT *pRects); + [in, out] UINT *a, + [out] D3D10_RECT *b); HRESULT GetDeviceRemovedReason(); HRESULT SetExceptionMode( - [in] UINT RaiseFlags); + [in] UINT a); UINT GetExceptionMode(); HRESULT GetPrivateData( - [in] REFGUID guid, - [in, out] UINT *pDataSize, - [out] void *pData); + [in] REFGUID a, + [in, out] UINT *b, + [out] void *c); HRESULT SetPrivateData( - [in] REFGUID guid, - [in] UINT DataSize, - [in] const void *pData); + [in] REFGUID a, + [in] UINT b, + [in] const void *c); HRESULT SetPrivateDataInterface( - [in] REFGUID guid, - [in] const IUnknown *pData); + [in] REFGUID a, + [in] const IUnknown *b); void ClearState(); void Flush(); HRESULT CreateBuffer( - [in] const D3D10_BUFFER_DESC *pDesc, - [in] const D3D10_SUBRESOURCE_DATA *pInitialData, - [out] ID3D10Buffer **ppBuffer); + [in] const D3D10_BUFFER_DESC *a, + [in] const D3D10_SUBRESOURCE_DATA *b, + [out] ID3D10Buffer **c); HRESULT CreateTexture1D( - [in] const D3D10_TEXTURE1D_DESC *pDesc, - [in] const D3D10_SUBRESOURCE_DATA *pInitialData, - [out] ID3D10Texture1D **ppTexture1D); + [in] const D3D10_TEXTURE1D_DESC *a, + [in] const D3D10_SUBRESOURCE_DATA *b, + [out] ID3D10Texture1D **c); HRESULT CreateTexture2D( - [in] const D3D10_TEXTURE2D_DESC *pDesc, - [in] const D3D10_SUBRESOURCE_DATA *pInitialData, - [out] ID3D10Texture2D **ppTexture2D); + [in] const D3D10_TEXTURE2D_DESC *a, + [in] const D3D10_SUBRESOURCE_DATA *b, + [out] ID3D10Texture2D **c); HRESULT CreateTexture3D( - [in] const D3D10_TEXTURE3D_DESC *pDesc, - [in] const D3D10_SUBRESOURCE_DATA *pInitialData, - [out] ID3D10Texture3D **ppTexture3D); + [in] const D3D10_TEXTURE3D_DESC *a, + [in] const D3D10_SUBRESOURCE_DATA *b, + [out] ID3D10Texture3D **c); HRESULT CreateShaderResourceView( - [in] ID3D10Resource *pResource, - [in] const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, - [out] ID3D10ShaderResourceView **ppSRView); + [in] ID3D10Resource *a, + [in] const D3D10_SHADER_RESOURCE_VIEW_DESC *b, + [out] ID3D10ShaderResourceView **c); HRESULT CreateRenderTargetView( - [in] ID3D10Resource *pResource, - [in] const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, - [out] ID3D10RenderTargetView **ppRTView); + [in] ID3D10Resource *a, + [in] const D3D10_RENDER_TARGET_VIEW_DESC *b, + [out] ID3D10RenderTargetView **c); HRESULT CreateDepthStencilView( - [in] ID3D10Resource *pResource, - [in] const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, - [out] ID3D10DepthStencilView **ppDepthStencilView); + [in] ID3D10Resource *a, + [in] const D3D10_DEPTH_STENCIL_VIEW_DESC *b, + [out] ID3D10DepthStencilView **c); HRESULT CreateInputLayout( - [in] const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, - [in] UINT NumElements, - [in] const void *pShaderBytecodeWithInputSignature, - [in] SIZE_T BytecodeLength, - [out] ID3D10InputLayout **ppInputLayout); + [in] const D3D10_INPUT_ELEMENT_DESC *a, + [in] UINT b, + [in] const void *c, + [in] SIZE_T d, + [out] ID3D10InputLayout **e); HRESULT CreateVertexShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [out] ID3D10VertexShader **ppVertexShader); + [in] const void *a, + [in] SIZE_T b, + [out] ID3D10VertexShader **c); HRESULT CreateGeometryShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [out] ID3D10GeometryShader **ppGeometryShader); + [in] const void *a, + [in] SIZE_T b, + [out] ID3D10GeometryShader **c); HRESULT CreateGeometryShaderWithStreamOutput( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [in] const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, - [in] UINT NumEntries, - [in] UINT OutputStreamStride, - [out] ID3D10GeometryShader **ppGeometryShader); + [in] const void *a, + [in] SIZE_T b, + [in] const D3D10_SO_DECLARATION_ENTRY *c, + [in] UINT d, + [in] UINT e, + [out] ID3D10GeometryShader **f); HRESULT CreatePixelShader( - [in] const void *pShaderBytecode, - [in] SIZE_T BytecodeLength, - [out] ID3D10PixelShader **ppPixelShader); + [in] const void *a, + [in] SIZE_T b, + [out] ID3D10PixelShader **c); HRESULT CreateBlendState( - [in] const D3D10_BLEND_DESC *pBlendStateDesc, - [out] ID3D10BlendState **ppBlendState); + [in] const D3D10_BLEND_DESC *a, + [out] ID3D10BlendState **b); HRESULT CreateDepthStencilState( - [in] const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, - [out] ID3D10DepthStencilState **ppDepthStencilState); + [in] const D3D10_DEPTH_STENCIL_DESC *a, + [out] ID3D10DepthStencilState **b); HRESULT CreateRasterizerState( - [in] const D3D10_RASTERIZER_DESC *pRasterizerDesc, - [out] ID3D10RasterizerState **ppRasterizerState); + [in] const D3D10_RASTERIZER_DESC *a, + [out] ID3D10RasterizerState **b); HRESULT CreateSamplerState( - [in] const D3D10_SAMPLER_DESC *pSamplerDesc, - [out] ID3D10SamplerState **ppSamplerState); + [in] const D3D10_SAMPLER_DESC *a, + [out] ID3D10SamplerState **b); HRESULT CreateQuery( - [in] const D3D10_QUERY_DESC *pQueryDesc, - [out] ID3D10Query **ppQuery); + [in] const D3D10_QUERY_DESC *a, + [out] ID3D10Query **b); HRESULT CreatePredicate( - [in] const D3D10_QUERY_DESC *pPredicateDesc, - [out] ID3D10Predicate **ppPredicate); + [in] const D3D10_QUERY_DESC *a, + [out] ID3D10Predicate **b); HRESULT CreateCounter( - [in] const D3D10_COUNTER_DESC *pCounterDesc, - [out] ID3D10Counter **ppCounter); + [in] const D3D10_COUNTER_DESC *a, + [out] ID3D10Counter **b); HRESULT CheckFormatSupport( - [in] DXGI_FORMAT Format, - [out] UINT *pFormatSupport); + [in] DXGI_FORMAT a, + [out] UINT *b); HRESULT CheckMultisampleQualityLevels( - [in] DXGI_FORMAT Format, - [in] UINT SampleCount, - [out] UINT *pNumQualityLevels); + [in] DXGI_FORMAT a, + [in] UINT b, + [out] UINT *c); void CheckCounterInfo( - [out] D3D10_COUNTER_INFO *pCounterInfo); + [out] D3D10_COUNTER_INFO *a); HRESULT CheckCounter( - [in] const D3D10_COUNTER_DESC *pDesc, - [out] D3D10_COUNTER_TYPE *pType, - [out] UINT *pActiveCounters, - [out] LPSTR szName, - [in, out] UINT *pNameLength, - [out] LPSTR szUnits, - [in, out] UINT *pUnitsLength, - [out] LPSTR szDescription, - [in, out] UINT *pDescriptionLength); + [in] const D3D10_COUNTER_DESC *a, + [out] D3D10_COUNTER_TYPE *b, + [out] UINT *c, + [out] LPSTR d, + [in, out] UINT *e, + [out] LPSTR f, + [in, out] UINT *g, + [out] LPSTR h, + [in, out] UINT *i); UINT GetCreationFlags(); HRESULT OpenSharedResource( - [in] HANDLE hResource, - [in] REFIID ReturnedInterface, - [out] void **ppResource); + [in] HANDLE a, + [in] REFIID b, + [out] void **c); void SetTextFilterSize( - [in] UINT Width, - [in] UINT Height); + [in] UINT a, + [in] UINT b); void GetTextFilterSize( - [out] UINT *pWidth, - [out] UINT *pHeight); + [out] UINT *a, + [out] UINT *b); } [ @@ -1544,7 +1544,7 @@ interface ID3D10Multithread : IUnknown void Enter(); void Leave(); BOOL SetMultithreadProtected( - [in] BOOL bMTProtect); + [in] BOOL a); BOOL GetMultithreadProtected(); } -- cgit v1.2.3 From 907a6734fcd427a6ac6fe5fcfbeac5d6054d82ae Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Sep 2010 15:53:55 -0700 Subject: mesa: Remove the non-required ARB_imaging extension. Many of the EXT_ extensions in the subset have significant code overhead with no users. It is not a required part of GL -- though text describing the extension is part of the core spec since 1.2, it is always conditional on the ARB_imaging extension. --- src/mesa/main/blend.c | 6 ++---- src/mesa/main/extensions.c | 5 +---- src/mesa/main/get.c | 4 ++-- src/mesa/main/histogram.c | 20 ++++++++++---------- src/mesa/main/mtypes.h | 1 - src/mesa/state_tracker/st_cb_texture.c | 1 - 6 files changed, 15 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index d022770f24c..736a94c052a 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -215,8 +215,7 @@ _mesa_validate_blend_equation( GLcontext *ctx, break; case GL_MIN: case GL_MAX: - if (!ctx->Extensions.EXT_blend_minmax && - !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_blend_minmax) { return GL_FALSE; } break; @@ -229,8 +228,7 @@ _mesa_validate_blend_equation( GLcontext *ctx, break; case GL_FUNC_SUBTRACT: case GL_FUNC_REVERSE_SUBTRACT: - if (!ctx->Extensions.EXT_blend_subtract && - !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_blend_subtract) { return GL_FALSE; } break; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 080fa98dfc6..b6500b9c4e6 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -62,7 +62,6 @@ static const struct { /* { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) }, */ { OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) }, { OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) }, - { OFF, "GL_ARB_imaging", F(ARB_imaging) }, { OFF, "GL_ARB_instanced_arrays", F(ARB_instanced_arrays) }, { OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) }, { ON, "GL_ARB_multisample", F(ARB_multisample) }, @@ -255,7 +254,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif ctx->Extensions.ARB_half_float_pixel = GL_TRUE; ctx->Extensions.ARB_half_float_vertex = GL_TRUE; - ctx->Extensions.ARB_imaging = GL_TRUE; ctx->Extensions.ARB_map_buffer_range = GL_TRUE; ctx->Extensions.ARB_multitexture = GL_TRUE; #if FEATURE_queryobj @@ -392,12 +390,11 @@ _mesa_enable_sw_extensions(GLcontext *ctx) /** - * Enable GL_ARB_imaging and all the EXT extensions that are subsets of it. + * Enable common EXT extensions in the ARB_imaging subset. */ void _mesa_enable_imaging_extensions(GLcontext *ctx) { - ctx->Extensions.ARB_imaging = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_logic_op = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 2062134a390..a840663f6af 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -938,12 +938,12 @@ static const struct value_desc values[] = { CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]), extra_EXT_convolution }, - /* GL_EXT_histogram / GL_ARB_imaging */ + /* GL_EXT_histogram */ { GL_HISTOGRAM, CONTEXT_BOOL(Pixel.HistogramEnabled), extra_EXT_histogram }, { GL_MINMAX, CONTEXT_BOOL(Pixel.MinMaxEnabled), extra_EXT_histogram }, - /* GL_SGI_color_table / GL_ARB_imaging */ + /* GL_SGI_color_table */ { GL_COLOR_TABLE_SGI, CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]), extra_SGI_color_table }, diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 4e482bcd54b..db3cbfc5a90 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -629,7 +629,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); return; } @@ -692,7 +692,7 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); return; } @@ -752,7 +752,7 @@ _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); return; } @@ -799,7 +799,7 @@ _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); return; } @@ -846,7 +846,7 @@ _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv"); return; } @@ -872,7 +872,7 @@ _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); return; } @@ -900,7 +900,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram"); return; } @@ -981,7 +981,7 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax"); return; } @@ -1010,7 +1010,7 @@ _mesa_ResetHistogram(GLenum target) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); return; } @@ -1035,7 +1035,7 @@ _mesa_ResetMinmax(GLenum target) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); return; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5494be8f423..0bb8734e4bf 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2658,7 +2658,6 @@ struct gl_extensions GLboolean ARB_geometry_shader4; GLboolean ARB_half_float_pixel; GLboolean ARB_half_float_vertex; - GLboolean ARB_imaging; GLboolean ARB_instanced_arrays; GLboolean ARB_map_buffer_range; GLboolean ARB_multisample; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index cd5001475c9..0a4f8508ec2 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -548,7 +548,6 @@ st_TexImage(GLcontext * ctx, /* The Mesa/Gallium state tracker does not implement the imaging extensions * such as convolution. */ - assert(!ctx->Extensions.ARB_imaging); assert(!ctx->Extensions.EXT_convolution); /* switch to "normal" */ -- cgit v1.2.3 From 7126e38d9037da66fd531c4cb02b3843b68b84ff Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Sep 2010 16:10:22 -0700 Subject: mesa: Remove EXT_histogram. This has always been optional, and not useful. --- src/mesa/main/attrib.c | 4 - src/mesa/main/context.c | 2 - src/mesa/main/enable.c | 21 - src/mesa/main/extensions.c | 3 - src/mesa/main/get.c | 6 - src/mesa/main/histogram.c | 971 +------------------------------------------- src/mesa/main/histogram.h | 2 - src/mesa/main/image.c | 74 ---- src/mesa/main/mfeatures.h | 1 - src/mesa/main/mtypes.h | 42 +- src/mesa/main/pixel.c | 8 - src/mesa/swrast/s_copypix.c | 40 +- src/mesa/swrast/s_drawpix.c | 35 +- 13 files changed, 43 insertions(+), 1166 deletions(-) (limited to 'src') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 753949be503..9a8917fc896 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -78,7 +78,6 @@ struct gl_enable_attrib GLboolean DepthTest; GLboolean Dither; GLboolean Fog; - GLboolean Histogram; GLboolean Light[MAX_LIGHTS]; GLboolean Lighting; GLboolean LineSmooth; @@ -107,7 +106,6 @@ struct gl_enable_attrib GLboolean Map2Vertex4; GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ - GLboolean MinMax; GLboolean Normalize; GLboolean PixelTexture; GLboolean PointSmooth; @@ -279,8 +277,6 @@ _mesa_PushAttrib(GLbitfield mask) attr->Lighting = ctx->Light.Enabled; attr->LineSmooth = ctx->Line.SmoothFlag; attr->LineStipple = ctx->Line.StippleFlag; - attr->Histogram = ctx->Pixel.HistogramEnabled; - attr->MinMax = ctx->Pixel.MinMaxEnabled; attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; attr->Map1Color4 = ctx->Eval.Map1Color4; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 3bddf2570ec..6f2ffe107d2 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -98,7 +98,6 @@ #include "feedback.h" #include "fog.h" #include "framebuffer.h" -#include "histogram.h" #include "hint.h" #include "hash.h" #include "light.h" @@ -738,7 +737,6 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); _mesa_init_fog( ctx ); - _mesa_init_histogram( ctx ); _mesa_init_hint( ctx ); _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index db30123c0fb..b0eb294df47 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -363,13 +363,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Enabled = state; break; - case GL_HISTOGRAM: - CHECK_EXTENSION(EXT_histogram, cap); - if (ctx->Pixel.HistogramEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.HistogramEnabled = state; - break; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: @@ -534,12 +527,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Vertex4 = state; break; - case GL_MINMAX: - if (ctx->Pixel.MinMaxEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.MinMaxEnabled = state; - break; case GL_NORMALIZE: if (ctx->Transform.Normalize == state) return; @@ -1356,14 +1343,6 @@ _mesa_IsEnabled( GLenum cap ) return (ctx->Array.ArrayObj->PointSize.Enabled != 0); #endif - /* GL_EXT_histogram */ - case GL_HISTOGRAM: - CHECK_EXTENSION(EXT_histogram); - return ctx->Pixel.HistogramEnabled; - case GL_MINMAX: - CHECK_EXTENSION(EXT_histogram); - return ctx->Pixel.MinMaxEnabled; - /* GL_SGI_color_table */ case GL_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index b6500b9c4e6..33599136b41 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -128,7 +128,6 @@ static const struct { { OFF, "GL_EXT_framebuffer_sRGB", F(EXT_framebuffer_sRGB) }, { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, - { OFF, "GL_EXT_histogram", F(EXT_histogram) }, { ON, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) }, { OFF, "GL_EXT_packed_float", F(EXT_packed_float) }, @@ -319,7 +318,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_ARB_framebuffer_object ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; #endif - ctx->Extensions.EXT_histogram = GL_TRUE; /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/ ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; ctx->Extensions.EXT_paletted_texture = GL_TRUE; @@ -400,7 +398,6 @@ _mesa_enable_imaging_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_convolution = GL_TRUE; - ctx->Extensions.EXT_histogram = GL_TRUE; ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGI_color_table = GL_TRUE; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index a840663f6af..f04f42022d6 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -277,7 +277,6 @@ EXTRA_EXT(NV_texture_rectangle); EXTRA_EXT(EXT_stencil_two_side); EXTRA_EXT(NV_light_max_exponent); EXTRA_EXT(EXT_convolution); -EXTRA_EXT(EXT_histogram); EXTRA_EXT(SGI_color_table); EXTRA_EXT(SGI_texture_color_table); EXTRA_EXT(EXT_depth_bounds_test); @@ -938,11 +937,6 @@ static const struct value_desc values[] = { CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]), extra_EXT_convolution }, - /* GL_EXT_histogram */ - { GL_HISTOGRAM, CONTEXT_BOOL(Pixel.HistogramEnabled), - extra_EXT_histogram }, - { GL_MINMAX, CONTEXT_BOOL(Pixel.MinMaxEnabled), extra_EXT_histogram }, - /* GL_SGI_color_table */ { GL_COLOR_TABLE_SGI, CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]), diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index db3cbfc5a90..a14d93e5199 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -35,585 +35,6 @@ #if FEATURE_histogram - -/* - * XXX the packed pixel formats haven't been tested. - */ -static void -pack_histogram( GLcontext *ctx, - GLuint n, CONST GLuint rgba[][4], - GLenum format, GLenum type, GLvoid *destination, - const struct gl_pixelstore_attrib *packing ) -{ - const GLint comps = _mesa_components_in_format(format); - GLuint luminance[MAX_WIDTH]; - - if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { - GLuint i; - for (i = 0; i < n; i++) { - luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; - } - } - -#define PACK_MACRO(TYPE) \ - { \ - GLuint i; \ - switch (format) { \ - case GL_RED: \ - for (i=0;iSwapBytes) { - _mesa_swap2(dst, n * comps); - } - } - break; - case GL_SHORT: - { - GLshort *dst = (GLshort *) destination; - PACK_MACRO(GLshort); - if (packing->SwapBytes) { - _mesa_swap2((GLushort *) dst, n * comps); - } - } - break; - case GL_UNSIGNED_INT: - { - GLuint *dst = (GLuint *) destination; - PACK_MACRO(GLuint); - if (packing->SwapBytes) { - _mesa_swap4(dst, n * comps); - } - } - break; - case GL_INT: - { - GLint *dst = (GLint *) destination; - PACK_MACRO(GLint); - if (packing->SwapBytes) { - _mesa_swap4((GLuint *) dst, n * comps); - } - } - break; - case GL_FLOAT: - { - GLfloat *dst = (GLfloat *) destination; - PACK_MACRO(GLfloat); - if (packing->SwapBytes) { - _mesa_swap4((GLuint *) dst, n * comps); - } - } - break; - case GL_HALF_FLOAT_ARB: - { - /* temporarily store as GLuints */ - GLuint temp[4*HISTOGRAM_TABLE_SIZE]; - GLuint *dst = temp; - GLhalfARB *half = (GLhalfARB *) destination; - GLuint i; - /* get GLuint values */ - PACK_MACRO(GLuint); - /* convert to GLhalf */ - for (i = 0; i < n * comps; i++) { - half[i] = _mesa_float_to_half((GLfloat) temp[i]); - } - if (packing->SwapBytes) { - _mesa_swap2((GLushort *) half, n * comps); - } - } - break; - case GL_UNSIGNED_BYTE_3_3_2: - if (format == GL_RGB) { - GLubyte *dst = (GLubyte *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x7) << 5) - | ((rgba[i][GCOMP] & 0x7) << 2) - | ((rgba[i][BCOMP] & 0x3) ); - } - } - else { - GLubyte *dst = (GLubyte *) destination; - GLuint i; - ASSERT(format == GL_BGR); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0x7) << 5) - | ((rgba[i][GCOMP] & 0x7) << 2) - | ((rgba[i][RCOMP] & 0x3) ); - } - } - break; - case GL_UNSIGNED_BYTE_2_3_3_REV: - if (format == GL_RGB) { - GLubyte *dst = (GLubyte *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x3) << 6) - | ((rgba[i][GCOMP] & 0x7) << 3) - | ((rgba[i][BCOMP] & 0x7) ); - } - } - else { - GLubyte *dst = (GLubyte *) destination; - GLuint i; - ASSERT(format == GL_BGR); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0x3) << 6) - | ((rgba[i][GCOMP] & 0x7) << 3) - | ((rgba[i][RCOMP] & 0x7) ); - } - } - break; - case GL_UNSIGNED_SHORT_5_6_5: - if (format == GL_RGB) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x3f) << 5) - | ((rgba[i][BCOMP] & 0x1f) ); - } - } - else { - GLushort *dst = (GLushort *) destination; - GLuint i; - ASSERT(format == GL_BGR); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x3f) << 5) - | ((rgba[i][RCOMP] & 0x1f) ); - } - } - break; - case GL_UNSIGNED_SHORT_5_6_5_REV: - if (format == GL_RGB) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x3f) << 5) - | ((rgba[i][RCOMP] & 0x1f) ); - } - } - else { - GLushort *dst = (GLushort *) destination; - GLuint i; - ASSERT(format == GL_BGR); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x3f) << 5) - | ((rgba[i][BCOMP] & 0x1f) ); - } - } - break; - case GL_UNSIGNED_SHORT_4_4_4_4: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) - | ((rgba[i][GCOMP] & 0xf) << 8) - | ((rgba[i][BCOMP] & 0xf) << 4) - | ((rgba[i][ACOMP] & 0xf) ); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0xf) << 12) - | ((rgba[i][GCOMP] & 0xf) << 8) - | ((rgba[i][RCOMP] & 0xf) << 4) - | ((rgba[i][ACOMP] & 0xf) ); - } - } - else { - GLushort *dst = (GLushort *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) - | ((rgba[i][BCOMP] & 0xf) << 8) - | ((rgba[i][GCOMP] & 0xf) << 4) - | ((rgba[i][RCOMP] & 0xf) ); - } - } - break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) - | ((rgba[i][BCOMP] & 0xf) << 8) - | ((rgba[i][GCOMP] & 0xf) << 4) - | ((rgba[i][RCOMP] & 0xf) ); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) - | ((rgba[i][RCOMP] & 0xf) << 8) - | ((rgba[i][GCOMP] & 0xf) << 4) - | ((rgba[i][BCOMP] & 0xf) ); - } - } - else { - GLushort *dst = (GLushort *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) - | ((rgba[i][GCOMP] & 0xf) << 8) - | ((rgba[i][BCOMP] & 0xf) << 4) - | ((rgba[i][ACOMP] & 0xf) ); - } - } - break; - case GL_UNSIGNED_SHORT_5_5_5_1: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x1f) << 6) - | ((rgba[i][BCOMP] & 0x1f) << 1) - | ((rgba[i][ACOMP] & 0x1) ); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x1f) << 6) - | ((rgba[i][RCOMP] & 0x1f) << 1) - | ((rgba[i][ACOMP] & 0x1) ); - } - } - else { - GLushort *dst = (GLushort *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) - | ((rgba[i][BCOMP] & 0x1f) << 6) - | ((rgba[i][GCOMP] & 0x1f) << 1) - | ((rgba[i][RCOMP] & 0x1) ); - } - } - break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) - | ((rgba[i][BCOMP] & 0x1f) << 6) - | ((rgba[i][GCOMP] & 0x1f) << 1) - | ((rgba[i][RCOMP] & 0x1) ); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) - | ((rgba[i][RCOMP] & 0x1f) << 6) - | ((rgba[i][GCOMP] & 0x1f) << 1) - | ((rgba[i][BCOMP] & 0x1) ); - } - } - else { - GLushort *dst = (GLushort *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) - | ((rgba[i][GCOMP] & 0x1f) << 6) - | ((rgba[i][BCOMP] & 0x1f) << 1) - | ((rgba[i][ACOMP] & 0x1) ); - } - } - break; - case GL_UNSIGNED_INT_8_8_8_8: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) - | ((rgba[i][GCOMP] & 0xff) << 16) - | ((rgba[i][BCOMP] & 0xff) << 8) - | ((rgba[i][ACOMP] & 0xff) ); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0xff) << 24) - | ((rgba[i][GCOMP] & 0xff) << 16) - | ((rgba[i][RCOMP] & 0xff) << 8) - | ((rgba[i][ACOMP] & 0xff) ); - } - } - else { - GLuint *dst = (GLuint *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) - | ((rgba[i][BCOMP] & 0xff) << 16) - | ((rgba[i][GCOMP] & 0xff) << 8) - | ((rgba[i][RCOMP] & 0xff) ); - } - } - break; - case GL_UNSIGNED_INT_8_8_8_8_REV: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) - | ((rgba[i][BCOMP] & 0xff) << 16) - | ((rgba[i][GCOMP] & 0xff) << 8) - | ((rgba[i][RCOMP] & 0xff) ); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) - | ((rgba[i][RCOMP] & 0xff) << 16) - | ((rgba[i][GCOMP] & 0xff) << 8) - | ((rgba[i][BCOMP] & 0xff) ); - } - } - else { - GLuint *dst = (GLuint *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) - | ((rgba[i][GCOMP] & 0xff) << 16) - | ((rgba[i][BCOMP] & 0xff) << 8) - | ((rgba[i][ACOMP] & 0xff) ); - } - } - break; - case GL_UNSIGNED_INT_10_10_10_2: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) - | ((rgba[i][GCOMP] & 0x3ff) << 12) - | ((rgba[i][BCOMP] & 0x3ff) << 2) - | ((rgba[i][ACOMP] & 0x3) ); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][BCOMP] & 0x3ff) << 22) - | ((rgba[i][GCOMP] & 0x3ff) << 12) - | ((rgba[i][RCOMP] & 0x3ff) << 2) - | ((rgba[i][ACOMP] & 0x3) ); - } - } - else { - GLuint *dst = (GLuint *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) - | ((rgba[i][BCOMP] & 0x3ff) << 12) - | ((rgba[i][GCOMP] & 0x3ff) << 2) - | ((rgba[i][RCOMP] & 0x3) ); - } - } - break; - case GL_UNSIGNED_INT_2_10_10_10_REV: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) - | ((rgba[i][BCOMP] & 0x3ff) << 12) - | ((rgba[i][GCOMP] & 0x3ff) << 2) - | ((rgba[i][RCOMP] & 0x3) ); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - GLuint i; - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) - | ((rgba[i][RCOMP] & 0x3ff) << 12) - | ((rgba[i][GCOMP] & 0x3ff) << 2) - | ((rgba[i][BCOMP] & 0x3) ); - } - } - else { - GLuint *dst = (GLuint *) destination; - GLuint i; - ASSERT(format == GL_ABGR_EXT); - for (i = 0; i < n; i++) { - dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) - | ((rgba[i][GCOMP] & 0x3ff) << 12) - | ((rgba[i][BCOMP] & 0x3ff) << 2) - | ((rgba[i][ACOMP] & 0x3) ); - } - } - break; - default: - _mesa_problem(ctx, "Bad type in pack_histogram"); - } - -#undef PACK_MACRO -} - - -/* - * Given an internalFormat token passed to glHistogram or glMinMax, - * return the corresponding base format. - * Return -1 if invalid token. - */ -static GLint -base_histogram_format( GLenum format ) -{ - switch (format) { - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return GL_ALPHA; - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return GL_LUMINANCE; - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return GL_LUMINANCE_ALPHA; - case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return GL_RGB; - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB5_A1: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return GL_RGBA; - default: - return -1; /* error */ - } -} - - - /********************************************************************** * API functions */ @@ -627,62 +48,8 @@ static void GLAPIENTRY _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); - return; - } - - if (target != GL_MINMAX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)"); - return; - } - - if (format != GL_RED && - format != GL_GREEN && - format != GL_BLUE && - format != GL_ALPHA && - format != GL_RGB && - format != GL_BGR && - format != GL_RGBA && - format != GL_BGRA && - format != GL_ABGR_EXT && - format != GL_LUMINANCE && - format != GL_LUMINANCE_ALPHA) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMax(format)"); - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)"); - return; - } - - values = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack, 2, 1, 1, - format, type, values, "glGetMinmax"); - if (!values) - return; - - { - GLfloat minmax[2][4]; - minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F); - minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F); - minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F); - minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F); - minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F); - minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); - minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); - minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); - _mesa_pack_rgba_span_float(ctx, 2, minmax, - format, type, values, &ctx->Pack, 0x0); - } - - _mesa_unmap_pbo_dest(ctx, &ctx->Pack); - - if (reset) { - _mesa_ResetMinmax(GL_MINMAX); - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); } @@ -690,59 +57,8 @@ static void GLAPIENTRY _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); - return; - } - - if (target != GL_HISTOGRAM) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); - return; - } - - if (format != GL_RED && - format != GL_GREEN && - format != GL_BLUE && - format != GL_ALPHA && - format != GL_RGB && - format != GL_BGR && - format != GL_RGBA && - format != GL_BGRA && - format != GL_ABGR_EXT && - format != GL_LUMINANCE && - format != GL_LUMINANCE_ALPHA) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)"); - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)"); - return; - } - values = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack, - ctx->Histogram.Width, 1, 1, - format, type, values, - "glGetHistogram"); - if (!values) - return; - - pack_histogram(ctx, ctx->Histogram.Width, - (CONST GLuint (*)[4]) ctx->Histogram.Count, - format, type, values, &ctx->Pack); - - _mesa_unmap_pbo_dest(ctx, &ctx->Pack); - - if (reset) { - GLuint i; - for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { - ctx->Histogram.Count[i][0] = 0; - ctx->Histogram.Count[i][1] = 0; - ctx->Histogram.Count[i][2] = 0; - ctx->Histogram.Count[i][3] = 0; - } - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); } @@ -750,46 +66,8 @@ static void GLAPIENTRY _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); - return; - } - if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); - return; - } - - switch (pname) { - case GL_HISTOGRAM_WIDTH: - *params = (GLfloat) ctx->Histogram.Width; - break; - case GL_HISTOGRAM_FORMAT: - *params = (GLfloat) ctx->Histogram.Format; - break; - case GL_HISTOGRAM_RED_SIZE: - *params = (GLfloat) ctx->Histogram.RedSize; - break; - case GL_HISTOGRAM_GREEN_SIZE: - *params = (GLfloat) ctx->Histogram.GreenSize; - break; - case GL_HISTOGRAM_BLUE_SIZE: - *params = (GLfloat) ctx->Histogram.BlueSize; - break; - case GL_HISTOGRAM_ALPHA_SIZE: - *params = (GLfloat) ctx->Histogram.AlphaSize; - break; - case GL_HISTOGRAM_LUMINANCE_SIZE: - *params = (GLfloat) ctx->Histogram.LuminanceSize; - break; - case GL_HISTOGRAM_SINK: - *params = (GLfloat) ctx->Histogram.Sink; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); } @@ -797,46 +75,8 @@ static void GLAPIENTRY _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); - return; - } - if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); - return; - } - - switch (pname) { - case GL_HISTOGRAM_WIDTH: - *params = (GLint) ctx->Histogram.Width; - break; - case GL_HISTOGRAM_FORMAT: - *params = (GLint) ctx->Histogram.Format; - break; - case GL_HISTOGRAM_RED_SIZE: - *params = (GLint) ctx->Histogram.RedSize; - break; - case GL_HISTOGRAM_GREEN_SIZE: - *params = (GLint) ctx->Histogram.GreenSize; - break; - case GL_HISTOGRAM_BLUE_SIZE: - *params = (GLint) ctx->Histogram.BlueSize; - break; - case GL_HISTOGRAM_ALPHA_SIZE: - *params = (GLint) ctx->Histogram.AlphaSize; - break; - case GL_HISTOGRAM_LUMINANCE_SIZE: - *params = (GLint) ctx->Histogram.LuminanceSize; - break; - case GL_HISTOGRAM_SINK: - *params = (GLint) ctx->Histogram.Sink; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); } @@ -844,25 +84,8 @@ static void GLAPIENTRY _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv"); - return; - } - if (target != GL_MINMAX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); - return; - } - if (pname == GL_MINMAX_FORMAT) { - *params = (GLfloat) ctx->MinMax.Format; - } - else if (pname == GL_MINMAX_SINK) { - *params = (GLfloat) ctx->MinMax.Sink; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); - } } @@ -870,108 +93,17 @@ static void GLAPIENTRY _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); - return; - } - if (target != GL_MINMAX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); - return; - } - if (pname == GL_MINMAX_FORMAT) { - *params = (GLint) ctx->MinMax.Format; - } - else if (pname == GL_MINMAX_SINK) { - *params = (GLint) ctx->MinMax.Sink; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); } static void GLAPIENTRY _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { - GLuint i; - GLboolean error = GL_FALSE; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram"); - return; - } - if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { - _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); - return; - } - - if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { - if (target == GL_PROXY_HISTOGRAM) { - error = GL_TRUE; - } - else { - if (width < 0) - _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); - else - _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); - return; - } - } - - if (width != 0 && !_mesa_is_pow_two(width)) { - if (target == GL_PROXY_HISTOGRAM) { - error = GL_TRUE; - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); - return; - } - } - - if (base_histogram_format(internalFormat) < 0) { - if (target == GL_PROXY_HISTOGRAM) { - error = GL_TRUE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); - return; - } - } - - FLUSH_VERTICES(ctx, _NEW_PIXEL); - - /* reset histograms */ - for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { - ctx->Histogram.Count[i][0] = 0; - ctx->Histogram.Count[i][1] = 0; - ctx->Histogram.Count[i][2] = 0; - ctx->Histogram.Count[i][3] = 0; - } - - if (error) { - ctx->Histogram.Width = 0; - ctx->Histogram.Format = 0; - ctx->Histogram.RedSize = 0; - ctx->Histogram.GreenSize = 0; - ctx->Histogram.BlueSize = 0; - ctx->Histogram.AlphaSize = 0; - ctx->Histogram.LuminanceSize = 0; - } - else { - ctx->Histogram.Width = width; - ctx->Histogram.Format = internalFormat; - ctx->Histogram.Sink = sink; - ctx->Histogram.RedSize = 8 * sizeof(GLuint); - ctx->Histogram.GreenSize = 8 * sizeof(GLuint); - ctx->Histogram.BlueSize = 8 * sizeof(GLuint); - ctx->Histogram.AlphaSize = 8 * sizeof(GLuint); - ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint); - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram"); } @@ -979,53 +111,17 @@ static void GLAPIENTRY _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax"); - return; - } - if (target != GL_MINMAX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); - return; - } - - if (base_histogram_format(internalFormat) < 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); - return; - } - - if (ctx->MinMax.Sink == sink) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->MinMax.Sink = sink; + _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax"); } static void GLAPIENTRY _mesa_ResetHistogram(GLenum target) { - GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ - - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); - return; - } - - if (target != GL_HISTOGRAM) { - _mesa_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); - return; - } - for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { - ctx->Histogram.Count[i][0] = 0; - ctx->Histogram.Count[i][1] = 0; - ctx->Histogram.Count[i][2] = 0; - ctx->Histogram.Count[i][3] = 0; - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); } @@ -1033,22 +129,8 @@ static void GLAPIENTRY _mesa_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (!ctx->Extensions.EXT_histogram) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); - return; - } - - if (target != GL_MINMAX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); - return; - } - - ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; - ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; - ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; - ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; + _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); } @@ -1067,39 +149,4 @@ _mesa_init_histogram_dispatch(struct _glapi_table *disp) SET_ResetMinmax(disp, _mesa_ResetMinmax); } - #endif /* FEATURE_histogram */ - - -/**********************************************************************/ -/***** Initialization *****/ -/**********************************************************************/ - -void _mesa_init_histogram( GLcontext * ctx ) -{ - int i; - - /* Histogram group */ - ctx->Histogram.Width = 0; - ctx->Histogram.Format = GL_RGBA; - ctx->Histogram.Sink = GL_FALSE; - ctx->Histogram.RedSize = 0; - ctx->Histogram.GreenSize = 0; - ctx->Histogram.BlueSize = 0; - ctx->Histogram.AlphaSize = 0; - ctx->Histogram.LuminanceSize = 0; - for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { - ctx->Histogram.Count[i][0] = 0; - ctx->Histogram.Count[i][1] = 0; - ctx->Histogram.Count[i][2] = 0; - ctx->Histogram.Count[i][3] = 0; - } - - /* Min/Max group */ - ctx->MinMax.Format = GL_RGBA; - ctx->MinMax.Sink = GL_FALSE; - ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; - ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; - ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; - ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; -} diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h index dbae1bbd06b..240087141b3 100644 --- a/src/mesa/main/histogram.h +++ b/src/mesa/main/histogram.h @@ -52,6 +52,4 @@ _mesa_init_histogram_dispatch(struct _glapi_table *disp) #endif /* FEATURE_histogram */ -extern void _mesa_init_histogram( GLcontext * ctx ); - #endif /* HISTOGRAM_H */ diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 86aa6d0d702..453611d00b6 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1876,69 +1876,6 @@ _mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, } } - - -/* - * Update the min/max values from an array of fragment colors. - */ -static void -update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) -{ - GLuint i; - for (i = 0; i < n; i++) { - /* update mins */ - if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) - ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; - if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) - ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; - if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) - ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; - if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) - ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; - - /* update maxs */ - if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) - ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; - if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) - ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; - if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) - ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; - if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) - ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; - } -} - - -/* - * Update the histogram values from an array of fragment colors. - */ -static void -update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) -{ - const GLint max = ctx->Histogram.Width - 1; - GLfloat w = (GLfloat) max; - GLuint i; - - if (ctx->Histogram.Width == 0) - return; - - for (i = 0; i < n; i++) { - GLint ri = IROUND(rgba[i][RCOMP] * w); - GLint gi = IROUND(rgba[i][GCOMP] * w); - GLint bi = IROUND(rgba[i][BCOMP] * w); - GLint ai = IROUND(rgba[i][ACOMP] * w); - ri = CLAMP(ri, 0, max); - gi = CLAMP(gi, 0, max); - bi = CLAMP(bi, 0, max); - ai = CLAMP(ai, 0, max); - ctx->Histogram.Count[ri][RCOMP]++; - ctx->Histogram.Count[gi][GCOMP]++; - ctx->Histogram.Count[bi][BCOMP]++; - ctx->Histogram.Count[ai][ACOMP]++; - } -} - - /** * Apply various pixel transfer operations to an array of RGBA pixels * as indicated by the transferOps bitmask @@ -1992,14 +1929,6 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX], n, rgba); } - /* update histogram count */ - if (transferOps & IMAGE_HISTOGRAM_BIT) { - update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); - } - /* update min/max values */ - if (transferOps & IMAGE_MIN_MAX_BIT) { - update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); - } /* clamping to [0,1] */ if (transferOps & IMAGE_CLAMP_BIT) { GLuint i; @@ -2132,9 +2061,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], if (transferOps) { _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba); - if ((transferOps & IMAGE_MIN_MAX_BIT) && ctx->MinMax.Sink) { - return; - } } if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 92311ef7f0a..9b9b6d0420b 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -100,7 +100,6 @@ #define FEATURE_drawpix FEATURE_GL #define FEATURE_evaluators FEATURE_GL #define FEATURE_feedback FEATURE_GL -#define FEATURE_histogram FEATURE_GL #define FEATURE_pixel_transfer FEATURE_GL #define FEATURE_queryobj FEATURE_GL #define FEATURE_rastpos FEATURE_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0bb8734e4bf..d918482353f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -811,34 +811,6 @@ struct gl_hint_attrib }; -/** - * Histogram attributes. - */ -struct gl_histogram_attrib -{ - GLuint Width; /**< number of table entries */ - GLint Format; /**< GL_ALPHA, GL_RGB, etc */ - GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */ - GLboolean Sink; /**< terminate image transfer? */ - GLubyte RedSize; /**< Bits per counter */ - GLubyte GreenSize; - GLubyte BlueSize; - GLubyte AlphaSize; - GLubyte LuminanceSize; -}; - - -/** - * Color Min/max state. - */ -struct gl_minmax_attrib -{ - GLenum Format; - GLboolean Sink; - GLfloat Min[4], Max[4]; /**< RGBA */ -}; - - /** * Image convolution state. */ @@ -1013,11 +985,6 @@ struct gl_pixel_attrib GLfloat PostColorMatrixScale[4]; /**< RGBA */ GLfloat PostColorMatrixBias[4]; /**< RGBA */ - /* Histogram & minmax (GL_EXT_histogram) */ - /* Note: histogram and minmax data are not part of this attrib group */ - GLboolean HistogramEnabled; - GLboolean MinMaxEnabled; - /*--- End Pixel Transfer State ---*/ /** glPixelZoom */ @@ -2717,7 +2684,6 @@ struct gl_extensions GLboolean EXT_framebuffer_object; GLboolean EXT_framebuffer_sRGB; GLboolean EXT_gpu_program_parameters; - GLboolean EXT_histogram; GLboolean EXT_multi_draw_arrays; GLboolean EXT_paletted_texture; GLboolean EXT_packed_depth_stencil; @@ -2831,8 +2797,6 @@ struct gl_matrix_stack #define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40 #define IMAGE_COLOR_MATRIX_BIT 0x80 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100 -#define IMAGE_HISTOGRAM_BIT 0x200 -#define IMAGE_MIN_MAX_BIT 0x400 #define IMAGE_CLAMP_BIT 0x800 @@ -2846,9 +2810,7 @@ struct gl_matrix_stack #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \ IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \ IMAGE_COLOR_MATRIX_BIT | \ - IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\ - IMAGE_HISTOGRAM_BIT | \ - IMAGE_MIN_MAX_BIT) + IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) /*@}*/ @@ -3206,8 +3168,6 @@ struct __GLcontextRec /** \name Other assorted state (not pushed/popped on attribute stack) */ /*@{*/ struct gl_pixelmaps PixelMaps; - struct gl_histogram_attrib Histogram; - struct gl_minmax_attrib MinMax; struct gl_convolution_attrib Convolution1D; struct gl_convolution_attrib Convolution2D; struct gl_convolution_attrib Separable2D; diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 675e933ca62..980c40550c3 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -738,12 +738,6 @@ update_image_transfer_state(GLcontext *ctx) if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]) mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; - if (ctx->Pixel.HistogramEnabled) - mask |= IMAGE_HISTOGRAM_BIT; - - if (ctx->Pixel.MinMaxEnabled) - mask |= IMAGE_MIN_MAX_BIT; - ctx->_ImageTransferState = mask; } @@ -829,8 +823,6 @@ _mesa_init_pixel( GLcontext *ctx ) init_pixelmap(&ctx->PixelMaps.GtoG); init_pixelmap(&ctx->PixelMaps.BtoB); init_pixelmap(&ctx->PixelMaps.AtoA); - ctx->Pixel.HistogramEnabled = GL_FALSE; - ctx->Pixel.MinMaxEnabled = GL_FALSE; ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); for (i = 0; i < COLORTABLE_MAX; i++) { diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index f4f0c8a330e..a9b4cb80818 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -103,8 +103,6 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint row; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; const GLbitfield transferOps = ctx->_ImageTransferState; - const GLboolean sink = (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) - || (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink); GLfloat *dest, *tmpImage, *convImage; SWspan span; @@ -160,30 +158,28 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, width, rgba); } - if (!sink) { - /* write the new image */ - for (row = 0; row < height; row++) { - const GLfloat *src = convImage + row * width * 4; - GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; + /* write the new image */ + for (row = 0; row < height; row++) { + const GLfloat *src = convImage + row * width * 4; + GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; - /* copy convolved colors into span array */ - memcpy(rgba, src, width * 4 * sizeof(GLfloat)); + /* copy convolved colors into span array */ + memcpy(rgba, src, width * 4 * sizeof(GLfloat)); - /* write span */ - span.x = destx; - span.y = desty + row; - span.end = width; - span.array->ChanType = GL_FLOAT; - if (zoom) { - _swrast_write_zoomed_rgba_span(ctx, destx, desty, &span, rgba); - } - else { - _swrast_write_rgba_span(ctx, &span); - } + /* write span */ + span.x = destx; + span.y = desty + row; + span.end = width; + span.array->ChanType = GL_FLOAT; + if (zoom) { + _swrast_write_zoomed_rgba_span(ctx, destx, desty, &span, rgba); + } + else { + _swrast_write_rgba_span(ctx, &span); } - /* restore this */ - span.array->ChanType = CHAN_TYPE; } + /* restore this */ + span.array->ChanType = CHAN_TYPE; free(convImage); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 3cec3a7a2ba..9bc0e9043ba 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -551,8 +551,6 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, * General solution */ { - const GLboolean sink = (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) - || (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink); const GLbitfield interpMask = span.interpMask; const GLbitfield arrayMask = span.arrayMask; const GLint srcStride @@ -575,24 +573,21 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, _mesa_unpack_color_span_float(ctx, spanWidth, GL_RGBA, rgba, format, type, source, unpack, transferOps); - /* draw the span */ - if (!sink) { - /* Set these for each row since the _swrast_write_* functions - * may change them while clipping/rendering. - */ - span.array->ChanType = GL_FLOAT; - span.x = x + skipPixels; - span.y = y + row; - span.end = spanWidth; - span.arrayMask = arrayMask; - span.interpMask = interpMask; - if (zoom) { - _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, rgba); - } - else { - _swrast_write_rgba_span(ctx, &span); - } - } + /* Set these for each row since the _swrast_write_* functions + * may change them while clipping/rendering. + */ + span.array->ChanType = GL_FLOAT; + span.x = x + skipPixels; + span.y = y + row; + span.end = spanWidth; + span.arrayMask = arrayMask; + span.interpMask = interpMask; + if (zoom) { + _swrast_write_zoomed_rgba_span(ctx, imgX, imgY, &span, rgba); + } + else { + _swrast_write_rgba_span(ctx, &span); + } source += srcStride; } /* for row */ -- cgit v1.2.3 From 6c227e57e69158e4da40c69322db0eac4c31086c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Sep 2010 16:25:17 -0700 Subject: mesa: Remove SGI_color_table. Another optional ARB_imaging subset extension. --- src/mesa/main/attrib.c | 13 --- src/mesa/main/colortab.c | 204 +-------------------------------------------- src/mesa/main/colortab.h | 7 -- src/mesa/main/context.c | 2 - src/mesa/main/enable.c | 34 +------- src/mesa/main/extensions.c | 3 - src/mesa/main/get.c | 12 --- src/mesa/main/image.c | 12 --- src/mesa/main/mtypes.h | 19 +---- src/mesa/main/pixel.c | 14 ---- 10 files changed, 4 insertions(+), 316 deletions(-) (limited to 'src') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 9a8917fc896..73c2375f9d3 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -69,7 +69,6 @@ struct gl_enable_attrib GLboolean Blend; GLbitfield ClipPlanes; GLboolean ColorMaterial; - GLboolean ColorTable[COLORTABLE_MAX]; GLboolean Convolution1D; GLboolean Convolution2D; GLboolean Separable2D; @@ -260,9 +259,6 @@ _mesa_PushAttrib(GLbitfield mask) attr->Blend = ctx->Color.BlendEnabled; attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; - for (i = 0; i < COLORTABLE_MAX; i++) { - attr->ColorTable[i] = ctx->Pixel.ColorTableEnabled[i]; - } attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; attr->Separable2D = ctx->Pixel.Separable2DEnabled; @@ -515,15 +511,6 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL); - TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION], - enable->ColorTable[COLORTABLE_PRECONVOLUTION], - GL_COLOR_TABLE); - TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION], - enable->ColorTable[COLORTABLE_POSTCONVOLUTION], - GL_POST_CONVOLUTION_COLOR_TABLE); - TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX], - enable->ColorTable[COLORTABLE_POSTCOLORMATRIX], - GL_POST_COLOR_MATRIX_COLOR_TABLE); TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp, GL_DEPTH_CLAMP); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 52d5badf39c..5c2697d40af 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -297,15 +297,6 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; - case GL_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION]; - scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]; - break; - case GL_PROXY_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION]; - proxy = GL_TRUE; - break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); @@ -323,24 +314,6 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, table = &(texUnit->ProxyColorTable); proxy = GL_TRUE; break; - case GL_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION]; - scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION]; - proxy = GL_TRUE; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX]; - scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]; - break; - case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX]; - proxy = GL_TRUE; - break; default: /* try texture targets */ { @@ -459,11 +432,6 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; - case GL_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION]; - scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]; - break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); @@ -473,16 +441,6 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, scale = ctx->Pixel.TextureColorTableScale; bias = ctx->Pixel.TextureColorTableBias; break; - case GL_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION]; - scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX]; - scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]; - break; default: /* try texture targets */ texObj = _mesa_select_tex_object(ctx, texUnit, target); @@ -590,9 +548,6 @@ _mesa_GetColorTable( GLenum target, GLenum format, case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; - case GL_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION]; - break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); @@ -600,12 +555,6 @@ _mesa_GetColorTable( GLenum target, GLenum format, } table = &(texUnit->ColorTable); break; - case GL_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX]; - break; default: /* try texture targets */ { @@ -714,22 +663,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { - case GL_COLOR_TABLE_SGI: - scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]; - break; case GL_TEXTURE_COLOR_TABLE_SGI: scale = ctx->Pixel.TextureColorTableScale; bias = ctx->Pixel.TextureColorTableBias; break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]; - bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]; - break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); return; @@ -755,10 +692,7 @@ static void GLAPIENTRY _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { GLfloat fparams[4]; - if (pname == GL_COLOR_TABLE_SGI || - pname == GL_TEXTURE_COLOR_TABLE_SGI || - pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || - pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + if (pname == GL_TEXTURE_COLOR_TABLE_SGI) { /* four values */ fparams[0] = (GLfloat) params[0]; fparams[1] = (GLfloat) params[1]; @@ -786,20 +720,6 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; - case GL_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION]; - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]); - return; - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]); - return; - } - break; - case GL_PROXY_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION]; - break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); @@ -822,34 +742,6 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) } table = &(texUnit->ProxyColorTable); break; - case GL_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION]; - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]); - return; - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]); - return; - } - break; - case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX]; - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]); - return; - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]); - return; - } - break; - case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX]; - break; default: /* try texture targets */ { @@ -913,28 +805,6 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; - case GL_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION]; - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]; - params[0] = (GLint) scale[0]; - params[1] = (GLint) scale[1]; - params[2] = (GLint) scale[2]; - params[3] = (GLint) scale[3]; - return; - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]; - params[0] = (GLint) bias[0]; - params[1] = (GLint) bias[1]; - params[2] = (GLint) bias[2]; - params[3] = (GLint) bias[3]; - return; - } - break; - case GL_PROXY_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION]; - break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); @@ -963,50 +833,6 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) } table = &(texUnit->ProxyColorTable); break; - case GL_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION]; - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]; - params[0] = (GLint) scale[0]; - params[1] = (GLint) scale[1]; - params[2] = (GLint) scale[2]; - params[3] = (GLint) scale[3]; - return; - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]; - params[0] = (GLint) bias[0]; - params[1] = (GLint) bias[1]; - params[2] = (GLint) bias[2]; - params[3] = (GLint) bias[3]; - return; - } - break; - case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX]; - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]; - params[0] = (GLint) scale[0]; - params[0] = (GLint) scale[1]; - params[0] = (GLint) scale[2]; - params[0] = (GLint) scale[3]; - return; - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - GLfloat *bias = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]; - params[0] = (GLint) bias[0]; - params[1] = (GLint) bias[1]; - params[2] = (GLint) bias[2]; - params[3] = (GLint) bias[3]; - return; - } - break; - case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: - table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX]; - break; default: /* Try texture targets */ { @@ -1103,31 +929,3 @@ _mesa_free_colortable_data( struct gl_color_table *p ) p->TableUB = NULL; } } - - -/* - * Initialize all colortables for a context. - */ -void -_mesa_init_colortables( GLcontext * ctx ) -{ - GLuint i; - for (i = 0; i < COLORTABLE_MAX; i++) { - _mesa_init_colortable(&ctx->ColorTable[i]); - _mesa_init_colortable(&ctx->ProxyColorTable[i]); - } -} - - -/* - * Free all colortable data for a context - */ -void -_mesa_free_colortables_data( GLcontext *ctx ) -{ - GLuint i; - for (i = 0; i < COLORTABLE_MAX; i++) { - _mesa_free_colortable_data(&ctx->ColorTable[i]); - _mesa_free_colortable_data(&ctx->ProxyColorTable[i]); - } -} diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index 303c9fb3024..ea3ec870fd4 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -78,11 +78,4 @@ _mesa_init_colortable( struct gl_color_table *table ); extern void _mesa_free_colortable_data( struct gl_color_table *table ); -extern void -_mesa_init_colortables( GLcontext *ctx ); - -extern void -_mesa_free_colortables_data( GLcontext *ctx ); - - #endif /* COLORTAB_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 6f2ffe107d2..774553ccce4 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -728,7 +728,6 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_attrib( ctx ); _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); - _mesa_init_colortables( ctx ); _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); @@ -1105,7 +1104,6 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); - _mesa_free_colortables_data( ctx ); _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); _mesa_free_queryobj_data(ctx); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index b0eb294df47..2c8c000f9f4 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -703,28 +703,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) client_state( ctx, cap, state ); return; - /* GL_SGI_color_table */ - case GL_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table, cap); - if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] = state; - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table, cap); - if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] = state; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table, cap); - if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] = state; - break; + /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_texture_color_table, cap); if (ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled == state) @@ -1343,17 +1322,6 @@ _mesa_IsEnabled( GLenum cap ) return (ctx->Array.ArrayObj->PointSize.Enabled != 0); #endif - /* GL_SGI_color_table */ - case GL_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table); - return ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table); - return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXTENSION(SGI_color_table); - return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]; - /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_texture_color_table); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 33599136b41..3e4801030d1 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -207,7 +207,6 @@ static const struct { { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { ON, "GL_OES_read_format", F(OES_read_format) }, { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, - { OFF, "GL_SGI_color_table", F(SGI_color_table) }, { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) }, { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, @@ -368,7 +367,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.NV_fragment_program_option = GL_TRUE; #endif ctx->Extensions.SGI_color_matrix = GL_TRUE; - ctx->Extensions.SGI_color_table = GL_TRUE; ctx->Extensions.SGI_texture_color_table = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; @@ -399,7 +397,6 @@ _mesa_enable_imaging_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_convolution = GL_TRUE; ctx->Extensions.SGI_color_matrix = GL_TRUE; - ctx->Extensions.SGI_color_table = GL_TRUE; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index f04f42022d6..bb2ce759d36 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -277,7 +277,6 @@ EXTRA_EXT(NV_texture_rectangle); EXTRA_EXT(EXT_stencil_two_side); EXTRA_EXT(NV_light_max_exponent); EXTRA_EXT(EXT_convolution); -EXTRA_EXT(SGI_color_table); EXTRA_EXT(SGI_texture_color_table); EXTRA_EXT(EXT_depth_bounds_test); EXTRA_EXT(ARB_depth_clamp); @@ -937,17 +936,6 @@ static const struct value_desc values[] = { CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]), extra_EXT_convolution }, - /* GL_SGI_color_table */ - { GL_COLOR_TABLE_SGI, - CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]), - extra_SGI_color_table }, - { GL_POST_CONVOLUTION_COLOR_TABLE_SGI, - CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]), - extra_SGI_color_table }, - { GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI, - CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]), - extra_SGI_color_table }, - /* GL_SGI_texture_color_table */ { GL_TEXTURE_COLOR_TABLE_SGI, LOC_TEXUNIT, TYPE_BOOLEAN, offsetof(struct gl_texture_unit, ColorTableEnabled), diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 453611d00b6..7918ef7926b 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1896,10 +1896,6 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, if (transferOps & IMAGE_MAP_COLOR_BIT) { _mesa_map_rgba( ctx, n, rgba ); } - /* GL_COLOR_TABLE lookup */ - if (transferOps & IMAGE_COLOR_TABLE_BIT) { - _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_PRECONVOLUTION], n, rgba); - } /* convolution */ if (transferOps & IMAGE_CONVOLUTION_BIT) { /* this has to be done in the calling code */ @@ -1917,18 +1913,10 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, ctx->Pixel.PostConvolutionBias[BCOMP], ctx->Pixel.PostConvolutionBias[ACOMP]); } - /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ - if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { - _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCONVOLUTION], n, rgba); - } /* color matrix transform */ if (transferOps & IMAGE_COLOR_MATRIX_BIT) { _mesa_transform_rgba(ctx, n, rgba); } - /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ - if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { - _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX], n, rgba); - } /* clamping to [0,1] */ if (transferOps & IMAGE_CLAMP_BIT) { GLuint i; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d918482353f..97187326085 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -964,11 +964,6 @@ struct gl_pixel_attrib GLboolean MapColorFlag; GLboolean MapStencilFlag; - /* There are multiple color table stages: */ - GLboolean ColorTableEnabled[COLORTABLE_MAX]; - GLfloat ColorTableScale[COLORTABLE_MAX][4]; /**< RGBA */ - GLfloat ColorTableBias[COLORTABLE_MAX][4]; /**< RGBA */ - /* Convolution (GL_EXT_convolution) */ GLboolean Convolution1DEnabled; GLboolean Convolution2DEnabled; @@ -2754,7 +2749,6 @@ struct gl_extensions GLboolean NV_vertex_program1_1; GLboolean OES_read_format; GLboolean SGI_color_matrix; - GLboolean SGI_color_table; GLboolean SGI_texture_color_table; GLboolean SGIS_generate_mipmap; GLboolean SGIS_texture_edge_clamp; @@ -2791,26 +2785,20 @@ struct gl_matrix_stack #define IMAGE_SCALE_BIAS_BIT 0x1 #define IMAGE_SHIFT_OFFSET_BIT 0x2 #define IMAGE_MAP_COLOR_BIT 0x4 -#define IMAGE_COLOR_TABLE_BIT 0x8 #define IMAGE_CONVOLUTION_BIT 0x10 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20 -#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40 #define IMAGE_COLOR_MATRIX_BIT 0x80 -#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100 #define IMAGE_CLAMP_BIT 0x800 /** Pixel Transfer ops up to convolution */ #define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \ IMAGE_SHIFT_OFFSET_BIT | \ - IMAGE_MAP_COLOR_BIT | \ - IMAGE_COLOR_TABLE_BIT) + IMAGE_MAP_COLOR_BIT) /** Pixel transfer ops after convolution */ #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \ - IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \ - IMAGE_COLOR_MATRIX_BIT | \ - IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) + IMAGE_COLOR_MATRIX_BIT) /*@}*/ @@ -3176,9 +3164,6 @@ struct __GLcontextRec struct gl_feedback Feedback; /**< Feedback */ struct gl_selection Select; /**< Selection */ - struct gl_color_table ColorTable[COLORTABLE_MAX]; - struct gl_color_table ProxyColorTable[COLORTABLE_MAX]; - struct gl_program_state Program; /**< general program state */ struct gl_vertex_program_state VertexProgram; struct gl_fragment_program_state FragmentProgram; diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 980c40550c3..834a41108c2 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -702,9 +702,6 @@ update_image_transfer_state(GLcontext *ctx) if (ctx->Pixel.MapColorFlag) mask |= IMAGE_MAP_COLOR_BIT; - if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]) - mask |= IMAGE_COLOR_TABLE_BIT; - if (ctx->Pixel.Convolution1DEnabled || ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { @@ -721,9 +718,6 @@ update_image_transfer_state(GLcontext *ctx) } } - if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]) - mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; - if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY || ctx->Pixel.PostColorMatrixScale[0] != 1.0F || ctx->Pixel.PostColorMatrixBias[0] != 0.0F || @@ -735,9 +729,6 @@ update_image_transfer_state(GLcontext *ctx) ctx->Pixel.PostColorMatrixBias[3] != 0.0F) mask |= IMAGE_COLOR_MATRIX_BIT; - if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]) - mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; - ctx->_ImageTransferState = mask; } @@ -825,11 +816,6 @@ _mesa_init_pixel( GLcontext *ctx ) init_pixelmap(&ctx->PixelMaps.AtoA); ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); - for (i = 0; i < COLORTABLE_MAX; i++) { - ASSIGN_4V(ctx->Pixel.ColorTableScale[i], 1.0, 1.0, 1.0, 1.0); - ASSIGN_4V(ctx->Pixel.ColorTableBias[i], 0.0, 0.0, 0.0, 0.0); - ctx->Pixel.ColorTableEnabled[i] = GL_FALSE; - } ctx->Pixel.Convolution1DEnabled = GL_FALSE; ctx->Pixel.Convolution2DEnabled = GL_FALSE; ctx->Pixel.Separable2DEnabled = GL_FALSE; -- cgit v1.2.3 From 73578ba9c4938db3a23198c3a2ddf843cfc4f700 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Sep 2010 16:58:48 -0700 Subject: mesa: Remove SGI_color_matrix. Another optional ARB_imaging subset extension. --- src/mesa/drivers/dri/i965/brw_state_upload.c | 1 - src/mesa/main/context.c | 2 - src/mesa/main/debug.c | 3 +- src/mesa/main/dlist.c | 2 - src/mesa/main/extensions.c | 3 - src/mesa/main/get.c | 25 ----- src/mesa/main/image.c | 34 ------- src/mesa/main/image.h | 5 - src/mesa/main/matrix.c | 6 -- src/mesa/main/mtypes.h | 25 +---- src/mesa/main/pixel.c | 66 ------------- src/mesa/main/querymatrix.c | 4 - src/mesa/program/prog_statevars.c | 29 ------ src/mesa/program/prog_statevars.h | 3 - src/mesa/state_tracker/st_atom_pixeltransfer.c | 130 +------------------------ src/mesa/state_tracker/st_extensions.c | 1 - 16 files changed, 5 insertions(+), 334 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index a0c130557e3..e4f36a7ec38 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -231,7 +231,6 @@ static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(_NEW_MODELVIEW), DEFINE_BIT(_NEW_PROJECTION), DEFINE_BIT(_NEW_TEXTURE_MATRIX), - DEFINE_BIT(_NEW_COLOR_MATRIX), DEFINE_BIT(_NEW_ACCUM), DEFINE_BIT(_NEW_COLOR), DEFINE_BIT(_NEW_DEPTH), diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 774553ccce4..87285683f80 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -341,7 +341,6 @@ static void dummy_enum_func(void) { gl_buffer_index bi = BUFFER_FRONT_LEFT; - gl_colortable_index ci = COLORTABLE_PRECONVOLUTION; gl_face_index fi = FACE_POS_X; gl_frag_attrib fa = FRAG_ATTRIB_WPOS; gl_frag_result fr = FRAG_RESULT_DEPTH; @@ -352,7 +351,6 @@ dummy_enum_func(void) gl_geom_result gr = GEOM_RESULT_POS; (void) bi; - (void) ci; (void) fi; (void) fa; (void) fr; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 526145aeccf..4205c7a4b71 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -85,13 +85,12 @@ void _mesa_print_state( const char *msg, GLuint state ) { _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", - (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "", (state & _NEW_ACCUM) ? "ctx->Accum, " : "", (state & _NEW_COLOR) ? "ctx->Color, " : "", (state & _NEW_DEPTH) ? "ctx->Depth, " : "", diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index d847d4d5d3c..3a730f0e406 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1552,7 +1552,6 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, n[3].f = params[0]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || - pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI) { n[4].f = params[1]; n[5].f = params[2]; @@ -1581,7 +1580,6 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) n[3].i = params[0]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || - pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI) { n[4].i = params[1]; n[5].i = params[2]; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 3e4801030d1..3f86973e3ea 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -206,7 +206,6 @@ static const struct { { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { ON, "GL_OES_read_format", F(OES_read_format) }, - { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) }, { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, @@ -366,7 +365,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program ctx->Extensions.NV_fragment_program_option = GL_TRUE; #endif - ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGI_texture_color_table = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; @@ -396,7 +394,6 @@ _mesa_enable_imaging_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_convolution = GL_TRUE; - ctx->Extensions.SGI_color_matrix = GL_TRUE; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index bb2ce759d36..33ea81b83a6 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -874,36 +874,12 @@ static const struct value_desc values[] = { extra_EXT_compiled_vertex_array }, /* GL_ARB_transpose_matrix */ - { GL_TRANSPOSE_COLOR_MATRIX_ARB, CONTEXT_MATRIX_T(ColorMatrixStack.Top), NO_EXTRA }, { GL_TRANSPOSE_MODELVIEW_MATRIX_ARB, CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA }, { GL_TRANSPOSE_PROJECTION_MATRIX_ARB, CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA }, { GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA }, - /* GL_SGI_color_matrix (also in 1.2 imaging) */ - { GL_COLOR_MATRIX_SGI, CONTEXT_MATRIX(ColorMatrixStack.Top), NO_EXTRA }, - { GL_COLOR_MATRIX_STACK_DEPTH_SGI, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, ColorMatrixStack.Depth), NO_EXTRA }, - { GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI, - CONST(MAX_COLOR_STACK_DEPTH), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_RED_SCALE_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixScale[0]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixScale[1]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixScale[2]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixScale[3]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_RED_BIAS_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixBias[0]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixBias[1]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixBias[2]), NO_EXTRA }, - { GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI, - CONTEXT_FLOAT(Pixel.PostColorMatrixBias[3]), NO_EXTRA }, - /* GL_EXT_convolution (also in 1.2 imaging) */ { GL_CONVOLUTION_1D_EXT, CONTEXT_BOOL(Pixel.Convolution1DEnabled), extra_EXT_convolution }, @@ -1449,7 +1425,6 @@ find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v) case GL_MODELVIEW_STACK_DEPTH: case GL_PROJECTION_STACK_DEPTH: - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: v->value_int = *(GLint *) ((char *) ctx + d->offset) + 1; break; diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 7918ef7926b..788584ae85f 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1525,36 +1525,6 @@ _mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) } } - -/* - * Apply the color matrix and post color matrix scaling and biasing. - */ -void -_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) -{ - const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0]; - const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; - const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; - const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; - const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; - const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; - const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; - const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; - const GLfloat *m = ctx->ColorMatrixStack.Top->m; - GLuint i; - for (i = 0; i < n; i++) { - const GLfloat r = rgba[i][RCOMP]; - const GLfloat g = rgba[i][GCOMP]; - const GLfloat b = rgba[i][BCOMP]; - const GLfloat a = rgba[i][ACOMP]; - rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; - rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; - rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; - rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; - } -} - - /** * Apply a color table lookup to an array of floating point RGBA colors. */ @@ -1913,10 +1883,6 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, ctx->Pixel.PostConvolutionBias[BCOMP], ctx->Pixel.PostConvolutionBias[ACOMP]); } - /* color matrix transform */ - if (transferOps & IMAGE_COLOR_MATRIX_BIT) { - _mesa_transform_rgba(ctx, n, rgba); - } /* clamping to [0,1] */ if (transferOps & IMAGE_CLAMP_BIT) { GLuint i; diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index 8b180d6bfe6..672dbf2823e 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -163,11 +163,6 @@ _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], extern void _mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); - -extern void -_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); - - extern void _mesa_lookup_rgba_float(const struct gl_color_table *table, GLuint n, GLfloat rgba[][4]); diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 4b8c00b5b63..8ed718cd38e 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -177,9 +177,6 @@ _mesa_MatrixMode( GLenum mode ) ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack)); ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; break; - case GL_COLOR: - ctx->CurrentStack = &ctx->ColorMatrixStack; - break; case GL_MATRIX0_NV: case GL_MATRIX1_NV: case GL_MATRIX2_NV: @@ -724,8 +721,6 @@ void _mesa_init_matrix( GLcontext * ctx ) _NEW_MODELVIEW); init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH, _NEW_PROJECTION); - init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH, - _NEW_COLOR_MATRIX); for (i = 0; i < Elements(ctx->TextureMatrixStack); i++) init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, _NEW_TEXTURE_MATRIX); @@ -753,7 +748,6 @@ void _mesa_free_matrix_data( GLcontext *ctx ) free_matrix_stack(&ctx->ModelviewMatrixStack); free_matrix_stack(&ctx->ProjectionMatrixStack); - free_matrix_stack(&ctx->ColorMatrixStack); for (i = 0; i < Elements(ctx->TextureMatrixStack); i++) free_matrix_stack(&ctx->TextureMatrixStack[i]); for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 97187326085..c982f55e825 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -454,16 +454,6 @@ typedef enum BUFFER_BIT_COLOR7) -/** The pixel transfer path has three color tables: */ -typedef enum -{ - COLORTABLE_PRECONVOLUTION, - COLORTABLE_POSTCONVOLUTION, - COLORTABLE_POSTCOLORMATRIX, - COLORTABLE_MAX -} gl_colortable_index; - - /** * Data structure for color tables */ @@ -975,11 +965,6 @@ struct gl_pixel_attrib GLfloat PostConvolutionScale[4]; /**< RGBA */ GLfloat PostConvolutionBias[4]; /**< RGBA */ - /* Color matrix (GL_SGI_color_matrix) */ - /* Note: the color matrix is not part of this attrib group */ - GLfloat PostColorMatrixScale[4]; /**< RGBA */ - GLfloat PostColorMatrixBias[4]; /**< RGBA */ - /*--- End Pixel Transfer State ---*/ /** glPixelZoom */ @@ -2748,7 +2733,6 @@ struct gl_extensions GLboolean NV_vertex_program; GLboolean NV_vertex_program1_1; GLboolean OES_read_format; - GLboolean SGI_color_matrix; GLboolean SGI_texture_color_table; GLboolean SGIS_generate_mipmap; GLboolean SGIS_texture_edge_clamp; @@ -2787,7 +2771,6 @@ struct gl_matrix_stack #define IMAGE_MAP_COLOR_BIT 0x4 #define IMAGE_CONVOLUTION_BIT 0x10 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20 -#define IMAGE_COLOR_MATRIX_BIT 0x80 #define IMAGE_CLAMP_BIT 0x800 @@ -2797,8 +2780,7 @@ struct gl_matrix_stack IMAGE_MAP_COLOR_BIT) /** Pixel transfer ops after convolution */ -#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \ - IMAGE_COLOR_MATRIX_BIT) +#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS) /*@}*/ @@ -2811,7 +2793,6 @@ struct gl_matrix_stack #define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */ #define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */ #define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */ -#define _NEW_COLOR_MATRIX 0x8 /**< __GLcontextRec::ColorMatrix */ #define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */ #define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */ #define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */ @@ -2934,8 +2915,7 @@ struct gl_matrix_stack #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \ _NEW_TEXTURE) -#define _MESA_NEW_TRANSFER_STATE (_NEW_PIXEL | \ - _NEW_COLOR_MATRIX) +#define _MESA_NEW_TRANSFER_STATE (_NEW_PIXEL) /*@}*/ @@ -3083,7 +3063,6 @@ struct __GLcontextRec /*@{*/ struct gl_matrix_stack ModelviewMatrixStack; struct gl_matrix_stack ProjectionMatrixStack; - struct gl_matrix_stack ColorMatrixStack; struct gl_matrix_stack TextureMatrixStack[MAX_TEXTURE_UNITS]; struct gl_matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; struct gl_matrix_stack *CurrentStack; /**< Points to one of the above stacks */ diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 834a41108c2..5e900b4eed9 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -566,54 +566,6 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.DepthBias = param; break; - case GL_POST_COLOR_MATRIX_RED_SCALE: - if (ctx->Pixel.PostColorMatrixScale[0] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixScale[0] = param; - break; - case GL_POST_COLOR_MATRIX_RED_BIAS: - if (ctx->Pixel.PostColorMatrixBias[0] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixBias[0] = param; - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE: - if (ctx->Pixel.PostColorMatrixScale[1] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixScale[1] = param; - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS: - if (ctx->Pixel.PostColorMatrixBias[1] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixBias[1] = param; - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE: - if (ctx->Pixel.PostColorMatrixScale[2] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixScale[2] = param; - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS: - if (ctx->Pixel.PostColorMatrixBias[2] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixBias[2] = param; - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE: - if (ctx->Pixel.PostColorMatrixScale[3] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixScale[3] = param; - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS: - if (ctx->Pixel.PostColorMatrixBias[3] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixBias[3] = param; - break; case GL_POST_CONVOLUTION_RED_SCALE: if (ctx->Pixel.PostConvolutionScale[0] == param) return; @@ -718,17 +670,6 @@ update_image_transfer_state(GLcontext *ctx) } } - if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY || - ctx->Pixel.PostColorMatrixScale[0] != 1.0F || - ctx->Pixel.PostColorMatrixBias[0] != 0.0F || - ctx->Pixel.PostColorMatrixScale[1] != 1.0F || - ctx->Pixel.PostColorMatrixBias[1] != 0.0F || - ctx->Pixel.PostColorMatrixScale[2] != 1.0F || - ctx->Pixel.PostColorMatrixBias[2] != 0.0F || - ctx->Pixel.PostColorMatrixScale[3] != 1.0F || - ctx->Pixel.PostColorMatrixBias[3] != 0.0F) - mask |= IMAGE_COLOR_MATRIX_BIT; - ctx->_ImageTransferState = mask; } @@ -738,11 +679,6 @@ update_image_transfer_state(GLcontext *ctx) */ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) { - if (new_state & _NEW_COLOR_MATRIX) - _math_matrix_analyse( ctx->ColorMatrixStack.Top ); - - /* References ColorMatrix.type (derived above). - */ if (new_state & _MESA_NEW_TRANSFER_STATE) update_image_transfer_state(ctx); } @@ -814,8 +750,6 @@ _mesa_init_pixel( GLcontext *ctx ) init_pixelmap(&ctx->PixelMaps.GtoG); init_pixelmap(&ctx->PixelMaps.BtoB); init_pixelmap(&ctx->PixelMaps.AtoA); - ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); - ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); ctx->Pixel.Convolution1DEnabled = GL_FALSE; ctx->Pixel.Convolution2DEnabled = GL_FALSE; ctx->Pixel.Separable2DEnabled = GL_FALSE; diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c index 36236eb9a75..944ad435f7a 100644 --- a/src/mesa/main/querymatrix.c +++ b/src/mesa/main/querymatrix.c @@ -117,10 +117,6 @@ GLbitfield GL_APIENTRY _es_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[ {GL_MODELVIEW, GL_MODELVIEW_MATRIX}, {GL_PROJECTION, GL_PROJECTION_MATRIX}, {GL_TEXTURE, GL_TEXTURE_MATRIX}, -#if 0 - /* this doesn't exist in GLES */ - {GL_COLOR, GL_COLOR_MATRIX}, -#endif }; /* Call Mesa to get the current matrix in floating-point form. First, diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c index 2687f8ae2c0..c6fb42b9a69 100644 --- a/src/mesa/program/prog_statevars.c +++ b/src/mesa/program/prog_statevars.c @@ -273,7 +273,6 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], case STATE_MVP_MATRIX: case STATE_TEXTURE_MATRIX: case STATE_PROGRAM_MATRIX: - case STATE_COLOR_MATRIX: { /* state[0] = modelview, projection, texture, etc. */ /* state[1] = which texture matrix or program matrix */ @@ -309,9 +308,6 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], ASSERT(index < Elements(ctx->ProgramMatrixStack)); matrix = ctx->ProgramMatrixStack[index].Top; } - else if (mat == STATE_COLOR_MATRIX) { - matrix = ctx->ColorMatrixStack.Top; - } else { _mesa_problem(ctx, "Bad matrix name in _mesa_fetch_state()"); return; @@ -555,14 +551,6 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[3] = ctx->Pixel.AlphaBias; return; - case STATE_PCM_SCALE: - COPY_4V(value, ctx->Pixel.PostColorMatrixScale); - return; - - case STATE_PCM_BIAS: - COPY_4V(value, ctx->Pixel.PostColorMatrixBias); - return; - case STATE_SHADOW_AMBIENT: { const int unit = (int) state[2]; @@ -667,8 +655,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) return _NEW_TEXTURE_MATRIX; case STATE_PROGRAM_MATRIX: return _NEW_TRACK_MATRIX; - case STATE_COLOR_MATRIX: - return _NEW_COLOR_MATRIX; case STATE_DEPTH_RANGE: return _NEW_VIEWPORT; @@ -706,8 +692,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) case STATE_PT_SCALE: case STATE_PT_BIAS: - case STATE_PCM_SCALE: - case STATE_PCM_BIAS: return _NEW_PIXEL; case STATE_FB_SIZE: @@ -792,9 +776,6 @@ append_token(char *dst, gl_state_index k) case STATE_PROGRAM_MATRIX: append(dst, "matrix.program"); break; - case STATE_COLOR_MATRIX: - append(dst, "matrix.color"); - break; case STATE_MATRIX_INVERSE: append(dst, ".inverse"); break; @@ -913,12 +894,6 @@ append_token(char *dst, gl_state_index k) case STATE_PT_BIAS: append(dst, "PTbias"); break; - case STATE_PCM_SCALE: - append(dst, "PCMscale"); - break; - case STATE_PCM_BIAS: - append(dst, "PCMbias"); - break; case STATE_SHADOW_AMBIENT: append(dst, "CompareFailValue"); break; @@ -1010,7 +985,6 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) case STATE_MVP_MATRIX: case STATE_TEXTURE_MATRIX: case STATE_PROGRAM_MATRIX: - case STATE_COLOR_MATRIX: { /* state[0] = modelview, projection, texture, etc. */ /* state[1] = which texture matrix or program matrix */ @@ -1147,9 +1121,6 @@ _mesa_load_tracked_matrices(GLcontext *ctx) Elements(ctx->TextureMatrixStack) - 1); mat = ctx->TextureMatrixStack[unit].Top; } - else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) { - mat = ctx->ColorMatrixStack.Top; - } else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) { /* XXX verify the combined matrix is up to date */ mat = &ctx->_ModelProjectMatrix; diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h index 1753471ffb6..cfce226fb49 100644 --- a/src/mesa/program/prog_statevars.h +++ b/src/mesa/program/prog_statevars.h @@ -67,7 +67,6 @@ typedef enum gl_state_index_ { STATE_MVP_MATRIX, STATE_TEXTURE_MATRIX, STATE_PROGRAM_MATRIX, - STATE_COLOR_MATRIX, STATE_MATRIX_INVERSE, STATE_MATRIX_TRANSPOSE, STATE_MATRIX_INVTRANS, @@ -116,8 +115,6 @@ typedef enum gl_state_index_ { STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ - STATE_PCM_SCALE, /**< Post color matrix RGBA scale */ - STATE_PCM_BIAS, /**< Post color matrix RGBA bias */ STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */ STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */ STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */ diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 8a8d17599ec..081b6b3e233 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -27,7 +27,7 @@ /* * Generate fragment programs to implement pixel transfer ops, such as - * scale/bias, colormatrix, colortable, convolution... + * scale/bias, colortable, convolution... * * Authors: * Brian Paul @@ -55,8 +55,6 @@ struct state_key { GLuint scaleAndBias:1; - GLuint colorMatrix:1; - GLuint colorMatrixPostScaleBias:1; GLuint pixelMaps:1; #if 0 @@ -70,27 +68,9 @@ struct state_key #endif }; - -static GLboolean -is_identity(const GLfloat m[16]) -{ - GLuint i; - for (i = 0; i < 16; i++) { - const int row = i % 4, col = i / 4; - const float val = (GLfloat)(row == col); - if (m[i] != val) - return GL_FALSE; - } - return GL_TRUE; -} - - static void make_state_key(GLcontext *ctx, struct state_key *key) { - static const GLfloat zero[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; - static const GLfloat one[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - memset(key, 0, sizeof(*key)); if (ctx->Pixel.RedBias != 0.0 || ctx->Pixel.RedScale != 1.0 || @@ -100,15 +80,6 @@ make_state_key(GLcontext *ctx, struct state_key *key) key->scaleAndBias = 1; } - if (!is_identity(ctx->ColorMatrixStack.Top->m)) { - key->colorMatrix = 1; - } - - if (!TEST_EQ_4V(ctx->Pixel.PostColorMatrixScale, one) || - !TEST_EQ_4V(ctx->Pixel.PostColorMatrixBias, zero)) { - key->colorMatrixPostScaleBias = 1; - } - key->pixelMaps = ctx->Pixel.MapColorFlag; } @@ -306,103 +277,6 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) fp->Base.SamplersUsed |= (1 << 1); /* sampler 1 is used */ } - if (key->colorMatrix) { - static const gl_state_index row0_state[STATE_LENGTH] = - { STATE_COLOR_MATRIX, 0, 0, 0, 0 }; - static const gl_state_index row1_state[STATE_LENGTH] = - { STATE_COLOR_MATRIX, 0, 1, 1, 0 }; - static const gl_state_index row2_state[STATE_LENGTH] = - { STATE_COLOR_MATRIX, 0, 2, 2, 0 }; - static const gl_state_index row3_state[STATE_LENGTH] = - { STATE_COLOR_MATRIX, 0, 3, 3, 0 }; - - GLint row0_p = _mesa_add_state_reference(params, row0_state); - GLint row1_p = _mesa_add_state_reference(params, row1_state); - GLint row2_p = _mesa_add_state_reference(params, row2_state); - GLint row3_p = _mesa_add_state_reference(params, row3_state); - const GLuint temp = 1; - - /* DP4 temp.x, colorTemp, matrow0; */ - _mesa_init_instructions(inst + ic, 1); - inst[ic].Opcode = OPCODE_DP4; - inst[ic].DstReg.File = PROGRAM_TEMPORARY; - inst[ic].DstReg.Index = temp; - inst[ic].DstReg.WriteMask = WRITEMASK_X; - inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY; - inst[ic].SrcReg[0].Index = colorTemp; - inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR; - inst[ic].SrcReg[1].Index = row0_p; - ic++; - - /* DP4 temp.y, colorTemp, matrow1; */ - _mesa_init_instructions(inst + ic, 1); - inst[ic].Opcode = OPCODE_DP4; - inst[ic].DstReg.File = PROGRAM_TEMPORARY; - inst[ic].DstReg.Index = temp; - inst[ic].DstReg.WriteMask = WRITEMASK_Y; - inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY; - inst[ic].SrcReg[0].Index = colorTemp; - inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR; - inst[ic].SrcReg[1].Index = row1_p; - ic++; - - /* DP4 temp.z, colorTemp, matrow2; */ - _mesa_init_instructions(inst + ic, 1); - inst[ic].Opcode = OPCODE_DP4; - inst[ic].DstReg.File = PROGRAM_TEMPORARY; - inst[ic].DstReg.Index = temp; - inst[ic].DstReg.WriteMask = WRITEMASK_Z; - inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY; - inst[ic].SrcReg[0].Index = colorTemp; - inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR; - inst[ic].SrcReg[1].Index = row2_p; - ic++; - - /* DP4 temp.w, colorTemp, matrow3; */ - _mesa_init_instructions(inst + ic, 1); - inst[ic].Opcode = OPCODE_DP4; - inst[ic].DstReg.File = PROGRAM_TEMPORARY; - inst[ic].DstReg.Index = temp; - inst[ic].DstReg.WriteMask = WRITEMASK_W; - inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY; - inst[ic].SrcReg[0].Index = colorTemp; - inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR; - inst[ic].SrcReg[1].Index = row3_p; - ic++; - - /* MOV colorTemp, temp; */ - _mesa_init_instructions(inst + ic, 1); - inst[ic].Opcode = OPCODE_MOV; - inst[ic].DstReg.File = PROGRAM_TEMPORARY; - inst[ic].DstReg.Index = colorTemp; - inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY; - inst[ic].SrcReg[0].Index = temp; - ic++; - } - - if (key->colorMatrixPostScaleBias) { - static const gl_state_index scale_state[STATE_LENGTH] = - { STATE_INTERNAL, STATE_PT_SCALE, 0, 0, 0 }; - static const gl_state_index bias_state[STATE_LENGTH] = - { STATE_INTERNAL, STATE_PT_BIAS, 0, 0, 0 }; - GLint scale_param, bias_param; - - scale_param = _mesa_add_state_reference(params, scale_state); - bias_param = _mesa_add_state_reference(params, bias_state); - - _mesa_init_instructions(inst + ic, 1); - inst[ic].Opcode = OPCODE_MAD; - inst[ic].DstReg.File = PROGRAM_TEMPORARY; - inst[ic].DstReg.Index = colorTemp; - inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY; - inst[ic].SrcReg[0].Index = colorTemp; - inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR; - inst[ic].SrcReg[1].Index = scale_param; - inst[ic].SrcReg[2].File = PROGRAM_STATE_VAR; - inst[ic].SrcReg[2].Index = bias_param; - ic++; - } - /* Modify last instruction's dst reg to write to result.color */ { struct prog_instruction *last = &inst[ic - 1]; @@ -473,7 +347,7 @@ update_pixel_transfer(struct st_context *st) const struct st_tracked_state st_update_pixel_transfer = { "st_update_pixel_transfer", /* name */ { /* dirty */ - _NEW_PIXEL | _NEW_COLOR_MATRIX, /* mesa */ + _NEW_PIXEL, /* mesa */ 0, /* st */ }, update_pixel_transfer /* update */ diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 017f6c5cf7e..225f75e3af0 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -271,7 +271,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.OES_draw_texture = GL_TRUE; #endif - ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; /* -- cgit v1.2.3 From a62efdf82c20747feb11dfd7756f0579aa914b57 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Sep 2010 19:37:15 -0700 Subject: mesa: Remove EXT_convolution. More optional code. --- src/mesa/drivers/common/driverfuncs.c | 2 - src/mesa/drivers/common/meta.c | 82 -- src/mesa/drivers/dri/intel/intel_extensions.c | 2 - src/mesa/drivers/dri/intel/intel_tex_image.c | 20 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 16 +- src/mesa/drivers/dri/savage/savagetex.c | 3 - src/mesa/drivers/dri/unichrome/via_tex.c | 22 +- src/mesa/main/attrib.c | 12 - src/mesa/main/context.c | 2 - src/mesa/main/convolve.c | 1307 +------------------------ src/mesa/main/convolve.h | 70 -- src/mesa/main/dd.h | 9 - src/mesa/main/enable.c | 34 - src/mesa/main/extensions.c | 3 - src/mesa/main/get.c | 33 - src/mesa/main/image.c | 21 +- src/mesa/main/mtypes.h | 46 +- src/mesa/main/pixel.c | 82 -- src/mesa/main/texcompress_fxt1.c | 3 - src/mesa/main/texcompress_s3tc.c | 5 - src/mesa/main/teximage.c | 62 -- src/mesa/main/texstore.c | 210 +--- src/mesa/state_tracker/st_cb_readpixels.c | 3 - src/mesa/state_tracker/st_cb_texture.c | 5 - src/mesa/swrast/s_copypix.c | 103 -- src/mesa/swrast/s_drawpix.c | 57 -- src/mesa/swrast/s_readpix.c | 59 +- 27 files changed, 63 insertions(+), 2210 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index f92cdc5a777..aee73b53bb3 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -122,8 +122,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* imaging */ driver->CopyColorTable = _mesa_meta_CopyColorTable; driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable; - driver->CopyConvolutionFilter1D = _mesa_meta_CopyConvolutionFilter1D; - driver->CopyConvolutionFilter2D = _mesa_meta_CopyConvolutionFilter2D; /* Vertex/fragment programs */ driver->BindProgram = NULL; diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 87d116ad9f1..16ca42f7b5e 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -40,7 +40,6 @@ #include "main/bufferobj.h" #include "main/buffers.h" #include "main/colortab.h" -#include "main/convolve.h" #include "main/depth.h" #include "main/enable.h" #include "main/fbobject.h" @@ -128,9 +127,6 @@ struct save_state GLfloat AlphaBias, AlphaScale; GLfloat DepthBias, DepthScale; GLboolean MapColorFlag; - GLboolean Convolution1DEnabled; - GLboolean Convolution2DEnabled; - GLboolean Separable2DEnabled; /** META_RASTERIZATION */ GLenum FrontPolygonMode, BackPolygonMode; @@ -389,9 +385,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) save->AlphaScale = ctx->Pixel.AlphaScale; save->AlphaBias = ctx->Pixel.AlphaBias; save->MapColorFlag = ctx->Pixel.MapColorFlag; - save->Convolution1DEnabled = ctx->Pixel.Convolution1DEnabled; - save->Convolution2DEnabled = ctx->Pixel.Convolution2DEnabled; - save->Separable2DEnabled = ctx->Pixel.Separable2DEnabled; ctx->Pixel.RedScale = 1.0F; ctx->Pixel.RedBias = 0.0F; ctx->Pixel.GreenScale = 1.0F; @@ -401,9 +394,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) ctx->Pixel.AlphaScale = 1.0F; ctx->Pixel.AlphaBias = 0.0F; ctx->Pixel.MapColorFlag = GL_FALSE; - ctx->Pixel.Convolution1DEnabled = GL_FALSE; - ctx->Pixel.Convolution2DEnabled = GL_FALSE; - ctx->Pixel.Separable2DEnabled = GL_FALSE; /* XXX more state */ ctx->NewState |=_NEW_PIXEL; } @@ -638,9 +628,6 @@ _mesa_meta_end(GLcontext *ctx) ctx->Pixel.AlphaScale = save->AlphaScale; ctx->Pixel.AlphaBias = save->AlphaBias; ctx->Pixel.MapColorFlag = save->MapColorFlag; - ctx->Pixel.Convolution1DEnabled = save->Convolution1DEnabled; - ctx->Pixel.Convolution2DEnabled = save->Convolution2DEnabled; - ctx->Pixel.Separable2DEnabled = save->Separable2DEnabled; /* XXX more state */ ctx->NewState |=_NEW_PIXEL; } @@ -2579,14 +2566,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, format, type, &ctx->Pack, buf); _mesa_meta_end(ctx); - /* - * Prepare for new texture image size/data - */ - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, - &postConvWidth, &postConvHeight); - } - if (texImage->Data) { ctx->Driver.FreeTexImageData(ctx, texImage); } @@ -2804,64 +2783,3 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, free(buf); } - - -void -_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width) -{ - GLfloat *buf; - - buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat)); - if (!buf) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); - return; - } - - /* - * Read image from framebuffer (disable pixel transfer ops) - */ - _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); - _mesa_update_state(ctx); - ctx->Driver.ReadPixels(ctx, x, y, width, 1, - GL_RGBA, GL_FLOAT, &ctx->Pack, buf); - - _mesa_ConvolutionFilter1D(target, internalFormat, width, - GL_RGBA, GL_FLOAT, buf); - - _mesa_meta_end(ctx); - - free(buf); -} - - -void -_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - GLfloat *buf; - - buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!buf) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); - return; - } - - /* - * Read image from framebuffer (disable pixel transfer ops) - */ - _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); - _mesa_update_state(ctx); - - ctx->Driver.ReadPixels(ctx, x, y, width, height, - GL_RGBA, GL_FLOAT, &ctx->Pack, buf); - - _mesa_ConvolutionFilter2D(target, internalFormat, width, height, - GL_RGBA, GL_FLOAT, buf); - - _mesa_meta_end(ctx); - - free(buf); -} diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 4b6229ffe6f..2edd6d21b48 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -208,8 +208,6 @@ intelInitExtensions(GLcontext *ctx) { struct intel_context *intel = intel_context(ctx); - /* Disable imaging extension until convolution is working in teximage paths. - */ driInitExtensions(ctx, card_extensions, GL_FALSE); _mesa_map_function_array(GL_VERSION_2_1_functions); diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index b1ed7ee5e73..f8cb50797e1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -4,7 +4,6 @@ #include "main/mtypes.h" #include "main/enums.h" #include "main/bufferobj.h" -#include "main/convolve.h" #include "main/context.h" #include "main/formats.h" #include "main/texcompress.h" @@ -320,8 +319,6 @@ intelTexImage(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); struct intel_texture_image *intelImage = intel_texture_image(texImage); - GLint postConvWidth = width; - GLint postConvHeight = height; GLint texelBytes, sizeInBytes; GLuint dstRowStride = 0, srcRowStride = texImage->RowStride; @@ -331,11 +328,6 @@ intelTexImage(GLcontext * ctx, intelImage->face = target_to_face(target); intelImage->level = level; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; } @@ -343,13 +335,13 @@ intelTexImage(GLcontext * ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + if (width * texelBytes < 32) { + width = 32 / texelBytes; + texImage->RowStride = width; } if (!intelImage->mt) { - assert(texImage->RowStride == postConvWidth); + assert(texImage->RowStride == width); } } @@ -502,8 +494,8 @@ intelTexImage(GLcontext * ctx, assert(dims != 3); } else { - dstRowStride = postConvWidth * texelBytes; - sizeInBytes = depth * dstRowStride * postConvHeight; + dstRowStride = width * texelBytes; + sizeInBytes = depth * dstRowStride * height; } texImage->Data = _mesa_alloc_texmemory(sizeInBytes); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 8c6a50d2f0d..bf30e0cab8b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -32,7 +32,6 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/context.h" -#include "main/convolve.h" #include "main/enums.h" #include "main/mipmap.h" #include "main/texcompress.h" @@ -773,8 +772,6 @@ static void radeon_teximage( radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - GLint postConvWidth = width; - GLint postConvHeight = height; GLuint face = _mesa_tex_target_to_face(target); radeon_print(RADEON_TEXTURE, RADEON_NORMAL, @@ -795,20 +792,15 @@ static void radeon_teximage( t->validated = GL_FALSE; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - if (!_mesa_is_format_compressed(texImage->TexFormat)) { GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + if (width * texelBytes < 32) { + width = 32 / texelBytes; + texImage->RowStride = width; } if (!image->mt) { - assert(texImage->RowStride == postConvWidth); + assert(texImage->RowStride == width); } } diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 1523af4065f..89090da5c63 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -28,7 +28,6 @@ #include "main/macros.h" #include "main/texstore.h" #include "main/texobj.h" -#include "main/convolve.h" #include "main/colormac.h" #include "main/simple_list.h" #include "main/enums.h" @@ -586,7 +585,6 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr @@ -626,7 +624,6 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a64f093326f..01cb3ebbc88 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -32,7 +32,6 @@ #include "main/enums.h" #include "main/formats.h" #include "main/colortab.h" -#include "main/convolve.h" #include "main/context.h" #include "main/mipmap.h" #include "main/mm.h" @@ -664,8 +663,6 @@ static void viaTexImage(GLcontext *ctx, struct gl_texture_image *texImage) { struct via_context *vmesa = VIA_CONTEXT(ctx); - GLint postConvWidth = width; - GLint postConvHeight = height; GLint texelBytes, sizeInBytes; struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; @@ -676,11 +673,6 @@ static void viaTexImage(GLcontext *ctx, via_release_pending_textures(vmesa); } - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - /* choose the texture format */ texImage->TexFormat = viaChooseTexFormat(ctx, internalFormat, format, type); @@ -690,13 +682,13 @@ static void viaTexImage(GLcontext *ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + if (width * texelBytes < 32) { + width = 32 / texelBytes; + texImage->RowStride = width; } - assert(texImage->RowStride == postConvWidth); - viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); + assert(texImage->RowStride == width); + viaImage->pitchLog2 = logbase2(width * texelBytes); /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) @@ -705,7 +697,7 @@ static void viaTexImage(GLcontext *ctx, texImage->Height, texImage->Depth); else - sizeInBytes = postConvWidth * postConvHeight * texelBytes; + sizeInBytes = width * height * texelBytes; /* Attempt to allocate texture memory directly, otherwise use main @@ -786,7 +778,7 @@ static void viaTexImage(GLcontext *ctx, dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); } else { - dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); + dstRowStride = width * _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 73c2375f9d3..0299525f46b 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -69,9 +69,6 @@ struct gl_enable_attrib GLboolean Blend; GLbitfield ClipPlanes; GLboolean ColorMaterial; - GLboolean Convolution1D; - GLboolean Convolution2D; - GLboolean Separable2D; GLboolean CullFace; GLboolean DepthClamp; GLboolean DepthTest; @@ -259,9 +256,6 @@ _mesa_PushAttrib(GLbitfield mask) attr->Blend = ctx->Color.BlendEnabled; attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; - attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; - attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; - attr->Separable2D = ctx->Pixel.Separable2DEnabled; attr->CullFace = ctx->Polygon.CullFlag; attr->DepthClamp = ctx->Transform.DepthClamp; attr->DepthTest = ctx->Depth.Test; @@ -516,12 +510,6 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_DEPTH_CLAMP); TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); - TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, - GL_CONVOLUTION_1D); - TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, - GL_CONVOLUTION_2D); - TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, - GL_SEPARABLE_2D); TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG); TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING); TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 87285683f80..7d6bfaa62d1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -557,8 +557,6 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; - ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; - ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; ctx->Const.MaxLights = MAX_LIGHTS; ctx->Const.MaxShininess = 128.0; diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index f63bddc44d5..301569e5f67 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -45,218 +45,20 @@ #if FEATURE_convolve - -/* - * Given an internalFormat token passed to glConvolutionFilter - * or glSeparableFilter, return the corresponding base format. - * Return -1 if invalid token. - */ -static GLint -base_filter_format( GLenum format ) -{ - switch (format) { - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return GL_ALPHA; - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return GL_LUMINANCE; - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return GL_LUMINANCE_ALPHA; - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - return GL_INTENSITY; - case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return GL_RGB; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB5_A1: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return GL_RGBA; - default: - return -1; /* error */ - } -} - - -void GLAPIENTRY +static void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { - GLint baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (target != GL_CONVOLUTION_1D) { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); - return; - } - - baseFormat = base_filter_format(internalFormat); - if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)"); - return; - } - if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { - _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)"); - return; - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)"); - return; - } - - if (format == GL_COLOR_INDEX || - format == GL_STENCIL_INDEX || - format == GL_DEPTH_COMPONENT || - format == GL_INTENSITY || - type == GL_BITMAP) { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)"); - return; - } - - ctx->Convolution1D.Format = format; - ctx->Convolution1D.InternalFormat = internalFormat; - ctx->Convolution1D.Width = width; - ctx->Convolution1D.Height = 1; - - image = _mesa_map_validate_pbo_source(ctx, - 1, &ctx->Unpack, width, 1, 1, - format, type, image, - "glConvolutionFilter1D"); - if (!image) - return; - - _mesa_unpack_color_span_float(ctx, width, GL_RGBA, - ctx->Convolution1D.Filter, - format, type, image, &ctx->Unpack, - 0); /* transferOps */ - - _mesa_unmap_pbo_source(ctx, &ctx->Unpack); - - _mesa_scale_and_bias_rgba(width, - (GLfloat (*)[4]) ctx->Convolution1D.Filter, - ctx->Pixel.ConvolutionFilterScale[0][0], - ctx->Pixel.ConvolutionFilterScale[0][1], - ctx->Pixel.ConvolutionFilterScale[0][2], - ctx->Pixel.ConvolutionFilterScale[0][3], - ctx->Pixel.ConvolutionFilterBias[0][0], - ctx->Pixel.ConvolutionFilterBias[0][1], - ctx->Pixel.ConvolutionFilterBias[0][2], - ctx->Pixel.ConvolutionFilterBias[0][3]); - - ctx->NewState |= _NEW_PIXEL; + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D"); } - -void GLAPIENTRY +static void GLAPIENTRY _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { - GLint baseFormat; - GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (target != GL_CONVOLUTION_2D) { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); - return; - } - - baseFormat = base_filter_format(internalFormat); - if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)"); - return; - } - - if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { - _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)"); - return; - } - if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { - _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)"); - return; - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)"); - return; - } - if (format == GL_COLOR_INDEX || - format == GL_STENCIL_INDEX || - format == GL_DEPTH_COMPONENT || - format == GL_INTENSITY || - type == GL_BITMAP) { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)"); - return; - } - - /* this should have been caught earlier */ - assert(_mesa_components_in_format(format)); - - ctx->Convolution2D.Format = format; - ctx->Convolution2D.InternalFormat = internalFormat; - ctx->Convolution2D.Width = width; - ctx->Convolution2D.Height = height; - - image = _mesa_map_validate_pbo_source(ctx, - 2, &ctx->Unpack, width, height, 1, - format, type, image, - "glConvolutionFilter2D"); - if (!image) - return; - - /* Unpack filter image. We always store filters in RGBA format. */ - for (i = 0; i < height; i++) { - const GLvoid *src = _mesa_image_address2d(&ctx->Unpack, image, width, - height, format, type, i, 0); - GLfloat *dst = ctx->Convolution2D.Filter + i * width * 4; - _mesa_unpack_color_span_float(ctx, width, GL_RGBA, dst, - format, type, src, &ctx->Unpack, - 0); /* transferOps */ - } - - _mesa_unmap_pbo_source(ctx, &ctx->Unpack); - _mesa_scale_and_bias_rgba(width * height, - (GLfloat (*)[4]) ctx->Convolution2D.Filter, - ctx->Pixel.ConvolutionFilterScale[1][0], - ctx->Pixel.ConvolutionFilterScale[1][1], - ctx->Pixel.ConvolutionFilterScale[1][2], - ctx->Pixel.ConvolutionFilterScale[1][3], - ctx->Pixel.ConvolutionFilterBias[1][0], - ctx->Pixel.ConvolutionFilterBias[1][1], - ctx->Pixel.ConvolutionFilterBias[1][2], - ctx->Pixel.ConvolutionFilterBias[1][3]); - - ctx->NewState |= _NEW_PIXEL; + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D"); } @@ -264,42 +66,8 @@ static void GLAPIENTRY _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); - GLuint c; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - switch (target) { - case GL_CONVOLUTION_1D: - c = 0; - break; - case GL_CONVOLUTION_2D: - c = 1; - break; - case GL_SEPARABLE_2D: - c = 2; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)"); - return; - } - - switch (pname) { - case GL_CONVOLUTION_BORDER_MODE: - if (param == (GLfloat) GL_REDUCE || - param == (GLfloat) GL_CONSTANT_BORDER || - param == (GLfloat) GL_REPLICATE_BORDER) { - ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)"); - return; - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); - return; - } - ctx->NewState |= _NEW_PIXEL; + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf"); } @@ -307,51 +75,8 @@ static void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - GLuint c; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - switch (target) { - case GL_CONVOLUTION_1D: - c = 0; - break; - case GL_CONVOLUTION_2D: - c = 1; - break; - case GL_SEPARABLE_2D: - c = 2; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); - return; - } - - switch (pname) { - case GL_CONVOLUTION_BORDER_COLOR: - COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params); - break; - case GL_CONVOLUTION_BORDER_MODE: - if (params[0] == (GLfloat) GL_REDUCE || - params[0] == (GLfloat) GL_CONSTANT_BORDER || - params[0] == (GLfloat) GL_REPLICATE_BORDER) { - ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)"); - return; - } - break; - case GL_CONVOLUTION_FILTER_SCALE: - COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); - break; - case GL_CONVOLUTION_FILTER_BIAS: - COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); - return; - } - ctx->NewState |= _NEW_PIXEL; + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv"); } @@ -359,42 +84,8 @@ static void GLAPIENTRY _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); - GLuint c; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - switch (target) { - case GL_CONVOLUTION_1D: - c = 0; - break; - case GL_CONVOLUTION_2D: - c = 1; - break; - case GL_SEPARABLE_2D: - c = 2; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)"); - return; - } - - switch (pname) { - case GL_CONVOLUTION_BORDER_MODE: - if (param == (GLint) GL_REDUCE || - param == (GLint) GL_CONSTANT_BORDER || - param == (GLint) GL_REPLICATE_BORDER) { - ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)"); - return; - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); - return; - } - - ctx->NewState |= _NEW_PIXEL; + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri"); } @@ -402,132 +93,26 @@ static void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); - GLuint c; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - switch (target) { - case GL_CONVOLUTION_1D: - c = 0; - break; - case GL_CONVOLUTION_2D: - c = 1; - break; - case GL_SEPARABLE_2D: - c = 2; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); - return; - } - - switch (pname) { - case GL_CONVOLUTION_BORDER_COLOR: - ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); - ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); - ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); - ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); - break; - case GL_CONVOLUTION_BORDER_MODE: - if (params[0] == (GLint) GL_REDUCE || - params[0] == (GLint) GL_CONSTANT_BORDER || - params[0] == (GLint) GL_REPLICATE_BORDER) { - ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); - return; - } - break; - case GL_CONVOLUTION_FILTER_SCALE: - /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */ - /* need cast to prevent compiler warnings */ - ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0]; - ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1]; - ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2]; - ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3]; - break; - case GL_CONVOLUTION_FILTER_BIAS: - /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */ - /* need cast to prevent compiler warnings */ - ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0]; - ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1]; - ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2]; - ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3]; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); - return; - } - ctx->NewState |= _NEW_PIXEL; + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv"); } static void GLAPIENTRY _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { - GLint baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (target != GL_CONVOLUTION_1D) { - _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); - return; - } - - baseFormat = base_filter_format(internalFormat); - if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)"); - return; - } - - if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)"); - return; - } - - if (!ctx->ReadBuffer->_ColorReadBuffer) { - return; /* no readbuffer - OK */ - } - - ctx->Driver.CopyConvolutionFilter1D( ctx, target, - internalFormat, x, y, width); + _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D"); } static void GLAPIENTRY _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { - GLint baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (target != GL_CONVOLUTION_2D) { - _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); - return; - } - baseFormat = base_filter_format(internalFormat); - if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)"); - return; - } - - if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)"); - return; - } - if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)"); - return; - } - - if (!ctx->ReadBuffer->_ColorReadBuffer) { - return; /* no readbuffer - OK */ - } - - ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y, - width, height ); + _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D"); } @@ -535,58 +120,9 @@ static void GLAPIENTRY _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { - struct gl_convolution_attrib *filter; - GLuint row; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->NewState) { - _mesa_update_state(ctx); - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); - return; - } - if (format == GL_COLOR_INDEX || - format == GL_STENCIL_INDEX || - format == GL_DEPTH_COMPONENT || - format == GL_INTENSITY || - type == GL_BITMAP) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); - return; - } - - switch (target) { - case GL_CONVOLUTION_1D: - filter = &(ctx->Convolution1D); - break; - case GL_CONVOLUTION_2D: - filter = &(ctx->Convolution2D); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); - return; - } - - image = _mesa_map_validate_pbo_dest(ctx, 2, &ctx->Pack, - filter->Width, filter->Height, 1, - format, type, image, - "glGetConvolutionFilter"); - if (!image) - return; - - for (row = 0; row < filter->Height; row++) { - GLvoid *dst = _mesa_image_address2d(&ctx->Pack, image, filter->Width, - filter->Height, format, type, - row, 0); - GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + row * filter->Width * 4); - _mesa_pack_rgba_span_float(ctx, filter->Width, src, - format, type, dst, &ctx->Pack, 0x0); - } - - _mesa_unmap_pbo_dest(ctx, &ctx->Pack); + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter"); } @@ -594,60 +130,8 @@ static void GLAPIENTRY _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - const struct gl_convolution_attrib *conv; - GLuint c; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - switch (target) { - case GL_CONVOLUTION_1D: - c = 0; - conv = &ctx->Convolution1D; - break; - case GL_CONVOLUTION_2D: - c = 1; - conv = &ctx->Convolution2D; - break; - case GL_SEPARABLE_2D: - c = 2; - conv = &ctx->Separable2D; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)"); - return; - } - switch (pname) { - case GL_CONVOLUTION_BORDER_COLOR: - COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]); - break; - case GL_CONVOLUTION_BORDER_MODE: - *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c]; - break; - case GL_CONVOLUTION_FILTER_SCALE: - COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]); - break; - case GL_CONVOLUTION_FILTER_BIAS: - COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]); - break; - case GL_CONVOLUTION_FORMAT: - *params = (GLfloat) conv->Format; - break; - case GL_CONVOLUTION_WIDTH: - *params = (GLfloat) conv->Width; - break; - case GL_CONVOLUTION_HEIGHT: - *params = (GLfloat) conv->Height; - break; - case GL_MAX_CONVOLUTION_WIDTH: - *params = (GLfloat) ctx->Const.MaxConvolutionWidth; - break; - case GL_MAX_CONVOLUTION_HEIGHT: - *params = (GLfloat) ctx->Const.MaxConvolutionHeight; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)"); - return; - } + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv"); } @@ -655,69 +139,8 @@ static void GLAPIENTRY _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - const struct gl_convolution_attrib *conv; - GLuint c; - ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (target) { - case GL_CONVOLUTION_1D: - c = 0; - conv = &ctx->Convolution1D; - break; - case GL_CONVOLUTION_2D: - c = 1; - conv = &ctx->Convolution2D; - break; - case GL_SEPARABLE_2D: - c = 2; - conv = &ctx->Separable2D; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)"); - return; - } - - switch (pname) { - case GL_CONVOLUTION_BORDER_COLOR: - params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]); - params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]); - params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]); - params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]); - break; - case GL_CONVOLUTION_BORDER_MODE: - *params = (GLint) ctx->Pixel.ConvolutionBorderMode[c]; - break; - case GL_CONVOLUTION_FILTER_SCALE: - params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0]; - params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1]; - params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2]; - params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3]; - break; - case GL_CONVOLUTION_FILTER_BIAS: - params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0]; - params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1]; - params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2]; - params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3]; - break; - case GL_CONVOLUTION_FORMAT: - *params = (GLint) conv->Format; - break; - case GL_CONVOLUTION_WIDTH: - *params = (GLint) conv->Width; - break; - case GL_CONVOLUTION_HEIGHT: - *params = (GLint) conv->Height; - break; - case GL_MAX_CONVOLUTION_WIDTH: - *params = (GLint) ctx->Const.MaxConvolutionWidth; - break; - case GL_MAX_CONVOLUTION_HEIGHT: - *params = (GLint) ctx->Const.MaxConvolutionHeight; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)"); - return; - } + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv"); } @@ -725,720 +148,20 @@ static void GLAPIENTRY _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { - const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; - struct gl_convolution_attrib *filter; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->NewState) { - _mesa_update_state(ctx); - } - - if (target != GL_SEPARABLE_2D) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)"); - return; - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetConvolutionFilter(format or type)"); - return; - } - if (format == GL_COLOR_INDEX || - format == GL_STENCIL_INDEX || - format == GL_DEPTH_COMPONENT || - format == GL_INTENSITY || - type == GL_BITMAP) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); - return; - } - - filter = &ctx->Separable2D; - - /* Get row filter */ - row = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack, - filter->Width, 1, 1, - format, type, row, - "glGetConvolutionFilter"); - if (row) { - GLvoid *dst = _mesa_image_address1d(&ctx->Pack, row, filter->Width, - format, type, 0); - _mesa_pack_rgba_span_float(ctx, filter->Width, - (GLfloat (*)[4]) filter->Filter, - format, type, dst, &ctx->Pack, 0x0); - _mesa_unmap_pbo_dest(ctx, &ctx->Pack); - } - - /* get column filter */ - column = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack, - filter->Height, 1, 1, - format, type, column, - "glGetConvolutionFilter"); - if (column) { - GLvoid *dst = _mesa_image_address1d(&ctx->Pack, column, filter->Height, - format, type, 0); - GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + colStart); - _mesa_pack_rgba_span_float(ctx, filter->Height, src, - format, type, dst, &ctx->Pack, 0x0); - _mesa_unmap_pbo_dest(ctx, &ctx->Pack); - } - - (void) span; /* unused at this time */ + _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter"); } static void GLAPIENTRY _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { - const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; - GLint baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (target != GL_SEPARABLE_2D) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); - return; - } - - baseFormat = base_filter_format(internalFormat); - if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)"); - return; - } - - if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { - _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)"); - return; - } - if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { - _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)"); - return; - } - - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)"); - return; - } - - if (format == GL_COLOR_INDEX || - format == GL_STENCIL_INDEX || - format == GL_DEPTH_COMPONENT || - format == GL_INTENSITY || - type == GL_BITMAP) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)"); - return; - } - - ctx->Separable2D.Format = format; - ctx->Separable2D.InternalFormat = internalFormat; - ctx->Separable2D.Width = width; - ctx->Separable2D.Height = height; - - /* unpack row filter */ - row = _mesa_map_validate_pbo_source(ctx, 1, &ctx->Unpack, - width, 1, 1, - format, type, row, - "glSeparableFilter2D"); - if (row) { - _mesa_unpack_color_span_float(ctx, width, GL_RGBA, - ctx->Separable2D.Filter, - format, type, row, &ctx->Unpack, - 0x0); /* transferOps */ - _mesa_scale_and_bias_rgba(width, - (GLfloat (*)[4]) ctx->Separable2D.Filter, - ctx->Pixel.ConvolutionFilterScale[2][0], - ctx->Pixel.ConvolutionFilterScale[2][1], - ctx->Pixel.ConvolutionFilterScale[2][2], - ctx->Pixel.ConvolutionFilterScale[2][3], - ctx->Pixel.ConvolutionFilterBias[2][0], - ctx->Pixel.ConvolutionFilterBias[2][1], - ctx->Pixel.ConvolutionFilterBias[2][2], - ctx->Pixel.ConvolutionFilterBias[2][3]); - _mesa_unmap_pbo_source(ctx, &ctx->Unpack); - } - - /* unpack column filter */ - column = _mesa_map_validate_pbo_source(ctx, 1, &ctx->Unpack, - height, 1, 1, - format, type, column, - "glSeparableFilter2D"); - if (column) { - _mesa_unpack_color_span_float(ctx, height, GL_RGBA, - &ctx->Separable2D.Filter[colStart], - format, type, column, &ctx->Unpack, - 0); /* transferOps */ - - _mesa_scale_and_bias_rgba(height, - (GLfloat (*)[4]) (ctx->Separable2D.Filter + colStart), - ctx->Pixel.ConvolutionFilterScale[2][0], - ctx->Pixel.ConvolutionFilterScale[2][1], - ctx->Pixel.ConvolutionFilterScale[2][2], - ctx->Pixel.ConvolutionFilterScale[2][3], - ctx->Pixel.ConvolutionFilterBias[2][0], - ctx->Pixel.ConvolutionFilterBias[2][1], - ctx->Pixel.ConvolutionFilterBias[2][2], - ctx->Pixel.ConvolutionFilterBias[2][3]); - _mesa_unmap_pbo_source(ctx, &ctx->Unpack); - } - - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - ctx->Unpack.BufferObj); - } - - ctx->NewState |= _NEW_PIXEL; -} - - -/**********************************************************************/ -/*** image convolution functions ***/ -/**********************************************************************/ - -static void -convolve_1d_reduce(GLint srcWidth, const GLfloat src[][4], - GLint filterWidth, const GLfloat filter[][4], - GLfloat dest[][4]) -{ - GLint dstWidth; - GLint i, n; - - if (filterWidth >= 1) - dstWidth = srcWidth - (filterWidth - 1); - else - dstWidth = srcWidth; - - if (dstWidth <= 0) - return; /* null result */ - - for (i = 0; i < dstWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (n = 0; n < filterWidth; n++) { - sumR += src[i + n][RCOMP] * filter[n][RCOMP]; - sumG += src[i + n][GCOMP] * filter[n][GCOMP]; - sumB += src[i + n][BCOMP] * filter[n][BCOMP]; - sumA += src[i + n][ACOMP] * filter[n][ACOMP]; - } - dest[i][RCOMP] = sumR; - dest[i][GCOMP] = sumG; - dest[i][BCOMP] = sumB; - dest[i][ACOMP] = sumA; - } -} - - -static void -convolve_1d_constant(GLint srcWidth, const GLfloat src[][4], - GLint filterWidth, const GLfloat filter[][4], - GLfloat dest[][4], - const GLfloat borderColor[4]) -{ - const GLint halfFilterWidth = filterWidth / 2; - GLint i, n; - - for (i = 0; i < srcWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (n = 0; n < filterWidth; n++) { - if (i + n < halfFilterWidth || i + n - halfFilterWidth >= srcWidth) { - sumR += borderColor[RCOMP] * filter[n][RCOMP]; - sumG += borderColor[GCOMP] * filter[n][GCOMP]; - sumB += borderColor[BCOMP] * filter[n][BCOMP]; - sumA += borderColor[ACOMP] * filter[n][ACOMP]; - } - else { - sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; - sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; - sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; - sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; - } - } - dest[i][RCOMP] = sumR; - dest[i][GCOMP] = sumG; - dest[i][BCOMP] = sumB; - dest[i][ACOMP] = sumA; - } -} - - -static void -convolve_1d_replicate(GLint srcWidth, const GLfloat src[][4], - GLint filterWidth, const GLfloat filter[][4], - GLfloat dest[][4]) -{ - const GLint halfFilterWidth = filterWidth / 2; - GLint i, n; - - for (i = 0; i < srcWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (n = 0; n < filterWidth; n++) { - if (i + n < halfFilterWidth) { - sumR += src[0][RCOMP] * filter[n][RCOMP]; - sumG += src[0][GCOMP] * filter[n][GCOMP]; - sumB += src[0][BCOMP] * filter[n][BCOMP]; - sumA += src[0][ACOMP] * filter[n][ACOMP]; - } - else if (i + n - halfFilterWidth >= srcWidth) { - sumR += src[srcWidth - 1][RCOMP] * filter[n][RCOMP]; - sumG += src[srcWidth - 1][GCOMP] * filter[n][GCOMP]; - sumB += src[srcWidth - 1][BCOMP] * filter[n][BCOMP]; - sumA += src[srcWidth - 1][ACOMP] * filter[n][ACOMP]; - } - else { - sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; - sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; - sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; - sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; - } - } - dest[i][RCOMP] = sumR; - dest[i][GCOMP] = sumG; - dest[i][BCOMP] = sumB; - dest[i][ACOMP] = sumA; - } -} - - -static void -convolve_2d_reduce(GLint srcWidth, GLint srcHeight, - const GLfloat src[][4], - GLint filterWidth, GLint filterHeight, - const GLfloat filter[][4], - GLfloat dest[][4]) -{ - GLint dstWidth, dstHeight; - GLint i, j, n, m; - - if (filterWidth >= 1) - dstWidth = srcWidth - (filterWidth - 1); - else - dstWidth = srcWidth; - - if (filterHeight >= 1) - dstHeight = srcHeight - (filterHeight - 1); - else - dstHeight = srcHeight; - - if (dstWidth <= 0 || dstHeight <= 0) - return; - - for (j = 0; j < dstHeight; j++) { - for (i = 0; i < dstWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (m = 0; m < filterHeight; m++) { - for (n = 0; n < filterWidth; n++) { - const GLint k = (j + m) * srcWidth + i + n; - const GLint f = m * filterWidth + n; - sumR += src[k][RCOMP] * filter[f][RCOMP]; - sumG += src[k][GCOMP] * filter[f][GCOMP]; - sumB += src[k][BCOMP] * filter[f][BCOMP]; - sumA += src[k][ACOMP] * filter[f][ACOMP]; - } - } - dest[j * dstWidth + i][RCOMP] = sumR; - dest[j * dstWidth + i][GCOMP] = sumG; - dest[j * dstWidth + i][BCOMP] = sumB; - dest[j * dstWidth + i][ACOMP] = sumA; - } - } -} - - -static void -convolve_2d_constant(GLint srcWidth, GLint srcHeight, - const GLfloat src[][4], - GLint filterWidth, GLint filterHeight, - const GLfloat filter[][4], - GLfloat dest[][4], - const GLfloat borderColor[4]) -{ - const GLint halfFilterWidth = filterWidth / 2; - const GLint halfFilterHeight = filterHeight / 2; - GLint i, j, n, m; - - for (j = 0; j < srcHeight; j++) { - for (i = 0; i < srcWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (m = 0; m < filterHeight; m++) { - for (n = 0; n < filterWidth; n++) { - const GLint f = m * filterWidth + n; - const GLint is = i + n - halfFilterWidth; - const GLint js = j + m - halfFilterHeight; - if (is < 0 || is >= srcWidth || - js < 0 || js >= srcHeight) { - sumR += borderColor[RCOMP] * filter[f][RCOMP]; - sumG += borderColor[GCOMP] * filter[f][GCOMP]; - sumB += borderColor[BCOMP] * filter[f][BCOMP]; - sumA += borderColor[ACOMP] * filter[f][ACOMP]; - } - else { - const GLint k = js * srcWidth + is; - sumR += src[k][RCOMP] * filter[f][RCOMP]; - sumG += src[k][GCOMP] * filter[f][GCOMP]; - sumB += src[k][BCOMP] * filter[f][BCOMP]; - sumA += src[k][ACOMP] * filter[f][ACOMP]; - } - } - } - dest[j * srcWidth + i][RCOMP] = sumR; - dest[j * srcWidth + i][GCOMP] = sumG; - dest[j * srcWidth + i][BCOMP] = sumB; - dest[j * srcWidth + i][ACOMP] = sumA; - } - } -} - - -static void -convolve_2d_replicate(GLint srcWidth, GLint srcHeight, - const GLfloat src[][4], - GLint filterWidth, GLint filterHeight, - const GLfloat filter[][4], - GLfloat dest[][4]) -{ - const GLint halfFilterWidth = filterWidth / 2; - const GLint halfFilterHeight = filterHeight / 2; - GLint i, j, n, m; - - for (j = 0; j < srcHeight; j++) { - for (i = 0; i < srcWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (m = 0; m < filterHeight; m++) { - for (n = 0; n < filterWidth; n++) { - const GLint f = m * filterWidth + n; - GLint is = i + n - halfFilterWidth; - GLint js = j + m - halfFilterHeight; - GLint k; - if (is < 0) - is = 0; - else if (is >= srcWidth) - is = srcWidth - 1; - if (js < 0) - js = 0; - else if (js >= srcHeight) - js = srcHeight - 1; - k = js * srcWidth + is; - sumR += src[k][RCOMP] * filter[f][RCOMP]; - sumG += src[k][GCOMP] * filter[f][GCOMP]; - sumB += src[k][BCOMP] * filter[f][BCOMP]; - sumA += src[k][ACOMP] * filter[f][ACOMP]; - } - } - dest[j * srcWidth + i][RCOMP] = sumR; - dest[j * srcWidth + i][GCOMP] = sumG; - dest[j * srcWidth + i][BCOMP] = sumB; - dest[j * srcWidth + i][ACOMP] = sumA; - } - } -} - - -static void -convolve_sep_reduce(GLint srcWidth, GLint srcHeight, - const GLfloat src[][4], - GLint filterWidth, GLint filterHeight, - const GLfloat rowFilt[][4], - const GLfloat colFilt[][4], - GLfloat dest[][4]) -{ - GLint dstWidth, dstHeight; - GLint i, j, n, m; - - if (filterWidth >= 1) - dstWidth = srcWidth - (filterWidth - 1); - else - dstWidth = srcWidth; - - if (filterHeight >= 1) - dstHeight = srcHeight - (filterHeight - 1); - else - dstHeight = srcHeight; - if (dstWidth <= 0 || dstHeight <= 0) - return; - - for (j = 0; j < dstHeight; j++) { - for (i = 0; i < dstWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (m = 0; m < filterHeight; m++) { - for (n = 0; n < filterWidth; n++) { - GLint k = (j + m) * srcWidth + i + n; - sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; - sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; - sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; - sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; - } - } - dest[j * dstWidth + i][RCOMP] = sumR; - dest[j * dstWidth + i][GCOMP] = sumG; - dest[j * dstWidth + i][BCOMP] = sumB; - dest[j * dstWidth + i][ACOMP] = sumA; - } - } -} - - -static void -convolve_sep_constant(GLint srcWidth, GLint srcHeight, - const GLfloat src[][4], - GLint filterWidth, GLint filterHeight, - const GLfloat rowFilt[][4], - const GLfloat colFilt[][4], - GLfloat dest[][4], - const GLfloat borderColor[4]) -{ - const GLint halfFilterWidth = filterWidth / 2; - const GLint halfFilterHeight = filterHeight / 2; - GLint i, j, n, m; - - for (j = 0; j < srcHeight; j++) { - for (i = 0; i < srcWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (m = 0; m < filterHeight; m++) { - for (n = 0; n < filterWidth; n++) { - const GLint is = i + n - halfFilterWidth; - const GLint js = j + m - halfFilterHeight; - if (is < 0 || is >= srcWidth || - js < 0 || js >= srcHeight) { - sumR += borderColor[RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; - sumG += borderColor[GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; - sumB += borderColor[BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; - sumA += borderColor[ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; - } - else { - GLint k = js * srcWidth + is; - sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; - sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; - sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; - sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; - } - - } - } - dest[j * srcWidth + i][RCOMP] = sumR; - dest[j * srcWidth + i][GCOMP] = sumG; - dest[j * srcWidth + i][BCOMP] = sumB; - dest[j * srcWidth + i][ACOMP] = sumA; - } - } -} - - -static void -convolve_sep_replicate(GLint srcWidth, GLint srcHeight, - const GLfloat src[][4], - GLint filterWidth, GLint filterHeight, - const GLfloat rowFilt[][4], - const GLfloat colFilt[][4], - GLfloat dest[][4]) -{ - const GLint halfFilterWidth = filterWidth / 2; - const GLint halfFilterHeight = filterHeight / 2; - GLint i, j, n, m; - - for (j = 0; j < srcHeight; j++) { - for (i = 0; i < srcWidth; i++) { - GLfloat sumR = 0.0; - GLfloat sumG = 0.0; - GLfloat sumB = 0.0; - GLfloat sumA = 0.0; - for (m = 0; m < filterHeight; m++) { - for (n = 0; n < filterWidth; n++) { - GLint is = i + n - halfFilterWidth; - GLint js = j + m - halfFilterHeight; - GLint k; - if (is < 0) - is = 0; - else if (is >= srcWidth) - is = srcWidth - 1; - if (js < 0) - js = 0; - else if (js >= srcHeight) - js = srcHeight - 1; - k = js * srcWidth + is; - sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; - sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; - sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; - sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; - } - } - dest[j * srcWidth + i][RCOMP] = sumR; - dest[j * srcWidth + i][GCOMP] = sumG; - dest[j * srcWidth + i][BCOMP] = sumB; - dest[j * srcWidth + i][ACOMP] = sumA; - } - } -} - - - -void -_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, - const GLfloat *srcImage, GLfloat *dstImage) -{ - switch (ctx->Pixel.ConvolutionBorderMode[0]) { - case GL_REDUCE: - convolve_1d_reduce(*width, (const GLfloat (*)[4]) srcImage, - ctx->Convolution1D.Width, - (const GLfloat (*)[4]) ctx->Convolution1D.Filter, - (GLfloat (*)[4]) dstImage); - *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); - break; - case GL_CONSTANT_BORDER: - convolve_1d_constant(*width, (const GLfloat (*)[4]) srcImage, - ctx->Convolution1D.Width, - (const GLfloat (*)[4]) ctx->Convolution1D.Filter, - (GLfloat (*)[4]) dstImage, - ctx->Pixel.ConvolutionBorderColor[0]); - break; - case GL_REPLICATE_BORDER: - convolve_1d_replicate(*width, (const GLfloat (*)[4]) srcImage, - ctx->Convolution1D.Width, - (const GLfloat (*)[4]) ctx->Convolution1D.Filter, - (GLfloat (*)[4]) dstImage); - break; - default: - ; - } -} - - -void -_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage) -{ - switch (ctx->Pixel.ConvolutionBorderMode[1]) { - case GL_REDUCE: - convolve_2d_reduce(*width, *height, - (const GLfloat (*)[4]) srcImage, - ctx->Convolution2D.Width, - ctx->Convolution2D.Height, - (const GLfloat (*)[4]) ctx->Convolution2D.Filter, - (GLfloat (*)[4]) dstImage); - *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); - *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); - break; - case GL_CONSTANT_BORDER: - convolve_2d_constant(*width, *height, - (const GLfloat (*)[4]) srcImage, - ctx->Convolution2D.Width, - ctx->Convolution2D.Height, - (const GLfloat (*)[4]) ctx->Convolution2D.Filter, - (GLfloat (*)[4]) dstImage, - ctx->Pixel.ConvolutionBorderColor[1]); - break; - case GL_REPLICATE_BORDER: - convolve_2d_replicate(*width, *height, - (const GLfloat (*)[4]) srcImage, - ctx->Convolution2D.Width, - ctx->Convolution2D.Height, - (const GLfloat (*)[4])ctx->Convolution2D.Filter, - (GLfloat (*)[4]) dstImage); - break; - default: - ; - } -} - - -void -_mesa_convolve_sep_image(const GLcontext *ctx, - GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage) -{ - const GLfloat *rowFilter = ctx->Separable2D.Filter; - const GLfloat *colFilter = rowFilter + 4 * MAX_CONVOLUTION_WIDTH; - - switch (ctx->Pixel.ConvolutionBorderMode[2]) { - case GL_REDUCE: - convolve_sep_reduce(*width, *height, - (const GLfloat (*)[4]) srcImage, - ctx->Separable2D.Width, - ctx->Separable2D.Height, - (const GLfloat (*)[4]) rowFilter, - (const GLfloat (*)[4]) colFilter, - (GLfloat (*)[4]) dstImage); - *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); - *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); - break; - case GL_CONSTANT_BORDER: - convolve_sep_constant(*width, *height, - (const GLfloat (*)[4]) srcImage, - ctx->Separable2D.Width, - ctx->Separable2D.Height, - (const GLfloat (*)[4]) rowFilter, - (const GLfloat (*)[4]) colFilter, - (GLfloat (*)[4]) dstImage, - ctx->Pixel.ConvolutionBorderColor[2]); - break; - case GL_REPLICATE_BORDER: - convolve_sep_replicate(*width, *height, - (const GLfloat (*)[4]) srcImage, - ctx->Separable2D.Width, - ctx->Separable2D.Height, - (const GLfloat (*)[4]) rowFilter, - (const GLfloat (*)[4]) colFilter, - (GLfloat (*)[4]) dstImage); - break; - default: - ; - } + _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D"); } - - -/* - * This function computes an image's size after convolution. - * If the convolution border mode is GL_REDUCE, the post-convolution - * image will be smaller than the original. - */ -void -_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, - GLsizei *width, GLsizei *height) -{ - if (ctx->Pixel.Convolution1DEnabled - && dimensions == 1 - && ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) { - *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); - } - else if (ctx->Pixel.Convolution2DEnabled - && dimensions > 1 - && ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) { - *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); - *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); - } - else if (ctx->Pixel.Separable2DEnabled - && dimensions > 1 - && ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) { - *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); - *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); - } -} - - void _mesa_init_convolve_dispatch(struct _glapi_table *disp) { diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h index 80caf942fba..0277917433d 100644 --- a/src/mesa/main/convolve.h +++ b/src/mesa/main/convolve.h @@ -33,32 +33,6 @@ #if FEATURE_convolve -extern void GLAPIENTRY -_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, - GLenum format, GLenum type, const GLvoid *image); - -extern void GLAPIENTRY -_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, - GLsizei height, GLenum format, GLenum type, - const GLvoid *image); - -extern void -_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, - const GLfloat *srcImage, GLfloat *dstImage); - -extern void -_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage); - -extern void -_mesa_convolve_sep_image(const GLcontext *ctx, - GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage); - -extern void -_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, - GLsizei *width, GLsizei *height); - extern void _mesa_init_convolve_dispatch(struct _glapi_table *disp); @@ -66,50 +40,6 @@ _mesa_init_convolve_dispatch(struct _glapi_table *disp); #include "main/compiler.h" -static INLINE void GLAPIENTRY -_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, - GLenum format, GLenum type, const GLvoid *image) -{ - ASSERT_NO_FEATURE(); -} - -static INLINE void GLAPIENTRY -_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, - GLsizei height, GLenum format, GLenum type, - const GLvoid *image) -{ - ASSERT_NO_FEATURE(); -} - -static INLINE void -_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, - const GLfloat *srcImage, GLfloat *dstImage) -{ - ASSERT_NO_FEATURE(); -} - -static INLINE void -_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage) -{ - ASSERT_NO_FEATURE(); -} - - -static INLINE void -_mesa_convolve_sep_image(const GLcontext *ctx, - GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage) -{ - ASSERT_NO_FEATURE(); -} - -static INLINE void -_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, - GLsizei *width, GLsizei *height) -{ -} - static INLINE void _mesa_init_convolve_dispatch(struct _glapi_table *disp) { diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 8a20a663632..46d26cf901d 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -558,15 +558,6 @@ struct dd_function_table { void (*CopyColorSubTable)( GLcontext *ctx, GLenum target, GLsizei start, GLint x, GLint y, GLsizei width ); - - void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width ); - - void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, - GLsizei width, GLsizei height ); /*@}*/ diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 2c8c000f9f4..15ce2d12254 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -712,29 +712,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state; break; - /* GL_EXT_convolution */ - case GL_CONVOLUTION_1D: - CHECK_EXTENSION(EXT_convolution, cap); - if (ctx->Pixel.Convolution1DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Convolution1DEnabled = state; - break; - case GL_CONVOLUTION_2D: - CHECK_EXTENSION(EXT_convolution, cap); - if (ctx->Pixel.Convolution2DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Convolution2DEnabled = state; - break; - case GL_SEPARABLE_2D: - CHECK_EXTENSION(EXT_convolution, cap); - if (ctx->Pixel.Separable2DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Separable2DEnabled = state; - break; - /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXTENSION(ARB_texture_cube_map, cap); @@ -1327,17 +1304,6 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(SGI_texture_color_table); return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; - /* GL_EXT_convolution */ - case GL_CONVOLUTION_1D: - CHECK_EXTENSION(EXT_convolution); - return ctx->Pixel.Convolution1DEnabled; - case GL_CONVOLUTION_2D: - CHECK_EXTENSION(EXT_convolution); - return ctx->Pixel.Convolution2DEnabled; - case GL_SEPARABLE_2D: - CHECK_EXTENSION(EXT_convolution); - return ctx->Pixel.Separable2DEnabled; - /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXTENSION(ARB_texture_cube_map); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 3f86973e3ea..c5febc77cff 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -116,7 +116,6 @@ static const struct { { OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) }, { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, - { OFF, "GL_EXT_convolution", F(EXT_convolution) }, { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, { OFF, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2) }, @@ -303,7 +302,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_logic_op = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; - ctx->Extensions.EXT_convolution = GL_TRUE; ctx->Extensions.EXT_depth_bounds_test = GL_TRUE; ctx->Extensions.EXT_draw_buffers2 = GL_TRUE; ctx->Extensions.EXT_fog_coord = GL_TRUE; @@ -393,7 +391,6 @@ _mesa_enable_imaging_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_logic_op = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; - ctx->Extensions.EXT_convolution = GL_TRUE; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 33ea81b83a6..cb456fb64d8 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -276,7 +276,6 @@ EXTRA_EXT(NV_fragment_program); EXTRA_EXT(NV_texture_rectangle); EXTRA_EXT(EXT_stencil_two_side); EXTRA_EXT(NV_light_max_exponent); -EXTRA_EXT(EXT_convolution); EXTRA_EXT(SGI_texture_color_table); EXTRA_EXT(EXT_depth_bounds_test); EXTRA_EXT(ARB_depth_clamp); @@ -880,38 +879,6 @@ static const struct value_desc values[] = { CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA }, { GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA }, - /* GL_EXT_convolution (also in 1.2 imaging) */ - { GL_CONVOLUTION_1D_EXT, CONTEXT_BOOL(Pixel.Convolution1DEnabled), - extra_EXT_convolution }, - { GL_CONVOLUTION_2D_EXT, CONTEXT_BOOL(Pixel.Convolution2DEnabled), - extra_EXT_convolution }, - { GL_SEPARABLE_2D_EXT, CONTEXT_BOOL(Pixel.Separable2DEnabled), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_RED_SCALE_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionScale[0]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_GREEN_SCALE_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionScale[1]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_BLUE_SCALE_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionScale[2]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_ALPHA_SCALE_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionScale[3]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_RED_BIAS_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionBias[0]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_GREEN_BIAS_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionBias[1]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_BLUE_BIAS_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionBias[2]), - extra_EXT_convolution }, - { GL_POST_CONVOLUTION_ALPHA_BIAS_EXT, - CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]), - extra_EXT_convolution }, - /* GL_SGI_texture_color_table */ { GL_TEXTURE_COLOR_TABLE_SGI, LOC_TEXUNIT, TYPE_BOOLEAN, offsetof(struct gl_texture_unit, ColorTableEnabled), diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 788584ae85f..029d2fef8a6 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1866,23 +1866,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, if (transferOps & IMAGE_MAP_COLOR_BIT) { _mesa_map_rgba( ctx, n, rgba ); } - /* convolution */ - if (transferOps & IMAGE_CONVOLUTION_BIT) { - /* this has to be done in the calling code */ - _mesa_problem(ctx, "IMAGE_CONVOLUTION_BIT set in _mesa_apply_transfer_ops"); - } - /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ - if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { - _mesa_scale_and_bias_rgba(n, rgba, - ctx->Pixel.PostConvolutionScale[RCOMP], - ctx->Pixel.PostConvolutionScale[GCOMP], - ctx->Pixel.PostConvolutionScale[BCOMP], - ctx->Pixel.PostConvolutionScale[ACOMP], - ctx->Pixel.PostConvolutionBias[RCOMP], - ctx->Pixel.PostConvolutionBias[GCOMP], - ctx->Pixel.PostConvolutionBias[BCOMP], - ctx->Pixel.PostConvolutionBias[ACOMP]); - } + /* clamping to [0,1] */ if (transferOps & IMAGE_CLAMP_BIT) { GLuint i; @@ -1988,8 +1972,7 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, /** * Used to pack an array [][4] of RGBA float colors as specified - * by the dstFormat, dstType and dstPacking. Used by glReadPixels, - * glGetConvolutionFilter(), etc. + * by the dstFormat, dstType and dstPacking. Used by glReadPixels. * Note: the rgba values will be modified by this function when any pixel * transfer ops are enabled. */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c982f55e825..d7c5d28c2cf 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -800,20 +800,6 @@ struct gl_hint_attrib GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */ }; - -/** - * Image convolution state. - */ -struct gl_convolution_attrib -{ - GLenum Format; - GLenum InternalFormat; - GLuint Width; - GLuint Height; - GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4]; -}; - - /** * Light state flags. */ @@ -954,17 +940,6 @@ struct gl_pixel_attrib GLboolean MapColorFlag; GLboolean MapStencilFlag; - /* Convolution (GL_EXT_convolution) */ - GLboolean Convolution1DEnabled; - GLboolean Convolution2DEnabled; - GLboolean Separable2DEnabled; - GLfloat ConvolutionBorderColor[3][4]; /**< RGBA */ - GLenum ConvolutionBorderMode[3]; - GLfloat ConvolutionFilterScale[3][4]; /**< RGBA */ - GLfloat ConvolutionFilterBias[3][4]; /**< RGBA */ - GLfloat PostConvolutionScale[4]; /**< RGBA */ - GLfloat PostConvolutionBias[4]; /**< RGBA */ - /*--- End Pixel Transfer State ---*/ /** glPixelZoom */ @@ -2528,8 +2503,6 @@ struct gl_constants GLfloat LineWidthGranularity; GLuint MaxColorTableSize; - GLuint MaxConvolutionWidth; - GLuint MaxConvolutionHeight; GLuint MaxClipPlanes; GLuint MaxLights; @@ -2652,7 +2625,6 @@ struct gl_extensions GLboolean EXT_blend_subtract; GLboolean EXT_clip_volume_hint; GLboolean EXT_cull_vertex; - GLboolean EXT_convolution; GLboolean EXT_compiled_vertex_array; GLboolean EXT_copy_texture; GLboolean EXT_depth_bounds_test; @@ -2769,20 +2741,13 @@ struct gl_matrix_stack #define IMAGE_SCALE_BIAS_BIT 0x1 #define IMAGE_SHIFT_OFFSET_BIT 0x2 #define IMAGE_MAP_COLOR_BIT 0x4 -#define IMAGE_CONVOLUTION_BIT 0x10 -#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20 #define IMAGE_CLAMP_BIT 0x800 -/** Pixel Transfer ops up to convolution */ -#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \ - IMAGE_SHIFT_OFFSET_BIT | \ - IMAGE_MAP_COLOR_BIT) - -/** Pixel transfer ops after convolution */ -#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS) -/*@}*/ - +/** Pixel Transfer ops */ +#define IMAGE_BITS (IMAGE_SCALE_BIAS_BIT | \ + IMAGE_SHIFT_OFFSET_BIT | \ + IMAGE_MAP_COLOR_BIT) /** * \name Bits to indicate what state has changed. @@ -3135,9 +3100,6 @@ struct __GLcontextRec /** \name Other assorted state (not pushed/popped on attribute stack) */ /*@{*/ struct gl_pixelmaps PixelMaps; - struct gl_convolution_attrib Convolution1D; - struct gl_convolution_attrib Convolution2D; - struct gl_convolution_attrib Separable2D; struct gl_evaluators EvalMap; /**< All evaluators */ struct gl_feedback Feedback; /**< Feedback */ diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 5e900b4eed9..1d378e4d9f7 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -566,54 +566,6 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.DepthBias = param; break; - case GL_POST_CONVOLUTION_RED_SCALE: - if (ctx->Pixel.PostConvolutionScale[0] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionScale[0] = param; - break; - case GL_POST_CONVOLUTION_RED_BIAS: - if (ctx->Pixel.PostConvolutionBias[0] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionBias[0] = param; - break; - case GL_POST_CONVOLUTION_GREEN_SCALE: - if (ctx->Pixel.PostConvolutionScale[1] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionScale[1] = param; - break; - case GL_POST_CONVOLUTION_GREEN_BIAS: - if (ctx->Pixel.PostConvolutionBias[1] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionBias[1] = param; - break; - case GL_POST_CONVOLUTION_BLUE_SCALE: - if (ctx->Pixel.PostConvolutionScale[2] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionScale[2] = param; - break; - case GL_POST_CONVOLUTION_BLUE_BIAS: - if (ctx->Pixel.PostConvolutionBias[2] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionBias[2] = param; - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE: - if (ctx->Pixel.PostConvolutionScale[3] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionScale[3] = param; - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS: - if (ctx->Pixel.PostConvolutionBias[3] == param) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionBias[3] = param; - break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); return; @@ -654,22 +606,6 @@ update_image_transfer_state(GLcontext *ctx) if (ctx->Pixel.MapColorFlag) mask |= IMAGE_MAP_COLOR_BIT; - if (ctx->Pixel.Convolution1DEnabled || - ctx->Pixel.Convolution2DEnabled || - ctx->Pixel.Separable2DEnabled) { - mask |= IMAGE_CONVOLUTION_BIT; - if (ctx->Pixel.PostConvolutionScale[0] != 1.0F || - ctx->Pixel.PostConvolutionScale[1] != 1.0F || - ctx->Pixel.PostConvolutionScale[2] != 1.0F || - ctx->Pixel.PostConvolutionScale[3] != 1.0F || - ctx->Pixel.PostConvolutionBias[0] != 0.0F || - ctx->Pixel.PostConvolutionBias[1] != 0.0F || - ctx->Pixel.PostConvolutionBias[2] != 0.0F || - ctx->Pixel.PostConvolutionBias[3] != 0.0F) { - mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS; - } - } - ctx->_ImageTransferState = mask; } @@ -721,8 +657,6 @@ init_pixelmap(struct gl_pixelmap *map) void _mesa_init_pixel( GLcontext *ctx ) { - int i; - /* Pixel group */ ctx->Pixel.RedBias = 0.0; ctx->Pixel.RedScale = 1.0; @@ -750,22 +684,6 @@ _mesa_init_pixel( GLcontext *ctx ) init_pixelmap(&ctx->PixelMaps.GtoG); init_pixelmap(&ctx->PixelMaps.BtoB); init_pixelmap(&ctx->PixelMaps.AtoA); - ctx->Pixel.Convolution1DEnabled = GL_FALSE; - ctx->Pixel.Convolution2DEnabled = GL_FALSE; - ctx->Pixel.Separable2DEnabled = GL_FALSE; - for (i = 0; i < 3; i++) { - ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0); - ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE; - ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0); - ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0); - } - for (i = 0; i < MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_WIDTH * 4; i++) { - ctx->Convolution1D.Filter[i] = 0.0; - ctx->Convolution2D.Filter[i] = 0.0; - ctx->Separable2D.Filter[i] = 0.0; - } - ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); - ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); /* GL_SGI_texture_color_table */ ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0); diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index c8b45bd3a55..3d8996c2fdc 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -32,7 +32,6 @@ #include "glheader.h" #include "imports.h" #include "colormac.h" -#include "convolve.h" #include "image.h" #include "macros.h" #include "mipmap.h" @@ -86,7 +85,6 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 3 * srcWidth; srcFormat = GL_RGB; @@ -143,7 +141,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; srcFormat = GL_RGBA; diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 8e059802625..551203f0125 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -36,7 +36,6 @@ #include "glheader.h" #include "imports.h" #include "colormac.h" -#include "convolve.h" #include "dlopen.h" #include "image.h" #include "macros.h" @@ -187,7 +186,6 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 3 * srcWidth; srcFormat = GL_RGB; @@ -250,7 +248,6 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; srcFormat = GL_RGBA; @@ -312,7 +309,6 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; } @@ -373,7 +369,6 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index ca1bd6096e2..614f0014dab 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -33,7 +33,6 @@ #include "glheader.h" #include "bufferobj.h" #include "context.h" -#include "convolve.h" #include "enums.h" #include "fbobject.h" #include "framebuffer.h" @@ -2243,12 +2242,6 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, internalFormat = override_internal_format(internalFormat, width, 1); -#if FEATURE_convolve - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); - } -#endif - if (target == GL_TEXTURE_1D) { /* non-proxy target */ struct gl_texture_object *texObj; @@ -2354,13 +2347,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, internalFormat = override_internal_format(internalFormat, width, height); -#if FEATURE_convolve - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, - &postConvHeight); - } -#endif - if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && @@ -2649,13 +2635,6 @@ _mesa_TexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); -#if FEATURE_convolve - /* XXX should test internal format */ - if (_mesa_is_color_format(format)) { - _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); - } -#endif - if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1, 1, format, type)) { return; /* error was detected */ @@ -2715,14 +2694,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); -#if FEATURE_convolve - /* XXX should test internal format */ - if (_mesa_is_color_format(format)) { - _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, - &postConvHeight); - } -#endif - if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight, 1, format, type)) { return; /* error was detected */ @@ -2843,12 +2814,6 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); -#if FEATURE_convolve - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); - } -#endif - if (copytexture_error_check(ctx, 1, target, level, internalFormat, postConvWidth, 1, border)) return; @@ -2918,13 +2883,6 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); -#if FEATURE_convolve - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, - &postConvHeight); - } -#endif - if (copytexture_error_check(ctx, 2, target, level, internalFormat, postConvWidth, postConvHeight, border)) return; @@ -3004,12 +2962,6 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, { texImage = _mesa_select_tex_image(ctx, texObj, target, level); -#if FEATURE_convolve - if (texImage && _mesa_is_color_format(texImage->InternalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); - } -#endif - if (copytexsubimage_error_check2(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1, texImage)) { @@ -3064,13 +3016,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, { texImage = _mesa_select_tex_image(ctx, texObj, target, level); -#if FEATURE_convolve - if (texImage && _mesa_is_color_format(texImage->InternalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, - &postConvWidth, &postConvHeight); - } -#endif - if (copytexsubimage_error_check2(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight, @@ -3127,13 +3072,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, { texImage = _mesa_select_tex_image(ctx, texObj, target, level); -#if FEATURE_convolve - if (texImage && _mesa_is_color_format(texImage->InternalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, - &postConvWidth, &postConvHeight); - } -#endif - if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset, zoffset, postConvWidth, postConvHeight, texImage)) { diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 2989fdb72ed..a1574e6cd83 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -45,7 +45,7 @@ * Texture image processing is actually kind of complicated. We have to do: * Format/type conversions * pixel unpacking - * pixel transfer (scale, bais, lookup, convolution!, etc) + * pixel transfer (scale, bais, lookup, etc) * * These functions can handle most everything, including processing full * images and sub-images. @@ -55,7 +55,6 @@ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" -#include "convolve.h" #include "image.h" #include "macros.h" #include "mipmap.h" @@ -310,6 +309,11 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, { GLuint transferOps = ctx->_ImageTransferState; GLfloat *tempImage; + const GLint components = _mesa_components_in_format(logicalBaseFormat); + const GLint srcStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); + GLfloat *dst; + GLint img, row; ASSERT(dims >= 1 && dims <= 3); @@ -331,126 +335,24 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, textureBaseFormat == GL_COLOR_INDEX || textureBaseFormat == GL_DEPTH_COMPONENT); - /* conventional color image */ - - if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || - (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || - (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { - /* need image convolution */ - const GLuint preConvTransferOps - = (transferOps & IMAGE_PRE_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; - const GLuint postConvTransferOps - = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; - GLint img, row; - GLint convWidth = srcWidth, convHeight = srcHeight; - GLfloat *convImage; - - /* pre-convolution image buffer (3D) */ - tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth - * 4 * sizeof(GLfloat)); - if (!tempImage) - return NULL; - - /* post-convolution image buffer (2D) */ - convImage = (GLfloat *) malloc(srcWidth * srcHeight - * 4 * sizeof(GLfloat)); - if (!convImage) { - free(tempImage); - return NULL; - } - - /* loop over 3D image slices */ - for (img = 0; img < srcDepth; img++) { - GLfloat *dst = tempImage + img * (srcWidth * srcHeight * 4); - - /* unpack and do transfer ops up to convolution */ - for (row = 0; row < srcHeight; row++) { - const GLvoid *src = _mesa_image_address(dims, srcPacking, - srcAddr, srcWidth, srcHeight, - srcFormat, srcType, img, row, 0); - _mesa_unpack_color_span_float(ctx, srcWidth, GL_RGBA, dst, - srcFormat, srcType, src, - srcPacking, - preConvTransferOps); - dst += srcWidth * 4; - } - - /* size after optional convolution */ - convWidth = srcWidth; - convHeight = srcHeight; - -#if FEATURE_convolve - /* do convolution */ - { - GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); - if (dims == 1) { - ASSERT(ctx->Pixel.Convolution1DEnabled); - _mesa_convolve_1d_image(ctx, &convWidth, src, convImage); - } - else { - if (ctx->Pixel.Convolution2DEnabled) { - _mesa_convolve_2d_image(ctx, &convWidth, &convHeight, - src, convImage); - } - else { - ASSERT(ctx->Pixel.Separable2DEnabled); - _mesa_convolve_sep_image(ctx, &convWidth, &convHeight, - src, convImage); - } - } - } -#endif - /* do post-convolution transfer and pack into tempImage */ - { - const GLint logComponents - = _mesa_components_in_format(logicalBaseFormat); - const GLfloat *src = convImage; - GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); - for (row = 0; row < convHeight; row++) { - _mesa_pack_rgba_span_float(ctx, convWidth, - (GLfloat (*)[4]) src, - logicalBaseFormat, GL_FLOAT, - dst, &ctx->DefaultPacking, - postConvTransferOps); - src += convWidth * 4; - dst += convWidth * logComponents; - } - } - } /* loop over 3D image slices */ - - free(convImage); - - /* might need these below */ - srcWidth = convWidth; - srcHeight = convHeight; - } - else { - /* no convolution */ - const GLint components = _mesa_components_in_format(logicalBaseFormat); - const GLint srcStride = - _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); - GLfloat *dst; - GLint img, row; - - tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth - * components * sizeof(GLfloat)); - if (!tempImage) - return NULL; + tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth + * components * sizeof(GLfloat)); + if (!tempImage) + return NULL; - dst = tempImage; - for (img = 0; img < srcDepth; img++) { - const GLubyte *src - = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, - srcWidth, srcHeight, - srcFormat, srcType, - img, 0, 0); - for (row = 0; row < srcHeight; row++) { - _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat, - dst, srcFormat, srcType, src, - srcPacking, transferOps); - dst += srcWidth * components; - src += srcStride; - } + dst = tempImage; + for (img = 0; img < srcDepth; img++) { + const GLubyte *src + = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat, + dst, srcFormat, srcType, src, + srcPacking, transferOps); + dst += srcWidth * components; + src += srcStride; } } @@ -536,7 +438,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, { GLuint transferOps = ctx->_ImageTransferState; const GLint components = _mesa_components_in_format(logicalBaseFormat); - GLboolean freeSrcImage = GL_FALSE; GLint img, row; GLchan *tempImage, *dst; @@ -556,37 +457,10 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, textureBaseFormat == GL_ALPHA || textureBaseFormat == GL_INTENSITY); -#if FEATURE_convolve - if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || - (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || - (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { - /* get convolved image */ - GLfloat *convImage = make_temp_float_image(ctx, dims, - logicalBaseFormat, - logicalBaseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, - srcAddr, srcPacking); - if (!convImage) - return NULL; - /* the convolved image is our new source image */ - srcAddr = convImage; - srcFormat = logicalBaseFormat; - srcType = GL_FLOAT; - srcPacking = &ctx->DefaultPacking; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); - transferOps = 0; - freeSrcImage = GL_TRUE; - } -#endif - /* unpack and transfer the source image */ tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLchan)); if (!tempImage) { - if (freeSrcImage) { - free((void *) srcAddr); - } return NULL; } @@ -608,11 +482,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, } } - /* If we made a temporary image for convolution, free it here */ - if (freeSrcImage) { - free((void *) srcAddr); - } - if (logicalBaseFormat != textureBaseFormat) { /* one more conversion step */ GLint texComponents = _mesa_components_in_format(textureBaseFormat); @@ -1238,7 +1107,6 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -1365,7 +1233,6 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -1567,7 +1434,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -1697,7 +1563,6 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -1824,7 +1689,6 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -1882,7 +1746,6 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -1951,7 +1814,6 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2010,7 +1872,6 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2115,7 +1976,6 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2186,7 +2046,6 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2257,7 +2116,6 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2327,8 +2185,6 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); - /* Note: tempImage is always float[4] / RGBA. We convert to 1, 2, * 3 or 4 components/pixel here. */ @@ -2390,7 +2246,6 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2479,7 +2334,6 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2710,7 +2564,6 @@ _mesa_texstore_signed_r8(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2755,7 +2608,6 @@ _mesa_texstore_signed_rg88(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2800,7 +2652,6 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -2912,7 +2763,6 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) GLint img, row, col; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3186,7 +3036,6 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); bytesPerRow = srcWidth * components * sizeof(GLfloat); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr @@ -3254,7 +3103,6 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3318,7 +3166,6 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3382,7 +3229,6 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3446,7 +3292,6 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3510,7 +3355,6 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3574,7 +3418,6 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -3638,7 +3481,6 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) GLint img, row; if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr + dstImageOffsets[dstZoffset + img] * texelBytes @@ -4057,9 +3899,6 @@ texture_row_stride(const struct gl_texture_image *texImage) * This is the software fallback for Driver.TexImage1D() * and Driver.CopyTexImage1D(). * \sa _mesa_store_teximage2d() - * Note that the width may not be the actual texture width since it may - * be changed by convolution w/ GL_REDUCE. The texImage->Width field will - * have the actual texture size. */ void _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, @@ -4114,9 +3953,6 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, * * This function is oriented toward storing images in main memory, rather * than VRAM. Device driver's can easily plug in their own replacement. - * - * Note: width and height may be pre-convolved dimensions, but - * texImage->Width and texImage->Height will be post-convolved dimensions. */ void _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 6ab03ec9391..d9e9a527f63 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -338,9 +338,6 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, assert(ctx->ReadBuffer->Width > 0); - /* XXX convolution not done yet */ - assert((transferOps & IMAGE_CONVOLUTION_BIT) == 0); - st_validate_state(st); /* Do all needed clipping here, so that we can forget about it later */ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 0a4f8508ec2..526417df3ba 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -545,11 +545,6 @@ st_TexImage(GLcontext * ctx, DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); - /* The Mesa/Gallium state tracker does not implement the imaging extensions - * such as convolution. - */ - assert(!ctx->Extensions.EXT_convolution); - /* switch to "normal" */ if (stObj->surface_based) { _mesa_clear_texture_object(ctx, texObj); diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index a9b4cb80818..c35494e3857 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -27,7 +27,6 @@ #include "main/context.h" #include "main/colormac.h" #include "main/condrender.h" -#include "main/convolve.h" #include "main/image.h" #include "main/macros.h" #include "main/imports.h" @@ -93,98 +92,6 @@ regions_overlap(GLint srcx, GLint srcy, } -/** - * RGBA copypixels with convolution. - */ -static void -copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, - GLint width, GLint height, GLint destx, GLint desty) -{ - GLint row; - const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; - const GLbitfield transferOps = ctx->_ImageTransferState; - GLfloat *dest, *tmpImage, *convImage; - SWspan span; - - INIT_SPAN(span, GL_BITMAP); - _swrast_span_default_attribs(ctx, &span); - span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; - - /* allocate space for GLfloat image */ - tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!tmpImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); - return; - } - convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!convImage) { - free(tmpImage); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); - return; - } - - /* read source image as float/RGBA */ - dest = tmpImage; - for (row = 0; row < height; row++) { - _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, - width, srcx, srcy + row, GL_FLOAT, dest); - dest += 4 * width; - } - - /* do the image transfer ops which preceed convolution */ - for (row = 0; row < height; row++) { - GLfloat (*rgba)[4] = (GLfloat (*)[4]) (tmpImage + row * width * 4); - _mesa_apply_rgba_transfer_ops(ctx, - transferOps & IMAGE_PRE_CONVOLUTION_BITS, - width, rgba); - } - - /* do convolution */ - if (ctx->Pixel.Convolution2DEnabled) { - _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); - } - else { - ASSERT(ctx->Pixel.Separable2DEnabled); - _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); - } - free(tmpImage); - - /* do remaining post-convolution image transfer ops */ - for (row = 0; row < height; row++) { - GLfloat (*rgba)[4] = (GLfloat (*)[4]) (convImage + row * width * 4); - _mesa_apply_rgba_transfer_ops(ctx, - transferOps & IMAGE_POST_CONVOLUTION_BITS, - width, rgba); - } - - /* write the new image */ - for (row = 0; row < height; row++) { - const GLfloat *src = convImage + row * width * 4; - GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; - - /* copy convolved colors into span array */ - memcpy(rgba, src, width * 4 * sizeof(GLfloat)); - - /* write span */ - span.x = destx; - span.y = desty + row; - span.end = width; - span.array->ChanType = GL_FLOAT; - if (zoom) { - _swrast_write_zoomed_rgba_span(ctx, destx, desty, &span, rgba); - } - else { - _swrast_write_rgba_span(ctx, &span); - } - } - /* restore this */ - span.array->ChanType = CHAN_TYPE; - - free(convImage); -} - - /** * RGBA copypixels */ @@ -204,16 +111,6 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, return; } - if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { - copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty); - return; - } - else if (ctx->Pixel.Convolution1DEnabled) { - /* make sure we don't apply 1D convolution */ - transferOps &= ~(IMAGE_CONVOLUTION_BIT | - IMAGE_POST_CONVOLUTION_SCALE_BIAS); - } - if (ctx->DrawBuffer == ctx->ReadBuffer) { overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 9bc0e9043ba..7778820c5cd 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -27,7 +27,6 @@ #include "main/bufferobj.h" #include "main/condrender.h" #include "main/context.h" -#include "main/convolve.h" #include "main/image.h" #include "main/macros.h" #include "main/imports.h" @@ -484,62 +483,6 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, span.arrayMask = SPAN_RGBA; span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */ - if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { - /* Convolution has to be handled specially. We'll create an - * intermediate image, applying all pixel transfer operations - * up to convolution. Then we'll convolve the image. Then - * we'll proceed with the rest of the transfer operations and - * rasterize the image. - */ - GLint row; - GLfloat *dest, *tmpImage; - - tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!tmpImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); - return; - } - convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!convImage) { - free(tmpImage); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); - return; - } - - /* Unpack the image and apply transfer ops up to convolution */ - dest = tmpImage; - for (row = 0; row < height; row++) { - const GLvoid *source = _mesa_image_address2d(unpack, - pixels, width, height, format, type, row, 0); - _mesa_unpack_color_span_float(ctx, width, GL_RGBA, (GLfloat *) dest, - format, type, source, unpack, - transferOps & IMAGE_PRE_CONVOLUTION_BITS); - dest += width * 4; - } - - /* do convolution */ - if (ctx->Pixel.Convolution2DEnabled) { - _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); - } - else { - ASSERT(ctx->Pixel.Separable2DEnabled); - _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); - } - free(tmpImage); - - /* continue transfer ops and draw the convolved image */ - unpack = &ctx->DefaultPacking; - pixels = convImage; - format = GL_RGBA; - type = GL_FLOAT; - transferOps &= IMAGE_POST_CONVOLUTION_BITS; - } - else if (ctx->Pixel.Convolution1DEnabled) { - /* we only want to apply 1D convolution to glTexImage1D */ - transferOps &= ~(IMAGE_CONVOLUTION_BIT | - IMAGE_POST_CONVOLUTION_SCALE_BIAS); - } - if (ctx->DrawBuffer->_NumColorDrawBuffers > 0 && ctx->DrawBuffer->_ColorDrawBuffers[0]->DataType != GL_FLOAT && ctx->Color.ClampFragmentColor != GL_FALSE) { diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 1de481248b1..b0a3d36420a 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -26,7 +26,6 @@ #include "main/glheader.h" #include "main/bufferobj.h" #include "main/colormac.h" -#include "main/convolve.h" #include "main/feedback.h" #include "main/formats.h" #include "main/image.h" @@ -326,57 +325,7 @@ read_rgba_pixels( GLcontext *ctx, /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); - if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { - GLfloat *dest, *src, *tmpImage, *convImage; - GLint row; - - tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!tmpImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); - return; - } - convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!convImage) { - free(tmpImage); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); - return; - } - - /* read full RGBA, FLOAT image */ - dest = tmpImage; - for (row = 0; row < height; row++, y++) { - _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, dest); - _mesa_apply_rgba_transfer_ops(ctx, - transferOps & IMAGE_PRE_CONVOLUTION_BITS, - width, (GLfloat (*)[4]) dest); - dest += width * 4; - } - - /* do convolution */ - if (ctx->Pixel.Convolution2DEnabled) { - _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); - } - else { - ASSERT(ctx->Pixel.Separable2DEnabled); - _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); - } - free(tmpImage); - - /* finish transfer ops and pack the resulting image */ - src = convImage; - for (row = 0; row < height; row++) { - GLvoid *dest; - dest = _mesa_image_address2d(packing, pixels, width, height, - format, type, row, 0); - _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) src, - format, type, dest, packing, - transferOps & IMAGE_POST_CONVOLUTION_BITS); - src += width * 4; - } - free(convImage); - } - else { - /* no convolution */ + do { const GLint dstStride = _mesa_image_row_stride(packing, width, format, type); GLfloat (*rgba)[4] = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0]; @@ -385,10 +334,6 @@ read_rgba_pixels( GLcontext *ctx, = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, format, type, 0, 0); - /* make sure we don't apply 1D convolution */ - transferOps &= ~(IMAGE_CONVOLUTION_BIT | - IMAGE_POST_CONVOLUTION_SCALE_BIAS); - for (row = 0; row < height; row++, y++) { /* Get float rgba pixels */ @@ -407,7 +352,7 @@ read_rgba_pixels( GLcontext *ctx, dst += dstStride; } - } + } while (0); } -- cgit v1.2.3 From ce8c71817b89ae97f960ba517becc8a74431206f Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Thu, 23 Sep 2010 22:30:46 +0200 Subject: r600g: Destroy the blitter. Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/r600_context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index b9abff9dc10..e8eb8142095 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -57,6 +57,8 @@ static void r600_destroy_context(struct pipe_context *context) free(rctx->vs_constant); free(rctx->vs_resource); + util_blitter_destroy(rctx->blitter); + u_upload_destroy(rctx->upload_vb); u_upload_destroy(rctx->upload_ib); -- cgit v1.2.3 From b360c050b60a578ce6c75cbc872dd54999b3f6c5 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 22 Sep 2010 17:37:30 -0400 Subject: r600g: initial evergreen support in new path This doesn't work yet. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/Makefile | 1 + src/gallium/drivers/r600/evergreen_state.c | 1477 +++++++++++++++++++++++++ src/gallium/drivers/r600/evergreend.h | 410 +++++++ src/gallium/drivers/r600/r600.h | 16 + src/gallium/drivers/r600/r600_pipe.h | 146 +++ src/gallium/drivers/r600/r600_state2.c | 164 +-- src/gallium/winsys/r600/drm/Makefile | 1 + src/gallium/winsys/r600/drm/evergreen_state.c | 685 ++++++++++++ src/gallium/winsys/r600/drm/r600_state2.c | 32 +- 9 files changed, 2806 insertions(+), 126 deletions(-) create mode 100644 src/gallium/drivers/r600/evergreen_state.c create mode 100644 src/gallium/drivers/r600/r600_pipe.h create mode 100644 src/gallium/winsys/r600/drm/evergreen_state.c (limited to 'src') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 3cdb963f978..433b7044e5e 100644 --- a/src/gallium/drivers/r600/Makefile +++ b/src/gallium/drivers/r600/Makefile @@ -9,6 +9,7 @@ LIBRARY_INCLUDES = \ C_SOURCES = \ r600_buffer.c \ r600_state2.c \ + evergreen_state.c \ r600_context.c \ r600_shader.c \ r600_draw.c \ diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c new file mode 100644 index 00000000000..7ac505c525e --- /dev/null +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -0,0 +1,1477 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + */ + +/* TODO: + * - fix mask for depth control & cull for query + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "r600.h" +#include "evergreend.h" +struct radeon_state { + unsigned dummy; +}; +#include "r600_resource.h" +#include "r600_shader.h" +#include "r600_pipe.h" +#include "eg_state_inlines.h" + +static void evergreen_set_blend_color(struct pipe_context *ctx, + const struct pipe_blend_color *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + + if (rstate == NULL) + return; + + rstate->id = R600_PIPE_STATE_BLEND_COLOR; + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); + free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); + rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void *evergreen_create_blend_state(struct pipe_context *ctx, + const struct pipe_blend_state *state) +{ + struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend); + struct r600_pipe_state *rstate; + u32 color_control, target_mask; + + if (blend == NULL) { + return NULL; + } + rstate = &blend->rstate; + + rstate->id = R600_PIPE_STATE_BLEND; + + target_mask = 0; + color_control = S_028808_MODE(1); + if (state->logicop_enable) { + color_control |= (state->logicop_func << 16) | (state->logicop_func << 20); + } else { + color_control |= (0xcc << 16); + } + /* we pretend 8 buffer are used, CB_SHADER_MASK will disable unused one */ + if (state->independent_blend_enable) { + for (int i = 0; i < 8; i++) { + target_mask |= (state->rt[i].colormask << (4 * i)); + } + } else { + for (int i = 0; i < 8; i++) { + target_mask |= (state->rt[0].colormask << (4 * i)); + } + } + blend->cb_target_mask = target_mask; + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL, + color_control, 0xFFFFFFFF, NULL); + return rstate; +} + +static void evergreen_bind_blend_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_blend *blend = (struct r600_pipe_blend *)state; + struct r600_pipe_state *rstate; + + if (state == NULL) + return; + rstate = &blend->rstate; + rctx->states[rstate->id] = rstate; + rctx->cb_target_mask = blend->cb_target_mask; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void *evergreen_create_dsa_state(struct pipe_context *ctx, + const struct pipe_depth_stencil_alpha_state *state) +{ + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; + unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control; + + if (rstate == NULL) { + return NULL; + } + + rstate->id = R600_PIPE_STATE_DSA; + /* depth TODO some of those db_shader_control field depend on shader adjust mask & add it to shader */ + /* db_shader_control is 0xFFFFFFBE as Z_EXPORT_ENABLE (bit 0) will be + * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will + * be set if shader use texkill instruction + */ + db_shader_control = 0x210; + stencil_ref_mask = 0; + stencil_ref_mask_bf = 0; + db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | + S_028800_Z_WRITE_ENABLE(state->depth.writemask) | + S_028800_ZFUNC(state->depth.func); + + /* stencil */ + if (state->stencil[0].enabled) { + db_depth_control |= S_028800_STENCIL_ENABLE(1); + db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)); + db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)); + db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)); + db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); + + + stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) | + S_028430_STENCILWRITEMASK(state->stencil[0].writemask); + if (state->stencil[1].enabled) { + db_depth_control |= S_028800_BACKFACE_ENABLE(1); + db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)); + db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)); + db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)); + db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); + stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | + S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask); + } + } + + /* alpha */ + alpha_test_control = 0; + alpha_ref = 0; + if (state->alpha.enabled) { + alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func); + alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1); + alpha_ref = fui(state->alpha.ref_value); + } + + /* misc */ + db_render_control = 0; + db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | + S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | + S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); + /* TODO db_render_override depends on query */ + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028430_DB_STENCILREFMASK, stencil_ref_mask, + 0xFFFFFFFF & C_028430_STENCILREF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf, + 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); + + return rstate; +} + +static void *evergreen_create_rs_state(struct pipe_context *ctx, + const struct pipe_rasterizer_state *state) +{ + struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); + struct r600_pipe_state *rstate; + float offset_units = 0, offset_scale = 0; + unsigned offset_db_fmt_cntl = 0; + unsigned tmp; + unsigned prov_vtx = 1; + + if (rs == NULL) { + return NULL; + } + + rstate = &rs->rstate; + rs->flatshade = state->flatshade; + rs->sprite_coord_enable = state->sprite_coord_enable; + + rstate->id = R600_PIPE_STATE_RASTERIZER; + if (state->flatshade_first) + prov_vtx = 0; + tmp = 0x00000001; + if (state->sprite_coord_enable) { + tmp |= S_0286D4_PNT_SPRITE_ENA(1) | + S_0286D4_PNT_SPRITE_OVRD_X(2) | + S_0286D4_PNT_SPRITE_OVRD_Y(3) | + S_0286D4_PNT_SPRITE_OVRD_Z(0) | + S_0286D4_PNT_SPRITE_OVRD_W(1); + if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) { + tmp |= S_0286D4_PNT_SPRITE_TOP_1(1); + } + } + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, + S_028814_PROVOKING_VTX_LAST(prov_vtx) | + S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | + S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | + S_028814_FACE(!state->front_ccw) | + S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | + S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | + S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, + S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | + S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + /* point size 12.4 fixed point */ + tmp = (unsigned)(state->point_size * 8.0); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + return rstate; +} + +static void evergreen_bind_rs_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + if (state == NULL) + return; + + if (rctx->flatshade != rs->flatshade) { +// rctx->ps_rebuild = TRUE; + } + if (rctx->sprite_coord_enable != rs->sprite_coord_enable) { +// rctx->ps_rebuild = TRUE; + } + rctx->flatshade = rs->flatshade; + rctx->sprite_coord_enable = rs->sprite_coord_enable; + + rctx->states[rs->rstate.id] = &rs->rstate; + r600_context_pipe_state_set(&rctx->ctx, &rs->rstate); +} + +static void evergreen_delete_rs_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; + + if (rctx->states[rs->rstate.id] == &rs->rstate) { + rctx->states[rs->rstate.id] = NULL; + } + free(rs); +} + +static void *evergreen_create_sampler_state(struct pipe_context *ctx, + const struct pipe_sampler_state *state) +{ + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + union util_color uc; + + if (rstate == NULL) { + return NULL; + } + + rstate->id = R600_PIPE_STATE_SAMPLER; + util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0, + S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | + S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | + S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | + S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) | + S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) | + S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) | + S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | + S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL); + /* FIXME LOD it depends on texture base level ... */ + r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0, + S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | + S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0, + S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) | + S_03C008_TYPE(1), + 0xFFFFFFFF, NULL); + + if (uc.ui) { + /* TODO border color */ + } + return rstate; +} + +static void *evergreen_create_vertex_elements(struct pipe_context *ctx, + unsigned count, + const struct pipe_vertex_element *elements) +{ + struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); + + assert(count < 32); + v->count = count; + v->refcount = 1; + memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element)); + return v; +} + +static void evergreen_sampler_view_destroy(struct pipe_context *ctx, + struct pipe_sampler_view *state) +{ + struct r600_pipe_sampler_view *resource = (struct r600_pipe_sampler_view *)state; + + pipe_resource_reference(&state->texture, NULL); + FREE(resource); +} + +static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_context *ctx, + struct pipe_resource *texture, + const struct pipe_sampler_view *state) +{ + struct r600_pipe_sampler_view *resource = CALLOC_STRUCT(r600_pipe_sampler_view); + struct r600_pipe_state *rstate; + const struct util_format_description *desc; + struct r600_resource_texture *tmp; + struct r600_resource *rbuffer; + unsigned format; + uint32_t word4 = 0, yuv_format = 0, pitch = 0; + unsigned char swizzle[4]; + struct radeon_ws_bo *bo[2]; + + if (resource == NULL) + return NULL; + rstate = &resource->state; + + /* initialize base object */ + resource->base = *state; + resource->base.texture = NULL; + pipe_reference(NULL, &texture->reference); + resource->base.texture = texture; + resource->base.reference.count = 1; + resource->base.context = ctx; + + swizzle[0] = state->swizzle_r; + swizzle[1] = state->swizzle_g; + swizzle[2] = state->swizzle_b; + swizzle[3] = state->swizzle_a; + format = r600_translate_texformat(texture->format, + swizzle, + &word4, &yuv_format); + if (format == ~0) { + format = 0; + } + desc = util_format_description(texture->format); + if (desc == NULL) { + R600_ERR("unknow format %d\n", texture->format); + } + tmp = (struct r600_resource_texture*)texture; + rbuffer = &tmp->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; + /* FIXME depth texture decompression */ + if (tmp->depth) { +#if 0 + r = evergreen_texture_from_depth(ctx, tmp, view->first_level); + if (r) { + return; + } + bo[0] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); + bo[1] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); +#endif + } + pitch = align(tmp->pitch[0] / tmp->bpt, 8); + + /* FIXME properly handle first level != 0 */ + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, + S_030000_DIM(r600_tex_dim(texture->target)) | + S_030000_PITCH((pitch / 8) - 1) | + S_030000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, + S_030004_TEX_HEIGHT(texture->height0 - 1) | + S_030004_TEX_DEPTH(texture->depth0 - 1), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030008_RESOURCE0_WORD2, + tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03000C_RESOURCE0_WORD3, + tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, + word4 | S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) | + S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) | + S_030010_REQUEST_SIZE(1) | + S_030010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, + S_030014_LAST_LEVEL(state->last_level) | + S_030014_BASE_ARRAY(0) | + S_030014_LAST_ARRAY(0), 0xffffffff, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, + S_03001C_DATA_FORMAT(format) | + S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL); + + return &resource->base; +} + +static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, + struct pipe_sampler_view **views) +{ + /* TODO */ + assert(1); +} + +static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, + struct pipe_sampler_view **views) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; + + for (int i = 0; i < count; i++) { + if (resource[i]) { + r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); + } + } +} + +static void evergreen_bind_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; + + if (state == NULL) + return; + rctx->states[rstate->id] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void **states) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; + + for (int i = 0; i < count; i++) { + r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); + } +} + +static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void **states) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; + + /* TODO implement */ + for (int i = 0; i < count; i++) { + r600_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); + } +} + +static void evergreen_delete_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; + + if (rctx->states[rstate->id] == rstate) { + rctx->states[rstate->id] = NULL; + } + for (int i = 0; i < rstate->nregs; i++) { + radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); + } + free(rstate); +} + +static void evergreen_delete_vertex_element(struct pipe_context *ctx, void *state) +{ + struct r600_vertex_element *v = (struct r600_vertex_element*)state; + + if (v == NULL) + return; + if (--v->refcount) + return; + free(v); +} + +static void evergreen_set_clip_state(struct pipe_context *ctx, + const struct pipe_clip_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + + if (rstate == NULL) + return; + + rctx->clip = *state; + rstate->id = R600_PIPE_STATE_CLIP; + for (int i = 0; i < state->nr; i++) { + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0285BC_PA_CL_UCP0_X + i * 4, + fui(state->ucp[i][0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0285C0_PA_CL_UCP0_Y + i * 4, + fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0285C4_PA_CL_UCP0_Z + i * 4, + fui(state->ucp[i][2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0285C8_PA_CL_UCP0_W + i * 4, + fui(state->ucp[i][3]), 0xFFFFFFFF, NULL); + } + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, + S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) | + S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) | + S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_CLIP]); + rctx->states[R600_PIPE_STATE_CLIP] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void evergreen_bind_vertex_elements(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_vertex_element *v = (struct r600_vertex_element*)state; + + evergreen_delete_vertex_element(ctx, rctx->vertex_elements); + rctx->vertex_elements = v; + if (v) { + v->refcount++; +// rctx->vs_rebuild = TRUE; + } +} + +static void evergreen_set_polygon_stipple(struct pipe_context *ctx, + const struct pipe_poly_stipple *state) +{ +} + +static void evergreen_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask) +{ +} + +static void evergreen_set_scissor_state(struct pipe_context *ctx, + const struct pipe_scissor_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + u32 tl, br; + + if (rstate == NULL) + return; + + rstate->id = R600_PIPE_STATE_SCISSOR; + tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1); + br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028030_PA_SC_SCREEN_SCISSOR_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028034_PA_SC_SCREEN_SCISSOR_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028204_PA_SC_WINDOW_SCISSOR_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028208_PA_SC_WINDOW_SCISSOR_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028210_PA_SC_CLIPRECT_0_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028214_PA_SC_CLIPRECT_0_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028218_PA_SC_CLIPRECT_1_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02821C_PA_SC_CLIPRECT_1_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028220_PA_SC_CLIPRECT_2_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028224_PA_SC_CLIPRECT_2_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028228_PA_SC_CLIPRECT_3_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02822C_PA_SC_CLIPRECT_3_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028200_PA_SC_WINDOW_OFFSET, 0x00000000, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, + 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_SCISSOR]); + rctx->states[R600_PIPE_STATE_SCISSOR] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void evergreen_set_stencil_ref(struct pipe_context *ctx, + const struct pipe_stencil_ref *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + u32 tmp; + + if (rstate == NULL) + return; + + rctx->stencil_ref = *state; + rstate->id = R600_PIPE_STATE_STENCIL_REF; + tmp = S_028430_STENCILREF(state->ref_value[0]); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028430_DB_STENCILREFMASK, tmp, + ~C_028430_STENCILREF, NULL); + tmp = S_028434_STENCILREF_BF(state->ref_value[1]); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028434_DB_STENCILREFMASK_BF, tmp, + ~C_028434_STENCILREF_BF, NULL); + + free(rctx->states[R600_PIPE_STATE_STENCIL_REF]); + rctx->states[R600_PIPE_STATE_STENCIL_REF] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void evergreen_set_viewport_state(struct pipe_context *ctx, + const struct pipe_viewport_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + + if (rstate == NULL) + return; + + rctx->viewport = *state; + rstate->id = R600_PIPE_STATE_VIEWPORT; + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_VIEWPORT]); + rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, + const struct pipe_framebuffer_state *state, int cb) +{ + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + unsigned level = state->cbufs[cb]->level; + unsigned pitch, slice; + unsigned color_info; + unsigned format, swap, ntype; + const struct util_format_description *desc; + struct radeon_ws_bo *bo[3]; + + rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; + rbuffer = &rtex->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; + bo[2] = rbuffer->bo; + + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; + ntype = 0; + desc = util_format_description(rtex->resource.base.b.format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) + ntype = V_028C70_NUMBER_SRGB; + + format = r600_translate_colorformat(rtex->resource.base.b.format); + swap = r600_translate_colorswap(rtex->resource.base.b.format); + color_info = S_028C70_FORMAT(format) | + S_028C70_COMP_SWAP(swap) | + S_028C70_BLEND_CLAMP(1) | + S_028C70_SOURCE_FORMAT(1) | + S_028C70_NUMBER_TYPE(ntype); + + /* FIXME handle enabling of CB beyond BASE8 which has different offset */ + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028C60_CB_COLOR0_BASE + cb * 0x3C, + state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028C70_CB_COLOR0_INFO + cb * 0x3C, + color_info, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028C64_CB_COLOR0_PITCH + cb * 0x3C, + S_028C64_PITCH_TILE_MAX(pitch), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028C68_CB_COLOR0_SLICE + cb * 0x3C, + S_028C68_SLICE_TILE_MAX(slice), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028C6C_CB_COLOR0_VIEW + cb * 0x3C, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028C74_CB_COLOR0_ATTRIB + cb * 0x3C, + S_028C74_NON_DISP_TILING_ORDER(1), + 0xFFFFFFFF, NULL); +} + +static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, + const struct pipe_framebuffer_state *state) +{ + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + unsigned level; + unsigned pitch, slice, format; + + if (state->zsbuf == NULL) + return; + + rtex = (struct r600_resource_texture*)state->zsbuf->texture; + rtex->tiled = 1; + rtex->array_mode = 2; + rtex->tile_type = 1; + rtex->depth = 1; + rbuffer = &rtex->resource; + + level = state->zsbuf->level; + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; + format = r600_translate_dbformat(state->zsbuf->texture->format); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028048_DB_Z_READ_BASE, + state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028050_DB_Z_WRITE_BASE, + state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028040_DB_Z_INFO, + S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028058_DB_DEPTH_SIZE, + S_028058_PITCH_TILE_MAX(pitch), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02805C_DB_DEPTH_SLICE, + S_02805C_SLICE_TILE_MAX(slice), + 0xFFFFFFFF, NULL); +} + +static void evergreen_set_framebuffer_state(struct pipe_context *ctx, + const struct pipe_framebuffer_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + u32 shader_mask, tl, br, target_mask; + + if (rstate == NULL) + return; + + /* unreference old buffer and reference new one */ + rstate->id = R600_PIPE_STATE_FRAMEBUFFER; + for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { + pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL); + } + for (int i = 0; i < state->nr_cbufs; i++) { + pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]); + } + pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf); + rctx->framebuffer = *state; + + /* build states */ + for (int i = 0; i < state->nr_cbufs; i++) { + evergreen_cb(rctx, rstate, state, i); + } + if (state->zsbuf) { + evergreen_db(rctx, rstate, state); + } + + target_mask = 0x00000000; + target_mask = 0xFFFFFFFF; + shader_mask = 0; + for (int i = 0; i < state->nr_cbufs; i++) { + target_mask ^= 0xf << (i * 4); + shader_mask |= 0xf << (i * 4); + } + tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1); + br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028240_PA_SC_GENERIC_SCISSOR_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028244_PA_SC_GENERIC_SCISSOR_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, + 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, + 0x00000000, target_mask, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK, + shader_mask, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, + 0x00000000, 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); + rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void evergreen_set_index_buffer(struct pipe_context *ctx, + const struct pipe_index_buffer *ib) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + if (ib) { + pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer); + memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer)); + } else { + pipe_resource_reference(&rctx->index_buffer.buffer, NULL); + memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer)); + } + + /* TODO make this more like a state */ +} + +static void evergreen_set_vertex_buffers(struct pipe_context *ctx, unsigned count, + const struct pipe_vertex_buffer *buffers) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + for (int i = 0; i < rctx->nvertex_buffer; i++) { + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + } + memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); + for (int i = 0; i < count; i++) { + rctx->vertex_buffer[i].buffer = NULL; + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); + } + rctx->nvertex_buffer = count; +} + +static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, + struct pipe_resource *buffer) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_resource *rbuffer = (struct r600_resource*)buffer; + + switch (shader) { + case PIPE_SHADER_VERTEX: + rctx->vs_const_buffer.nregs = 0; + r600_pipe_state_add_reg(&rctx->vs_const_buffer, R600_GROUP_ALU_CONST, + R_028180_ALU_CONST_BUFFER_SIZE_VS_0, + ALIGN_DIVUP(buffer->width0 >> 4, 16), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rctx->vs_const_buffer, R600_GROUP_ALU_CONST, + R_028980_ALU_CONST_CACHE_VS_0, + 0, 0xFFFFFFFF, rbuffer->bo); + r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); + break; + case PIPE_SHADER_FRAGMENT: + rctx->ps_const_buffer.nregs = 0; + r600_pipe_state_add_reg(&rctx->ps_const_buffer, R600_GROUP_ALU_CONST, + R_028140_ALU_CONST_BUFFER_SIZE_PS_0, + ALIGN_DIVUP(buffer->width0 >> 4, 16), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rctx->ps_const_buffer, R600_GROUP_ALU_CONST, + R_028940_ALU_CONST_CACHE_PS_0, + 0, 0xFFFFFFFF, rbuffer->bo); + r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); + break; + default: + R600_ERR("unsupported %d\n", shader); + return; + } +} + +static void *evergreen_create_shader_state(struct pipe_context *ctx, + const struct pipe_shader_state *state) +{ + struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); + int r; + + r = r600_pipe_shader_create2(ctx, shader, state->tokens); + if (r) { + return NULL; + } + return shader; +} + +static void evergreen_bind_ps_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + /* TODO delete old shader */ + rctx->ps_shader = (struct r600_pipe_shader *)state; +} + +static void evergreen_bind_vs_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + /* TODO delete old shader */ + rctx->vs_shader = (struct r600_pipe_shader *)state; +} + +static void evergreen_delete_ps_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; + + if (rctx->ps_shader == shader) { + rctx->ps_shader = NULL; + } + /* TODO proper delete */ + free(shader); +} + +static void evergreen_delete_vs_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; + + if (rctx->vs_shader == shader) { + rctx->vs_shader = NULL; + } + /* TODO proper delete */ + free(shader); +} + +void evergreen_init_state_functions2(struct r600_pipe_context *rctx) +{ + rctx->context.create_blend_state = evergreen_create_blend_state; + rctx->context.create_depth_stencil_alpha_state = evergreen_create_dsa_state; + rctx->context.create_fs_state = evergreen_create_shader_state; + rctx->context.create_rasterizer_state = evergreen_create_rs_state; + rctx->context.create_sampler_state = evergreen_create_sampler_state; + rctx->context.create_sampler_view = evergreen_create_sampler_view; + rctx->context.create_vertex_elements_state = evergreen_create_vertex_elements; + rctx->context.create_vs_state = evergreen_create_shader_state; + rctx->context.bind_blend_state = evergreen_bind_blend_state; + rctx->context.bind_depth_stencil_alpha_state = evergreen_bind_state; + rctx->context.bind_fragment_sampler_states = evergreen_bind_ps_sampler; + rctx->context.bind_fs_state = evergreen_bind_ps_shader; + rctx->context.bind_rasterizer_state = evergreen_bind_rs_state; + rctx->context.bind_vertex_elements_state = evergreen_bind_vertex_elements; + rctx->context.bind_vertex_sampler_states = evergreen_bind_vs_sampler; + rctx->context.bind_vs_state = evergreen_bind_vs_shader; + rctx->context.delete_blend_state = evergreen_delete_state; + rctx->context.delete_depth_stencil_alpha_state = evergreen_delete_state; + rctx->context.delete_fs_state = evergreen_delete_ps_shader; + rctx->context.delete_rasterizer_state = evergreen_delete_rs_state; + rctx->context.delete_sampler_state = evergreen_delete_state; + rctx->context.delete_vertex_elements_state = evergreen_delete_vertex_element; + rctx->context.delete_vs_state = evergreen_delete_vs_shader; + rctx->context.set_blend_color = evergreen_set_blend_color; + rctx->context.set_clip_state = evergreen_set_clip_state; + rctx->context.set_constant_buffer = evergreen_set_constant_buffer; + rctx->context.set_fragment_sampler_views = evergreen_set_ps_sampler_view; + rctx->context.set_framebuffer_state = evergreen_set_framebuffer_state; + rctx->context.set_polygon_stipple = evergreen_set_polygon_stipple; + rctx->context.set_sample_mask = evergreen_set_sample_mask; + rctx->context.set_scissor_state = evergreen_set_scissor_state; + rctx->context.set_stencil_ref = evergreen_set_stencil_ref; + rctx->context.set_vertex_buffers = evergreen_set_vertex_buffers; + rctx->context.set_index_buffer = evergreen_set_index_buffer; + rctx->context.set_vertex_sampler_views = evergreen_set_vs_sampler_view; + rctx->context.set_viewport_state = evergreen_set_viewport_state; + rctx->context.sampler_view_destroy = evergreen_sampler_view_destroy; +} + +void evergreen_init_config2(struct r600_pipe_context *rctx) +{ + struct r600_pipe_state *rstate = &rctx->config; + int ps_prio; + int vs_prio; + int gs_prio; + int es_prio; + int hs_prio, cs_prio, ls_prio; + int num_ps_gprs; + int num_vs_gprs; + int num_gs_gprs; + int num_es_gprs; + int num_hs_gprs; + int num_ls_gprs; + int num_temp_gprs; + int num_ps_threads; + int num_vs_threads; + int num_gs_threads; + int num_es_threads; + int num_hs_threads; + int num_ls_threads; + int num_ps_stack_entries; + int num_vs_stack_entries; + int num_gs_stack_entries; + int num_es_stack_entries; + int num_hs_stack_entries; + int num_ls_stack_entries; + enum radeon_family family; + unsigned tmp; + + family = r600_get_family(rctx->radeon); + ps_prio = 0; + vs_prio = 1; + gs_prio = 2; + es_prio = 3; + hs_prio = 0; + ls_prio = 0; + cs_prio = 0; + + switch (family) { + case CHIP_CEDAR: + default: + num_ps_gprs = 93; + num_vs_gprs = 46; + num_temp_gprs = 4; + num_gs_gprs = 31; + num_es_gprs = 31; + num_hs_gprs = 23; + num_ls_gprs = 23; + num_ps_threads = 96; + num_vs_threads = 16; + num_gs_threads = 16; + num_es_threads = 16; + num_hs_threads = 16; + num_ls_threads = 16; + num_ps_stack_entries = 42; + num_vs_stack_entries = 42; + num_gs_stack_entries = 42; + num_es_stack_entries = 42; + num_hs_stack_entries = 42; + num_ls_stack_entries = 42; + break; + case CHIP_REDWOOD: + num_ps_gprs = 93; + num_vs_gprs = 46; + num_temp_gprs = 4; + num_gs_gprs = 31; + num_es_gprs = 31; + num_hs_gprs = 23; + num_ls_gprs = 23; + num_ps_threads = 128; + num_vs_threads = 20; + num_gs_threads = 20; + num_es_threads = 20; + num_hs_threads = 20; + num_ls_threads = 20; + num_ps_stack_entries = 42; + num_vs_stack_entries = 42; + num_gs_stack_entries = 42; + num_es_stack_entries = 42; + num_hs_stack_entries = 42; + num_ls_stack_entries = 42; + break; + case CHIP_JUNIPER: + num_ps_gprs = 93; + num_vs_gprs = 46; + num_temp_gprs = 4; + num_gs_gprs = 31; + num_es_gprs = 31; + num_hs_gprs = 23; + num_ls_gprs = 23; + num_ps_threads = 128; + num_vs_threads = 20; + num_gs_threads = 20; + num_es_threads = 20; + num_hs_threads = 20; + num_ls_threads = 20; + num_ps_stack_entries = 85; + num_vs_stack_entries = 85; + num_gs_stack_entries = 85; + num_es_stack_entries = 85; + num_hs_stack_entries = 85; + num_ls_stack_entries = 85; + break; + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + num_ps_gprs = 93; + num_vs_gprs = 46; + num_temp_gprs = 4; + num_gs_gprs = 31; + num_es_gprs = 31; + num_hs_gprs = 23; + num_ls_gprs = 23; + num_ps_threads = 128; + num_vs_threads = 20; + num_gs_threads = 20; + num_es_threads = 20; + num_hs_threads = 20; + num_ls_threads = 20; + num_ps_stack_entries = 85; + num_vs_stack_entries = 85; + num_gs_stack_entries = 85; + num_es_stack_entries = 85; + num_hs_stack_entries = 85; + num_ls_stack_entries = 85; + break; + } + + tmp = 0x00000000; + switch (family) { + case CHIP_CEDAR: + break; + default: + tmp |= S_008C00_VC_ENABLE(1); + break; + } + tmp |= S_008C00_EXPORT_SRC_C(1); + tmp |= S_008C00_CS_PRIO(cs_prio); + tmp |= S_008C00_LS_PRIO(ls_prio); + tmp |= S_008C00_HS_PRIO(hs_prio); + tmp |= S_008C00_PS_PRIO(ps_prio); + tmp |= S_008C00_VS_PRIO(vs_prio); + tmp |= S_008C00_GS_PRIO(gs_prio); + tmp |= S_008C00_ES_PRIO(es_prio); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); + tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); + tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); + tmp |= S_008C08_NUM_ES_GPRS(num_es_gprs); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C0C_NUM_HS_GPRS(num_hs_gprs); + tmp |= S_008C0C_NUM_LS_GPRS(num_ls_gprs); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C18_NUM_PS_THREADS(num_ps_threads); + tmp |= S_008C18_NUM_VS_THREADS(num_vs_threads); + tmp |= S_008C18_NUM_GS_THREADS(num_gs_threads); + tmp |= S_008C18_NUM_ES_THREADS(num_es_threads); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C1C_NUM_HS_THREADS(num_hs_threads); + tmp |= S_008C1C_NUM_LS_THREADS(num_ls_threads); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); + tmp |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); + tmp |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries); + tmp |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL); + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); +void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate; + struct r600_resource *rbuffer; + unsigned i, j, offset, format, prim; + u32 vgt_dma_index_type, vgt_draw_initiator, mask; + struct pipe_vertex_buffer *vertex_buffer; + struct r600_draw rdraw; + struct r600_pipe_state vgt; + struct r600_drawl draw; + + assert(info->index_bias == 0); + + draw.mode = info->mode; + draw.start = info->start; + draw.count = info->count; + if (info->indexed && rctx->index_buffer.buffer) { + draw.index_size = rctx->index_buffer.index_size; + draw.index_buffer = rctx->index_buffer.buffer; + assert(rctx->index_buffer.offset % + rctx->index_buffer.index_size == 0); + draw.start += rctx->index_buffer.offset / + rctx->index_buffer.index_size; + } else { + draw.index_size = 0; + draw.index_buffer = NULL; + } + switch (draw.index_size) { + case 2: + vgt_draw_initiator = 0; + vgt_dma_index_type = 0; + break; + case 4: + vgt_draw_initiator = 0; + vgt_dma_index_type = 1; + break; + case 0: + vgt_draw_initiator = 2; + vgt_dma_index_type = 0; + break; + default: + R600_ERR("unsupported index size %d\n", draw.index_size); + return; + } + if (r600_conv_pipe_prim(draw.mode, &prim)) + return; + + /* rebuild vertex shader if input format changed */ + if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader)) + return; + if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader)) + return; + + for (i = 0 ; i < rctx->vertex_elements->count; i++) { + rstate = &rctx->vs_resource[i]; + j = rctx->vertex_elements->elements[i].vertex_buffer_index; + vertex_buffer = &rctx->vertex_buffer[j]; + rbuffer = (struct r600_resource*)vertex_buffer->buffer; + offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; + format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); + rstate->id = R600_PIPE_STATE_RESOURCE; + rstate->nregs = 0; + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, + R_030008_RESOURCE0_WORD2, + S_030008_STRIDE(vertex_buffer->stride) | + S_030008_DATA_FORMAT(format), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, + R_03000C_RESOURCE0_WORD3, + S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) | + S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) | + S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) | + S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL); + evergreen_vs_resource_set(&rctx->ctx, rstate, i); + } + + mask = 0; + for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { + mask |= (0xF << (i * 4)); + } + + vgt.id = R600_PIPE_STATE_VGT; + vgt.nregs = 0; + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.start, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); + r600_context_pipe_state_set(&rctx->ctx, &vgt); + + rdraw.vgt_num_indices = draw.count; + rdraw.vgt_num_instances = 1; + rdraw.vgt_index_type = vgt_dma_index_type; + rdraw.vgt_draw_initiator = vgt_draw_initiator; + rdraw.indices = NULL; + if (draw.index_buffer) { + rbuffer = (struct r600_resource*)draw.index_buffer; + rdraw.indices = rbuffer->bo; + rdraw.indices_bo_offset = 0; + } + evergreen_context_draw(&rctx->ctx, &rdraw); +} + +void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = &shader->rstate; + struct r600_shader *rshader = &shader->shader; + unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z; + boolean have_pos = FALSE, have_face = FALSE; + + /* clear previous register */ + rstate->nregs = 0; + + for (i = 0; i < rshader->ninput; i++) { + tmp = S_028644_SEMANTIC(i); + tmp |= S_028644_SEL_CENTROID(1); + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) + have_pos = TRUE; + if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || + rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || + rshader->input[i].name == TGSI_SEMANTIC_POSITION) { + tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); + } + if (rshader->input[i].name == TGSI_SEMANTIC_FACE) + have_face = TRUE; + if (rctx->sprite_coord_enable & (1 << i)) { + tmp |= S_028644_PT_SPRITE_TEX(1); + } + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); + } + + exports_ps = 0; + num_cout = 0; + for (i = 0; i < rshader->noutput; i++) { + if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) + exports_ps |= 1; + else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { + num_cout++; + } + } + exports_ps |= S_02884C_EXPORT_COLORS(num_cout); + if (!exports_ps) { + /* always at least export 1 component per pixel */ + exports_ps = 2; + } + + spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) | + S_0286CC_PERSP_GRADIENT_ENA(1); + spi_input_z = 0; + if (have_pos) { + spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1); + spi_input_z |= 1; + } + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, + spi_ps_in_control_0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, + S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028840_SQ_PGM_START_PS, + 0x00000000, 0xFFFFFFFF, shader->bo); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028844_SQ_PGM_RESOURCES_PS, + S_028844_NUM_GPRS(rshader->bc.ngpr) | + S_028844_PRIME_CACHE_ON_DRAW(1) | + S_028844_STACK_SIZE(rshader->bc.nstack), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02884C_SQ_PGM_EXPORTS_PS, + exports_ps, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0286E0_SPI_BARYC_CNTL, + S_0286E0_PERSP_CENTROID_ENA(1) | + S_0286E0_LINEAR_CENTROID_ENA(1), + 0xFFFFFFFF, NULL); +} + +void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) +{ + struct r600_pipe_state *rstate = &shader->rstate; + struct r600_shader *rshader = &shader->shader; + unsigned spi_vs_out_id[10]; + unsigned i, tmp; + + /* clear previous register */ + rstate->nregs = 0; + + /* so far never got proper semantic id from tgsi */ + for (i = 0; i < 10; i++) { + spi_vs_out_id[i] = 0; + } + for (i = 0; i < 32; i++) { + tmp = i << ((i & 3) * 8); + spi_vs_out_id[i / 4] |= tmp; + } + for (i = 0; i < 10; i++) { + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02861C_SPI_VS_OUT_ID_0 + i * 4, + spi_vs_out_id[i], 0xFFFFFFFF, NULL); + } + + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0286C4_SPI_VS_OUT_CONFIG, + S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028860_SQ_PGM_RESOURCES_VS, + S_028860_NUM_GPRS(rshader->bc.ngpr) | + S_028860_STACK_SIZE(rshader->bc.nstack), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0288A8_SQ_PGM_RESOURCES_FS, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02885C_SQ_PGM_START_VS, + 0x00000000, 0xFFFFFFFF, shader->bo); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_0288A4_SQ_PGM_START_FS, + 0x00000000, 0xFFFFFFFF, shader->bo); +} diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 77cd8f1588b..1973da3647d 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -26,6 +26,23 @@ #ifndef EVERGREEND_H #define EVERGREEND_H +/* evergreen values */ +#define EVERGREEN_CONFIG_REG_OFFSET 0X00008000 +#define EVERGREEN_CONFIG_REG_END 0X0000AC00 +#define EVERGREEN_CONTEXT_REG_OFFSET 0X00028000 +#define EVERGREEN_CONTEXT_REG_END 0X00029000 +#define EVERGREEN_RESOURCE_OFFSET 0x00030000 +#define EVERGREEN_RESOURCE_END 0x00030400 +#define EVERGREEN_LOOP_CONST_OFFSET 0x0003A200 +#define EVERGREEN_LOOP_CONST_END 0x0003A26C +#define EVERGREEN_BOOL_CONST_OFFSET 0x0003A500 +#define EVERGREEN_BOOL_CONST_END 0x0003A506 +#define EVERGREEN_SAMPLER_OFFSET 0X0003C000 +#define EVERGREEN_SAMPLER_END 0X0003CFF0 + +#define EVENT_TYPE_ZPASS_DONE 0x15 +#define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16 + #define R600_TEXEL_PITCH_ALIGNMENT_MASK 0x7 #define PKT3_NOP 0x10 @@ -1456,4 +1473,397 @@ #define SQ_TEX_INST_SAMPLE 0x10 #define SQ_TEX_INST_SAMPLE_L 0x11 #define SQ_TEX_INST_SAMPLE_C 0x18 + +#define R_008A14_PA_CL_ENHANCE 0x00008A14 +#define R_008C0C_SQ_THREAD_RESOURCE_MGMT 0x00008C0C +#define R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x00008D8C +#define R_028000_DB_RENDER_CONTROL 0x00028000 +#define R_028008_DB_DEPTH_VIEW 0x00028008 +#define R_02800C_DB_RENDER_OVERRIDE 0x0002800C +#define R_028010_DB_RENDER_OVERRIDE2 0x00028010 +#define R_028014_DB_HTILE_DATA_BASE 0x00028014 +#define R_028028_DB_STENCIL_CLEAR 0x00028028 +#define R_02802C_DB_DEPTH_CLEAR 0x0002802C +#define R_028048_DB_Z_READ_BASE 0x00028048 +#define R_02804C_DB_STENCIL_READ_BASE 0x0002804C +#define R_028050_DB_Z_WRITE_BASE 0x00028050 +#define R_028054_DB_STENCIL_WRITE_BASE 0x00028054 +#define R_028140_ALU_CONST_BUFFER_SIZE_PS_0 0x00028140 +#define R_028180_ALU_CONST_BUFFER_SIZE_VS_0 0x00028180 +#define R_028200_PA_SC_WINDOW_OFFSET 0x00028200 +#define R_02820C_PA_SC_CLIPRECT_RULE 0x0002820C +#define R_028210_PA_SC_CLIPRECT_0_TL 0x00028210 +#define R_028214_PA_SC_CLIPRECT_0_BR 0x00028214 +#define R_028218_PA_SC_CLIPRECT_1_TL 0x00028218 +#define R_02821C_PA_SC_CLIPRECT_1_BR 0x0002821C +#define R_028220_PA_SC_CLIPRECT_2_TL 0x00028220 +#define R_028224_PA_SC_CLIPRECT_2_BR 0x00028224 +#define R_028228_PA_SC_CLIPRECT_3_TL 0x00028228 +#define R_02822C_PA_SC_CLIPRECT_3_BR 0x0002822C +#define R_028230_PA_SC_EDGERULE 0x00028230 +#define R_028234_PA_SU_HARDWARE_SCREEN_OFFSET 0x00028234 +#define R_028238_CB_TARGET_MASK 0x00028238 +#define R_02823C_CB_SHADER_MASK 0x0002823C +#define R_028250_PA_SC_VPORT_SCISSOR_0_TL 0x00028250 +#define R_028254_PA_SC_VPORT_SCISSOR_0_BR 0x00028254 +#define R_028350_SX_MISC 0x00028350 +#define R_028380_SQ_VTX_SEMANTIC_0 0x00028380 +#define R_028384_SQ_VTX_SEMANTIC_1 0x00028384 +#define R_028388_SQ_VTX_SEMANTIC_2 0x00028388 +#define R_02838C_SQ_VTX_SEMANTIC_3 0x0002838C +#define R_028390_SQ_VTX_SEMANTIC_4 0x00028390 +#define R_028394_SQ_VTX_SEMANTIC_5 0x00028394 +#define R_028398_SQ_VTX_SEMANTIC_6 0x00028398 +#define R_02839C_SQ_VTX_SEMANTIC_7 0x0002839C +#define R_0283A0_SQ_VTX_SEMANTIC_8 0x000283A0 +#define R_0283A4_SQ_VTX_SEMANTIC_9 0x000283A4 +#define R_0283A8_SQ_VTX_SEMANTIC_10 0x000283A8 +#define R_0283AC_SQ_VTX_SEMANTIC_11 0x000283AC +#define R_0283B0_SQ_VTX_SEMANTIC_12 0x000283B0 +#define R_0283B4_SQ_VTX_SEMANTIC_13 0x000283B4 +#define R_0283B8_SQ_VTX_SEMANTIC_14 0x000283B8 +#define R_0283BC_SQ_VTX_SEMANTIC_15 0x000283BC +#define R_0283C0_SQ_VTX_SEMANTIC_16 0x000283C0 +#define R_0283C4_SQ_VTX_SEMANTIC_17 0x000283C4 +#define R_0283C8_SQ_VTX_SEMANTIC_18 0x000283C8 +#define R_0283CC_SQ_VTX_SEMANTIC_19 0x000283CC +#define R_0283D0_SQ_VTX_SEMANTIC_20 0x000283D0 +#define R_0283D4_SQ_VTX_SEMANTIC_21 0x000283D4 +#define R_0283D8_SQ_VTX_SEMANTIC_22 0x000283D8 +#define R_0283DC_SQ_VTX_SEMANTIC_23 0x000283DC +#define R_0283E0_SQ_VTX_SEMANTIC_24 0x000283E0 +#define R_0283E4_SQ_VTX_SEMANTIC_25 0x000283E4 +#define R_0283E8_SQ_VTX_SEMANTIC_26 0x000283E8 +#define R_0283EC_SQ_VTX_SEMANTIC_27 0x000283EC +#define R_0283F0_SQ_VTX_SEMANTIC_28 0x000283F0 +#define R_0283F4_SQ_VTX_SEMANTIC_29 0x000283F4 +#define R_0283F8_SQ_VTX_SEMANTIC_30 0x000283F8 +#define R_0283FC_SQ_VTX_SEMANTIC_31 0x000283FC +#define R_0282D0_PA_SC_VPORT_ZMIN_0 0x000282D0 +#define R_0282D4_PA_SC_VPORT_ZMAX_0 0x000282D4 +#define R_028400_VGT_MAX_VTX_INDX 0x00028400 +#define R_028404_VGT_MIN_VTX_INDX 0x00028404 +#define R_028408_VGT_INDX_OFFSET 0x00028408 +#define R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX 0x0002840C +#define R_028414_CB_BLEND_RED 0x00028414 +#define R_028418_CB_BLEND_GREEN 0x00028418 +#define R_02841C_CB_BLEND_BLUE 0x0002841C +#define R_028420_CB_BLEND_ALPHA 0x00028420 +#define R_028438_SX_ALPHA_REF 0x00028438 +#define R_02843C_PA_CL_VPORT_XSCALE_0 0x0002843C +#define R_028440_PA_CL_VPORT_XOFFSET_0 0x00028440 +#define R_028444_PA_CL_VPORT_YSCALE_0 0x00028444 +#define R_028448_PA_CL_VPORT_YOFFSET_0 0x00028448 +#define R_02844C_PA_CL_VPORT_ZSCALE_0 0x0002844C +#define R_028450_PA_CL_VPORT_ZOFFSET_0 0x00028450 +#define R_0285BC_PA_CL_UCP0_X 0x000285BC +#define R_0285C0_PA_CL_UCP0_Y 0x000285C0 +#define R_0285C4_PA_CL_UCP0_Z 0x000285C4 +#define R_0285C8_PA_CL_UCP0_W 0x000285C8 +#define R_0285CC_PA_CL_UCP1_X 0x000285CC +#define R_0285D0_PA_CL_UCP1_Y 0x000285D0 +#define R_0285D4_PA_CL_UCP1_Z 0x000285D4 +#define R_0285D8_PA_CL_UCP1_W 0x000285D8 +#define R_0285DC_PA_CL_UCP2_X 0x000285DC +#define R_0285E0_PA_CL_UCP2_Y 0x000285E0 +#define R_0285E4_PA_CL_UCP2_Z 0x000285E4 +#define R_0285E8_PA_CL_UCP2_W 0x000285E8 +#define R_0285EC_PA_CL_UCP3_X 0x000285EC +#define R_0285F0_PA_CL_UCP3_Y 0x000285F0 +#define R_0285F4_PA_CL_UCP3_Z 0x000285F4 +#define R_0285F8_PA_CL_UCP3_W 0x000285F8 +#define R_0285FC_PA_CL_UCP4_X 0x000285FC +#define R_028600_PA_CL_UCP4_Y 0x00028600 +#define R_028604_PA_CL_UCP4_Z 0x00028604 +#define R_028608_PA_CL_UCP4_W 0x00028608 +#define R_02860C_PA_CL_UCP5_X 0x0002860C +#define R_028610_PA_CL_UCP5_Y 0x00028610 +#define R_028614_PA_CL_UCP5_Z 0x00028614 +#define R_028618_PA_CL_UCP5_W 0x00028618 +#define R_02861C_SPI_VS_OUT_ID_0 0x0002861C +#define R_028620_SPI_VS_OUT_ID_1 0x00028620 +#define R_028624_SPI_VS_OUT_ID_2 0x00028624 +#define R_028628_SPI_VS_OUT_ID_3 0x00028628 +#define R_02862C_SPI_VS_OUT_ID_4 0x0002862C +#define R_028630_SPI_VS_OUT_ID_5 0x00028630 +#define R_028634_SPI_VS_OUT_ID_6 0x00028634 +#define R_028638_SPI_VS_OUT_ID_7 0x00028638 +#define R_02863C_SPI_VS_OUT_ID_8 0x0002863C +#define R_028640_SPI_VS_OUT_ID_9 0x00028640 +#define R_028648_SPI_PS_INPUT_CNTL_1 0x00028648 +#define R_02864C_SPI_PS_INPUT_CNTL_2 0x0002864C +#define R_028650_SPI_PS_INPUT_CNTL_3 0x00028650 +#define R_028654_SPI_PS_INPUT_CNTL_4 0x00028654 +#define R_028658_SPI_PS_INPUT_CNTL_5 0x00028658 +#define R_02865C_SPI_PS_INPUT_CNTL_6 0x0002865C +#define R_028660_SPI_PS_INPUT_CNTL_7 0x00028660 +#define R_028664_SPI_PS_INPUT_CNTL_8 0x00028664 +#define R_028668_SPI_PS_INPUT_CNTL_9 0x00028668 +#define R_02866C_SPI_PS_INPUT_CNTL_10 0x0002866C +#define R_028670_SPI_PS_INPUT_CNTL_11 0x00028670 +#define R_028674_SPI_PS_INPUT_CNTL_12 0x00028674 +#define R_028678_SPI_PS_INPUT_CNTL_13 0x00028678 +#define R_02867C_SPI_PS_INPUT_CNTL_14 0x0002867C +#define R_028680_SPI_PS_INPUT_CNTL_15 0x00028680 +#define R_028684_SPI_PS_INPUT_CNTL_16 0x00028684 +#define R_028688_SPI_PS_INPUT_CNTL_17 0x00028688 +#define R_02868C_SPI_PS_INPUT_CNTL_18 0x0002868C +#define R_028690_SPI_PS_INPUT_CNTL_19 0x00028690 +#define R_028694_SPI_PS_INPUT_CNTL_20 0x00028694 +#define R_028698_SPI_PS_INPUT_CNTL_21 0x00028698 +#define R_02869C_SPI_PS_INPUT_CNTL_22 0x0002869C +#define R_0286A0_SPI_PS_INPUT_CNTL_23 0x000286A0 +#define R_0286A4_SPI_PS_INPUT_CNTL_24 0x000286A4 +#define R_0286A8_SPI_PS_INPUT_CNTL_25 0x000286A8 +#define R_0286AC_SPI_PS_INPUT_CNTL_26 0x000286AC +#define R_0286B0_SPI_PS_INPUT_CNTL_27 0x000286B0 +#define R_0286B4_SPI_PS_INPUT_CNTL_28 0x000286B4 +#define R_0286B8_SPI_PS_INPUT_CNTL_29 0x000286B8 +#define R_0286BC_SPI_PS_INPUT_CNTL_30 0x000286BC +#define R_0286C0_SPI_PS_INPUT_CNTL_31 0x000286C0 +#define R_0286C8_SPI_THREAD_GROUPING 0x000286C8 +#define R_0286D8_SPI_INPUT_Z 0x000286D8 +#define R_0286DC_SPI_FOG_CNTL 0x000286DC +#define R_0286E4_SPI_PS_IN_CONTROL_2 0x000286E4 +#define R_0286E8_SPI_COMPUTE_INPUT_CNTL 0x000286E8 +#define R_028780_CB_BLEND0_CONTROL 0x00028780 +#define R_028784_CB_BLEND1_CONTROL 0x00028784 +#define R_028788_CB_BLEND2_CONTROL 0x00028788 +#define R_02878C_CB_BLEND3_CONTROL 0x0002878C +#define R_028790_CB_BLEND4_CONTROL 0x00028790 +#define R_028794_CB_BLEND5_CONTROL 0x00028794 +#define R_028798_CB_BLEND6_CONTROL 0x00028798 +#define R_02879C_CB_BLEND7_CONTROL 0x0002879C +#define R_028818_PA_CL_VTE_CNTL 0x00028818 +#define R_028820_PA_CL_NANINF_CNTL 0x00028820 +#define R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1 0x00028838 +#define R_028840_SQ_PGM_START_PS 0x00028840 +#define R_02884C_SQ_PGM_EXPORTS_PS 0x0002884C +#define S_02884C_EXPORT_COLORS(x) (((x) & 0xF) << 1) +#define G_02884C_EXPORT_COLORS(x) (((x) >> 1) & 0xF) +#define C_02884C_EXPORT_COLORS 0xFFFFFFE1 +#define S_02884C_EXPORT_Z(x) (((x) & 0x1) << 0) +#define G_02884C_EXPORT_Z(x) (((x) >> 0) & 0x1) +#define C_02884C_EXPORT_Z 0xFFFFFFFE +#define R_02885C_SQ_PGM_START_VS 0x0002885C +#define R_0288A4_SQ_PGM_START_FS 0x000288A4 +#define R_0288A8_SQ_PGM_RESOURCES_FS 0x000288A8 +#define R_0288EC_SQ_LDS_ALLOC_PS 0x000288EC +#define R_028900_SQ_ESGS_RING_ITEMSIZE 0x00028900 +#define R_028904_SQ_GSVS_RING_ITEMSIZE 0x00028904 +#define R_028908_SQ_ESTMP_RING_ITEMSIZE 0x00028908 +#define R_02890C_SQ_GSTMP_RING_ITEMSIZE 0x0002890C +#define R_028910_SQ_VSTMP_RING_ITEMSIZE 0x00028910 +#define R_028914_SQ_PSTMP_RING_ITEMSIZE 0x00028914 +#define R_02891C_SQ_GS_VERT_ITEMSIZE 0x0002891C +#define R_028920_SQ_GS_VERT_ITEMSIZE_1 0x00028920 +#define R_028924_SQ_GS_VERT_ITEMSIZE_2 0x00028924 +#define R_028928_SQ_GS_VERT_ITEMSIZE_3 0x00028928 +#define R_028940_ALU_CONST_CACHE_PS_0 0x00028940 +#define R_028980_ALU_CONST_CACHE_VS_0 0x00028980 +#define R_028A04_PA_SU_POINT_MINMAX 0x00028A04 +#define R_028A08_PA_SU_LINE_CNTL 0x00028A08 +#define R_028A10_VGT_OUTPUT_PATH_CNTL 0x00028A10 +#define R_028A14_VGT_HOS_CNTL 0x00028A14 +#define R_028A18_VGT_HOS_MAX_TESS_LEVEL 0x00028A18 +#define R_028A1C_VGT_HOS_MIN_TESS_LEVEL 0x00028A1C +#define R_028A20_VGT_HOS_REUSE_DEPTH 0x00028A20 +#define R_028A24_VGT_GROUP_PRIM_TYPE 0x00028A24 +#define R_028A28_VGT_GROUP_FIRST_DECR 0x00028A28 +#define R_028A2C_VGT_GROUP_DECR 0x00028A2C +#define R_028A30_VGT_GROUP_VECT_0_CNTL 0x00028A30 +#define R_028A34_VGT_GROUP_VECT_1_CNTL 0x00028A34 +#define R_028A38_VGT_GROUP_VECT_0_FMT_CNTL 0x00028A38 +#define R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL 0x00028A3C +#define R_028A48_PA_SC_MODE_CNTL_0 0x00028A48 +#define R_028A4C_PA_SC_MODE_CNTL_1 0x00028A4C +#define R_028AB4_VGT_REUSE_OFF 0x00028AB4 +#define R_028AB8_VGT_VTX_CNT_EN 0x00028AB8 +#define R_028ABC_DB_HTILE_SURFACE 0x00028ABC +#define R_028AC0_DB_SRESULTS_COMPARE_STATE0 0x00028AC0 +#define R_028AC4_DB_SRESULTS_COMPARE_STATE1 0x00028AC4 +#define R_028AC8_DB_PRELOAD_CONTROL 0x00028AC8 +#define R_028B54_VGT_SHADER_STAGES_EN 0x00028B54 +#define R_028B70_DB_ALPHA_TO_MASK 0x00028B70 +#define R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL 0x00028B78 +#define R_028B7C_PA_SU_POLY_OFFSET_CLAMP 0x00028B7C +#define R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE 0x00028B80 +#define R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET 0x00028B84 +#define R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE 0x00028B88 +#define R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET 0x00028B8C +#define R_028B94_VGT_STRMOUT_CONFIG 0x00028B94 +#define R_028B98_VGT_STRMOUT_BUFFER_CONFIG 0x00028B98 +#define R_028C00_PA_SC_LINE_CNTL 0x00028C00 +#define R_028C04_PA_SC_AA_CONFIG 0x00028C04 +#define R_028C08_PA_SU_VTX_CNTL 0x00028C08 +#define R_028C0C_PA_CL_GB_VERT_CLIP_ADJ 0x00028C0C +#define R_028C10_PA_CL_GB_VERT_DISC_ADJ 0x00028C10 +#define R_028C14_PA_CL_GB_HORZ_CLIP_ADJ 0x00028C14 +#define R_028C18_PA_CL_GB_HORZ_DISC_ADJ 0x00028C18 +#define R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX 0x00028C1C +#define R_028C3C_PA_SC_AA_MASK 0x00028C3C +#define R_028C60_CB_COLOR0_BASE 0x00028C60 +#define R_028C6C_CB_COLOR0_VIEW 0x00028C6C +#define R_028C9C_CB_COLOR1_BASE 0x00028C9C +#define R_028CA0_CB_COLOR1_PITCH 0x00028CA0 +#define R_028CA4_CB_COLOR1_SLICE 0x00028CA4 +#define R_028CA8_CB_COLOR1_VIEW 0x00028CA8 +#define R_028CAC_CB_COLOR1_INFO 0x00028CAC +#define R_028CB0_CB_COLOR1_ATTRIB 0x00028CB0 +#define R_028CB8_CB_COLOR1_DIM 0x00028CB8 +#define R_028CD8_CB_COLOR2_BASE 0x00028CD8 +#define R_028CDC_CB_COLOR2_PITCH 0x00028CDC +#define R_028CE0_CB_COLOR2_SLICE 0x00028CE0 +#define R_028CE4_CB_COLOR2_VIEW 0x00028CE4 +#define R_028CE8_CB_COLOR2_INFO 0x00028CE8 +#define R_028CEC_CB_COLOR2_ATTRIB 0x00028CEC +#define R_028CF0_CB_COLOR2_DIM 0x00028CF0 +#define R_028D14_CB_COLOR3_BASE 0x00028D14 +#define R_028D18_CB_COLOR3_PITCH 0x00028D18 +#define R_028D1C_CB_COLOR3_SLICE 0x00028D1C +#define R_028D20_CB_COLOR3_VIEW 0x00028D20 +#define R_028D24_CB_COLOR3_INFO 0x00028D24 +#define R_028D28_CB_COLOR3_ATTRIB 0x00028D28 +#define R_028D2C_CB_COLOR3_DIM 0x00028D2C +#define R_028D50_CB_COLOR4_BASE 0x00028D50 +#define R_028D54_CB_COLOR4_PITCH 0x00028D54 +#define R_028D58_CB_COLOR4_SLICE 0x00028D58 +#define R_028D5C_CB_COLOR4_VIEW 0x00028D5C +#define R_028D60_CB_COLOR4_INFO 0x00028D60 +#define R_028D64_CB_COLOR4_ATTRIB 0x00028D64 +#define R_028D68_CB_COLOR4_DIM 0x00028D68 +#define R_028D8C_CB_COLOR5_BASE 0x00028D8C +#define R_028D90_CB_COLOR5_PITCH 0x00028D90 +#define R_028D94_CB_COLOR5_SLICE 0x00028D94 +#define R_028D98_CB_COLOR5_VIEW 0x00028D98 +#define R_028D9C_CB_COLOR5_INFO 0x00028D9C +#define R_028DA0_CB_COLOR5_ATTRIB 0x00028DA0 +#define R_028DA4_CB_COLOR5_DIM 0x00028DA4 +#define R_028DC8_CB_COLOR6_BASE 0x00028DC8 +#define R_028DCC_CB_COLOR6_PITCH 0x00028DCC +#define R_028DD0_CB_COLOR6_SLICE 0x00028DD0 +#define R_028DD4_CB_COLOR6_VIEW 0x00028DD4 +#define R_028DD8_CB_COLOR6_INFO 0x00028DD8 +#define R_028DDC_CB_COLOR6_ATTRIB 0x00028DDC +#define R_028DE0_CB_COLOR6_DIM 0x00028DE0 +#define R_028E04_CB_COLOR7_BASE 0x00028E04 +#define R_028E08_CB_COLOR7_PITCH 0x00028E08 +#define R_028E0C_CB_COLOR7_SLICE 0x00028E0C +#define R_028E10_CB_COLOR7_VIEW 0x00028E10 +#define R_028E14_CB_COLOR7_INFO 0x00028E14 +#define R_028E18_CB_COLOR7_ATTRIB 0x00028E18 +#define R_028E1C_CB_COLOR7_DIM 0x00028E1C +#define R_028E40_CB_COLOR8_BASE 0x00028E40 +#define R_028E44_CB_COLOR8_PITCH 0x00028E44 +#define R_028E48_CB_COLOR8_SLICE 0x00028E48 +#define R_028E4C_CB_COLOR8_VIEW 0x00028E4C +#define R_028E50_CB_COLOR8_INFO 0x00028E50 +#define R_028E54_CB_COLOR8_ATTRIB 0x00028E54 +#define R_028E58_CB_COLOR8_DIM 0x00028E58 +#define R_028E5C_CB_COLOR9_BASE 0x00028E5C +#define R_028E60_CB_COLOR9_PITCH 0x00028E60 +#define R_028E64_CB_COLOR9_SLICE 0x00028E64 +#define R_028E68_CB_COLOR9_VIEW 0x00028E68 +#define R_028E6C_CB_COLOR9_INFO 0x00028E6C +#define R_028E70_CB_COLOR9_ATTRIB 0x00028E70 +#define R_028E74_CB_COLOR9_DIM 0x00028E74 +#define R_028E78_CB_COLOR10_BASE 0x00028E78 +#define R_028E7C_CB_COLOR10_PITCH 0x00028E7C +#define R_028E80_CB_COLOR10_SLICE 0x00028E80 +#define R_028E84_CB_COLOR10_VIEW 0x00028E84 +#define R_028E88_CB_COLOR10_INFO 0x00028E88 +#define R_028E8C_CB_COLOR10_ATTRIB 0x00028E8C +#define R_028E90_CB_COLOR10_DIM 0x00028E90 +#define R_028E94_CB_COLOR11_BASE 0x00028E94 +#define R_028E98_CB_COLOR11_PITCH 0x00028E98 +#define R_028E9C_CB_COLOR11_SLICE 0x00028E9C +#define R_028EA0_CB_COLOR11_VIEW 0x00028EA0 +#define R_028EA4_CB_COLOR11_INFO 0x00028EA4 +#define R_028EA8_CB_COLOR11_ATTRIB 0x00028EA8 +#define R_028EAC_CB_COLOR11_DIM 0x00028EAC +#define R_030000_RESOURCE0_WORD0 0x00030000 +#define R_030004_RESOURCE0_WORD1 0x00030004 +#define R_030008_RESOURCE0_WORD2 0x00030008 +#define R_03000C_RESOURCE0_WORD3 0x0003000C +#define R_030010_RESOURCE0_WORD4 0x00030010 +#define R_030014_RESOURCE0_WORD5 0x00030014 +#define R_030018_RESOURCE0_WORD6 0x00030018 +#define R_03001C_RESOURCE0_WORD7 0x0003001C +#define R_0085F0_CP_COHER_CNTL 0x0085F0 +#define S_0085F0_DEST_BASE_0_ENA(x) (((x) & 0x1) << 0) +#define G_0085F0_DEST_BASE_0_ENA(x) (((x) >> 0) & 0x1) +#define C_0085F0_DEST_BASE_0_ENA 0xFFFFFFFE +#define S_0085F0_DEST_BASE_1_ENA(x) (((x) & 0x1) << 1) +#define G_0085F0_DEST_BASE_1_ENA(x) (((x) >> 1) & 0x1) +#define C_0085F0_DEST_BASE_1_ENA 0xFFFFFFFD +#define S_0085F0_SO0_DEST_BASE_ENA(x) (((x) & 0x1) << 2) +#define G_0085F0_SO0_DEST_BASE_ENA(x) (((x) >> 2) & 0x1) +#define C_0085F0_SO0_DEST_BASE_ENA 0xFFFFFFFB +#define S_0085F0_SO1_DEST_BASE_ENA(x) (((x) & 0x1) << 3) +#define G_0085F0_SO1_DEST_BASE_ENA(x) (((x) >> 3) & 0x1) +#define C_0085F0_SO1_DEST_BASE_ENA 0xFFFFFFF7 +#define S_0085F0_SO2_DEST_BASE_ENA(x) (((x) & 0x1) << 4) +#define G_0085F0_SO2_DEST_BASE_ENA(x) (((x) >> 4) & 0x1) +#define C_0085F0_SO2_DEST_BASE_ENA 0xFFFFFFEF +#define S_0085F0_SO3_DEST_BASE_ENA(x) (((x) & 0x1) << 5) +#define G_0085F0_SO3_DEST_BASE_ENA(x) (((x) >> 5) & 0x1) +#define C_0085F0_SO3_DEST_BASE_ENA 0xFFFFFFDF +#define S_0085F0_CB0_DEST_BASE_ENA(x) (((x) & 0x1) << 6) +#define G_0085F0_CB0_DEST_BASE_ENA(x) (((x) >> 6) & 0x1) +#define C_0085F0_CB0_DEST_BASE_ENA 0xFFFFFFBF +#define S_0085F0_CB1_DEST_BASE_ENA(x) (((x) & 0x1) << 7) +#define G_0085F0_CB1_DEST_BASE_ENA(x) (((x) >> 7) & 0x1) +#define C_0085F0_CB1_DEST_BASE_ENA 0xFFFFFF7F +#define S_0085F0_CB2_DEST_BASE_ENA(x) (((x) & 0x1) << 8) +#define G_0085F0_CB2_DEST_BASE_ENA(x) (((x) >> 8) & 0x1) +#define C_0085F0_CB2_DEST_BASE_ENA 0xFFFFFEFF +#define S_0085F0_CB3_DEST_BASE_ENA(x) (((x) & 0x1) << 9) +#define G_0085F0_CB3_DEST_BASE_ENA(x) (((x) >> 9) & 0x1) +#define C_0085F0_CB3_DEST_BASE_ENA 0xFFFFFDFF +#define S_0085F0_CB4_DEST_BASE_ENA(x) (((x) & 0x1) << 10) +#define G_0085F0_CB4_DEST_BASE_ENA(x) (((x) >> 10) & 0x1) +#define C_0085F0_CB4_DEST_BASE_ENA 0xFFFFFBFF +#define S_0085F0_CB5_DEST_BASE_ENA(x) (((x) & 0x1) << 11) +#define G_0085F0_CB5_DEST_BASE_ENA(x) (((x) >> 11) & 0x1) +#define C_0085F0_CB5_DEST_BASE_ENA 0xFFFFF7FF +#define S_0085F0_CB6_DEST_BASE_ENA(x) (((x) & 0x1) << 12) +#define G_0085F0_CB6_DEST_BASE_ENA(x) (((x) >> 12) & 0x1) +#define C_0085F0_CB6_DEST_BASE_ENA 0xFFFFEFFF +#define S_0085F0_CB7_DEST_BASE_ENA(x) (((x) & 0x1) << 13) +#define G_0085F0_CB7_DEST_BASE_ENA(x) (((x) >> 13) & 0x1) +#define C_0085F0_CB7_DEST_BASE_ENA 0xFFFFDFFF +#define S_0085F0_DB_DEST_BASE_ENA(x) (((x) & 0x1) << 14) +#define G_0085F0_DB_DEST_BASE_ENA(x) (((x) >> 14) & 0x1) +#define C_0085F0_DB_DEST_BASE_ENA 0xFFFFBFFF +#define S_0085F0_CR_DEST_BASE_ENA(x) (((x) & 0x1) << 15) +#define G_0085F0_CR_DEST_BASE_ENA(x) (((x) >> 15) & 0x1) +#define C_0085F0_CR_DEST_BASE_ENA 0xFFFF7FFF +#define S_0085F0_TC_ACTION_ENA(x) (((x) & 0x1) << 23) +#define G_0085F0_TC_ACTION_ENA(x) (((x) >> 23) & 0x1) +#define C_0085F0_TC_ACTION_ENA 0xFF7FFFFF +#define S_0085F0_VC_ACTION_ENA(x) (((x) & 0x1) << 24) +#define G_0085F0_VC_ACTION_ENA(x) (((x) >> 24) & 0x1) +#define C_0085F0_VC_ACTION_ENA 0xFEFFFFFF +#define S_0085F0_CB_ACTION_ENA(x) (((x) & 0x1) << 25) +#define G_0085F0_CB_ACTION_ENA(x) (((x) >> 25) & 0x1) +#define C_0085F0_CB_ACTION_ENA 0xFDFFFFFF +#define S_0085F0_DB_ACTION_ENA(x) (((x) & 0x1) << 26) +#define G_0085F0_DB_ACTION_ENA(x) (((x) >> 26) & 0x1) +#define C_0085F0_DB_ACTION_ENA 0xFBFFFFFF +#define S_0085F0_SH_ACTION_ENA(x) (((x) & 0x1) << 27) +#define G_0085F0_SH_ACTION_ENA(x) (((x) >> 27) & 0x1) +#define C_0085F0_SH_ACTION_ENA 0xF7FFFFFF +#define S_0085F0_SMX_ACTION_ENA(x) (((x) & 0x1) << 28) +#define G_0085F0_SMX_ACTION_ENA(x) (((x) >> 28) & 0x1) +#define C_0085F0_SMX_ACTION_ENA 0xEFFFFFFF +#define S_0085F0_CR0_ACTION_ENA(x) (((x) & 0x1) << 29) +#define G_0085F0_CR0_ACTION_ENA(x) (((x) >> 29) & 0x1) +#define C_0085F0_CR0_ACTION_ENA 0xDFFFFFFF +#define S_0085F0_CR1_ACTION_ENA(x) (((x) & 0x1) << 30) +#define G_0085F0_CR1_ACTION_ENA(x) (((x) >> 30) & 0x1) +#define C_0085F0_CR1_ACTION_ENA 0xBFFFFFFF +#define S_0085F0_CR2_ACTION_ENA(x) (((x) & 0x1) << 31) +#define G_0085F0_CR2_ACTION_ENA(x) (((x) >> 31) & 0x1) +#define C_0085F0_CR2_ACTION_ENA 0x7FFFFFFF + #endif diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 6d87220db2a..65b029b065f 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -129,6 +129,17 @@ enum r600_group_id { R600_NGROUPS }; +enum evergreen_group_id { + EVERGREEN_GROUP_CONFIG = 0, + EVERGREEN_GROUP_CONTEXT, + EVERGREEN_GROUP_RESOURCE, + EVERGREEN_GROUP_SAMPLER, + EVERGREEN_GROUP_CTL_CONST, + EVERGREEN_GROUP_LOOP_CONST, + EVERGREEN_GROUP_BOOL_CONST, + EVERGREEN_NGROUPS +}; + struct r600_pipe_reg { unsigned group_id; u32 offset; @@ -265,4 +276,9 @@ boolean r600_context_query_result(struct r600_context *ctx, void r600_query_begin(struct r600_context *ctx, struct r600_query *query); void r600_query_end(struct r600_context *ctx, struct r600_query *query); +int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon); +void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw); +void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); +void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); + #endif diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h new file mode 100644 index 00000000000..c64ca404905 --- /dev/null +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -0,0 +1,146 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Jerome Glisse + */ +#ifndef R600_PIPE_H +#define R600_PIPE_H + +enum r600_pipe_state_id { + R600_PIPE_STATE_BLEND = 0, + R600_PIPE_STATE_BLEND_COLOR, + R600_PIPE_STATE_CONFIG, + R600_PIPE_STATE_CLIP, + R600_PIPE_STATE_SCISSOR, + R600_PIPE_STATE_VIEWPORT, + R600_PIPE_STATE_RASTERIZER, + R600_PIPE_STATE_VGT, + R600_PIPE_STATE_FRAMEBUFFER, + R600_PIPE_STATE_DSA, + R600_PIPE_STATE_STENCIL_REF, + R600_PIPE_STATE_PS_SHADER, + R600_PIPE_STATE_VS_SHADER, + R600_PIPE_STATE_CONSTANT, + R600_PIPE_STATE_SAMPLER, + R600_PIPE_STATE_RESOURCE, + R600_PIPE_NSTATES +}; + +struct r600_screen { + struct pipe_screen screen; + struct radeon *radeon; +}; + +struct r600_pipe_sampler_view { + struct pipe_sampler_view base; + struct r600_pipe_state state; +}; + +struct r600_pipe_rasterizer { + struct r600_pipe_state rstate; + bool flatshade; + unsigned sprite_coord_enable; +}; + +struct r600_pipe_blend { + struct r600_pipe_state rstate; + unsigned cb_target_mask; +}; + +struct r600_pipe_shader { + struct r600_shader shader; + struct r600_pipe_state rstate; + struct radeon_ws_bo *bo; +}; + +struct r600_vertex_element +{ + unsigned count; + unsigned refcount; + struct pipe_vertex_element elements[32]; +}; + +struct r600_pipe_context { + struct pipe_context context; + struct r600_screen *screen; + struct radeon *radeon; + struct blitter_context *blitter; + struct r600_pipe_state *states[R600_PIPE_NSTATES]; + struct r600_context ctx; + struct r600_vertex_element *vertex_elements; + struct pipe_framebuffer_state framebuffer; + struct pipe_index_buffer index_buffer; + struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; + unsigned nvertex_buffer; + unsigned cb_target_mask; + /* for saving when using blitter */ + struct pipe_stencil_ref stencil_ref; + struct pipe_viewport_state viewport; + struct pipe_clip_state clip; + unsigned vs_nconst; + unsigned ps_nconst; + struct r600_pipe_state vs_const[256]; + struct r600_pipe_state ps_const[256]; + struct r600_pipe_state vs_resource[160]; + struct r600_pipe_state ps_resource[160]; + struct r600_pipe_state config; + struct r600_pipe_shader *ps_shader; + struct r600_pipe_shader *vs_shader; + struct r600_pipe_state vs_const_buffer; + struct r600_pipe_state ps_const_buffer; + /* shader information */ + unsigned sprite_coord_enable; + bool flatshade; +}; + +struct r600_drawl { + struct pipe_context *ctx; + unsigned mode; + unsigned start; + unsigned count; + unsigned index_size; + struct pipe_resource *index_buffer; +}; + +uint32_t r600_translate_texformat(enum pipe_format format, + const unsigned char *swizzle_view, + uint32_t *word4_p, uint32_t *yuv_format_p); + +/* r600_state2.c */ +int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader); +int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); + +/* evergreen_state.c */ +void evergreen_init_state_functions2(struct r600_pipe_context *rctx); +void evergreen_init_config2(struct r600_pipe_context *rctx); +void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info); +void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader); +void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader); + +static INLINE u32 S_FIXED(float value, u32 frac_bits) +{ + return value * (1 << frac_bits); +} +#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) + +#endif diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 5182b26fcfa..6ce82648c15 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -48,108 +48,12 @@ struct radeon_state { }; #include "r600_resource.h" #include "r600_shader.h" - - -uint32_t r600_translate_texformat(enum pipe_format format, - const unsigned char *swizzle_view, - uint32_t *word4_p, uint32_t *yuv_format_p); - +#include "r600_pipe.h" #include "r600_state_inlines.h" -enum r600_pipe_state_id { - R600_PIPE_STATE_BLEND = 0, - R600_PIPE_STATE_BLEND_COLOR, - R600_PIPE_STATE_CONFIG, - R600_PIPE_STATE_CLIP, - R600_PIPE_STATE_SCISSOR, - R600_PIPE_STATE_VIEWPORT, - R600_PIPE_STATE_RASTERIZER, - R600_PIPE_STATE_VGT, - R600_PIPE_STATE_FRAMEBUFFER, - R600_PIPE_STATE_DSA, - R600_PIPE_STATE_STENCIL_REF, - R600_PIPE_STATE_PS_SHADER, - R600_PIPE_STATE_VS_SHADER, - R600_PIPE_STATE_CONSTANT, - R600_PIPE_STATE_SAMPLER, - R600_PIPE_STATE_RESOURCE, - R600_PIPE_NSTATES -}; - -struct r600_screen { - struct pipe_screen screen; - struct radeon *radeon; -}; - -struct r600_pipe_sampler_view { - struct pipe_sampler_view base; - struct r600_pipe_state state; -}; - -struct r600_pipe_rasterizer { - struct r600_pipe_state rstate; - bool flatshade; - unsigned sprite_coord_enable; -}; - -struct r600_pipe_blend { - struct r600_pipe_state rstate; - unsigned cb_target_mask; -}; - -struct r600_pipe_shader { - struct r600_shader shader; - struct r600_pipe_state rstate; - struct radeon_ws_bo *bo; -}; - -struct r600_vertex_element -{ - unsigned count; - unsigned refcount; - struct pipe_vertex_element elements[32]; -}; - -struct r600_pipe_context { - struct pipe_context context; - struct r600_screen *screen; - struct radeon *radeon; - struct blitter_context *blitter; - struct r600_pipe_state *states[R600_PIPE_NSTATES]; - struct r600_context ctx; - struct r600_vertex_element *vertex_elements; - struct pipe_framebuffer_state framebuffer; - struct pipe_index_buffer index_buffer; - struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - unsigned nvertex_buffer; - unsigned cb_target_mask; - /* for saving when using blitter */ - struct pipe_stencil_ref stencil_ref; - struct pipe_viewport_state viewport; - struct pipe_clip_state clip; - unsigned vs_nconst; - unsigned ps_nconst; - struct r600_pipe_state vs_const[256]; - struct r600_pipe_state ps_const[256]; - struct r600_pipe_state vs_resource[160]; - struct r600_pipe_state ps_resource[160]; - struct r600_pipe_state config; - struct r600_pipe_shader *ps_shader; - struct r600_pipe_shader *vs_shader; - /* shader information */ - unsigned sprite_coord_enable; - bool flatshade; -}; - -static INLINE u32 S_FIXED(float value, u32 frac_bits) -{ - return value * (1 << frac_bits); -} - /* r600_shader.c */ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_state *rstate = &shader->rstate; struct r600_shader *rshader = &shader->shader; unsigned spi_vs_out_id[10]; @@ -287,10 +191,18 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s rshader->flat_shade = rctx->flatshade; switch (rshader->processor_type) { case TGSI_PROCESSOR_VERTEX: - r600_pipe_shader_vs(ctx, shader); + if (rshader->family >= CHIP_CEDAR) { + evergreen_pipe_shader_vs(ctx, shader); + } else { + r600_pipe_shader_vs(ctx, shader); + } break; case TGSI_PROCESSOR_FRAGMENT: - r600_pipe_shader_ps(ctx, shader); + if (rshader->family >= CHIP_CEDAR) { + evergreen_pipe_shader_ps(ctx, shader); + } else { + r600_pipe_shader_ps(ctx, shader); + } break; default: return -EINVAL; @@ -339,7 +251,7 @@ static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader return r600_bc_build(&shader->bc); } -static int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader) +int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; int r; @@ -359,7 +271,7 @@ static int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_s } int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader); -static int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens) +int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; int r; @@ -535,15 +447,6 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) FREE(rscreen); } -struct r600_drawl { - struct pipe_context *ctx; - unsigned mode; - unsigned start; - unsigned count; - unsigned index_size; - struct pipe_resource *index_buffer; -}; - int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); static void r600_draw_common(struct r600_drawl *draw) { @@ -2137,7 +2040,6 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi rctx->context.screen = screen; rctx->context.priv = priv; rctx->context.destroy = r600_destroy_context; - rctx->context.draw_vbo = r600_draw_vbo2; rctx->context.flush = r600_flush2; /* Easy accessing of screen/winsys. */ @@ -2146,7 +2048,6 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi r600_init_blit_functions2(rctx); r600_init_query_functions2(rctx); - r600_init_state_functions2(rctx); r600_init_context_resource_functions2(rctx); rctx->blitter = util_blitter_create(&rctx->context); @@ -2155,13 +2056,46 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi return NULL; } - if (r600_context_init(&rctx->ctx, rctx->radeon)) { + switch (r600_get_family(rctx->radeon)) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + rctx->context.draw_vbo = r600_draw_vbo2; + r600_init_state_functions2(rctx); + if (r600_context_init(&rctx->ctx, rctx->radeon)) { + r600_destroy_context(&rctx->context); + return NULL; + } + r600_init_config2(rctx); + break; + case CHIP_CEDAR: + case CHIP_REDWOOD: + case CHIP_JUNIPER: + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + rctx->context.draw_vbo = evergreen_draw; + evergreen_init_state_functions2(rctx); + if (evergreen_context_init(&rctx->ctx, rctx->radeon)) { + r600_destroy_context(&rctx->context); + return NULL; + } + evergreen_init_config2(rctx); + break; + default: + R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon)); r600_destroy_context(&rctx->context); return NULL; } - r600_init_config2(rctx); - return &rctx->context; } diff --git a/src/gallium/winsys/r600/drm/Makefile b/src/gallium/winsys/r600/drm/Makefile index 9d8dc8dc594..8a84ceec698 100644 --- a/src/gallium/winsys/r600/drm/Makefile +++ b/src/gallium/winsys/r600/drm/Makefile @@ -8,6 +8,7 @@ C_SOURCES = \ bof.c \ r600_state.c \ r600_state2.c \ + evergreen_state.c \ r600.c \ radeon_ctx.c \ radeon_draw.c \ diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c new file mode 100644 index 00000000000..d3831942113 --- /dev/null +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -0,0 +1,685 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Jerome Glisse + */ +#include +#include +#include +#include +#include +#include "xf86drm.h" +#include "r600.h" +#include "evergreend.h" +#include "r600_priv.h" +#include "radeon_drm.h" +#include "bof.h" +#include "pipe/p_compiler.h" +#include "util/u_inlines.h" +#include + +struct radeon_bo { + struct pipe_reference reference; + unsigned handle; + unsigned size; + unsigned alignment; + unsigned map_count; + void *data; +}; +struct radeon_ws_bo { + struct pipe_reference reference; + struct pb_buffer *pb; +}; +struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); + +struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset); +void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group, unsigned opcode); +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); +int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset); + +#define GROUP_FORCE_NEW_BLOCK 0 +static const struct r600_reg evergreen_reg_list[] = { + {0, 0, R_008958_VGT_PRIMITIVE_TYPE}, + {0, 0, R_008A14_PA_CL_ENHANCE}, + {0, 0, R_008C00_SQ_CONFIG}, + {0, 0, R_008C04_SQ_GPR_RESOURCE_MGMT_1}, + {0, 0, R_008C08_SQ_GPR_RESOURCE_MGMT_2}, + {0, 0, R_008C0C_SQ_THREAD_RESOURCE_MGMT}, + {0, 0, R_008C18_SQ_THREAD_RESOURCE_MGMT_1}, + {0, 0, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2}, + {0, 0, R_008C20_SQ_STACK_RESOURCE_MGMT_1}, + {0, 0, R_008C24_SQ_STACK_RESOURCE_MGMT_2}, + {0, 0, R_008C28_SQ_STACK_RESOURCE_MGMT_3}, + {0, 0, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ}, + {0, 0, R_009100_SPI_CONFIG_CNTL}, + {0, 0, R_00913C_SPI_CONFIG_CNTL_1}, + {0, 0, R_028000_DB_RENDER_CONTROL}, + {0, 0, R_028008_DB_DEPTH_VIEW}, + {0, 0, R_02800C_DB_RENDER_OVERRIDE}, + {0, 0, R_028010_DB_RENDER_OVERRIDE2}, + {1, 0, R_028014_DB_HTILE_DATA_BASE}, + {0, 0, R_028028_DB_STENCIL_CLEAR}, + {0, 0, R_02802C_DB_DEPTH_CLEAR}, + {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL}, + {0, 0, R_028034_PA_SC_SCREEN_SCISSOR_BR}, + {1, 0, R_028040_DB_Z_INFO}, + {0, 0, R_028044_DB_STENCIL_INFO}, + {1, 0, R_028048_DB_Z_READ_BASE}, + {1, 0, R_02804C_DB_STENCIL_READ_BASE}, + {1, 0, R_028050_DB_Z_WRITE_BASE}, + {1, 0, R_028054_DB_STENCIL_WRITE_BASE}, + {0, 0, R_028058_DB_DEPTH_SIZE}, + {0, 0, R_02805C_DB_DEPTH_SLICE}, + {0, 0, R_028140_ALU_CONST_BUFFER_SIZE_PS_0}, + {0, 0, R_028180_ALU_CONST_BUFFER_SIZE_VS_0}, + {0, 0, R_028200_PA_SC_WINDOW_OFFSET}, + {0, 0, R_028204_PA_SC_WINDOW_SCISSOR_TL}, + {0, 0, R_028208_PA_SC_WINDOW_SCISSOR_BR}, + {0, 0, R_02820C_PA_SC_CLIPRECT_RULE}, + {0, 0, R_028210_PA_SC_CLIPRECT_0_TL}, + {0, 0, R_028214_PA_SC_CLIPRECT_0_BR}, + {0, 0, R_028218_PA_SC_CLIPRECT_1_TL}, + {0, 0, R_02821C_PA_SC_CLIPRECT_1_BR}, + {0, 0, R_028220_PA_SC_CLIPRECT_2_TL}, + {0, 0, R_028224_PA_SC_CLIPRECT_2_BR}, + {0, 0, R_028228_PA_SC_CLIPRECT_3_TL}, + {0, 0, R_02822C_PA_SC_CLIPRECT_3_BR}, + {0, 0, R_028230_PA_SC_EDGERULE}, + {0, 0, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET}, + {0, 0, R_028238_CB_TARGET_MASK}, + {0, 0, R_02823C_CB_SHADER_MASK}, + {0, 0, R_028240_PA_SC_GENERIC_SCISSOR_TL}, + {0, 0, R_028244_PA_SC_GENERIC_SCISSOR_BR}, + {0, 0, R_028250_PA_SC_VPORT_SCISSOR_0_TL}, + {0, 0, R_028254_PA_SC_VPORT_SCISSOR_0_BR}, + {0, 0, R_028350_SX_MISC}, + {0, 0, R_028380_SQ_VTX_SEMANTIC_0}, + {0, 0, R_028384_SQ_VTX_SEMANTIC_1}, + {0, 0, R_028388_SQ_VTX_SEMANTIC_2}, + {0, 0, R_02838C_SQ_VTX_SEMANTIC_3}, + {0, 0, R_028390_SQ_VTX_SEMANTIC_4}, + {0, 0, R_028394_SQ_VTX_SEMANTIC_5}, + {0, 0, R_028398_SQ_VTX_SEMANTIC_6}, + {0, 0, R_02839C_SQ_VTX_SEMANTIC_7}, + {0, 0, R_0283A0_SQ_VTX_SEMANTIC_8}, + {0, 0, R_0283A4_SQ_VTX_SEMANTIC_9}, + {0, 0, R_0283A8_SQ_VTX_SEMANTIC_10}, + {0, 0, R_0283AC_SQ_VTX_SEMANTIC_11}, + {0, 0, R_0283B0_SQ_VTX_SEMANTIC_12}, + {0, 0, R_0283B4_SQ_VTX_SEMANTIC_13}, + {0, 0, R_0283B8_SQ_VTX_SEMANTIC_14}, + {0, 0, R_0283BC_SQ_VTX_SEMANTIC_15}, + {0, 0, R_0283C0_SQ_VTX_SEMANTIC_16}, + {0, 0, R_0283C4_SQ_VTX_SEMANTIC_17}, + {0, 0, R_0283C8_SQ_VTX_SEMANTIC_18}, + {0, 0, R_0283CC_SQ_VTX_SEMANTIC_19}, + {0, 0, R_0283D0_SQ_VTX_SEMANTIC_20}, + {0, 0, R_0283D4_SQ_VTX_SEMANTIC_21}, + {0, 0, R_0283D8_SQ_VTX_SEMANTIC_22}, + {0, 0, R_0283DC_SQ_VTX_SEMANTIC_23}, + {0, 0, R_0283E0_SQ_VTX_SEMANTIC_24}, + {0, 0, R_0283E4_SQ_VTX_SEMANTIC_25}, + {0, 0, R_0283E8_SQ_VTX_SEMANTIC_26}, + {0, 0, R_0283EC_SQ_VTX_SEMANTIC_27}, + {0, 0, R_0283F0_SQ_VTX_SEMANTIC_28}, + {0, 0, R_0283F4_SQ_VTX_SEMANTIC_29}, + {0, 0, R_0283F8_SQ_VTX_SEMANTIC_30}, + {0, 0, R_0283FC_SQ_VTX_SEMANTIC_31}, + {0, 0, R_0282D0_PA_SC_VPORT_ZMIN_0}, + {0, 0, R_0282D4_PA_SC_VPORT_ZMAX_0}, + {0, 0, R_028400_VGT_MAX_VTX_INDX}, + {0, 0, R_028404_VGT_MIN_VTX_INDX}, + {0, 0, R_028408_VGT_INDX_OFFSET}, + {0, 0, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX}, + {0, 0, R_028410_SX_ALPHA_TEST_CONTROL}, + {0, 0, R_028414_CB_BLEND_RED}, + {0, 0, R_028418_CB_BLEND_GREEN}, + {0, 0, R_02841C_CB_BLEND_BLUE}, + {0, 0, R_028420_CB_BLEND_ALPHA}, + {0, 0, R_028430_DB_STENCILREFMASK}, + {0, 0, R_028434_DB_STENCILREFMASK_BF}, + {0, 0, R_028438_SX_ALPHA_REF}, + {0, 0, R_02843C_PA_CL_VPORT_XSCALE_0}, + {0, 0, R_028440_PA_CL_VPORT_XOFFSET_0}, + {0, 0, R_028444_PA_CL_VPORT_YSCALE_0}, + {0, 0, R_028448_PA_CL_VPORT_YOFFSET_0}, + {0, 0, R_02844C_PA_CL_VPORT_ZSCALE_0}, + {0, 0, R_028450_PA_CL_VPORT_ZOFFSET_0}, + {0, 0, R_0285BC_PA_CL_UCP0_X}, + {0, 0, R_0285C0_PA_CL_UCP0_Y}, + {0, 0, R_0285C4_PA_CL_UCP0_Z}, + {0, 0, R_0285C8_PA_CL_UCP0_W}, + {0, 0, R_0285CC_PA_CL_UCP1_X}, + {0, 0, R_0285D0_PA_CL_UCP1_Y}, + {0, 0, R_0285D4_PA_CL_UCP1_Z}, + {0, 0, R_0285D8_PA_CL_UCP1_W}, + {0, 0, R_0285DC_PA_CL_UCP2_X}, + {0, 0, R_0285E0_PA_CL_UCP2_Y}, + {0, 0, R_0285E4_PA_CL_UCP2_Z}, + {0, 0, R_0285E8_PA_CL_UCP2_W}, + {0, 0, R_0285EC_PA_CL_UCP3_X}, + {0, 0, R_0285F0_PA_CL_UCP3_Y}, + {0, 0, R_0285F4_PA_CL_UCP3_Z}, + {0, 0, R_0285F8_PA_CL_UCP3_W}, + {0, 0, R_0285FC_PA_CL_UCP4_X}, + {0, 0, R_028600_PA_CL_UCP4_Y}, + {0, 0, R_028604_PA_CL_UCP4_Z}, + {0, 0, R_028608_PA_CL_UCP4_W}, + {0, 0, R_02860C_PA_CL_UCP5_X}, + {0, 0, R_028610_PA_CL_UCP5_Y}, + {0, 0, R_028614_PA_CL_UCP5_Z}, + {0, 0, R_028618_PA_CL_UCP5_W}, + {0, 0, R_02861C_SPI_VS_OUT_ID_0}, + {0, 0, R_028620_SPI_VS_OUT_ID_1}, + {0, 0, R_028624_SPI_VS_OUT_ID_2}, + {0, 0, R_028628_SPI_VS_OUT_ID_3}, + {0, 0, R_02862C_SPI_VS_OUT_ID_4}, + {0, 0, R_028630_SPI_VS_OUT_ID_5}, + {0, 0, R_028634_SPI_VS_OUT_ID_6}, + {0, 0, R_028638_SPI_VS_OUT_ID_7}, + {0, 0, R_02863C_SPI_VS_OUT_ID_8}, + {0, 0, R_028640_SPI_VS_OUT_ID_9}, + {0, 0, R_028644_SPI_PS_INPUT_CNTL_0}, + {0, 0, R_028648_SPI_PS_INPUT_CNTL_1}, + {0, 0, R_02864C_SPI_PS_INPUT_CNTL_2}, + {0, 0, R_028650_SPI_PS_INPUT_CNTL_3}, + {0, 0, R_028654_SPI_PS_INPUT_CNTL_4}, + {0, 0, R_028658_SPI_PS_INPUT_CNTL_5}, + {0, 0, R_02865C_SPI_PS_INPUT_CNTL_6}, + {0, 0, R_028660_SPI_PS_INPUT_CNTL_7}, + {0, 0, R_028664_SPI_PS_INPUT_CNTL_8}, + {0, 0, R_028668_SPI_PS_INPUT_CNTL_9}, + {0, 0, R_02866C_SPI_PS_INPUT_CNTL_10}, + {0, 0, R_028670_SPI_PS_INPUT_CNTL_11}, + {0, 0, R_028674_SPI_PS_INPUT_CNTL_12}, + {0, 0, R_028678_SPI_PS_INPUT_CNTL_13}, + {0, 0, R_02867C_SPI_PS_INPUT_CNTL_14}, + {0, 0, R_028680_SPI_PS_INPUT_CNTL_15}, + {0, 0, R_028684_SPI_PS_INPUT_CNTL_16}, + {0, 0, R_028688_SPI_PS_INPUT_CNTL_17}, + {0, 0, R_02868C_SPI_PS_INPUT_CNTL_18}, + {0, 0, R_028690_SPI_PS_INPUT_CNTL_19}, + {0, 0, R_028694_SPI_PS_INPUT_CNTL_20}, + {0, 0, R_028698_SPI_PS_INPUT_CNTL_21}, + {0, 0, R_02869C_SPI_PS_INPUT_CNTL_22}, + {0, 0, R_0286A0_SPI_PS_INPUT_CNTL_23}, + {0, 0, R_0286A4_SPI_PS_INPUT_CNTL_24}, + {0, 0, R_0286A8_SPI_PS_INPUT_CNTL_25}, + {0, 0, R_0286AC_SPI_PS_INPUT_CNTL_26}, + {0, 0, R_0286B0_SPI_PS_INPUT_CNTL_27}, + {0, 0, R_0286B4_SPI_PS_INPUT_CNTL_28}, + {0, 0, R_0286B8_SPI_PS_INPUT_CNTL_29}, + {0, 0, R_0286BC_SPI_PS_INPUT_CNTL_30}, + {0, 0, R_0286C0_SPI_PS_INPUT_CNTL_31}, + {0, 0, R_0286C4_SPI_VS_OUT_CONFIG}, + {0, 0, R_0286C8_SPI_THREAD_GROUPING}, + {0, 0, R_0286CC_SPI_PS_IN_CONTROL_0}, + {0, 0, R_0286D0_SPI_PS_IN_CONTROL_1}, + {0, 0, R_0286D4_SPI_INTERP_CONTROL_0}, + {0, 0, R_0286D8_SPI_INPUT_Z}, + {0, 0, R_0286DC_SPI_FOG_CNTL}, + {0, 0, R_0286E0_SPI_BARYC_CNTL}, + {0, 0, R_0286E4_SPI_PS_IN_CONTROL_2}, + {0, 0, R_0286E8_SPI_COMPUTE_INPUT_CNTL}, + {0, 0, R_028780_CB_BLEND0_CONTROL}, + {0, 0, R_028784_CB_BLEND1_CONTROL}, + {0, 0, R_028788_CB_BLEND2_CONTROL}, + {0, 0, R_02878C_CB_BLEND3_CONTROL}, + {0, 0, R_028790_CB_BLEND4_CONTROL}, + {0, 0, R_028794_CB_BLEND5_CONTROL}, + {0, 0, R_028798_CB_BLEND6_CONTROL}, + {0, 0, R_02879C_CB_BLEND7_CONTROL}, + {0, 0, R_028800_DB_DEPTH_CONTROL}, + {0, 0, R_02880C_DB_SHADER_CONTROL}, + {0, 0, R_028808_CB_COLOR_CONTROL}, + {0, 0, R_028810_PA_CL_CLIP_CNTL}, + {0, 0, R_028814_PA_SU_SC_MODE_CNTL}, + {0, 0, R_028818_PA_CL_VTE_CNTL}, + {0, 0, R_02881C_PA_CL_VS_OUT_CNTL}, + {0, 0, R_028820_PA_CL_NANINF_CNTL}, + {0, 0, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1}, + {1, 0, R_028840_SQ_PGM_START_PS}, + {0, 0, R_028844_SQ_PGM_RESOURCES_PS}, + {0, 0, R_028848_SQ_PGM_RESOURCES_2_PS}, + {0, 0, R_02884C_SQ_PGM_EXPORTS_PS}, + {1, 0, R_02885C_SQ_PGM_START_VS}, + {0, 0, R_028860_SQ_PGM_RESOURCES_VS}, + {0, 0, R_028864_SQ_PGM_RESOURCES_2_VS}, + {1, 0, R_0288A4_SQ_PGM_START_FS}, + {0, 0, R_0288A8_SQ_PGM_RESOURCES_FS}, + {0, 0, R_0288EC_SQ_LDS_ALLOC_PS}, + {0, 0, R_028900_SQ_ESGS_RING_ITEMSIZE}, + {0, 0, R_028904_SQ_GSVS_RING_ITEMSIZE}, + {0, 0, R_028908_SQ_ESTMP_RING_ITEMSIZE}, + {0, 0, R_02890C_SQ_GSTMP_RING_ITEMSIZE}, + {0, 0, R_028910_SQ_VSTMP_RING_ITEMSIZE}, + {0, 0, R_028914_SQ_PSTMP_RING_ITEMSIZE}, + {0, 0, R_02891C_SQ_GS_VERT_ITEMSIZE}, + {0, 0, R_028920_SQ_GS_VERT_ITEMSIZE_1}, + {0, 0, R_028924_SQ_GS_VERT_ITEMSIZE_2}, + {0, 0, R_028928_SQ_GS_VERT_ITEMSIZE_3}, + {1, 0, R_028940_ALU_CONST_CACHE_PS_0}, + {1, 0, R_028980_ALU_CONST_CACHE_VS_0}, + {0, 0, R_028A00_PA_SU_POINT_SIZE}, + {0, 0, R_028A04_PA_SU_POINT_MINMAX}, + {0, 0, R_028A08_PA_SU_LINE_CNTL}, + {0, 0, R_028A10_VGT_OUTPUT_PATH_CNTL}, + {0, 0, R_028A14_VGT_HOS_CNTL}, + {0, 0, R_028A18_VGT_HOS_MAX_TESS_LEVEL}, + {0, 0, R_028A1C_VGT_HOS_MIN_TESS_LEVEL}, + {0, 0, R_028A20_VGT_HOS_REUSE_DEPTH}, + {0, 0, R_028A24_VGT_GROUP_PRIM_TYPE}, + {0, 0, R_028A28_VGT_GROUP_FIRST_DECR}, + {0, 0, R_028A2C_VGT_GROUP_DECR}, + {0, 0, R_028A30_VGT_GROUP_VECT_0_CNTL}, + {0, 0, R_028A34_VGT_GROUP_VECT_1_CNTL}, + {0, 0, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL}, + {0, 0, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL}, + {0, 0, R_028A40_VGT_GS_MODE}, + {0, 0, R_028A48_PA_SC_MODE_CNTL_0}, + {0, 0, R_028A4C_PA_SC_MODE_CNTL_1}, + {0, 0, R_028AB4_VGT_REUSE_OFF}, + {0, 0, R_028AB8_VGT_VTX_CNT_EN}, + {0, 0, R_028ABC_DB_HTILE_SURFACE}, + {0, 0, R_028AC0_DB_SRESULTS_COMPARE_STATE0}, + {0, 0, R_028AC4_DB_SRESULTS_COMPARE_STATE1}, + {0, 0, R_028AC8_DB_PRELOAD_CONTROL}, + {0, 0, R_028B54_VGT_SHADER_STAGES_EN}, + {0, 0, R_028B70_DB_ALPHA_TO_MASK}, + {0, 0, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL}, + {0, 0, R_028B7C_PA_SU_POLY_OFFSET_CLAMP}, + {0, 0, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE}, + {0, 0, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET}, + {0, 0, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE}, + {0, 0, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET}, + {0, 0, R_028B94_VGT_STRMOUT_CONFIG}, + {0, 0, R_028B98_VGT_STRMOUT_BUFFER_CONFIG}, + {0, 0, R_028C00_PA_SC_LINE_CNTL}, + {0, 0, R_028C04_PA_SC_AA_CONFIG}, + {0, 0, R_028C08_PA_SU_VTX_CNTL}, + {0, 0, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ}, + {0, 0, R_028C10_PA_CL_GB_VERT_DISC_ADJ}, + {0, 0, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ}, + {0, 0, R_028C18_PA_CL_GB_HORZ_DISC_ADJ}, + {0, 0, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX}, + {0, 0, R_028C3C_PA_SC_AA_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028C60_CB_COLOR0_BASE}, + {0, 0, R_028C64_CB_COLOR0_PITCH}, + {0, 0, R_028C68_CB_COLOR0_SLICE}, + {0, 0, R_028C6C_CB_COLOR0_VIEW}, + {1, 0, R_028C70_CB_COLOR0_INFO}, + {0, 0, R_028C74_CB_COLOR0_ATTRIB}, + {0, 0, R_028C78_CB_COLOR0_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028C9C_CB_COLOR1_BASE}, + {0, 0, R_028CA0_CB_COLOR1_PITCH}, + {0, 0, R_028CA4_CB_COLOR1_SLICE}, + {0, 0, R_028CA8_CB_COLOR1_VIEW}, + {1, 0, R_028CAC_CB_COLOR1_INFO}, + {0, 0, R_028CB0_CB_COLOR1_ATTRIB}, + {0, 0, R_028CB8_CB_COLOR1_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028CD8_CB_COLOR2_BASE}, + {0, 0, R_028CDC_CB_COLOR2_PITCH}, + {0, 0, R_028CE0_CB_COLOR2_SLICE}, + {0, 0, R_028CE4_CB_COLOR2_VIEW}, + {1, 0, R_028CE8_CB_COLOR2_INFO}, + {0, 0, R_028CEC_CB_COLOR2_ATTRIB}, + {0, 0, R_028CF0_CB_COLOR2_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028D14_CB_COLOR3_BASE}, + {0, 0, R_028D18_CB_COLOR3_PITCH}, + {0, 0, R_028D1C_CB_COLOR3_SLICE}, + {0, 0, R_028D20_CB_COLOR3_VIEW}, + {1, 0, R_028D24_CB_COLOR3_INFO}, + {0, 0, R_028D28_CB_COLOR3_ATTRIB}, + {0, 0, R_028D2C_CB_COLOR3_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028D50_CB_COLOR4_BASE}, + {0, 0, R_028D54_CB_COLOR4_PITCH}, + {0, 0, R_028D58_CB_COLOR4_SLICE}, + {0, 0, R_028D5C_CB_COLOR4_VIEW}, + {1, 0, R_028D60_CB_COLOR4_INFO}, + {0, 0, R_028D64_CB_COLOR4_ATTRIB}, + {0, 0, R_028D68_CB_COLOR4_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028D8C_CB_COLOR5_BASE}, + {0, 0, R_028D90_CB_COLOR5_PITCH}, + {0, 0, R_028D94_CB_COLOR5_SLICE}, + {0, 0, R_028D98_CB_COLOR5_VIEW}, + {1, 0, R_028D9C_CB_COLOR5_INFO}, + {0, 0, R_028DA0_CB_COLOR5_ATTRIB}, + {0, 0, R_028DA4_CB_COLOR5_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028DC8_CB_COLOR6_BASE}, + {0, 0, R_028DCC_CB_COLOR6_PITCH}, + {0, 0, R_028DD0_CB_COLOR6_SLICE}, + {0, 0, R_028DD4_CB_COLOR6_VIEW}, + {1, 0, R_028DD8_CB_COLOR6_INFO}, + {0, 0, R_028DDC_CB_COLOR6_ATTRIB}, + {0, 0, R_028DE0_CB_COLOR6_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028E04_CB_COLOR7_BASE}, + {0, 0, R_028E08_CB_COLOR7_PITCH}, + {0, 0, R_028E0C_CB_COLOR7_SLICE}, + {0, 0, R_028E10_CB_COLOR7_VIEW}, + {1, 0, R_028E14_CB_COLOR7_INFO}, + {0, 0, R_028E18_CB_COLOR7_ATTRIB}, + {0, 0, R_028E1C_CB_COLOR7_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028E40_CB_COLOR8_BASE}, + {0, 0, R_028E44_CB_COLOR8_PITCH}, + {0, 0, R_028E48_CB_COLOR8_SLICE}, + {0, 0, R_028E4C_CB_COLOR8_VIEW}, + {1, 0, R_028E50_CB_COLOR8_INFO}, + {0, 0, R_028E54_CB_COLOR8_ATTRIB}, + {0, 0, R_028E58_CB_COLOR8_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028E5C_CB_COLOR9_BASE}, + {0, 0, R_028E60_CB_COLOR9_PITCH}, + {0, 0, R_028E64_CB_COLOR9_SLICE}, + {0, 0, R_028E68_CB_COLOR9_VIEW}, + {1, 0, R_028E6C_CB_COLOR9_INFO}, + {0, 0, R_028E70_CB_COLOR9_ATTRIB}, + {0, 0, R_028E74_CB_COLOR9_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028E78_CB_COLOR10_BASE}, + {0, 0, R_028E7C_CB_COLOR10_PITCH}, + {0, 0, R_028E80_CB_COLOR10_SLICE}, + {0, 0, R_028E84_CB_COLOR10_VIEW}, + {1, 0, R_028E88_CB_COLOR10_INFO}, + {0, 0, R_028E8C_CB_COLOR10_ATTRIB}, + {0, 0, R_028E90_CB_COLOR10_DIM}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028E94_CB_COLOR11_BASE}, + {0, 0, R_028E98_CB_COLOR11_PITCH}, + {0, 0, R_028E9C_CB_COLOR11_SLICE}, + {0, 0, R_028EA0_CB_COLOR11_VIEW}, + {1, 0, R_028EA4_CB_COLOR11_INFO}, + {0, 0, R_028EA8_CB_COLOR11_ATTRIB}, + {0, 0, R_028EAC_CB_COLOR11_DIM}, +}; + +/* SHADER RESOURCE R600/R700 */ +static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_resource[] = { + {0, 0, R_030000_RESOURCE0_WORD0}, + {0, 0, R_030004_RESOURCE0_WORD1}, + {1, 0, R_030008_RESOURCE0_WORD2}, + {1, 0, R_03000C_RESOURCE0_WORD3}, + {0, 0, R_030010_RESOURCE0_WORD4}, + {0, 0, R_030014_RESOURCE0_WORD5}, + {0, 0, R_030018_RESOURCE0_WORD6}, + {0, 0, R_03001C_RESOURCE0_WORD7}, + }; + unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_resource[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_resource, nreg); +} + +/* SHADER SAMPLER R600/R700 */ +static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_sampler[] = { + {0, 0, R_03C000_SQ_TEX_SAMPLER_WORD0_0}, + {0, 0, R_03C004_SQ_TEX_SAMPLER_WORD1_0}, + {0, 0, R_03C008_SQ_TEX_SAMPLER_WORD2_0}, + }; + unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_sampler[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_sampler, nreg); +} + +int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) +{ + int r; + + memset(ctx, 0, sizeof(struct r600_context)); + ctx->radeon = radeon; + LIST_INITHEAD(&ctx->query_list); + /* initialize groups */ + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_CONFIG], EVERGREEN_CONFIG_REG_OFFSET, EVERGREEN_CONFIG_REG_END); + if (r) { + goto out_err; + } + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_LOOP_CONST], EVERGREEN_LOOP_CONST_OFFSET, EVERGREEN_LOOP_CONST_END); + if (r) { + goto out_err; + } + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_BOOL_CONST], EVERGREEN_BOOL_CONST_OFFSET, EVERGREEN_BOOL_CONST_END); + if (r) { + goto out_err; + } + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_SAMPLER], EVERGREEN_SAMPLER_OFFSET, EVERGREEN_SAMPLER_END); + if (r) { + goto out_err; + } + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_RESOURCE], EVERGREEN_RESOURCE_OFFSET, EVERGREEN_RESOURCE_END); + if (r) { + goto out_err; + } + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_CONTEXT], EVERGREEN_CONTEXT_REG_OFFSET, EVERGREEN_CONTEXT_REG_END); + if (r) { + goto out_err; + } + ctx->ngroups = EVERGREEN_NGROUPS; + + /* add blocks */ + r = r600_context_add_block(ctx, evergreen_reg_list, sizeof(evergreen_reg_list)/sizeof(struct r600_reg)); + if (r) + goto out_err; + + /* PS SAMPLER */ + for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) { + r = r600_state_sampler_init(ctx, offset); + if (r) + goto out_err; + } + /* VS SAMPLER */ + for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) { + r = r600_state_sampler_init(ctx, offset); + if (r) + goto out_err; + } + /* PS RESOURCE */ + for (int j = 0, offset = 0; j < 176; j++, offset += 0x1C) { + r = evergreen_state_resource_init(ctx, offset); + if (r) + goto out_err; + } + /* VS RESOURCE */ + for (int j = 0, offset = 0x1600; j < 176; j++, offset += 0x1C) { + r = evergreen_state_resource_init(ctx, offset); + if (r) + goto out_err; + } + + /* allocate cs variables */ + ctx->nreloc = RADEON_CTX_MAX_PM4; + ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); + if (ctx->reloc == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx->bo = calloc(ctx->nreloc, sizeof(void *)); + if (ctx->bo == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; + ctx->pm4 = calloc(ctx->pm4_ndwords, 4); + if (ctx->pm4 == NULL) { + r = -ENOMEM; + goto out_err; + } + return 0; +out_err: + r600_context_fini(ctx); + return r; +} + +void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw) +{ + struct radeon_bo *cb[12]; + unsigned ndwords = 9; + + if (draw->indices) { + ndwords = 13; + /* make sure there is enough relocation space before scheduling draw */ + if (ctx->creloc >= (ctx->nreloc - 1)) { + r600_context_flush(ctx); + } + } + + /* find number of color buffer */ + cb[0] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028C60_CB_COLOR0_BASE); + cb[1] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028C9C_CB_COLOR1_BASE); + cb[2] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028CD8_CB_COLOR2_BASE); + cb[3] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D14_CB_COLOR3_BASE); + cb[4] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D50_CB_COLOR4_BASE); + cb[5] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D8C_CB_COLOR5_BASE); + cb[6] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028DC8_CB_COLOR6_BASE); + cb[7] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E04_CB_COLOR7_BASE); + cb[8] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E40_CB_COLOR8_BASE); + cb[9] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E5C_CB_COLOR9_BASE); + cb[10] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E78_CB_COLOR10_BASE); + cb[11] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E94_CB_COLOR11_BASE); + for (int i = 0; i < 12; i++) { + if (cb[i]) { + ndwords += 7; + } + } + + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { + /* need to flush */ + r600_context_flush(ctx); + } + /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */ + if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) { + R600_ERR("context is too big to be scheduled\n"); + return; + } + + /* enough room to copy packet */ + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONFIG], PKT3_SET_CONFIG_REG); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONTEXT], PKT3_SET_CONTEXT_REG); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_RESOURCE], PKT3_SET_RESOURCE); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER], PKT3_SET_SAMPLER); + + /* draw packet */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; + if (draw->indices) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); + ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); + } else { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; + } + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + + /* flush color buffer */ + for (int i = 0; i < 8; i++) { + if (cb[i]) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + S_0085F0_CB_ACTION_ENA(1); + ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); + } + } + + /* all dirty state have been scheduled in current cs */ + ctx->pm4_dirty_cdwords = 0; +} + +static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_group_block *block; + unsigned id; + + offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; + id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; + block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; + block->pm4[0] = state->regs[0].value; + block->pm4[1] = state->regs[1].value; + block->pm4[2] = state->regs[2].value; + block->pm4[3] = state->regs[3].value; + block->pm4[4] = state->regs[4].value; + block->pm4[5] = state->regs[5].value; + block->pm4[6] = state->regs[6].value; + block->pm4[7] = state->regs[7].value; + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + if (state->regs[0].bo) { + /* VERTEX RESOURCE, we preted there is 2 bo to relocate so + * we have single case btw VERTEX & TEXTURE resource + */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + } else { + /* TEXTURE RESOURCE */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; +} + +void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid; + + evergreen_resource_set(ctx, state, offset); +} + +void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid; + + evergreen_resource_set(ctx, state, offset); +} diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index cde4ec37f9a..16950bd72d0 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -38,6 +38,7 @@ #include "util/u_inlines.h" #include +#define GROUP_FORCE_NEW_BLOCK 0 struct radeon_ws_bo { struct pipe_reference reference; struct pb_buffer *pb; @@ -93,7 +94,7 @@ static int r600_group_id_register_offset(unsigned offset) return -1; } -static int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) { struct r600_group_block *block, *tmp; struct r600_group *group; @@ -101,13 +102,22 @@ static int r600_context_add_block(struct r600_context *ctx, const struct r600_re for (unsigned i = 0, n = 0; i < nreg; i += n) { u32 j, r; - /* find number of consecutive registers */ - for (j = i + 1, r = reg[i].offset + 4, n = 1; j < (nreg - i); j++, n++, r+=4) { - if (r != reg[j].offset) { - break; + + /* register that need relocation are in their own group */ + n = 1; + if (!reg[i].need_bo) { + /* find number of consecutive registers */ + for (j = i + 1, r = reg[i].offset + 4, n = 1; j < (nreg - i); j++, n++, r+=4) { + if (reg[i].need_bo || r != reg[j].offset) { + break; + } } } + /* ignore new block balise */ + if (reg[i].offset == GROUP_FORCE_NEW_BLOCK) + continue; + /* find into which group this block is */ group_id = r600_group_id_register_offset(reg[i].offset); assert(group_id >= 0); @@ -158,7 +168,7 @@ static int r600_context_add_block(struct r600_context *ctx, const struct r600_re return 0; } -static int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset) +int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset) { group->start_offset = start_offset; group->end_offset = end_offset; @@ -702,7 +712,7 @@ out_err: return r; } -static void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo) +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo) { int i, reloc_id; @@ -770,8 +780,8 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx block->pm4[4] = state->regs[4].value; block->pm4[5] = state->regs[5].value; block->pm4[6] = state->regs[6].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, block->reloc[1].bo); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, block->reloc[2].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { /* VERTEX RESOURCE, we preted there is 2 bo to relocate so * we have single case btw VERTEX & TEXTURE resource @@ -859,7 +869,7 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 } } -static inline void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group, unsigned opcode) +void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group, unsigned opcode) { struct radeon_bo *bo; int id; @@ -887,7 +897,7 @@ static inline void r600_context_group_emit_dirty(struct r600_context *ctx, struc } } -static struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset) +struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset) { struct r600_group_block *block; unsigned id; -- cgit v1.2.3 From c0c0c4b96b0174f1750c1e78bb12de65ec577bbf Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 07:45:45 +1000 Subject: r300g: fix point sprite coord. handled elsewhere now. thanks to Droste on irc for pointing out the fix --- src/gallium/drivers/r300/r300_state.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 8ccb63964e7..d6cded927a1 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -950,10 +950,8 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->rs = *state; rs->rs_draw = *state; - /* Generate point sprite texture coordinates in GENERIC0 - * if point_quad_rasterization is TRUE. */ rs->rs.sprite_coord_enable = state->point_quad_rasterization * - (state->sprite_coord_enable | 1); + state->sprite_coord_enable; /* Override some states for Draw. */ rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */ -- cgit v1.2.3 From d26211e499afb06359d903419315070f022c8efe Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 14:57:25 -0700 Subject: intel: Remove disabled stencil drawpixels acceleration. We still retain the fallback override for GL_STENCIL_INDEX, because the metaops version fails at oglconform. --- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 210 -------------------------- 1 file changed, 210 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index a40b232fff8..b5576a9c917 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -49,203 +49,6 @@ #include "intel_pixel.h" #include "intel_fbo.h" - -/** XXX compare perf of this vs. _mesa_meta_DrawPixels(STENCIL) */ -static GLboolean -intel_stencil_drawpixels(GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, - GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) -{ - struct intel_context *intel = intel_context(ctx); - GLuint texname, rb_name, fb_name, old_fb_name; - GLfloat vertices[4][2]; - struct intel_renderbuffer *irb; - struct intel_renderbuffer *depth_irb; - struct gl_pixelstore_attrib old_unpack; - GLstencil *stencil_pixels; - int row, y1, y2; - GLint old_active_texture; - GLboolean rendering_to_fbo = ctx->DrawBuffer->Name != 0; - - if (format != GL_STENCIL_INDEX) - return GL_FALSE; - - /* If there's nothing to write, we're done. */ - if (ctx->Stencil.WriteMask[0] == 0) - return GL_TRUE; - - /* Can't do a per-bit writemask while treating stencil as rgba data. */ - if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "stencil mask enabled\n"); - return GL_FALSE; - } - - /* We don't support stencil testing/ops here */ - if (ctx->Stencil._Enabled) - return GL_FALSE; - - /* We use FBOs for our wrapping of the depthbuffer into a color - * destination. - */ - if (!ctx->Extensions.EXT_framebuffer_object) - return GL_FALSE; - - /* We're going to mess with texturing with no regard to existing texture - * state, so if there is some set up we have to bail. - */ - if (ctx->Texture._EnabledUnits != 0) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "texturing enabled\n"); - return GL_FALSE; - } - - /* Can't do textured DrawPixels with a fragment program, unless we were - * to generate a new program that sampled our texture and put the results - * in the fragment color before the user's program started. - */ - if (ctx->FragmentProgram.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "fragment program enabled\n"); - return GL_FALSE; - } - - /* Check that we can load in a texture this big. */ - if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) || - height > (1 << (ctx->Const.MaxTextureLevels - 1))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "bitmap too large (%dx%d)\n", - width, height); - return GL_FALSE; - } - - if (!ctx->Extensions.ARB_texture_non_power_of_two && - (!is_power_of_two(width) || !is_power_of_two(height))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, - "glDrawPixels(GL_STENCIL_INDEX) fallback: NPOT texture\n"); - return GL_FALSE; - } - - _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | - GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - old_fb_name = ctx->DrawBuffer->Name; - old_active_texture = ctx->Texture.CurrentUnit; - - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_Disable(GL_DEPTH_TEST); - _mesa_Disable(GL_STENCIL_TEST); - - /* Unpack the supplied stencil values into a ubyte buffer. */ - assert(sizeof(GLstencil) == sizeof(GLubyte)); - stencil_pixels = malloc(width * height * sizeof(GLstencil)); - for (row = 0; row < height; row++) { - GLvoid *source = _mesa_image_address2d(unpack, pixels, - width, height, - GL_COLOR_INDEX, type, - row, 0); - _mesa_unpack_stencil_span(ctx, width, GL_UNSIGNED_BYTE, - stencil_pixels + - row * width * sizeof(GLstencil), - type, source, unpack, ctx->_ImageTransferState); - } - - /* Take the current depth/stencil renderbuffer, and make a new one wrapping - * it which will be treated as GL_RGBA8 so we can render to it as a color - * buffer. - */ - depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH); - irb = intel_create_renderbuffer(MESA_FORMAT_ARGB8888); - irb->Base.Width = depth_irb->Base.Width; - irb->Base.Height = depth_irb->Base.Height; - intel_renderbuffer_set_region(intel, irb, depth_irb->region); - - /* Create a name for our renderbuffer, which lets us use other mesa - * rb functions for convenience. - */ - _mesa_GenRenderbuffersEXT(1, &rb_name); - irb->Base.RefCount++; - _mesa_HashInsert(ctx->Shared->RenderBuffers, rb_name, &irb->Base); - - /* Bind the new renderbuffer to the color attachment point. */ - _mesa_GenFramebuffersEXT(1, &fb_name); - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name); - _mesa_FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - GL_RENDERBUFFER_EXT, - rb_name); - /* Choose to render to the color attachment. */ - _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - - _mesa_DepthMask(GL_FALSE); - _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); - _mesa_Enable(GL_TEXTURE_2D); - _mesa_GenTextures(1, &texname); - _mesa_BindTexture(GL_TEXTURE_2D, texname); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - old_unpack = ctx->Unpack; - ctx->Unpack = ctx->DefaultPacking; - _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0, - GL_RED, GL_UNSIGNED_BYTE, stencil_pixels); - ctx->Unpack = old_unpack; - free(stencil_pixels); - - meta_set_passthrough_transform(&intel->meta); - - /* Since we're rendering to the framebuffer as if it was an FBO, - * if it's the window system we have to flip the coordinates. - */ - if (rendering_to_fbo) { - y1 = y; - y2 = y + height * ctx->Pixel.ZoomY; - } else { - y1 = irb->Base.Height - (y + height * ctx->Pixel.ZoomY); - y2 = irb->Base.Height - y; - } - vertices[0][0] = x; - vertices[0][1] = y1; - vertices[1][0] = x + width * ctx->Pixel.ZoomX; - vertices[1][1] = y1; - vertices[2][0] = x + width * ctx->Pixel.ZoomX; - vertices[2][1] = y2; - vertices[3][0] = x; - vertices[3][1] = y2; - - _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_VERTEX_ARRAY); - meta_set_default_texrect(&intel->meta); - - _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - - meta_restore_texcoords(&intel->meta); - meta_restore_transform(&intel->meta); - - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fb_name); - - _mesa_PopClientAttrib(); - _mesa_PopAttrib(); - - _mesa_DeleteTextures(1, &texname); - _mesa_DeleteFramebuffersEXT(1, &fb_name); - _mesa_DeleteRenderbuffersEXT(1, &rb_name); - - return GL_TRUE; -} - void intelDrawPixels(GLcontext * ctx, GLint x, GLint y, @@ -255,24 +58,11 @@ intelDrawPixels(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid * pixels) { -#if 0 - /* XXX this function doesn't seem to work reliably even when all - * the pre-requisite conditions are met. - * Note that this function is never hit with conform. - * Fall back to swrast because even the _mesa_meta_DrawPixels() approach - * isn't working because of an apparent stencil bug. - */ - if (intel_stencil_drawpixels(ctx, x, y, width, height, format, type, - unpack, pixels)) - return; -#else - (void) intel_stencil_drawpixels; /* silence warning */ if (format == GL_STENCIL_INDEX) { _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); return; } -#endif _mesa_meta_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); -- cgit v1.2.3 From 92762842a0724831a92aa9f76eb52a19cc179649 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sun, 19 Sep 2010 22:44:19 -0700 Subject: r300g: Always try to build libr300compiler.a Make libr300compiler.a a PHONY target so that this library will always be built. This fixes the problem of libr300compiler.a not being updated when r300g is being built and r300c is not. This is a candidate for the Mesa 7.9 branch. --- src/gallium/drivers/r300/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index 728bc40a5bb..66d900ebb5f 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -39,5 +39,6 @@ EXTRA_OBJECTS = \ include ../../Makefile.template +.PHONY: $(COMPILER_ARCHIVE) $(COMPILER_ARCHIVE): $(MAKE) -C $(TOP)/src/mesa/drivers/dri/r300/compiler -- cgit v1.2.3 From 2337f364b193c6379ecd5744743b26a5e75e73ae Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 15:47:53 -0700 Subject: intel: Remove unnecessary minimum pitch alignment to 32 bytes. This broke with the cleanup I did in convolution removal. It's unnecessary anyway since region_alloc_tiled adjusts pitches for us (64 byte alignment) --- src/mesa/drivers/dri/intel/intel_tex_image.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index f8cb50797e1..4732efd7d79 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -333,12 +333,6 @@ intelTexImage(GLcontext * ctx, } else { texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - - /* Minimum pitch of 32 bytes */ - if (width * texelBytes < 32) { - width = 32 / texelBytes; - texImage->RowStride = width; - } if (!intelImage->mt) { assert(texImage->RowStride == width); -- cgit v1.2.3 From fae18559461e62af623be77787ecba4c7013a8b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 15:12:21 -0700 Subject: intel: Replace my intel_texture_bitmap code with _mesa_meta_Bitmap. The meta code is more general than mine, and appears to pass the same sets of tests (piglit + some oglconform). --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 181 +----------------------- 1 file changed, 1 insertion(+), 180 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 02c0ffce31d..3ea1d48d7ca 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -309,178 +309,6 @@ out: return GL_TRUE; } -static GLboolean -intel_texture_bitmap(GLcontext * ctx, - GLint dst_x, GLint dst_y, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) -{ - struct intel_context *intel = intel_context(ctx); - static const char *fp = - "!!ARBfp1.0\n" - "TEMP val;\n" - "PARAM color=program.local[0];\n" - "TEX val, fragment.texcoord[0], texture[0], 2D;\n" - "ADD val, val.wwww, {-.5, -.5, -.5, -.5};\n" - "KIL val;\n" - "MOV result.color, color;\n" - "END\n"; - GLuint texname; - GLfloat vertices[4][4]; - GLint old_active_texture; - GLubyte *a8_bitmap; - GLfloat dst_z; - - /* We need a fragment program for the KIL effect */ - if (!ctx->Extensions.ARB_fragment_program || - !ctx->Extensions.ARB_vertex_program) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, - "glBitmap fallback: No fragment/vertex program support\n"); - return GL_FALSE; - } - - /* We're going to mess with texturing with no regard to existing texture - * state, so if there is some set up we have to bail. - */ - if (ctx->Texture._EnabledUnits != 0) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: texturing enabled\n"); - return GL_FALSE; - } - - /* Can't do textured DrawPixels with a fragment program, unless we were - * to generate a new program that sampled our texture and put the results - * in the fragment color before the user's program started. - */ - if (ctx->FragmentProgram.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: fragment program enabled\n"); - return GL_FALSE; - } - - if (ctx->VertexProgram.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: vertex program enabled\n"); - return GL_FALSE; - } - - if (!ctx->Extensions.ARB_texture_non_power_of_two && - (!is_power_of_two(width) || !is_power_of_two(height))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, - "glBitmap() fallback: NPOT texture\n"); - return GL_FALSE; - } - - if (ctx->Fog.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap() fallback: fog\n"); - return GL_FALSE; - } - - /* Check that we can load in a texture this big. */ - if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) || - height > (1 << (ctx->Const.MaxTextureLevels - 1))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: bitmap too large (%dx%d)\n", - width, height); - return GL_FALSE; - } - - if (_mesa_is_bufferobj(unpack->BufferObj)) { - bitmap = map_pbo(ctx, width, height, unpack, bitmap); - if (bitmap == NULL) - return GL_TRUE; /* even though this is an error, we're done */ - } - - /* Convert the A1 bitmap to an A8 format suitable for glTexImage */ - a8_bitmap = calloc(1, width * height); - _mesa_expand_bitmap(width, height, unpack, bitmap, a8_bitmap, width, 0xff); - - if (_mesa_is_bufferobj(unpack->BufferObj)) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } - - /* Save GL state before we start setting up our drawing */ - _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_POLYGON_BIT | - GL_TEXTURE_BIT | GL_VIEWPORT_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT | - GL_CLIENT_PIXEL_STORE_BIT); - old_active_texture = ctx->Texture.CurrentUnit; - - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - /* Upload our bitmap data to an alpha texture */ - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); - _mesa_Enable(GL_TEXTURE_2D); - _mesa_GenTextures(1, &texname); - _mesa_BindTexture(GL_TEXTURE_2D, texname); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - _mesa_PixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - _mesa_PixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - _mesa_PixelStorei(GL_UNPACK_ROW_LENGTH, 0); - _mesa_PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - _mesa_PixelStorei(GL_UNPACK_SKIP_ROWS, 0); - _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1); - _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, - GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap); - free(a8_bitmap); - - meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp); - _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, - ctx->Current.RasterColor); - meta_set_passthrough_vertex_program(&intel->meta); - meta_set_passthrough_transform(&intel->meta); - - /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */ - dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2]; - - /* RasterPos[2] already takes into account the DepthRange mapping. */ - _mesa_DepthRange(0.0, 1.0); - - vertices[0][0] = dst_x; - vertices[0][1] = dst_y; - vertices[0][2] = dst_z; - vertices[0][3] = 1.0; - vertices[1][0] = dst_x + width; - vertices[1][1] = dst_y; - vertices[1][2] = dst_z; - vertices[1][3] = 1.0; - vertices[2][0] = dst_x + width; - vertices[2][1] = dst_y + height; - vertices[2][2] = dst_z; - vertices[2][3] = 1.0; - vertices[3][0] = dst_x; - vertices[3][1] = dst_y + height; - vertices[3][2] = dst_z; - vertices[3][3] = 1.0; - - _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_VERTEX_ARRAY); - meta_set_default_texrect(&intel->meta); - _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - - meta_restore_texcoords(&intel->meta); - meta_restore_transform(&intel->meta); - meta_restore_fragment_program(&intel->meta); - meta_restore_vertex_program(&intel->meta); - - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); - _mesa_PopClientAttrib(); - _mesa_PopAttrib(); - - _mesa_DeleteTextures(1, &texname); - - return GL_TRUE; -} - /* There are a large number of possible ways to implement bitmap on * this hardware, most of them have some sort of drawback. Here are a * few that spring to mind: @@ -512,12 +340,5 @@ intelBitmap(GLcontext * ctx, unpack, pixels)) return; - if (intel_texture_bitmap(ctx, x, y, width, height, - unpack, pixels)) - return; - - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s: fallback to swrast\n", __FUNCTION__); - - _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); + _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); } -- cgit v1.2.3 From 1c0646a826cb19d3c3eaa84591930590db6e8af8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 16:13:50 -0700 Subject: radeon: Remove copied minimum pitch alignment code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is already covered by radeon_mipmap_tree.c, and my convolution cleanups broke in the presence of this code. Thanks to Marek Olšák for tracking down the relevant miptree code for me. --- src/mesa/drivers/dri/radeon/radeon_texture.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index bf30e0cab8b..d1ebd83550d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -792,18 +792,6 @@ static void radeon_teximage( t->validated = GL_FALSE; - if (!_mesa_is_format_compressed(texImage->TexFormat)) { - GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - /* Minimum pitch of 32 bytes */ - if (width * texelBytes < 32) { - width = 32 / texelBytes; - texImage->RowStride = width; - } - if (!image->mt) { - assert(texImage->RowStride == width); - } - } - /* Mesa core only clears texImage->Data but not image->mt */ radeonFreeTexImageData(ctx, texImage); -- cgit v1.2.3 From f9e6f401e1c3b0a9caeb09f4c14eaea48dd91d06 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 16:19:18 -0700 Subject: unichrome: Mostly revert my convolution removal changes. For this driver, the minimum pitch alignment stuff does appear to be necessary, so leave the separate munged width/height variable in place. --- src/mesa/drivers/dri/unichrome/via_tex.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 01cb3ebbc88..9ae9466c97b 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -663,6 +663,8 @@ static void viaTexImage(GLcontext *ctx, struct gl_texture_image *texImage) { struct via_context *vmesa = VIA_CONTEXT(ctx); + GLint postConvWidth = width; + GLint postConvHeight = height; GLint texelBytes, sizeInBytes; struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; @@ -682,13 +684,13 @@ static void viaTexImage(GLcontext *ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (width * texelBytes < 32) { - width = 32 / texelBytes; - texImage->RowStride = width; + if (postConvWidth * texelBytes < 32) { + postConvWidth = 32 / texelBytes; + texImage->RowStride = postConvWidth; } - assert(texImage->RowStride == width); - viaImage->pitchLog2 = logbase2(width * texelBytes); + assert(texImage->RowStride == postConvWidth); + viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) @@ -697,7 +699,7 @@ static void viaTexImage(GLcontext *ctx, texImage->Height, texImage->Depth); else - sizeInBytes = width * height * texelBytes; + sizeInBytes = postConvWidth * postConvHeight * texelBytes; /* Attempt to allocate texture memory directly, otherwise use main @@ -778,7 +780,7 @@ static void viaTexImage(GLcontext *ctx, dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); } else { - dstRowStride = width * _mesa_get_format_bytes(texImage->TexFormat); + dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, -- cgit v1.2.3 From 64ff468d6ff7645e4c0247a5135d71f380690873 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 16:30:58 -0700 Subject: intel: Remove dead intelIsTextureResident(). It always returned 1 (GL_TRUE), which is the same thing that happens when the driver hook isn't present. --- src/mesa/drivers/dri/intel/intel_tex.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 8bb6ae99fb1..4537f589111 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -9,23 +9,6 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE -static GLboolean -intelIsTextureResident(GLcontext * ctx, struct gl_texture_object *texObj) -{ -#if 0 - struct intel_context *intel = intel_context(ctx); - struct intel_texture_object *intelObj = intel_texture_object(texObj); - - return - intelObj->mt && - intelObj->mt->region && - intel_is_region_resident(intel, intelObj->mt->region); -#endif - return 1; -} - - - static struct gl_texture_image * intelNewTextureImage(GLcontext * ctx) { @@ -217,7 +200,6 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->DeleteTexture = intelDeleteTextureObject; functions->FreeTexImageData = intelFreeTextureImageData; functions->UpdateTexturePalette = 0; - functions->IsTextureResident = intelIsTextureResident; #if DO_DEBUG && !defined(__ia64__) if (INTEL_DEBUG & DEBUG_BUFMGR) -- cgit v1.2.3 From f46523e0bcdfe447b4a9a35fe1561490fa32c3f0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 16:34:10 -0700 Subject: i915: Remove a dead if (0) block. --- src/mesa/drivers/dri/i915/i915_context.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 450e66e0d33..bf6762d6666 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -108,9 +108,6 @@ i915CreateContext(int api, if (!i915) return GL_FALSE; - if (0) - printf("\ntexmem-0-3 branch\n\n"); - i915InitVtbl(i915); i915InitDriverFunctions(&functions); -- cgit v1.2.3 From 68afbe89c72d085dcbbf2b264f0201ab73fe339e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 23 Sep 2010 20:39:27 +0200 Subject: util: make calling remove_from_list multiple times in a row safe This commit fixes an infinite loop in foreach_s if remove_from_list is used more than once on the same item with other list operations in between. NOTE: This is a candidate for the 7.9 branch because the commit "r300g: fixup long-lived BO maps being incorrectly unmapped when flushing" depends on it. --- src/gallium/auxiliary/util/u_simple_list.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_simple_list.h b/src/gallium/auxiliary/util/u_simple_list.h index f5f43b0faa2..fe59771371b 100644 --- a/src/gallium/auxiliary/util/u_simple_list.h +++ b/src/gallium/auxiliary/util/u_simple_list.h @@ -46,6 +46,8 @@ do { \ (elem)->next->prev = (elem)->prev; \ (elem)->prev->next = (elem)->next; \ + (elem)->next = elem; \ + (elem)->prev = elem; \ } while (0) /** -- cgit v1.2.3 From 206d92912cfd1ac73233d9c027fa590b60270cb8 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 23 Sep 2010 13:59:42 +0200 Subject: r300g: fixup long-lived BO maps being incorrectly unmapped when flushing Based on commit 3ddc714b20ac4e28b80c6f88d1993445fff2262c by Dave Airlie. NOTE: This is a candidate for the 7.9 branch. --- src/gallium/winsys/radeon/drm/radeon_drm_buffer.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c index cf665241c48..075ab5cb324 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c @@ -118,8 +118,10 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf, return NULL; } - if (buf->bo->ptr != NULL) + if (buf->bo->ptr != NULL) { + remove_from_list(buf); return buf->bo->ptr; + } if (flags & PB_USAGE_DONTBLOCK) { uint32_t domain; @@ -142,14 +144,18 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf, if (radeon_bo_map(buf->bo, write)) { return NULL; } - insert_at_tail(&buf->mgr->buffer_map_list, buf); + + remove_from_list(buf); return buf->bo->ptr; } static void radeon_drm_buffer_unmap_internal(struct pb_buffer *_buf) { - (void)_buf; + struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf); + if (is_empty_list(buf)) { /* = is not inserted... */ + insert_at_tail(&buf->mgr->buffer_map_list, buf); + } } static void @@ -163,7 +169,7 @@ radeon_drm_buffer_get_base_buffer(struct pb_buffer *buf, static enum pipe_error -radeon_drm_buffer_validate(struct pb_buffer *_buf, +radeon_drm_buffer_validate(struct pb_buffer *_buf, struct pb_validate *vl, unsigned flags) { -- cgit v1.2.3 From a333485386c66672fc34813c77c1400516c56ee5 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 23 Sep 2010 14:24:52 +0200 Subject: r300g: make accessing map_list and buffer_handles thread-safe NOTE: This is a candidate for the 7.9 branch. --- src/gallium/winsys/radeon/drm/radeon_drm_buffer.c | 64 ++++++++++++++++++++--- 1 file changed, 58 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c index 075ab5cb324..78723948d41 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c @@ -11,8 +11,10 @@ #include "util/u_simple_list.h" #include "pipebuffer/pb_buffer.h" #include "pipebuffer/pb_bufmgr.h" +#include "os/os_thread.h" #include "radeon_winsys.h" + struct radeon_drm_bufmgr; struct radeon_drm_buffer { @@ -39,10 +41,19 @@ radeon_drm_buffer(struct pb_buffer *buf) } struct radeon_drm_bufmgr { + /* Base class. */ struct pb_manager base; + + /* Winsys. */ struct radeon_libdrm_winsys *rws; + + /* List of mapped buffers and its mutex. */ struct radeon_drm_buffer buffer_map_list; + pipe_mutex buffer_map_list_mutex; + + /* List of buffer handles and its mutex. */ struct util_hash_table *buffer_handles; + pipe_mutex buffer_handles_mutex; }; static INLINE struct radeon_drm_bufmgr * @@ -59,14 +70,21 @@ radeon_drm_buffer_destroy(struct pb_buffer *_buf) int name; if (buf->bo->ptr != NULL) { - remove_from_list(buf); - radeon_bo_unmap(buf->bo); - buf->bo->ptr = NULL; + pipe_mutex_lock(buf->mgr->buffer_map_list_mutex); + /* Now test it again inside the mutex. */ + if (buf->bo->ptr != NULL) { + remove_from_list(buf); + radeon_bo_unmap(buf->bo); + buf->bo->ptr = NULL; + } + pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex); } name = radeon_gem_name_bo(buf->bo); if (name) { + pipe_mutex_lock(buf->mgr->buffer_handles_mutex); util_hash_table_remove(buf->mgr->buffer_handles, (void*)(uintptr_t)name); + pipe_mutex_unlock(buf->mgr->buffer_handles_mutex); } radeon_bo_unref(buf->bo); @@ -119,7 +137,13 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf, } if (buf->bo->ptr != NULL) { - remove_from_list(buf); + pipe_mutex_lock(buf->mgr->buffer_map_list_mutex); + /* Now test ptr again inside the mutex. We might have gotten a race + * during the first test. */ + if (buf->bo->ptr != NULL) { + remove_from_list(buf); + } + pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex); return buf->bo->ptr; } @@ -145,7 +169,9 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf, return NULL; } + pipe_mutex_lock(buf->mgr->buffer_map_list_mutex); remove_from_list(buf); + pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex); return buf->bo->ptr; } @@ -153,9 +179,11 @@ static void radeon_drm_buffer_unmap_internal(struct pb_buffer *_buf) { struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf); + pipe_mutex_lock(buf->mgr->buffer_map_list_mutex); if (is_empty_list(buf)) { /* = is not inserted... */ insert_at_tail(&buf->mgr->buffer_map_list, buf); } + pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex); } static void @@ -192,8 +220,9 @@ const struct pb_vtbl radeon_drm_buffer_vtbl = { radeon_drm_buffer_get_base_buffer, }; -struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr, - uint32_t handle) +static struct pb_buffer * +radeon_drm_bufmgr_create_buffer_from_handle_unsafe(struct pb_manager *_mgr, + uint32_t handle) { struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr); struct radeon_libdrm_winsys *rws = mgr->rws; @@ -201,6 +230,7 @@ struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager struct radeon_bo *bo; buf = util_hash_table_get(mgr->buffer_handles, (void*)(uintptr_t)handle); + if (buf) { struct pb_buffer *b = NULL; pb_reference(&b, &buf->base); @@ -234,6 +264,20 @@ struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager return &buf->base; } +struct pb_buffer * +radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr, + uint32_t handle) +{ + struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr); + struct pb_buffer *pb; + + pipe_mutex_lock(mgr->buffer_handles_mutex); + pb = radeon_drm_bufmgr_create_buffer_from_handle_unsafe(_mgr, handle); + pipe_mutex_unlock(mgr->buffer_handles_mutex); + + return pb; +} + static struct pb_buffer * radeon_drm_bufmgr_create_buffer(struct pb_manager *_mgr, pb_size size, @@ -285,6 +329,8 @@ radeon_drm_bufmgr_destroy(struct pb_manager *_mgr) { struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr); util_hash_table_destroy(mgr->buffer_handles); + pipe_mutex_destroy(mgr->buffer_map_list_mutex); + pipe_mutex_destroy(mgr->buffer_handles_mutex); FREE(mgr); } @@ -314,6 +360,8 @@ radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws) mgr->rws = rws; make_empty_list(&mgr->buffer_map_list); mgr->buffer_handles = util_hash_table_create(handle_hash, handle_compare); + pipe_mutex_init(mgr->buffer_map_list_mutex); + pipe_mutex_init(mgr->buffer_handles_mutex); return &mgr->base; } @@ -489,6 +537,8 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr) struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr); struct radeon_drm_buffer *rpb, *t_rpb; + pipe_mutex_lock(mgr->buffer_map_list_mutex); + foreach_s(rpb, t_rpb, &mgr->buffer_map_list) { radeon_bo_unmap(rpb->bo); rpb->bo->ptr = NULL; @@ -496,6 +546,8 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr) } make_empty_list(&mgr->buffer_map_list); + + pipe_mutex_unlock(mgr->buffer_map_list_mutex); } void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws, -- cgit v1.2.3 From 7d28ec8500fc08fafbdb3ae5443b32dd756eddd7 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 23 Sep 2010 22:53:10 +0200 Subject: r300g: fix a copy-paste typo for logging --- src/gallium/drivers/r300/r300_texture_desc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 112282a0a6a..20d1fdab426 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -444,10 +444,10 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen, if (max_buffer_size) { /* Make sure the buffer we got is large enough. */ if (desc->size_in_bytes > max_buffer_size) { - fprintf(stderr, "r300: texture_from_handle: The buffer is not " + fprintf(stderr, "r300: texture_desc_init: The buffer is not " "large enough. Got: %i, Need: %i, Info:\n", max_buffer_size, desc->size_in_bytes); - r300_tex_print_info(rscreen, desc, "texture_from_handle"); + r300_tex_print_info(rscreen, desc, "texture_desc_init"); return FALSE; } @@ -457,7 +457,7 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen, } if (SCREEN_DBG_ON(rscreen, DBG_TEX)) - r300_tex_print_info(rscreen, desc, "texture_from_handle"); + r300_tex_print_info(rscreen, desc, "texture_desc_init"); return TRUE; } -- cgit v1.2.3 From 9f35dcd24cb520af5e39501672a3324000cdbfce Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 23 Sep 2010 22:56:50 +0200 Subject: r300g: fix the border color for every format other than PIPE_FORMAT_B8G8R8A8 TX_BORDER_COLOR should be formatted according to the texture format. Also the interaction with ARB_texture_swizzle should be fixed too. NOTE: This is a candidate for the 7.9 branch. --- src/gallium/drivers/r300/r300_context.h | 1 - src/gallium/drivers/r300/r300_state.c | 4 -- src/gallium/drivers/r300/r300_state_derived.c | 85 ++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 7f655dbfd21..8f4e2de02d1 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -162,7 +162,6 @@ struct r300_sampler_state { uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */ uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */ - uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */ /* Min/max LOD must be clamped to [0, last_level], thus * it's dependent on a currently bound texture */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index d6cded927a1..ad3282a4e6b 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1169,7 +1169,6 @@ static void* struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state); boolean is_r500 = r300->screen->caps.is_r500; int lod_bias; - union util_color uc; sampler->state = *state; @@ -1226,9 +1225,6 @@ static void* sampler->filter1 |= r500_anisotropy(state->max_anisotropy); } - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - sampler->border_color = uc.ui; - /* R500-specific fixups and optimizations */ if (r300->screen->caps.is_r500) { sampler->filter1 |= R500_BORDER_FIX; diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index f9a516825df..566a828871d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -567,6 +567,85 @@ static void r300_update_rs_block(struct r300_context *r300) } } +static uint32_t r300_get_border_color(enum pipe_format format, + const unsigned char swizzle_view[4], + const float border[4]) +{ + const struct util_format_description *desc; + unsigned char swizzle[4]; + unsigned i; + float border_swizzled[4]; + uint32_t r; + + desc = util_format_description(format); + + /* Combine the swizzles. */ + for (i = 0; i < 4; i++) { + swizzle[i] = swizzle_view[i] <= UTIL_FORMAT_SWIZZLE_W ? + desc->swizzle[swizzle_view[i]] : swizzle_view[i]; + } + + /* Apply swizzling. */ + for (i = 0; i < 4; i++) { + switch (swizzle[i]) { + case UTIL_FORMAT_SWIZZLE_X: + border_swizzled[i] = border[0]; + break; + case UTIL_FORMAT_SWIZZLE_Y: + border_swizzled[i] = border[1]; + break; + case UTIL_FORMAT_SWIZZLE_Z: + border_swizzled[i] = border[2]; + break; + case UTIL_FORMAT_SWIZZLE_W: + border_swizzled[i] = border[3]; + break; + case UTIL_FORMAT_SWIZZLE_0: + border_swizzled[i] = 0; + break; + default: /* 1, NONE */ + border_swizzled[i] = 1; + } + } + + /* We don't use util_pack_format because it does not handle the formats + * we want, e.g. R4G4B4A4 is non-existent in Gallium. */ + switch (desc->channel[0].size) { + case 4: + r = ((float_to_ubyte(border_swizzled[0]) & 0xf0) >> 4) | + ((float_to_ubyte(border_swizzled[1]) & 0xf0) << 0) | + ((float_to_ubyte(border_swizzled[2]) & 0xf0) << 4) | + ((float_to_ubyte(border_swizzled[3]) & 0xf0) << 8); + break; + + case 5: + if (desc->channel[1].size == 5) { + r = ((float_to_ubyte(border_swizzled[0]) & 0xf8) >> 3) | + ((float_to_ubyte(border_swizzled[1]) & 0xf8) << 2) | + ((float_to_ubyte(border_swizzled[2]) & 0xf8) << 7) | + ((float_to_ubyte(border_swizzled[3]) & 0x80) << 8); + } else if (desc->channel[1].size == 6) { + r = ((float_to_ubyte(border_swizzled[0]) & 0xf8) >> 3) | + ((float_to_ubyte(border_swizzled[1]) & 0xfc) << 3) | + ((float_to_ubyte(border_swizzled[2]) & 0xf8) << 8); + } else { + assert(0); + } + break; + + default: + /* I think the fat formats (16, 32) are specified + * as the 8-bit ones. I am not sure how compressed formats + * work here. */ + r = ((float_to_ubyte(border_swizzled[0]) & 0xff) << 0) | + ((float_to_ubyte(border_swizzled[1]) & 0xff) << 8) | + ((float_to_ubyte(border_swizzled[2]) & 0xff) << 16) | + ((float_to_ubyte(border_swizzled[3]) & 0xff) << 24); + } + + return r; +} + static void r300_merge_textures_and_samplers(struct r300_context* r300) { struct r300_textures_state *state = @@ -599,7 +678,11 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) texstate->format = view->format; texstate->filter0 = sampler->filter0; texstate->filter1 = sampler->filter1; - texstate->border_color = sampler->border_color; + + /* Set the border color. */ + texstate->border_color = + r300_get_border_color(view->base.format, view->swizzle, + sampler->state.border_color); /* determine min/max levels */ max_level = MIN3(sampler->max_lod + view->base.first_level, -- cgit v1.2.3 From 4388087f199f020e15024c908ba840a250cf29e1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 23 Sep 2010 20:45:01 +1000 Subject: r600g: add vert support for 16/16 and 16/16/16 floats. makes draw-vertices-half-float pass --- src/gallium/drivers/r600/r600_state_inlines.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 283f1e59b33..3a2c08da0bd 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -400,6 +400,9 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32_FLOAT: return V_0280A0_COLOR_32_FLOAT; + case PIPE_FORMAT_R16G16_FLOAT: + case PIPE_FORMAT_R16G16B16_FLOAT: + return V_0280A0_COLOR_16_16_16_16_FLOAT; /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_UNORM: -- cgit v1.2.3 From b7ab9ee84e4e4ff48b335c74c110d82e48bee4a5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 09:50:48 +1000 Subject: r600g: add some more vertex format support. adds the sscaled formats, this passes some more of the draw-vertices tests. --- src/gallium/drivers/r600/eg_hw_states.c | 12 ++++++--- src/gallium/drivers/r600/eg_state_inlines.h | 33 ++++++++++++++++++++++++ src/gallium/drivers/r600/evergreend.h | 3 +++ src/gallium/drivers/r600/r600_draw.c | 3 +-- src/gallium/drivers/r600/r600_hw_states.c | 12 ++++++--- src/gallium/drivers/r600/r600_state_inlines.h | 37 ++++++++++++++++++++++++--- src/gallium/drivers/r600/r600d.h | 3 +++ 7 files changed, 92 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 42b49002c39..77ac444fe2e 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -849,19 +849,25 @@ static void eg_init_config(struct r600_context *rctx) } static int eg_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset, - uint32_t stride, uint32_t format) + uint32_t stride, uint32_t src_format) { struct radeon_state *vs_resource = &rctx->vs_resource[id]; struct r600_screen *rscreen = rctx->screen; + unsigned format, num_format = 0, format_comp = 0; + + format = r600_translate_colorformat(src_format); + r600_translate_vertex_num_format(src_format, &num_format, &format_comp); + format = S_030008_DATA_FORMAT(format) | S_030008_NUM_FORMAT_ALL(num_format) | + S_030008_FORMAT_COMP_ALL(format_comp); + radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS); radeon_ws_bo_reference(rscreen->rw, &vs_resource->bo[0], rbuffer->bo); vs_resource->nbo = 1; vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD0] = offset; vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->size - offset - 1; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = S_030008_STRIDE(stride) | - S_030008_DATA_FORMAT(format); + vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = S_030008_STRIDE(stride) | format; vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) | S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) | S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) | diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 0a42abcdf2b..d9897e020ec 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -400,7 +400,18 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32_FLOAT: return V_028C70_COLOR_32_FLOAT; + case PIPE_FORMAT_R16G16_FLOAT: + return V_028C70_COLOR_16_16_FLOAT; + + case PIPE_FORMAT_R16G16_SSCALED: + return V_028C70_COLOR_16_16; + + case PIPE_FORMAT_R16G16B16_FLOAT: + return V_028C70_COLOR_16_16_16_16_FLOAT; + /* 64-bit buffers. */ + case PIPE_FORMAT_R16G16B16A16_SSCALED: + case PIPE_FORMAT_R16G16B16_SSCALED: case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: return V_028C70_COLOR_16_16_16_16; @@ -409,6 +420,9 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32G32_FLOAT: return V_028C70_COLOR_32_32_FLOAT; + case PIPE_FORMAT_R32G32_SSCALED: + return V_028C70_COLOR_32_32; + /* 128-bit buffers. */ case PIPE_FORMAT_R32G32B32_FLOAT: return V_028C70_COLOR_32_32_32_FLOAT; @@ -424,6 +438,25 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) } } +static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uint32_t *num_format_p, + uint32_t *format_comp_p) +{ + uint32_t num_format = 0, format_comp = 0; + switch (format) { + case PIPE_FORMAT_R16G16B16A16_SSCALED: + case PIPE_FORMAT_R16G16B16_SSCALED: + case PIPE_FORMAT_R16G16_SSCALED: + case PIPE_FORMAT_R32G32_SSCALED: + num_format = V_030008_SQ_NUM_FORMAT_SCALED; + format_comp = 1; + break; + default: + break; + } + *num_format_p = num_format; + *format_comp_p = format_comp; +} + static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format) { return r600_translate_texformat(format, NULL, NULL, NULL) != ~0; diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 1973da3647d..9bd74348664 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1157,6 +1157,9 @@ #define S_030008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26) #define G_030008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3) #define C_030008_NUM_FORMAT_ALL 0xF3FFFFFF +#define V_030008_SQ_NUM_FORMAT_NORM 0x00000000 +#define V_030008_SQ_NUM_FORMAT_INT 0x00000001 +#define V_030008_SQ_NUM_FORMAT_SCALED 0x00000002 #define S_030008_FORMAT_COMP_ALL(x) (((x) & 0x1) << 28) #define G_030008_FORMAT_COMP_ALL(x) (((x) >> 28) & 0x1) #define C_030008_FORMAT_COMP_ALL 0xEFFFFFFF diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 51c9b065494..0fa48ae23ab 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -120,9 +120,8 @@ static int r600_draw_common(struct r600_draw *draw) vertex_buffer = &rctx->vertex_buffer[j]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, format); + rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->elements[i].src_format); radeon_draw_bind(&rctx->draw, vs_resource); } rctx->vs_nresource = rctx->vertex_elements->count; diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index f3cb3b1ae0e..9e54c6a9215 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -928,18 +928,24 @@ static void r600_init_config(struct r600_context *rctx) } static int r600_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset, - uint32_t stride, uint32_t format) + uint32_t stride, uint32_t src_format) { struct radeon_state *vs_resource = &rctx->vs_resource[id]; struct r600_screen *rscreen = rctx->screen; + unsigned format, num_format = 0, format_comp = 0; + format = r600_translate_colorformat(src_format); + + r600_translate_vertex_num_format(src_format, &num_format, &format_comp); + + format = S_038008_DATA_FORMAT(format) | S_038008_NUM_FORMAT_ALL(num_format) | S_038008_FORMAT_COMP_ALL(format_comp); + radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS); radeon_ws_bo_reference(rscreen->rw, &vs_resource->bo[0], rbuffer->bo); vs_resource->nbo = 1; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->size - offset - 1; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(stride) | - S_038008_DATA_FORMAT(format); + vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(stride) | format; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000; vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000; diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 3a2c08da0bd..1337d8ec815 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -400,19 +400,31 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32_FLOAT: return V_0280A0_COLOR_32_FLOAT; + case PIPE_FORMAT_R16G16_FLOAT: - case PIPE_FORMAT_R16G16B16_FLOAT: - return V_0280A0_COLOR_16_16_16_16_FLOAT; + return V_0280A0_COLOR_16_16_FLOAT; + + case PIPE_FORMAT_R16G16_SSCALED: + return V_0280A0_COLOR_16_16; + /* 64-bit buffers. */ + case PIPE_FORMAT_R16G16B16_SSCALED: + case PIPE_FORMAT_R16G16B16A16_SSCALED: case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: return V_0280A0_COLOR_16_16_16_16; + + case PIPE_FORMAT_R16G16B16_FLOAT: case PIPE_FORMAT_R16G16B16A16_FLOAT: return V_0280A0_COLOR_16_16_16_16_FLOAT; + case PIPE_FORMAT_R32G32_FLOAT: return V_0280A0_COLOR_32_32_FLOAT; + case PIPE_FORMAT_R32G32_SSCALED: + return V_0280A0_COLOR_32_32; + /* 128-bit buffers. */ case PIPE_FORMAT_R32G32B32_FLOAT: return V_0280A0_COLOR_32_32_32_FLOAT; @@ -423,11 +435,30 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_UYVY: case PIPE_FORMAT_YUYV: default: - R600_ERR("unsupported color format %d\n", format); + R600_ERR("unsupported color format %d %s\n", format, util_format_name(format)); return ~0; /* Unsupported. */ } } +static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uint32_t *num_format_p, + uint32_t *format_comp_p) +{ + uint32_t num_format = 0, format_comp = 0; + switch (format) { + case PIPE_FORMAT_R16G16B16A16_SSCALED: + case PIPE_FORMAT_R16G16B16_SSCALED: + case PIPE_FORMAT_R16G16_SSCALED: + case PIPE_FORMAT_R32G32_SSCALED: + num_format = V_038008_SQ_NUM_FORMAT_SCALED; + format_comp = 1; + break; + default: + break; + } + *num_format_p = num_format; + *format_comp_p = format_comp; +} + static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format) { return r600_translate_texformat(format, NULL, NULL, NULL) != ~0; diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 56fba19a703..47ab1eb9650 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -1062,6 +1062,9 @@ #define S_038008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26) #define G_038008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3) #define C_038008_NUM_FORMAT_ALL 0xF3FFFFFF +#define V_038008_SQ_NUM_FORMAT_NORM 0x00000000 +#define V_038008_SQ_NUM_FORMAT_INT 0x00000001 +#define V_038008_SQ_NUM_FORMAT_SCALED 0x00000002 #define S_038008_FORMAT_COMP_ALL(x) (((x) & 0x1) << 28) #define G_038008_FORMAT_COMP_ALL(x) (((x) >> 28) & 0x1) #define C_038008_FORMAT_COMP_ALL 0xEFFFFFFF -- cgit v1.2.3 From 95e04c3d74aef91bde8653bddc4b0013b68fedd1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 10:47:14 +1000 Subject: r600g: some more vertex formats --- src/gallium/drivers/r600/eg_state_inlines.h | 6 +++--- src/gallium/drivers/r600/r600_state_inlines.h | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index d9897e020ec..4723aee5a5e 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -406,17 +406,17 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R16G16_SSCALED: return V_028C70_COLOR_16_16; - case PIPE_FORMAT_R16G16B16_FLOAT: - return V_028C70_COLOR_16_16_16_16_FLOAT; - /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_SSCALED: case PIPE_FORMAT_R16G16B16_SSCALED: case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: return V_028C70_COLOR_16_16_16_16; + + case PIPE_FORMAT_R16G16B16_FLOAT: case PIPE_FORMAT_R16G16B16A16_FLOAT: return V_028C70_COLOR_16_16_16_16_FLOAT; + case PIPE_FORMAT_R32G32_FLOAT: return V_028C70_COLOR_32_32_FLOAT; diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 1337d8ec815..663529faafb 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -409,6 +409,8 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) /* 64-bit buffers. */ + case PIPE_FORMAT_R16G16B16_USCALED: + case PIPE_FORMAT_R16G16B16A16_USCALED: case PIPE_FORMAT_R16G16B16_SSCALED: case PIPE_FORMAT_R16G16B16A16_SSCALED: case PIPE_FORMAT_R16G16B16A16_UNORM: @@ -422,6 +424,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32G32_FLOAT: return V_0280A0_COLOR_32_32_FLOAT; + case PIPE_FORMAT_R32G32_USCALED: case PIPE_FORMAT_R32G32_SSCALED: return V_0280A0_COLOR_32_32; @@ -449,8 +452,12 @@ static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uin case PIPE_FORMAT_R16G16B16_SSCALED: case PIPE_FORMAT_R16G16_SSCALED: case PIPE_FORMAT_R32G32_SSCALED: - num_format = V_038008_SQ_NUM_FORMAT_SCALED; format_comp = 1; + case PIPE_FORMAT_R16G16B16A16_USCALED: + case PIPE_FORMAT_R16G16B16_USCALED: + case PIPE_FORMAT_R16G16_USCALED: + case PIPE_FORMAT_R32G32_USCALED: + num_format = V_038008_SQ_NUM_FORMAT_SCALED; break; default: break; -- cgit v1.2.3 From cf0162be138cb424f47a8fa75e4645e2319c7ddf Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 12:32:45 +1000 Subject: r600g: fix draw-elements and draw-elements-base-vertex --- src/gallium/drivers/r600/r600_context.h | 1 + src/gallium/drivers/r600/r600_draw.c | 11 ++++++----- src/gallium/drivers/r600/r600_hw_states.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index 8778f23a819..c15e64329d8 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -129,6 +129,7 @@ struct r600_draw { struct pipe_resource *index_buffer; unsigned index_buffer_offset; unsigned min_index, max_index; + unsigned index_bias; }; struct r600_context_hw_states { diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 0fa48ae23ab..4978a3cab2a 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -149,8 +149,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) struct r600_draw draw; int r; - assert(info->index_bias == 0); - memset(&draw, 0, sizeof(draw)); if (rctx->any_user_vbs) { @@ -166,16 +164,17 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; draw.min_index = info->min_index; draw.max_index = info->max_index; + draw.index_bias = info->index_bias; r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer, &rctx->index_buffer.index_size, - rctx->index_buffer.offset, &draw.start, + 0, &draw.start, info->count); draw.index_size = rctx->index_buffer.index_size; draw.index_buffer = rctx->index_buffer.buffer; - draw.index_buffer_offset = rctx->index_buffer.offset; - + draw.index_buffer_offset = draw.start * draw.index_size; + draw.start = 0; r600_upload_index_buffer(rctx, &draw); } else { @@ -184,7 +183,9 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.min_index = 0; draw.max_index = 0xffffff; draw.index_buffer_offset = 0; + draw.index_bias = draw.start; } + r = r600_draw_common(&draw); if (r) fprintf(stderr,"draw common failed %d\n", r); diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 9e54c6a9215..1e9c5ffbfc7 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -983,7 +983,7 @@ static int r600_draw_vgt_prim(struct r600_draw *draw, draw->vgt.states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; draw->vgt.states[R600_VGT__VGT_MAX_VTX_INDX] = draw->max_index; draw->vgt.states[R600_VGT__VGT_MIN_VTX_INDX] = draw->min_index; - draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->start; + draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->index_bias; draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000; draw->vgt.states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; draw->vgt.states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; -- cgit v1.2.3 From 4e27e935ca670d0cb1748e40a46a2357d4331a6f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 12:36:08 +1000 Subject: r600g: drop index_offset parameter to index buffer translate. r600 doesn't need this as we always have working index bias --- src/gallium/drivers/r600/r600_draw.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 4978a3cab2a..5b389462e72 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -40,29 +40,25 @@ static void r600_translate_index_buffer(struct r600_context *r600, struct pipe_resource **index_buffer, - unsigned *index_size, unsigned index_offset, + unsigned *index_size, unsigned *start, unsigned count) { switch (*index_size) { case 1: - util_shorten_ubyte_elts(&r600->context, index_buffer, index_offset, *start, count); - *index_size = 2; - *start = 0; - break; + util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count); + *index_size = 2; + *start = 0; + break; case 2: - if (*start % 2 != 0 || index_offset) { - util_rebuild_ushort_elts(&r600->context, index_buffer, index_offset, *start, count); - *start = 0; - } - break; - + if (*start % 2 != 0) { + util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count); + *start = 0; + } + break; + case 4: - if (index_offset) { - util_rebuild_uint_elts(&r600->context, index_buffer, index_offset, *start, count); - *start = 0; - } - break; + break; } } @@ -168,7 +164,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer, &rctx->index_buffer.index_size, - 0, &draw.start, + &draw.start, info->count); draw.index_size = rctx->index_buffer.index_size; -- cgit v1.2.3 From e74d26d82ab6e4b21c6220d8f599f69ab2acf01e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 13:44:48 +1000 Subject: r600g: fixup tex wrapping. the clamp edge/clamp cases were reversed. --- src/gallium/drivers/r600/eg_state_inlines.h | 8 ++++---- src/gallium/drivers/r600/r600_state_inlines.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 4723aee5a5e..251e64a67a0 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -136,17 +136,17 @@ static inline unsigned r600_tex_wrap(unsigned wrap) case PIPE_TEX_WRAP_REPEAT: return V_03C000_SQ_TEX_WRAP; case PIPE_TEX_WRAP_CLAMP: - return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: return V_03C000_SQ_TEX_CLAMP_HALF_BORDER; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL; case PIPE_TEX_WRAP_CLAMP_TO_BORDER: return V_03C000_SQ_TEX_CLAMP_BORDER; case PIPE_TEX_WRAP_MIRROR_REPEAT: return V_03C000_SQ_TEX_MIRROR; case PIPE_TEX_WRAP_MIRROR_CLAMP: - return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: return V_03C000_SQ_TEX_MIRROR_ONCE_HALF_BORDER; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL; case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: return V_03C000_SQ_TEX_MIRROR_ONCE_BORDER; } diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 663529faafb..3be5248cd30 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -136,17 +136,17 @@ static inline unsigned r600_tex_wrap(unsigned wrap) case PIPE_TEX_WRAP_REPEAT: return V_03C000_SQ_TEX_WRAP; case PIPE_TEX_WRAP_CLAMP: - return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: return V_03C000_SQ_TEX_CLAMP_HALF_BORDER; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL; case PIPE_TEX_WRAP_CLAMP_TO_BORDER: return V_03C000_SQ_TEX_CLAMP_BORDER; case PIPE_TEX_WRAP_MIRROR_REPEAT: return V_03C000_SQ_TEX_MIRROR; case PIPE_TEX_WRAP_MIRROR_CLAMP: - return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: return V_03C000_SQ_TEX_MIRROR_ONCE_HALF_BORDER; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL; case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: return V_03C000_SQ_TEX_MIRROR_ONCE_BORDER; } -- cgit v1.2.3 From 59276b8541049a2d07d32fbb139fb14e21e387fc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 14:58:15 +1000 Subject: r600g: fixup VP->FP output->input routing. We need to map the TGSI semantics to each other using the hw semantic ids. this fixes glsl-kwin-blur and glsl-routing. --- src/gallium/drivers/r600/eg_hw_states.c | 2 +- src/gallium/drivers/r600/r600_context.h | 1 + src/gallium/drivers/r600/r600_hw_states.c | 2 +- src/gallium/drivers/r600/r600_shader.c | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 77ac444fe2e..47c15b8dcc8 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -934,7 +934,7 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)); tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index c15e64329d8..aec0dab338c 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -279,6 +279,7 @@ extern int r600_pipe_shader_create(struct pipe_context *ctx, const struct tgsi_token *tokens); extern int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_context_state *rstate); +extern int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id); #define R600_ERR(fmt, args...) \ fprintf(stderr, "EE %s/%s:%d - "fmt, __FILE__, __func__, __LINE__, ##args) diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 1e9c5ffbfc7..9cbf12008b7 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -1007,7 +1007,7 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i) | S_028644_SEL_CENTROID(1); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)) | S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e18c6ce6052..3274f3be71a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -64,6 +64,22 @@ struct r600_shader_tgsi_instruction { static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[]; static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx); +/* called from hw states files to find VS->FS mapping */ +int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id) +{ + int i; + struct r600_shader *vs = &rctx->vs_shader->shader; + struct r600_shader_io *input = &rshader->input[id]; + + for (i = 0; i < vs->noutput; i++) { + if (input->name == vs->output[i].name && + input->sid == vs->output[i].sid) { + return i - 1; + } + } + return 0; +} + static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader) { struct r600_context *rctx = r600_context(ctx); -- cgit v1.2.3 From 428b101af922fce5358af501b7a4d90697f35368 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 16:10:07 +1000 Subject: r600g: fix typo in r700 alu emit --- src/gallium/drivers/r600/r700_asm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r700_asm.c b/src/gallium/drivers/r600/r700_asm.c index a78cf0ce950..9c731f2dbb9 100644 --- a/src/gallium/drivers/r600/r700_asm.c +++ b/src/gallium/drivers/r600/r700_asm.c @@ -37,7 +37,7 @@ int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id) S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) | S_SQ_ALU_WORD0_SRC0_NEG(alu->src[0].neg) | S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) | - S_SQ_ALU_WORD0_SRC0_REL(alu->src[1].rel) | + S_SQ_ALU_WORD0_SRC1_REL(alu->src[1].rel) | S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) | S_SQ_ALU_WORD0_LAST(alu->last); -- cgit v1.2.3 From efa111a6cbfe03318a0e0569d4c9205a16d56857 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 16:36:16 +1000 Subject: r600g: fixup sprite coord enable. this fixes piglit glsl-fs-pointcoord --- src/gallium/drivers/r600/r600_hw_states.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 9cbf12008b7..892666b00b6 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -1019,7 +1019,8 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * if (rshader->input[i].name == TGSI_SEMANTIC_FACE) have_face = TRUE; - if (rasterizer->sprite_coord_enable & (1 << i)) { + if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && + rasterizer->sprite_coord_enable & (1 << rshader->input[i].sid)) { tmp |= S_028644_PT_SPRITE_TEX(1); } state->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp; -- cgit v1.2.3 From 11cd1612a1f0f7225ccb22c1197074c57b46aa26 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 18:57:33 +1000 Subject: r600g: fix polygon mode this fixes glean'pointSprite test. --- src/gallium/drivers/r600/r600_hw_states.c | 9 ++++++++- src/gallium/drivers/r600/r600_state_inlines.h | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 892666b00b6..b4d73a0fb10 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -201,6 +201,7 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta unsigned offset_db_fmt_cntl = 0; unsigned point_size; unsigned prov_vtx = 1; + unsigned polygon_dual_mode; if (rctx->clip) clip = &rctx->clip->state.clip; @@ -263,6 +264,9 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp) | S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); } + polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || + state->fill_back != PIPE_POLYGON_MODE_FILL); + rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | @@ -270,7 +274,10 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta S_028814_FACE(!state->front_ccw) | S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri); + S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | + S_028814_POLY_MODE(polygon_dual_mode) | + S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | + S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)); rstate->states[R600_RASTERIZER__PA_CL_VS_OUT_CNTL] = S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex); diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 3be5248cd30..a9e7619bf35 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -123,6 +123,18 @@ static INLINE uint32_t r600_translate_stencil_op(int s_op) return 0; } +static INLINE uint32_t r600_translate_fill(uint32_t func) +{ + switch(func) { + case PIPE_POLYGON_MODE_FILL: + return 2; + case PIPE_POLYGON_MODE_LINE: + return 1; + case PIPE_POLYGON_MODE_POINT: + return 0; + } +} + /* translates straight */ static INLINE uint32_t r600_translate_ds_func(int func) { -- cgit v1.2.3 From f71f8c7d18a1a92681c337cb6dbf507ab06b62b1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 18:03:06 +0200 Subject: d3d1x: add shader dumping --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 1 + src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 962bea5ce95..42678fab4d0 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -30,6 +30,7 @@ extern "C" { #include "util/u_gen_mipmap.h" #include "tgsi/tgsi_ureg.h" +#include "tgsi/tgsi_dump.h" #include "cso_cache/cso_context.h" } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 61b1ba2bd3e..c41117080a2 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -24,6 +24,8 @@ * **************************************************************************/ +DEBUG_GET_ONCE_BOOL_OPTION(dump_shaders, "D3D1X_DUMP_SHADERS", FALSE); + /* These cap sets are much more correct than the ones in u_caps.c */ /* TODO: it seems cube levels should be the same as 2D levels */ @@ -1166,6 +1168,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif ) { + bool dump = debug_get_option_dump_shaders(); + dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(shader_bytecode, bytecode_length); if(!sm4_chunk) return 0; @@ -1174,12 +1178,18 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen if(!sm4.get()) return 0; + if(dump) + sm4->dump(); + struct pipe_shader_state tgsi_shader; memset(&tgsi_shader, 0, sizeof(tgsi_shader)); tgsi_shader.tokens = (const tgsi_token*)sm4_to_tgsi(*sm4); if(!tgsi_shader.tokens) return 0; + if(dump) + tgsi_dump(tgsi_shader.tokens, 0); + void* shader_cso; GalliumD3D11Shader<>* shader; -- cgit v1.2.3 From 4babdc78448f92b8d027a66cd506351a16aef4ec Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 18:03:34 +0200 Subject: d3d1x: add untested support for geometry shader translation --- .../d3d1x/d3d1xstutil/include/d3d1xstutil.h | 6 ++++ .../d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp | 42 ++++++++++++++++++++++ .../state_trackers/d3d1x/gd3d1x/d3d1x_private.h | 3 -- .../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp | 24 ------------- .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp | 31 +++++++++++++--- 5 files changed, 75 insertions(+), 31 deletions(-) create mode 100644 src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 313aa10a377..2b613b82d11 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -62,6 +62,12 @@ extern "C" #undef max #endif +#define D3D_PRIMITIVE_TOPOLOGY_COUNT 65 +extern unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT]; + +#define D3D_PRIMITIVE_COUNT 40 +extern unsigned d3d_to_pipe_prim_type[D3D_PRIMITIVE_COUNT]; + /* NOTE: this _depends_ on the vtable layout of the C++ compiler to be * binary compatible with Windows. * Furthermore some absurd vtable layout likely won't work at all, since diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp new file mode 100644 index 00000000000..410a56c2485 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp @@ -0,0 +1,42 @@ +#include "d3d1xstutil.h" + +unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT] = +{ + 0, + PIPE_PRIM_POINTS, + PIPE_PRIM_LINES, + PIPE_PRIM_LINE_STRIP, + PIPE_PRIM_TRIANGLES, + PIPE_PRIM_TRIANGLE_STRIP, + PIPE_PRIM_LINES_ADJACENCY, + PIPE_PRIM_LINE_STRIP_ADJACENCY, + PIPE_PRIM_TRIANGLES_ADJACENCY, + PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY, + /* gap */ + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, + /* patches */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +}; + +unsigned d3d_to_pipe_prim_type[D3D_PRIMITIVE_COUNT] = +{ + 0, + PIPE_PRIM_POINTS, + PIPE_PRIM_LINES, + PIPE_PRIM_TRIANGLES, + 0, + PIPE_PRIM_POINTS, + PIPE_PRIM_LINES_ADJACENCY, + PIPE_PRIM_TRIANGLES_ADJACENCY, + /* patches */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +}; diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h index d4b6a8fc957..977f0cd2cea 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h @@ -92,7 +92,4 @@ extern unsigned d3d11_to_pipe_wrap[D3D11_TEXTURE_ADDRESS_COUNT]; extern unsigned d3d11_to_pipe_query[D3D11_QUERY_COUNT]; extern unsigned d3d11_query_size[D3D11_QUERY_COUNT]; -#define D3D_PRIMITIVE_TOPOLOGY_COUNT 65 -extern unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT]; - #endif /* D3D1X_H_ */ diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp index 37113a6ec91..853d11410df 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp @@ -121,27 +121,3 @@ unsigned d3d11_query_size[D3D11_QUERY_COUNT] = 0, 0 }; - -unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT] = -{ - 0, - PIPE_PRIM_POINTS, - PIPE_PRIM_LINES, - PIPE_PRIM_LINE_STRIP, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLE_STRIP, - PIPE_PRIM_LINES_ADJACENCY, - PIPE_PRIM_LINE_STRIP_ADJACENCY, - PIPE_PRIM_TRIANGLES_ADJACENCY, - PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY, - /* gap */ - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, - /* patches */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp index 4b43a3325ca..7d03cecafc0 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -24,6 +24,7 @@ * **************************************************************************/ +#include "d3d1xstutil.h" #include "sm4.h" #include "tgsi/tgsi_ureg.h" #include @@ -137,9 +138,16 @@ struct sm4_to_tgsi_converter s = ureg_imm4f(ureg, op.imm_values[0].f32, op.imm_values[1].f32, op.imm_values[2].f32, op.imm_values[3].f32); break; case SM4_FILE_INPUT: - check(op.has_simple_index()); - check(op.indices[0].disp < inputs.size()); - s = inputs[op.indices[0].disp]; + check(op.is_index_simple(0)); + check(op.num_indices == 1 || op.num_indices == 2); + // TODO: is this correct, or are incorrectly swapping the two indices in the GS case? + check(op.indices[op.num_indices - 1].disp < inputs.size()); + s = inputs[op.indices[op.num_indices - 1].disp]; + if(op.num_indices == 2) + { + s.Dimension = 1; + s.DimensionIndex = op.indices[0].disp; + } break; case SM4_FILE_CONSTANT_BUFFER: // TODO: indirect addressing @@ -700,7 +708,7 @@ next:; { sm4_dcl& dcl = *program.dcls[insn_num]; int idx = -1; - if(dcl.op.get() && dcl.op->has_simple_index()) + if(dcl.op.get() && dcl.op->is_index_simple(0)) idx = dcl.op->indices[0].disp; switch(dcl.opcode) { @@ -716,6 +724,12 @@ next:; inputs.resize(idx + 1); if(processor == TGSI_PROCESSOR_VERTEX) inputs[idx] = ureg_DECL_vs_input(ureg, idx); + else if(processor == TGSI_PROCESSOR_GEOMETRY) + { + // TODO: is this correct? + unsigned gsidx = dcl.op->indices[1].disp; + inputs[gsidx] = ureg_DECL_gs_input(ureg, gsidx, TGSI_SEMANTIC_GENERIC, gsidx); + } else check(0); break; @@ -792,6 +806,15 @@ next:; idx = dcl.op->indices[0].disp; ureg_DECL_constant2D(ureg, 0, (unsigned)dcl.op->indices[1].disp - 1, idx); break; + case SM4_OPCODE_DCL_GS_INPUT_PRIMITIVE: + ureg_property_gs_input_prim(ureg, d3d_to_pipe_prim_type[dcl.dcl_gs_input_primitive.primitive]); + break; + case SM4_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY: + ureg_property_gs_output_prim(ureg, d3d_to_pipe_prim[dcl.dcl_gs_output_primitive_topology.primitive_topology]); + break; + case SM4_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT: + ureg_property_gs_max_vertices(ureg, dcl.num); + break; default: check(0); } -- cgit v1.2.3 From 0e40b41ceec15d97507fe85343daad54aa1c4824 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 18:24:34 +0200 Subject: d3d1x: don't assert on unsupported resource types --- src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp index 7d03cecafc0..66b686687cf 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -720,14 +720,18 @@ next:; break; case SM4_OPCODE_DCL_INPUT: check(idx >= 0); - if(inputs.size() <= (unsigned)idx) - inputs.resize(idx + 1); if(processor == TGSI_PROCESSOR_VERTEX) + { + if(inputs.size() <= (unsigned)idx) + inputs.resize(idx + 1); inputs[idx] = ureg_DECL_vs_input(ureg, idx); + } else if(processor == TGSI_PROCESSOR_GEOMETRY) { // TODO: is this correct? unsigned gsidx = dcl.op->indices[1].disp; + if(inputs.size() <= (unsigned)gsidx) + inputs.resize(gsidx + 1); inputs[gsidx] = ureg_DECL_gs_input(ureg, gsidx, TGSI_SEMANTIC_GENERIC, gsidx); } else @@ -789,7 +793,11 @@ next:; targets[idx].second = 0; break; default: - check(0); + // HACK to make SimpleSample10 work + //check(0); + targets[idx].first = TGSI_TEXTURE_2D; + targets[idx].second = TGSI_TEXTURE_SHADOW2D; + break; } break; case SM4_OPCODE_DCL_SAMPLER: -- cgit v1.2.3 From 0f4ec3f72ce66e4c56af9bb832c7c4cd2015901e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 20:24:20 +0200 Subject: d3d1x: fix CheckMultisampleQualityLevels --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index c41117080a2..528d32c4b1e 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -327,7 +327,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen { SYNCHRONIZED; - *pcount = 0; + if(sample_count == 1) + *pcount = 1; + else + *pcount = 0; return S_OK; } -- cgit v1.2.3 From 54ee7721a142f57c932f77e6a33af6874320cdc0 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 09:12:33 +0200 Subject: d3d1x: draw to the correct buffer --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 74bce598ae2..ef256a80c79 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -1045,7 +1045,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectbuffer_mask & NATIVE_ATTACHMENT_BACK_LEFT); + db = !!(config->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)); dst = resources[db ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT]; src = gallium_buffer0; dst_surface = 0; -- cgit v1.2.3 From c7a064b4d5b6df0277d35a21d5fc1df899087784 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 09:49:51 +0200 Subject: d3d1x: fix linking of dxbc2tgsi --- src/gallium/state_trackers/d3d1x/gd3d1x/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile index 924b2f17c54..a1ab425f1a0 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile @@ -2,5 +2,5 @@ LIBNAME=gd3d1x CPP_SOURCES=$(wildcard *.cpp) LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common PROGS=tools/dxbc2tgsi -LIBS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../../../auxiliary/libgallium.a -ldl +LIBS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../d3d1xstutil/libd3d1xstutil.a ../../../auxiliary/libgallium.a -ldl include ../Makefile.inc -- cgit v1.2.3 From 8b63ed4e6cb4ecea57e2bc622124056341844c56 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 24 Sep 2010 13:26:19 +0300 Subject: r600g: break alu clause earlier we still have constants to add and next int may need also 6 slots --- src/gallium/drivers/r600/r600_asm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index dcb1b4fcccb..fcdcad3edf8 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -420,7 +420,6 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int /* cf can contains only alu or only vtx or only tex */ if (bc->cf_last == NULL || bc->cf_last->inst != (type << 3) || bc->force_add_cf) { - /* at most 128 slots, one add alu can add 4 slots + 4 constant worst case */ r = r600_bc_add_cf(bc); if (r) { free(nalu); @@ -434,7 +433,9 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int } else { LIST_ADDTAIL(&nalu->bs_list, &bc->cf_last->curr_bs_head->bs_list); } - if (alu->last && (bc->cf_last->ndw >> 1) >= 124) { + /* at most 128 slots, one add alu can add 4 slots + 4 constants(2 slots) + * worst case */ + if (alu->last && (bc->cf_last->ndw >> 1) >= 120) { bc->force_add_cf = 1; } /* number of gpr == the last gpr used in any alu */ -- cgit v1.2.3 From d0ee833deec843742f80dc1d42b4ecc03ada06e2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 14:12:24 +0200 Subject: nvfx: allow setting NULL constant buffers --- src/gallium/drivers/nvfx/nvfx_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index b767846a99e..54619037d82 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -305,7 +305,7 @@ nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct nvfx_context *nvfx = nvfx_context(pipe); nvfx->constbuf[shader] = buf; - nvfx->constbuf_nr[shader] = buf->width0 / (4 * sizeof(float)); + nvfx->constbuf_nr[shader] = buf ? (buf->width0 / (4 * sizeof(float))) : 0; if (shader == PIPE_SHADER_VERTEX) { nvfx->dirty |= NVFX_NEW_VERTCONST; -- cgit v1.2.3 From b632d9fce3bd541795a863eb02ef8fbb72cdb9a2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 14:28:24 +0200 Subject: nvfx: add RGB framebuffer format support in addition to BGR --- src/gallium/drivers/nvfx/nvfx_screen.c | 2 ++ src/gallium/drivers/nvfx/nvfx_state_fb.c | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 3f177b7ed07..8024800bd09 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -194,6 +194,8 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_B8G8R8A8_UNORM: case PIPE_FORMAT_B8G8R8X8_UNORM: + case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: case PIPE_FORMAT_B5G6R5_UNORM: break; case PIPE_FORMAT_R16G16B16A16_FLOAT: diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c index 4ffc4de4520..30e48c80735 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_fb.c +++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c @@ -140,6 +140,12 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result) case 0: rt_format |= NV30_3D_RT_FORMAT_COLOR_A8R8G8B8; break; + case PIPE_FORMAT_R8G8B8X8_UNORM: + rt_format |= NV30_3D_RT_FORMAT_COLOR_X8B8G8R8; + break; + case PIPE_FORMAT_R8G8B8A8_UNORM: + rt_format |= NV30_3D_RT_FORMAT_COLOR_A8B8G8R8; + break; case PIPE_FORMAT_B5G6R5_UNORM: rt_format |= NV30_3D_RT_FORMAT_COLOR_R5G6B5; break; -- cgit v1.2.3 From f1063cfee213ba92f7c9e34199caccf4bed78c1c Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 14:28:31 +0200 Subject: d3d1x: don't crash on drivers not supporting vertex or geometry sampling --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 1 + src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h | 10 ++++++++-- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 42678fab4d0..27cfebc1b9c 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -125,6 +125,7 @@ struct GalliumD3D11Caps bool render_condition; unsigned constant_buffers[D3D11_STAGES]; unsigned stages; + unsigned stages_with_sampling; }; typedef GalliumDXGIDevice< diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index d7c1c921b71..4abb4ac6b0f 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -158,6 +158,12 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl } if(!pipe->set_stream_output_buffers) caps.so = false; + if(!pipe->set_geometry_sampler_views) + caps.stages_with_sampling &=~ (1 << PIPE_SHADER_GEOMETRY); + if(!pipe->set_fragment_sampler_views) + caps.stages_with_sampling &=~ (1 << PIPE_SHADER_FRAGMENT); + if(!pipe->set_vertex_sampler_views) + caps.stages_with_sampling &=~ (1 << PIPE_SHADER_VERTEX); update_flags = 0; @@ -505,7 +511,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl { while(num_shader_resource_views[s] && !sampler_views[s][num_shader_resource_views[s] - 1]) \ --num_shader_resource_views[s]; - if(s < caps.stages) + if((1 << s) & caps.stages_with_sampling) { struct pipe_sampler_view* views_to_bind[PIPE_MAX_SAMPLERS]; unsigned num_views_to_bind = shaders[s] ? shaders[s]->slot_to_resource.size() : 0; @@ -532,7 +538,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl { while(num_samplers[s] && !sampler_csos[s].v[num_samplers[s] - 1]) --num_samplers[s]; - if(s < caps.stages) + if((1 << s) & caps.stages_with_sampling) { void* samplers_to_bind[PIPE_MAX_SAMPLERS]; unsigned num_samplers_to_bind = shaders[s] ? shaders[s]->slot_to_sampler.size() : 0; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 528d32c4b1e..1ecd67ca474 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -101,6 +101,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen screen_caps.stages = i + 1; } + screen_caps.stages_with_sampling = (1 << screen_caps.stages) - 1; + if(!screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS)) + screen_caps.stages_with_sampling &=~ (1 << PIPE_SHADER_VERTEX); + memset(format_support, 0xff, sizeof(format_support)); float default_level; -- cgit v1.2.3 From db1fbb1efc10ee4853c3fbdf63567e62fdde7447 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 14:52:13 +0200 Subject: d3d1x: assert if X visual is not among enumerated visuals --- src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index ef256a80c79..a75a953abfb 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -902,6 +902,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectdisplay, (Window)window, &xwa); + assert(adapter->configs_by_native_visual_id.count(xwa.visual->visualid)); config_num = adapter->configs_by_native_visual_id[xwa.visual->visualid]; } else -- cgit v1.2.3 From 7e81c67c8b16c6f87e01320c9d9a7455a52cf91b Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 15:01:04 +0200 Subject: d3d1x: stop using GLX in demos, just use the default visual --- src/gallium/state_trackers/d3d1x/progs/Makefile | 2 +- .../state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp | 15 +++------------ .../state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp | 15 +++------------ 3 files changed, 7 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index 4766d3684d0..bb37012a3d7 100644 --- a/src/gallium/state_trackers/d3d1x/progs/Makefile +++ b/src/gallium/state_trackers/d3d1x/progs/Makefile @@ -13,7 +13,7 @@ LIBS= \ ../../../../../lib/libEGL.so LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS) LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS) -LDADD=-lGL -lXext -lXfixes -lX11 -ldrm -ldl +LDADD=-lXext -lXfixes -lX11 -ldrm -ldl all: bin/d3d10tri bin/d3d11tri bin/d3d11tex bin/d3d11gears include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp index a8f24ae3031..efbe322fe68 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp @@ -26,7 +26,6 @@ #include "d3d10app.h" #include -#include #include #include @@ -37,14 +36,6 @@ DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; static ID3D10Device* dev; static ID3D10Device* ctx; -static int attributeList[] = { - GLX_RGBA, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - None -}; - double get_time() { struct timeval tv; @@ -55,15 +46,15 @@ double get_time() int main(int argc, char** argv) { Display* dpy = XOpenDisplay(0); - XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList); - Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); + Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy)); + Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone); XSetWindowAttributes swa; swa.colormap = cmap; swa.border_pixel = 0; swa.event_mask = StructureNotifyMask; width = 512; height = 512; - Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap| CWEventMask, &swa); + Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa); XMapWindow(dpy, win); GalliumDXGIUseX11Display(dpy, 0); diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp index 8eb51d36387..1271499c4d3 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp @@ -1,6 +1,5 @@ #include "d3d11app.h" #include -#include #include #include @@ -11,14 +10,6 @@ DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; static ID3D11Device* dev; static ID3D11DeviceContext* ctx; -static int attributeList[] = { - GLX_RGBA, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - None -}; - double get_time() { struct timeval tv; @@ -29,15 +20,15 @@ double get_time() int main(int argc, char** argv) { Display* dpy = XOpenDisplay(0); - XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList); - Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); + Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy)); + Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone); XSetWindowAttributes swa; swa.colormap = cmap; swa.border_pixel = 0; swa.event_mask = StructureNotifyMask; width = 512; height = 512; - Window win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap| CWEventMask, &swa); + Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa); XMapWindow(dpy, win); GalliumDXGIUseX11Display(dpy, 0); -- cgit v1.2.3 From 11547654295cadcfde69f6c2361f50a4cd17fc7a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 24 Sep 2010 15:08:57 +0200 Subject: d3d1x: CRLF -> LF in progs --- .../state_trackers/d3d1x/progs/d3d10app/d3d10app.h | 102 +- .../d3d1x/progs/d3d10app/d3d10winmain.cpp | 376 +++--- .../d3d1x/progs/d3d10app/d3d10x11main.cpp | 308 ++--- .../d3d1x/progs/d3d10tri/d3d10tri.cpp | 236 ++-- .../d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h | 224 ++-- .../d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h | 256 ++-- .../state_trackers/d3d1x/progs/d3d11app/d3d11app.h | 102 +- .../d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h | 284 ++--- .../d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h | 260 ++-- .../state_trackers/d3d1x/progs/d3d11app/d3d11u.h | 848 ++++++------- .../d3d1x/progs/d3d11app/d3d11winmain.cpp | 344 +++--- .../d3d1x/progs/d3d11app/d3d11x11main.cpp | 228 ++-- .../d3d1x/progs/d3d11gears/d3d11gears.cpp | 1146 +++++++++--------- .../d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h | 618 +++++----- .../d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h | 616 +++++----- .../progs/d3d11spikysphere/d3d11spikysphere.cpp | 454 +++---- .../d3d11spikysphere/d3d11spikysphere.hlsl.ds.h | 1246 ++++++++++---------- .../d3d11spikysphere/d3d11spikysphere.hlsl.hs.h | 594 +++++----- .../d3d11spikysphere/d3d11spikysphere.hlsl.ps.h | 422 +++---- .../d3d11spikysphere/d3d11spikysphere.hlsl.vs.h | 210 ++-- .../d3d1x/progs/d3d11tex/d3d11tex.cpp | 232 ++-- .../d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h | 468 ++++---- .../d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h | 306 ++--- .../d3d1x/progs/d3d11tri/d3d11tri.cpp | 240 ++-- .../d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h | 224 ++-- .../d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h | 256 ++-- 26 files changed, 5300 insertions(+), 5300 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h index c27e66ed54b..59fe338f565 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h @@ -1,51 +1,51 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#ifndef D3D10APP_H -#define D3D10APP_H - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include -#include - -#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0) - -struct d3d10_application -{ - virtual ~d3d10_application() {} - - virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0; - virtual bool init(ID3D10Device* dev, int argc, char** argv) = 0; -}; - -/* this is the entry point you must provide */ -extern "C" d3d10_application* d3d10_application_create(); - -#endif +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef D3D10APP_H +#define D3D10APP_H + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0) + +struct d3d10_application +{ + virtual ~d3d10_application() {} + + virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0; + virtual bool init(ID3D10Device* dev, int argc, char** argv) = 0; +}; + +/* this is the entry point you must provide */ +extern "C" d3d10_application* d3d10_application_create(); + +#endif diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp index ac4798a108e..94680977ebd 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp @@ -1,188 +1,188 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#define INITGUID -#include "d3d10app.h" -#include "stdio.h" - -static d3d10_application* app; -static IDXGISwapChain* swap_chain; -static unsigned width, height; -static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; -static ID3D10Device* dev; -static ID3D10Device* ctx; -static int frames = 0; -static int buffer_count = 1; - -LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_SIZE: - width = lParam & 0xffff; - height = lParam >> 16; - - swap_chain->ResizeBuffers(buffer_count, width, height, format, 0); - frames = 0; - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - return DefWindowProc(hwnd, message, wParam, lParam); - } - return 0; -} - -int main(int argc, char** argv) -{ - HINSTANCE hInstance = GetModuleHandle(NULL); - WNDCLASSEXA wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = 0; - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = 0; - wcex.lpszClassName = "d3d10"; - wcex.hIconSm = 0; - - RegisterClassExA(&wcex); - - HWND hwnd = CreateWindowA("d3d10", "d3d10", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); - - if(!hwnd) - return FALSE; - - RECT rc; - GetClientRect(hwnd, &rc ); - width = rc.right - rc.left; - height = rc.bottom - rc.top; - - DXGI_SWAP_CHAIN_DESC swap_chain_desc; - memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); - swap_chain_desc.BufferDesc.Width = width; - swap_chain_desc.BufferDesc.Height = height; - swap_chain_desc.BufferDesc.Format = format; - swap_chain_desc.SampleDesc.Count = 1; - swap_chain_desc.SampleDesc.Quality = 0; - swap_chain_desc.OutputWindow = hwnd; - swap_chain_desc.Windowed = TRUE; - swap_chain_desc.BufferCount = buffer_count; - swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; - swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; - - D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0; - - HRESULT hr; - if(1) - { - hr = D3D10CreateDeviceAndSwapChain( - NULL, - D3D10_DRIVER_TYPE_HARDWARE, - NULL, - D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG, - D3D10_SDK_VERSION, - &swap_chain_desc, - &swap_chain, - &dev); - } - else - { - hr = D3D10CreateDeviceAndSwapChain1( - NULL, - D3D10_DRIVER_TYPE_HARDWARE, - NULL, - D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG, - feature_level, - D3D10_SDK_VERSION, - &swap_chain_desc, - &swap_chain, - (ID3D10Device1**)&dev); - } - - if(!SUCCEEDED(hr)) - { - fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr); - return 1; - } - - ctx = dev; - - app = d3d10_application_create(); - if(!app->init(dev, argc, argv)) - return 1; - - ShowWindow(hwnd, SW_SHOWDEFAULT); - UpdateWindow(hwnd); - - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - double period = 1.0 / (double)freq.QuadPart; - LARGE_INTEGER ctime_li; - QueryPerformanceCounter(&ctime_li); - double start_time = ctime_li.QuadPart * period; - - MSG msg; - for(;;) - { - if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - if(msg.message == WM_QUIT) - break; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - else if(width && height) - { - ID3D10Texture2D* tex; - static ID3D10RenderTargetView* rtv; - ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex)); - ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); - - QueryPerformanceCounter(&ctime_li); - double ctime = (double)ctime_li.QuadPart * period - start_time; - - app->draw(ctx, rtv, width, height, ctime); - ctx->OMSetRenderTargets(0, 0, 0); - - swap_chain->Present(0, 0); - rtv->Release(); - tex->Release(); - } - else - WaitMessage(); - } - return (int) msg.wParam; -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define INITGUID +#include "d3d10app.h" +#include "stdio.h" + +static d3d10_application* app; +static IDXGISwapChain* swap_chain; +static unsigned width, height; +static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D10Device* dev; +static ID3D10Device* ctx; +static int frames = 0; +static int buffer_count = 1; + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_SIZE: + width = lParam & 0xffff; + height = lParam >> 16; + + swap_chain->ResizeBuffers(buffer_count, width, height, format, 0); + frames = 0; + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + return 0; +} + +int main(int argc, char** argv) +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + WNDCLASSEXA wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = "d3d10"; + wcex.hIconSm = 0; + + RegisterClassExA(&wcex); + + HWND hwnd = CreateWindowA("d3d10", "d3d10", WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if(!hwnd) + return FALSE; + + RECT rc; + GetClientRect(hwnd, &rc ); + width = rc.right - rc.left; + height = rc.bottom - rc.top; + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = hwnd; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = buffer_count; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + + D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0; + + HRESULT hr; + if(1) + { + hr = D3D10CreateDeviceAndSwapChain( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev); + } + else + { + hr = D3D10CreateDeviceAndSwapChain1( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG, + feature_level, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + (ID3D10Device1**)&dev); + } + + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr); + return 1; + } + + ctx = dev; + + app = d3d10_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + ShowWindow(hwnd, SW_SHOWDEFAULT); + UpdateWindow(hwnd); + + LARGE_INTEGER freq; + QueryPerformanceFrequency(&freq); + double period = 1.0 / (double)freq.QuadPart; + LARGE_INTEGER ctime_li; + QueryPerformanceCounter(&ctime_li); + double start_time = ctime_li.QuadPart * period; + + MSG msg; + for(;;) + { + if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if(msg.message == WM_QUIT) + break; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if(width && height) + { + ID3D10Texture2D* tex; + static ID3D10RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + QueryPerformanceCounter(&ctime_li); + double ctime = (double)ctime_li.QuadPart * period - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + swap_chain->Present(0, 0); + rtv->Release(); + tex->Release(); + } + else + WaitMessage(); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp index efbe322fe68..8f07380056c 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp @@ -1,154 +1,154 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "d3d10app.h" -#include -#include -#include - -static d3d10_application* app; -static IDXGISwapChain* swap_chain; -unsigned width, height; -DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; -static ID3D10Device* dev; -static ID3D10Device* ctx; - -double get_time() -{ - struct timeval tv; - gettimeofday(&tv, 0); - return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001; -} - -int main(int argc, char** argv) -{ - Display* dpy = XOpenDisplay(0); - Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy)); - Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone); - XSetWindowAttributes swa; - swa.colormap = cmap; - swa.border_pixel = 0; - swa.event_mask = StructureNotifyMask; - width = 512; - height = 512; - Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa); - XMapWindow(dpy, win); - - GalliumDXGIUseX11Display(dpy, 0); - - DXGI_SWAP_CHAIN_DESC swap_chain_desc; - memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); - swap_chain_desc.BufferDesc.Width = width; - swap_chain_desc.BufferDesc.Height = height; - swap_chain_desc.BufferDesc.Format = format; - swap_chain_desc.SampleDesc.Count = 1; - swap_chain_desc.SampleDesc.Quality = 0; - swap_chain_desc.OutputWindow = (HWND)win; - swap_chain_desc.Windowed = TRUE; - swap_chain_desc.BufferCount = 3; - swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; - swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - - D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0; - - HRESULT hr; - if(0) - { - hr = D3D10CreateDeviceAndSwapChain( - NULL, - D3D10_DRIVER_TYPE_HARDWARE, - NULL, - D3D10_CREATE_DEVICE_SINGLETHREADED, - D3D10_SDK_VERSION, - &swap_chain_desc, - &swap_chain, - &dev); - } - else - { - hr = D3D10CreateDeviceAndSwapChain1( - NULL, - D3D10_DRIVER_TYPE_HARDWARE, - NULL, - D3D10_CREATE_DEVICE_SINGLETHREADED, - feature_level, - D3D10_SDK_VERSION, - &swap_chain_desc, - &swap_chain, - (ID3D10Device1**)&dev); - } - if(!SUCCEEDED(hr)) - { - fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr); - return 1; - } - ctx = dev; - - app = d3d10_application_create(); - if(!app->init(dev, argc, argv)) - return 1; - - double start_time = get_time(); - - MSG msg; - for(;;) - { - XEvent event; - if(XPending(dpy)) - { - XNextEvent(dpy, &event); - if(event.type == DestroyNotify) - break; - switch(event.type) - { - case ConfigureNotify: - width = event.xconfigure.width; - height = event.xconfigure.height; - swap_chain->ResizeBuffers(3, width, height, format, 0); - break; - } - } - else if(width && height) - { - ID3D10Texture2D* tex; - ID3D10RenderTargetView* rtv; - ensure(swap_chain->GetBuffer(0, IID_ID3D10Texture2D, (void**)&tex)); - ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); - - double ctime = get_time() - start_time; - - app->draw(ctx, rtv, width, height, ctime); - ctx->OMSetRenderTargets(0, 0, 0); - - tex->Release(); - rtv->Release(); - swap_chain->Present(0, 0); - } - else - XPeekEvent(dpy, &event); - } - return (int) msg.wParam; -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d10app.h" +#include +#include +#include + +static d3d10_application* app; +static IDXGISwapChain* swap_chain; +unsigned width, height; +DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D10Device* dev; +static ID3D10Device* ctx; + +double get_time() +{ + struct timeval tv; + gettimeofday(&tv, 0); + return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001; +} + +int main(int argc, char** argv) +{ + Display* dpy = XOpenDisplay(0); + Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy)); + Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone); + XSetWindowAttributes swa; + swa.colormap = cmap; + swa.border_pixel = 0; + swa.event_mask = StructureNotifyMask; + width = 512; + height = 512; + Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa); + XMapWindow(dpy, win); + + GalliumDXGIUseX11Display(dpy, 0); + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = (HWND)win; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = 3; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + + D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0; + + HRESULT hr; + if(0) + { + hr = D3D10CreateDeviceAndSwapChain( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev); + } + else + { + hr = D3D10CreateDeviceAndSwapChain1( + NULL, + D3D10_DRIVER_TYPE_HARDWARE, + NULL, + D3D10_CREATE_DEVICE_SINGLETHREADED, + feature_level, + D3D10_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + (ID3D10Device1**)&dev); + } + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr); + return 1; + } + ctx = dev; + + app = d3d10_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + double start_time = get_time(); + + MSG msg; + for(;;) + { + XEvent event; + if(XPending(dpy)) + { + XNextEvent(dpy, &event); + if(event.type == DestroyNotify) + break; + switch(event.type) + { + case ConfigureNotify: + width = event.xconfigure.width; + height = event.xconfigure.height; + swap_chain->ResizeBuffers(3, width, height, format, 0); + break; + } + } + else if(width && height) + { + ID3D10Texture2D* tex; + ID3D10RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, IID_ID3D10Texture2D, (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + double ctime = get_time() - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + tex->Release(); + rtv->Release(); + swap_chain->Present(0, 0); + } + else + XPeekEvent(dpy, &event); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp index 06ad811dec0..90b97f8a5d4 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp @@ -1,118 +1,118 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "d3d10app.h" -#include "d3d10tri.hlsl.ps.h" -#include "d3d10tri.hlsl.vs.h" - -struct vertex { - float position[4]; - float color[4]; -}; - -static struct vertex vertices[3] = -{ - { - { 0.0f, 0.9f, 0.5f, 1.0f }, - { 1.0f, 0.0f, 0.0f, 1.0f } - }, - { - { 0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 0.0f, 1.0f, 1.0f } - }, - { - { -0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 1.0f, 0.0f, 1.0f } - }, -}; - -struct d3d10tri : public d3d10_application -{ - ID3D10PixelShader* ps; - ID3D10VertexShader* vs; - ID3D10InputLayout* layout; - ID3D10Buffer* vb; - - virtual bool init(ID3D10Device* dev, int argc, char** argv) - { - ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), &ps)); - ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), &vs)); - - D3D10_INPUT_ELEMENT_DESC elements[] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0}, - }; - - ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout)); - D3D10_BUFFER_DESC bufferd; - bufferd.ByteWidth = sizeof(vertices); - bufferd.Usage = D3D10_USAGE_IMMUTABLE; - bufferd.BindFlags = D3D10_BIND_VERTEX_BUFFER; - bufferd.CPUAccessFlags = 0; - bufferd.MiscFlags = 0; - - D3D10_SUBRESOURCE_DATA buffersd; - buffersd.pSysMem = vertices; - buffersd.SysMemPitch = sizeof(vertices); - buffersd.SysMemSlicePitch = sizeof(vertices); - - ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); - - return true; - } - - virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) - { - float clear_color[4] = {1, 0, 1, 1}; - D3D10_VIEWPORT vp; - memset(&vp, 0, sizeof(vp)); - vp.Width = (unsigned)width; - vp.Height = (unsigned)height; - vp.MaxDepth = 1.0f; - - ctx->OMSetRenderTargets(1, &rtv, 0); - ctx->RSSetViewports(1, &vp); - - ctx->ClearRenderTargetView(rtv, clear_color); - - ctx->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - ctx->IASetInputLayout(layout); - unsigned stride = 2 * 4 * 4; - unsigned offset = 0; - ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); - - ctx->VSSetShader(vs); - ctx->PSSetShader(ps); - - ctx->Draw(3, 0); - } -}; - -d3d10_application* d3d10_application_create() -{ - return new d3d10tri(); -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d10app.h" +#include "d3d10tri.hlsl.ps.h" +#include "d3d10tri.hlsl.vs.h" + +struct vertex { + float position[4]; + float color[4]; +}; + +static struct vertex vertices[3] = +{ + { + { 0.0f, 0.9f, 0.5f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + }, + { + { 0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } + }, + { + { -0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } + }, +}; + +struct d3d10tri : public d3d10_application +{ + ID3D10PixelShader* ps; + ID3D10VertexShader* vs; + ID3D10InputLayout* layout; + ID3D10Buffer* vb; + + virtual bool init(ID3D10Device* dev, int argc, char** argv) + { + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), &vs)); + + D3D10_INPUT_ELEMENT_DESC elements[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0}, + }; + + ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout)); + D3D10_BUFFER_DESC bufferd; + bufferd.ByteWidth = sizeof(vertices); + bufferd.Usage = D3D10_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D10_BIND_VERTEX_BUFFER; + bufferd.CPUAccessFlags = 0; + bufferd.MiscFlags = 0; + + D3D10_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = vertices; + buffersd.SysMemPitch = sizeof(vertices); + buffersd.SysMemSlicePitch = sizeof(vertices); + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); + + return true; + } + + virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + float clear_color[4] = {1, 0, 1, 1}; + D3D10_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (unsigned)width; + vp.Height = (unsigned)height; + vp.MaxDepth = 1.0f; + + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->RSSetViewports(1, &vp); + + ctx->ClearRenderTargetView(rtv, clear_color); + + ctx->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ctx->IASetInputLayout(layout); + unsigned stride = 2 * 4 * 4; + unsigned offset = 0; + ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); + + ctx->VSSetShader(vs); + ctx->PSSetShader(ps); + + ctx->Draw(3, 0); + } +}; + +d3d10_application* d3d10_application_create() +{ + return new d3d10tri(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h index 3502d9f7292..bc55cf8a472 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h @@ -1,112 +1,112 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d10tri.hlsl.ps.h /Eps /Tps_4_0 d3d10tri.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float -// COLOR 0 xyzw 1 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_4_0 -dcl_input_ps linear v1.xyzw -dcl_output o0.xyzw -mov o0.xyzw, v1.xyzw -ret -// Approximately 2 instruction slots used -#endif - -const BYTE g_ps[] = -{ - 68, 88, 66, 67, 206, 120, - 117, 238, 118, 127, 10, 87, - 80, 75, 114, 198, 95, 2, - 120, 102, 1, 0, 0, 0, - 208, 1, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 224, 0, - 0, 0, 20, 1, 0, 0, - 84, 1, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 255, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 76, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 68, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 15, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 67, 79, 76, 79, 82, 0, - 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 65, 82, - 71, 69, 84, 0, 171, 171, - 83, 72, 68, 82, 56, 0, - 0, 0, 64, 0, 0, 0, - 14, 0, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, - 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d10tri.hlsl.ps.h /Eps /Tps_4_0 d3d10tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_input_ps linear v1.xyzw +dcl_output o0.xyzw +mov o0.xyzw, v1.xyzw +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 206, 120, + 117, 238, 118, 127, 10, 87, + 80, 75, 114, 198, 95, 2, + 120, 102, 1, 0, 0, 0, + 208, 1, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 20, 1, 0, 0, + 84, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 67, 79, 76, 79, 82, 0, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 171, 171, + 83, 72, 68, 82, 56, 0, + 0, 0, 64, 0, 0, 0, + 14, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h index 5c941d8a9f8..7204281ea81 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h @@ -1,128 +1,128 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d10tri.hlsl.vs.h /Evs /Tvs_4_0 d3d10tri.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyzw 0 NONE float xyzw -// COLOR 0 xyzw 1 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// COLOR 0 xyzw 1 NONE float xyzw -// -vs_4_0 -dcl_input v0.xyzw -dcl_input v1.xyzw -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -mov o0.xyzw, v0.xyzw -mov o1.xyzw, v1.xyzw -ret -// Approximately 3 instruction slots used -#endif - -const BYTE g_vs[] = -{ - 68, 88, 66, 67, 190, 171, - 186, 20, 44, 105, 95, 129, - 137, 204, 223, 72, 251, 159, - 126, 176, 1, 0, 0, 0, - 28, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 220, 0, - 0, 0, 48, 1, 0, 0, - 160, 1, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 254, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 72, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 65, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 15, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 67, 79, 76, - 79, 82, 0, 171, 79, 83, - 71, 78, 76, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 68, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 80, - 79, 83, 73, 84, 73, 79, - 78, 0, 67, 79, 76, 79, - 82, 0, 171, 171, 83, 72, - 68, 82, 104, 0, 0, 0, - 64, 0, 1, 0, 26, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, - 242, 32, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 1, 0, - 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 116, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d10tri.hlsl.vs.h /Evs /Tvs_4_0 d3d10tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xyzw +dcl_output_siv o0.xyzw, position +dcl_output o1.xyzw +mov o0.xyzw, v0.xyzw +mov o1.xyzw, v1.xyzw +ret +// Approximately 3 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 190, 171, + 186, 20, 44, 105, 95, 129, + 137, 204, 223, 72, 251, 159, + 126, 176, 1, 0, 0, 0, + 28, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 220, 0, + 0, 0, 48, 1, 0, 0, + 160, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 72, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 67, 79, 76, + 79, 82, 0, 171, 79, 83, + 71, 78, 76, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 83, 72, + 68, 82, 104, 0, 0, 0, + 64, 0, 1, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h index 9eb69d6f5d8..53de10ab3e7 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h @@ -1,51 +1,51 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#ifndef D3D11APP_H -#define D3D11APP_H - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include -#include - -#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0) - -struct d3d11_application -{ - virtual ~d3d11_application() {} - - virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0; - virtual bool init(ID3D11Device* dev, int argc, char** argv) = 0; -}; - -/* this is the entry point you must provide */ -extern "C" d3d11_application* d3d11_application_create(); - -#endif +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#ifndef D3D11APP_H +#define D3D11APP_H + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0) + +struct d3d11_application +{ + virtual ~d3d11_application() {} + + virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0; + virtual bool init(ID3D11Device* dev, int argc, char** argv) = 0; +}; + +/* this is the entry point you must provide */ +extern "C" d3d11_application* d3d11_application_create(); + +#endif diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h index d034c872224..5823b4c9764 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h @@ -1,142 +1,142 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11blit.hlsl.ps.h /Eps_blit /Tps_4_0 d3d11blit.hlsl -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// samp sampler NA NA 0 1 -// tex texture float4 2d 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_4_0 -dcl_sampler s0, mode_default -dcl_resource_texture2d (float,float,float,float) t0 -dcl_input_ps linear v1.xy -dcl_output o0.xyzw -sample o0.xyzw, v1.xyxx, t0.xyzw, s0 -ret -// Approximately 2 instruction slots used -#endif - -const BYTE g_ps_blit[] = -{ - 68, 88, 66, 67, 183, 100, - 39, 89, 244, 20, 241, 39, - 36, 169, 159, 230, 234, 214, - 114, 11, 1, 0, 0, 0, - 72, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 212, 0, 0, 0, 44, 1, - 0, 0, 96, 1, 0, 0, - 204, 1, 0, 0, 82, 68, - 69, 70, 152, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 255, 255, 0, 1, 0, 0, - 101, 0, 0, 0, 92, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 97, 0, 0, 0, 2, 0, - 0, 0, 5, 0, 0, 0, - 4, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 1, 0, 0, 0, 12, 0, - 0, 0, 115, 97, 109, 112, - 0, 116, 101, 120, 0, 77, - 105, 99, 114, 111, 115, 111, - 102, 116, 32, 40, 82, 41, - 32, 72, 76, 83, 76, 32, - 83, 104, 97, 100, 101, 114, - 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 73, 83, 71, 78, - 80, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 68, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 44, 0, - 0, 0, 1, 0, 0, 0, - 8, 0, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 83, 86, - 95, 84, 65, 82, 71, 69, - 84, 0, 171, 171, 83, 72, - 68, 82, 100, 0, 0, 0, - 64, 0, 0, 0, 25, 0, - 0, 0, 90, 0, 0, 3, - 0, 96, 16, 0, 0, 0, - 0, 0, 88, 24, 0, 4, - 0, 112, 16, 0, 0, 0, - 0, 0, 85, 85, 0, 0, - 98, 16, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, - 69, 0, 0, 9, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11blit.hlsl.ps.h /Eps_blit /Tps_4_0 d3d11blit.hlsl +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// samp sampler NA NA 0 1 +// tex texture float4 2d 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +sample o0.xyzw, v1.xyxx, t0.xyzw, s0 +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_ps_blit[] = +{ + 68, 88, 66, 67, 183, 100, + 39, 89, 244, 20, 241, 39, + 36, 169, 159, 230, 234, 214, + 114, 11, 1, 0, 0, 0, + 72, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 212, 0, 0, 0, 44, 1, + 0, 0, 96, 1, 0, 0, + 204, 1, 0, 0, 82, 68, + 69, 70, 152, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 101, 0, 0, 0, 92, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 97, 0, 0, 0, 2, 0, + 0, 0, 5, 0, 0, 0, + 4, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 1, 0, 0, 0, 12, 0, + 0, 0, 115, 97, 109, 112, + 0, 116, 101, 120, 0, 77, + 105, 99, 114, 111, 115, 111, + 102, 116, 32, 40, 82, 41, + 32, 72, 76, 83, 76, 32, + 83, 104, 97, 100, 101, 114, + 32, 67, 111, 109, 112, 105, + 108, 101, 114, 32, 57, 46, + 50, 57, 46, 57, 53, 50, + 46, 51, 49, 49, 49, 0, + 171, 171, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 68, 82, 100, 0, 0, 0, + 64, 0, 0, 0, 25, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h index 8e884d92484..5d9acd20f1d 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h @@ -1,130 +1,130 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11blit.hlsl.vs.h /Evs_blit /Tvs_4_0 d3d11blit.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyzw 0 NONE float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// -vs_4_0 -dcl_input v0.xyzw -dcl_input v1.xy -dcl_output_siv o0.xyzw, position -dcl_output o1.xy -mov o0.xyzw, v0.xyzw -mov o1.xy, v1.xyxx -ret -// Approximately 3 instruction slots used -#endif - -const BYTE g_vs_blit[] = -{ - 68, 88, 66, 67, 142, 11, - 173, 22, 73, 47, 224, 51, - 147, 83, 148, 177, 56, 17, - 72, 237, 1, 0, 0, 0, - 36, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 224, 0, - 0, 0, 56, 1, 0, 0, - 168, 1, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 254, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 76, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 65, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 84, 69, 88, - 67, 79, 79, 82, 68, 0, - 171, 171, 79, 83, 71, 78, - 80, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 68, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, - 83, 72, 68, 82, 104, 0, - 0, 0, 64, 0, 1, 0, - 26, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 95, 0, - 0, 3, 50, 16, 16, 0, - 1, 0, 0, 0, 103, 0, - 0, 4, 242, 32, 16, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 50, 32, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 50, 32, 16, 0, - 1, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11blit.hlsl.vs.h /Evs_blit /Tvs_4_0 d3d11blit.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output_siv o0.xyzw, position +dcl_output o1.xy +mov o0.xyzw, v0.xyzw +mov o1.xy, v1.xyxx +ret +// Approximately 3 instruction slots used +#endif + +const BYTE g_vs_blit[] = +{ + 68, 88, 66, 67, 142, 11, + 173, 22, 73, 47, 224, 51, + 147, 83, 148, 177, 56, 17, + 72, 237, 1, 0, 0, 0, + 36, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 56, 1, 0, 0, + 168, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 84, 69, 88, + 67, 79, 79, 82, 68, 0, + 171, 171, 79, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 83, 72, 68, 82, 104, 0, + 0, 0, 64, 0, 1, 0, + 26, 0, 0, 0, 95, 0, + 0, 3, 242, 16, 16, 0, + 0, 0, 0, 0, 95, 0, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 103, 0, + 0, 4, 242, 32, 16, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 50, 32, 16, 0, 1, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 30, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h index e67fa096060..1e0ce04ca65 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h @@ -1,424 +1,424 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include - -#include "d3d11blit.hlsl.ps.h" -#include "d3d11blit.hlsl.vs.h" - -template -struct triangle_list_indices : public std::vector -{ - unsigned base; - bool flip; - - triangle_list_indices() - : base(0), flip(false) - {} - - void poly(unsigned a, unsigned b, unsigned c) - { - this->push_back(base + a); - this->push_back(base + (flip ? c : b)); - this->push_back(base + (flip ? b : c)); - } - - void poly(unsigned a, unsigned b, unsigned c, unsigned d) - { - poly(a, b, c); - poly(a, c, d); - } - - void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e) - { - poly(a, b, c, d); - poly(a, d, e); - } - - void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f) - { - poly(a, b, c, d, e); - poly(a, e, f); - } - - void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g) - { - poly(a, b, c, d, e, f); - poly(a, f, g); - } - - void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g, unsigned h) - { - poly(a, b, c, d, e, f, g); - poly(a, g, h); - } -}; - -struct mesh -{ - ID3D11InputLayout* layout; - ID3D11Buffer* buffer; - D3D11_PRIMITIVE_TOPOLOGY topology; - unsigned vertex_size; - unsigned draw_count; - DXGI_FORMAT index_format; - unsigned index_offset; - - mesh(ID3D11Device* dev, D3D11_PRIMITIVE_TOPOLOGY topology, - const D3D11_INPUT_ELEMENT_DESC *elements, unsigned num_elements, - const void* vs, unsigned vs_size, - const void* vertices, unsigned vertex_size, unsigned num_vertices, - const void* indices = 0, unsigned index_size = 0, unsigned num_indices = 0) - : topology(topology), vertex_size(vertex_size), draw_count(index_size ? num_indices : num_vertices) - { - dev->CreateInputLayout(elements, num_elements, vs, vs_size, &layout); - if(index_size == 2) - index_format = DXGI_FORMAT_R16_UINT; - else if(index_size == 4) - index_format = DXGI_FORMAT_R32_UINT; - else - index_format = DXGI_FORMAT_UNKNOWN; - this->vertex_size = vertex_size; - index_offset = vertex_size * num_vertices; - - D3D11_BUFFER_DESC bufferd; - memset(&bufferd, 0, sizeof(bufferd)); - bufferd.Usage = D3D11_USAGE_IMMUTABLE; - bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; - if(index_format) - bufferd.BindFlags |= D3D11_BIND_INDEX_BUFFER; - bufferd.ByteWidth = index_offset + index_format * num_indices; - - char* data = (char*)malloc(bufferd.ByteWidth); - memcpy(data, vertices, vertex_size * num_vertices); - memcpy(data + index_offset, indices, index_size * num_indices); - - D3D11_SUBRESOURCE_DATA buffersd; - buffersd.pSysMem = data; - - ensure(dev->CreateBuffer(&bufferd, &buffersd, &buffer)); - free(data); - } - - ~mesh() - { - layout->Release(); - buffer->Release(); - } - - void bind(ID3D11DeviceContext* ctx) - { - unsigned offset = 0; - ctx->IASetPrimitiveTopology(topology); - ctx->IASetInputLayout(layout); - if(index_format) - ctx->IASetIndexBuffer(buffer, index_format, index_offset); - ctx->IASetVertexBuffers(0, 1, &buffer, &vertex_size, &offset); - } - - void draw_bound(ID3D11DeviceContext* ctx) - { - if(index_format) - ctx->DrawIndexed(draw_count, 0, 0); - else - ctx->Draw(draw_count, 0); - } - - void bind_and_draw(ID3D11DeviceContext* ctx) - { - bind(ctx); - draw_bound(ctx); - } -}; - -mesh* create_tex_quad(ID3D11Device* dev, const BYTE* vs, unsigned vs_size) -{ - float quad_data[] = { - -1, -1, 0, 1, - -1, 1, 0, 0, - 1, -1, 1, 1, - 1, 1, 1, 0, - }; - - D3D11_INPUT_ELEMENT_DESC elements[2] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - - return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, - elements, 2, - vs, vs_size, - quad_data, 4 * sizeof(float), 4, - 0, 0, 0); -} - -struct d3d11_blitter -{ - mesh* quad; - ID3D11VertexShader* vs; - ID3D11PixelShader* ps; - ID3D11SamplerState* sampler[2]; - - d3d11_blitter(ID3D11Device* dev) - { - quad = create_tex_quad(dev, g_vs_blit, sizeof(g_vs_blit)); - - dev->CreateVertexShader(g_vs_blit, sizeof(g_vs_blit), 0, &vs); - dev->CreatePixelShader(g_ps_blit, sizeof(g_ps_blit), 0, &ps); - - for(unsigned i = 0; i < 2; ++i) - { - D3D11_SAMPLER_DESC samplerd; - memset(&samplerd, 0, sizeof(samplerd)); - samplerd.Filter = i ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_LINEAR; - samplerd.AddressU = samplerd.AddressV = samplerd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - dev->CreateSamplerState(&samplerd, &sampler[i]); - } - } - - void bind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear) - { - D3D11_VIEWPORT vp; - vp.TopLeftX = x; - vp.TopLeftY = y; - vp.Width = width; - vp.Height = height; - vp.MinDepth = 0; - vp.MaxDepth = 1; - ctx->RSSetViewports(1, &vp); - ctx->RSSetState(0); - ctx->OMSetBlendState(0, 0, ~0); - ctx->OMSetDepthStencilState(0, 0); - ctx->OMSetRenderTargets(1, &rtv, 0); - ctx->VSSetShader(vs, 0, 0); - ctx->PSSetShader(ps, 0, 0); - ctx->PSSetShaderResources(0, 1, &srv); - ctx->PSSetSamplers(0, 1, &sampler[!!linear]); - quad->bind(ctx); - } - - void draw_bound(ID3D11DeviceContext* ctx) - { - quad->draw_bound(ctx); - } - - void bind_draw_and_unbind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear) - { - bind(ctx, srv, rtv, x, y, width, height, linear); - draw_bound(ctx); - unbind(ctx); - } - - void unbind(ID3D11DeviceContext* ctx) - { - void* null = 0; - ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&null); - ctx->PSSetSamplers(0, 1, (ID3D11SamplerState**)&null); - } -}; - -template -struct vec_t -{ - T v[n]; - - T& operator [](unsigned i) - { - return v[i]; - } - - const T& operator [](unsigned i) const - { - return v[i]; - } -}; - -template -vec_t operator -(const vec_t a) -{ - vec_t r; - for(unsigned i = 0; i < n; ++i) - r[i] = -a[i]; - return r; -} - -template -vec_t operator +(const vec_t& a, const vec_t& b) -{ - vec_t r; - for(unsigned i = 0; i < n; ++i) - r[i] = a[i] + b[i]; - return r; -} - -template -vec_t& operator +=(vec_t& a, const vec_t& b) -{ - for(unsigned i = 0; i < n; ++i) - a[i] += b[i]; - return a; -} - -template -struct mat_t : public vec_t, c> -{}; - -template -vec_t operator *(const vec_t& a, const T& b) -{ - vec_t r; - for(unsigned i = 0; i < n; ++i) - r[i] = a[i] * b; - return r; -} - -template -vec_t operator *(const T& b, const vec_t& a) -{ - vec_t r; - for(unsigned i = 0; i < n; ++i) - r[i] = a[i] * b; - return r; -} - -template -vec_t operator *(const mat_t& m, const vec_t& b) -{ - vec_t r; - r = m[0] * b[0]; - for(unsigned i = 1; i < d; ++i) - r += m[i] * b[i]; - return r; -} - -template -mat_t operator *(const mat_t& m, const mat_t& b) -{ - mat_t r; - for(unsigned i = 0; i < d; ++i) - r[i] = m * b[i]; - return r; -} - -template -vec_t vec(T a, T b, T c) -{ - vec_t v; - v[0] = a; - v[1] = b; - v[2] = c; - return v; -} - -template -vec_t vec(T a, T b, T c, T d) -{ - vec_t v; - v[0] = a; - v[1] = b; - v[2] = c; - v[3] = d; - return v; -} - -typedef mat_t float4x4; -typedef mat_t float4x3; -typedef mat_t float3x4; -typedef mat_t float3x3; - -typedef vec_t float3; -typedef vec_t float4; - -template -mat_t mat4x4_frustum(T left, T right, T bottom, T top, T nearval, T farval) -{ - T x = (2.0f * nearval) / (right - left); - T y = (2.0f * nearval) / (top - bottom); - T a = (right + left) / (right - left); - T b = (top + bottom) / (top - bottom); - T c = -(farval + nearval) / (farval - nearval); - T d = -(2.0f * farval * nearval) / (farval - nearval); - T _0 = (T)0; - - mat_t m; - m[0] = vec(x, _0, _0, _0); - m[1] = vec(_0, y, _0, _0); - m[2] = vec(a, b, c, (T)-1); - m[3] = vec(_0, _0, d, _0); - return m; -} - -template -mat_t mat3x3_diag(T v) -{ - mat_t m; - T _0 = (T)0; - m[0] = vec(v, _0, _0); - m[1] = vec(_0, v, _0); - m[2] = vec(_0, _0, v); - return m; -} - -template -mat_t mat4x4_diag(T v) -{ - mat_t m; - T _0 = (T)0; - m[0] = vec(v, _0, _0, _0); - m[1] = vec(_0, v, _0, _0); - m[2] = vec(_0, _0, v, _0); - m[3] = vec(_0, _0, _0, v); - return m; -} - -template -mat_t mat_push_rotate(const mat_t& m, unsigned axis, T angle) -{ - T s = (T)sin(angle); - T c = (T)cos(angle); - - mat_t r = m; - unsigned a = (axis + 1) % 3; - unsigned b = (axis + 2) % 3; - r[a] = (m[a] * c) + (m[b] * s); - r[b] = -(m[a] * s) + (m[b] * c); - return r; -} - -template -mat_t mat_push_translate(const mat_t& m, float x, float y, float z) -{ - mat_t r = m; - vec_t v; - v[0] = x; - v[1] = y; - v[2] = z; - if(n >= 4) - v[3] = (T)0; - r[3] += m * v; - return r; -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include + +#include "d3d11blit.hlsl.ps.h" +#include "d3d11blit.hlsl.vs.h" + +template +struct triangle_list_indices : public std::vector +{ + unsigned base; + bool flip; + + triangle_list_indices() + : base(0), flip(false) + {} + + void poly(unsigned a, unsigned b, unsigned c) + { + this->push_back(base + a); + this->push_back(base + (flip ? c : b)); + this->push_back(base + (flip ? b : c)); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d) + { + poly(a, b, c); + poly(a, c, d); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e) + { + poly(a, b, c, d); + poly(a, d, e); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f) + { + poly(a, b, c, d, e); + poly(a, e, f); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g) + { + poly(a, b, c, d, e, f); + poly(a, f, g); + } + + void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g, unsigned h) + { + poly(a, b, c, d, e, f, g); + poly(a, g, h); + } +}; + +struct mesh +{ + ID3D11InputLayout* layout; + ID3D11Buffer* buffer; + D3D11_PRIMITIVE_TOPOLOGY topology; + unsigned vertex_size; + unsigned draw_count; + DXGI_FORMAT index_format; + unsigned index_offset; + + mesh(ID3D11Device* dev, D3D11_PRIMITIVE_TOPOLOGY topology, + const D3D11_INPUT_ELEMENT_DESC *elements, unsigned num_elements, + const void* vs, unsigned vs_size, + const void* vertices, unsigned vertex_size, unsigned num_vertices, + const void* indices = 0, unsigned index_size = 0, unsigned num_indices = 0) + : topology(topology), vertex_size(vertex_size), draw_count(index_size ? num_indices : num_vertices) + { + dev->CreateInputLayout(elements, num_elements, vs, vs_size, &layout); + if(index_size == 2) + index_format = DXGI_FORMAT_R16_UINT; + else if(index_size == 4) + index_format = DXGI_FORMAT_R32_UINT; + else + index_format = DXGI_FORMAT_UNKNOWN; + this->vertex_size = vertex_size; + index_offset = vertex_size * num_vertices; + + D3D11_BUFFER_DESC bufferd; + memset(&bufferd, 0, sizeof(bufferd)); + bufferd.Usage = D3D11_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + if(index_format) + bufferd.BindFlags |= D3D11_BIND_INDEX_BUFFER; + bufferd.ByteWidth = index_offset + index_format * num_indices; + + char* data = (char*)malloc(bufferd.ByteWidth); + memcpy(data, vertices, vertex_size * num_vertices); + memcpy(data + index_offset, indices, index_size * num_indices); + + D3D11_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = data; + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &buffer)); + free(data); + } + + ~mesh() + { + layout->Release(); + buffer->Release(); + } + + void bind(ID3D11DeviceContext* ctx) + { + unsigned offset = 0; + ctx->IASetPrimitiveTopology(topology); + ctx->IASetInputLayout(layout); + if(index_format) + ctx->IASetIndexBuffer(buffer, index_format, index_offset); + ctx->IASetVertexBuffers(0, 1, &buffer, &vertex_size, &offset); + } + + void draw_bound(ID3D11DeviceContext* ctx) + { + if(index_format) + ctx->DrawIndexed(draw_count, 0, 0); + else + ctx->Draw(draw_count, 0); + } + + void bind_and_draw(ID3D11DeviceContext* ctx) + { + bind(ctx); + draw_bound(ctx); + } +}; + +mesh* create_tex_quad(ID3D11Device* dev, const BYTE* vs, unsigned vs_size) +{ + float quad_data[] = { + -1, -1, 0, 1, + -1, 1, 0, 0, + 1, -1, 1, 1, + 1, 1, 1, 0, + }; + + D3D11_INPUT_ELEMENT_DESC elements[2] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + elements, 2, + vs, vs_size, + quad_data, 4 * sizeof(float), 4, + 0, 0, 0); +} + +struct d3d11_blitter +{ + mesh* quad; + ID3D11VertexShader* vs; + ID3D11PixelShader* ps; + ID3D11SamplerState* sampler[2]; + + d3d11_blitter(ID3D11Device* dev) + { + quad = create_tex_quad(dev, g_vs_blit, sizeof(g_vs_blit)); + + dev->CreateVertexShader(g_vs_blit, sizeof(g_vs_blit), 0, &vs); + dev->CreatePixelShader(g_ps_blit, sizeof(g_ps_blit), 0, &ps); + + for(unsigned i = 0; i < 2; ++i) + { + D3D11_SAMPLER_DESC samplerd; + memset(&samplerd, 0, sizeof(samplerd)); + samplerd.Filter = i ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_LINEAR; + samplerd.AddressU = samplerd.AddressV = samplerd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + dev->CreateSamplerState(&samplerd, &sampler[i]); + } + } + + void bind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear) + { + D3D11_VIEWPORT vp; + vp.TopLeftX = x; + vp.TopLeftY = y; + vp.Width = width; + vp.Height = height; + vp.MinDepth = 0; + vp.MaxDepth = 1; + ctx->RSSetViewports(1, &vp); + ctx->RSSetState(0); + ctx->OMSetBlendState(0, 0, ~0); + ctx->OMSetDepthStencilState(0, 0); + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->VSSetShader(vs, 0, 0); + ctx->PSSetShader(ps, 0, 0); + ctx->PSSetShaderResources(0, 1, &srv); + ctx->PSSetSamplers(0, 1, &sampler[!!linear]); + quad->bind(ctx); + } + + void draw_bound(ID3D11DeviceContext* ctx) + { + quad->draw_bound(ctx); + } + + void bind_draw_and_unbind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear) + { + bind(ctx, srv, rtv, x, y, width, height, linear); + draw_bound(ctx); + unbind(ctx); + } + + void unbind(ID3D11DeviceContext* ctx) + { + void* null = 0; + ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&null); + ctx->PSSetSamplers(0, 1, (ID3D11SamplerState**)&null); + } +}; + +template +struct vec_t +{ + T v[n]; + + T& operator [](unsigned i) + { + return v[i]; + } + + const T& operator [](unsigned i) const + { + return v[i]; + } +}; + +template +vec_t operator -(const vec_t a) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = -a[i]; + return r; +} + +template +vec_t operator +(const vec_t& a, const vec_t& b) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = a[i] + b[i]; + return r; +} + +template +vec_t& operator +=(vec_t& a, const vec_t& b) +{ + for(unsigned i = 0; i < n; ++i) + a[i] += b[i]; + return a; +} + +template +struct mat_t : public vec_t, c> +{}; + +template +vec_t operator *(const vec_t& a, const T& b) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = a[i] * b; + return r; +} + +template +vec_t operator *(const T& b, const vec_t& a) +{ + vec_t r; + for(unsigned i = 0; i < n; ++i) + r[i] = a[i] * b; + return r; +} + +template +vec_t operator *(const mat_t& m, const vec_t& b) +{ + vec_t r; + r = m[0] * b[0]; + for(unsigned i = 1; i < d; ++i) + r += m[i] * b[i]; + return r; +} + +template +mat_t operator *(const mat_t& m, const mat_t& b) +{ + mat_t r; + for(unsigned i = 0; i < d; ++i) + r[i] = m * b[i]; + return r; +} + +template +vec_t vec(T a, T b, T c) +{ + vec_t v; + v[0] = a; + v[1] = b; + v[2] = c; + return v; +} + +template +vec_t vec(T a, T b, T c, T d) +{ + vec_t v; + v[0] = a; + v[1] = b; + v[2] = c; + v[3] = d; + return v; +} + +typedef mat_t float4x4; +typedef mat_t float4x3; +typedef mat_t float3x4; +typedef mat_t float3x3; + +typedef vec_t float3; +typedef vec_t float4; + +template +mat_t mat4x4_frustum(T left, T right, T bottom, T top, T nearval, T farval) +{ + T x = (2.0f * nearval) / (right - left); + T y = (2.0f * nearval) / (top - bottom); + T a = (right + left) / (right - left); + T b = (top + bottom) / (top - bottom); + T c = -(farval + nearval) / (farval - nearval); + T d = -(2.0f * farval * nearval) / (farval - nearval); + T _0 = (T)0; + + mat_t m; + m[0] = vec(x, _0, _0, _0); + m[1] = vec(_0, y, _0, _0); + m[2] = vec(a, b, c, (T)-1); + m[3] = vec(_0, _0, d, _0); + return m; +} + +template +mat_t mat3x3_diag(T v) +{ + mat_t m; + T _0 = (T)0; + m[0] = vec(v, _0, _0); + m[1] = vec(_0, v, _0); + m[2] = vec(_0, _0, v); + return m; +} + +template +mat_t mat4x4_diag(T v) +{ + mat_t m; + T _0 = (T)0; + m[0] = vec(v, _0, _0, _0); + m[1] = vec(_0, v, _0, _0); + m[2] = vec(_0, _0, v, _0); + m[3] = vec(_0, _0, _0, v); + return m; +} + +template +mat_t mat_push_rotate(const mat_t& m, unsigned axis, T angle) +{ + T s = (T)sin(angle); + T c = (T)cos(angle); + + mat_t r = m; + unsigned a = (axis + 1) % 3; + unsigned b = (axis + 2) % 3; + r[a] = (m[a] * c) + (m[b] * s); + r[b] = -(m[a] * s) + (m[b] * c); + return r; +} + +template +mat_t mat_push_translate(const mat_t& m, float x, float y, float z) +{ + mat_t r = m; + vec_t v; + v[0] = x; + v[1] = y; + v[2] = z; + if(n >= 4) + v[3] = (T)0; + r[3] += m * v; + return r; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp index 76903e57f09..8e71ec367ea 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp @@ -1,172 +1,172 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#define INITGUID -#include "d3d11app.h" -#include "stdio.h" - -static d3d11_application* app; -static IDXGISwapChain* swap_chain; -static unsigned width, height; -static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; -static ID3D11Device* dev; -static ID3D11DeviceContext* ctx; -static int frames = 0; -static int buffer_count = 1; - -LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_SIZE: - width = lParam & 0xffff; - height = lParam >> 16; - - swap_chain->ResizeBuffers(buffer_count, width, height, format, 0); - frames = 0; - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - return DefWindowProc(hwnd, message, wParam, lParam); - } - return 0; -} - -int main(int argc, char** argv) -{ - HINSTANCE hInstance = GetModuleHandle(NULL); - WNDCLASSEXA wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = 0; - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = 0; - wcex.lpszClassName = "d3d11"; - wcex.hIconSm = 0; - - RegisterClassExA(&wcex); - - HWND hwnd = CreateWindowA("d3d11", "d3d11", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); - - if(!hwnd) - return FALSE; - - RECT rc; - GetClientRect(hwnd, &rc ); - width = rc.right - rc.left; - height = rc.bottom - rc.top; - - DXGI_SWAP_CHAIN_DESC swap_chain_desc; - memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); - swap_chain_desc.BufferDesc.Width = width; - swap_chain_desc.BufferDesc.Height = height; - swap_chain_desc.BufferDesc.Format = format; - swap_chain_desc.SampleDesc.Count = 1; - swap_chain_desc.SampleDesc.Quality = 0; - swap_chain_desc.OutputWindow = hwnd; - swap_chain_desc.Windowed = TRUE; - swap_chain_desc.BufferCount = buffer_count; - swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; - swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; - - D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; - - HRESULT hr = D3D11CreateDeviceAndSwapChain( - NULL, - D3D_DRIVER_TYPE_HARDWARE, - NULL, - D3D11_CREATE_DEVICE_SINGLETHREADED, // | D3D11_CREATE_DEVICE_DEBUG, - NULL, - 0, - D3D11_SDK_VERSION, - &swap_chain_desc, - &swap_chain, - &dev, - &feature_level, - &ctx); - if(!SUCCEEDED(hr)) - { - fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr); - return 1; - } - - app = d3d11_application_create(); - if(!app->init(dev, argc, argv)) - return 1; - - ShowWindow(hwnd, SW_SHOWDEFAULT); - UpdateWindow(hwnd); - - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - double period = 1.0 / (double)freq.QuadPart; - LARGE_INTEGER ctime_li; - QueryPerformanceCounter(&ctime_li); - double start_time = ctime_li.QuadPart * period; - - MSG msg; - for(;;) - { - if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - if(msg.message == WM_QUIT) - break; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - else if(width && height) - { - ID3D11Texture2D* tex; - static ID3D11RenderTargetView* rtv; - ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex)); - ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); - - QueryPerformanceCounter(&ctime_li); - double ctime = (double)ctime_li.QuadPart * period - start_time; - - app->draw(ctx, rtv, width, height, ctime); - ctx->OMSetRenderTargets(0, 0, 0); - - swap_chain->Present(0, 0); - rtv->Release(); - tex->Release(); - } - else - WaitMessage(); - } - return (int) msg.wParam; -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define INITGUID +#include "d3d11app.h" +#include "stdio.h" + +static d3d11_application* app; +static IDXGISwapChain* swap_chain; +static unsigned width, height; +static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D11Device* dev; +static ID3D11DeviceContext* ctx; +static int frames = 0; +static int buffer_count = 1; + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_SIZE: + width = lParam & 0xffff; + height = lParam >> 16; + + swap_chain->ResizeBuffers(buffer_count, width, height, format, 0); + frames = 0; + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + return 0; +} + +int main(int argc, char** argv) +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + WNDCLASSEXA wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = "d3d11"; + wcex.hIconSm = 0; + + RegisterClassExA(&wcex); + + HWND hwnd = CreateWindowA("d3d11", "d3d11", WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if(!hwnd) + return FALSE; + + RECT rc; + GetClientRect(hwnd, &rc ); + width = rc.right - rc.left; + height = rc.bottom - rc.top; + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = hwnd; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = buffer_count; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + + D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; + + HRESULT hr = D3D11CreateDeviceAndSwapChain( + NULL, + D3D_DRIVER_TYPE_HARDWARE, + NULL, + D3D11_CREATE_DEVICE_SINGLETHREADED, // | D3D11_CREATE_DEVICE_DEBUG, + NULL, + 0, + D3D11_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev, + &feature_level, + &ctx); + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr); + return 1; + } + + app = d3d11_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + ShowWindow(hwnd, SW_SHOWDEFAULT); + UpdateWindow(hwnd); + + LARGE_INTEGER freq; + QueryPerformanceFrequency(&freq); + double period = 1.0 / (double)freq.QuadPart; + LARGE_INTEGER ctime_li; + QueryPerformanceCounter(&ctime_li); + double start_time = ctime_li.QuadPart * period; + + MSG msg; + for(;;) + { + if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if(msg.message == WM_QUIT) + break; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if(width && height) + { + ID3D11Texture2D* tex; + static ID3D11RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + QueryPerformanceCounter(&ctime_li); + double ctime = (double)ctime_li.QuadPart * period - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + swap_chain->Present(0, 0); + rtv->Release(); + tex->Release(); + } + else + WaitMessage(); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp index 1271499c4d3..2fadf4eecd2 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp @@ -1,114 +1,114 @@ -#include "d3d11app.h" -#include -#include -#include - -static d3d11_application* app; -static IDXGISwapChain* swap_chain; -unsigned width, height; -DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; -static ID3D11Device* dev; -static ID3D11DeviceContext* ctx; - -double get_time() -{ - struct timeval tv; - gettimeofday(&tv, 0); - return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001; -} - -int main(int argc, char** argv) -{ - Display* dpy = XOpenDisplay(0); - Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy)); - Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone); - XSetWindowAttributes swa; - swa.colormap = cmap; - swa.border_pixel = 0; - swa.event_mask = StructureNotifyMask; - width = 512; - height = 512; - Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa); - XMapWindow(dpy, win); - - GalliumDXGIUseX11Display(dpy, 0); - - DXGI_SWAP_CHAIN_DESC swap_chain_desc; - memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); - swap_chain_desc.BufferDesc.Width = width; - swap_chain_desc.BufferDesc.Height = height; - swap_chain_desc.BufferDesc.Format = format; - swap_chain_desc.SampleDesc.Count = 1; - swap_chain_desc.SampleDesc.Quality = 0; - swap_chain_desc.OutputWindow = (HWND)win; - swap_chain_desc.Windowed = TRUE; - swap_chain_desc.BufferCount = 3; - swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; - swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - - D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; - - HRESULT hr =D3D11CreateDeviceAndSwapChain( - NULL, - D3D_DRIVER_TYPE_HARDWARE, - NULL, - D3D11_CREATE_DEVICE_SINGLETHREADED, - NULL, - 0, - D3D11_SDK_VERSION, - &swap_chain_desc, - &swap_chain, - &dev, - &feature_level, - &ctx); - if(!SUCCEEDED(hr)) - { - fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr); - return 1; - } - - app = d3d11_application_create(); - if(!app->init(dev, argc, argv)) - return 1; - - double start_time = get_time(); - - MSG msg; - for(;;) - { - XEvent event; - if(XPending(dpy)) - { - XNextEvent(dpy, &event); - if(event.type == DestroyNotify) - break; - switch(event.type) - { - case ConfigureNotify: - width = event.xconfigure.width; - height = event.xconfigure.height; - swap_chain->ResizeBuffers(3, width, height, format, 0); - break; - } - } - else if(width && height) - { - ID3D11Texture2D* tex; - ID3D11RenderTargetView* rtv; - ensure(swap_chain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&tex)); - ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); - - double ctime = get_time() - start_time; - - app->draw(ctx, rtv, width, height, ctime); - ctx->OMSetRenderTargets(0, 0, 0); - - tex->Release(); - rtv->Release(); - swap_chain->Present(0, 0); - } - else - XPeekEvent(dpy, &event); - } - return (int) msg.wParam; -} +#include "d3d11app.h" +#include +#include +#include + +static d3d11_application* app; +static IDXGISwapChain* swap_chain; +unsigned width, height; +DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; +static ID3D11Device* dev; +static ID3D11DeviceContext* ctx; + +double get_time() +{ + struct timeval tv; + gettimeofday(&tv, 0); + return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001; +} + +int main(int argc, char** argv) +{ + Display* dpy = XOpenDisplay(0); + Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy)); + Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone); + XSetWindowAttributes swa; + swa.colormap = cmap; + swa.border_pixel = 0; + swa.event_mask = StructureNotifyMask; + width = 512; + height = 512; + Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa); + XMapWindow(dpy, win); + + GalliumDXGIUseX11Display(dpy, 0); + + DXGI_SWAP_CHAIN_DESC swap_chain_desc; + memset(&swap_chain_desc, 0, sizeof(swap_chain_desc)); + swap_chain_desc.BufferDesc.Width = width; + swap_chain_desc.BufferDesc.Height = height; + swap_chain_desc.BufferDesc.Format = format; + swap_chain_desc.SampleDesc.Count = 1; + swap_chain_desc.SampleDesc.Quality = 0; + swap_chain_desc.OutputWindow = (HWND)win; + swap_chain_desc.Windowed = TRUE; + swap_chain_desc.BufferCount = 3; + swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + + D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0; + + HRESULT hr =D3D11CreateDeviceAndSwapChain( + NULL, + D3D_DRIVER_TYPE_HARDWARE, + NULL, + D3D11_CREATE_DEVICE_SINGLETHREADED, + NULL, + 0, + D3D11_SDK_VERSION, + &swap_chain_desc, + &swap_chain, + &dev, + &feature_level, + &ctx); + if(!SUCCEEDED(hr)) + { + fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr); + return 1; + } + + app = d3d11_application_create(); + if(!app->init(dev, argc, argv)) + return 1; + + double start_time = get_time(); + + MSG msg; + for(;;) + { + XEvent event; + if(XPending(dpy)) + { + XNextEvent(dpy, &event); + if(event.type == DestroyNotify) + break; + switch(event.type) + { + case ConfigureNotify: + width = event.xconfigure.width; + height = event.xconfigure.height; + swap_chain->ResizeBuffers(3, width, height, format, 0); + break; + } + } + else if(width && height) + { + ID3D11Texture2D* tex; + ID3D11RenderTargetView* rtv; + ensure(swap_chain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&tex)); + ensure(dev->CreateRenderTargetView(tex, NULL, &rtv)); + + double ctime = get_time() - start_time; + + app->draw(ctx, rtv, width, height, ctime); + ctx->OMSetRenderTargets(0, 0, 0); + + tex->Release(); + rtv->Release(); + swap_chain->Present(0, 0); + } + else + XPeekEvent(dpy, &event); + } + return (int) msg.wParam; +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp index de9946c67e8..0edf1f2ef13 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp @@ -1,573 +1,573 @@ -/* -* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. -* Copyright (C) 2009-2010 Luca Barbieri 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, sublicense, -* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -* BRIAN PAUL 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. -*/ - -/* -* This is a port of the infamous "glxgears" demo to straight EGL -* Port by Dane Rushton 10 July 2005 -* -* This a rewrite of the 'eglgears' demo in straight Gallium -* Port by Luca Barbieri -* -* This a port of the 'galliumgears' demo to Direct3D 11 -* Port by Luca Barbieri -*/ - -#define _USE_MATH_DEFINES -#include "d3d11app.h" -#include "d3d11u.h" -#include "d3d11gears.hlsl.ps.h" -#include "d3d11gears.hlsl.vs.h" - -#include -#include -#include -#include - -struct gear -{ - struct mesh* mesh; - float x; - float y; - float t0; - float wmul; - float4 color; -}; - -struct cbuf_t -{ - float4x4 projection; - float4x4 modelview; - float4 light; - float4 diffuse; - float4 specular; - float specular_power; - float padding[3]; -}; - -struct gear gears[3]; - -struct vertex -{ - float position[3]; - float normal[3]; - - vertex(float x, float y, float z, float nx, float ny, float nz) - { - position[0] = x; - position[1] = y; - position[2] = z; - normal[0] = nx; - normal[1] = ny; - normal[2] = nz; - } -}; - -#define VERT(x, y, z) vertices.push_back(vertex((x), (y), (z), (nx), (ny), (nz))) - -static mesh* build_gear(ID3D11Device* dev, int triangle_budget, float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) -{ - int i, j, k; - float r0, r1, r2; - float da; - float nx, ny, nz; - int face; - int segs = 4; - int base_triangles = teeth * segs * 2 * 2; - int divs0 = (triangle_budget / base_triangles) - 1; - int divs = (divs0 > 0) ? divs0 : 1; - float* c = (float*)malloc(teeth * segs * sizeof(float)); - float* s = (float*)malloc(teeth * segs * sizeof(float)); - float* dc = (float*)malloc(teeth * segs * divs * sizeof(float)); - float* ds = (float*)malloc(teeth * segs * divs * sizeof(float)); - int num_vertices = teeth * segs * 2 * (3 + 2 * divs); - int num_triangles = base_triangles * (1 + divs); - printf("Creating gear with %i teeth using %i vertices used in %i triangles\n", teeth, num_vertices, num_triangles); - triangle_list_indices<> indices; - std::vector vertices; - - r0 = inner_radius; - r1 = outer_radius - tooth_depth / 2.0f; - r2 = outer_radius + tooth_depth / 2.0f; - - da = (float)(2.0 * M_PI / (teeth * segs * divs)); - for(i = 0; i < teeth * segs * divs; ++i) { - float angle = da * i; - ds[i] = sin(angle); - dc[i] = cos(angle); - } - - for(i = 0; i < teeth * segs; ++i) { - s[i] = ds[i * divs]; - c[i] = dc[i * divs]; - } - - /* faces */ - for(face = -1; face <= 1; face += 2) { - float z = width * face * 0.5f; - nx = 0.0f; - ny = 0.0f; - nz = (float)face; - - indices.flip = face > 0; - - assert(segs == 4); - for(i = 0; i < teeth; ++i) { - VERT(r1 * c[segs * i], r1 * s[segs * i], z); - VERT(r2 * c[segs * i + 1], r2 * s[segs * i + 1], z); - VERT(r2 * c[segs * i + 2], r2 * s[segs * i + 2], z); - VERT(r1 * c[segs * i + 3], r1 * s[segs * i + 3], z); - } - - for(i = 0; i < teeth * segs * divs; ++i) { - VERT(r0 * dc[i], r0 * ds[i], z); - } - - for(i = 0; i < teeth; ++i) { - for(j = i * segs; j < (i + 1) * segs; ++j) { - int nextj = j + 1; - if(nextj == teeth * segs) - nextj = 0; - - for(k = j * divs; k < (j + 1) * divs; ++k) { - int nextk = k + 1; - if(nextk == teeth * segs * divs) - nextk = 0; - indices.poly(teeth * segs + k, j, teeth * segs + nextk); - } - - indices.poly(teeth * segs + nextj * divs, j, nextj); - } - } - - indices.base += teeth * segs * (1 + divs); - } - - /* teeth faces */ - indices.flip = true; - float z = width * 0.5f; - - float* coords = (float*)malloc((segs + 1) * 2 * sizeof(float)); - nz = 0; - for(i = 0; i < teeth; i++) { - int next = i + 1; - if(next == teeth) - next = 0; - - coords[0] = r1 * c[segs * i]; - coords[1] = r1 * s[segs * i]; - coords[2] = r2 * c[segs * i + 1]; - coords[3] = r2 * s[segs * i + 1]; - coords[4] = r2 * c[segs * i + 2]; - coords[5] = r2 * s[segs * i + 2]; - coords[6] = r1 * c[segs * i + 3]; - coords[7] = r1 * s[segs * i + 3]; - coords[8] = r1 * c[segs * next]; - coords[9] = r1 * s[segs * next]; - - for(int j = 0; j < segs; ++j) { - float dx = coords[j * 2] - coords[j * 2 + 2]; - float dy = coords[j * 2 + 1] - coords[j * 2 + 3]; - float len = hypotf(dx, dy); - nx = -dy / len; - ny = dx / len; - VERT(coords[j * 2], coords[j * 2 + 1], z); - VERT(coords[j * 2], coords[j * 2 + 1], -z); - VERT(coords[j * 2 + 2], coords[j * 2 + 3], z); - VERT(coords[j * 2 + 2], coords[j * 2 + 3], -z); - - indices.poly(0, 1, 3, 2); - indices.base += 4; - } - } - free(coords); - - /* inner part - simulate a cylinder */ - indices.flip = true; - for(i = 0; i < teeth * segs * divs; i++) { - int next = i + 1; - if(next == teeth * segs * divs) - next = 0; - - nx = -dc[i]; - ny = -ds[i]; - VERT(r0 * dc[i], r0 * ds[i], -width * 0.5f); - VERT(r0 * dc[i], r0 * ds[i], width * 0.5f); - - indices.poly(i * 2, i * 2 + 1, next * 2 + 1, next * 2); - } - - indices.base += teeth * segs * divs * 2; - free(c); - free(s); - free(dc); - free(ds); - - D3D11_INPUT_ELEMENT_DESC elements[2] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - - return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, - elements, 2, - g_vs, sizeof(g_vs), - &vertices[0], sizeof(vertices[0]), vertices.size(), - &indices[0], sizeof(indices[0]), indices.size()); -} - -struct d3d11gears : public d3d11_application -{ - float view_rotx; - float view_roty; - float view_rotz; - int wireframe; - int triangles; - float speed; - float period; - unsigned impressions; - bool blue_only; - - float last_time; - - int cur_width; - int cur_height; - - ID3D11DepthStencilView* zsv; - ID3D11RenderTargetView* offscreen_rtv; - ID3D11ShaderResourceView* offscreen_srv; - - ID3D11Device* dev; - ID3D11BlendState* blend; - ID3D11DepthStencilState* zsa; - - ID3D11PixelShader* ps; - ID3D11VertexShader* vs; - ID3D11Buffer* cb; - - d3d11_blitter* blitter; - - d3d11gears() - : cur_width(-1), cur_height(-1), zsv(0), offscreen_rtv(0), offscreen_srv(0) - { - view_rotx = (float)(M_PI / 9.0); - view_roty = (float)(M_PI / 6.0); - view_rotz = 0.0f; - wireframe = 0; - triangles = 3200; - speed = 1.0f; - period = -1.0f; - impressions = 1; - blue_only = false; - } - - void draw_one(ID3D11DeviceContext* ctx, cbuf_t& cbd, const float4x4& modelview, float angle) - { - for(unsigned i = blue_only ? 2 : 0; i < 3; ++i) - { - float4x4 m2 = modelview; - m2 = mat_push_translate(m2, gears[i].x, gears[i].y, 0.0f); - m2 = mat_push_rotate(m2, 2, angle * gears[i].wmul + gears[i].t0); - - cbd.modelview = m2; - cbd.diffuse = gears[i].color; - cbd.specular = gears[i].color; - cbd.specular_power = 5.0f; - - ctx->UpdateSubresource(cb, 0, 0, &cbd, 0, 0); - - gears[i].mesh->bind_and_draw(ctx); - } - } - - float get_angle(double time) - { - // designed so that 1 = original glxgears speed - float mod_speed = M_PI * 70.0f / 180.0f * speed; - if(period < 0) - return (float)(time * mod_speed); - else - return (float)(cos(time / period) * period * mod_speed); - } - - void init_for_dimensions(unsigned width, unsigned height) - { - if(zsv) - zsv->Release(); - ID3D11Texture2D* zsbuf; - D3D11_TEXTURE2D_DESC zsbufd; - memset(&zsbufd, 0, sizeof(zsbufd)); - zsbufd.Width = width; - zsbufd.Height = height; - zsbufd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - zsbufd.ArraySize = 1; - zsbufd.MipLevels = 1; - zsbufd.SampleDesc.Count = 1; - zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL; - ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf)); - ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv)); - zsbuf->Release(); - - ID3D11Texture2D* offscreen; - if(offscreen_rtv) - { - offscreen_rtv->Release(); - offscreen_srv->Release(); - offscreen_rtv = 0; - offscreen_srv = 0; - } - - if(impressions > 1) - { - DXGI_FORMAT formats[] = { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R16G16B16A16_UNORM, - DXGI_FORMAT_R16G16B16A16_FLOAT, - DXGI_FORMAT_R10G10B10A2_UNORM, - }; - DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; // this won't work well at all - unsigned needed_support = D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE; - for(unsigned i = 0; i < sizeof(formats); ++i) - { - unsigned support; - dev->CheckFormatSupport(DXGI_FORMAT_R32G32B32A32_FLOAT, &support); - if((support & needed_support) == needed_support) - { - format = formats[i]; - break; - } - } - - - D3D11_TEXTURE2D_DESC offscreend; - memset(&offscreend, 0, sizeof(offscreend)); - offscreend.Width = width; - offscreend.Height = height; - - offscreend.Format = format; - offscreend.MipLevels = 1; - offscreend.ArraySize = 1; - offscreend.SampleDesc.Count = 1; - offscreend.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; - ensure(dev->CreateTexture2D(&offscreend, 0, &offscreen)); - ensure(dev->CreateRenderTargetView(offscreen, 0, &offscreen_rtv)); - ensure(dev->CreateShaderResourceView(offscreen, 0, &offscreen_srv)); - offscreen->Release(); - } - - cur_width = width; - cur_height = height; - } - - void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) - { - D3D11_VIEWPORT vp; - memset(&vp, 0, sizeof(vp)); - vp.Width = (float)width; - vp.Height = (float)height; - vp.MaxDepth = 1.0f; - - if((int)width != cur_width || (int)height != cur_height) - init_for_dimensions(width, height); - - float4 lightpos = vec(5.0f, 5.0f, 10.0f, 0.0f); - float black[4] = {0.0, 0.0, 0.0, 0}; - - float4x4 proj; - float4x4 m; - - float xr = (float)width / (float)height; - float yr = 1.0f; - if(xr < 1.0f) { - yr /= xr; - xr = 1.0f; - } - proj = mat4x4_frustum(-xr, xr, -yr, yr, 5.0f, 60.0f); - - m = mat4x4_diag(1.0f); - m = mat_push_translate(m, 0.0f, 0.0f, -40.0f); - m = mat_push_rotate(m, 0, view_rotx); - m = mat_push_rotate(m, 1, view_roty); - m = mat_push_rotate(m, 2, view_rotz); - - cbuf_t cbd; - - cbd.projection = proj; - cbd.light = lightpos; - - float blend_factor[4] = {1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions}; - - ID3D11RenderTargetView* render_rtv; - if(impressions == 1) - render_rtv = rtv; - else - render_rtv = offscreen_rtv; - - ctx->RSSetViewports(1, &vp); - ctx->ClearRenderTargetView(render_rtv, black); - - ctx->PSSetShader(ps, 0, 0); - ctx->VSSetShader(vs, 0, 0); - - ctx->PSSetConstantBuffers(0, 1, &cb); - ctx->VSSetConstantBuffers(0, 1, &cb); - - if(impressions == 1) - { - ctx->OMSetBlendState(0, 0, ~0); - ctx->OMSetDepthStencilState(0, 0); - ctx->OMSetRenderTargets(1, &rtv, zsv); - ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); - draw_one(ctx, cbd, m, get_angle(time)); - } - else - { - ctx->OMSetBlendState(blend, blend_factor, ~0); - - float time_delta = (float)time - last_time; - float time_delta_per_impression = time_delta / impressions; - float base_time = last_time + time_delta_per_impression / 2; - for(unsigned impression = 0; impression < impressions; ++impression) - { - float impression_time = base_time + time_delta_per_impression * impression; - - ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); - - // do early z-pass since we must not write any pixel more than once due to blending - for(unsigned pass = 0; pass < 2; ++pass) - { - if(pass == 0) - { - ctx->OMSetRenderTargets(0, 0, zsv); - ctx->OMSetDepthStencilState(0, 0); - } - else - { - ctx->OMSetRenderTargets(1, &render_rtv, zsv); - ctx->OMSetDepthStencilState(zsa, 0); - } - - draw_one(ctx, cbd, m, get_angle(impression_time)); - } - } - - blitter->bind_draw_and_unbind(ctx, offscreen_srv, rtv, 0, 0, (float)width, (float)height, false); - } - last_time = (float)time; - } - - bool init(ID3D11Device* dev, int argc, char** argv) - { - this->dev = dev; - - for(char** p = argv + 1; *p; ++p) { - if(!strcmp(*p, "-w")) - wireframe = 1; - else if(!strcmp(*p, "-b")) - blue_only = true; - else if(!strcmp(*p, "-t")) - triangles = atoi(*++p); - else if(!strcmp(*p, "-m")) - impressions = (float)atof(*++p); - else if(!strcmp(*p, "-p")) - period = (float)atof(*++p); - else if(!strcmp(*p, "-s")) - speed = (float)atof(*++p); - else { - fprintf(stderr, "Usage: d3d11gears [-v|-w] [-t TRIANGLES]\n"); - fprintf(stderr, "d3d11gears is an enhanced port of glxgears to Direct3D 11\n"); - fprintf(stderr, "\n"); - //fprintf(stderr, "-v\t\tuse per-vertex diffuse-only lighting (classic glxgears look)\n"); - fprintf(stderr, "-w\t\twireframe mode\n"); - fprintf(stderr, "-t TRIANGLES\ttriangle budget (default is 3200)\n"); - fprintf(stderr, "-m IMPRESSIONS\tmotion blur impressions (default is 1)\n"); - fprintf(stderr, "-p PERIOD\tspeed reversal period (default is infinite)\n"); - fprintf(stderr, "-s SPEED\tgear speed (default is 1.0)\n"); - fprintf(stderr, "-b\tonly show blue gear (for faster motion blur)\n"); - return false; - } - } - - ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); - ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); - - gears[0].color = vec(0.8f, 0.1f, 0.0f, 1.0f); - gears[1].color = vec(0.0f, 0.8f, 0.2f, 1.0f); - gears[2].color = vec(0.2f, 0.2f, 1.0f, 1.0f); - - gears[0].mesh = build_gear(dev, triangles / 2, 1.0f, 4.0f, 1.0f, 20, 0.7f); - gears[1].mesh = build_gear(dev, triangles / 4, 0.5f, 2.0f, 2.0f, 10, 0.7f); - gears[2].mesh = build_gear(dev, triangles / 4, 1.3f, 2.0f, 0.5f, 10, 0.7f); - - gears[0].x = -3.0f; - gears[0].y = -2.0f; - gears[0].wmul = 1.0f; - gears[0].t0 = 0.0 * M_PI / 180.0f; - - gears[1].x = 3.1f; - gears[1].y = -2.0f; - gears[1].wmul = -2.0f; - gears[1].t0 = -9.0f * (float)M_PI / 180.0f; - - gears[2].x = -3.1f; - gears[2].y = 4.2f; - gears[2].wmul = -2.0f; - gears[2].t0 = -25.0f * (float)M_PI / 180.0f; - - D3D11_BUFFER_DESC bufferd; - memset(&bufferd, 0, sizeof(bufferd)); - bufferd.ByteWidth = sizeof(cbuf_t); - bufferd.Usage = D3D11_USAGE_DEFAULT; - bufferd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - ensure(dev->CreateBuffer(&bufferd, 0, &cb)); - - if(impressions > 1) - { - D3D11_BLEND_DESC blendd; - memset(&blendd, 0, sizeof(blendd)); - blendd.RenderTarget[0].BlendEnable = TRUE; - blendd.RenderTarget[0].BlendOp = blendd.RenderTarget[0].BlendOpAlpha - = D3D11_BLEND_OP_ADD; - blendd.RenderTarget[0].SrcBlend = blendd.RenderTarget[0].SrcBlendAlpha - = D3D11_BLEND_BLEND_FACTOR; - blendd.RenderTarget[0].DestBlend = blendd.RenderTarget[0].DestBlendAlpha - = D3D11_BLEND_ONE; - blendd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - ensure(dev->CreateBlendState(&blendd, &blend)); - - D3D11_DEPTH_STENCIL_DESC zsad; - memset(&zsad, 0, sizeof(zsad)); - zsad.DepthEnable = TRUE; - zsad.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; - zsad.DepthFunc = D3D11_COMPARISON_EQUAL; - ensure(dev->CreateDepthStencilState(&zsad, &zsa)); - - blitter = new d3d11_blitter(dev); - } - - return true; - } -}; - -d3d11_application* d3d11_application_create() -{ - return new d3d11gears(); -} +/* +* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +* Copyright (C) 2009-2010 Luca Barbieri 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, sublicense, +* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL +* BRIAN PAUL 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. +*/ + +/* +* This is a port of the infamous "glxgears" demo to straight EGL +* Port by Dane Rushton 10 July 2005 +* +* This a rewrite of the 'eglgears' demo in straight Gallium +* Port by Luca Barbieri +* +* This a port of the 'galliumgears' demo to Direct3D 11 +* Port by Luca Barbieri +*/ + +#define _USE_MATH_DEFINES +#include "d3d11app.h" +#include "d3d11u.h" +#include "d3d11gears.hlsl.ps.h" +#include "d3d11gears.hlsl.vs.h" + +#include +#include +#include +#include + +struct gear +{ + struct mesh* mesh; + float x; + float y; + float t0; + float wmul; + float4 color; +}; + +struct cbuf_t +{ + float4x4 projection; + float4x4 modelview; + float4 light; + float4 diffuse; + float4 specular; + float specular_power; + float padding[3]; +}; + +struct gear gears[3]; + +struct vertex +{ + float position[3]; + float normal[3]; + + vertex(float x, float y, float z, float nx, float ny, float nz) + { + position[0] = x; + position[1] = y; + position[2] = z; + normal[0] = nx; + normal[1] = ny; + normal[2] = nz; + } +}; + +#define VERT(x, y, z) vertices.push_back(vertex((x), (y), (z), (nx), (ny), (nz))) + +static mesh* build_gear(ID3D11Device* dev, int triangle_budget, float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) +{ + int i, j, k; + float r0, r1, r2; + float da; + float nx, ny, nz; + int face; + int segs = 4; + int base_triangles = teeth * segs * 2 * 2; + int divs0 = (triangle_budget / base_triangles) - 1; + int divs = (divs0 > 0) ? divs0 : 1; + float* c = (float*)malloc(teeth * segs * sizeof(float)); + float* s = (float*)malloc(teeth * segs * sizeof(float)); + float* dc = (float*)malloc(teeth * segs * divs * sizeof(float)); + float* ds = (float*)malloc(teeth * segs * divs * sizeof(float)); + int num_vertices = teeth * segs * 2 * (3 + 2 * divs); + int num_triangles = base_triangles * (1 + divs); + printf("Creating gear with %i teeth using %i vertices used in %i triangles\n", teeth, num_vertices, num_triangles); + triangle_list_indices<> indices; + std::vector vertices; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0f; + r2 = outer_radius + tooth_depth / 2.0f; + + da = (float)(2.0 * M_PI / (teeth * segs * divs)); + for(i = 0; i < teeth * segs * divs; ++i) { + float angle = da * i; + ds[i] = sin(angle); + dc[i] = cos(angle); + } + + for(i = 0; i < teeth * segs; ++i) { + s[i] = ds[i * divs]; + c[i] = dc[i * divs]; + } + + /* faces */ + for(face = -1; face <= 1; face += 2) { + float z = width * face * 0.5f; + nx = 0.0f; + ny = 0.0f; + nz = (float)face; + + indices.flip = face > 0; + + assert(segs == 4); + for(i = 0; i < teeth; ++i) { + VERT(r1 * c[segs * i], r1 * s[segs * i], z); + VERT(r2 * c[segs * i + 1], r2 * s[segs * i + 1], z); + VERT(r2 * c[segs * i + 2], r2 * s[segs * i + 2], z); + VERT(r1 * c[segs * i + 3], r1 * s[segs * i + 3], z); + } + + for(i = 0; i < teeth * segs * divs; ++i) { + VERT(r0 * dc[i], r0 * ds[i], z); + } + + for(i = 0; i < teeth; ++i) { + for(j = i * segs; j < (i + 1) * segs; ++j) { + int nextj = j + 1; + if(nextj == teeth * segs) + nextj = 0; + + for(k = j * divs; k < (j + 1) * divs; ++k) { + int nextk = k + 1; + if(nextk == teeth * segs * divs) + nextk = 0; + indices.poly(teeth * segs + k, j, teeth * segs + nextk); + } + + indices.poly(teeth * segs + nextj * divs, j, nextj); + } + } + + indices.base += teeth * segs * (1 + divs); + } + + /* teeth faces */ + indices.flip = true; + float z = width * 0.5f; + + float* coords = (float*)malloc((segs + 1) * 2 * sizeof(float)); + nz = 0; + for(i = 0; i < teeth; i++) { + int next = i + 1; + if(next == teeth) + next = 0; + + coords[0] = r1 * c[segs * i]; + coords[1] = r1 * s[segs * i]; + coords[2] = r2 * c[segs * i + 1]; + coords[3] = r2 * s[segs * i + 1]; + coords[4] = r2 * c[segs * i + 2]; + coords[5] = r2 * s[segs * i + 2]; + coords[6] = r1 * c[segs * i + 3]; + coords[7] = r1 * s[segs * i + 3]; + coords[8] = r1 * c[segs * next]; + coords[9] = r1 * s[segs * next]; + + for(int j = 0; j < segs; ++j) { + float dx = coords[j * 2] - coords[j * 2 + 2]; + float dy = coords[j * 2 + 1] - coords[j * 2 + 3]; + float len = hypotf(dx, dy); + nx = -dy / len; + ny = dx / len; + VERT(coords[j * 2], coords[j * 2 + 1], z); + VERT(coords[j * 2], coords[j * 2 + 1], -z); + VERT(coords[j * 2 + 2], coords[j * 2 + 3], z); + VERT(coords[j * 2 + 2], coords[j * 2 + 3], -z); + + indices.poly(0, 1, 3, 2); + indices.base += 4; + } + } + free(coords); + + /* inner part - simulate a cylinder */ + indices.flip = true; + for(i = 0; i < teeth * segs * divs; i++) { + int next = i + 1; + if(next == teeth * segs * divs) + next = 0; + + nx = -dc[i]; + ny = -ds[i]; + VERT(r0 * dc[i], r0 * ds[i], -width * 0.5f); + VERT(r0 * dc[i], r0 * ds[i], width * 0.5f); + + indices.poly(i * 2, i * 2 + 1, next * 2 + 1, next * 2); + } + + indices.base += teeth * segs * divs * 2; + free(c); + free(s); + free(dc); + free(ds); + + D3D11_INPUT_ELEMENT_DESC elements[2] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + elements, 2, + g_vs, sizeof(g_vs), + &vertices[0], sizeof(vertices[0]), vertices.size(), + &indices[0], sizeof(indices[0]), indices.size()); +} + +struct d3d11gears : public d3d11_application +{ + float view_rotx; + float view_roty; + float view_rotz; + int wireframe; + int triangles; + float speed; + float period; + unsigned impressions; + bool blue_only; + + float last_time; + + int cur_width; + int cur_height; + + ID3D11DepthStencilView* zsv; + ID3D11RenderTargetView* offscreen_rtv; + ID3D11ShaderResourceView* offscreen_srv; + + ID3D11Device* dev; + ID3D11BlendState* blend; + ID3D11DepthStencilState* zsa; + + ID3D11PixelShader* ps; + ID3D11VertexShader* vs; + ID3D11Buffer* cb; + + d3d11_blitter* blitter; + + d3d11gears() + : cur_width(-1), cur_height(-1), zsv(0), offscreen_rtv(0), offscreen_srv(0) + { + view_rotx = (float)(M_PI / 9.0); + view_roty = (float)(M_PI / 6.0); + view_rotz = 0.0f; + wireframe = 0; + triangles = 3200; + speed = 1.0f; + period = -1.0f; + impressions = 1; + blue_only = false; + } + + void draw_one(ID3D11DeviceContext* ctx, cbuf_t& cbd, const float4x4& modelview, float angle) + { + for(unsigned i = blue_only ? 2 : 0; i < 3; ++i) + { + float4x4 m2 = modelview; + m2 = mat_push_translate(m2, gears[i].x, gears[i].y, 0.0f); + m2 = mat_push_rotate(m2, 2, angle * gears[i].wmul + gears[i].t0); + + cbd.modelview = m2; + cbd.diffuse = gears[i].color; + cbd.specular = gears[i].color; + cbd.specular_power = 5.0f; + + ctx->UpdateSubresource(cb, 0, 0, &cbd, 0, 0); + + gears[i].mesh->bind_and_draw(ctx); + } + } + + float get_angle(double time) + { + // designed so that 1 = original glxgears speed + float mod_speed = M_PI * 70.0f / 180.0f * speed; + if(period < 0) + return (float)(time * mod_speed); + else + return (float)(cos(time / period) * period * mod_speed); + } + + void init_for_dimensions(unsigned width, unsigned height) + { + if(zsv) + zsv->Release(); + ID3D11Texture2D* zsbuf; + D3D11_TEXTURE2D_DESC zsbufd; + memset(&zsbufd, 0, sizeof(zsbufd)); + zsbufd.Width = width; + zsbufd.Height = height; + zsbufd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + zsbufd.ArraySize = 1; + zsbufd.MipLevels = 1; + zsbufd.SampleDesc.Count = 1; + zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL; + ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf)); + ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv)); + zsbuf->Release(); + + ID3D11Texture2D* offscreen; + if(offscreen_rtv) + { + offscreen_rtv->Release(); + offscreen_srv->Release(); + offscreen_rtv = 0; + offscreen_srv = 0; + } + + if(impressions > 1) + { + DXGI_FORMAT formats[] = { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R10G10B10A2_UNORM, + }; + DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; // this won't work well at all + unsigned needed_support = D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE; + for(unsigned i = 0; i < sizeof(formats); ++i) + { + unsigned support; + dev->CheckFormatSupport(DXGI_FORMAT_R32G32B32A32_FLOAT, &support); + if((support & needed_support) == needed_support) + { + format = formats[i]; + break; + } + } + + + D3D11_TEXTURE2D_DESC offscreend; + memset(&offscreend, 0, sizeof(offscreend)); + offscreend.Width = width; + offscreend.Height = height; + + offscreend.Format = format; + offscreend.MipLevels = 1; + offscreend.ArraySize = 1; + offscreend.SampleDesc.Count = 1; + offscreend.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; + ensure(dev->CreateTexture2D(&offscreend, 0, &offscreen)); + ensure(dev->CreateRenderTargetView(offscreen, 0, &offscreen_rtv)); + ensure(dev->CreateShaderResourceView(offscreen, 0, &offscreen_srv)); + offscreen->Release(); + } + + cur_width = width; + cur_height = height; + } + + void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + if((int)width != cur_width || (int)height != cur_height) + init_for_dimensions(width, height); + + float4 lightpos = vec(5.0f, 5.0f, 10.0f, 0.0f); + float black[4] = {0.0, 0.0, 0.0, 0}; + + float4x4 proj; + float4x4 m; + + float xr = (float)width / (float)height; + float yr = 1.0f; + if(xr < 1.0f) { + yr /= xr; + xr = 1.0f; + } + proj = mat4x4_frustum(-xr, xr, -yr, yr, 5.0f, 60.0f); + + m = mat4x4_diag(1.0f); + m = mat_push_translate(m, 0.0f, 0.0f, -40.0f); + m = mat_push_rotate(m, 0, view_rotx); + m = mat_push_rotate(m, 1, view_roty); + m = mat_push_rotate(m, 2, view_rotz); + + cbuf_t cbd; + + cbd.projection = proj; + cbd.light = lightpos; + + float blend_factor[4] = {1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions}; + + ID3D11RenderTargetView* render_rtv; + if(impressions == 1) + render_rtv = rtv; + else + render_rtv = offscreen_rtv; + + ctx->RSSetViewports(1, &vp); + ctx->ClearRenderTargetView(render_rtv, black); + + ctx->PSSetShader(ps, 0, 0); + ctx->VSSetShader(vs, 0, 0); + + ctx->PSSetConstantBuffers(0, 1, &cb); + ctx->VSSetConstantBuffers(0, 1, &cb); + + if(impressions == 1) + { + ctx->OMSetBlendState(0, 0, ~0); + ctx->OMSetDepthStencilState(0, 0); + ctx->OMSetRenderTargets(1, &rtv, zsv); + ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); + draw_one(ctx, cbd, m, get_angle(time)); + } + else + { + ctx->OMSetBlendState(blend, blend_factor, ~0); + + float time_delta = (float)time - last_time; + float time_delta_per_impression = time_delta / impressions; + float base_time = last_time + time_delta_per_impression / 2; + for(unsigned impression = 0; impression < impressions; ++impression) + { + float impression_time = base_time + time_delta_per_impression * impression; + + ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); + + // do early z-pass since we must not write any pixel more than once due to blending + for(unsigned pass = 0; pass < 2; ++pass) + { + if(pass == 0) + { + ctx->OMSetRenderTargets(0, 0, zsv); + ctx->OMSetDepthStencilState(0, 0); + } + else + { + ctx->OMSetRenderTargets(1, &render_rtv, zsv); + ctx->OMSetDepthStencilState(zsa, 0); + } + + draw_one(ctx, cbd, m, get_angle(impression_time)); + } + } + + blitter->bind_draw_and_unbind(ctx, offscreen_srv, rtv, 0, 0, (float)width, (float)height, false); + } + last_time = (float)time; + } + + bool init(ID3D11Device* dev, int argc, char** argv) + { + this->dev = dev; + + for(char** p = argv + 1; *p; ++p) { + if(!strcmp(*p, "-w")) + wireframe = 1; + else if(!strcmp(*p, "-b")) + blue_only = true; + else if(!strcmp(*p, "-t")) + triangles = atoi(*++p); + else if(!strcmp(*p, "-m")) + impressions = (float)atof(*++p); + else if(!strcmp(*p, "-p")) + period = (float)atof(*++p); + else if(!strcmp(*p, "-s")) + speed = (float)atof(*++p); + else { + fprintf(stderr, "Usage: d3d11gears [-v|-w] [-t TRIANGLES]\n"); + fprintf(stderr, "d3d11gears is an enhanced port of glxgears to Direct3D 11\n"); + fprintf(stderr, "\n"); + //fprintf(stderr, "-v\t\tuse per-vertex diffuse-only lighting (classic glxgears look)\n"); + fprintf(stderr, "-w\t\twireframe mode\n"); + fprintf(stderr, "-t TRIANGLES\ttriangle budget (default is 3200)\n"); + fprintf(stderr, "-m IMPRESSIONS\tmotion blur impressions (default is 1)\n"); + fprintf(stderr, "-p PERIOD\tspeed reversal period (default is infinite)\n"); + fprintf(stderr, "-s SPEED\tgear speed (default is 1.0)\n"); + fprintf(stderr, "-b\tonly show blue gear (for faster motion blur)\n"); + return false; + } + } + + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + + gears[0].color = vec(0.8f, 0.1f, 0.0f, 1.0f); + gears[1].color = vec(0.0f, 0.8f, 0.2f, 1.0f); + gears[2].color = vec(0.2f, 0.2f, 1.0f, 1.0f); + + gears[0].mesh = build_gear(dev, triangles / 2, 1.0f, 4.0f, 1.0f, 20, 0.7f); + gears[1].mesh = build_gear(dev, triangles / 4, 0.5f, 2.0f, 2.0f, 10, 0.7f); + gears[2].mesh = build_gear(dev, triangles / 4, 1.3f, 2.0f, 0.5f, 10, 0.7f); + + gears[0].x = -3.0f; + gears[0].y = -2.0f; + gears[0].wmul = 1.0f; + gears[0].t0 = 0.0 * M_PI / 180.0f; + + gears[1].x = 3.1f; + gears[1].y = -2.0f; + gears[1].wmul = -2.0f; + gears[1].t0 = -9.0f * (float)M_PI / 180.0f; + + gears[2].x = -3.1f; + gears[2].y = 4.2f; + gears[2].wmul = -2.0f; + gears[2].t0 = -25.0f * (float)M_PI / 180.0f; + + D3D11_BUFFER_DESC bufferd; + memset(&bufferd, 0, sizeof(bufferd)); + bufferd.ByteWidth = sizeof(cbuf_t); + bufferd.Usage = D3D11_USAGE_DEFAULT; + bufferd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + ensure(dev->CreateBuffer(&bufferd, 0, &cb)); + + if(impressions > 1) + { + D3D11_BLEND_DESC blendd; + memset(&blendd, 0, sizeof(blendd)); + blendd.RenderTarget[0].BlendEnable = TRUE; + blendd.RenderTarget[0].BlendOp = blendd.RenderTarget[0].BlendOpAlpha + = D3D11_BLEND_OP_ADD; + blendd.RenderTarget[0].SrcBlend = blendd.RenderTarget[0].SrcBlendAlpha + = D3D11_BLEND_BLEND_FACTOR; + blendd.RenderTarget[0].DestBlend = blendd.RenderTarget[0].DestBlendAlpha + = D3D11_BLEND_ONE; + blendd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + ensure(dev->CreateBlendState(&blendd, &blend)); + + D3D11_DEPTH_STENCIL_DESC zsad; + memset(&zsad, 0, sizeof(zsad)); + zsad.DepthEnable = TRUE; + zsad.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + zsad.DepthFunc = D3D11_COMPARISON_EQUAL; + ensure(dev->CreateDepthStencilState(&zsad, &zsa)); + + blitter = new d3d11_blitter(dev); + } + + return true; + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11gears(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h index 890b1af276b..e83b5bb5a8f 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h @@ -1,309 +1,309 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11gears.hlsl.ps.h /Eps /Tps_4_0 d3d11gears.hlsl -// -// -// Buffer Definitions: -// -// cbuffer cb -// { -// -// float4x4 proj; // Offset: 0 Size: 64 [unused] -// float4x4 modelview; // Offset: 64 Size: 64 [unused] -// float4 light; // Offset: 128 Size: 16 [unused] -// float4 diffuse; // Offset: 144 Size: 16 -// float4 specular; // Offset: 160 Size: 16 -// float specular_power; // Offset: 176 Size: 4 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// cb cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float -// NORMAL 0 xyz 1 NONE float xyz -// EYE 0 xyz 2 NONE float xyz -// LIGHT 0 xyz 3 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_4_0 -dcl_constantbuffer cb0[12], immediateIndexed -dcl_input_ps linear v1.xyz -dcl_input_ps linear v2.xyz -dcl_input_ps linear v3.xyz -dcl_output o0.xyzw -dcl_temps 3 -dp3 r0.x, v2.xyzx, v2.xyzx -rsq r0.x, r0.x -dp3 r0.y, v3.xyzx, v3.xyzx -rsq r0.y, r0.y -mul r0.yzw, r0.yyyy, v3.xxyz -mad r1.xyz, v2.xyzx, r0.xxxx, r0.yzwy -dp3 r0.x, r1.xyzx, r1.xyzx -rsq r0.x, r0.x -mul r1.xyz, r0.xxxx, r1.xyzx -dp3 r0.x, v1.xyzx, v1.xyzx -rsq r0.x, r0.x -mul r2.xyz, r0.xxxx, v1.xyzx -dp3_sat r0.x, r2.xyzx, r1.xyzx -dp3_sat r0.y, r2.xyzx, r0.yzwy -log r0.x, r0.x -mul r0.x, r0.x, cb0[11].x -exp r0.x, r0.x -mul r1.xyzw, r0.xxxx, cb0[10].xyzw -mad o0.xyzw, cb0[9].xyzw, r0.yyyy, r1.xyzw -ret -// Approximately 20 instruction slots used -#endif - -const BYTE g_ps[] = -{ - 68, 88, 66, 67, 91, 23, - 206, 102, 23, 38, 122, 59, - 55, 123, 215, 57, 98, 213, - 215, 191, 1, 0, 0, 0, - 92, 5, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 192, 1, 0, 0, 80, 2, - 0, 0, 132, 2, 0, 0, - 224, 4, 0, 0, 82, 68, - 69, 70, 132, 1, 0, 0, - 1, 0, 0, 0, 64, 0, - 0, 0, 1, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 255, 255, 0, 1, 0, 0, - 80, 1, 0, 0, 60, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 99, 98, 0, 171, 60, 0, - 0, 0, 6, 0, 0, 0, - 88, 0, 0, 0, 192, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 232, 0, - 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 0, 0, - 0, 0, 240, 0, 0, 0, - 0, 0, 0, 0, 0, 1, - 0, 0, 64, 0, 0, 0, - 64, 0, 0, 0, 0, 0, - 0, 0, 240, 0, 0, 0, - 0, 0, 0, 0, 10, 1, - 0, 0, 128, 0, 0, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 16, 1, 0, 0, - 0, 0, 0, 0, 32, 1, - 0, 0, 144, 0, 0, 0, - 16, 0, 0, 0, 2, 0, - 0, 0, 16, 1, 0, 0, - 0, 0, 0, 0, 40, 1, - 0, 0, 160, 0, 0, 0, - 16, 0, 0, 0, 2, 0, - 0, 0, 16, 1, 0, 0, - 0, 0, 0, 0, 49, 1, - 0, 0, 176, 0, 0, 0, - 4, 0, 0, 0, 2, 0, - 0, 0, 64, 1, 0, 0, - 0, 0, 0, 0, 112, 114, - 111, 106, 0, 171, 171, 171, - 3, 0, 3, 0, 4, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 109, 111, - 100, 101, 108, 118, 105, 101, - 119, 0, 108, 105, 103, 104, - 116, 0, 1, 0, 3, 0, - 1, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 100, 105, 102, 102, 117, 115, - 101, 0, 115, 112, 101, 99, - 117, 108, 97, 114, 0, 115, - 112, 101, 99, 117, 108, 97, - 114, 95, 112, 111, 119, 101, - 114, 0, 0, 0, 3, 0, - 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 77, 105, 99, 114, 111, 115, - 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, - 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, - 71, 78, 136, 0, 0, 0, - 4, 0, 0, 0, 8, 0, - 0, 0, 104, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 116, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 7, 7, - 0, 0, 123, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 7, 7, - 0, 0, 127, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 7, 7, - 0, 0, 83, 86, 95, 80, - 79, 83, 73, 84, 73, 79, - 78, 0, 78, 79, 82, 77, - 65, 76, 0, 69, 89, 69, - 0, 76, 73, 71, 72, 84, - 0, 171, 171, 171, 79, 83, - 71, 78, 44, 0, 0, 0, - 1, 0, 0, 0, 8, 0, - 0, 0, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 84, - 65, 82, 71, 69, 84, 0, - 171, 171, 83, 72, 68, 82, - 84, 2, 0, 0, 64, 0, - 0, 0, 149, 0, 0, 0, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 1, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 2, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 3, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 3, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 2, 0, - 0, 0, 70, 18, 16, 0, - 2, 0, 0, 0, 68, 0, - 0, 5, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 16, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 3, 0, - 0, 0, 70, 18, 16, 0, - 3, 0, 0, 0, 68, 0, - 0, 5, 34, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 226, 0, - 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 6, 25, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 9, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 18, - 16, 0, 2, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 150, 7, 16, 0, - 0, 0, 0, 0, 16, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 68, 0, 0, 5, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 16, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, - 1, 0, 0, 0, 70, 18, - 16, 0, 1, 0, 0, 0, - 68, 0, 0, 5, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 2, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 70, 18, - 16, 0, 1, 0, 0, 0, - 16, 32, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 16, 32, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 150, 7, 16, 0, 0, 0, - 0, 0, 47, 0, 0, 5, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 11, 0, 0, 0, - 25, 0, 0, 5, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 242, 0, 16, 0, 1, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 50, 0, - 0, 10, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, - 0, 0, 20, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 17, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11gears.hlsl.ps.h /Eps /Tps_4_0 d3d11gears.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb +// { +// +// float4x4 proj; // Offset: 0 Size: 64 [unused] +// float4x4 modelview; // Offset: 64 Size: 64 [unused] +// float4 light; // Offset: 128 Size: 16 [unused] +// float4 diffuse; // Offset: 144 Size: 16 +// float4 specular; // Offset: 160 Size: 16 +// float specular_power; // Offset: 176 Size: 4 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb cbuffer NA NA 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// NORMAL 0 xyz 1 NONE float xyz +// EYE 0 xyz 2 NONE float xyz +// LIGHT 0 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer cb0[12], immediateIndexed +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xyz +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 3 +dp3 r0.x, v2.xyzx, v2.xyzx +rsq r0.x, r0.x +dp3 r0.y, v3.xyzx, v3.xyzx +rsq r0.y, r0.y +mul r0.yzw, r0.yyyy, v3.xxyz +mad r1.xyz, v2.xyzx, r0.xxxx, r0.yzwy +dp3 r0.x, r1.xyzx, r1.xyzx +rsq r0.x, r0.x +mul r1.xyz, r0.xxxx, r1.xyzx +dp3 r0.x, v1.xyzx, v1.xyzx +rsq r0.x, r0.x +mul r2.xyz, r0.xxxx, v1.xyzx +dp3_sat r0.x, r2.xyzx, r1.xyzx +dp3_sat r0.y, r2.xyzx, r0.yzwy +log r0.x, r0.x +mul r0.x, r0.x, cb0[11].x +exp r0.x, r0.x +mul r1.xyzw, r0.xxxx, cb0[10].xyzw +mad o0.xyzw, cb0[9].xyzw, r0.yyyy, r1.xyzw +ret +// Approximately 20 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 91, 23, + 206, 102, 23, 38, 122, 59, + 55, 123, 215, 57, 98, 213, + 215, 191, 1, 0, 0, 0, + 92, 5, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 192, 1, 0, 0, 80, 2, + 0, 0, 132, 2, 0, 0, + 224, 4, 0, 0, 82, 68, + 69, 70, 132, 1, 0, 0, + 1, 0, 0, 0, 64, 0, + 0, 0, 1, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 80, 1, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 0, 171, 60, 0, + 0, 0, 6, 0, 0, 0, + 88, 0, 0, 0, 192, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 232, 0, + 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 10, 1, + 0, 0, 128, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 32, 1, + 0, 0, 144, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 40, 1, + 0, 0, 160, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 49, 1, + 0, 0, 176, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 64, 1, 0, 0, + 0, 0, 0, 0, 112, 114, + 111, 106, 0, 171, 171, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 109, 111, + 100, 101, 108, 118, 105, 101, + 119, 0, 108, 105, 103, 104, + 116, 0, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 100, 105, 102, 102, 117, 115, + 101, 0, 115, 112, 101, 99, + 117, 108, 97, 114, 0, 115, + 112, 101, 99, 117, 108, 97, + 114, 95, 112, 111, 119, 101, + 114, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 57, + 46, 50, 57, 46, 57, 53, + 50, 46, 51, 49, 49, 49, + 0, 171, 171, 171, 73, 83, + 71, 78, 136, 0, 0, 0, + 4, 0, 0, 0, 8, 0, + 0, 0, 104, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 116, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 7, 7, + 0, 0, 123, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 7, 7, + 0, 0, 127, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 7, 7, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 78, 79, 82, 77, + 65, 76, 0, 69, 89, 69, + 0, 76, 73, 71, 72, 84, + 0, 171, 171, 171, 79, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 84, + 65, 82, 71, 69, 84, 0, + 171, 171, 83, 72, 68, 82, + 84, 2, 0, 0, 64, 0, + 0, 0, 149, 0, 0, 0, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 18, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 226, 0, + 16, 0, 0, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 6, 25, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 9, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 1, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 68, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 16, 32, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 16, 32, + 0, 7, 34, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 150, 7, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 5, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 11, 0, 0, 0, + 25, 0, 0, 5, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 50, 0, + 0, 10, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 20, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h index 3170d3a0b65..ee931091c29 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h @@ -1,308 +1,308 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11gears.hlsl.vs.h /Evs /Tvs_4_0 d3d11gears.hlsl -// -// -// Buffer Definitions: -// -// cbuffer cb -// { -// -// float4x4 proj; // Offset: 0 Size: 64 -// float4x4 modelview; // Offset: 64 Size: 64 -// float4 light; // Offset: 128 Size: 16 -// float4 diffuse; // Offset: 144 Size: 16 [unused] -// float4 specular; // Offset: 160 Size: 16 [unused] -// float specular_power; // Offset: 176 Size: 4 [unused] -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// cb cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyzw 0 NONE float xyzw -// NORMAL 0 xyz 1 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// NORMAL 0 xyz 1 NONE float xyz -// EYE 0 xyz 2 NONE float xyz -// LIGHT 0 xyz 3 NONE float xyz -// -vs_4_0 -dcl_constantbuffer cb0[9], immediateIndexed -dcl_input v0.xyzw -dcl_input v1.xyz -dcl_output_siv o0.xyzw, position -dcl_output o1.xyz -dcl_output o2.xyz -dcl_output o3.xyz -dcl_temps 2 -mul r0.xyz, v0.yyyy, cb0[5].xyzx -mad r0.xyz, cb0[4].xyzx, v0.xxxx, r0.xyzx -mad r0.xyz, cb0[6].xyzx, v0.zzzz, r0.xyzx -mad r0.xyz, cb0[7].xyzx, v0.wwww, r0.xyzx -mul r1.xyzw, r0.yyyy, cb0[1].xyzw -mad r1.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw -mad r1.xyzw, cb0[2].xyzw, r0.zzzz, r1.xyzw -add o0.xyzw, r1.xyzw, cb0[3].xyzw -mul r1.xyz, v1.yyyy, cb0[5].xyzx -mad r1.xyz, cb0[4].xyzx, v1.xxxx, r1.xyzx -mad o1.xyz, cb0[6].xyzx, v1.zzzz, r1.xyzx -mov o2.xyz, -r0.xyzx -add o3.xyz, -r0.xyzx, cb0[8].xyzx -ret -// Approximately 14 instruction slots used -#endif - -const BYTE g_vs[] = -{ - 68, 88, 66, 67, 251, 82, - 65, 114, 135, 66, 139, 83, - 7, 10, 20, 121, 102, 38, - 44, 36, 1, 0, 0, 0, - 104, 5, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 192, 1, 0, 0, 16, 2, - 0, 0, 160, 2, 0, 0, - 236, 4, 0, 0, 82, 68, - 69, 70, 132, 1, 0, 0, - 1, 0, 0, 0, 64, 0, - 0, 0, 1, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 254, 255, 0, 1, 0, 0, - 80, 1, 0, 0, 60, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 99, 98, 0, 171, 60, 0, - 0, 0, 6, 0, 0, 0, - 88, 0, 0, 0, 192, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 232, 0, - 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 2, 0, - 0, 0, 240, 0, 0, 0, - 0, 0, 0, 0, 0, 1, - 0, 0, 64, 0, 0, 0, - 64, 0, 0, 0, 2, 0, - 0, 0, 240, 0, 0, 0, - 0, 0, 0, 0, 10, 1, - 0, 0, 128, 0, 0, 0, - 16, 0, 0, 0, 2, 0, - 0, 0, 16, 1, 0, 0, - 0, 0, 0, 0, 32, 1, - 0, 0, 144, 0, 0, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 16, 1, 0, 0, - 0, 0, 0, 0, 40, 1, - 0, 0, 160, 0, 0, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 16, 1, 0, 0, - 0, 0, 0, 0, 49, 1, - 0, 0, 176, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 64, 1, 0, 0, - 0, 0, 0, 0, 112, 114, - 111, 106, 0, 171, 171, 171, - 3, 0, 3, 0, 4, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 109, 111, - 100, 101, 108, 118, 105, 101, - 119, 0, 108, 105, 103, 104, - 116, 0, 1, 0, 3, 0, - 1, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 100, 105, 102, 102, 117, 115, - 101, 0, 115, 112, 101, 99, - 117, 108, 97, 114, 0, 115, - 112, 101, 99, 117, 108, 97, - 114, 95, 112, 111, 119, 101, - 114, 0, 0, 0, 3, 0, - 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 77, 105, 99, 114, 111, 115, - 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, - 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, - 71, 78, 72, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 15, - 0, 0, 65, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 7, 7, - 0, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 78, - 79, 82, 77, 65, 76, 0, - 79, 83, 71, 78, 136, 0, - 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 116, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 7, 8, 0, 0, 123, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 7, 8, 0, 0, 127, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 7, 8, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 78, 79, - 82, 77, 65, 76, 0, 69, - 89, 69, 0, 76, 73, 71, - 72, 84, 0, 171, 171, 171, - 83, 72, 68, 82, 68, 2, - 0, 0, 64, 0, 1, 0, - 145, 0, 0, 0, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 9, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, - 242, 32, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 114, 32, - 16, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 114, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 114, 32, - 16, 0, 3, 0, 0, 0, - 104, 0, 0, 2, 2, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 6, 16, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 166, 26, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 7, 0, 0, 0, - 246, 31, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 1, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 1, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 1, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 8, - 242, 32, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 56, 0, - 0, 8, 114, 0, 16, 0, - 1, 0, 0, 0, 86, 21, - 16, 0, 1, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 16, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 114, 32, 16, 0, - 1, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 166, 26, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 6, - 114, 32, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 114, 32, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, - 0, 0, 14, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11gears.hlsl.vs.h /Evs /Tvs_4_0 d3d11gears.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb +// { +// +// float4x4 proj; // Offset: 0 Size: 64 +// float4x4 modelview; // Offset: 64 Size: 64 +// float4 light; // Offset: 128 Size: 16 +// float4 diffuse; // Offset: 144 Size: 16 [unused] +// float4 specular; // Offset: 160 Size: 16 [unused] +// float specular_power; // Offset: 176 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb cbuffer NA NA 0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// NORMAL 0 xyz 1 NONE float xyz +// EYE 0 xyz 2 NONE float xyz +// LIGHT 0 xyz 3 NONE float xyz +// +vs_4_0 +dcl_constantbuffer cb0[9], immediateIndexed +dcl_input v0.xyzw +dcl_input v1.xyz +dcl_output_siv o0.xyzw, position +dcl_output o1.xyz +dcl_output o2.xyz +dcl_output o3.xyz +dcl_temps 2 +mul r0.xyz, v0.yyyy, cb0[5].xyzx +mad r0.xyz, cb0[4].xyzx, v0.xxxx, r0.xyzx +mad r0.xyz, cb0[6].xyzx, v0.zzzz, r0.xyzx +mad r0.xyz, cb0[7].xyzx, v0.wwww, r0.xyzx +mul r1.xyzw, r0.yyyy, cb0[1].xyzw +mad r1.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw +mad r1.xyzw, cb0[2].xyzw, r0.zzzz, r1.xyzw +add o0.xyzw, r1.xyzw, cb0[3].xyzw +mul r1.xyz, v1.yyyy, cb0[5].xyzx +mad r1.xyz, cb0[4].xyzx, v1.xxxx, r1.xyzx +mad o1.xyz, cb0[6].xyzx, v1.zzzz, r1.xyzx +mov o2.xyz, -r0.xyzx +add o3.xyz, -r0.xyzx, cb0[8].xyzx +ret +// Approximately 14 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 251, 82, + 65, 114, 135, 66, 139, 83, + 7, 10, 20, 121, 102, 38, + 44, 36, 1, 0, 0, 0, + 104, 5, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 192, 1, 0, 0, 16, 2, + 0, 0, 160, 2, 0, 0, + 236, 4, 0, 0, 82, 68, + 69, 70, 132, 1, 0, 0, + 1, 0, 0, 0, 64, 0, + 0, 0, 1, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 80, 1, 0, 0, 60, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 0, 171, 60, 0, + 0, 0, 6, 0, 0, 0, + 88, 0, 0, 0, 192, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 232, 0, + 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 2, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 0, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 2, 0, + 0, 0, 240, 0, 0, 0, + 0, 0, 0, 0, 10, 1, + 0, 0, 128, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 32, 1, + 0, 0, 144, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 40, 1, + 0, 0, 160, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 16, 1, 0, 0, + 0, 0, 0, 0, 49, 1, + 0, 0, 176, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 64, 1, 0, 0, + 0, 0, 0, 0, 112, 114, + 111, 106, 0, 171, 171, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 109, 111, + 100, 101, 108, 118, 105, 101, + 119, 0, 108, 105, 103, 104, + 116, 0, 1, 0, 3, 0, + 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 100, 105, 102, 102, 117, 115, + 101, 0, 115, 112, 101, 99, + 117, 108, 97, 114, 0, 115, + 112, 101, 99, 117, 108, 97, + 114, 95, 112, 111, 119, 101, + 114, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 57, + 46, 50, 57, 46, 57, 53, + 50, 46, 51, 49, 49, 49, + 0, 171, 171, 171, 73, 83, + 71, 78, 72, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 15, + 0, 0, 65, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 7, 7, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 78, + 79, 82, 77, 65, 76, 0, + 79, 83, 71, 78, 136, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 8, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 127, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 8, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 78, 79, + 82, 77, 65, 76, 0, 69, + 89, 69, 0, 76, 73, 71, + 72, 84, 0, 171, 171, 171, + 83, 72, 68, 82, 68, 2, + 0, 0, 64, 0, 1, 0, + 145, 0, 0, 0, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 3, 0, 0, 0, + 104, 0, 0, 2, 2, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 86, 21, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 6, 16, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 6, 0, + 0, 0, 166, 26, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 7, 0, 0, 0, + 246, 31, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 166, 10, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 86, 21, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 6, 16, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 32, 16, 0, + 1, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 166, 26, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 54, 0, 0, 6, + 114, 32, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 9, + 114, 32, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 14, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp index 31af95ca2c4..54ca08f23c8 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp @@ -1,227 +1,227 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#define _USE_MATH_DEFINES -#include "d3d11app.h" -#include "d3d11spikysphere.hlsl.vs.h" -#include "d3d11spikysphere.hlsl.hs.h" -#include "d3d11spikysphere.hlsl.ds.h" -#include "d3d11spikysphere.hlsl.ps.h" - -#include -#include -#include -#include -#include - -struct cb_frame_t -{ - D3DXMATRIX model; - D3DXMATRIX view_proj; - float disp_scale; - float disp_freq; - float tess_factor; -}; - -static float vertex_data[] = -{ - 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0, - - 0.0, 1.0, 0.0, - -1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, - - 0.0, -1.0, 0.0, - 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, - - -1.0, 0.0, 0.0, - 0.0, -1.0, 0.0, - 0.0, 0.0, 1.0, - - 0.0, 1.0, 0.0, - 1.0, 0.0, 0.0, - 0.0, 0.0, -1.0, - - -1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, -1.0, - - 1.0, 0.0, 0.0, - 0.0, -1.0, 0.0, - 0.0, 0.0, -1.0, - - 0.0, -1.0, 0.0, - -1.0, 0.0, 0.0, - 0.0, 0.0, -1.0, -}; - -struct d3d11spikysphere : public d3d11_application -{ - ID3D11Device* dev; - ID3D11PixelShader* ps; - ID3D11DomainShader* ds; - ID3D11HullShader* hs; - ID3D11VertexShader* vs; - ID3D11InputLayout* layout; - ID3D11Buffer* vb; - ID3D11RenderTargetView* rtv; - ID3D11DepthStencilView* zsv; - ID3D11Buffer* cb_frame; - - int cur_width; - int cur_height; - - d3d11spikysphere() - : cur_width(-1), cur_height(-1), zsv(0) - {} - - bool init(ID3D11Device* dev, int argc, char** argv) - { - this->dev = dev; - ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); - ensure(dev->CreateHullShader(g_hs, sizeof(g_hs), NULL, &hs)); - ensure(dev->CreateDomainShader(g_ds, sizeof(g_ds), NULL, &ds)); - ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); - - D3D11_INPUT_ELEMENT_DESC elements[1] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, - 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - - ensure(dev->CreateInputLayout(elements, 1, g_vs, sizeof(g_vs), &layout)); - - D3D11_BUFFER_DESC bufferd; - bufferd.ByteWidth = sizeof(vertex_data); - bufferd.Usage = D3D11_USAGE_IMMUTABLE; - bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufferd.CPUAccessFlags = 0; - bufferd.MiscFlags = 0; - bufferd.StructureByteStride = 0; - - D3D11_SUBRESOURCE_DATA buffersd; - buffersd.pSysMem = vertex_data; - - ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); - - D3D11_BUFFER_DESC cbd; - cbd.ByteWidth = (sizeof(cb_frame_t) + 15) & ~15; - cbd.Usage = D3D11_USAGE_DYNAMIC; - cbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - cbd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - cbd.MiscFlags = 0; - cbd.StructureByteStride = 0; - - ensure(dev->CreateBuffer(&cbd, NULL, &cb_frame)); - return true; - } - - void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) - { - D3D11_VIEWPORT vp; - memset(&vp, 0, sizeof(vp)); - vp.Width = (float)width; - vp.Height = (float)height; - vp.MaxDepth = 1.0f; - - if(width != cur_width || height != cur_height) - { - if(zsv) - zsv->Release(); - ID3D11Texture2D* zsbuf; - D3D11_TEXTURE2D_DESC zsbufd; - memset(&zsbufd, 0, sizeof(zsbufd)); - zsbufd.Width = width; - zsbufd.Height = height; - zsbufd.Format = DXGI_FORMAT_D32_FLOAT; - zsbufd.ArraySize = 1; - zsbufd.MipLevels = 1; - zsbufd.SampleDesc.Count = 1; - zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL; - ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf)); - ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv)); - zsbuf->Release(); - } - - float black[4] = {0, 0, 0, 0}; - - D3D11_MAPPED_SUBRESOURCE map; - ensure(ctx->Map(cb_frame, 0, D3D11_MAP_WRITE_DISCARD, 0, &map)); - cb_frame_t* cb_frame_data = (cb_frame_t*)map.pData; - D3DXMatrixIdentity(&cb_frame_data->model); - - D3DXMATRIX view; - D3DXVECTOR3 eye(2.0f * (float)sin(time), 0.0f, 2.0f * (float)cos(time)); - D3DXVECTOR3 at(0, 0, 0); - D3DXVECTOR3 up(0, 1, 0); - D3DXMatrixLookAtLH(&view, &eye, &at, &up); - D3DXMATRIX proj; - D3DXMatrixPerspectiveLH(&proj, 1.1f, 1.1f, 1.0f, 3.0f); - - cb_frame_data->view_proj = view * proj; - float min_tess_factor = 1.0f; - cb_frame_data->tess_factor = (1.0f - (float)cos(time)) * ((64.0f - min_tess_factor) / 2.0f) + min_tess_factor; - cb_frame_data->disp_scale = 0.9f; - //cb_frame_data->disp_scale = (sin(time) + 1.0) / 2.0; - cb_frame_data->disp_freq = 5.0f * (float)M_PI; - //cb_frame_data->disp_freq = (4.0 + 4.0 * cos(time / 5.0)) * PI; - ctx->Unmap(cb_frame, 0); - - ctx->HSSetConstantBuffers(0, 1, &cb_frame); - ctx->DSSetConstantBuffers(0, 1, &cb_frame); - - //ctx->OMSetBlendState(bs, black, ~0); - //ctx->OMSetDepthStencilState(dss, 0); - ctx->OMSetRenderTargets(1, &rtv, zsv); - //ctx->RSSetState(rs); - ctx->RSSetViewports(1, &vp); - - ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST); - ctx->IASetInputLayout(layout); - unsigned stride = 3 * 4; - unsigned offset = 0; - ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); - - ctx->VSSetShader(vs, NULL, 0); - ctx->HSSetShader(hs, NULL, 0); - ctx->DSSetShader(ds, NULL, 0); - ctx->GSSetShader(NULL, NULL, 0); - ctx->PSSetShader(ps, NULL, 0); - - ctx->ClearRenderTargetView(rtv, black); - ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH, 1.0f, 0); - - ctx->Draw(3 * 8, 0); - } -}; - -d3d11_application* d3d11_application_create() -{ - return new d3d11spikysphere(); -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#define _USE_MATH_DEFINES +#include "d3d11app.h" +#include "d3d11spikysphere.hlsl.vs.h" +#include "d3d11spikysphere.hlsl.hs.h" +#include "d3d11spikysphere.hlsl.ds.h" +#include "d3d11spikysphere.hlsl.ps.h" + +#include +#include +#include +#include +#include + +struct cb_frame_t +{ + D3DXMATRIX model; + D3DXMATRIX view_proj; + float disp_scale; + float disp_freq; + float tess_factor; +}; + +static float vertex_data[] = +{ + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + + 0.0, 1.0, 0.0, + -1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + + 0.0, -1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + + -1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, 1.0, + + 0.0, 1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, -1.0, + + -1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, -1.0, + + 1.0, 0.0, 0.0, + 0.0, -1.0, 0.0, + 0.0, 0.0, -1.0, + + 0.0, -1.0, 0.0, + -1.0, 0.0, 0.0, + 0.0, 0.0, -1.0, +}; + +struct d3d11spikysphere : public d3d11_application +{ + ID3D11Device* dev; + ID3D11PixelShader* ps; + ID3D11DomainShader* ds; + ID3D11HullShader* hs; + ID3D11VertexShader* vs; + ID3D11InputLayout* layout; + ID3D11Buffer* vb; + ID3D11RenderTargetView* rtv; + ID3D11DepthStencilView* zsv; + ID3D11Buffer* cb_frame; + + int cur_width; + int cur_height; + + d3d11spikysphere() + : cur_width(-1), cur_height(-1), zsv(0) + {} + + bool init(ID3D11Device* dev, int argc, char** argv) + { + this->dev = dev; + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + ensure(dev->CreateHullShader(g_hs, sizeof(g_hs), NULL, &hs)); + ensure(dev->CreateDomainShader(g_ds, sizeof(g_ds), NULL, &ds)); + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + + D3D11_INPUT_ELEMENT_DESC elements[1] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, + 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + ensure(dev->CreateInputLayout(elements, 1, g_vs, sizeof(g_vs), &layout)); + + D3D11_BUFFER_DESC bufferd; + bufferd.ByteWidth = sizeof(vertex_data); + bufferd.Usage = D3D11_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufferd.CPUAccessFlags = 0; + bufferd.MiscFlags = 0; + bufferd.StructureByteStride = 0; + + D3D11_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = vertex_data; + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); + + D3D11_BUFFER_DESC cbd; + cbd.ByteWidth = (sizeof(cb_frame_t) + 15) & ~15; + cbd.Usage = D3D11_USAGE_DYNAMIC; + cbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + cbd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + cbd.MiscFlags = 0; + cbd.StructureByteStride = 0; + + ensure(dev->CreateBuffer(&cbd, NULL, &cb_frame)); + return true; + } + + void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + if(width != cur_width || height != cur_height) + { + if(zsv) + zsv->Release(); + ID3D11Texture2D* zsbuf; + D3D11_TEXTURE2D_DESC zsbufd; + memset(&zsbufd, 0, sizeof(zsbufd)); + zsbufd.Width = width; + zsbufd.Height = height; + zsbufd.Format = DXGI_FORMAT_D32_FLOAT; + zsbufd.ArraySize = 1; + zsbufd.MipLevels = 1; + zsbufd.SampleDesc.Count = 1; + zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL; + ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf)); + ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv)); + zsbuf->Release(); + } + + float black[4] = {0, 0, 0, 0}; + + D3D11_MAPPED_SUBRESOURCE map; + ensure(ctx->Map(cb_frame, 0, D3D11_MAP_WRITE_DISCARD, 0, &map)); + cb_frame_t* cb_frame_data = (cb_frame_t*)map.pData; + D3DXMatrixIdentity(&cb_frame_data->model); + + D3DXMATRIX view; + D3DXVECTOR3 eye(2.0f * (float)sin(time), 0.0f, 2.0f * (float)cos(time)); + D3DXVECTOR3 at(0, 0, 0); + D3DXVECTOR3 up(0, 1, 0); + D3DXMatrixLookAtLH(&view, &eye, &at, &up); + D3DXMATRIX proj; + D3DXMatrixPerspectiveLH(&proj, 1.1f, 1.1f, 1.0f, 3.0f); + + cb_frame_data->view_proj = view * proj; + float min_tess_factor = 1.0f; + cb_frame_data->tess_factor = (1.0f - (float)cos(time)) * ((64.0f - min_tess_factor) / 2.0f) + min_tess_factor; + cb_frame_data->disp_scale = 0.9f; + //cb_frame_data->disp_scale = (sin(time) + 1.0) / 2.0; + cb_frame_data->disp_freq = 5.0f * (float)M_PI; + //cb_frame_data->disp_freq = (4.0 + 4.0 * cos(time / 5.0)) * PI; + ctx->Unmap(cb_frame, 0); + + ctx->HSSetConstantBuffers(0, 1, &cb_frame); + ctx->DSSetConstantBuffers(0, 1, &cb_frame); + + //ctx->OMSetBlendState(bs, black, ~0); + //ctx->OMSetDepthStencilState(dss, 0); + ctx->OMSetRenderTargets(1, &rtv, zsv); + //ctx->RSSetState(rs); + ctx->RSSetViewports(1, &vp); + + ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST); + ctx->IASetInputLayout(layout); + unsigned stride = 3 * 4; + unsigned offset = 0; + ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); + + ctx->VSSetShader(vs, NULL, 0); + ctx->HSSetShader(hs, NULL, 0); + ctx->DSSetShader(ds, NULL, 0); + ctx->GSSetShader(NULL, NULL, 0); + ctx->PSSetShader(ps, NULL, 0); + + ctx->ClearRenderTargetView(rtv, black); + ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH, 1.0f, 0); + + ctx->Draw(3 * 8, 0); + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11spikysphere(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h index 4ec1f6b87e3..45045e5c613 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h @@ -1,623 +1,623 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11spikysphere.hlsl.ds.h /Eds /Tds_5_0 d3d11spikysphere.hlsl -// -// -// Buffer Definitions: -// -// cbuffer cb_frame -// { -// -// float4x4 model; // Offset: 0 Size: 64 -// float4x4 view_proj; // Offset: 64 Size: 64 -// float disp_scale; // Offset: 128 Size: 4 -// float disp_freq; // Offset: 132 Size: 4 -// float tess_factor; // Offset: 136 Size: 4 [unused] -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// cb_frame cbuffer NA NA 0 1 -// -// -// -// Patch Constant signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TessFactor 0 x 0 TRIEDGE float -// SV_TessFactor 1 x 1 TRIEDGE float -// SV_TessFactor 2 x 2 TRIEDGE float -// SV_InsideTessFactor 0 x 3 TRIINT float -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyz 0 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// OBJPOS 0 xyz 1 NONE float xyz -// OBJNORMAL 0 xyz 2 NONE float xyz -// WORLDNORMAL 0 xyz 3 NONE float xyz -// -// Tessellation Domain # of control points -// -------------------- -------------------- -// Triangle 3 -// -ds_5_0 -dcl_input_control_point_count 3 -dcl_tessellator_domain domain_tri -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[9], immediateIndexed -dcl_input vDomain.xyz -dcl_input vicp[3][0].xyz -dcl_output_siv o0.xyzw, position -dcl_output o1.xyz -dcl_output o2.xyz -dcl_output o3.xyz -dcl_temps 5 -add r0.x, cb0[8].x, l(1.000000) -mul r0.yzw, vDomain.yyyy, vicp[1][0].yyzx -mad r0.yzw, vicp[0][0].yyzx, vDomain.xxxx, r0.yyzw -mad r0.yzw, vicp[2][0].yyzx, vDomain.zzzz, r0.yyzw -dp3 r1.x, r0.yzwy, r0.yzwy -rsq r1.x, r1.x -mul r0.yzw, r0.yyzw, r1.xxxx -mul r1.xyz, r0.wyzw, cb0[8].yyyy -sincos null, r2.xyz, r1.zxyz -sincos r1.xyz, null, -r1.xyzx -mul r1.xyz, r1.xyzx, cb0[8].yyyy -mul r1.xyz, r2.zxyz, r1.xyzx -mul r1.xyz, r2.xyzx, r1.xyzx -mul r1.xyz, r1.xyzx, cb0[8].xxxx -mul r1.w, r2.z, r2.y -mul r1.w, r2.x, r1.w -mad r1.w, r1.w, cb0[8].x, l(1.000000) -mul r2.xyz, r0.wyzw, r1.wwww -div r2.xyz, r2.xyzx, r0.xxxx -mul r3.xyz, r2.yyyy, cb0[1].xyzx -mad r3.xyz, cb0[0].xyzx, r2.xxxx, r3.xyzx -mad r3.xyz, cb0[2].xyzx, r2.zzzz, r3.xyzx -mov o1.xyz, r2.xyzx -add r2.xyz, r3.xyzx, cb0[3].xyzx -mul r3.xyzw, r2.yyyy, cb0[5].xyzw -mad r3.xyzw, cb0[4].xyzw, r2.xxxx, r3.xyzw -mad r2.xyzw, cb0[6].xyzw, r2.zzzz, r3.xyzw -add o0.xyzw, r2.xyzw, cb0[7].xyzw -mov r2.y, l(0) -lt r0.x, |r0.y|, |r0.w| -mul r2.xz, r0.zzwz, l(-1.000000, 0.000000, 1.000000, 0.000000) -mov r2.w, r0.y -movc r2.xyz, r0.xxxx, r2.zxyz, r2.wyxw -dp3 r0.x, r2.xyzx, r2.xyzx -rsq r0.x, r0.x -mul r2.xyz, r0.xxxx, r2.xyzx -mul r3.xyz, r0.wyzw, r2.xyzx -mad r3.xyz, r0.zwyz, r2.yzxy, -r3.xyzx -dp3 r0.x, r3.xyzx, r3.xyzx -rsq r0.x, r0.x -mul r3.xyz, r0.xxxx, r3.xyzx -dp3 r0.x, r1.yzxy, r3.xyzx -mul r3.xyz, r1.wwww, r3.xyzx -mul r4.xyz, r1.wwww, r2.xyzx -dp3 r1.x, r1.zxyz, r2.xyzx -mad r1.xyz, r0.zwyz, r1.xxxx, r4.xyzx -mad r0.xyz, r0.yzwy, r0.xxxx, r3.xyzx -mul r2.xyz, r0.xyzx, r1.xyzx -mad r0.xyz, r1.zxyz, r0.yzxy, -r2.xyzx -dp3 r0.w, r0.xyzx, r0.xyzx -rsq r0.w, r0.w -mul r0.xyz, r0.wwww, r0.xyzx -mov o2.xyz, r0.xyzx -mul r1.xyz, r0.yyyy, cb0[1].xyzx -mad r0.xyw, cb0[0].xyxz, r0.xxxx, r1.xyxz -mad o3.xyz, cb0[2].xyzx, r0.zzzz, r0.xywx -ret -// Approximately 57 instruction slots used -#endif - -const BYTE g_ds[] = -{ - 68, 88, 66, 67, 0, 128, - 111, 5, 170, 61, 238, 30, - 169, 104, 139, 245, 182, 233, - 180, 255, 1, 0, 0, 0, - 112, 11, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, - 68, 2, 0, 0, 120, 2, - 0, 0, 12, 3, 0, 0, - 168, 3, 0, 0, 212, 10, - 0, 0, 82, 68, 69, 70, - 4, 2, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 0, - 1, 0, 0, 0, 60, 0, - 0, 0, 0, 5, 83, 68, - 0, 1, 0, 0, 210, 1, - 0, 0, 82, 68, 49, 49, - 60, 0, 0, 0, 24, 0, - 0, 0, 32, 0, 0, 0, - 40, 0, 0, 0, 36, 0, - 0, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 92, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 99, 98, 95, 102, 114, 97, - 109, 101, 0, 171, 171, 171, - 92, 0, 0, 0, 5, 0, - 0, 0, 128, 0, 0, 0, - 144, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 72, 1, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, - 2, 0, 0, 0, 88, 1, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 124, 1, - 0, 0, 64, 0, 0, 0, - 64, 0, 0, 0, 2, 0, - 0, 0, 88, 1, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 134, 1, 0, 0, - 128, 0, 0, 0, 4, 0, - 0, 0, 2, 0, 0, 0, - 152, 1, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 188, 1, 0, 0, 132, 0, - 0, 0, 4, 0, 0, 0, - 2, 0, 0, 0, 152, 1, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 198, 1, - 0, 0, 136, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 152, 1, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 109, 111, 100, 101, - 108, 0, 102, 108, 111, 97, - 116, 52, 120, 52, 0, 171, - 3, 0, 3, 0, 4, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 78, 1, 0, 0, - 118, 105, 101, 119, 95, 112, - 114, 111, 106, 0, 100, 105, - 115, 112, 95, 115, 99, 97, - 108, 101, 0, 102, 108, 111, - 97, 116, 0, 171, 0, 0, - 3, 0, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 145, 1, 0, 0, 100, 105, - 115, 112, 95, 102, 114, 101, - 113, 0, 116, 101, 115, 115, - 95, 102, 97, 99, 116, 111, - 114, 0, 77, 105, 99, 114, - 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, - 100, 101, 114, 32, 67, 111, - 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 73, 83, - 71, 78, 44, 0, 0, 0, - 1, 0, 0, 0, 8, 0, - 0, 0, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 7, 7, - 0, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 171, - 171, 171, 80, 67, 83, 71, - 140, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, - 104, 0, 0, 0, 0, 0, - 0, 0, 13, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 104, 0, 0, 0, 1, 0, - 0, 0, 13, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, - 104, 0, 0, 0, 2, 0, - 0, 0, 13, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 1, 0, 0, 0, - 118, 0, 0, 0, 0, 0, - 0, 0, 14, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 83, 86, 95, 84, 101, 115, - 115, 70, 97, 99, 116, 111, - 114, 0, 83, 86, 95, 73, - 110, 115, 105, 100, 101, 84, - 101, 115, 115, 70, 97, 99, - 116, 111, 114, 0, 171, 171, - 79, 83, 71, 78, 148, 0, - 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 116, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 7, 8, 0, 0, 123, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 7, 8, 0, 0, 133, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 7, 8, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 79, 66, - 74, 80, 79, 83, 0, 79, - 66, 74, 78, 79, 82, 77, - 65, 76, 0, 87, 79, 82, - 76, 68, 78, 79, 82, 77, - 65, 76, 0, 171, 171, 171, - 83, 72, 69, 88, 36, 7, - 0, 0, 80, 0, 4, 0, - 201, 1, 0, 0, 147, 24, - 0, 1, 149, 16, 0, 1, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 9, 0, - 0, 0, 95, 0, 0, 2, - 114, 192, 1, 0, 95, 0, - 0, 4, 114, 144, 33, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 103, 0, 0, 4, - 242, 32, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 114, 32, - 16, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 114, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 114, 32, - 16, 0, 3, 0, 0, 0, - 104, 0, 0, 2, 5, 0, - 0, 0, 0, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 7, 226, 0, 16, 0, - 0, 0, 0, 0, 86, 197, - 1, 0, 86, 146, 33, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 9, - 226, 0, 16, 0, 0, 0, - 0, 0, 86, 146, 33, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 6, 192, 1, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 9, - 226, 0, 16, 0, 0, 0, - 0, 0, 86, 146, 33, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 166, 202, 1, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 16, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 150, 7, 16, 0, - 0, 0, 0, 0, 150, 7, - 16, 0, 0, 0, 0, 0, - 68, 0, 0, 5, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 226, 0, 16, 0, 0, 0, - 0, 0, 86, 14, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 8, 114, 0, - 16, 0, 1, 0, 0, 0, - 118, 14, 16, 0, 0, 0, - 0, 0, 86, 133, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 77, 0, 0, 6, - 0, 208, 0, 0, 114, 0, - 16, 0, 2, 0, 0, 0, - 38, 9, 16, 0, 1, 0, - 0, 0, 77, 0, 0, 7, - 114, 0, 16, 0, 1, 0, - 0, 0, 0, 208, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 1, 0, 0, 0, - 56, 0, 0, 8, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 86, 133, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 1, 0, - 0, 0, 38, 9, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 8, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 7, 130, 0, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 10, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 1, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 8, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 114, 0, - 16, 0, 2, 0, 0, 0, - 118, 14, 16, 0, 0, 0, - 0, 0, 246, 15, 16, 0, - 1, 0, 0, 0, 14, 0, - 0, 7, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 3, 0, - 0, 0, 86, 5, 16, 0, - 2, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 3, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 10, - 114, 0, 16, 0, 3, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 10, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 114, 32, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 3, 0, 0, 0, 86, 5, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 3, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 0, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 166, 10, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 3, 0, - 0, 0, 0, 0, 0, 8, - 242, 32, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 54, 0, - 0, 5, 34, 0, 16, 0, - 2, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 9, 18, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 128, 129, 0, - 0, 0, 0, 0, 0, 0, - 58, 0, 16, 128, 129, 0, - 0, 0, 0, 0, 0, 0, - 56, 0, 0, 10, 82, 0, - 16, 0, 2, 0, 0, 0, - 166, 11, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 0, 54, 0, - 0, 5, 130, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 2, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 38, 9, 16, 0, - 2, 0, 0, 0, 118, 12, - 16, 0, 2, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 68, 0, - 0, 5, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 114, 0, - 16, 0, 2, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 3, 0, 0, 0, 118, 14, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 10, - 114, 0, 16, 0, 3, 0, - 0, 0, 230, 9, 16, 0, - 0, 0, 0, 0, 150, 4, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 3, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 68, 0, - 0, 5, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 114, 0, - 16, 0, 3, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 16, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 150, 4, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 3, 0, - 0, 0, 246, 15, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 56, 0, 0, 7, 114, 0, - 16, 0, 4, 0, 0, 0, - 246, 15, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 16, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 38, 9, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 1, 0, - 0, 0, 230, 9, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 0, 0, - 0, 0, 150, 7, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 0, 0, 0, 0, - 38, 9, 16, 0, 1, 0, - 0, 0, 150, 4, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 16, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 68, 0, 0, 5, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 0, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 114, 32, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 114, 0, 16, 0, - 1, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 178, 0, - 16, 0, 0, 0, 0, 0, - 70, 136, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 8, 16, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 114, 32, 16, 0, - 3, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 3, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 148, 0, - 0, 0, 57, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 38, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.ds.h /Eds /Tds_5_0 d3d11spikysphere.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb_frame +// { +// +// float4x4 model; // Offset: 0 Size: 64 +// float4x4 view_proj; // Offset: 64 Size: 64 +// float disp_scale; // Offset: 128 Size: 4 +// float disp_freq; // Offset: 132 Size: 4 +// float tess_factor; // Offset: 136 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb_frame cbuffer NA NA 0 1 +// +// +// +// Patch Constant signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TessFactor 0 x 0 TRIEDGE float +// SV_TessFactor 1 x 1 TRIEDGE float +// SV_TessFactor 2 x 2 TRIEDGE float +// SV_InsideTessFactor 0 x 3 TRIINT float +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// OBJPOS 0 xyz 1 NONE float xyz +// OBJNORMAL 0 xyz 2 NONE float xyz +// WORLDNORMAL 0 xyz 3 NONE float xyz +// +// Tessellation Domain # of control points +// -------------------- -------------------- +// Triangle 3 +// +ds_5_0 +dcl_input_control_point_count 3 +dcl_tessellator_domain domain_tri +dcl_globalFlags refactoringAllowed +dcl_constantbuffer cb0[9], immediateIndexed +dcl_input vDomain.xyz +dcl_input vicp[3][0].xyz +dcl_output_siv o0.xyzw, position +dcl_output o1.xyz +dcl_output o2.xyz +dcl_output o3.xyz +dcl_temps 5 +add r0.x, cb0[8].x, l(1.000000) +mul r0.yzw, vDomain.yyyy, vicp[1][0].yyzx +mad r0.yzw, vicp[0][0].yyzx, vDomain.xxxx, r0.yyzw +mad r0.yzw, vicp[2][0].yyzx, vDomain.zzzz, r0.yyzw +dp3 r1.x, r0.yzwy, r0.yzwy +rsq r1.x, r1.x +mul r0.yzw, r0.yyzw, r1.xxxx +mul r1.xyz, r0.wyzw, cb0[8].yyyy +sincos null, r2.xyz, r1.zxyz +sincos r1.xyz, null, -r1.xyzx +mul r1.xyz, r1.xyzx, cb0[8].yyyy +mul r1.xyz, r2.zxyz, r1.xyzx +mul r1.xyz, r2.xyzx, r1.xyzx +mul r1.xyz, r1.xyzx, cb0[8].xxxx +mul r1.w, r2.z, r2.y +mul r1.w, r2.x, r1.w +mad r1.w, r1.w, cb0[8].x, l(1.000000) +mul r2.xyz, r0.wyzw, r1.wwww +div r2.xyz, r2.xyzx, r0.xxxx +mul r3.xyz, r2.yyyy, cb0[1].xyzx +mad r3.xyz, cb0[0].xyzx, r2.xxxx, r3.xyzx +mad r3.xyz, cb0[2].xyzx, r2.zzzz, r3.xyzx +mov o1.xyz, r2.xyzx +add r2.xyz, r3.xyzx, cb0[3].xyzx +mul r3.xyzw, r2.yyyy, cb0[5].xyzw +mad r3.xyzw, cb0[4].xyzw, r2.xxxx, r3.xyzw +mad r2.xyzw, cb0[6].xyzw, r2.zzzz, r3.xyzw +add o0.xyzw, r2.xyzw, cb0[7].xyzw +mov r2.y, l(0) +lt r0.x, |r0.y|, |r0.w| +mul r2.xz, r0.zzwz, l(-1.000000, 0.000000, 1.000000, 0.000000) +mov r2.w, r0.y +movc r2.xyz, r0.xxxx, r2.zxyz, r2.wyxw +dp3 r0.x, r2.xyzx, r2.xyzx +rsq r0.x, r0.x +mul r2.xyz, r0.xxxx, r2.xyzx +mul r3.xyz, r0.wyzw, r2.xyzx +mad r3.xyz, r0.zwyz, r2.yzxy, -r3.xyzx +dp3 r0.x, r3.xyzx, r3.xyzx +rsq r0.x, r0.x +mul r3.xyz, r0.xxxx, r3.xyzx +dp3 r0.x, r1.yzxy, r3.xyzx +mul r3.xyz, r1.wwww, r3.xyzx +mul r4.xyz, r1.wwww, r2.xyzx +dp3 r1.x, r1.zxyz, r2.xyzx +mad r1.xyz, r0.zwyz, r1.xxxx, r4.xyzx +mad r0.xyz, r0.yzwy, r0.xxxx, r3.xyzx +mul r2.xyz, r0.xyzx, r1.xyzx +mad r0.xyz, r1.zxyz, r0.yzxy, -r2.xyzx +dp3 r0.w, r0.xyzx, r0.xyzx +rsq r0.w, r0.w +mul r0.xyz, r0.wwww, r0.xyzx +mov o2.xyz, r0.xyzx +mul r1.xyz, r0.yyyy, cb0[1].xyzx +mad r0.xyw, cb0[0].xyxz, r0.xxxx, r1.xyxz +mad o3.xyz, cb0[2].xyzx, r0.zzzz, r0.xywx +ret +// Approximately 57 instruction slots used +#endif + +const BYTE g_ds[] = +{ + 68, 88, 66, 67, 0, 128, + 111, 5, 170, 61, 238, 30, + 169, 104, 139, 245, 182, 233, + 180, 255, 1, 0, 0, 0, + 112, 11, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 68, 2, 0, 0, 120, 2, + 0, 0, 12, 3, 0, 0, + 168, 3, 0, 0, 212, 10, + 0, 0, 82, 68, 69, 70, + 4, 2, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 60, 0, + 0, 0, 0, 5, 83, 68, + 0, 1, 0, 0, 210, 1, + 0, 0, 82, 68, 49, 49, + 60, 0, 0, 0, 24, 0, + 0, 0, 32, 0, 0, 0, + 40, 0, 0, 0, 36, 0, + 0, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 95, 102, 114, 97, + 109, 101, 0, 171, 171, 171, + 92, 0, 0, 0, 5, 0, + 0, 0, 128, 0, 0, 0, + 144, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 1, 0, 0, 0, 0, + 0, 0, 64, 0, 0, 0, + 2, 0, 0, 0, 88, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 124, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 2, 0, + 0, 0, 88, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 134, 1, 0, 0, + 128, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 152, 1, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 188, 1, 0, 0, 132, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 152, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 198, 1, + 0, 0, 136, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 152, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 109, 111, 100, 101, + 108, 0, 102, 108, 111, 97, + 116, 52, 120, 52, 0, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 78, 1, 0, 0, + 118, 105, 101, 119, 95, 112, + 114, 111, 106, 0, 100, 105, + 115, 112, 95, 115, 99, 97, + 108, 101, 0, 102, 108, 111, + 97, 116, 0, 171, 0, 0, + 3, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 145, 1, 0, 0, 100, 105, + 115, 112, 95, 102, 114, 101, + 113, 0, 116, 101, 115, 115, + 95, 102, 97, 99, 116, 111, + 114, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 57, 46, 50, 57, 46, + 57, 53, 50, 46, 51, 49, + 49, 49, 0, 171, 73, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 7, 7, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 171, + 171, 171, 80, 67, 83, 71, + 140, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 13, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 0, 1, 0, + 0, 0, 13, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 104, 0, 0, 0, 2, 0, + 0, 0, 13, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 1, 0, 0, 0, + 118, 0, 0, 0, 0, 0, + 0, 0, 14, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 83, 86, 95, 84, 101, 115, + 115, 70, 97, 99, 116, 111, + 114, 0, 83, 86, 95, 73, + 110, 115, 105, 100, 101, 84, + 101, 115, 115, 70, 97, 99, + 116, 111, 114, 0, 171, 171, + 79, 83, 71, 78, 148, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 116, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 7, 8, 0, 0, 123, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 7, 8, 0, 0, 133, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 7, 8, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 79, 66, + 74, 80, 79, 83, 0, 79, + 66, 74, 78, 79, 82, 77, + 65, 76, 0, 87, 79, 82, + 76, 68, 78, 79, 82, 77, + 65, 76, 0, 171, 171, 171, + 83, 72, 69, 88, 36, 7, + 0, 0, 80, 0, 4, 0, + 201, 1, 0, 0, 147, 24, + 0, 1, 149, 16, 0, 1, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 9, 0, + 0, 0, 95, 0, 0, 2, + 114, 192, 1, 0, 95, 0, + 0, 4, 114, 144, 33, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 2, 0, 0, 0, + 101, 0, 0, 3, 114, 32, + 16, 0, 3, 0, 0, 0, + 104, 0, 0, 2, 5, 0, + 0, 0, 0, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 226, 0, 16, 0, + 0, 0, 0, 0, 86, 197, + 1, 0, 86, 146, 33, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 146, 33, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 6, 192, 1, 0, + 86, 14, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 9, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 146, 33, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 166, 202, 1, 0, + 86, 14, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 150, 7, + 16, 0, 0, 0, 0, 0, + 68, 0, 0, 5, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 14, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 118, 14, 16, 0, 0, 0, + 0, 0, 86, 133, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 77, 0, 0, 6, + 0, 208, 0, 0, 114, 0, + 16, 0, 2, 0, 0, 0, + 38, 9, 16, 0, 1, 0, + 0, 0, 77, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 0, 208, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 86, 133, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 1, 0, + 0, 0, 38, 9, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 7, 130, 0, + 16, 0, 1, 0, 0, 0, + 42, 0, 16, 0, 2, 0, + 0, 0, 26, 0, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 130, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 2, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 10, + 130, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 118, 14, 16, 0, 0, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 14, 0, + 0, 7, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 3, 0, + 0, 0, 86, 5, 16, 0, + 2, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 130, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 166, 10, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 54, 0, 0, 5, 114, 32, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 0, 0, 0, 8, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 3, 0, 0, 0, 86, 5, + 16, 0, 2, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 50, 0, 0, 10, 242, 0, + 16, 0, 3, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 166, 10, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 3, 0, + 0, 0, 0, 0, 0, 8, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 54, 0, + 0, 5, 34, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 49, 0, 0, 9, 18, 0, + 16, 0, 0, 0, 0, 0, + 26, 0, 16, 128, 129, 0, + 0, 0, 0, 0, 0, 0, + 58, 0, 16, 128, 129, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 82, 0, + 16, 0, 2, 0, 0, 0, + 166, 11, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 191, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 0, 0, 54, 0, + 0, 5, 130, 0, 16, 0, + 2, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 38, 9, 16, 0, + 2, 0, 0, 0, 118, 12, + 16, 0, 2, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 3, 0, 0, 0, 118, 14, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 230, 9, 16, 0, + 0, 0, 0, 0, 150, 4, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 128, 65, 0, + 0, 0, 3, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 3, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 150, 4, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 3, 0, + 0, 0, 246, 15, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 4, 0, 0, 0, + 246, 15, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 38, 9, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 9, + 114, 0, 16, 0, 1, 0, + 0, 0, 230, 9, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 50, 0, 0, 9, + 114, 0, 16, 0, 0, 0, + 0, 0, 150, 7, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 38, 9, 16, 0, 1, 0, + 0, 0, 150, 4, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 0, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 114, 32, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 86, 5, + 16, 0, 0, 0, 0, 0, + 70, 130, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 50, 0, 0, 10, 178, 0, + 16, 0, 0, 0, 0, 0, + 70, 136, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 8, 16, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 114, 32, 16, 0, + 3, 0, 0, 0, 70, 130, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 166, 10, + 16, 0, 0, 0, 0, 0, + 70, 3, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 148, 0, + 0, 0, 57, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 38, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h index 316bcdfedd7..d37502a5a86 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h @@ -1,297 +1,297 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11spikysphere.hlsl.hs.h /Ehs /Ths_5_0 d3d11spikysphere.hlsl -// -// -// Buffer Definitions: -// -// cbuffer cb_frame -// { -// -// float4x4 model; // Offset: 0 Size: 64 [unused] -// float4x4 view_proj; // Offset: 64 Size: 64 [unused] -// float disp_scale; // Offset: 128 Size: 4 [unused] -// float disp_freq; // Offset: 132 Size: 4 [unused] -// float tess_factor; // Offset: 136 Size: 4 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// cb_frame cbuffer NA NA 0 1 -// -// -// -// Patch Constant signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TessFactor 0 x 0 TRIEDGE float x -// SV_TessFactor 1 x 1 TRIEDGE float x -// SV_TessFactor 2 x 2 TRIEDGE float x -// SV_InsideTessFactor 0 x 3 TRIINT float x -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyz 0 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyz 0 NONE float xyz -// -// Tessellation Domain # of control points -// -------------------- -------------------- -// Triangle 3 -// -// Tessellation Output Primitive Partitioning Type -// ------------------------------ ------------------ -// Clockwise Triangles Even Fractional -// -hs_5_0 -hs_decls -dcl_input_control_point_count 3 -dcl_output_control_point_count 3 -dcl_tessellator_domain domain_tri -dcl_tessellator_partitioning partitioning_fractional_even -dcl_tessellator_output_primitive output_triangle_cw -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[9], immediateIndexed -hs_fork_phase -dcl_hs_fork_phase_instance_count 3 -dcl_input vForkInstanceID -dcl_output_siv o0.x, finalTriUeq0EdgeTessFactor -dcl_output_siv o1.x, finalTriVeq0EdgeTessFactor -dcl_output_siv o2.x, finalTriWeq0EdgeTessFactor -dcl_temps 1 -dcl_indexrange o0.x 3 -mov r0.x, vForkInstanceID.x -mov o[r0.x + 0].x, cb0[8].z -ret -hs_fork_phase -dcl_output_siv o3.x, finalTriInsideTessFactor -mov o3.x, cb0[8].z -ret -// Approximately 5 instruction slots used -#endif - -const BYTE g_hs[] = -{ - 68, 88, 66, 67, 174, 23, - 253, 184, 171, 234, 181, 122, - 114, 17, 23, 172, 69, 130, - 17, 19, 1, 0, 0, 0, - 212, 4, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, - 68, 2, 0, 0, 120, 2, - 0, 0, 172, 2, 0, 0, - 64, 3, 0, 0, 56, 4, - 0, 0, 82, 68, 69, 70, - 4, 2, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 0, - 1, 0, 0, 0, 60, 0, - 0, 0, 0, 5, 83, 72, - 0, 1, 0, 0, 210, 1, - 0, 0, 82, 68, 49, 49, - 60, 0, 0, 0, 24, 0, - 0, 0, 32, 0, 0, 0, - 40, 0, 0, 0, 36, 0, - 0, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 92, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 99, 98, 95, 102, 114, 97, - 109, 101, 0, 171, 171, 171, - 92, 0, 0, 0, 5, 0, - 0, 0, 128, 0, 0, 0, - 144, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 72, 1, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, - 0, 0, 0, 0, 88, 1, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 124, 1, - 0, 0, 64, 0, 0, 0, - 64, 0, 0, 0, 0, 0, - 0, 0, 88, 1, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 134, 1, 0, 0, - 128, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 152, 1, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 188, 1, 0, 0, 132, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 152, 1, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 198, 1, - 0, 0, 136, 0, 0, 0, - 4, 0, 0, 0, 2, 0, - 0, 0, 152, 1, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 109, 111, 100, 101, - 108, 0, 102, 108, 111, 97, - 116, 52, 120, 52, 0, 171, - 3, 0, 3, 0, 4, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 78, 1, 0, 0, - 118, 105, 101, 119, 95, 112, - 114, 111, 106, 0, 100, 105, - 115, 112, 95, 115, 99, 97, - 108, 101, 0, 102, 108, 111, - 97, 116, 0, 171, 0, 0, - 3, 0, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 145, 1, 0, 0, 100, 105, - 115, 112, 95, 102, 114, 101, - 113, 0, 116, 101, 115, 115, - 95, 102, 97, 99, 116, 111, - 114, 0, 77, 105, 99, 114, - 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, - 100, 101, 114, 32, 67, 111, - 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 73, 83, - 71, 78, 44, 0, 0, 0, - 1, 0, 0, 0, 8, 0, - 0, 0, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 7, 7, - 0, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 171, - 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 7, 8, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 171, 171, 171, - 80, 67, 83, 71, 140, 0, - 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 1, 14, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 13, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 1, 14, 0, 0, 104, 0, - 0, 0, 2, 0, 0, 0, - 13, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 1, 14, 0, 0, 118, 0, - 0, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 1, 14, 0, 0, 83, 86, - 95, 84, 101, 115, 115, 70, - 97, 99, 116, 111, 114, 0, - 83, 86, 95, 73, 110, 115, - 105, 100, 101, 84, 101, 115, - 115, 70, 97, 99, 116, 111, - 114, 0, 171, 171, 83, 72, - 69, 88, 240, 0, 0, 0, - 80, 0, 3, 0, 60, 0, - 0, 0, 113, 0, 0, 1, - 147, 24, 0, 1, 148, 24, - 0, 1, 149, 16, 0, 1, - 150, 32, 0, 1, 151, 24, - 0, 1, 106, 8, 0, 1, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 115, 0, - 0, 1, 153, 0, 0, 2, - 3, 0, 0, 0, 95, 0, - 0, 2, 0, 112, 1, 0, - 103, 0, 0, 4, 18, 32, - 16, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 103, 0, - 0, 4, 18, 32, 16, 0, - 1, 0, 0, 0, 18, 0, - 0, 0, 103, 0, 0, 4, - 18, 32, 16, 0, 2, 0, - 0, 0, 19, 0, 0, 0, - 104, 0, 0, 2, 1, 0, - 0, 0, 91, 0, 0, 4, - 18, 32, 16, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 4, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 112, 1, 0, 54, 0, - 0, 7, 18, 32, 144, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 42, 128, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 62, 0, 0, 1, - 115, 0, 0, 1, 103, 0, - 0, 4, 18, 32, 16, 0, - 3, 0, 0, 0, 20, 0, - 0, 0, 54, 0, 0, 6, - 18, 32, 16, 0, 3, 0, - 0, 0, 42, 128, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 148, 0, - 0, 0, 5, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 4, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.hs.h /Ehs /Ths_5_0 d3d11spikysphere.hlsl +// +// +// Buffer Definitions: +// +// cbuffer cb_frame +// { +// +// float4x4 model; // Offset: 0 Size: 64 [unused] +// float4x4 view_proj; // Offset: 64 Size: 64 [unused] +// float disp_scale; // Offset: 128 Size: 4 [unused] +// float disp_freq; // Offset: 132 Size: 4 [unused] +// float tess_factor; // Offset: 136 Size: 4 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// cb_frame cbuffer NA NA 0 1 +// +// +// +// Patch Constant signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TessFactor 0 x 0 TRIEDGE float x +// SV_TessFactor 1 x 1 TRIEDGE float x +// SV_TessFactor 2 x 2 TRIEDGE float x +// SV_InsideTessFactor 0 x 3 TRIINT float x +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// Tessellation Domain # of control points +// -------------------- -------------------- +// Triangle 3 +// +// Tessellation Output Primitive Partitioning Type +// ------------------------------ ------------------ +// Clockwise Triangles Even Fractional +// +hs_5_0 +hs_decls +dcl_input_control_point_count 3 +dcl_output_control_point_count 3 +dcl_tessellator_domain domain_tri +dcl_tessellator_partitioning partitioning_fractional_even +dcl_tessellator_output_primitive output_triangle_cw +dcl_globalFlags refactoringAllowed +dcl_constantbuffer cb0[9], immediateIndexed +hs_fork_phase +dcl_hs_fork_phase_instance_count 3 +dcl_input vForkInstanceID +dcl_output_siv o0.x, finalTriUeq0EdgeTessFactor +dcl_output_siv o1.x, finalTriVeq0EdgeTessFactor +dcl_output_siv o2.x, finalTriWeq0EdgeTessFactor +dcl_temps 1 +dcl_indexrange o0.x 3 +mov r0.x, vForkInstanceID.x +mov o[r0.x + 0].x, cb0[8].z +ret +hs_fork_phase +dcl_output_siv o3.x, finalTriInsideTessFactor +mov o3.x, cb0[8].z +ret +// Approximately 5 instruction slots used +#endif + +const BYTE g_hs[] = +{ + 68, 88, 66, 67, 174, 23, + 253, 184, 171, 234, 181, 122, + 114, 17, 23, 172, 69, 130, + 17, 19, 1, 0, 0, 0, + 212, 4, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 68, 2, 0, 0, 120, 2, + 0, 0, 172, 2, 0, 0, + 64, 3, 0, 0, 56, 4, + 0, 0, 82, 68, 69, 70, + 4, 2, 0, 0, 1, 0, + 0, 0, 104, 0, 0, 0, + 1, 0, 0, 0, 60, 0, + 0, 0, 0, 5, 83, 72, + 0, 1, 0, 0, 210, 1, + 0, 0, 82, 68, 49, 49, + 60, 0, 0, 0, 24, 0, + 0, 0, 32, 0, 0, 0, + 40, 0, 0, 0, 36, 0, + 0, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 99, 98, 95, 102, 114, 97, + 109, 101, 0, 171, 171, 171, + 92, 0, 0, 0, 5, 0, + 0, 0, 128, 0, 0, 0, + 144, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 72, 1, 0, 0, 0, 0, + 0, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 88, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 124, 1, + 0, 0, 64, 0, 0, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 88, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 134, 1, 0, 0, + 128, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 152, 1, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 188, 1, 0, 0, 132, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 152, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 198, 1, + 0, 0, 136, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 152, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 109, 111, 100, 101, + 108, 0, 102, 108, 111, 97, + 116, 52, 120, 52, 0, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 78, 1, 0, 0, + 118, 105, 101, 119, 95, 112, + 114, 111, 106, 0, 100, 105, + 115, 112, 95, 115, 99, 97, + 108, 101, 0, 102, 108, 111, + 97, 116, 0, 171, 0, 0, + 3, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 145, 1, 0, 0, 100, 105, + 115, 112, 95, 102, 114, 101, + 113, 0, 116, 101, 115, 115, + 95, 102, 97, 99, 116, 111, + 114, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 57, 46, 50, 57, 46, + 57, 53, 50, 46, 51, 49, + 49, 49, 0, 171, 73, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 7, 7, + 0, 0, 80, 79, 83, 73, + 84, 73, 79, 78, 0, 171, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 7, 8, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 171, 171, 171, + 80, 67, 83, 71, 140, 0, + 0, 0, 4, 0, 0, 0, + 8, 0, 0, 0, 104, 0, + 0, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 1, 14, 0, 0, 104, 0, + 0, 0, 1, 0, 0, 0, + 13, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 1, 14, 0, 0, 104, 0, + 0, 0, 2, 0, 0, 0, + 13, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 1, 14, 0, 0, 118, 0, + 0, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 3, 0, + 0, 0, 3, 0, 0, 0, + 1, 14, 0, 0, 83, 86, + 95, 84, 101, 115, 115, 70, + 97, 99, 116, 111, 114, 0, + 83, 86, 95, 73, 110, 115, + 105, 100, 101, 84, 101, 115, + 115, 70, 97, 99, 116, 111, + 114, 0, 171, 171, 83, 72, + 69, 88, 240, 0, 0, 0, + 80, 0, 3, 0, 60, 0, + 0, 0, 113, 0, 0, 1, + 147, 24, 0, 1, 148, 24, + 0, 1, 149, 16, 0, 1, + 150, 32, 0, 1, 151, 24, + 0, 1, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 115, 0, + 0, 1, 153, 0, 0, 2, + 3, 0, 0, 0, 95, 0, + 0, 2, 0, 112, 1, 0, + 103, 0, 0, 4, 18, 32, + 16, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 103, 0, + 0, 4, 18, 32, 16, 0, + 1, 0, 0, 0, 18, 0, + 0, 0, 103, 0, 0, 4, + 18, 32, 16, 0, 2, 0, + 0, 0, 19, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 91, 0, 0, 4, + 18, 32, 16, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 54, 0, 0, 4, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 112, 1, 0, 54, 0, + 0, 7, 18, 32, 144, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 42, 128, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 62, 0, 0, 1, + 115, 0, 0, 1, 103, 0, + 0, 4, 18, 32, 16, 0, + 3, 0, 0, 0, 20, 0, + 0, 0, 54, 0, 0, 6, + 18, 32, 16, 0, 3, 0, + 0, 0, 42, 128, 32, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 148, 0, + 0, 0, 5, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h index df0ad052880..9af20713716 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h @@ -1,211 +1,211 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11spikysphere.hlsl.ps.h /Eps /Tps_4_0 d3d11spikysphere.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float -// OBJPOS 0 xyz 1 NONE float xyz -// OBJNORMAL 0 xyz 2 NONE float xyz -// WORLDNORMAL 0 xyz 3 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_4_0 -dcl_input_ps linear v1.xyz -dcl_input_ps linear v2.xyz -dcl_input_ps linear v3.xyz -dcl_output o0.xyzw -dcl_temps 2 -dp3 r0.x, v2.xyzx, v2.xyzx -rsq r0.x, r0.x -mul r0.xyz, r0.xxxx, v2.xyzx -dp3 r0.w, v1.xyzx, v1.xyzx -rsq r0.w, r0.w -mul r1.xyz, r0.wwww, v1.xyzx -dp3_sat r0.x, r0.xyzx, r1.xyzx -dp3 r0.y, v3.xyzx, v3.xyzx -rsq r0.y, r0.y -mul r0.yz, r0.yyyy, v3.yyzy -dp2_sat r0.y, l(0.707107, -0.707107, 0.000000, 0.000000), r0.yzyy -mul r0.yzw, r0.yyyy, l(0.000000, 0.600000, 0.600000, 0.400000) -mad o0.xyz, r0.xxxx, l(0.400000, 0.400000, 0.600000, 0.000000), r0.yzwy -mov o0.w, l(1.000000) -ret -// Approximately 15 instruction slots used -#endif - -const BYTE g_ps[] = -{ - 68, 88, 66, 67, 211, 117, - 143, 38, 226, 40, 181, 77, - 39, 255, 33, 137, 74, 241, - 40, 100, 1, 0, 0, 0, - 184, 3, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 40, 1, - 0, 0, 92, 1, 0, 0, - 60, 3, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 255, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 148, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, - 104, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 116, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 7, 7, 0, 0, - 123, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 7, 7, 0, 0, - 133, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 7, 7, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 79, 66, 74, 80, 79, 83, - 0, 79, 66, 74, 78, 79, - 82, 77, 65, 76, 0, 87, - 79, 82, 76, 68, 78, 79, - 82, 77, 65, 76, 0, 171, - 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 65, 82, - 71, 69, 84, 0, 171, 171, - 83, 72, 68, 82, 216, 1, - 0, 0, 64, 0, 0, 0, - 118, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 1, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 2, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 3, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 2, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 2, 0, - 0, 0, 70, 18, 16, 0, - 2, 0, 0, 0, 68, 0, - 0, 5, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 114, 0, - 16, 0, 0, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, - 2, 0, 0, 0, 16, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 70, 18, - 16, 0, 1, 0, 0, 0, - 70, 18, 16, 0, 1, 0, - 0, 0, 68, 0, 0, 5, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 1, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 1, 0, - 0, 0, 16, 32, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 16, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 3, 0, - 0, 0, 70, 18, 16, 0, - 3, 0, 0, 0, 68, 0, - 0, 5, 34, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 98, 0, - 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 86, 22, 16, 0, - 3, 0, 0, 0, 15, 32, - 0, 10, 34, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 243, 4, 53, 63, - 243, 4, 53, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 150, 5, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 10, - 226, 0, 16, 0, 0, 0, - 0, 0, 86, 5, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 154, 153, 25, 63, 154, 153, - 25, 63, 205, 204, 204, 62, - 50, 0, 0, 12, 114, 32, - 16, 0, 0, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 205, 204, 204, 62, 205, 204, - 204, 62, 154, 153, 25, 63, - 0, 0, 0, 0, 150, 7, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, - 0, 0, 15, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 12, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.ps.h /Eps /Tps_4_0 d3d11spikysphere.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// OBJPOS 0 xyz 1 NONE float xyz +// OBJNORMAL 0 xyz 2 NONE float xyz +// WORLDNORMAL 0 xyz 3 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_input_ps linear v1.xyz +dcl_input_ps linear v2.xyz +dcl_input_ps linear v3.xyz +dcl_output o0.xyzw +dcl_temps 2 +dp3 r0.x, v2.xyzx, v2.xyzx +rsq r0.x, r0.x +mul r0.xyz, r0.xxxx, v2.xyzx +dp3 r0.w, v1.xyzx, v1.xyzx +rsq r0.w, r0.w +mul r1.xyz, r0.wwww, v1.xyzx +dp3_sat r0.x, r0.xyzx, r1.xyzx +dp3 r0.y, v3.xyzx, v3.xyzx +rsq r0.y, r0.y +mul r0.yz, r0.yyyy, v3.yyzy +dp2_sat r0.y, l(0.707107, -0.707107, 0.000000, 0.000000), r0.yzyy +mul r0.yzw, r0.yyyy, l(0.000000, 0.600000, 0.600000, 0.400000) +mad o0.xyz, r0.xxxx, l(0.400000, 0.400000, 0.600000, 0.000000), r0.yzwy +mov o0.w, l(1.000000) +ret +// Approximately 15 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 211, 117, + 143, 38, 226, 40, 181, 77, + 39, 255, 33, 137, 74, 241, + 40, 100, 1, 0, 0, 0, + 184, 3, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 40, 1, + 0, 0, 92, 1, 0, 0, + 60, 3, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 148, 0, 0, 0, 4, 0, + 0, 0, 8, 0, 0, 0, + 104, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 116, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 7, 7, 0, 0, + 123, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 7, 7, 0, 0, + 133, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 7, 7, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 79, 66, 74, 80, 79, 83, + 0, 79, 66, 74, 78, 79, + 82, 77, 65, 76, 0, 87, + 79, 82, 76, 68, 78, 79, + 82, 77, 65, 76, 0, 171, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 171, 171, + 83, 72, 68, 82, 216, 1, + 0, 0, 64, 0, 0, 0, + 118, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 2, 0, 0, 0, 98, 16, + 0, 3, 114, 16, 16, 0, + 3, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 16, 0, 0, 7, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 2, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 68, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 114, 0, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 7, 130, 0, 16, 0, + 0, 0, 0, 0, 70, 18, + 16, 0, 1, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 68, 0, 0, 5, + 130, 0, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 1, 0, + 0, 0, 16, 32, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 16, 0, 0, 7, 34, 0, + 16, 0, 0, 0, 0, 0, + 70, 18, 16, 0, 3, 0, + 0, 0, 70, 18, 16, 0, + 3, 0, 0, 0, 68, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 26, 0, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 98, 0, + 16, 0, 0, 0, 0, 0, + 86, 5, 16, 0, 0, 0, + 0, 0, 86, 22, 16, 0, + 3, 0, 0, 0, 15, 32, + 0, 10, 34, 0, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 243, 4, 53, 63, + 243, 4, 53, 191, 0, 0, + 0, 0, 0, 0, 0, 0, + 150, 5, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 226, 0, 16, 0, 0, 0, + 0, 0, 86, 5, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 154, 153, 25, 63, 154, 153, + 25, 63, 205, 204, 204, 62, + 50, 0, 0, 12, 114, 32, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 205, 204, 204, 62, 205, 204, + 204, 62, 154, 153, 25, 63, + 0, 0, 0, 0, 150, 7, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 128, 63, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 15, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h index 15a4663c0db..c71b0c3ae0b 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h @@ -1,105 +1,105 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11spikysphere.hlsl.vs.h /Evs /Tvs_4_0 d3d11spikysphere.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyz 0 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyz 0 NONE float xyz -// -vs_4_0 -dcl_input v0.xyz -dcl_output o0.xyz -mov o0.xyz, v0.xyzx -ret -// Approximately 2 instruction slots used -#endif - -const BYTE g_vs[] = -{ - 68, 88, 66, 67, 71, 140, - 219, 201, 207, 71, 236, 3, - 158, 208, 157, 229, 54, 227, - 221, 132, 1, 0, 0, 0, - 176, 1, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 192, 0, - 0, 0, 244, 0, 0, 0, - 52, 1, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 254, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 7, 7, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 171, 171, 171, - 79, 83, 71, 78, 44, 0, - 0, 0, 1, 0, 0, 0, - 8, 0, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 7, 8, 0, 0, 80, 79, - 83, 73, 84, 73, 79, 78, - 0, 171, 171, 171, 83, 72, - 68, 82, 56, 0, 0, 0, - 64, 0, 1, 0, 14, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, - 114, 32, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 114, 32, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 116, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11spikysphere.hlsl.vs.h /Evs /Tvs_4_0 d3d11spikysphere.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyz 0 NONE float xyz +// +vs_4_0 +dcl_input v0.xyz +dcl_output o0.xyz +mov o0.xyz, v0.xyzx +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 71, 140, + 219, 201, 207, 71, 236, 3, + 158, 208, 157, 229, 54, 227, + 221, 132, 1, 0, 0, 0, + 176, 1, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 192, 0, + 0, 0, 244, 0, 0, 0, + 52, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 7, 7, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 80, 79, + 83, 73, 84, 73, 79, 78, + 0, 171, 171, 171, 83, 72, + 68, 82, 56, 0, 0, 0, + 64, 0, 1, 0, 14, 0, + 0, 0, 95, 0, 0, 3, + 114, 16, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 114, 32, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 18, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp index db3742e2f12..19c669be9c8 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp @@ -1,116 +1,116 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "d3d11app.h" -#include "d3d11u.h" -#include "d3d11tex.hlsl.ps.h" -#include "d3d11tex.hlsl.vs.h" -#include "../data/cornell_box_image.h" -#include "../data/tux_image.h" - -struct d3d11tex : public d3d11_application -{ - ID3D11PixelShader* ps; - ID3D11VertexShader* vs; - mesh* quad; - ID3D11ShaderResourceView* srv[2]; - ID3D11SamplerState* samp[2]; - - virtual bool init(ID3D11Device* dev, int argc, char** argv) - { - ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); - ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); - - quad = create_tex_quad(dev, g_vs, sizeof(g_vs)); - - D3D11_TEXTURE2D_DESC texd; - memset(&texd, 0, sizeof(texd)); - texd.BindFlags = D3D11_BIND_SHADER_RESOURCE; - texd.Usage = D3D11_USAGE_IMMUTABLE; - texd.SampleDesc.Count = 1; - texd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - texd.Width = 32; - texd.Height = 32; - texd.ArraySize = 1; - texd.MipLevels = 1; - - D3D11_SUBRESOURCE_DATA texsd; - texsd.SysMemPitch = 32 * 4; - texsd.SysMemSlicePitch = 32 * 32 * 4; - - ID3D11Texture2D* tex; - - texsd.pSysMem = g_cornell_box_image; - ensure(dev->CreateTexture2D(&texd, &texsd, &tex)); - ensure(dev->CreateShaderResourceView(tex, 0, &srv[0])); - tex->Release(); - - texsd.pSysMem = g_tux_image; - ensure(dev->CreateTexture2D(&texd, &texsd, &tex)); - ensure(dev->CreateShaderResourceView(tex, 0, &srv[1])); - tex->Release(); - - D3D11_SAMPLER_DESC sampd; - memset(&sampd, 0, sizeof(sampd)); - sampd.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; - sampd.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; - sampd.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; - sampd.MinLOD = -FLT_MAX; - sampd.MaxLOD = FLT_MAX; - - sampd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; - dev->CreateSamplerState(&sampd, &samp[0]); - - sampd.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - dev->CreateSamplerState(&sampd, &samp[1]); - return true; - } - - virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) - { - D3D11_VIEWPORT vp; - memset(&vp, 0, sizeof(vp)); - vp.Width = (float)width; - vp.Height = (float)height; - vp.MaxDepth = 1.0f; - - ctx->OMSetRenderTargets(1, &rtv, 0); - ctx->RSSetViewports(1, &vp); - - ctx->VSSetShader(vs, NULL, 0); - ctx->PSSetShader(ps, NULL, 0); - - ctx->PSSetShaderResources(0, 2, srv); - ctx->PSSetSamplers(0, 2, samp); - - quad->bind_and_draw(ctx); - } -}; - -d3d11_application* d3d11_application_create() -{ - return new d3d11tex(); -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d11app.h" +#include "d3d11u.h" +#include "d3d11tex.hlsl.ps.h" +#include "d3d11tex.hlsl.vs.h" +#include "../data/cornell_box_image.h" +#include "../data/tux_image.h" + +struct d3d11tex : public d3d11_application +{ + ID3D11PixelShader* ps; + ID3D11VertexShader* vs; + mesh* quad; + ID3D11ShaderResourceView* srv[2]; + ID3D11SamplerState* samp[2]; + + virtual bool init(ID3D11Device* dev, int argc, char** argv) + { + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + + quad = create_tex_quad(dev, g_vs, sizeof(g_vs)); + + D3D11_TEXTURE2D_DESC texd; + memset(&texd, 0, sizeof(texd)); + texd.BindFlags = D3D11_BIND_SHADER_RESOURCE; + texd.Usage = D3D11_USAGE_IMMUTABLE; + texd.SampleDesc.Count = 1; + texd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texd.Width = 32; + texd.Height = 32; + texd.ArraySize = 1; + texd.MipLevels = 1; + + D3D11_SUBRESOURCE_DATA texsd; + texsd.SysMemPitch = 32 * 4; + texsd.SysMemSlicePitch = 32 * 32 * 4; + + ID3D11Texture2D* tex; + + texsd.pSysMem = g_cornell_box_image; + ensure(dev->CreateTexture2D(&texd, &texsd, &tex)); + ensure(dev->CreateShaderResourceView(tex, 0, &srv[0])); + tex->Release(); + + texsd.pSysMem = g_tux_image; + ensure(dev->CreateTexture2D(&texd, &texsd, &tex)); + ensure(dev->CreateShaderResourceView(tex, 0, &srv[1])); + tex->Release(); + + D3D11_SAMPLER_DESC sampd; + memset(&sampd, 0, sizeof(sampd)); + sampd.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; + sampd.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; + sampd.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; + sampd.MinLOD = -FLT_MAX; + sampd.MaxLOD = FLT_MAX; + + sampd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + dev->CreateSamplerState(&sampd, &samp[0]); + + sampd.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; + dev->CreateSamplerState(&sampd, &samp[1]); + return true; + } + + virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->RSSetViewports(1, &vp); + + ctx->VSSetShader(vs, NULL, 0); + ctx->PSSetShader(ps, NULL, 0); + + ctx->PSSetShaderResources(0, 2, srv); + ctx->PSSetSamplers(0, 2, samp); + + quad->bind_and_draw(ctx); + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11tex(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h index 722ed9afd0f..29795a99097 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h @@ -1,234 +1,234 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11tex.hlsl.ps.h /Eps /Tps_4_0 d3d11tex.hlsl -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// samp0 sampler NA NA 0 1 -// samp1 sampler NA NA 1 1 -// tex0 texture float4 2d 0 1 -// tex1 texture float4 2d 1 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// FACTORS 0 xyzw 2 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_4_0 -dcl_sampler s0, mode_default -dcl_sampler s1, mode_default -dcl_resource_texture2d (float,float,float,float) t0 -dcl_resource_texture2d (float,float,float,float) t1 -dcl_input_ps linear v1.xy -dcl_input_ps linear v2.xyzw -dcl_output o0.xyzw -dcl_temps 3 -sample r0.xyzw, v1.xyxx, t1.xyzw, s1 -mul r0.xyzw, r0.xyzw, v2.xxxx -sample r1.xyzw, v1.xyxx, t1.xyzw, s0 -mad r0.xyzw, r1.xyzw, v2.zzzz, r0.xyzw -mul r0.xyzw, r0.xyzw, v2.yyyy -sample r1.xyzw, v1.xyxx, t0.xyzw, s1 -mul r1.xyzw, r1.xyzw, v2.xxxx -sample r2.xyzw, v1.xyxx, t0.xyzw, s0 -mad r1.xyzw, r2.xyzw, v2.zzzz, r1.xyzw -mad o0.xyzw, r1.xyzw, v2.wwww, r0.xyzw -ret -// Approximately 11 instruction slots used -#endif - -const BYTE g_ps[] = -{ - 68, 88, 66, 67, 139, 203, - 114, 37, 104, 101, 201, 12, - 197, 147, 116, 98, 80, 214, - 173, 207, 1, 0, 0, 0, - 16, 4, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 32, 1, 0, 0, 152, 1, - 0, 0, 204, 1, 0, 0, - 148, 3, 0, 0, 82, 68, - 69, 70, 228, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 255, 255, 0, 1, 0, 0, - 178, 0, 0, 0, 156, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 162, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 1, 0, 0, 0, - 12, 0, 0, 0, 173, 0, - 0, 0, 2, 0, 0, 0, - 5, 0, 0, 0, 4, 0, - 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 1, 0, - 0, 0, 12, 0, 0, 0, - 115, 97, 109, 112, 48, 0, - 115, 97, 109, 112, 49, 0, - 116, 101, 120, 48, 0, 116, - 101, 120, 49, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 73, 83, 71, 78, 112, 0, - 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 92, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 3, 3, 0, 0, 101, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 84, 69, - 88, 67, 79, 79, 82, 68, - 0, 70, 65, 67, 84, 79, - 82, 83, 0, 171, 171, 171, - 79, 83, 71, 78, 44, 0, - 0, 0, 1, 0, 0, 0, - 8, 0, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 83, 86, - 95, 84, 65, 82, 71, 69, - 84, 0, 171, 171, 83, 72, - 68, 82, 192, 1, 0, 0, - 64, 0, 0, 0, 112, 0, - 0, 0, 90, 0, 0, 3, - 0, 96, 16, 0, 0, 0, - 0, 0, 90, 0, 0, 3, - 0, 96, 16, 0, 1, 0, - 0, 0, 88, 24, 0, 4, - 0, 112, 16, 0, 0, 0, - 0, 0, 85, 85, 0, 0, - 88, 24, 0, 4, 0, 112, - 16, 0, 1, 0, 0, 0, - 85, 85, 0, 0, 98, 16, - 0, 3, 50, 16, 16, 0, - 1, 0, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, - 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 3, 0, 0, 0, - 69, 0, 0, 9, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, - 1, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 6, 16, 16, 0, - 2, 0, 0, 0, 69, 0, - 0, 9, 242, 0, 16, 0, - 1, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, - 70, 126, 16, 0, 1, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 9, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 1, 0, 0, 0, - 166, 26, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 86, 21, 16, 0, 2, 0, - 0, 0, 69, 0, 0, 9, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 16, 16, 0, - 1, 0, 0, 0, 70, 126, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 6, 16, - 16, 0, 2, 0, 0, 0, - 69, 0, 0, 9, 242, 0, - 16, 0, 2, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 242, 0, - 16, 0, 1, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 166, 26, 16, 0, - 2, 0, 0, 0, 70, 14, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 9, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, - 11, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tex.hlsl.ps.h /Eps /Tps_4_0 d3d11tex.hlsl +// +// +// Resource Bindings: +// +// Name Type Format Dim Slot Elements +// ------------------------------ ---------- ------- ----------- ---- -------- +// samp0 sampler NA NA 0 1 +// samp1 sampler NA NA 1 1 +// tex0 texture float4 2d 0 1 +// tex1 texture float4 2d 1 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// FACTORS 0 xyzw 2 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v1.xy +dcl_input_ps linear v2.xyzw +dcl_output o0.xyzw +dcl_temps 3 +sample r0.xyzw, v1.xyxx, t1.xyzw, s1 +mul r0.xyzw, r0.xyzw, v2.xxxx +sample r1.xyzw, v1.xyxx, t1.xyzw, s0 +mad r0.xyzw, r1.xyzw, v2.zzzz, r0.xyzw +mul r0.xyzw, r0.xyzw, v2.yyyy +sample r1.xyzw, v1.xyxx, t0.xyzw, s1 +mul r1.xyzw, r1.xyzw, v2.xxxx +sample r2.xyzw, v1.xyxx, t0.xyzw, s0 +mad r1.xyzw, r2.xyzw, v2.zzzz, r1.xyzw +mad o0.xyzw, r1.xyzw, v2.wwww, r0.xyzw +ret +// Approximately 11 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 139, 203, + 114, 37, 104, 101, 201, 12, + 197, 147, 116, 98, 80, 214, + 173, 207, 1, 0, 0, 0, + 16, 4, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 32, 1, 0, 0, 152, 1, + 0, 0, 204, 1, 0, 0, + 148, 3, 0, 0, 82, 68, + 69, 70, 228, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 178, 0, 0, 0, 156, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 162, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 168, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 12, 0, 0, 0, 173, 0, + 0, 0, 2, 0, 0, 0, + 5, 0, 0, 0, 4, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 1, 0, + 0, 0, 12, 0, 0, 0, + 115, 97, 109, 112, 48, 0, + 115, 97, 109, 112, 49, 0, + 116, 101, 120, 48, 0, 116, + 101, 120, 49, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 73, 83, 71, 78, 112, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 101, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 15, 15, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 70, 65, 67, 84, 79, + 82, 83, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 68, 82, 192, 1, 0, 0, + 64, 0, 0, 0, 112, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 1, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 1, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 56, 0, 0, 7, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 6, 16, 16, 0, + 2, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 9, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 166, 26, 16, 0, 2, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 86, 21, 16, 0, 2, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 7, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 6, 16, + 16, 0, 2, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 2, 0, + 0, 0, 166, 26, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 50, 0, 0, 9, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 246, 31, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 11, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h index 0e3ebcd66d8..3aae79441a3 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h @@ -1,153 +1,153 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11tex.hlsl.vs.h /Evs /Tvs_4_0 d3d11tex.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyzw 0 NONE float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// FACTORS 0 xyzw 2 NONE float xyzw -// -vs_4_0 -dcl_input v0.xyzw -dcl_input v1.xy -dcl_output_siv o0.xyzw, position -dcl_output o1.xy -dcl_output o2.xyzw -mov o0.xyzw, v0.xyzw -mul o1.xy, v1.xyxx, l(8.000000, 8.000000, 0.000000, 0.000000) -mad o2.xyzw, v1.xyxy, l(1.000000, 1.000000, -1.000000, -1.000000), l(0.000000, 0.000000, 1.000000, 1.000000) -ret -// Approximately 4 instruction slots used -#endif - -const BYTE g_vs[] = -{ - 68, 88, 66, 67, 129, 141, - 49, 0, 46, 132, 26, 20, - 64, 38, 200, 86, 119, 202, - 172, 121, 1, 0, 0, 0, - 160, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 224, 0, - 0, 0, 88, 1, 0, 0, - 36, 2, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 254, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 76, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 65, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 84, 69, 88, - 67, 79, 79, 82, 68, 0, - 171, 171, 79, 83, 71, 78, - 112, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, - 80, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 92, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, - 101, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 70, 65, 67, - 84, 79, 82, 83, 0, 171, - 171, 171, 83, 72, 68, 82, - 196, 0, 0, 0, 64, 0, - 1, 0, 49, 0, 0, 0, - 95, 0, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, - 95, 0, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, - 103, 0, 0, 4, 242, 32, - 16, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 101, 0, - 0, 3, 50, 32, 16, 0, - 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 2, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 10, 50, 32, - 16, 0, 1, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 65, 0, 0, - 0, 65, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 0, - 0, 15, 242, 32, 16, 0, - 2, 0, 0, 0, 70, 20, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 191, 0, 0, - 128, 191, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 62, 0, - 0, 1, 83, 84, 65, 84, - 116, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 5, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tex.hlsl.vs.h /Evs /Tvs_4_0 d3d11tex.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// FACTORS 0 xyzw 2 NONE float xyzw +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xy +dcl_output_siv o0.xyzw, position +dcl_output o1.xy +dcl_output o2.xyzw +mov o0.xyzw, v0.xyzw +mul o1.xy, v1.xyxx, l(8.000000, 8.000000, 0.000000, 0.000000) +mad o2.xyzw, v1.xyxy, l(1.000000, 1.000000, -1.000000, -1.000000), l(0.000000, 0.000000, 1.000000, 1.000000) +ret +// Approximately 4 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 129, 141, + 49, 0, 46, 132, 26, 20, + 64, 38, 200, 86, 119, 202, + 172, 121, 1, 0, 0, 0, + 160, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 88, 1, 0, 0, + 36, 2, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 84, 69, 88, + 67, 79, 79, 82, 68, 0, + 171, 171, 79, 83, 71, 78, + 112, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 92, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 12, 0, 0, + 101, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 2, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 70, 65, 67, + 84, 79, 82, 83, 0, 171, + 171, 171, 83, 72, 68, 82, + 196, 0, 0, 0, 64, 0, + 1, 0, 49, 0, 0, 0, + 95, 0, 0, 3, 242, 16, + 16, 0, 0, 0, 0, 0, + 95, 0, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 2, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 50, 32, + 16, 0, 1, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 65, 0, 0, + 0, 65, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 242, 32, 16, 0, + 2, 0, 0, 0, 70, 20, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 191, 0, 0, + 128, 191, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp index 30c2ffa5cca..524b7d1c01c 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp @@ -1,120 +1,120 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * 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, sublicense, 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 NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. - * - **************************************************************************/ - -#include "d3d11app.h" -#include "d3d11tri.hlsl.ps.h" -#include "d3d11tri.hlsl.vs.h" - -struct vertex { - float position[4]; - float color[4]; -}; - -static struct vertex vertices[3] = -{ - { - { 0.0f, 0.9f, 0.5f, 1.0f }, - { 1.0f, 0.0f, 0.0f, 1.0f } - }, - { - { 0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 0.0f, 1.0f, 1.0f } - }, - { - { -0.9f, -0.9f, 0.5f, 1.0f }, - { 0.0f, 1.0f, 0.0f, 1.0f } - }, -}; - -struct d3d11tri : public d3d11_application -{ - ID3D11PixelShader* ps; - ID3D11VertexShader* vs; - ID3D11InputLayout* layout; - ID3D11Buffer* vb; - - virtual bool init(ID3D11Device* dev, int argc, char** argv) - { - ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); - ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); - - D3D11_INPUT_ELEMENT_DESC elements[] = - { - // inverse order to make sure the implementation can properly parse the vertex shader signature - {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - - ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout)); - D3D11_BUFFER_DESC bufferd; - bufferd.ByteWidth = sizeof(vertices); - bufferd.Usage = D3D11_USAGE_IMMUTABLE; - bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufferd.CPUAccessFlags = 0; - bufferd.MiscFlags = 0; - bufferd.StructureByteStride = 0; - - D3D11_SUBRESOURCE_DATA buffersd; - buffersd.pSysMem = vertices; - buffersd.SysMemPitch = sizeof(vertices); - buffersd.SysMemSlicePitch = sizeof(vertices); - - ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); - - return true; - } - - virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) - { - float clear_color[4] = {1, 0, 1, 1}; - D3D11_VIEWPORT vp; - memset(&vp, 0, sizeof(vp)); - vp.Width = (float)width; - vp.Height = (float)height; - vp.MaxDepth = 1.0f; - - ctx->OMSetRenderTargets(1, &rtv, 0); - ctx->RSSetViewports(1, &vp); - - ctx->ClearRenderTargetView(rtv, clear_color); - - ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - ctx->IASetInputLayout(layout); - unsigned stride = 2 * 4 * 4; - unsigned offset = 0; - ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); - - ctx->VSSetShader(vs, NULL, 0); - ctx->PSSetShader(ps, NULL, 0); - - ctx->Draw(3, 0); - } -}; - -d3d11_application* d3d11_application_create() -{ - return new d3d11tri(); -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * 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, sublicense, 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 NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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. + * + **************************************************************************/ + +#include "d3d11app.h" +#include "d3d11tri.hlsl.ps.h" +#include "d3d11tri.hlsl.vs.h" + +struct vertex { + float position[4]; + float color[4]; +}; + +static struct vertex vertices[3] = +{ + { + { 0.0f, 0.9f, 0.5f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + }, + { + { 0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } + }, + { + { -0.9f, -0.9f, 0.5f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } + }, +}; + +struct d3d11tri : public d3d11_application +{ + ID3D11PixelShader* ps; + ID3D11VertexShader* vs; + ID3D11InputLayout* layout; + ID3D11Buffer* vb; + + virtual bool init(ID3D11Device* dev, int argc, char** argv) + { + ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps)); + ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs)); + + D3D11_INPUT_ELEMENT_DESC elements[] = + { + // inverse order to make sure the implementation can properly parse the vertex shader signature + {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + + ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout)); + D3D11_BUFFER_DESC bufferd; + bufferd.ByteWidth = sizeof(vertices); + bufferd.Usage = D3D11_USAGE_IMMUTABLE; + bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufferd.CPUAccessFlags = 0; + bufferd.MiscFlags = 0; + bufferd.StructureByteStride = 0; + + D3D11_SUBRESOURCE_DATA buffersd; + buffersd.pSysMem = vertices; + buffersd.SysMemPitch = sizeof(vertices); + buffersd.SysMemSlicePitch = sizeof(vertices); + + ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb)); + + return true; + } + + virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) + { + float clear_color[4] = {1, 0, 1, 1}; + D3D11_VIEWPORT vp; + memset(&vp, 0, sizeof(vp)); + vp.Width = (float)width; + vp.Height = (float)height; + vp.MaxDepth = 1.0f; + + ctx->OMSetRenderTargets(1, &rtv, 0); + ctx->RSSetViewports(1, &vp); + + ctx->ClearRenderTargetView(rtv, clear_color); + + ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ctx->IASetInputLayout(layout); + unsigned stride = 2 * 4 * 4; + unsigned offset = 0; + ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset); + + ctx->VSSetShader(vs, NULL, 0); + ctx->PSSetShader(ps, NULL, 0); + + ctx->Draw(3, 0); + } +}; + +d3d11_application* d3d11_application_create() +{ + return new d3d11tri(); +} diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h index 21f6141f380..68eaee5cb2e 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h @@ -1,112 +1,112 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11tri.hlsl.ps.h /Eps /Tps_4_0 d3d11tri.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float -// COLOR 0 xyzw 1 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_4_0 -dcl_input_ps linear v1.xyzw -dcl_output o0.xyzw -mov o0.xyzw, v1.xyzw -ret -// Approximately 2 instruction slots used -#endif - -const BYTE g_ps[] = -{ - 68, 88, 66, 67, 206, 120, - 117, 238, 118, 127, 10, 87, - 80, 75, 114, 198, 95, 2, - 120, 102, 1, 0, 0, 0, - 208, 1, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 224, 0, - 0, 0, 20, 1, 0, 0, - 84, 1, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 255, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 76, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 68, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 15, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 67, 79, 76, 79, 82, 0, - 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 65, 82, - 71, 69, 84, 0, 171, 171, - 83, 72, 68, 82, 56, 0, - 0, 0, 64, 0, 0, 0, - 14, 0, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, - 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tri.hlsl.ps.h /Eps /Tps_4_0 d3d11tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_input_ps linear v1.xyzw +dcl_output o0.xyzw +mov o0.xyzw, v1.xyzw +ret +// Approximately 2 instruction slots used +#endif + +const BYTE g_ps[] = +{ + 68, 88, 66, 67, 206, 120, + 117, 238, 118, 127, 10, 87, + 80, 75, 114, 198, 95, 2, + 120, 102, 1, 0, 0, 0, + 208, 1, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 224, 0, + 0, 0, 20, 1, 0, 0, + 84, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 76, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 67, 79, 76, 79, 82, 0, + 171, 171, 79, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 83, 86, 95, 84, 65, 82, + 71, 69, 84, 0, 171, 171, + 83, 72, 68, 82, 56, 0, + 0, 0, 64, 0, 0, 0, + 14, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 30, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 116, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0 +}; diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h index edf18e01f76..43e2a18275c 100755 --- a/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h +++ b/src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h @@ -1,128 +1,128 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc /Fhd3d11tri.hlsl.vs.h /Evs /Tvs_4_0 d3d11tri.hlsl -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xyzw 0 NONE float xyzw -// COLOR 0 xyzw 1 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// COLOR 0 xyzw 1 NONE float xyzw -// -vs_4_0 -dcl_input v0.xyzw -dcl_input v1.xyzw -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -mov o0.xyzw, v0.xyzw -mov o1.xyzw, v1.xyzw -ret -// Approximately 3 instruction slots used -#endif - -const BYTE g_vs[] = -{ - 68, 88, 66, 67, 190, 171, - 186, 20, 44, 105, 95, 129, - 137, 204, 223, 72, 251, 159, - 126, 176, 1, 0, 0, 0, - 28, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 140, 0, 0, 0, 220, 0, - 0, 0, 48, 1, 0, 0, - 160, 1, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, - 254, 255, 0, 1, 0, 0, - 28, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, - 171, 171, 73, 83, 71, 78, - 72, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 65, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 15, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 67, 79, 76, - 79, 82, 0, 171, 79, 83, - 71, 78, 76, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 68, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 80, - 79, 83, 73, 84, 73, 79, - 78, 0, 67, 79, 76, 79, - 82, 0, 171, 171, 83, 72, - 68, 82, 104, 0, 0, 0, - 64, 0, 1, 0, 26, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, - 242, 32, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 1, 0, - 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 116, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// +// fxc /Fhd3d11tri.hlsl.vs.h /Evs /Tvs_4_0 d3d11tri.hlsl +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// POSITION 0 xyzw 0 NONE float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------ ------ +// SV_POSITION 0 xyzw 0 POS float xyzw +// COLOR 0 xyzw 1 NONE float xyzw +// +vs_4_0 +dcl_input v0.xyzw +dcl_input v1.xyzw +dcl_output_siv o0.xyzw, position +dcl_output o1.xyzw +mov o0.xyzw, v0.xyzw +mov o1.xyzw, v1.xyzw +ret +// Approximately 3 instruction slots used +#endif + +const BYTE g_vs[] = +{ + 68, 88, 66, 67, 190, 171, + 186, 20, 44, 105, 95, 129, + 137, 204, 223, 72, 251, 159, + 126, 176, 1, 0, 0, 0, + 28, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 140, 0, 0, 0, 220, 0, + 0, 0, 48, 1, 0, 0, + 160, 1, 0, 0, 82, 68, + 69, 70, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 1, 0, 0, + 28, 0, 0, 0, 77, 105, + 99, 114, 111, 115, 111, 102, + 116, 32, 40, 82, 41, 32, + 72, 76, 83, 76, 32, 83, + 104, 97, 100, 101, 114, 32, + 67, 111, 109, 112, 105, 108, + 101, 114, 32, 57, 46, 50, + 57, 46, 57, 53, 50, 46, + 51, 49, 49, 49, 0, 171, + 171, 171, 73, 83, 71, 78, + 72, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 15, 0, 0, + 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 15, 15, 0, 0, + 80, 79, 83, 73, 84, 73, + 79, 78, 0, 67, 79, 76, + 79, 82, 0, 171, 79, 83, + 71, 78, 76, 0, 0, 0, + 2, 0, 0, 0, 8, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 68, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 67, 79, 76, 79, + 82, 0, 171, 171, 83, 72, + 68, 82, 104, 0, 0, 0, + 64, 0, 1, 0, 26, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 0, 0, + 0, 0, 95, 0, 0, 3, + 242, 16, 16, 0, 1, 0, + 0, 0, 103, 0, 0, 4, + 242, 32, 16, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 1, 0, 0, 0, + 54, 0, 0, 5, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 30, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 242, 32, 16, 0, 1, 0, + 0, 0, 70, 30, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; -- cgit v1.2.3 From 9f7c8053e06663ba1f7b105f987052d9412d8fad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Sep 2010 07:54:46 -0600 Subject: mesa: fix assertions to handle srgb formats http://bugs.freedesktop.org/show_bug.cgi?id=30333 NOTE: This is a candidate for the 7.9 branch. --- src/mesa/main/texcompress_s3tc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 551203f0125..534a4247cf2 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -166,7 +166,8 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1); + ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 || + dstFormat == MESA_FORMAT_SRGB_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -228,7 +229,8 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 || + dstFormat == MESA_FORMAT_SRGBA_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -289,7 +291,8 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 || + dstFormat == MESA_FORMAT_SRGBA_DXT3); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -349,7 +352,8 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 || + dstFormat == MESA_FORMAT_SRGBA_DXT5); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); -- cgit v1.2.3 From 10dcc989ab9f143f0bd6d103fd2b336429644467 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Sep 2010 08:24:41 -0600 Subject: st/mesa: add missing MESA_FORMAT_S8 case in st_mesa_format_to_pipe_format() NOTE: this is a candidate for the 7.9 branch. --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 1ed79524b2c..95064605d7f 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -166,6 +166,8 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) return PIPE_FORMAT_X8Z24_UNORM; case MESA_FORMAT_X8_Z24: return PIPE_FORMAT_Z24X8_UNORM; + case MESA_FORMAT_S8: + return PIPE_FORMAT_S8_USCALED; case MESA_FORMAT_YCBCR: return PIPE_FORMAT_UYVY; #if FEATURE_texture_s3tc -- cgit v1.2.3 From f5c810c42f9dfcb660303ea898975b64f060b238 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Sep 2010 08:26:32 -0600 Subject: st/mesa: use the wrapped renderbuffer in CopyPixels() Fixes assertion failures when copying stencil pixels. NOTE: this is a candidate for the 7.9 branch. --- src/mesa/state_tracker/st_cb_drawpixels.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 1147b1950e2..fb1fec1aefd 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -832,7 +832,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty) { - struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer); + struct st_renderbuffer *rbDraw; struct pipe_context *pipe = st_context(ctx)->pipe; enum pipe_transfer_usage usage; struct pipe_transfer *ptDraw; @@ -846,6 +846,13 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, return; } + /* Get the dest renderbuffer. If there's a wrapper, use the + * underlying renderbuffer. + */ + rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer); + if (rbDraw->Base.Wrapped) + rbDraw = st_renderbuffer(rbDraw->Base.Wrapped); + /* this will do stencil pixel transfer ops */ st_read_stencil_pixels(ctx, srcx, srcy, width, height, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, @@ -968,6 +975,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); } + if (rbRead->Base.Wrapped) + rbRead = st_renderbuffer(rbRead->Base.Wrapped); + sample_count = rbRead->texture->nr_samples; /* I believe this would be legal, presumably would need to do a resolve for color, and for depth/stencil spec says to just use one of the -- cgit v1.2.3 From 3672bc14afe14334046589c869eb9ee7f5cfd137 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 10:37:41 -0400 Subject: r600g: fix typo in evergreen define (resource are in [0x30000;0x34000] range) Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index c5d5fe9ddfc..3c60e5c11a7 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -28,7 +28,7 @@ /* evergreen values */ #define EG_RESOURCE_OFFSET 0x00030000 -#define EG_RESOURCE_END 0x00030400 +#define EG_RESOURCE_END 0x00034000 #define EG_LOOP_CONST_OFFSET 0x0003A200 #define EG_LOOP_CONST_END 0x0003A26C #define EG_BOOL_CONST_OFFSET 0x0003A500 -- cgit v1.2.3 From cb3aed80db05120767fb9122125723a9b1600e11 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 10:38:41 -0400 Subject: r600g: move use_mem_constants flags for new designs structure alignment Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/radeon_priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 4471d3ca427..e780cfd96ad 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -84,10 +84,10 @@ struct radeon { unsigned device; unsigned family; enum chip_class chip_class; + boolean use_mem_constant; /* true for evergreen */ unsigned nstype; struct radeon_stype_info *stype; unsigned max_states; - boolean use_mem_constant; /* true for evergreen */ struct pb_manager *mman; /* malloc manager */ struct pb_manager *kman; /* kernel bo manager */ struct pb_manager *cman; /* cached bo manager */ -- cgit v1.2.3 From eff1af65afb479b3719d8fa2bed97b76d6dee768 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 10:40:17 -0400 Subject: r600g: evergreen fix for new design Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 18 +++++------ src/gallium/drivers/r600/evergreend.h | 43 ++++++++++++--------------- src/gallium/drivers/r600/r600_state2.c | 16 +++++----- src/gallium/winsys/r600/drm/evergreen_state.c | 29 +++++++++--------- src/gallium/winsys/r600/drm/r600_priv.h | 1 + src/gallium/winsys/r600/drm/r600_state2.c | 33 +++++--------------- 6 files changed, 59 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7ac505c525e..ed0daab25a1 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -256,11 +256,11 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); return rstate; } @@ -895,22 +895,22 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader, switch (shader) { case PIPE_SHADER_VERTEX: rctx->vs_const_buffer.nregs = 0; - r600_pipe_state_add_reg(&rctx->vs_const_buffer, R600_GROUP_ALU_CONST, + r600_pipe_state_add_reg(&rctx->vs_const_buffer, EVERGREEN_GROUP_CONTEXT, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, ALIGN_DIVUP(buffer->width0 >> 4, 16), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rctx->vs_const_buffer, R600_GROUP_ALU_CONST, + r600_pipe_state_add_reg(&rctx->vs_const_buffer, EVERGREEN_GROUP_CONTEXT, R_028980_ALU_CONST_CACHE_VS_0, 0, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); break; case PIPE_SHADER_FRAGMENT: rctx->ps_const_buffer.nregs = 0; - r600_pipe_state_add_reg(&rctx->ps_const_buffer, R600_GROUP_ALU_CONST, + r600_pipe_state_add_reg(&rctx->ps_const_buffer, EVERGREEN_GROUP_CONTEXT, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, ALIGN_DIVUP(buffer->width0 >> 4, 16), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rctx->ps_const_buffer, R600_GROUP_ALU_CONST, + r600_pipe_state_add_reg(&rctx->ps_const_buffer, EVERGREEN_GROUP_CONTEXT, R_028940_ALU_CONST_CACHE_PS_0, 0, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 9bd74348664..db9b5656df1 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -32,7 +32,7 @@ #define EVERGREEN_CONTEXT_REG_OFFSET 0X00028000 #define EVERGREEN_CONTEXT_REG_END 0X00029000 #define EVERGREEN_RESOURCE_OFFSET 0x00030000 -#define EVERGREEN_RESOURCE_END 0x00030400 +#define EVERGREEN_RESOURCE_END 0x00034000 #define EVERGREEN_LOOP_CONST_OFFSET 0x0003A200 #define EVERGREEN_LOOP_CONST_END 0x0003A26C #define EVERGREEN_BOOL_CONST_OFFSET 0x0003A500 @@ -746,29 +746,6 @@ #define S_02880C_DUAL_EXPORT_ENABLE(x) (((x) & 0x1) << 9) #define G_02880C_DUAL_EXPORT_ENABLE(x) (((x) >> 9) & 0x1) #define C_02880C_DUAL_EXPORT_ENABLE 0xFFFFFDFF -#define R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL 0x028DF8 -#define S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(x) (((x) & 0xFF) << 0) -#define G_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(x) (((x) >> 0) & 0xFF) -#define C_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS 0xFFFFFF00 -#define S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(x) (((x) & 0x1) << 8) -#define G_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(x) (((x) >> 8) & 0x1) -#define C_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT 0xFFFFFEFF -#define R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE 0x028E00 -#define S_028E00_SCALE(x) (((x) & 0xFFFFFFFF) << 0) -#define G_028E00_SCALE(x) (((x) >> 0) & 0xFFFFFFFF) -#define C_028E00_SCALE 0x00000000 -#define R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET 0x028E04 -#define S_028E04_OFFSET(x) (((x) & 0xFFFFFFFF) << 0) -#define G_028E04_OFFSET(x) (((x) >> 0) & 0xFFFFFFFF) -#define C_028E04_OFFSET 0x00000000 -#define R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE 0x028E08 -#define S_028E08_SCALE(x) (((x) & 0xFFFFFFFF) << 0) -#define G_028E08_SCALE(x) (((x) >> 0) & 0xFFFFFFFF) -#define C_028E08_SCALE 0x00000000 -#define R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET 0x028E0C -#define S_028E0C_OFFSET(x) (((x) & 0xFFFFFFFF) << 0) -#define G_028E0C_OFFSET(x) (((x) >> 0) & 0xFFFFFFFF) -#define C_028E0C_OFFSET 0x00000000 #define R_028A00_PA_SU_POINT_SIZE 0x028A00 #define S_028A00_HEIGHT(x) (((x) & 0xFFFF) << 0) #define G_028A00_HEIGHT(x) (((x) >> 0) & 0xFFFF) @@ -1689,11 +1666,29 @@ #define R_028B54_VGT_SHADER_STAGES_EN 0x00028B54 #define R_028B70_DB_ALPHA_TO_MASK 0x00028B70 #define R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL 0x00028B78 +#define S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(x) (((x) & 0xFF) << 0) +#define G_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(x) (((x) >> 0) & 0xFF) +#define C_028B78_POLY_OFFSET_NEG_NUM_DB_BITS 0xFFFFFF00 +#define S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(x) (((x) & 0x1) << 8) +#define G_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(x) (((x) >> 8) & 0x1) +#define C_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT 0xFFFFFEFF #define R_028B7C_PA_SU_POLY_OFFSET_CLAMP 0x00028B7C #define R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE 0x00028B80 +#define S_028B80_SCALE(x) (((x) & 0xFFFFFFFF) << 0) +#define G_028B80_SCALE(x) (((x) >> 0) & 0xFFFFFFFF) +#define C_028B80_SCALE 0x00000000 #define R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET 0x00028B84 +#define S_028B84_OFFSET(x) (((x) & 0xFFFFFFFF) << 0) +#define G_028B84_OFFSET(x) (((x) >> 0) & 0xFFFFFFFF) +#define C_028B84_OFFSET 0x00000000 #define R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE 0x00028B88 +#define S_028B88_SCALE(x) (((x) & 0xFFFFFFFF) << 0) +#define G_028B88_SCALE(x) (((x) >> 0) & 0xFFFFFFFF) +#define C_028B88_SCALE 0x00000000 #define R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET 0x00028B8C +#define S_028B8C_OFFSET(x) (((x) & 0xFFFFFFFF) << 0) +#define G_028B8C_OFFSET(x) (((x) >> 0) & 0xFFFFFFFF) +#define C_028B8C_OFFSET 0x00000000 #define R_028B94_VGT_STRMOUT_CONFIG 0x00028B94 #define R_028B98_VGT_STRMOUT_BUFFER_CONFIG 0x00028B98 #define R_028C00_PA_SC_LINE_CNTL 0x00028C00 diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 6ce82648c15..075b5f03190 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -564,7 +564,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; -#if 0 +#if 1 static int dc = 0; char dname[256]; #endif @@ -572,7 +572,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, if (!rctx->ctx.pm4_cdwords) return; -#if 0 +#if 1 sprintf(dname, "gallium-%08d.bof", dc); if (dc < 20) { r600_context_dump_bof(&rctx->ctx, dname); @@ -2050,12 +2050,6 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi r600_init_query_functions2(rctx); r600_init_context_resource_functions2(rctx); - rctx->blitter = util_blitter_create(&rctx->context); - if (rctx->blitter == NULL) { - FREE(rctx); - return NULL; - } - switch (r600_get_family(rctx->radeon)) { case CHIP_R600: case CHIP_RV610: @@ -2096,6 +2090,12 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi return NULL; } + rctx->blitter = util_blitter_create(&rctx->context); + if (rctx->blitter == NULL) { + FREE(rctx); + return NULL; + } + return &rctx->context; } diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index d3831942113..5781d448ede 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -329,7 +329,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028C64_CB_COLOR0_PITCH}, {0, 0, R_028C68_CB_COLOR0_SLICE}, {0, 0, R_028C6C_CB_COLOR0_VIEW}, - {1, 0, R_028C70_CB_COLOR0_INFO}, + {0, 0, R_028C70_CB_COLOR0_INFO}, {0, 0, R_028C74_CB_COLOR0_ATTRIB}, {0, 0, R_028C78_CB_COLOR0_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -337,7 +337,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028CA0_CB_COLOR1_PITCH}, {0, 0, R_028CA4_CB_COLOR1_SLICE}, {0, 0, R_028CA8_CB_COLOR1_VIEW}, - {1, 0, R_028CAC_CB_COLOR1_INFO}, + {0, 0, R_028CAC_CB_COLOR1_INFO}, {0, 0, R_028CB0_CB_COLOR1_ATTRIB}, {0, 0, R_028CB8_CB_COLOR1_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -345,7 +345,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028CDC_CB_COLOR2_PITCH}, {0, 0, R_028CE0_CB_COLOR2_SLICE}, {0, 0, R_028CE4_CB_COLOR2_VIEW}, - {1, 0, R_028CE8_CB_COLOR2_INFO}, + {0, 0, R_028CE8_CB_COLOR2_INFO}, {0, 0, R_028CEC_CB_COLOR2_ATTRIB}, {0, 0, R_028CF0_CB_COLOR2_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -353,7 +353,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028D18_CB_COLOR3_PITCH}, {0, 0, R_028D1C_CB_COLOR3_SLICE}, {0, 0, R_028D20_CB_COLOR3_VIEW}, - {1, 0, R_028D24_CB_COLOR3_INFO}, + {0, 0, R_028D24_CB_COLOR3_INFO}, {0, 0, R_028D28_CB_COLOR3_ATTRIB}, {0, 0, R_028D2C_CB_COLOR3_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -361,7 +361,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028D54_CB_COLOR4_PITCH}, {0, 0, R_028D58_CB_COLOR4_SLICE}, {0, 0, R_028D5C_CB_COLOR4_VIEW}, - {1, 0, R_028D60_CB_COLOR4_INFO}, + {0, 0, R_028D60_CB_COLOR4_INFO}, {0, 0, R_028D64_CB_COLOR4_ATTRIB}, {0, 0, R_028D68_CB_COLOR4_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -369,7 +369,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028D90_CB_COLOR5_PITCH}, {0, 0, R_028D94_CB_COLOR5_SLICE}, {0, 0, R_028D98_CB_COLOR5_VIEW}, - {1, 0, R_028D9C_CB_COLOR5_INFO}, + {0, 0, R_028D9C_CB_COLOR5_INFO}, {0, 0, R_028DA0_CB_COLOR5_ATTRIB}, {0, 0, R_028DA4_CB_COLOR5_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -377,7 +377,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028DCC_CB_COLOR6_PITCH}, {0, 0, R_028DD0_CB_COLOR6_SLICE}, {0, 0, R_028DD4_CB_COLOR6_VIEW}, - {1, 0, R_028DD8_CB_COLOR6_INFO}, + {0, 0, R_028DD8_CB_COLOR6_INFO}, {0, 0, R_028DDC_CB_COLOR6_ATTRIB}, {0, 0, R_028DE0_CB_COLOR6_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -385,7 +385,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E08_CB_COLOR7_PITCH}, {0, 0, R_028E0C_CB_COLOR7_SLICE}, {0, 0, R_028E10_CB_COLOR7_VIEW}, - {1, 0, R_028E14_CB_COLOR7_INFO}, + {0, 0, R_028E14_CB_COLOR7_INFO}, {0, 0, R_028E18_CB_COLOR7_ATTRIB}, {0, 0, R_028E1C_CB_COLOR7_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -393,7 +393,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E44_CB_COLOR8_PITCH}, {0, 0, R_028E48_CB_COLOR8_SLICE}, {0, 0, R_028E4C_CB_COLOR8_VIEW}, - {1, 0, R_028E50_CB_COLOR8_INFO}, + {0, 0, R_028E50_CB_COLOR8_INFO}, {0, 0, R_028E54_CB_COLOR8_ATTRIB}, {0, 0, R_028E58_CB_COLOR8_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -401,7 +401,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E60_CB_COLOR9_PITCH}, {0, 0, R_028E64_CB_COLOR9_SLICE}, {0, 0, R_028E68_CB_COLOR9_VIEW}, - {1, 0, R_028E6C_CB_COLOR9_INFO}, + {0, 0, R_028E6C_CB_COLOR9_INFO}, {0, 0, R_028E70_CB_COLOR9_ATTRIB}, {0, 0, R_028E74_CB_COLOR9_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -409,7 +409,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E7C_CB_COLOR10_PITCH}, {0, 0, R_028E80_CB_COLOR10_SLICE}, {0, 0, R_028E84_CB_COLOR10_VIEW}, - {1, 0, R_028E88_CB_COLOR10_INFO}, + {0, 0, R_028E88_CB_COLOR10_INFO}, {0, 0, R_028E8C_CB_COLOR10_ATTRIB}, {0, 0, R_028E90_CB_COLOR10_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -417,7 +417,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E98_CB_COLOR11_PITCH}, {0, 0, R_028E9C_CB_COLOR11_SLICE}, {0, 0, R_028EA0_CB_COLOR11_VIEW}, - {1, 0, R_028EA4_CB_COLOR11_INFO}, + {0, 0, R_028EA4_CB_COLOR11_INFO}, {0, 0, R_028EA8_CB_COLOR11_ATTRIB}, {0, 0, R_028EAC_CB_COLOR11_DIM}, }; @@ -464,6 +464,7 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) int r; memset(ctx, 0, sizeof(struct r600_context)); + radeon->use_mem_constant = TRUE; ctx->radeon = radeon; LIST_INITHEAD(&ctx->query_list); /* initialize groups */ @@ -511,13 +512,13 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } /* PS RESOURCE */ - for (int j = 0, offset = 0; j < 176; j++, offset += 0x1C) { + for (int j = 0, offset = 0; j < 176; j++, offset += 0x20) { r = evergreen_state_resource_init(ctx, offset); if (r) goto out_err; } /* VS RESOURCE */ - for (int j = 0, offset = 0x1600; j < 176; j++, offset += 0x1C) { + for (int j = 0, offset = 0x1600; j < 176; j++, offset += 0x20) { r = evergreen_state_resource_init(ctx, offset); if (r) goto out_err; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 6023f215bb6..92b2eb1dff1 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -39,6 +39,7 @@ struct radeon { unsigned device; unsigned family; enum chip_class chip_class; + boolean use_mem_constant; /* true for evergreen */ }; struct radeon *r600_new(int fd, unsigned device); diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 16950bd72d0..c29616c9cbc 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -65,31 +65,12 @@ unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); static void r600_context_queries_suspend(struct r600_context *ctx); static void r600_context_queries_resume(struct r600_context *ctx); -static int r600_group_id_register_offset(unsigned offset) +static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offset) { - if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { - return R600_GROUP_CONFIG; - } - if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) { - return R600_GROUP_CONTEXT; - } - if (offset >= R600_ALU_CONST_OFFSET && offset < R600_ALU_CONST_END) { - return R600_GROUP_ALU_CONST; - } - if (offset >= R600_RESOURCE_OFFSET && offset < R600_RESOURCE_END) { - return R600_GROUP_RESOURCE; - } - if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) { - return R600_GROUP_SAMPLER; - } - if (offset >= R600_CTL_CONST_OFFSET && offset < R600_CTL_CONST_END) { - return R600_GROUP_CTL_CONST; - } - if (offset >= R600_LOOP_CONST_OFFSET && offset < R600_LOOP_CONST_END) { - return R600_GROUP_LOOP_CONST; - } - if (offset >= R600_BOOL_CONST_OFFSET && offset < R600_BOOL_CONST_END) { - return R600_GROUP_BOOL_CONST; + for (int i = 0; i < ctx->ngroups; i++) { + if (offset >= ctx->groups[i].start_offset && offset <= ctx->groups[i].end_offset) { + return i; + } } return -1; } @@ -119,7 +100,7 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, continue; /* find into which group this block is */ - group_id = r600_group_id_register_offset(reg[i].offset); + group_id = r600_group_id_register_offset(ctx, reg[i].offset); assert(group_id >= 0); group = &ctx->groups[group_id]; @@ -1005,7 +986,7 @@ void r600_context_flush(struct r600_context *ctx) /* suspend queries */ r600_context_queries_suspend(ctx); -#if 1 +#if 0 /* emit cs */ drmib.num_chunks = 2; drmib.chunks = (uint64_t)(uintptr_t)chunk_array; -- cgit v1.2.3 From 7967b46e652eeef5e3bb1101e53b4c15683ecd12 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 10:43:57 -0400 Subject: r600g: fix compilation after change to evergreend.h Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/eg_hw_states.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 47c15b8dcc8..6e823689847 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -215,7 +215,7 @@ static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate case PIPE_FORMAT_Z32_FLOAT: depth = -23; offset_units *= 1.0f; - offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); break; case PIPE_FORMAT_Z16_UNORM: depth = -16; @@ -226,7 +226,7 @@ static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate return; } } - offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); + offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth); if (state->flatshade_first) prov_vtx = 0; -- cgit v1.2.3 From 61b7da074e2faebf03d3dfc30e910ee1367bcd5a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 23 Sep 2010 18:18:40 -0600 Subject: llvmpipe: make min/max lod and lod bias dynamic state Before, changing any of these sampler values triggered generation of new JIT code. Added a new flag for the special case of min_lod == max_lod which is hit during auto mipmap generation. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 35 ++++++++++++----------- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 18 +++++++++++- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 2 +- src/gallium/drivers/llvmpipe/lp_jit.c | 15 ++++++++++ src/gallium/drivers/llvmpipe/lp_jit.h | 7 +++++ src/gallium/drivers/llvmpipe/lp_setup.c | 8 +++++- src/gallium/drivers/llvmpipe/lp_setup.h | 3 +- src/gallium/drivers/llvmpipe/lp_state_derived.c | 6 ++-- src/gallium/drivers/llvmpipe/lp_tex_sample.c | 7 +++++ 10 files changed, 79 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index e89ee7c2302..caf1c7e8656 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -99,21 +99,21 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE; } + /* If min_lod == max_lod we can greatly simplify mipmap selection. + * This is a case that occurs during automatic mipmap generation. + */ + if (sampler->min_lod == sampler->max_lod) { + state->min_max_lod_equal = 1; + state->min_max_lod = sampler->min_lod; + } + state->compare_mode = sampler->compare_mode; if (sampler->compare_mode != PIPE_TEX_COMPARE_NONE) { state->compare_func = sampler->compare_func; } state->normalized_coords = sampler->normalized_coords; - state->lod_bias = sampler->lod_bias; - if (!view->last_level && - sampler->min_img_filter == sampler->mag_img_filter) { - state->min_lod = 0.0f; - state->max_lod = 0.0f; - } else { - state->min_lod = MAX2(sampler->min_lod, 0.0f); - state->max_lod = sampler->max_lod; - } + state->border_color[0] = sampler->border_color[0]; state->border_color[1] = sampler->border_color[1]; state->border_color[2] = sampler->border_color[2]; @@ -140,6 +140,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, */ LLVMValueRef lp_build_lod_selector(struct lp_build_sample_context *bld, + unsigned unit, const LLVMValueRef ddx[4], const LLVMValueRef ddy[4], LLVMValueRef lod_bias, /* optional */ @@ -149,20 +150,20 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, LLVMValueRef depth) { - if (bld->static_state->min_lod == bld->static_state->max_lod) { + if (bld->static_state->min_max_lod_equal) { /* User is forcing sampling from a particular mipmap level. * This is hit during mipmap generation. */ - return LLVMConstReal(LLVMFloatType(), bld->static_state->min_lod); + return LLVMConstReal(LLVMFloatType(), bld->static_state->min_max_lod); } else { struct lp_build_context *float_bld = &bld->float_bld; - LLVMValueRef sampler_lod_bias = LLVMConstReal(LLVMFloatType(), - bld->static_state->lod_bias); - LLVMValueRef min_lod = LLVMConstReal(LLVMFloatType(), - bld->static_state->min_lod); - LLVMValueRef max_lod = LLVMConstReal(LLVMFloatType(), - bld->static_state->max_lod); + LLVMValueRef sampler_lod_bias = + bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit); + LLVMValueRef min_lod = + bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); + LLVMValueRef max_lod = + bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit); LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0); LLVMValueRef lod; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 8b042d5242e..661f35f6deb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -82,8 +82,9 @@ struct lp_sampler_static_state unsigned compare_mode:1; unsigned compare_func:3; unsigned normalized_coords:1; - float lod_bias, min_lod, max_lod; float border_color[4]; + unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */ + float min_max_lod; /**< only valid when min_max_lod_equal=1 */ /* Aero hacks */ unsigned force_nearest_s:1; @@ -143,6 +144,20 @@ struct lp_sampler_dynamic_state LLVMBuilderRef builder, unsigned unit); + /** Obtain texture min lod */ + LLVMValueRef + (*min_lod)(const struct lp_sampler_dynamic_state *state, + LLVMBuilderRef builder, unsigned unit); + + /** Obtain texture max lod */ + LLVMValueRef + (*max_lod)(const struct lp_sampler_dynamic_state *state, + LLVMBuilderRef builder, unsigned unit); + + /** Obtain texture lod bias */ + LLVMValueRef + (*lod_bias)(const struct lp_sampler_dynamic_state *state, + LLVMBuilderRef builder, unsigned unit); }; @@ -248,6 +263,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, LLVMValueRef lp_build_lod_selector(struct lp_build_sample_context *bld, + unsigned unit, const LLVMValueRef ddx[4], const LLVMValueRef ddy[4], LLVMValueRef lod_bias, /* optional */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 7e064900e77..000d4938a03 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -970,7 +970,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* Need to compute lod either to choose mipmap levels or to * distinguish between minification/magnification with one mipmap level. */ - lod = lp_build_lod_selector(bld, ddx, ddy, + lod = lp_build_lod_selector(bld, unit, ddx, ddy, lod_bias, explicit_lod, width, height, depth); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 91fab18e4e6..cbae1188a59 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -937,7 +937,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* Need to compute lod either to choose mipmap levels or to * distinguish between minification/magnification with one mipmap level. */ - lod = lp_build_lod_selector(bld, ddx, ddy, + lod = lp_build_lod_selector(bld, unit, ddx, ddy, lod_bias, explicit_lod, width, height, depth); } diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 8e6dfb293d0..4c7089892ef 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -65,6 +65,11 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0), LP_MAX_TEXTURE_LEVELS); + elem_types[LP_JIT_TEXTURE_MIN_LOD] = LLVMFloatType(); + elem_types[LP_JIT_TEXTURE_MAX_LOD] = LLVMFloatType(); + elem_types[LP_JIT_TEXTURE_LOD_BIAS] = LLVMFloatType(); + + texture_type = LLVMStructType(elem_types, Elements(elem_types), 0); LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, width, @@ -88,6 +93,16 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, data, screen->target, texture_type, LP_JIT_TEXTURE_DATA); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, min_lod, + screen->target, texture_type, + LP_JIT_TEXTURE_MIN_LOD); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, max_lod, + screen->target, texture_type, + LP_JIT_TEXTURE_MAX_LOD); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, lod_bias, + screen->target, texture_type, + LP_JIT_TEXTURE_LOD_BIAS); + LP_CHECK_STRUCT_SIZE(struct lp_jit_texture, screen->target, texture_type); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index c94189413ab..e94d758e200 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -54,6 +54,10 @@ struct lp_jit_texture uint32_t row_stride[LP_MAX_TEXTURE_LEVELS]; uint32_t img_stride[LP_MAX_TEXTURE_LEVELS]; const void *data[LP_MAX_TEXTURE_LEVELS]; + /* sampler state, actually */ + float min_lod; + float max_lod; + float lod_bias; }; @@ -65,6 +69,9 @@ enum { LP_JIT_TEXTURE_ROW_STRIDE, LP_JIT_TEXTURE_IMG_STRIDE, LP_JIT_TEXTURE_DATA, + LP_JIT_TEXTURE_MIN_LOD, + LP_JIT_TEXTURE_MAX_LOD, + LP_JIT_TEXTURE_LOD_BIAS, LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */ }; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index ea7002aafcf..28d202bd655 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -617,7 +617,8 @@ lp_setup_set_vertex_info( struct lp_setup_context *setup, void lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, unsigned num, - struct pipe_sampler_view **views) + struct pipe_sampler_view **views, + const struct pipe_sampler_state **samplers) { unsigned i; @@ -638,6 +639,11 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->depth = tex->depth0; jit_tex->last_level = tex->last_level; + /* sampler state */ + jit_tex->min_lod = samplers[i]->min_lod; + jit_tex->max_lod = samplers[i]->max_lod; + jit_tex->lod_bias = samplers[i]->lod_bias; + /* We're referencing the texture's internal data, so save a * reference to it. */ diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 81ff43f8adc..868bd3ad2f1 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -143,7 +143,8 @@ lp_setup_set_scissor( struct lp_setup_context *setup, void lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, unsigned num, - struct pipe_sampler_view **views); + struct pipe_sampler_view **views, + const struct pipe_sampler_state **samplers); unsigned lp_setup_is_resource_referenced( const struct lp_setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index edd723f65f2..d2be22d7fc5 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -208,10 +208,12 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe ) lp_setup_set_fs_constants(llvmpipe->setup, llvmpipe->constants[PIPE_SHADER_FRAGMENT][0]); - if (llvmpipe->dirty & LP_NEW_SAMPLER_VIEW) + if (llvmpipe->dirty & (LP_NEW_SAMPLER_VIEW | + LP_NEW_SAMPLER)) lp_setup_set_fragment_sampler_views(llvmpipe->setup, llvmpipe->num_fragment_sampler_views, - llvmpipe->fragment_sampler_views); + llvmpipe->fragment_sampler_views, + llvmpipe->sampler); llvmpipe->dirty = 0; } diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 4e026cc8ffb..151fe93cfbb 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -151,6 +151,9 @@ LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE) LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE) LP_LLVM_TEXTURE_MEMBER(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE) LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA, FALSE) +LP_LLVM_TEXTURE_MEMBER(min_lod, LP_JIT_TEXTURE_MIN_LOD, TRUE) +LP_LLVM_TEXTURE_MEMBER(max_lod, LP_JIT_TEXTURE_MAX_LOD, TRUE) +LP_LLVM_TEXTURE_MEMBER(lod_bias, LP_JIT_TEXTURE_LOD_BIAS, TRUE) static void @@ -217,6 +220,10 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride; sampler->dynamic_state.base.img_stride = lp_llvm_texture_img_stride; sampler->dynamic_state.base.data_ptr = lp_llvm_texture_data_ptr; + sampler->dynamic_state.base.min_lod = lp_llvm_texture_min_lod; + sampler->dynamic_state.base.max_lod = lp_llvm_texture_max_lod; + sampler->dynamic_state.base.lod_bias = lp_llvm_texture_lod_bias; + sampler->dynamic_state.static_state = static_state; sampler->dynamic_state.context_ptr = context_ptr; -- cgit v1.2.3 From d1a4dd4217a4b8b018d4d9a161afece640d75694 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 23 Sep 2010 19:16:33 -0600 Subject: llvmpipe: make texture border_color dynamic state --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 5 -- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 9 +++- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 64 ++++++++++++++++------- src/gallium/drivers/llvmpipe/lp_jit.c | 7 ++- src/gallium/drivers/llvmpipe/lp_jit.h | 2 + src/gallium/drivers/llvmpipe/lp_setup.c | 1 + src/gallium/drivers/llvmpipe/lp_tex_sample.c | 2 + 7 files changed, 63 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index caf1c7e8656..19e380a8dce 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -114,11 +114,6 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, state->normalized_coords = sampler->normalized_coords; - state->border_color[0] = sampler->border_color[0]; - state->border_color[1] = sampler->border_color[1]; - state->border_color[2] = sampler->border_color[2]; - state->border_color[3] = sampler->border_color[3]; - /* * FIXME: Handle the remainder of pipe_sampler_view. */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 661f35f6deb..9a19e87571e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -82,7 +82,6 @@ struct lp_sampler_static_state unsigned compare_mode:1; unsigned compare_func:3; unsigned normalized_coords:1; - float border_color[4]; unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */ float min_max_lod; /**< only valid when min_max_lod_equal=1 */ @@ -158,6 +157,11 @@ struct lp_sampler_dynamic_state LLVMValueRef (*lod_bias)(const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); + + /** Obtain texture border color */ + LLVMValueRef + (*border_color)(const struct lp_sampler_dynamic_state *state, + LLVMBuilderRef builder, unsigned unit); }; @@ -178,6 +182,9 @@ struct lp_build_sample_context struct lp_type float_type; struct lp_build_context float_bld; + /** float vector type */ + struct lp_build_context float_vec_bld; + /** regular scalar float type */ struct lp_type int_type; struct lp_build_context int_bld; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index cbae1188a59..db2a6a0b22b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -54,6 +54,7 @@ #include "lp_bld_format.h" #include "lp_bld_sample.h" #include "lp_bld_sample_aos.h" +#include "lp_bld_struct.h" #include "lp_bld_quad.h" @@ -93,6 +94,7 @@ wrap_mode_uses_border_color(unsigned mode) */ static void lp_build_sample_texel_soa(struct lp_build_sample_context *bld, + unsigned unit, LLVMValueRef width, LLVMValueRef height, LLVMValueRef depth, @@ -188,13 +190,18 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, if (use_border) { /* select texel color or border color depending on use_border */ + LLVMValueRef border_color_ptr = + bld->dynamic_state->border_color(bld->dynamic_state, + bld->builder, unit); int chan; for (chan = 0; chan < 4; chan++) { LLVMValueRef border_chan = - lp_build_const_vec(bld->texel_type, - bld->static_state->border_color[chan]); + lp_build_array_get(bld->builder, border_color_ptr, + lp_build_const_int32(chan)); + LLVMValueRef border_chan_vec = + lp_build_broadcast_scalar(&bld->float_vec_bld, border_chan); texel_out[chan] = lp_build_select(&bld->texel_bld, use_border, - border_chan, texel_out[chan]); + border_chan_vec, texel_out[chan]); } } } @@ -567,6 +574,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, */ static void lp_build_sample_image_nearest(struct lp_build_sample_context *bld, + unsigned unit, LLVMValueRef width_vec, LLVMValueRef height_vec, LLVMValueRef depth_vec, @@ -615,7 +623,8 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, /* * Get texture colors. */ - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x, y, z, row_stride_vec, img_stride_vec, data_ptr, colors_out); @@ -628,6 +637,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, */ static void lp_build_sample_image_linear(struct lp_build_sample_context *bld, + unsigned unit, LLVMValueRef width_vec, LLVMValueRef height_vec, LLVMValueRef depth_vec, @@ -689,11 +699,13 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, * Get texture colors. */ /* get x0/x1 texels */ - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x0, y0, z0, row_stride_vec, img_stride_vec, data_ptr, neighbors[0][0]); - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x1, y0, z0, row_stride_vec, img_stride_vec, data_ptr, neighbors[0][1]); @@ -711,11 +723,13 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef colors0[4]; /* get x0/x1 texels at y1 */ - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x0, y1, z0, row_stride_vec, img_stride_vec, data_ptr, neighbors[1][0]); - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x1, y1, z0, row_stride_vec, img_stride_vec, data_ptr, neighbors[1][1]); @@ -735,19 +749,23 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef colors1[4]; /* get x0/x1/y0/y1 texels at z1 */ - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x0, y0, z1, row_stride_vec, img_stride_vec, data_ptr, neighbors1[0][0]); - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x1, y0, z1, row_stride_vec, img_stride_vec, data_ptr, neighbors1[0][1]); - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x0, y1, z1, row_stride_vec, img_stride_vec, data_ptr, neighbors1[1][0]); - lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec, + lp_build_sample_texel_soa(bld, unit, + width_vec, height_vec, depth_vec, x1, y1, z1, row_stride_vec, img_stride_vec, data_ptr, neighbors1[1][1]); @@ -787,6 +805,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, */ static void lp_build_sample_mipmap(struct lp_build_sample_context *bld, + unsigned unit, unsigned img_filter, unsigned mip_filter, LLVMValueRef s, @@ -812,14 +831,14 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, if (img_filter == PIPE_TEX_FILTER_NEAREST) { /* sample the first mipmap level */ - lp_build_sample_image_nearest(bld, + lp_build_sample_image_nearest(bld, unit, width0_vec, height0_vec, depth0_vec, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, colors0); if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { /* sample the second mipmap level */ - lp_build_sample_image_nearest(bld, + lp_build_sample_image_nearest(bld, unit, width1_vec, height1_vec, depth1_vec, row_stride1_vec, img_stride1_vec, data_ptr1, s, t, r, colors1); @@ -829,14 +848,14 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, assert(img_filter == PIPE_TEX_FILTER_LINEAR); /* sample the first mipmap level */ - lp_build_sample_image_linear(bld, + lp_build_sample_image_linear(bld, unit, width0_vec, height0_vec, depth0_vec, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, colors0); if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { /* sample the second mipmap level */ - lp_build_sample_image_linear(bld, + lp_build_sample_image_linear(bld, unit, width1_vec, height1_vec, depth1_vec, row_stride1_vec, img_stride1_vec, data_ptr1, s, t, r, colors1); @@ -995,7 +1014,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, */ if (min_filter == mag_filter) { /* no need to distinquish between minification and magnification */ - lp_build_sample_mipmap(bld, min_filter, mip_filter, s, t, r, lod_fpart, + lp_build_sample_mipmap(bld, unit, + min_filter, mip_filter, s, t, r, lod_fpart, width0_vec, width1_vec, height0_vec, height1_vec, depth0_vec, depth1_vec, @@ -1027,7 +1047,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, lp_build_if(&if_ctx, flow_ctx, bld->builder, minify); { /* Use the minification filter */ - lp_build_sample_mipmap(bld, min_filter, mip_filter, + lp_build_sample_mipmap(bld, unit, + min_filter, mip_filter, s, t, r, lod_fpart, width0_vec, width1_vec, height0_vec, height1_vec, @@ -1040,7 +1061,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, lp_build_else(&if_ctx); { /* Use the magnification filter */ - lp_build_sample_mipmap(bld, mag_filter, mip_filter, + lp_build_sample_mipmap(bld, unit, + mag_filter, mip_filter, s, t, r, lod_fpart, width0_vec, width1_vec, height0_vec, height1_vec, @@ -1146,6 +1168,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, LLVMValueRef s; LLVMValueRef t; LLVMValueRef r; + struct lp_type float_vec_type; if (0) { enum pipe_format fmt = static_state->format; @@ -1168,7 +1191,10 @@ lp_build_sample_soa(LLVMBuilderRef builder, bld.int_coord_type = lp_int_type(type); bld.texel_type = type; + float_vec_type = lp_type_float_vec(32); + lp_build_context_init(&bld.float_bld, builder, bld.float_type); + lp_build_context_init(&bld.float_vec_bld, builder, float_vec_type); lp_build_context_init(&bld.int_bld, builder, bld.int_type); lp_build_context_init(&bld.coord_bld, builder, bld.coord_type); lp_build_context_init(&bld.uint_coord_bld, builder, bld.uint_coord_type); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 4c7089892ef..04b12dedccf 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -64,11 +64,11 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) elem_types[LP_JIT_TEXTURE_DATA] = LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0), LP_MAX_TEXTURE_LEVELS); - elem_types[LP_JIT_TEXTURE_MIN_LOD] = LLVMFloatType(); elem_types[LP_JIT_TEXTURE_MAX_LOD] = LLVMFloatType(); elem_types[LP_JIT_TEXTURE_LOD_BIAS] = LLVMFloatType(); - + elem_types[LP_JIT_TEXTURE_BORDER_COLOR] = + LLVMArrayType(LLVMFloatType(), 4); texture_type = LLVMStructType(elem_types, Elements(elem_types), 0); @@ -102,6 +102,9 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, lod_bias, screen->target, texture_type, LP_JIT_TEXTURE_LOD_BIAS); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, border_color, + screen->target, texture_type, + LP_JIT_TEXTURE_BORDER_COLOR); LP_CHECK_STRUCT_SIZE(struct lp_jit_texture, screen->target, texture_type); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index e94d758e200..16e04fce0cd 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -58,6 +58,7 @@ struct lp_jit_texture float min_lod; float max_lod; float lod_bias; + float border_color[4]; }; @@ -72,6 +73,7 @@ enum { LP_JIT_TEXTURE_MIN_LOD, LP_JIT_TEXTURE_MAX_LOD, LP_JIT_TEXTURE_LOD_BIAS, + LP_JIT_TEXTURE_BORDER_COLOR, LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */ }; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 28d202bd655..eade4000873 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -643,6 +643,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->min_lod = samplers[i]->min_lod; jit_tex->max_lod = samplers[i]->max_lod; jit_tex->lod_bias = samplers[i]->lod_bias; + COPY_4V(jit_tex->border_color, samplers[i]->border_color); /* We're referencing the texture's internal data, so save a * reference to it. diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 151fe93cfbb..f417fc8a9ea 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -154,6 +154,7 @@ LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA, FALSE) LP_LLVM_TEXTURE_MEMBER(min_lod, LP_JIT_TEXTURE_MIN_LOD, TRUE) LP_LLVM_TEXTURE_MEMBER(max_lod, LP_JIT_TEXTURE_MAX_LOD, TRUE) LP_LLVM_TEXTURE_MEMBER(lod_bias, LP_JIT_TEXTURE_LOD_BIAS, TRUE) +LP_LLVM_TEXTURE_MEMBER(border_color, LP_JIT_TEXTURE_BORDER_COLOR, FALSE) static void @@ -223,6 +224,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, sampler->dynamic_state.base.min_lod = lp_llvm_texture_min_lod; sampler->dynamic_state.base.max_lod = lp_llvm_texture_max_lod; sampler->dynamic_state.base.lod_bias = lp_llvm_texture_lod_bias; + sampler->dynamic_state.base.border_color = lp_llvm_texture_border_color; sampler->dynamic_state.static_state = static_state; sampler->dynamic_state.context_ptr = context_ptr; -- cgit v1.2.3 From eade946cbf787f48f773c8a4037af0ead425eb26 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 23 Sep 2010 09:39:42 -0700 Subject: EGL DRI2: Silence piles of 'unused variable' warnings --- src/egl/drivers/dri2/egl_dri2.c | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src') diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 9c4ff560b14..5823ef253ff 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -339,6 +339,8 @@ dri2_get_buffers(__DRIdrawable * driDrawable, xcb_dri2_get_buffers_reply_t *reply; xcb_dri2_get_buffers_cookie_t cookie; + (void) driDrawable; + cookie = xcb_dri2_get_buffers_unchecked (dri2_dpy->conn, dri2_surf->drawable, count, count, attachments); @@ -360,12 +362,16 @@ dri2_get_buffers(__DRIdrawable * driDrawable, static void dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) { + (void) driDrawable; + /* FIXME: Does EGL support front buffer rendering at all? */ #if 0 struct dri2_egl_surface *dri2_surf = loaderPrivate; dri2WaitGL(dri2_surf); +#else + (void) loaderPrivate; #endif } @@ -376,6 +382,8 @@ dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data) struct dri2_egl_image *dri2_img; _EGLImage *img; + (void) screen; + img = _eglLookupImage(image, disp); if (img == NULL) { _eglError(EGL_BAD_PARAMETER, "dri2_lookup_egl_image"); @@ -406,6 +414,8 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable, xcb_dri2_get_buffers_with_format_cookie_t cookie; xcb_dri2_attach_format_t *format_attachments; + (void) driDrawable; + format_attachments = (xcb_dri2_attach_format_t *) attachments; cookie = xcb_dri2_get_buffers_with_format_unchecked (dri2_dpy->conn, dri2_surf->drawable, @@ -771,6 +781,8 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp, { struct dri2_egl_display *dri2_dpy; + (void) drv; + dri2_dpy = malloc(sizeof *dri2_dpy); if (!dri2_dpy) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); @@ -1074,6 +1086,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, const __DRIconfig *dri_config; int api; + (void) drv; + dri2_ctx = malloc(sizeof *dri2_ctx); if (!dri2_ctx) { _eglError(EGL_BAD_ALLOC, "eglCreateContext"); @@ -1145,6 +1159,8 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); + (void) drv; + if (_eglIsSurfaceBound(surf)) return EGL_TRUE; @@ -1220,6 +1236,8 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, xcb_screen_iterator_t s; xcb_generic_error_t *error; + (void) drv; + dri2_surf = malloc(sizeof *dri2_surf); if (!dri2_surf) { _eglError(EGL_BAD_ALLOC, "dri2_create_surface"); @@ -1393,6 +1411,8 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, static _EGLProc dri2_get_proc_address(_EGLDriver *drv, const char *procname) { + (void) drv; + /* FIXME: Do we need to support lookup of EGL symbols too? */ return (_EGLProc) _glapi_get_proc_address(procname); @@ -1404,6 +1424,8 @@ dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(ctx->DrawSurface); + (void) drv; + /* FIXME: If EGL allows frontbuffer rendering for window surfaces, * we need to copy fake to real here.*/ @@ -1415,6 +1437,9 @@ dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) static EGLBoolean dri2_wait_native(_EGLDriver *drv, _EGLDisplay *disp, EGLint engine) { + (void) drv; + (void) disp; + if (engine != EGL_CORE_NATIVE_ENGINE) return _eglError(EGL_BAD_PARAMETER, "eglWaitNative"); /* glXWaitX(); */ @@ -1437,6 +1462,8 @@ dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); xcb_gcontext_t gc; + (void) drv; + (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); gc = xcb_generate_id(dri2_dpy->conn); @@ -1500,6 +1527,11 @@ static EGLBoolean dri2_release_tex_image(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint buffer) { + (void) drv; + (void) disp; + (void) surf; + (void) buffer; + return EGL_TRUE; } @@ -1519,6 +1551,8 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, xcb_generic_error_t *error; int stride, format; + (void) ctx; + drawable = (xcb_drawable_t) buffer; xcb_dri2_create_drawable (dri2_dpy->conn, drawable); attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT; @@ -1629,6 +1663,8 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, struct dri2_egl_image *dri2_img; EGLint width, height, format, name, stride, pitch, i, err; + (void) ctx; + name = (EGLint) buffer; err = EGL_SUCCESS; @@ -1715,6 +1751,8 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list) { + (void) drv; + switch (target) { case EGL_NATIVE_PIXMAP_KHR: return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list); @@ -1734,6 +1772,8 @@ dri2_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_image *dri2_img = dri2_egl_image(image); + (void) drv; + dri2_dpy->image->destroyImage(dri2_img->dri_image); free(dri2_img); @@ -1750,6 +1790,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, unsigned int use, dri_use, valid_mask; EGLint err = EGL_SUCCESS; + (void) drv; + dri2_img = malloc(sizeof *dri2_img); if (!dri2_img) { _eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); @@ -1850,6 +1892,8 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_image *dri2_img = dri2_egl_image(img); + (void) drv; + if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image, __DRI_IMAGE_ATTRIB_NAME, name)) { _eglError(EGL_BAD_ALLOC, "dri2_export_drm_image_mesa"); @@ -1876,6 +1920,8 @@ _eglMain(const char *args) { struct dri2_egl_driver *dri2_drv; + (void) args; + dri2_drv = malloc(sizeof *dri2_drv); if (!dri2_drv) return NULL; -- cgit v1.2.3 From 137fce247f8f575f5ff38da65171bd26b4e38866 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 23 Sep 2010 09:40:58 -0700 Subject: EGL DRI2: Silence 'missing initializer' warnings --- src/egl/drivers/dri2/egl_dri2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 5823ef253ff..2b6e36876dc 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -449,14 +449,14 @@ struct dri2_extension_match { static struct dri2_extension_match dri2_driver_extensions[] = { { __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) }, { __DRI_DRI2, 1, offsetof(struct dri2_egl_display, dri2) }, - { NULL } + { NULL, 0, 0 } }; static struct dri2_extension_match dri2_core_extensions[] = { { __DRI2_FLUSH, 1, offsetof(struct dri2_egl_display, flush) }, { __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) }, { __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) }, - { NULL } + { NULL, 0, 0 } }; static EGLBoolean -- cgit v1.2.3 From 15861e0074bdc0185662ef6a6f4358230a187243 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 24 Sep 2010 13:20:58 -0400 Subject: r600c: fix mipmap stride on evergreen taken from Dave's r600g fix --- src/mesa/drivers/dri/radeon/radeon_common_context.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index b0340cee218..85e4988c53f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -245,9 +245,16 @@ GLboolean radeonInitContext(radeonContextPtr radeon, DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16; if (IS_R600_CLASS(radeon->radeonScreen)) { - radeon->texture_row_align = 256; - radeon->texture_rect_row_align = 256; - radeon->texture_compressed_row_align = 256; + int chip_family = radeon->radeonScreen->chip_family; + if (chip_family >= CHIP_FAMILY_CEDAR) { + radeon->texture_row_align = 512; + radeon->texture_rect_row_align = 512; + radeon->texture_compressed_row_align = 512; + } else { + radeon->texture_row_align = 256; + radeon->texture_rect_row_align = 256; + radeon->texture_compressed_row_align = 256; + } } else if (IS_R200_CLASS(radeon->radeonScreen) || IS_R100_CLASS(radeon->radeonScreen)) { radeon->texture_row_align = 32; -- cgit v1.2.3 From e7c8832c7f4cbf0add350fbb6fe7c955b4665363 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Sep 2010 17:01:39 -0700 Subject: intel: Dead comment removal. --- src/mesa/drivers/dri/intel/intel_screen.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 6d66a25ca1f..d200dc1f4ac 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -465,7 +465,6 @@ intel_init_bufmgr(struct intel_screen *intelScreen) intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL; intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ); - /* Otherwise, use the classic buffer manager. */ if (intelScreen->bufmgr == NULL) { fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", __func__, __LINE__); -- cgit v1.2.3 From 66c9ac76ad6b405d75ea099c1c2d3b2ba23f63ce Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 24 Sep 2010 09:54:58 -0700 Subject: egl_glx: Silence piles of 'unused variable' warnings --- src/egl/drivers/glx/egl_glx.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index b2076e2e3fd..29bc8033d7d 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -457,6 +457,8 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp, { struct GLX_egl_display *GLX_dpy; + (void) drv; + if (disp->Platform != _EGL_PLATFORM_X11) return EGL_FALSE; @@ -541,6 +543,8 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); struct GLX_egl_context *GLX_ctx_shared = GLX_egl_context(share_list); + (void) drv; + if (!GLX_ctx) { _eglError(EGL_BAD_ALLOC, "eglCreateContext"); return NULL; @@ -604,6 +608,8 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, GLXContext cctx; EGLBoolean ret = EGL_FALSE; + (void) drv; + /* bind the new context and return the "orphaned" one */ if (!_eglBindContext(&ctx, &dsurf, &rsurf)) return EGL_FALSE; @@ -656,6 +662,8 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, struct GLX_egl_surface *GLX_surf; uint width, height; + (void) drv; + GLX_surf = CALLOC_STRUCT(GLX_egl_surface); if (!GLX_surf) { _eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface"); @@ -702,6 +710,8 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, struct GLX_egl_surface *GLX_surf; uint width, height; + (void) drv; + GLX_surf = CALLOC_STRUCT(GLX_egl_surface); if (!GLX_surf) { _eglError(EGL_BAD_ALLOC, "eglCreatePixmapSurface"); @@ -762,6 +772,8 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp, int attribs[5]; int i; + (void) drv; + GLX_surf = CALLOC_STRUCT(GLX_egl_surface); if (!GLX_surf) { _eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface"); @@ -820,6 +832,8 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp, static EGLBoolean GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) { + (void) drv; + if (!_eglIsSurfaceBound(surf)) destroy_surface(disp, surf); @@ -833,6 +847,8 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); struct GLX_egl_surface *GLX_surf = GLX_egl_surface(draw); + (void) drv; + glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable); return EGL_TRUE; @@ -844,12 +860,18 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) static _EGLProc GLX_eglGetProcAddress(_EGLDriver *drv, const char *procname) { + (void) drv; + return (_EGLProc) glXGetProcAddress((const GLubyte *) procname); } static EGLBoolean GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) { + (void) drv; + (void) dpy; + (void) ctx; + glXWaitGL(); return EGL_TRUE; } @@ -857,6 +879,9 @@ GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) static EGLBoolean GLX_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine) { + (void) drv; + (void) dpy; + if (engine != EGL_CORE_NATIVE_ENGINE) return _eglError(EGL_BAD_PARAMETER, "eglWaitNative"); glXWaitX(); @@ -880,6 +905,8 @@ _eglMain(const char *args) { struct GLX_egl_driver *GLX_drv = CALLOC_STRUCT(GLX_egl_driver); + (void) args; + if (!GLX_drv) return NULL; -- cgit v1.2.3 From e4bd50c232ed9d8c5a8a76a662a29a03d4237593 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 24 Sep 2010 10:54:28 -0700 Subject: egl: Fix several 'comparison between signed and unsigned integer' warnings I hate GCC for requiring the (int) cast on sizeof. --- src/egl/drivers/dri2/egl_dri2.c | 4 ++-- src/egl/drivers/glx/egl_glx.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 2b6e36876dc..d17a2ab88c2 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -292,7 +292,7 @@ dri2_process_buffers(struct dri2_egl_surface *dri2_surf, struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display); xcb_rectangle_t rectangle; - int i; + unsigned i; dri2_surf->buffer_count = count; dri2_surf->have_fake_front = 0; @@ -1386,7 +1386,7 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, xcb_rectangle_t rectangles[16]; int i; - if (numRects > ARRAY_SIZE(rectangles)) + if (numRects > (int)ARRAY_SIZE(rectangles)) return dri2_copy_region(drv, disp, draw, dri2_surf->region); /* FIXME: Invert y here? */ diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index 29bc8033d7d..8a46f9c4a61 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -162,7 +162,8 @@ static EGLBoolean convert_fbconfig(Display *dpy, GLXFBConfig fbconfig, struct GLX_egl_config *GLX_conf) { - int err = 0, attr, egl_attr, val, i; + int err = 0, attr, egl_attr, val; + unsigned i; EGLint conformant, config_caveat, surface_type; for (i = 0; i < ARRAY_SIZE(fbconfig_attributes); i++) { @@ -243,7 +244,8 @@ static EGLBoolean convert_visual(Display *dpy, XVisualInfo *vinfo, struct GLX_egl_config *GLX_conf) { - int err, attr, egl_attr, val, i; + int err, attr, egl_attr, val; + unsigned i; EGLint conformant, config_caveat, surface_type; /* the visual must support OpenGL */ -- cgit v1.2.3 From b43480fabb5d7c99ffd874e7dc64f2c65e1da2fe Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 14:59:28 -0400 Subject: r600g: fixup some evergreen register definitions Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/eg_hw_states.c | 10 ++-- src/gallium/drivers/r600/evergreend.h | 102 ++++++++++++++++---------------- 2 files changed, 56 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 6e823689847..f37208f362c 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -418,9 +418,9 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) db_render_control = 0; /// db_render_control = S_028D0C_STENCIL_COMPRESS_DISABLE(1) | /// S_028D0C_DEPTH_COMPRESS_DISABLE(1); - db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); + db_render_override = S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_DISABLE) | + S_02800C_FORCE_HIS_ENABLE0(V_02800C_FORCE_DISABLE) | + S_02800C_FORCE_HIS_ENABLE1(V_02800C_FORCE_DISABLE); query_running = FALSE; @@ -431,8 +431,8 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) } if (query_running) { - db_render_override |= S_028D10_NOOP_CULL_DISABLE(1); - db_render_control |= S_028D0C_PERFECT_ZPASS_COUNTS(1); + db_render_override |= S_02800C_NOOP_CULL_DISABLE(1); + db_render_control |= S_028000_PERFECT_ZPASS_COUNTS(1); } rstate->states[EG_DSA__DB_STENCIL_CLEAR] = 0x00000000; diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index db9b5656df1..2359c783838 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -326,7 +326,7 @@ #define S_028C74_NON_DISP_TILING_ORDER(x) (((x) & 0x1) << 4) #define G_028C74_NON_DISP_TILING_ORDER(x) (((x) >> 4) & 0x1) #define C_028C74_NON_DISP_TILING_ORDER 0xFFFFFFEF - + #define R_028C78_CB_COLOR0_DIM 0x028C78 #define S_028C78_WIDTH_MAX(x) (((x) & 0xFFFF) << 0) #define G_028C78_WIDTH_MAX(x) (((x) >> 0) & 0xFFFF) @@ -679,56 +679,6 @@ #define S_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) & 0x3FF) << 0) #define G_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) >> 0) & 0x3FF) #define C_028D34_DEPTH_HEIGHT_TILE_MAX 0xFFFFFC00 -#define R_028D0C_DB_RENDER_CONTROL 0x028D0C -#define S_028D0C_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5) -#define S_028D0C_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6) -#define S_028D0C_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15) -#define R_028D10_DB_RENDER_OVERRIDE 0x028D10 -#define V_028D10_FORCE_OFF 0 -#define V_028D10_FORCE_ENABLE 1 -#define V_028D10_FORCE_DISABLE 2 -#define S_028D10_FORCE_HIZ_ENABLE(x) (((x) & 0x3) << 0) -#define G_028D10_FORCE_HIZ_ENABLE(x) (((x) >> 0) & 0x3) -#define C_028D10_FORCE_HIZ_ENABLE 0xFFFFFFFC -#define S_028D10_FORCE_HIS_ENABLE0(x) (((x) & 0x3) << 2) -#define G_028D10_FORCE_HIS_ENABLE0(x) (((x) >> 2) & 0x3) -#define C_028D10_FORCE_HIS_ENABLE0 0xFFFFFFF3 -#define S_028D10_FORCE_HIS_ENABLE1(x) (((x) & 0x3) << 4) -#define G_028D10_FORCE_HIS_ENABLE1(x) (((x) >> 4) & 0x3) -#define C_028D10_FORCE_HIS_ENABLE1 0xFFFFFFCF -#define S_028D10_FORCE_SHADER_Z_ORDER(x) (((x) & 0x1) << 6) -#define G_028D10_FORCE_SHADER_Z_ORDER(x) (((x) >> 6) & 0x1) -#define C_028D10_FORCE_SHADER_Z_ORDER 0xFFFFFFBF -#define S_028D10_FAST_Z_DISABLE(x) (((x) & 0x1) << 7) -#define G_028D10_FAST_Z_DISABLE(x) (((x) >> 7) & 0x1) -#define C_028D10_FAST_Z_DISABLE 0xFFFFFF7F -#define S_028D10_FAST_STENCIL_DISABLE(x) (((x) & 0x1) << 8) -#define G_028D10_FAST_STENCIL_DISABLE(x) (((x) >> 8) & 0x1) -#define C_028D10_FAST_STENCIL_DISABLE 0xFFFFFEFF -#define S_028D10_NOOP_CULL_DISABLE(x) (((x) & 0x1) << 9) -#define G_028D10_NOOP_CULL_DISABLE(x) (((x) >> 9) & 0x1) -#define C_028D10_NOOP_CULL_DISABLE 0xFFFFFDFF -#define S_028D10_FORCE_COLOR_KILL(x) (((x) & 0x1) << 10) -#define G_028D10_FORCE_COLOR_KILL(x) (((x) >> 10) & 0x1) -#define C_028D10_FORCE_COLOR_KILL 0xFFFFFBFF -#define S_028D10_FORCE_Z_READ(x) (((x) & 0x1) << 11) -#define G_028D10_FORCE_Z_READ(x) (((x) >> 11) & 0x1) -#define C_028D10_FORCE_Z_READ 0xFFFFF7FF -#define S_028D10_FORCE_STENCIL_READ(x) (((x) & 0x1) << 12) -#define G_028D10_FORCE_STENCIL_READ(x) (((x) >> 12) & 0x1) -#define C_028D10_FORCE_STENCIL_READ 0xFFFFEFFF -#define S_028D10_FORCE_FULL_Z_RANGE(x) (((x) & 0x3) << 13) -#define G_028D10_FORCE_FULL_Z_RANGE(x) (((x) >> 13) & 0x3) -#define C_028D10_FORCE_FULL_Z_RANGE 0xFFFF9FFF -#define S_028D10_FORCE_QC_SMASK_CONFLICT(x) (((x) & 0x1) << 15) -#define G_028D10_FORCE_QC_SMASK_CONFLICT(x) (((x) >> 15) & 0x1) -#define C_028D10_FORCE_QC_SMASK_CONFLICT 0xFFFF7FFF -#define S_028D10_DISABLE_VIEWPORT_CLAMP(x) (((x) & 0x1) << 16) -#define G_028D10_DISABLE_VIEWPORT_CLAMP(x) (((x) >> 16) & 0x1) -#define C_028D10_DISABLE_VIEWPORT_CLAMP 0xFFFEFFFF -#define S_028D10_IGNORE_SC_ZRANGE(x) (((x) & 0x1) << 17) -#define G_028D10_IGNORE_SC_ZRANGE(x) (((x) >> 17) & 0x1) -#define C_028D10_IGNORE_SC_ZRANGE 0xFFFDFFFF #define R_02880C_DB_SHADER_CONTROL 0x02880C #define S_02880C_Z_EXPORT_ENABLE(x) (((x) & 0x1) << 0) #define G_02880C_Z_EXPORT_ENABLE(x) (((x) >> 0) & 0x1) @@ -1458,8 +1408,56 @@ #define R_008C0C_SQ_THREAD_RESOURCE_MGMT 0x00008C0C #define R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x00008D8C #define R_028000_DB_RENDER_CONTROL 0x00028000 +#define S_028000_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5) +#define S_028000_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6) +#define S_028000_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15) #define R_028008_DB_DEPTH_VIEW 0x00028008 #define R_02800C_DB_RENDER_OVERRIDE 0x0002800C +#define V_02800C_FORCE_OFF 0 +#define V_02800C_FORCE_ENABLE 1 +#define V_02800C_FORCE_DISABLE 2 +#define S_02800C_FORCE_HIZ_ENABLE(x) (((x) & 0x3) << 0) +#define G_02800C_FORCE_HIZ_ENABLE(x) (((x) >> 0) & 0x3) +#define C_02800C_FORCE_HIZ_ENABLE 0xFFFFFFFC +#define S_02800C_FORCE_HIS_ENABLE0(x) (((x) & 0x3) << 2) +#define G_02800C_FORCE_HIS_ENABLE0(x) (((x) >> 2) & 0x3) +#define C_02800C_FORCE_HIS_ENABLE0 0xFFFFFFF3 +#define S_02800C_FORCE_HIS_ENABLE1(x) (((x) & 0x3) << 4) +#define G_02800C_FORCE_HIS_ENABLE1(x) (((x) >> 4) & 0x3) +#define C_02800C_FORCE_HIS_ENABLE1 0xFFFFFFCF +#define S_02800C_FORCE_SHADER_Z_ORDER(x) (((x) & 0x1) << 6) +#define G_02800C_FORCE_SHADER_Z_ORDER(x) (((x) >> 6) & 0x1) +#define C_02800C_FORCE_SHADER_Z_ORDER 0xFFFFFFBF +#define S_02800C_FAST_Z_DISABLE(x) (((x) & 0x1) << 7) +#define G_02800C_FAST_Z_DISABLE(x) (((x) >> 7) & 0x1) +#define C_02800C_FAST_Z_DISABLE 0xFFFFFF7F +#define S_02800C_FAST_STENCIL_DISABLE(x) (((x) & 0x1) << 8) +#define G_02800C_FAST_STENCIL_DISABLE(x) (((x) >> 8) & 0x1) +#define C_02800C_FAST_STENCIL_DISABLE 0xFFFFFEFF +#define S_02800C_NOOP_CULL_DISABLE(x) (((x) & 0x1) << 9) +#define G_02800C_NOOP_CULL_DISABLE(x) (((x) >> 9) & 0x1) +#define C_02800C_NOOP_CULL_DISABLE 0xFFFFFDFF +#define S_02800C_FORCE_COLOR_KILL(x) (((x) & 0x1) << 10) +#define G_02800C_FORCE_COLOR_KILL(x) (((x) >> 10) & 0x1) +#define C_02800C_FORCE_COLOR_KILL 0xFFFFFBFF +#define S_02800C_FORCE_Z_READ(x) (((x) & 0x1) << 11) +#define G_02800C_FORCE_Z_READ(x) (((x) >> 11) & 0x1) +#define C_02800C_FORCE_Z_READ 0xFFFFF7FF +#define S_02800C_FORCE_STENCIL_READ(x) (((x) & 0x1) << 12) +#define G_02800C_FORCE_STENCIL_READ(x) (((x) >> 12) & 0x1) +#define C_02800C_FORCE_STENCIL_READ 0xFFFFEFFF +#define S_02800C_FORCE_FULL_Z_RANGE(x) (((x) & 0x3) << 13) +#define G_02800C_FORCE_FULL_Z_RANGE(x) (((x) >> 13) & 0x3) +#define C_02800C_FORCE_FULL_Z_RANGE 0xFFFF9FFF +#define S_02800C_FORCE_QC_SMASK_CONFLICT(x) (((x) & 0x1) << 15) +#define G_02800C_FORCE_QC_SMASK_CONFLICT(x) (((x) >> 15) & 0x1) +#define C_02800C_FORCE_QC_SMASK_CONFLICT 0xFFFF7FFF +#define S_02800C_DISABLE_VIEWPORT_CLAMP(x) (((x) & 0x1) << 16) +#define G_02800C_DISABLE_VIEWPORT_CLAMP(x) (((x) >> 16) & 0x1) +#define C_02800C_DISABLE_VIEWPORT_CLAMP 0xFFFEFFFF +#define S_02800C_IGNORE_SC_ZRANGE(x) (((x) & 0x1) << 17) +#define G_02800C_IGNORE_SC_ZRANGE(x) (((x) >> 17) & 0x1) +#define C_02800C_IGNORE_SC_ZRANGE 0xFFFDFFFF #define R_028010_DB_RENDER_OVERRIDE2 0x00028010 #define R_028014_DB_HTILE_DATA_BASE 0x00028014 #define R_028028_DB_STENCIL_CLEAR 0x00028028 @@ -1863,5 +1861,7 @@ #define S_0085F0_CR2_ACTION_ENA(x) (((x) & 0x1) << 31) #define G_0085F0_CR2_ACTION_ENA(x) (((x) >> 31) & 0x1) #define C_0085F0_CR2_ACTION_ENA 0x7FFFFFFF +#define R_008970_VGT_NUM_INDICES 0x008970 +#define R_0287F0_VGT_DRAW_INITIATOR 0x0287F0 #endif -- cgit v1.2.3 From ba7e6ccc95a4e39cd15ca03573b2f6d6f8c9f539 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 15:00:08 -0400 Subject: r600g: fix evergreen new path Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 419 ++++++++++++++++---------- src/gallium/drivers/r600/r600_state2.c | 2 +- src/gallium/winsys/r600/drm/evergreen_state.c | 26 +- src/gallium/winsys/r600/drm/r600_state2.c | 2 +- 4 files changed, 271 insertions(+), 178 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index ed0daab25a1..15588fed936 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -60,10 +60,11 @@ static void evergreen_set_blend_color(struct pipe_context *ctx, return; rstate->id = R600_PIPE_STATE_BLEND_COLOR; - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); + free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; r600_context_pipe_state_set(&rctx->ctx, rstate); @@ -75,6 +76,8 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx, struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend); struct r600_pipe_state *rstate; u32 color_control, target_mask; + /* FIXME there is more then 8 framebuffer */ + unsigned blend_cntl[8]; if (blend == NULL) { return NULL; @@ -101,8 +104,38 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx, } } blend->cb_target_mask = target_mask; - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL, color_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C3C_PA_SC_AA_MASK, 0xFFFFFFFF, 0xFFFFFFFF, NULL); + + for (int i = 0; i < 8; i++) { + unsigned eqRGB = state->rt[i].rgb_func; + unsigned srcRGB = state->rt[i].rgb_src_factor; + unsigned dstRGB = state->rt[i].rgb_dst_factor; + unsigned eqA = state->rt[i].alpha_func; + unsigned srcA = state->rt[i].alpha_src_factor; + unsigned dstA = state->rt[i].alpha_dst_factor; + + blend_cntl[i] = 0; + if (!state->rt[i].blend_enable) + continue; + + blend_cntl[i] |= S_028780_BLEND_CONTROL_ENABLE(1); + blend_cntl[i] |= S_028780_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB)); + blend_cntl[i] |= S_028780_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB)); + blend_cntl[i] |= S_028780_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB)); + + if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) { + blend_cntl[i] |= S_028780_SEPARATE_ALPHA_BLEND(1); + blend_cntl[i] |= S_028780_ALPHA_COMB_FCN(r600_translate_blend_function(eqA)); + blend_cntl[i] |= S_028780_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA)); + blend_cntl[i] |= S_028780_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA)); + } + } + for (int i = 0; i < 8; i++) { + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028780_CB_BLEND0_CONTROL + i * 4, blend_cntl[i], 0xFFFFFFFF, NULL); + } + return rstate; } @@ -177,25 +210,29 @@ static void *evergreen_create_dsa_state(struct pipe_context *ctx, /* misc */ db_render_control = 0; - db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); + db_render_override = S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_DISABLE) | + S_02800C_FORCE_HIS_ENABLE0(V_02800C_FORCE_DISABLE) | + S_02800C_FORCE_HIS_ENABLE1(V_02800C_FORCE_DISABLE); /* TODO db_render_override depends on query */ - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028430_DB_STENCILREFMASK, stencil_ref_mask, 0xFFFFFFFF & C_028430_STENCILREF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf, 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028000_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02800C_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC8_DB_PRELOAD_CONTROL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B70_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); return rstate; } @@ -232,9 +269,9 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, tmp |= S_0286D4_PNT_SPRITE_TOP_1(1); } } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | @@ -242,25 +279,27 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); /* point size 12.4 fixed point */ tmp = (unsigned)(state->point_size * 8.0); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C08_PA_SU_VTX_CNTL, 0x00000005, 0xFFFFFFFF, NULL); return rstate; } @@ -308,7 +347,7 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_SAMPLER; util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0, S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | @@ -318,11 +357,11 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL); /* FIXME LOD it depends on texture base level ... */ - r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0, S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) | S_03C008_TYPE(1), 0xFFFFFFFF, NULL); @@ -413,29 +452,29 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte pitch = align(tmp->pitch[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, S_030000_DIM(r600_tex_dim(texture->target)) | S_030000_PITCH((pitch / 8) - 1) | S_030000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, S_030004_TEX_HEIGHT(texture->height0 - 1) | S_030004_TEX_DEPTH(texture->depth0 - 1), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030008_RESOURCE0_WORD2, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030008_RESOURCE0_WORD2, tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03000C_RESOURCE0_WORD3, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03000C_RESOURCE0_WORD3, tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, word4 | S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) | S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) | S_030010_REQUEST_SIZE(1) | S_030010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, S_030014_LAST_LEVEL(state->last_level) | S_030014_BASE_ARRAY(0) | S_030014_LAST_ARRAY(0), 0xffffffff, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, S_03001C_DATA_FORMAT(format) | S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL); @@ -531,20 +570,20 @@ static void evergreen_set_clip_state(struct pipe_context *ctx, rctx->clip = *state; rstate->id = R600_PIPE_STATE_CLIP; for (int i = 0; i < state->nr; i++) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0285BC_PA_CL_UCP0_X + i * 4, fui(state->ucp[i][0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0285C0_PA_CL_UCP0_Y + i * 4, fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0285C4_PA_CL_UCP0_Z + i * 4, fui(state->ucp[i][2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0285C8_PA_CL_UCP0_W + i * 4, fui(state->ucp[i][3]), 0xFFFFFFFF, NULL); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) | S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) | S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL); @@ -587,51 +626,51 @@ static void evergreen_set_scissor_state(struct pipe_context *ctx, return; rstate->id = R600_PIPE_STATE_SCISSOR; - tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1); + tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny); br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028030_PA_SC_SCREEN_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028034_PA_SC_SCREEN_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028204_PA_SC_WINDOW_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028208_PA_SC_WINDOW_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028210_PA_SC_CLIPRECT_0_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028214_PA_SC_CLIPRECT_0_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028218_PA_SC_CLIPRECT_1_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02821C_PA_SC_CLIPRECT_1_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028220_PA_SC_CLIPRECT_2_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028224_PA_SC_CLIPRECT_2_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028228_PA_SC_CLIPRECT_3_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02822C_PA_SC_CLIPRECT_3_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028200_PA_SC_WINDOW_OFFSET, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, 0xFFFFFFFF, NULL); @@ -653,11 +692,11 @@ static void evergreen_set_stencil_ref(struct pipe_context *ctx, rctx->stencil_ref = *state; rstate->id = R600_PIPE_STATE_STENCIL_REF; tmp = S_028430_STENCILREF(state->ref_value[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028430_DB_STENCILREFMASK, tmp, ~C_028430_STENCILREF, NULL); tmp = S_028434_STENCILREF_BF(state->ref_value[1]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028434_DB_STENCILREFMASK_BF, tmp, ~C_028434_STENCILREF_BF, NULL); @@ -677,15 +716,15 @@ static void evergreen_set_viewport_state(struct pipe_context *ctx, rctx->viewport = *state; rstate->id = R600_PIPE_STATE_VIEWPORT; - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_VIEWPORT]); rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; @@ -726,24 +765,27 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state S_028C70_NUMBER_TYPE(ntype); /* FIXME handle enabling of CB beyond BASE8 which has different offset */ - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C60_CB_COLOR0_BASE + cb * 0x3C, state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + R_028C78_CB_COLOR0_DIM + cb * 0x3C, + 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C70_CB_COLOR0_INFO + cb * 0x3C, - color_info, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + color_info, 0xFFFFFFFF, bo[0]); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C64_CB_COLOR0_PITCH + cb * 0x3C, S_028C64_PITCH_TILE_MAX(pitch), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C68_CB_COLOR0_SLICE + cb * 0x3C, S_028C68_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C6C_CB_COLOR0_VIEW + cb * 0x3C, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C74_CB_COLOR0_ATTRIB + cb * 0x3C, S_028C74_NON_DISP_TILING_ORDER(1), 0xFFFFFFFF, NULL); @@ -772,18 +814,20 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028048_DB_Z_READ_BASE, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028048_DB_Z_READ_BASE, + state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028050_DB_Z_WRITE_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028050_DB_Z_WRITE_BASE, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028040_DB_Z_INFO, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028040_DB_Z_INFO, S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028058_DB_DEPTH_SIZE, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028058_DB_DEPTH_SIZE, S_028058_PITCH_TILE_MAX(pitch), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02805C_DB_DEPTH_SLICE, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02805C_DB_DEPTH_SLICE, S_02805C_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); } @@ -824,29 +868,29 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, target_mask ^= 0xf << (i * 4); shader_mask |= 0xf << (i * 4); } - tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1); + tl = S_028240_TL_X(0) | S_028240_TL_Y(0); br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028240_PA_SC_GENERIC_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028244_PA_SC_GENERIC_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, 0x00000000, target_mask, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK, shader_mask, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0x00000000, 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); @@ -927,6 +971,7 @@ static void *evergreen_create_shader_state(struct pipe_context *ctx, struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); int r; + shader->shader.use_mem_constant = TRUE; r = r600_pipe_shader_create2(ctx, shader, state->tokens); if (r) { return NULL; @@ -1159,90 +1204,127 @@ void evergreen_init_config2(struct r600_pipe_context *rctx) tmp |= S_008C00_VS_PRIO(vs_prio); tmp |= S_008C00_GS_PRIO(gs_prio); tmp |= S_008C00_ES_PRIO(es_prio); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); tmp |= S_008C08_NUM_ES_GPRS(num_es_gprs); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C0C_NUM_HS_GPRS(num_hs_gprs); tmp |= S_008C0C_NUM_LS_GPRS(num_ls_gprs); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C18_NUM_PS_THREADS(num_ps_threads); tmp |= S_008C18_NUM_VS_THREADS(num_vs_threads); tmp |= S_008C18_NUM_GS_THREADS(num_gs_threads); tmp |= S_008C18_NUM_ES_THREADS(num_es_threads); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C1C_NUM_HS_THREADS(num_hs_threads); tmp |= S_008C1C_NUM_LS_THREADS(num_ls_threads); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); tmp |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); tmp |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries); tmp |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AB4_VGT_REUSE_OFF, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028380_SQ_VTX_SEMANTIC_0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028384_SQ_VTX_SEMANTIC_1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028388_SQ_VTX_SEMANTIC_2, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02838C_SQ_VTX_SEMANTIC_3, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028390_SQ_VTX_SEMANTIC_4, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028394_SQ_VTX_SEMANTIC_5, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028398_SQ_VTX_SEMANTIC_6, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02839C_SQ_VTX_SEMANTIC_7, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A0_SQ_VTX_SEMANTIC_8, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A4_SQ_VTX_SEMANTIC_9, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A8_SQ_VTX_SEMANTIC_10, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283AC_SQ_VTX_SEMANTIC_11, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B0_SQ_VTX_SEMANTIC_12, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B4_SQ_VTX_SEMANTIC_13, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B8_SQ_VTX_SEMANTIC_14, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283BC_SQ_VTX_SEMANTIC_15, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C0_SQ_VTX_SEMANTIC_16, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C4_SQ_VTX_SEMANTIC_17, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C8_SQ_VTX_SEMANTIC_18, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283CC_SQ_VTX_SEMANTIC_19, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D0_SQ_VTX_SEMANTIC_20, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D4_SQ_VTX_SEMANTIC_21, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D8_SQ_VTX_SEMANTIC_22, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283DC_SQ_VTX_SEMANTIC_23, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E0_SQ_VTX_SEMANTIC_24, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E4_SQ_VTX_SEMANTIC_25, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E8_SQ_VTX_SEMANTIC_26, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283EC_SQ_VTX_SEMANTIC_27, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F0_SQ_VTX_SEMANTIC_28, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F4_SQ_VTX_SEMANTIC_29, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F8_SQ_VTX_SEMANTIC_30, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283FC_SQ_VTX_SEMANTIC_31, 0x0, 0xFFFFFFFF, NULL); + +r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, + 0x0, 0xFFFFFFFF, NULL); + r600_context_pipe_state_set(&rctx->ctx, rstate); } @@ -1342,6 +1424,9 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.start, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); +// r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, info->max_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, 0x0000FFFF, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, 0x00000000, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, &vgt); rdraw.vgt_num_indices = draw.count; @@ -1383,7 +1468,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader if (rctx->sprite_coord_enable & (1 << i)) { tmp |= S_028644_PT_SPRITE_TEX(1); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } exports_ps = 0; @@ -1408,24 +1493,27 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1); spi_input_z |= 1; } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028840_SQ_PGM_START_PS, 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028844_SQ_PGM_RESOURCES_PS, S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) | S_028844_STACK_SIZE(rshader->bc.nstack), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + R_028848_SQ_PGM_RESOURCES_2_PS, + 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02884C_SQ_PGM_EXPORTS_PS, exports_ps, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286E0_SPI_BARYC_CNTL, S_0286E0_PERSP_CENTROID_ENA(1) | S_0286E0_LINEAR_CENTROID_ENA(1), @@ -1451,27 +1539,30 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader spi_vs_out_id[i / 4] |= tmp; } for (i = 0; i < 10; i++) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02861C_SPI_VS_OUT_ID_0 + i * 4, spi_vs_out_id[i], 0xFFFFFFFF, NULL); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286C4_SPI_VS_OUT_CONFIG, S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028860_SQ_PGM_RESOURCES_VS, S_028860_NUM_GPRS(rshader->bc.ngpr) | S_028860_STACK_SIZE(rshader->bc.nstack), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + R_028864_SQ_PGM_RESOURCES_2_VS, + 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0288A8_SQ_PGM_RESOURCES_FS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02885C_SQ_PGM_START_VS, 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0288A4_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 075b5f03190..2c55f073f07 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -572,7 +572,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, if (!rctx->ctx.pm4_cdwords) return; -#if 1 +#if 0 sprintf(dname, "gallium-%08d.bof", dc); if (dc < 20) { r600_context_dump_bof(&rctx->ctx, dname); diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index 5781d448ede..96e2105cd18 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -78,7 +78,9 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028008_DB_DEPTH_VIEW}, {0, 0, R_02800C_DB_RENDER_OVERRIDE}, {0, 0, R_028010_DB_RENDER_OVERRIDE2}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028014_DB_HTILE_DATA_BASE}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {0, 0, R_028028_DB_STENCIL_CLEAR}, {0, 0, R_02802C_DB_DEPTH_CLEAR}, {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL}, @@ -329,7 +331,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028C64_CB_COLOR0_PITCH}, {0, 0, R_028C68_CB_COLOR0_SLICE}, {0, 0, R_028C6C_CB_COLOR0_VIEW}, - {0, 0, R_028C70_CB_COLOR0_INFO}, + {1, 0, R_028C70_CB_COLOR0_INFO}, {0, 0, R_028C74_CB_COLOR0_ATTRIB}, {0, 0, R_028C78_CB_COLOR0_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -337,7 +339,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028CA0_CB_COLOR1_PITCH}, {0, 0, R_028CA4_CB_COLOR1_SLICE}, {0, 0, R_028CA8_CB_COLOR1_VIEW}, - {0, 0, R_028CAC_CB_COLOR1_INFO}, + {1, 0, R_028CAC_CB_COLOR1_INFO}, {0, 0, R_028CB0_CB_COLOR1_ATTRIB}, {0, 0, R_028CB8_CB_COLOR1_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -345,7 +347,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028CDC_CB_COLOR2_PITCH}, {0, 0, R_028CE0_CB_COLOR2_SLICE}, {0, 0, R_028CE4_CB_COLOR2_VIEW}, - {0, 0, R_028CE8_CB_COLOR2_INFO}, + {1, 0, R_028CE8_CB_COLOR2_INFO}, {0, 0, R_028CEC_CB_COLOR2_ATTRIB}, {0, 0, R_028CF0_CB_COLOR2_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -353,7 +355,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028D18_CB_COLOR3_PITCH}, {0, 0, R_028D1C_CB_COLOR3_SLICE}, {0, 0, R_028D20_CB_COLOR3_VIEW}, - {0, 0, R_028D24_CB_COLOR3_INFO}, + {1, 0, R_028D24_CB_COLOR3_INFO}, {0, 0, R_028D28_CB_COLOR3_ATTRIB}, {0, 0, R_028D2C_CB_COLOR3_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -361,7 +363,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028D54_CB_COLOR4_PITCH}, {0, 0, R_028D58_CB_COLOR4_SLICE}, {0, 0, R_028D5C_CB_COLOR4_VIEW}, - {0, 0, R_028D60_CB_COLOR4_INFO}, + {1, 0, R_028D60_CB_COLOR4_INFO}, {0, 0, R_028D64_CB_COLOR4_ATTRIB}, {0, 0, R_028D68_CB_COLOR4_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -369,7 +371,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028D90_CB_COLOR5_PITCH}, {0, 0, R_028D94_CB_COLOR5_SLICE}, {0, 0, R_028D98_CB_COLOR5_VIEW}, - {0, 0, R_028D9C_CB_COLOR5_INFO}, + {1, 0, R_028D9C_CB_COLOR5_INFO}, {0, 0, R_028DA0_CB_COLOR5_ATTRIB}, {0, 0, R_028DA4_CB_COLOR5_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -377,7 +379,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028DCC_CB_COLOR6_PITCH}, {0, 0, R_028DD0_CB_COLOR6_SLICE}, {0, 0, R_028DD4_CB_COLOR6_VIEW}, - {0, 0, R_028DD8_CB_COLOR6_INFO}, + {1, 0, R_028DD8_CB_COLOR6_INFO}, {0, 0, R_028DDC_CB_COLOR6_ATTRIB}, {0, 0, R_028DE0_CB_COLOR6_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -385,7 +387,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E08_CB_COLOR7_PITCH}, {0, 0, R_028E0C_CB_COLOR7_SLICE}, {0, 0, R_028E10_CB_COLOR7_VIEW}, - {0, 0, R_028E14_CB_COLOR7_INFO}, + {1, 0, R_028E14_CB_COLOR7_INFO}, {0, 0, R_028E18_CB_COLOR7_ATTRIB}, {0, 0, R_028E1C_CB_COLOR7_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -393,7 +395,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E44_CB_COLOR8_PITCH}, {0, 0, R_028E48_CB_COLOR8_SLICE}, {0, 0, R_028E4C_CB_COLOR8_VIEW}, - {0, 0, R_028E50_CB_COLOR8_INFO}, + {1, 0, R_028E50_CB_COLOR8_INFO}, {0, 0, R_028E54_CB_COLOR8_ATTRIB}, {0, 0, R_028E58_CB_COLOR8_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -401,7 +403,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E60_CB_COLOR9_PITCH}, {0, 0, R_028E64_CB_COLOR9_SLICE}, {0, 0, R_028E68_CB_COLOR9_VIEW}, - {0, 0, R_028E6C_CB_COLOR9_INFO}, + {1, 0, R_028E6C_CB_COLOR9_INFO}, {0, 0, R_028E70_CB_COLOR9_ATTRIB}, {0, 0, R_028E74_CB_COLOR9_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -409,7 +411,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E7C_CB_COLOR10_PITCH}, {0, 0, R_028E80_CB_COLOR10_SLICE}, {0, 0, R_028E84_CB_COLOR10_VIEW}, - {0, 0, R_028E88_CB_COLOR10_INFO}, + {1, 0, R_028E88_CB_COLOR10_INFO}, {0, 0, R_028E8C_CB_COLOR10_ATTRIB}, {0, 0, R_028E90_CB_COLOR10_DIM}, {0, 0, GROUP_FORCE_NEW_BLOCK}, @@ -417,7 +419,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_028E98_CB_COLOR11_PITCH}, {0, 0, R_028E9C_CB_COLOR11_SLICE}, {0, 0, R_028EA0_CB_COLOR11_VIEW}, - {0, 0, R_028EA4_CB_COLOR11_INFO}, + {1, 0, R_028EA4_CB_COLOR11_INFO}, {0, 0, R_028EA8_CB_COLOR11_ATTRIB}, {0, 0, R_028EAC_CB_COLOR11_DIM}, }; diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index c29616c9cbc..edd1d13a7bb 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -986,7 +986,7 @@ void r600_context_flush(struct r600_context *ctx) /* suspend queries */ r600_context_queries_suspend(ctx); -#if 0 +#if 1 /* emit cs */ drmib.num_chunks = 2; drmib.chunks = (uint64_t)(uintptr_t)chunk_array; -- cgit v1.2.3 From 49111213e483e4f7830f77f53fc4331a57a296e3 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 16:09:05 -0400 Subject: r600g: fix reg definition Doesn't bother fixing old path code, just disable that reg. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreend.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 2359c783838..0a0a91eea2a 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1410,7 +1410,9 @@ #define R_028000_DB_RENDER_CONTROL 0x00028000 #define S_028000_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5) #define S_028000_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6) -#define S_028000_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15) +#define R_028004_DB_COUNT_CONTROL 0x00028004 +#define S_028004_ZPASS_INCREMENT_DISABLE (((x) & 0x1) << 0) +#define S_028004_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 1) #define R_028008_DB_DEPTH_VIEW 0x00028008 #define R_02800C_DB_RENDER_OVERRIDE 0x0002800C #define V_02800C_FORCE_OFF 0 -- cgit v1.2.3 From 3ad4486bfeea0d38f0789431e5e8fc1e6579e3aa Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 16:17:28 -0400 Subject: r600g: fix evergreen new path glxgears seems to work, had somelockup but now they seems to have vanish. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/eg_hw_states.c | 2 +- src/gallium/drivers/r600/evergreen_state.c | 12 +++++------- src/gallium/winsys/r600/drm/evergreen_state.c | 13 ++++++++++--- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index f37208f362c..d545db26295 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -432,7 +432,7 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) if (query_running) { db_render_override |= S_02800C_NOOP_CULL_DISABLE(1); - db_render_control |= S_028000_PERFECT_ZPASS_COUNTS(1); +// db_render_control |= S_028000_PERFECT_ZPASS_COUNTS(1); } rstate->states[EG_DSA__DB_STENCIL_CLEAR] = 0x00000000; diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 15588fed936..3170ec773ed 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -818,12 +818,11 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028050_DB_Z_WRITE_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028014_DB_HTILE_DATA_BASE, - state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); +// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028040_DB_Z_INFO, S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format), - 0xFFFFFFFF, NULL); + 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028058_DB_DEPTH_SIZE, S_028058_PITCH_TILE_MAX(pitch), 0xFFFFFFFF, NULL); @@ -1252,9 +1251,9 @@ void evergreen_init_config2(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); +// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); +// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL); @@ -1424,8 +1423,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.start, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); -// r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, info->max_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, 0x0000FFFF, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, info->max_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, 0x00000000, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, &vgt); diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index 96e2105cd18..f2038638d6b 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -85,12 +85,19 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_02802C_DB_DEPTH_CLEAR}, {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL}, {0, 0, R_028034_PA_SC_SCREEN_SCISSOR_BR}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028040_DB_Z_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {0, 0, R_028044_DB_STENCIL_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028048_DB_Z_READ_BASE}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_02804C_DB_STENCIL_READ_BASE}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028050_DB_Z_WRITE_BASE}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028054_DB_STENCIL_WRITE_BASE}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {0, 0, R_028058_DB_DEPTH_SIZE}, {0, 0, R_02805C_DB_DEPTH_SLICE}, {0, 0, R_028140_ALU_CONST_BUFFER_SIZE_PS_0}, @@ -261,14 +268,14 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_02881C_PA_CL_VS_OUT_CNTL}, {0, 0, R_028820_PA_CL_NANINF_CNTL}, {0, 0, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1}, - {1, 0, R_028840_SQ_PGM_START_PS}, + {1, S_0085F0_SH_ACTION_ENA(1), R_028840_SQ_PGM_START_PS}, {0, 0, R_028844_SQ_PGM_RESOURCES_PS}, {0, 0, R_028848_SQ_PGM_RESOURCES_2_PS}, {0, 0, R_02884C_SQ_PGM_EXPORTS_PS}, - {1, 0, R_02885C_SQ_PGM_START_VS}, + {1, S_0085F0_SH_ACTION_ENA(1), R_02885C_SQ_PGM_START_VS}, {0, 0, R_028860_SQ_PGM_RESOURCES_VS}, {0, 0, R_028864_SQ_PGM_RESOURCES_2_VS}, - {1, 0, R_0288A4_SQ_PGM_START_FS}, + {1, S_0085F0_SH_ACTION_ENA(1), R_0288A4_SQ_PGM_START_FS}, {0, 0, R_0288A8_SQ_PGM_RESOURCES_FS}, {0, 0, R_0288EC_SQ_LDS_ALLOC_PS}, {0, 0, R_028900_SQ_ESGS_RING_ITEMSIZE}, -- cgit v1.2.3 From 6613605d79bc84043e74c7eefe8025c2c7c4978b Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 17:33:30 -0400 Subject: r600g: bring over fix from old path to new path Up to 2010-09-19: r600g: fix tiling support for ddx supplied buffers 9b146eae2521d8e5f6d3cbefa4f6f7737666313a user buffer seems to be broken... new to fix that. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 30 ++++-- src/gallium/drivers/r600/r600_pipe.h | 13 +++ src/gallium/drivers/r600/r600_state2.c | 154 +++++++++++++++++++++++++---- src/gallium/winsys/r600/drm/r600_state2.c | 49 +++++++-- 4 files changed, 212 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3170ec773ed..4b7c251e5e9 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1342,20 +1342,36 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) assert(info->index_bias == 0); + memset(&draw, 0, sizeof(struct r600_drawl)); draw.mode = info->mode; draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.min_index = info->min_index; + draw.max_index = info->max_index; + draw.index_bias = info->index_bias; + + r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer, + &rctx->index_buffer.index_size, + &draw.start, + info->count); + draw.index_size = rctx->index_buffer.index_size; draw.index_buffer = rctx->index_buffer.buffer; - assert(rctx->index_buffer.offset % - rctx->index_buffer.index_size == 0); - draw.start += rctx->index_buffer.offset / - rctx->index_buffer.index_size; + draw.index_buffer_offset = draw.start * draw.index_size; + draw.start = 0; + r600_upload_index_buffer2(rctx, &draw); } else { draw.index_size = 0; draw.index_buffer = NULL; + draw.min_index = info->min_index; + draw.max_index = info->max_index; + draw.index_bias = info->start; } + + /* flush upload buffers */ + r600_upload_user_buffers2(rctx); + switch (draw.index_size) { case 2: vgt_draw_initiator = 0; @@ -1421,10 +1437,10 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) vgt.id = R600_PIPE_STATE_VGT; vgt.nregs = 0; r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.start, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.index_bias, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, info->max_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, &vgt); rdraw.vgt_num_indices = draw.count; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index c64ca404905..e05a14f4e93 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -111,14 +111,21 @@ struct r600_pipe_context { /* shader information */ unsigned sprite_coord_enable; bool flatshade; + struct u_upload_mgr *upload_vb; + struct u_upload_mgr *upload_ib; + enum radeon_family family; }; struct r600_drawl { struct pipe_context *ctx; unsigned mode; + unsigned min_index; + unsigned max_index; + unsigned index_bias; unsigned start; unsigned count; unsigned index_size; + unsigned index_buffer_offset; struct pipe_resource *index_buffer; }; @@ -129,6 +136,12 @@ uint32_t r600_translate_texformat(enum pipe_format format, /* r600_state2.c */ int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader); int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); +int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl *draw); +int r600_upload_user_buffers2(struct r600_pipe_context *rctx); +void r600_translate_index_buffer2(struct r600_pipe_context *r600, + struct pipe_resource **index_buffer, + unsigned *index_size, + unsigned *start, unsigned count); /* evergreen_state.c */ void evergreen_init_state_functions2(struct r600_pipe_context *rctx); diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 2c55f073f07..482ec0de81c 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include "r600.h" #include "r600d.h" @@ -108,7 +110,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade struct r600_pipe_state *rstate = &shader->rstate; struct r600_shader *rshader = &shader->shader; unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z; - boolean have_pos = FALSE; + boolean have_pos = FALSE, have_face = FALSE; /* clear previous register */ rstate->nregs = 0; @@ -123,6 +125,8 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade rshader->input[i].name == TGSI_SEMANTIC_POSITION) { tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); } + if (rshader->input[i].name == TGSI_SEMANTIC_FACE) + have_face = TRUE; if (rctx->sprite_coord_enable & (1 << i)) { tmp |= S_028644_PT_SPRITE_TEX(1); } @@ -153,7 +157,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade spi_input_z |= 1; } r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028840_SQ_PGM_START_PS, @@ -459,6 +463,8 @@ static void r600_draw_common(struct r600_drawl *draw) struct r600_draw rdraw; struct r600_pipe_state vgt; + /* flush upload buffers */ + r600_upload_user_buffers2(rctx); switch (draw->index_size) { case 2: @@ -518,7 +524,9 @@ static void r600_draw_common(struct r600_drawl *draw) vgt.id = R600_PIPE_STATE_VGT; vgt.nregs = 0; r600_pipe_state_add_reg(&vgt, R600_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw->start, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, &vgt); @@ -535,6 +543,30 @@ static void r600_draw_common(struct r600_drawl *draw) r600_context_draw(&rctx->ctx, &rdraw); } +void r600_translate_index_buffer2(struct r600_pipe_context *r600, + struct pipe_resource **index_buffer, + unsigned *index_size, + unsigned *start, unsigned count) +{ + switch (*index_size) { + case 1: + util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count); + *index_size = 2; + *start = 0; + break; + + case 2: + if (*start % 2 != 0) { + util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count); + *start = 0; + } + break; + + case 4: + break; + } +} + static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; @@ -542,20 +574,32 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info assert(info->index_bias == 0); + memset(&draw, 0, sizeof(struct r600_drawl)); draw.ctx = ctx; draw.mode = info->mode; draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.min_index = info->min_index; + draw.max_index = info->max_index; + draw.index_bias = info->index_bias; + + r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer, + &rctx->index_buffer.index_size, + &draw.start, + info->count); + draw.index_size = rctx->index_buffer.index_size; draw.index_buffer = rctx->index_buffer.buffer; - assert(rctx->index_buffer.offset % - rctx->index_buffer.index_size == 0); - draw.start += rctx->index_buffer.offset / - rctx->index_buffer.index_size; + draw.index_buffer_offset = draw.start * draw.index_size; + draw.start = 0; + r600_upload_index_buffer2(rctx, &draw); } else { draw.index_size = 0; draw.index_buffer = NULL; + draw.min_index = info->min_index; + draw.max_index = info->max_index; + draw.index_bias = info->start; } r600_draw_common(&draw); } @@ -572,6 +616,9 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, if (!rctx->ctx.pm4_cdwords) return; + u_upload_flush(rctx->upload_vb); + u_upload_flush(rctx->upload_ib); + #if 0 sprintf(dname, "gallium-%08d.bof", dc); if (dc < 20) { @@ -591,6 +638,10 @@ static void r600_destroy_context(struct pipe_context *context) for (int i = 0; i < R600_PIPE_NSTATES; i++) { free(rctx->states[i]); } + + u_upload_destroy(rctx->upload_vb); + u_upload_destroy(rctx->upload_ib); + FREE(rctx); } @@ -1319,9 +1370,11 @@ static void r600_set_scissor_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, - R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, - 0xFFFFFFFF, NULL); + if (rctx->family >= CHIP_RV770) { + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, + 0xFFFFFFFF, NULL); + } free(rctx->states[R600_PIPE_STATE_SCISSOR]); rctx->states[R600_PIPE_STATE_SCISSOR] = rstate; @@ -1418,7 +1471,7 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0280A0_CB_COLOR0_INFO + cb * 4, - color_info, 0xFFFFFFFF, NULL); + color_info, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028060_CB_COLOR0_SIZE + cb * 4, S_028060_PITCH_TILE_MAX(pitch) | @@ -1469,7 +1522,7 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028010_DB_DEPTH_INFO, S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format), - 0xFFFFFFFF, NULL); + 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D34_DB_PREFETCH_LIMIT, (state->zsbuf->height / 8) - 1, 0xFFFFFFFF, NULL); } @@ -1966,8 +2019,6 @@ static void r600_init_config2(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, 0x00FFFFFF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL); @@ -2045,6 +2096,7 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi /* Easy accessing of screen/winsys. */ rctx->screen = rscreen; rctx->radeon = rscreen->radeon; + rctx->family = r600_get_family(rctx->radeon); r600_init_blit_functions2(rctx); r600_init_query_functions2(rctx); @@ -2090,6 +2142,20 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi return NULL; } + rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16, + PIPE_BIND_INDEX_BUFFER); + if (rctx->upload_ib == NULL) { + r600_destroy_context(&rctx->context); + return NULL; + } + + rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16, + PIPE_BIND_VERTEX_BUFFER); + if (rctx->upload_vb == NULL) { + r600_destroy_context(&rctx->context); + return NULL; + } + rctx->blitter = util_blitter_create(&rctx->context); if (rctx->blitter == NULL) { FREE(rctx); @@ -2139,8 +2205,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e case PIPE_SHADER_CAP_MAX_PREDS: return 0; /* FIXME */ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: - /* TODO: support this! */ - return 0; + return 1; default: return 0; } @@ -2202,7 +2267,62 @@ struct pipe_screen *r600_screen_create2(struct radeon *radeon) rscreen->screen.context_create = r600_create_context2; r600_init_screen_texture_functions(&rscreen->screen); r600_init_screen_resource_functions(&rscreen->screen); - rscreen->screen.user_buffer_create = r600_user_buffer_create2; +// rscreen->screen.user_buffer_create = r600_user_buffer_create2; return &rscreen->screen; } + +int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl *draw) +{ + struct pipe_resource *upload_buffer = NULL; + unsigned index_offset = draw->index_buffer_offset; + int ret = 0; + + if (r600_buffer_is_user_buffer(draw->index_buffer)) { + ret = u_upload_buffer(rctx->upload_ib, + index_offset, + draw->count * draw->index_size, + draw->index_buffer, + &index_offset, + &upload_buffer); + if (ret) { + goto done; + } + draw->index_buffer_offset = index_offset; + draw->index_buffer = upload_buffer; + } + +done: + return ret; +} + +int r600_upload_user_buffers2(struct r600_pipe_context *rctx) +{ + enum pipe_error ret = PIPE_OK; + int i, nr; + + nr = rctx->vertex_elements->count; + + for (i = 0; i < nr; i++) { + struct pipe_vertex_buffer *vb = + &rctx->vertex_buffer[rctx->vertex_elements->elements[i].vertex_buffer_index]; + + if (r600_buffer_is_user_buffer(vb->buffer)) { + struct pipe_resource *upload_buffer = NULL; + unsigned offset = 0; /*vb->buffer_offset * 4;*/ + unsigned size = vb->buffer->width0; + unsigned upload_offset; + ret = u_upload_buffer(rctx->upload_vb, + offset, size, + vb->buffer, + &upload_offset, &upload_buffer); + if (ret) + return ret; + + pipe_resource_reference(&vb->buffer, NULL); + vb->buffer = upload_buffer; + vb->buffer_offset = upload_offset; + } + } + return ret; +} diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index edd1d13a7bb..e1f32da91b0 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -68,7 +68,7 @@ static void r600_context_queries_resume(struct r600_context *ctx); static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offset) { for (int i = 0; i < ctx->ngroups; i++) { - if (offset >= ctx->groups[i].start_offset && offset <= ctx->groups[i].end_offset) { + if (offset >= ctx->groups[i].start_offset && offset < ctx->groups[i].end_offset) { return i; } } @@ -211,57 +211,85 @@ static const struct r600_reg r600_reg_list[] = { {0, 0, R_028B20_VGT_STRMOUT_BUFFER_EN}, {0, 0, R_028028_DB_STENCIL_CLEAR}, {0, 0, R_02802C_DB_DEPTH_CLEAR}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028040_CB_COLOR0_BASE}, - {0, 0, R_0280A0_CB_COLOR0_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280A0_CB_COLOR0_INFO}, {0, 0, R_028060_CB_COLOR0_SIZE}, {0, 0, R_028080_CB_COLOR0_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280E0_CB_COLOR0_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280C0_CB_COLOR0_TILE}, {0, 0, R_028100_CB_COLOR0_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028044_CB_COLOR1_BASE}, - {0, 0, R_0280A4_CB_COLOR1_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280A4_CB_COLOR1_INFO}, {0, 0, R_028064_CB_COLOR1_SIZE}, {0, 0, R_028084_CB_COLOR1_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280E4_CB_COLOR1_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280C4_CB_COLOR1_TILE}, {0, 0, R_028104_CB_COLOR1_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028048_CB_COLOR2_BASE}, - {0, 0, R_0280A8_CB_COLOR2_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280A8_CB_COLOR2_INFO}, {0, 0, R_028068_CB_COLOR2_SIZE}, {0, 0, R_028088_CB_COLOR2_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280E8_CB_COLOR2_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280C8_CB_COLOR2_TILE}, {0, 0, R_028108_CB_COLOR2_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_02804C_CB_COLOR3_BASE}, - {0, 0, R_0280AC_CB_COLOR3_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280AC_CB_COLOR3_INFO}, {0, 0, R_02806C_CB_COLOR3_SIZE}, {0, 0, R_02808C_CB_COLOR3_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280EC_CB_COLOR3_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280CC_CB_COLOR3_TILE}, {0, 0, R_02810C_CB_COLOR3_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028050_CB_COLOR4_BASE}, - {0, 0, R_0280B0_CB_COLOR4_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280B0_CB_COLOR4_INFO}, {0, 0, R_028070_CB_COLOR4_SIZE}, {0, 0, R_028090_CB_COLOR4_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280F0_CB_COLOR4_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280D0_CB_COLOR4_TILE}, {0, 0, R_028110_CB_COLOR4_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_028054_CB_COLOR5_BASE}, - {0, 0, R_0280B4_CB_COLOR5_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280B4_CB_COLOR5_INFO}, {0, 0, R_028074_CB_COLOR5_SIZE}, {0, 0, R_028094_CB_COLOR5_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280F4_CB_COLOR5_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280D4_CB_COLOR5_TILE}, {0, 0, R_028114_CB_COLOR5_MASK}, {1, 0, R_028058_CB_COLOR6_BASE}, - {0, 0, R_0280B8_CB_COLOR6_INFO}, + {1, 0, R_0280B8_CB_COLOR6_INFO}, {0, 0, R_028078_CB_COLOR6_SIZE}, {0, 0, R_028098_CB_COLOR6_VIEW}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280F8_CB_COLOR6_FRAG}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_0280D8_CB_COLOR6_TILE}, {0, 0, R_028118_CB_COLOR6_MASK}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, {1, 0, R_02805C_CB_COLOR7_BASE}, - {0, 0, R_0280BC_CB_COLOR7_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_0280BC_CB_COLOR7_INFO}, {0, 0, R_02807C_CB_COLOR7_SIZE}, {0, 0, R_02809C_CB_COLOR7_VIEW}, {1, 0, R_0280FC_CB_COLOR7_FRAG}, @@ -313,7 +341,8 @@ static const struct r600_reg r600_reg_list[] = { {1, 0, R_02800C_DB_DEPTH_BASE}, {0, 0, R_028000_DB_DEPTH_SIZE}, {0, 0, R_028004_DB_DEPTH_VIEW}, - {0, 0, R_028010_DB_DEPTH_INFO}, + {0, 0, GROUP_FORCE_NEW_BLOCK}, + {1, 0, R_028010_DB_DEPTH_INFO}, {0, 0, R_028D0C_DB_RENDER_CONTROL}, {0, 0, R_028D10_DB_RENDER_OVERRIDE}, {0, 0, R_028D24_DB_HTILE_SURFACE}, -- cgit v1.2.3 From 836803df794be7a2ae3be0fc047e882d49ab22bb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 11:20:16 -0700 Subject: intel: Corresponding FinishRenderTexture debug to BeginRenderTexture. --- src/mesa/drivers/dri/intel/intel_fbo.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 363a5c02425..4ad85eb7c1a 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -598,6 +598,10 @@ intel_finish_render_texture(GLcontext * ctx, struct gl_texture_image *image = tex_obj->Image[att->CubeMapFace][att->TextureLevel]; struct intel_texture_image *intel_image = intel_texture_image(image); + struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer); + + DBG("Finish render texture tid %lx tex=%u refcount=%d\n", + _glthread_GetID(), att->Texture->Name, irb->Base.RefCount); /* Flag that this image may now be validated into the object's miptree. */ intel_image->used_as_render_target = GL_FALSE; -- cgit v1.2.3 From 1946b81e700fbb266294b8c1cb0d29ced84bf647 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 16:11:40 -0700 Subject: i965: Add support for rendering to SARGB8 FBOs. Tested with fbo-generatemipmap-formats GL_EXT_texture_srgb. The test still fails on SLA8, though. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 +++ src/mesa/drivers/dri/intel/intel_fbo.c | 5 +++++ src/mesa/drivers/dri/intel/intel_span.c | 1 + 3 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 17b016b569b..05f1aa18137 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -429,6 +429,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw, case MESA_FORMAT_XRGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; + case MESA_FORMAT_SARGB8: + key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB; + break; case MESA_FORMAT_RGB565: key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; break; diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 4ad85eb7c1a..64c94b9b556 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -433,6 +433,10 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to XGBA8 texture OK\n"); } + else if (texImage->TexFormat == MESA_FORMAT_SARGB8) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to SARGB8 texture OK\n"); + } else if (texImage->TexFormat == MESA_FORMAT_RGB565) { irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); @@ -659,6 +663,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_SARGB8: case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB1555: case MESA_FORMAT_ARGB4444: diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index fb840c1020d..c8d55c92a0b 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -366,6 +366,7 @@ intel_set_span_functions(struct intel_context *intel, intel_InitPointers_xRGB8888(rb); break; case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_SARGB8: intel_InitPointers_ARGB8888(rb); break; case MESA_FORMAT_Z16: -- cgit v1.2.3 From 861949579049f70c2ec039fe67d772ed435f55ba Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 23 Sep 2010 22:54:08 +0200 Subject: util: fix util_pack_color for B4G4R4A4 NOTE: This is a candidate for the 7.9 branch. --- src/gallium/auxiliary/util/u_pack_color.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index aae8b8bdf18..c90b0fdbc3f 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -394,7 +394,7 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color * return; case PIPE_FORMAT_B4G4R4A4_UNORM: { - uc->ub = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4); + uc->us = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4); } return; case PIPE_FORMAT_A8_UNORM: -- cgit v1.2.3 From 934fde4f5a63ff7c3c29c21e9e67cce3c2564788 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 16:22:08 -0700 Subject: intel: Fix segfault on INTEL_DEBUG=fbo with unsupported framebuffers. --- src/mesa/drivers/dri/intel/intel_fbo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 64c94b9b556..984585027c1 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -602,10 +602,9 @@ intel_finish_render_texture(GLcontext * ctx, struct gl_texture_image *image = tex_obj->Image[att->CubeMapFace][att->TextureLevel]; struct intel_texture_image *intel_image = intel_texture_image(image); - struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer); - DBG("Finish render texture tid %lx tex=%u refcount=%d\n", - _glthread_GetID(), att->Texture->Name, irb->Base.RefCount); + DBG("Finish render texture tid %lx tex=%u\n", + _glthread_GetID(), att->Texture->Name); /* Flag that this image may now be validated into the object's miptree. */ intel_image->used_as_render_target = GL_FALSE; -- cgit v1.2.3 From 2e3d22b0746dad2cc64873f336367ca4949d0123 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 18:00:42 -0700 Subject: intel: Add fallback debug to glGenerateMipmap. --- src/mesa/drivers/dri/intel/intel_tex.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 4537f589111..49b7d5ef6b1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -157,6 +157,10 @@ intelGenerateMipmap(GLcontext *ctx, GLenum target, /* sw path: need to map texture images */ struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); + + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); _mesa_generate_mipmap(ctx, target, texObj); intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); -- cgit v1.2.3 From 86ad797be4b9b2768f1c28bb5ac3ae6f9a41794a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 18:19:08 -0700 Subject: intel: More reverting of the sw fallback for depth texture border color. The rest was done with 9aec1288eeae8e87adc9a99f377be536892941b2 --- src/mesa/drivers/dri/intel/intel_tex_image.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 4732efd7d79..03aba58e107 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -73,10 +73,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, DBG("%s\n", __FUNCTION__); - if (intelImage->base.Border || - ((intelImage->base._BaseFormat == GL_DEPTH_COMPONENT) && - ((intelObj->base.WrapS == GL_CLAMP_TO_BORDER) || - (intelObj->base.WrapT == GL_CLAMP_TO_BORDER)))) + if (intelImage->base.Border) return; if (intelImage->level > intelObj->base.BaseLevel && -- cgit v1.2.3 From b917691bc015ec4a148a67bf3a1cdca0248400a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 18:25:42 -0700 Subject: intel: Improve some of the miptree debugging. --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index d316d34d690..9c4e5c5ee8c 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -333,7 +333,6 @@ intel_miptree_image_map(struct intel_context * intel, GLuint * row_stride, GLuint * image_offsets) { GLuint x, y; - DBG("%s \n", __FUNCTION__); if (row_stride) *row_stride = mt->region->pitch * mt->cpp; @@ -348,6 +347,8 @@ intel_miptree_image_map(struct intel_context * intel, image_offsets[i] = x + y * mt->region->pitch; } + DBG("%s \n", __FUNCTION__); + return intel_region_map(intel, mt->region); } else { assert(mt->level[level].depth == 1); @@ -355,6 +356,9 @@ intel_miptree_image_map(struct intel_context * intel, &x, &y); image_offsets[0] = 0; + DBG("%s: (%d,%d) -> (%d, %d)/%d\n", + __FUNCTION__, face, level, x, y, mt->region->pitch * mt->cpp); + return intel_region_map(intel, mt->region) + (x + y * mt->region->pitch) * mt->cpp; } @@ -385,7 +389,6 @@ intel_miptree_image_data(struct intel_context *intel, const GLuint depth = dst->level[level].depth; GLuint i; - DBG("%s: %d/%d\n", __FUNCTION__, face, level); for (i = 0; i < depth; i++) { GLuint dst_x, dst_y, height; @@ -395,6 +398,12 @@ intel_miptree_image_data(struct intel_context *intel, if(dst->compressed) height = (height + 3) / 4; + DBG("%s: %d/%d %p/%d -> (%d, %d)/%d (%d, %d)\n", + __FUNCTION__, face, level, + src, src_row_pitch * dst->cpp, + dst_x, dst_y, dst->region->pitch * dst->cpp, + dst->level[level].width, height); + intel_region_data(intel, dst->region, 0, dst_x, dst_y, src, -- cgit v1.2.3 From 1acadebd6270d3604b026842b8a21360968618a0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 24 Sep 2010 18:40:24 -0700 Subject: mesa: Fix type typo in glGenerateMipmap handling of GL_UNSIGNED_INT data. Fixes ARB_depth_texture/fbo-generatemipmap-formats. --- src/mesa/main/mipmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 678d17a2a36..f15c3b665be 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -415,7 +415,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, GLuint i, j, k; const GLuint *rowA = (const GLuint *) srcRowA; const GLuint *rowB = (const GLuint *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; + GLuint *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4); -- cgit v1.2.3 From 5c77b753162f284182b4162613822e78ede083fe Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 19:33:43 -0700 Subject: r300g: Silence uninitialized variable warning. Silence this GCC warning. r300_state_derived.c: In function 'r300_update_derived_state': r300_state_derived.c:578: warning: 'r' may be used uninitialized in this function r300_state_derived.c:578: note: 'r' was declared here --- src/gallium/drivers/r300/r300_state_derived.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 566a828871d..0c3fa200c82 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -630,6 +630,7 @@ static uint32_t r300_get_border_color(enum pipe_format format, ((float_to_ubyte(border_swizzled[2]) & 0xf8) << 8); } else { assert(0); + r = 0; } break; -- cgit v1.2.3 From ef1e1261df02203da4c7ebf708b0edf1b9cd16c2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 22:20:43 -0700 Subject: intel: Fix implicit declaration of function '_mesa_meta_Bitmap' warning. Fix this GCC warning. intel_pixel_bitmap.c: In function 'intelBitmap': intel_pixel_bitmap.c:343: warning: implicit declaration of function '_mesa_meta_Bitmap' --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 3ea1d48d7ca..6b62da20848 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -47,6 +47,7 @@ #include "main/viewport.h" #include "main/context.h" #include "swrast/swrast.h" +#include "drivers/common/meta.h" #include "intel_screen.h" #include "intel_context.h" -- cgit v1.2.3 From c510f8eeb425db281154cbfb915977226fa2e3ab Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 22:46:14 -0700 Subject: mesa: Remove unnecessary headers. --- src/mesa/main/context.c | 1 - src/mesa/main/convolve.c | 3 --- src/mesa/main/histogram.c | 2 -- 3 files changed, 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7d6bfaa62d1..00132514d77 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -86,7 +86,6 @@ #include "blend.h" #include "buffers.h" #include "bufferobj.h" -#include "colortab.h" #include "context.h" #include "cpuinfo.h" #include "debug.h" diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 301569e5f67..0231bcf6d3f 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -35,11 +35,8 @@ #include "bufferobj.h" #include "colormac.h" #include "convolve.h" -#include "context.h" -#include "image.h" #include "macros.h" #include "mtypes.h" -#include "state.h" #include "main/dispatch.h" diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index a14d93e5199..b98e3219c53 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -26,8 +26,6 @@ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" -#include "context.h" -#include "image.h" #include "histogram.h" #include "macros.h" #include "main/dispatch.h" -- cgit v1.2.3 From 80ac94af726e00a7b5e92d7f549caeb0b2d8b166 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 22:48:46 -0700 Subject: r600g: Remove unnecessary header. --- src/gallium/drivers/r600/r600_blit.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 0b22f037015..c30a7c187c9 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -32,7 +32,6 @@ #include "util/u_surface.h" #include "r600_screen.h" #include "r600_context.h" -#include "r600d.h" static void r600_blitter_save_states(struct pipe_context *ctx) { -- cgit v1.2.3 From f07ac801b9b5507b46a8e4d8884b822a24573213 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 22:53:40 -0700 Subject: unichrome: Remove unnecessary header. --- src/mesa/drivers/dri/unichrome/via_tex.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 9ae9466c97b..e55129c6dab 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -31,7 +31,6 @@ #include "main/mtypes.h" #include "main/enums.h" #include "main/formats.h" -#include "main/colortab.h" #include "main/context.h" #include "main/mipmap.h" #include "main/mm.h" -- cgit v1.2.3 From 365da88a7127e43eb9327552dda4921d1e8f885e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 22:55:04 -0700 Subject: intel: Remove unnecessary headers. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 10 ---------- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 11 ----------- 2 files changed, 21 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 6b62da20848..bd7707eeeba 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -26,7 +26,6 @@ **************************************************************************/ #include "main/glheader.h" -#include "main/arbprogram.h" #include "main/enums.h" #include "main/image.h" #include "main/colormac.h" @@ -34,17 +33,8 @@ #include "main/macros.h" #include "main/bufferobj.h" #include "main/polygon.h" -#include "main/pixelstore.h" -#include "main/polygon.h" #include "main/state.h" -#include "main/teximage.h" #include "main/texobj.h" -#include "main/texstate.h" -#include "main/texparam.h" -#include "main/varray.h" -#include "main/attrib.h" -#include "main/enable.h" -#include "main/viewport.h" #include "main/context.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index b5576a9c917..470c4b9326b 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -30,24 +30,13 @@ #include "main/image.h" #include "main/mtypes.h" #include "main/teximage.h" -#include "main/texenv.h" #include "main/texobj.h" #include "main/texstate.h" -#include "main/texparam.h" -#include "main/varray.h" -#include "main/attrib.h" -#include "main/enable.h" -#include "main/buffers.h" -#include "main/fbobject.h" -#include "main/depth.h" -#include "main/hash.h" -#include "main/blend.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" #include "intel_context.h" #include "intel_pixel.h" -#include "intel_fbo.h" void intelDrawPixels(GLcontext * ctx, -- cgit v1.2.3 From 207481fa53e545e12cb11a3a8b0e64ff0416beeb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 22:59:46 -0700 Subject: r600g: Remove unused variable. Fixes this GCC warning. r600_buffer.c: In function 'r600_buffer_transfer_map': r600_buffer.c:141: warning: unused variable 'rctx' --- src/gallium/drivers/r600/r600_buffer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index ea370782fdb..1621b2ab63f 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -138,7 +138,6 @@ static void r600_buffer_destroy(struct pipe_screen *screen, static void *r600_buffer_transfer_map(struct pipe_context *pipe, struct pipe_transfer *transfer) { - struct r600_context *rctx = r600_context(pipe); struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource); struct r600_screen *rscreen = r600_screen(pipe->screen); int write = 0; -- cgit v1.2.3 From 68fdd5f0d9d66f3b9c103a5ec0674a5f8e4c93d7 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 23:08:08 -0700 Subject: r600g: Disable unused variables. The variables are only used in currently disabled code. Fixes this GCC warning. r600_state2.c: In function 'r600_flush2': r600_state2.c:613: warning: unused variable 'dname' r600_state2.c:612: warning: unused variable 'dc' --- src/gallium/drivers/r600/r600_state2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 482ec0de81c..40038f0732e 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -608,7 +608,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; -#if 1 +#if 0 static int dc = 0; char dname[256]; #endif -- cgit v1.2.3 From 95cb6d30ae442614acd3cf1bee3c19517abb6d63 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 23:17:55 -0700 Subject: r600g: Remove unused variable. Fixes this GCC warning. eg_hw_states.c: In function 'eg_resource': eg_hw_states.c:525: warning: unused variable 'r' --- src/gallium/drivers/r600/eg_hw_states.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index d545db26295..7ba53fefb5d 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -522,7 +522,6 @@ static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate, unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4]; - int r; rstate->cpm4 = 0; swizzle[0] = view->swizzle_r; -- cgit v1.2.3 From 53e6eb8dbeedce5699bd43049d5dc1dde9d8855e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 24 Sep 2010 23:48:05 -0700 Subject: r600g: Silence 'control reaches end of non-void function' warning. Fixes this GCC warning. r600_hw_states.c: In function 'r600_translate_fill': r600_state_inlines.h:136: warning: control reaches end of non-void function --- src/gallium/drivers/r600/r600_state_inlines.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index a9e7619bf35..81ce1bb1900 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -132,6 +132,9 @@ static INLINE uint32_t r600_translate_fill(uint32_t func) return 1; case PIPE_POLYGON_MODE_POINT: return 0; + default: + assert(0); + return 0; } } -- cgit v1.2.3 From 865cf775030beac3147547537a1a5372485127de Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 25 Sep 2010 18:51:24 +1000 Subject: mesa/mipmap: fix warning since 1acadebd6270d3604b026842b8a21360968618a0 1acadebd6270d3604b026842b8a21360968618a0 fixed the pointer but not the cast. --- src/mesa/main/mipmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index f15c3b665be..3d1a4c49c49 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -415,7 +415,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, GLuint i, j, k; const GLuint *rowA = (const GLuint *) srcRowA; const GLuint *rowB = (const GLuint *) srcRowB; - GLuint *dst = (GLfloat *) dstRow; + GLuint *dst = (GLuint *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4); -- cgit v1.2.3 From 16a457bba6909d0c34036277eb3a56f27f425c3d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 25 Sep 2010 19:16:36 +1000 Subject: r600g: add eg poly mode code. --- src/gallium/drivers/r600/eg_hw_states.c | 9 ++++++++- src/gallium/drivers/r600/eg_state_inlines.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 7ba53fefb5d..998d74bd3eb 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -200,6 +200,7 @@ static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate unsigned offset_db_fmt_cntl = 0; unsigned tmp; unsigned prov_vtx = 1; + unsigned polygon_dual_mode; if (rctx->clip) clip = &rctx->clip->state.clip; @@ -254,6 +255,9 @@ static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp); rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); } + polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || + state->fill_back != PIPE_POLYGON_MODE_FILL); + rstate->states[EG_RASTERIZER__PA_SU_SC_MODE_CNTL] = S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | @@ -261,7 +265,10 @@ static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate S_028814_FACE(!state->front_ccw) | S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri); + S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | + S_028814_POLY_MODE(polygon_dual_mode) | + S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | + S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)); rstate->states[EG_RASTERIZER__PA_CL_VS_OUT_CNTL] = S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex); diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 251e64a67a0..497865a66dd 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -123,6 +123,21 @@ static INLINE uint32_t r600_translate_stencil_op(int s_op) return 0; } +static INLINE uint32_t r600_translate_fill(uint32_t func) +{ + switch(func) { + case PIPE_POLYGON_MODE_FILL: + return 2; + case PIPE_POLYGON_MODE_LINE: + return 1; + case PIPE_POLYGON_MODE_POINT: + return 0; + default: + assert(0); + return 0; + } +} + /* translates straight */ static INLINE uint32_t r600_translate_ds_func(int func) { -- cgit v1.2.3 From 26dc60d0a32f3e5b8084fda5991b762a721662e8 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 22 Sep 2010 17:59:00 +0200 Subject: gallivm: fix copy&paste bug looks like pot_depth should be used, not pot_height (found by accident, not verified) --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index db2a6a0b22b..e3e8548d93b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -605,7 +605,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, if (dims == 3) { z = lp_build_sample_wrap_nearest(bld, r, depth_vec, - bld->static_state->pot_height, + bld->static_state->pot_depth, bld->static_state->wrap_r); lp_build_name(z, "tex.z.wrapped"); } -- cgit v1.2.3 From 46d05d4ef99857e50d978247917f3e16574418f4 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 24 Sep 2010 15:02:24 +0200 Subject: gallivm: don't use URem/UDiv when calculating offsets for blocks While it's true that llvm can and will indeed replace this with bit arithmetic (since block height/width is POT), it does so (llvm 2.7) by element and hence extracts/shifts/reinserts each element individually. This costs about 16 instructions (and extract is not really fast) vs. 1... --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 19e380a8dce..44f44ff1aa4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -655,11 +655,21 @@ lp_build_sample_partial_offset(struct lp_build_context *bld, * Pixel blocks have power of two dimensions. LLVM should convert the * rem/div to bit arithmetic. * TODO: Verify this. + * It does indeed BUT it does transform it to scalar (and back) when doing so + * (using roughly extract, shift/and, mov, unpack) (llvm 2.7). + * The generated code looks seriously unfunny and is quite expensive. */ - +#if 0 LLVMValueRef block_width = lp_build_const_int_vec(bld->type, block_length); subcoord = LLVMBuildURem(bld->builder, coord, block_width, ""); coord = LLVMBuildUDiv(bld->builder, coord, block_width, ""); +#else + unsigned logbase2 = util_unsigned_logbase2(block_length); + LLVMValueRef block_shift = lp_build_const_int_vec(bld->type, logbase2); + LLVMValueRef block_mask = lp_build_const_int_vec(bld->type, block_length - 1); + subcoord = LLVMBuildAnd(bld->builder, coord, block_mask, ""); + coord = LLVMBuildLShr(bld->builder, coord, block_shift, ""); +#endif } offset = lp_build_mul(bld, coord, stride); -- cgit v1.2.3 From 049a8cce76b1148ab00de1ae207171e519bfafca Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 24 Sep 2010 15:17:07 +0200 Subject: gallivm: optimize yuv decoding this is more a proof to show vector shifts on x86 with per-element shift count are evil. Since we can avoid the shift with a single compare/select, use that instead. Replaces more than 20 instructions (and slow ones at that) with about 3, and cuts compiled shader size with mesa's yuvsqure demo by over 10% (no performance measurements done - but selection is blazing fast). Might want to revisit that for future cpus - unfortunately AVX won't have vector shifts neither, but AMD's XOP will, but even in that case using selection here is probably not slower. --- src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c | 64 +++++++++++++++++++---- 1 file changed, 55 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c index 0a5038bc988..2bce2895551 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c @@ -35,6 +35,7 @@ #include "util/u_format.h" +#include "util/u_cpu_detect.h" #include "lp_bld_arit.h" #include "lp_bld_type.h" @@ -42,7 +43,7 @@ #include "lp_bld_conv.h" #include "lp_bld_gather.h" #include "lp_bld_format.h" - +#include "lp_bld_logic.h" /** * Extract Y, U, V channels from packed UYVY. @@ -59,7 +60,7 @@ uyvy_to_yuv_soa(LLVMBuilderRef builder, LLVMValueRef *v) { struct lp_type type; - LLVMValueRef shift, mask; + LLVMValueRef mask; memset(&type, 0, sizeof type); type.width = 32; @@ -69,14 +70,37 @@ uyvy_to_yuv_soa(LLVMBuilderRef builder, assert(lp_check_value(type, i)); /* - * y = (uyvy >> 16*i) & 0xff + * y = (uyvy >> (16*i + 8)) & 0xff * u = (uyvy ) & 0xff * v = (uyvy >> 16 ) & 0xff */ - shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(type, 16), ""); - shift = LLVMBuildAdd(builder, shift, lp_build_const_int_vec(type, 8), ""); - *y = LLVMBuildLShr(builder, packed, shift, ""); +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + /* + * Avoid shift with per-element count. + * No support on x86, gets translated to roughly 5 instructions + * per element. Didn't measure performance but cuts shader size + * by quite a bit (less difference if cpu has no sse4.1 support). + */ + if (util_cpu_caps.has_sse2 && n == 4) { + LLVMValueRef sel, tmp, tmp2; + struct lp_build_context bld32; + + lp_build_context_init(&bld32, builder, type); + + tmp = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 8), ""); + tmp2 = LLVMBuildLShr(builder, tmp, lp_build_const_int_vec(type, 16), ""); + sel = lp_build_compare(builder, type, PIPE_FUNC_EQUAL, i, lp_build_const_int_vec(type, 0)); + *y = lp_build_select(&bld32, sel, tmp, tmp2); + } else +#endif + { + LLVMValueRef shift; + shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(type, 16), ""); + shift = LLVMBuildAdd(builder, shift, lp_build_const_int_vec(type, 8), ""); + *y = LLVMBuildLShr(builder, packed, shift, ""); + } + *u = packed; *v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 16), ""); @@ -103,7 +127,7 @@ yuyv_to_yuv_soa(LLVMBuilderRef builder, LLVMValueRef *v) { struct lp_type type; - LLVMValueRef shift, mask; + LLVMValueRef mask; memset(&type, 0, sizeof type); type.width = 32; @@ -118,8 +142,30 @@ yuyv_to_yuv_soa(LLVMBuilderRef builder, * v = (yuyv >> 24 ) & 0xff */ - shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(type, 16), ""); - *y = LLVMBuildLShr(builder, packed, shift, ""); +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + /* + * Avoid shift with per-element count. + * No support on x86, gets translated to roughly 5 instructions + * per element. Didn't measure performance but cuts shader size + * by quite a bit (less difference if cpu has no sse4.1 support). + */ + if (util_cpu_caps.has_sse2 && n == 4) { + LLVMValueRef sel, tmp; + struct lp_build_context bld32; + + lp_build_context_init(&bld32, builder, type); + + tmp = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 16), ""); + sel = lp_build_compare(builder, type, PIPE_FUNC_EQUAL, i, lp_build_const_int_vec(type, 0)); + *y = lp_build_select(&bld32, sel, packed, tmp); + } else +#endif + { + LLVMValueRef shift; + shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(type, 16), ""); + *y = LLVMBuildLShr(builder, packed, shift, ""); + } + *u = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 8), ""); *v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 24), ""); -- cgit v1.2.3 From 998cf11e1387b3b0f774426eb7b52abfebbb20d3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 25 Sep 2010 11:41:30 +0100 Subject: draw: Fullfil the new min_lod/max_lod/lod_bias/border_color dynamic state --- src/gallium/auxiliary/draw/draw_llvm.c | 17 +++++++++++++++++ src/gallium/auxiliary/draw/draw_llvm.h | 8 ++++++++ src/gallium/auxiliary/draw/draw_llvm_sample.c | 8 ++++++++ 3 files changed, 33 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 8759c38cabb..5154c1f3c5f 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -77,6 +77,11 @@ init_globals(struct draw_llvm *llvm) elem_types[DRAW_JIT_TEXTURE_DATA] = LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0), DRAW_MAX_TEXTURE_LEVELS); + elem_types[DRAW_JIT_TEXTURE_MIN_LOD] = LLVMFloatType(); + elem_types[DRAW_JIT_TEXTURE_MAX_LOD] = LLVMFloatType(); + elem_types[DRAW_JIT_TEXTURE_LOD_BIAS] = LLVMFloatType(); + elem_types[DRAW_JIT_TEXTURE_BORDER_COLOR] = + LLVMArrayType(LLVMFloatType(), 4); texture_type = LLVMStructType(elem_types, Elements(elem_types), 0); @@ -101,6 +106,18 @@ init_globals(struct draw_llvm *llvm) LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, data, llvm->target, texture_type, DRAW_JIT_TEXTURE_DATA); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, min_lod, + llvm->target, texture_type, + DRAW_JIT_TEXTURE_MIN_LOD); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, max_lod, + llvm->target, texture_type, + DRAW_JIT_TEXTURE_MAX_LOD); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, lod_bias, + llvm->target, texture_type, + DRAW_JIT_TEXTURE_LOD_BIAS); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, border_color, + llvm->target, texture_type, + DRAW_JIT_TEXTURE_BORDER_COLOR); LP_CHECK_STRUCT_SIZE(struct draw_jit_texture, llvm->target, texture_type); diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 6196b2f983f..b881ef6113b 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -55,6 +55,10 @@ struct draw_jit_texture uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS]; uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS]; const void *data[DRAW_MAX_TEXTURE_LEVELS]; + float min_lod; + float max_lod; + float lod_bias; + float border_color[4]; }; enum { @@ -65,6 +69,10 @@ enum { DRAW_JIT_TEXTURE_ROW_STRIDE, DRAW_JIT_TEXTURE_IMG_STRIDE, DRAW_JIT_TEXTURE_DATA, + DRAW_JIT_TEXTURE_MIN_LOD, + DRAW_JIT_TEXTURE_MAX_LOD, + DRAW_JIT_TEXTURE_LOD_BIAS, + DRAW_JIT_TEXTURE_BORDER_COLOR, DRAW_JIT_TEXTURE_NUM_FIELDS /* number of fields above */ }; diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index e9811010db0..ac1fbb179c6 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -146,6 +146,10 @@ DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE) DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE) DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE) DRAW_LLVM_TEXTURE_MEMBER(data_ptr, DRAW_JIT_TEXTURE_DATA, FALSE) +DRAW_LLVM_TEXTURE_MEMBER(min_lod, DRAW_JIT_TEXTURE_MIN_LOD, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(max_lod, DRAW_JIT_TEXTURE_MAX_LOD, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(lod_bias, DRAW_JIT_TEXTURE_LOD_BIAS, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(border_color, DRAW_JIT_TEXTURE_BORDER_COLOR, FALSE) static void @@ -207,6 +211,10 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, sampler->dynamic_state.base.row_stride = draw_llvm_texture_row_stride; sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride; sampler->dynamic_state.base.data_ptr = draw_llvm_texture_data_ptr; + sampler->dynamic_state.base.min_lod = draw_llvm_texture_min_lod; + sampler->dynamic_state.base.max_lod = draw_llvm_texture_max_lod; + sampler->dynamic_state.base.lod_bias = draw_llvm_texture_lod_bias; + sampler->dynamic_state.base.border_color = draw_llvm_texture_border_color; sampler->dynamic_state.static_state = static_state; sampler->dynamic_state.context_ptr = context_ptr; -- cgit v1.2.3 From 2a8d1fd3cedbac1dd145a3ac5b7a8edcba9a85d5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 25 Sep 2010 12:13:45 +0100 Subject: gallivm: Fetch the lod from the dynamic state when min_lod == max_lod. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 8 ++++---- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 44f44ff1aa4..d9fbc0f3057 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -104,7 +104,6 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, */ if (sampler->min_lod == sampler->max_lod) { state->min_max_lod_equal = 1; - state->min_max_lod = sampler->min_lod; } state->compare_mode = sampler->compare_mode; @@ -145,18 +144,19 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, LLVMValueRef depth) { + LLVMValueRef min_lod = + bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); + if (bld->static_state->min_max_lod_equal) { /* User is forcing sampling from a particular mipmap level. * This is hit during mipmap generation. */ - return LLVMConstReal(LLVMFloatType(), bld->static_state->min_max_lod); + return min_lod; } else { struct lp_build_context *float_bld = &bld->float_bld; LLVMValueRef sampler_lod_bias = bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit); - LLVMValueRef min_lod = - bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); LLVMValueRef max_lod = bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit); LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 9a19e87571e..43ed24bdc69 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -83,7 +83,6 @@ struct lp_sampler_static_state unsigned compare_func:3; unsigned normalized_coords:1; unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */ - float min_max_lod; /**< only valid when min_max_lod_equal=1 */ /* Aero hacks */ unsigned force_nearest_s:1; -- cgit v1.2.3 From 60a45b03c389f708c513bb2b70c5973175f01068 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Sep 2010 10:30:52 +0100 Subject: llvmpipe: handle FACING interpolants in line and point setup --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 6 ++++++ src/gallium/drivers/llvmpipe/lp_setup_point.c | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 829eb8a5a04..156bd633754 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -208,6 +208,12 @@ static void setup_line_coefficients( struct lp_setup_context *setup, fragcoord_usage_mask |= usage_mask; break; + case LP_INTERP_FACING: + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + constant_coef(setup, tri, slot+1, 1.0, i); + break; + default: assert(0); } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 2c354d1d0ed..a95c15751cc 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -232,13 +232,23 @@ setup_point_coefficients( struct lp_setup_context *setup, break; } } - - /* Otherwise fallthrough */ - default: + /* FALLTHROUGH */ + case LP_INTERP_CONSTANT: for (i = 0; i < NUM_CHANNELS; i++) { if (usage_mask & (1 << i)) constant_coef(setup, point, slot+1, info->v0[vert_attr][i], i); } + break; + + case LP_INTERP_FACING: + for (i = 0; i < NUM_CHANNELS; i++) + if (usage_mask & (1 << i)) + constant_coef(setup, point, slot+1, 1.0, i); + break; + + default: + assert(0); + break; } } -- cgit v1.2.3 From 72258387786332c49b3275b8136a99be7591bf7f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Sep 2010 11:18:38 +0100 Subject: llvmpipe: handle up to 8 planes in triangle binner --- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 5090f82ab5f..9016bb8e249 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -160,8 +160,9 @@ lp_setup_print_triangle(struct lp_setup_context *setup, } +#define MAX_PLANES 8 static unsigned -lp_rast_tri_tab[9] = { +lp_rast_tri_tab[MAX_PLANES+1] = { 0, /* should be impossible */ LP_RAST_OP_TRIANGLE_1, LP_RAST_OP_TRIANGLE_2, @@ -531,11 +532,11 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, } else { - int c[7]; - int ei[7]; - int eo[7]; - int xstep[7]; - int ystep[7]; + int c[MAX_PLANES]; + int ei[MAX_PLANES]; + int eo[MAX_PLANES]; + int xstep[MAX_PLANES]; + int ystep[MAX_PLANES]; int x, y; int ix0 = bbox->x0 / TILE_SIZE; @@ -564,7 +565,7 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, for (y = iy0; y <= iy1; y++) { boolean in = FALSE; /* are we inside the triangle? */ - int cx[7]; + int cx[MAX_PLANES]; for (i = 0; i < nr_planes; i++) cx[i] = c[i]; -- cgit v1.2.3 From a69a96d85ee1e17e791258967236c6a2c1945cdf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 25 Sep 2010 12:40:01 +0100 Subject: gallivm: Remove dead experimental code. --- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 4 - src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 120 +++++++++------------- 2 files changed, 46 insertions(+), 78 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 43ed24bdc69..bb485784ef5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -83,10 +83,6 @@ struct lp_sampler_static_state unsigned compare_func:3; unsigned normalized_coords:1; unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */ - - /* Aero hacks */ - unsigned force_nearest_s:1; - unsigned force_nearest_t:1; }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 000d4938a03..9a1c693d5eb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -489,10 +489,8 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, /* subtract 0.5 (add -128) */ i32_c128 = lp_build_const_int_vec(i32.type, -128); - if (!bld->static_state->force_nearest_s) { - s = LLVMBuildAdd(builder, s, i32_c128, ""); - } - if (dims >= 2 && !bld->static_state->force_nearest_t) { + s = LLVMBuildAdd(builder, s, i32_c128, ""); + if (dims >= 2) { t = LLVMBuildAdd(builder, t, i32_c128, ""); } if (dims >= 3) { @@ -709,82 +707,56 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, /* * Linear interpolation with 8.8 fixed point. */ - if (bld->static_state->force_nearest_s) { - /* special case 1-D lerp */ - packed_lo = lp_build_lerp(&h16, - t_fpart_lo, - neighbors_lo[0][0][0], - neighbors_lo[0][0][1]); - - packed_hi = lp_build_lerp(&h16, - t_fpart_hi, - neighbors_hi[0][1][0], - neighbors_hi[0][1][0]); - } - else if (bld->static_state->force_nearest_t) { - /* special case 1-D lerp */ + if (dims == 1) { + /* 1-D lerp */ packed_lo = lp_build_lerp(&h16, - s_fpart_lo, - neighbors_lo[0][0][0], - neighbors_lo[0][0][1]); + s_fpart_lo, + neighbors_lo[0][0][0], + neighbors_lo[0][0][1]); packed_hi = lp_build_lerp(&h16, - s_fpart_hi, - neighbors_hi[0][0][0], - neighbors_hi[0][0][1]); + s_fpart_hi, + neighbors_hi[0][0][0], + neighbors_hi[0][0][1]); } else { - /* general 1/2/3-D lerping */ - if (dims == 1) { - packed_lo = lp_build_lerp(&h16, - s_fpart_lo, - neighbors_lo[0][0][0], - neighbors_lo[0][0][1]); - - packed_hi = lp_build_lerp(&h16, - s_fpart_hi, - neighbors_hi[0][0][0], - neighbors_hi[0][0][1]); - } - else { - /* 2-D lerp */ - packed_lo = lp_build_lerp_2d(&h16, - s_fpart_lo, t_fpart_lo, - neighbors_lo[0][0][0], - neighbors_lo[0][0][1], - neighbors_lo[0][1][0], - neighbors_lo[0][1][1]); - - packed_hi = lp_build_lerp_2d(&h16, - s_fpart_hi, t_fpart_hi, - neighbors_hi[0][0][0], - neighbors_hi[0][0][1], - neighbors_hi[0][1][0], - neighbors_hi[0][1][1]); + /* 2-D lerp */ + packed_lo = lp_build_lerp_2d(&h16, + s_fpart_lo, t_fpart_lo, + neighbors_lo[0][0][0], + neighbors_lo[0][0][1], + neighbors_lo[0][1][0], + neighbors_lo[0][1][1]); + + packed_hi = lp_build_lerp_2d(&h16, + s_fpart_hi, t_fpart_hi, + neighbors_hi[0][0][0], + neighbors_hi[0][0][1], + neighbors_hi[0][1][0], + neighbors_hi[0][1][1]); - if (dims >= 3) { - LLVMValueRef packed_lo2, packed_hi2; - - /* lerp in the second z slice */ - packed_lo2 = lp_build_lerp_2d(&h16, - s_fpart_lo, t_fpart_lo, - neighbors_lo[1][0][0], - neighbors_lo[1][0][1], - neighbors_lo[1][1][0], - neighbors_lo[1][1][1]); - - packed_hi2 = lp_build_lerp_2d(&h16, - s_fpart_hi, t_fpart_hi, - neighbors_hi[1][0][0], - neighbors_hi[1][0][1], - neighbors_hi[1][1][0], - neighbors_hi[1][1][1]); - /* interp between two z slices */ - packed_lo = lp_build_lerp(&h16, r_fpart_lo, - packed_lo, packed_lo2); - packed_hi = lp_build_lerp(&h16, r_fpart_hi, - packed_hi, packed_hi2); - } + if (dims >= 3) { + LLVMValueRef packed_lo2, packed_hi2; + + /* lerp in the second z slice */ + packed_lo2 = lp_build_lerp_2d(&h16, + s_fpart_lo, t_fpart_lo, + neighbors_lo[1][0][0], + neighbors_lo[1][0][1], + neighbors_lo[1][1][0], + neighbors_lo[1][1][1]); + + packed_hi2 = lp_build_lerp_2d(&h16, + s_fpart_hi, t_fpart_hi, + neighbors_hi[1][0][0], + neighbors_hi[1][0][1], + neighbors_hi[1][1][0], + neighbors_hi[1][1][1]); + /* interp between two z slices */ + packed_lo = lp_build_lerp(&h16, r_fpart_lo, + packed_lo, packed_lo2); + packed_hi = lp_build_lerp(&h16, r_fpart_hi, + packed_hi, packed_hi2); } } -- cgit v1.2.3 From ebca23149a8d73317a5e00ba544f28ca0cde31ec Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 25 Sep 2010 19:23:05 +1000 Subject: r600g: make index bias fix for evergreen --- src/gallium/drivers/r600/eg_hw_states.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 998d74bd3eb..272972d4189 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -916,7 +916,7 @@ static int eg_draw_vgt_prim(struct r600_draw *draw, draw->vgt.states[EG_VGT__VGT_PRIMITIVE_TYPE] = prim; draw->vgt.states[EG_VGT__VGT_MAX_VTX_INDX] = draw->max_index; draw->vgt.states[EG_VGT__VGT_MIN_VTX_INDX] = draw->min_index; - draw->vgt.states[EG_VGT__VGT_INDX_OFFSET] = draw->start; + draw->vgt.states[EG_VGT__VGT_INDX_OFFSET] = draw->index_bias; draw->vgt.states[EG_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; draw->vgt.states[EG_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; draw->vgt.states[EG_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; -- cgit v1.2.3 From b6469a8dc712f550bafef624f854f265c5c8360f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 25 Sep 2010 20:23:44 +1000 Subject: r600g: add eg db count control register. --- src/gallium/drivers/r600/eg_hw_states.c | 5 +++-- src/gallium/drivers/r600/eg_states_inc.h | 15 ++++++++------- src/gallium/winsys/r600/drm/eg_states.h | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 272972d4189..889eedadef5 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -364,6 +364,7 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) struct r600_screen *rscreen = rctx->screen; unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control; + unsigned db_count_control = 0; struct r600_shader *rshader; struct r600_query *rquery = NULL; boolean query_running; @@ -439,7 +440,7 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) if (query_running) { db_render_override |= S_02800C_NOOP_CULL_DISABLE(1); -// db_render_control |= S_028000_PERFECT_ZPASS_COUNTS(1); + db_count_control |= S_028004_PERFECT_ZPASS_COUNTS(1); } rstate->states[EG_DSA__DB_STENCIL_CLEAR] = 0x00000000; @@ -455,7 +456,7 @@ static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) rstate->states[EG_DSA__DB_SHADER_CONTROL] = db_shader_control; rstate->states[EG_DSA__DB_RENDER_CONTROL] = db_render_control; rstate->states[EG_DSA__DB_RENDER_OVERRIDE] = db_render_override; - + rstate->states[EG_DSA__DB_COUNT_CONTROL] = db_count_control; rstate->states[EG_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000; rstate->states[EG_DSA__DB_PRELOAD_CONTROL] = 0x00000000; rstate->states[EG_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; diff --git a/src/gallium/drivers/r600/eg_states_inc.h b/src/gallium/drivers/r600/eg_states_inc.h index 9f8007c8e91..1379c11291f 100644 --- a/src/gallium/drivers/r600/eg_states_inc.h +++ b/src/gallium/drivers/r600/eg_states_inc.h @@ -150,13 +150,14 @@ #define EG_DSA__DB_DEPTH_CONTROL 7 #define EG_DSA__DB_SHADER_CONTROL 8 #define EG_DSA__DB_RENDER_CONTROL 9 -#define EG_DSA__DB_RENDER_OVERRIDE 10 -#define EG_DSA__DB_RENDER_OVERRIDE2 11 -#define EG_DSA__DB_SRESULTS_COMPARE_STATE0 12 -#define EG_DSA__DB_SRESULTS_COMPARE_STATE1 13 -#define EG_DSA__DB_PRELOAD_CONTROL 14 -#define EG_DSA__DB_ALPHA_TO_MASK 15 -#define EG_DSA_SIZE 16 +#define EG_DSA__DB_COUNT_CONTROL 10 +#define EG_DSA__DB_RENDER_OVERRIDE 11 +#define EG_DSA__DB_RENDER_OVERRIDE2 12 +#define EG_DSA__DB_SRESULTS_COMPARE_STATE0 13 +#define EG_DSA__DB_SRESULTS_COMPARE_STATE1 14 +#define EG_DSA__DB_PRELOAD_CONTROL 15 +#define EG_DSA__DB_ALPHA_TO_MASK 16 +#define EG_DSA_SIZE 17 #define EG_DSA_PM4 128 /* EG_VS_SHADER */ diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h index d87109fb801..ced7f147c0f 100644 --- a/src/gallium/winsys/r600/drm/eg_states.h +++ b/src/gallium/winsys/r600/drm/eg_states.h @@ -164,6 +164,7 @@ static const struct radeon_register EG_names_DSA[] = { {0x00028800, 0, 0, "DB_DEPTH_CONTROL"}, {0x0002880C, 0, 0, "DB_SHADER_CONTROL"}, {0x00028000, 0, 0, "DB_RENDER_CONTROL"}, + {0x00028004, 0, 0, "DB_COUNT_CONTROL"}, {0x0002800C, 0, 0, "DB_RENDER_OVERRIDE"}, {0x00028010, 0, 0, "DB_RENDER_OVERRIDE2"}, {0x00028AC0, 0, 0, "DB_SRESULTS_COMPARE_STATE0"}, -- cgit v1.2.3 From 58c243905b0cfcbf1b0299a0f7f0ea90755e36cc Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Sep 2010 21:34:56 -0400 Subject: r600g: fix vertex resource & polygon offset Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 78 ++++++++++++++++++++++------- src/gallium/drivers/r600/r600_pipe.h | 4 ++ src/gallium/drivers/r600/r600_state2.c | 79 +++++++++++++++++++++++------- 3 files changed, 127 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 4b7c251e5e9..c54b78aa6f0 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -242,8 +242,6 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, { struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); struct r600_pipe_state *rstate; - float offset_units = 0, offset_scale = 0; - unsigned offset_db_fmt_cntl = 0; unsigned tmp; unsigned prov_vtx = 1; @@ -255,6 +253,10 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, rs->flatshade = state->flatshade; rs->sprite_coord_enable = state->sprite_coord_enable; + /* offset */ + rs->offset_units = state->offset_units; + rs->offset_scale = state->offset_scale * 12.0f; + rstate->id = R600_PIPE_STATE_RASTERIZER; if (state->flatshade_first) prov_vtx = 0; @@ -293,11 +295,6 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0x0, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C08_PA_SU_VTX_CNTL, 0x00000005, 0xFFFFFFFF, NULL); return rstate; @@ -311,14 +308,9 @@ static void evergreen_bind_rs_state(struct pipe_context *ctx, void *state) if (state == NULL) return; - if (rctx->flatshade != rs->flatshade) { -// rctx->ps_rebuild = TRUE; - } - if (rctx->sprite_coord_enable != rs->sprite_coord_enable) { -// rctx->ps_rebuild = TRUE; - } rctx->flatshade = rs->flatshade; rctx->sprite_coord_enable = rs->sprite_coord_enable; + rctx->rasterizer = rs; rctx->states[rs->rstate.id] = &rs->rstate; r600_context_pipe_state_set(&rctx->ctx, &rs->rstate); @@ -329,6 +321,9 @@ static void evergreen_delete_rs_state(struct pipe_context *ctx, void *state) struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; + if (rctx->rasterizer == rs) { + rctx->rasterizer = NULL; + } if (rctx->states[rs->rstate.id] == &rs->rstate) { rctx->states[rs->rstate.id] = NULL; } @@ -924,6 +919,8 @@ static void evergreen_set_vertex_buffers(struct pipe_context *ctx, unsigned coun memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); for (int i = 0; i < count; i++) { rctx->vertex_buffer[i].buffer = NULL; + if (r600_buffer_is_user_buffer(buffers[i].buffer)) + rctx->any_user_vbs = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); } rctx->nvertex_buffer = count; @@ -1342,6 +1339,11 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) assert(info->index_bias == 0); + if (rctx->any_user_vbs) { + r600_upload_user_buffers2(rctx); + rctx->any_user_vbs = FALSE; + } + memset(&draw, 0, sizeof(struct r600_drawl)); draw.mode = info->mode; draw.start = info->start; @@ -1369,9 +1371,6 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.index_bias = info->start; } - /* flush upload buffers */ - r600_upload_user_buffers2(rctx); - switch (draw.index_size) { case 2: vgt_draw_initiator = 0; @@ -1399,6 +1398,8 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) return; for (i = 0 ; i < rctx->vertex_elements->count; i++) { + unsigned num_format = 0, format_comp = 0; + rstate = &rctx->vs_resource[i]; j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; @@ -1408,12 +1409,15 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) rstate->id = R600_PIPE_STATE_RESOURCE; rstate->nregs = 0; + r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030008_RESOURCE0_WORD2, S_030008_STRIDE(vertex_buffer->stride) | - S_030008_DATA_FORMAT(format), + S_030008_DATA_FORMAT(format) | + S_030008_NUM_FORMAT_ALL(num_format) | + S_030008_FORMAT_COMP_ALL(format_comp), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03000C_RESOURCE0_WORD3, @@ -1441,6 +1445,46 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL); + + if (rctx->rasterizer && rctx->framebuffer.zsbuf) { + float offset_units = rctx->rasterizer->offset_units; + unsigned offset_db_fmt_cntl = 0, depth; + + switch (rctx->framebuffer.zsbuf->texture->format) { + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + depth = -24; + offset_units *= 2.0f; + break; + case PIPE_FORMAT_Z32_FLOAT: + depth = -23; + offset_units *= 1.0f; + offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + break; + case PIPE_FORMAT_Z16_UNORM: + depth = -16; + offset_units *= 4.0f; + break; + default: + return; + } + offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, + fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, + fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, + fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, + fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, + offset_db_fmt_cntl, 0xFFFFFFFF, NULL); + } r600_context_pipe_state_set(&rctx->ctx, &vgt); rdraw.vgt_num_indices = draw.count; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index e05a14f4e93..19cfbccf4f1 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -60,6 +60,8 @@ struct r600_pipe_rasterizer { struct r600_pipe_state rstate; bool flatshade; unsigned sprite_coord_enable; + float offset_units; + float offset_scale; }; struct r600_pipe_blend { @@ -108,12 +110,14 @@ struct r600_pipe_context { struct r600_pipe_shader *vs_shader; struct r600_pipe_state vs_const_buffer; struct r600_pipe_state ps_const_buffer; + struct r600_pipe_rasterizer *rasterizer; /* shader information */ unsigned sprite_coord_enable; bool flatshade; struct u_upload_mgr *upload_vb; struct u_upload_mgr *upload_ib; enum radeon_family family; + unsigned any_user_vbs; }; struct r600_drawl { diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 40038f0732e..c4e06a5f528 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -463,9 +463,6 @@ static void r600_draw_common(struct r600_drawl *draw) struct r600_draw rdraw; struct r600_pipe_state vgt; - /* flush upload buffers */ - r600_upload_user_buffers2(rctx); - switch (draw->index_size) { case 2: vgt_draw_initiator = 0; @@ -486,6 +483,7 @@ static void r600_draw_common(struct r600_drawl *draw) if (r600_conv_pipe_prim(draw->mode, &prim)) return; + /* rebuild vertex shader if input format changed */ if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader)) return; @@ -493,6 +491,8 @@ static void r600_draw_common(struct r600_drawl *draw) return; for (i = 0 ; i < rctx->vertex_elements->count; i++) { + unsigned num_format = 0, format_comp = 0; + rstate = &rctx->vs_resource[i]; j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; @@ -502,12 +502,15 @@ static void r600_draw_common(struct r600_drawl *draw) rstate->id = R600_PIPE_STATE_RESOURCE; rstate->nregs = 0; + r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038008_RESOURCE0_WORD2, S_038008_STRIDE(vertex_buffer->stride) | - S_038008_DATA_FORMAT(format), + S_038008_DATA_FORMAT(format) | + S_038008_NUM_FORMAT_ALL(num_format) | + S_038008_FORMAT_COMP_ALL(format_comp), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); @@ -528,6 +531,46 @@ static void r600_draw_common(struct r600_drawl *draw) r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); + /* build late state */ + if (rctx->rasterizer && rctx->framebuffer.zsbuf) { + float offset_units = rctx->rasterizer->offset_units; + unsigned offset_db_fmt_cntl = 0, depth; + + switch (rctx->framebuffer.zsbuf->texture->format) { + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + depth = -24; + offset_units *= 2.0f; + break; + case PIPE_FORMAT_Z32_FLOAT: + depth = -23; + offset_units *= 1.0f; + offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + break; + case PIPE_FORMAT_Z16_UNORM: + depth = -16; + offset_units *= 4.0f; + break; + default: + return; + } + offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, + fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, + fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, + fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, + fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, + offset_db_fmt_cntl, 0xFFFFFFFF, NULL); + } r600_context_pipe_state_set(&rctx->ctx, &vgt); rdraw.vgt_num_indices = draw->count; @@ -574,6 +617,11 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info assert(info->index_bias == 0); + if (rctx->any_user_vbs) { + r600_upload_user_buffers2(rctx); + rctx->any_user_vbs = FALSE; + } + memset(&draw, 0, sizeof(struct r600_drawl)); draw.ctx = ctx; draw.mode = info->mode; @@ -942,8 +990,6 @@ static void *r600_create_rs_state(struct pipe_context *ctx, { struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); struct r600_pipe_state *rstate; - float offset_units = 0, offset_scale = 0; - unsigned offset_db_fmt_cntl = 0; unsigned tmp; unsigned prov_vtx = 1; @@ -955,6 +1001,10 @@ static void *r600_create_rs_state(struct pipe_context *ctx, rs->flatshade = state->flatshade; rs->sprite_coord_enable = state->sprite_coord_enable; + /* offset */ + rs->offset_units = state->offset_units; + rs->offset_scale = state->offset_scale * 12.0f; + rstate->id = R600_PIPE_STATE_RASTERIZER; if (state->flatshade_first) prov_vtx = 0; @@ -995,12 +1045,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, fui(offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); return rstate; } @@ -1012,14 +1057,9 @@ static void r600_bind_rs_state(struct pipe_context *ctx, void *state) if (state == NULL) return; - if (rctx->flatshade != rs->flatshade) { -// rctx->ps_rebuild = TRUE; - } - if (rctx->sprite_coord_enable != rs->sprite_coord_enable) { -// rctx->ps_rebuild = TRUE; - } rctx->flatshade = rs->flatshade; rctx->sprite_coord_enable = rs->sprite_coord_enable; + rctx->rasterizer = rs; rctx->states[rs->rstate.id] = &rs->rstate; r600_context_pipe_state_set(&rctx->ctx, &rs->rstate); @@ -1030,6 +1070,9 @@ static void r600_delete_rs_state(struct pipe_context *ctx, void *state) struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; + if (rctx->rasterizer == rs) { + rctx->rasterizer = NULL; + } if (rctx->states[rs->rstate.id] == &rs->rstate) { rctx->states[rs->rstate.id] = NULL; } @@ -1636,6 +1679,8 @@ static void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); for (int i = 0; i < count; i++) { rctx->vertex_buffer[i].buffer = NULL; + if (r600_buffer_is_user_buffer(buffers[i].buffer)) + rctx->any_user_vbs = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); } rctx->nvertex_buffer = count; -- cgit v1.2.3 From 583bbfb3aed3ded6ca060155c1ebbd4f39138a31 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 24 Sep 2010 20:33:10 +0200 Subject: nv50: use formats table in nv50_surface.c --- src/gallium/drivers/nv50/nv50_formats.c | 20 ++++++----- src/gallium/drivers/nv50/nv50_surface.c | 63 +++++++++++---------------------- 2 files changed, 31 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_formats.c b/src/gallium/drivers/nv50/nv50_formats.c index 3be39d5337a..42828094547 100644 --- a/src/gallium/drivers/nv50/nv50_formats.c +++ b/src/gallium/drivers/nv50/nv50_formats.c @@ -53,6 +53,8 @@ #define NV50TIC_0_0_FMT_16_16_16 NV50TIC_0_0_FMT_16_16_16_16 #define NV50TIC_0_0_FMT_32_32_32 NV50TIC_0_0_FMT_32_32_32_32 +/* NOTE: using NV50_2D_DST_FORMAT for substitute formats used with 2D engine */ + const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = { /* COMMON FORMATS */ @@ -81,7 +83,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 1_5_5_5, 1), SAMPLER_VIEW | RENDER_TARGET | SCANOUT }, - [PIPE_FORMAT_B4G4R4A4_UNORM] = { 0, + [PIPE_FORMAT_B4G4R4A4_UNORM] = { NV50_2D_DST_FORMAT_R16_UNORM, B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1), SAMPLER_VIEW }, @@ -122,15 +124,15 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = /* LUMINANCE, ALPHA, INTENSITY */ - [PIPE_FORMAT_L8_UNORM] = { 0, + [PIPE_FORMAT_L8_UNORM] = { NV50_2D_DST_FORMAT_R8_UNORM, A_(C0, C0, C0, ONE, UNORM, UNORM, UNORM, UNORM, 8, 0), SAMPLER_VIEW }, - [PIPE_FORMAT_L8_SRGB] = { 0, + [PIPE_FORMAT_L8_SRGB] = { NV50_2D_DST_FORMAT_R8_UNORM, A_(C0, C0, C0, ONE, UNORM, UNORM, UNORM, UNORM, 8, 0), SAMPLER_VIEW }, - [PIPE_FORMAT_I8_UNORM] = { 0, + [PIPE_FORMAT_I8_UNORM] = { NV50_2D_DST_FORMAT_R8_UNORM, A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 8, 0), SAMPLER_VIEW }, @@ -138,7 +140,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 8, 0), SAMPLER_VIEW | RENDER_TARGET }, - [PIPE_FORMAT_L8A8_UNORM] = { 0, + [PIPE_FORMAT_L8A8_UNORM] = { NV50_2D_DST_FORMAT_R16_UNORM, A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0), SAMPLER_VIEW }, @@ -276,9 +278,9 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 16_16, 0), VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET }, - [PIPE_FORMAT_R16_SNORM] = { 0, + [PIPE_FORMAT_R16_SNORM] = { NV50TCL_RT_FORMAT_R16_SNORM, A_(C0, ZERO, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, 16, 0), - VERTEX_BUFFER | SAMPLER_VIEW }, + VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET }, /* UNORM 16 */ @@ -294,9 +296,9 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 16_16, 0), VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET }, - [PIPE_FORMAT_R16_UNORM] = { 0, + [PIPE_FORMAT_R16_UNORM] = { NV50TCL_RT_FORMAT_R16_UNORM, A_(C0, ZERO, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, 16, 0), - VERTEX_BUFFER | SAMPLER_VIEW }, + VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET }, /* SNORM 8 */ diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 3e61203adff..623024ce77c 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -52,48 +52,26 @@ nv50_2d_format_faithful(enum pipe_format format) } } -static INLINE int -nv50_format(enum pipe_format format) +static INLINE uint8_t +nv50_2d_format(enum pipe_format format) { - switch (format) { - case PIPE_FORMAT_B8G8R8A8_UNORM: - return NV50_2D_DST_FORMAT_A8R8G8B8_UNORM; - case PIPE_FORMAT_B8G8R8X8_UNORM: - return NV50_2D_DST_FORMAT_X8R8G8B8_UNORM; - case PIPE_FORMAT_B8G8R8A8_SRGB: - return NV50_2D_DST_FORMAT_A8R8G8B8_SRGB; - case PIPE_FORMAT_B8G8R8X8_SRGB: - return NV50_2D_DST_FORMAT_X8R8G8B8_SRGB; - case PIPE_FORMAT_B5G6R5_UNORM: - return NV50_2D_DST_FORMAT_R5G6B5_UNORM; - case PIPE_FORMAT_B5G5R5A1_UNORM: - return NV50_2D_DST_FORMAT_A1R5G5B5_UNORM; - case PIPE_FORMAT_B10G10R10A2_UNORM: - return NV50_2D_DST_FORMAT_A2R10G10B10_UNORM; - case PIPE_FORMAT_A8_UNORM: - case PIPE_FORMAT_I8_UNORM: - case PIPE_FORMAT_L8_UNORM: - case PIPE_FORMAT_R8_UNORM: - return NV50_2D_DST_FORMAT_R8_UNORM; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - return NV50_2D_DST_FORMAT_R32G32B32A32_FLOAT; - case PIPE_FORMAT_R32G32B32_FLOAT: - return NV50_2D_DST_FORMAT_R32G32B32X32_FLOAT; - case PIPE_FORMAT_Z32_FLOAT: - return NV50_2D_DST_FORMAT_R32_FLOAT; + uint8_t id = nv50_format_table[format].rt; - /* only because we require src format == dst format: */ - case PIPE_FORMAT_R16G16_SNORM: - case PIPE_FORMAT_R16G16_UNORM: - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - return NV50_2D_DST_FORMAT_A8R8G8B8_UNORM; - case PIPE_FORMAT_L8A8_UNORM: - case PIPE_FORMAT_B4G4R4A4_UNORM: - return NV50_2D_DST_FORMAT_R16_UNORM; + /* Hardware values for color formats range from 0xc0 to 0xff, + * but the 2D engine doesn't support all of them. + */ + if ((id >= 0xc0) && (0xff0843e080608409ULL & (1ULL << (id - 0xc0)))) + return id; + switch (util_format_get_blocksize(format)) { + case 1: + return NV50_2D_DST_FORMAT_R8_UNORM; + case 2: + return NV50_2D_DST_FORMAT_R16_UNORM; + case 4: + return NV50_2D_DST_FORMAT_A8R8G8B8_UNORM; default: - return -1; + return 0; } } @@ -107,8 +85,8 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) int format, mthd = dst ? NV50_2D_DST_FORMAT : NV50_2D_SRC_FORMAT; int flags = NOUVEAU_BO_VRAM | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD); - format = nv50_format(ps->format); - if (format < 0) { + format = nv50_2d_format(ps->format); + if (!format) { NOUVEAU_ERR("invalid/unsupported surface format: %s\n", util_format_name(ps->format)); return 1; @@ -237,8 +215,8 @@ nv50_clear_render_target(struct pipe_context *pipe, union util_color uc; util_pack_color(rgba, dst->format, &uc); - format = nv50_format(dst->format); - if (format < 0) + format = nv50_2d_format(dst->format); + if (!format) return; ret = MARK_RING (chan, 16 + 32, 2); @@ -258,7 +236,6 @@ nv50_clear_render_target(struct pipe_context *pipe, OUT_RING (chan, dsty); OUT_RING (chan, width); OUT_RING (chan, height); - } void -- cgit v1.2.3 From 2ef1d759b34fb6e9795d70a7c7b6c6c274c64bf8 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 24 Sep 2010 22:46:51 +0200 Subject: nv50: use CLEAR_BUFFERS for surface fills The 2D engine's fill doesn't seem suited for RGBA32F or ZS buffers. --- src/gallium/drivers/nv50/nv50_reg.h | 3 + src/gallium/drivers/nv50/nv50_screen.c | 3 + src/gallium/drivers/nv50/nv50_surface.c | 110 +++++++++++++++++++++++++------- 3 files changed, 94 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_reg.h b/src/gallium/drivers/nv50/nv50_reg.h index 365576fdd07..949838b33f5 100644 --- a/src/gallium/drivers/nv50/nv50_reg.h +++ b/src/gallium/drivers/nv50/nv50_reg.h @@ -1018,6 +1018,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV50TCL_FP_START_ID 0x00001414 #define NV50TCL_GP_VERTEX_OUTPUT_COUNT 0x00001420 #define NV50TCL_VB_ELEMENT_BASE 0x00001434 +#define NV50TCL_CLEAR_FLAGS 0x0000143c +#define NV50TCL_CLEAR_FLAGS_OGL (1 << 0) +#define NV50TCL_CLEAR_FLAGS_D3D (1 << 4) #define NV50TCL_INSTANCE_BASE 0x00001438 #define NV50TCL_CODE_CB_FLUSH 0x00001440 #define NV50TCL_BIND_TSC(x) (0x00001444+((x)*8)) diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 7c9342b7471..c5115372ed6 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -457,6 +457,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) BEGIN_RING(chan, screen->tesla, NV50TCL_VP_REG_ALLOC_RESULT, 1); OUT_RING (chan, 8); + BEGIN_RING(chan, screen->tesla, NV50TCL_CLEAR_FLAGS, 1); + OUT_RING (chan, NV50TCL_CLEAR_FLAGS_D3D); + /* constant buffers for immediates and VP/FP parameters */ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (32 * 4) * 4, &screen->constbuf_misc[0]); diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 623024ce77c..3f3166261b1 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -199,7 +199,6 @@ nv50_surface_copy(struct pipe_context *pipe, nv50_miptree_surface_del(ps_dst); } -/* XXX this should probably look more along the lines of nv50_clear */ static void nv50_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, @@ -209,33 +208,99 @@ nv50_clear_render_target(struct pipe_context *pipe, { struct nv50_context *nv50 = nv50_context(pipe); struct nv50_screen *screen = nv50->screen; - struct nouveau_channel *chan = screen->eng2d->channel; - struct nouveau_grobj *eng2d = screen->eng2d; - int format, ret; - union util_color uc; - util_pack_color(rgba, dst->format, &uc); + struct nouveau_channel *chan = screen->base.channel; + struct nouveau_grobj *tesla = screen->tesla; + struct nv50_miptree *mt = nv50_miptree(dst->texture); + struct nouveau_bo *bo = mt->base.bo; - format = nv50_2d_format(dst->format); - if (!format) - return; + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_COLOR(0), 4); + OUT_RINGf (chan, rgba[0]); + OUT_RINGf (chan, rgba[1]); + OUT_RINGf (chan, rgba[2]); + OUT_RINGf (chan, rgba[3]); - ret = MARK_RING (chan, 16 + 32, 2); - if (ret) + if (MARK_RING(chan, 18, 2)) return; - ret = nv50_surface_set(screen, dst, 1); - if (ret) + BEGIN_RING(chan, tesla, NV50TCL_RT_CONTROL, 1); + OUT_RING (chan, 1); + BEGIN_RING(chan, tesla, NV50TCL_RT_ADDRESS_HIGH(0), 5); + OUT_RELOCh(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCl(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RING (chan, nv50_format_table[dst->format].rt); + OUT_RING (chan, mt->level[dst->level].tile_mode << 4); + OUT_RING (chan, 0); + BEGIN_RING(chan, tesla, NV50TCL_RT_HORIZ(0), 2); + OUT_RING (chan, dst->width); + OUT_RING (chan, dst->height); + BEGIN_RING(chan, tesla, NV50TCL_RT_ARRAY_MODE, 1); + OUT_RING (chan, 1); + + /* NOTE: only works with D3D clear flag (5097/0x143c bit 4) */ + + BEGIN_RING(chan, tesla, NV50TCL_VIEWPORT_HORIZ(0), 2); + OUT_RING (chan, (width << 16) | dstx); + OUT_RING (chan, (height << 16) | dsty); + + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1); + OUT_RING (chan, 0x3c); + + nv50->dirty |= NV50_NEW_FRAMEBUFFER; +} + +static void +nv50_clear_depth_stencil(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) +{ + struct nv50_context *nv50 = nv50_context(pipe); + struct nv50_screen *screen = nv50->screen; + struct nouveau_channel *chan = screen->base.channel; + struct nouveau_grobj *tesla = screen->tesla; + struct nv50_miptree *mt = nv50_miptree(dst->texture); + struct nouveau_bo *bo = mt->base.bo; + uint32_t mode = 0; + + if (clear_flags & PIPE_CLEAR_DEPTH) { + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_DEPTH, 1); + OUT_RINGf (chan, depth); + mode |= NV50TCL_CLEAR_BUFFERS_Z; + } + + if (clear_flags & PIPE_CLEAR_STENCIL) { + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_STENCIL, 1); + OUT_RING (chan, stencil & 0xff); + mode |= NV50TCL_CLEAR_BUFFERS_S; + } + + if (MARK_RING(chan, 17, 2)) return; - BEGIN_RING(chan, eng2d, NV50_2D_DRAW_SHAPE, 3); - OUT_RING (chan, NV50_2D_DRAW_SHAPE_RECTANGLES); - OUT_RING (chan, format); - OUT_RING (chan, uc.ui); - BEGIN_RING(chan, eng2d, NV50_2D_DRAW_POINT32_X(0), 4); - OUT_RING (chan, dstx); - OUT_RING (chan, dsty); - OUT_RING (chan, width); - OUT_RING (chan, height); + BEGIN_RING(chan, tesla, NV50TCL_ZETA_ADDRESS_HIGH, 5); + OUT_RELOCh(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCl(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RING (chan, nv50_format_table[dst->format].rt); + OUT_RING (chan, mt->level[dst->level].tile_mode << 4); + OUT_RING (chan, 0); + BEGIN_RING(chan, tesla, NV50TCL_ZETA_ENABLE, 1); + OUT_RING (chan, 1); + BEGIN_RING(chan, tesla, NV50TCL_ZETA_HORIZ, 3); + OUT_RING (chan, dst->width); + OUT_RING (chan, dst->height); + OUT_RING (chan, (1 << 16) | 1); + + BEGIN_RING(chan, tesla, NV50TCL_VIEWPORT_HORIZ(0), 2); + OUT_RING (chan, (width << 16) | dstx); + OUT_RING (chan, (height << 16) | dsty); + + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1); + OUT_RING (chan, mode); + + nv50->dirty |= NV50_NEW_FRAMEBUFFER; } void @@ -243,6 +308,7 @@ nv50_init_surface_functions(struct nv50_context *nv50) { nv50->pipe.resource_copy_region = nv50_surface_copy; nv50->pipe.clear_render_target = nv50_clear_render_target; + nv50->pipe.clear_depth_stencil = nv50_clear_depth_stencil; } -- cgit v1.2.3 From 86cddfb1104a3b59a91c480b5fc14e169f4885dc Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 25 Sep 2010 19:34:23 +0200 Subject: nv50: fix/handle a few more PIPE_CAPs --- src/gallium/drivers/nv50/nv50_screen.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index c5115372ed6..c6bd62df1db 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -84,6 +84,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TWO_SIDED_STENCIL: return 1; case PIPE_CAP_GLSL: + case PIPE_CAP_SM3: return 1; case PIPE_CAP_ANISOTROPIC_FILTER: return 1; @@ -95,6 +96,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 1; case PIPE_CAP_TIMER_QUERY: return 0; + case PIPE_CAP_STREAM_OUTPUT: + return 0; case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: @@ -137,8 +140,8 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, switch(shader) { case PIPE_SHADER_FRAGMENT: case PIPE_SHADER_VERTEX: - case PIPE_SHADER_GEOMETRY: break; + case PIPE_SHADER_GEOMETRY: default: return 0; } @@ -158,6 +161,8 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, return 64 / 4; case PIPE_SHADER_CAP_MAX_CONSTS: return 65536 / 16; + case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: /* 16 - 1, but not implemented */ + return 1; case PIPE_SHADER_CAP_MAX_ADDRS: /* no spilling atm */ return 1; case PIPE_SHADER_CAP_MAX_PREDS: /* not yet handled */ -- cgit v1.2.3 From 60ec71e8b96da647cd90d8639a4f8bc259d997d5 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 25 Sep 2010 12:21:10 -0700 Subject: r600g: Remove unused variable. Fixes this GCC warning. r600_screen.c: In function 'r600_screen_create': r600_screen.c:239: warning: unused variable 'family' --- src/gallium/drivers/r600/r600_screen.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c index d280a45bab7..be8a78ca3d0 100644 --- a/src/gallium/drivers/r600/r600_screen.c +++ b/src/gallium/drivers/r600/r600_screen.c @@ -236,7 +236,6 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) struct pipe_screen *r600_screen_create(struct radeon *rw) { struct r600_screen* rscreen; - enum radeon_family family = radeon_get_family(rw); rscreen = CALLOC_STRUCT(r600_screen); if (rscreen == NULL) { -- cgit v1.2.3 From d7065908e48b296cceb0e1b756e9560a013881a2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 25 Sep 2010 12:25:44 -0700 Subject: r600g: Remove unused variable. Fixes this GCC warning. r600_draw.c: In function 'r600_draw_common': r600_draw.c:71: warning: unused variable 'format' --- src/gallium/drivers/r600/r600_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 5b389462e72..afc3b7bba16 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -68,7 +68,7 @@ static int r600_draw_common(struct r600_draw *draw) /* FIXME vs_resource */ struct radeon_state *vs_resource; struct r600_resource *rbuffer; - unsigned i, j, offset, format, prim; + unsigned i, j, offset, prim; u32 vgt_dma_index_type, vgt_draw_initiator; struct pipe_vertex_buffer *vertex_buffer; int r; -- cgit v1.2.3 From 1fa50412f1840257579d8e6017e8b97189901609 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 25 Sep 2010 12:28:47 -0700 Subject: r600g: Disable unused variables. The variables are used only in currently disabled code. Fixes this GCC warning. r600_context.c: In function 'r600_flush': r600_context.c:76: warning: unused variable 'dname' r600_context.c:75: warning: unused variable 'dc' --- src/gallium/drivers/r600/r600_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index e8eb8142095..ec1f44639a3 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -71,7 +71,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, { struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; -#if 1 +#if 0 static int dc = 0; char dname[256]; #endif -- cgit v1.2.3 From f3e6a0faa9090cfcfcafe06e1481ed5a18838ca0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 25 Sep 2010 12:33:28 -0700 Subject: intel: Remove unnecessary header. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index bd7707eeeba..c62e16f5878 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -32,7 +32,6 @@ #include "main/mtypes.h" #include "main/macros.h" #include "main/bufferobj.h" -#include "main/polygon.h" #include "main/state.h" #include "main/texobj.h" #include "main/context.h" -- cgit v1.2.3 From e31f0f996537046228602a251706613ca4163209 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 13:06:31 -0600 Subject: softpipe: fix repeat() function for NPOT textures The trick of casting the coord to an unsigned value only works for POT textures. Add a bias instead. This fixes a few piglit texwrap failures. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index e654bb77c29..96ccf1da988 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -105,14 +105,14 @@ lerp_3d(float a, float b, float c, /** * Compute coord % size for repeat wrap modes. - * Note that if coord is a signed integer, coord % size doesn't give - * the right value for coord < 0 (in terms of texture repeat). Just - * casting to unsigned fixes that. + * Note that if coord is negative, coord % size doesn't give the right + * value. To avoid that problem we add a large multiple of the size + * (rather than using a conditional). */ static INLINE int repeat(int coord, unsigned size) { - return (int) ((unsigned) coord % size); + return (coord + size * 1024) % size; } -- cgit v1.2.3 From 4e2f53bacb670b824593dce70668a8f92796ed93 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 13:09:25 -0600 Subject: gallivm: fix repeat() function for NPOT textures The trick of casting the coord to an unsigned value only works for POT textures. Add a bias instead. This fixes a few piglit texwrap failures. --- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 13 ++++++++----- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 14 +++++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 9a1c693d5eb..49a6eed615f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -90,10 +90,12 @@ lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld, case PIPE_TEX_WRAP_REPEAT: if(is_pot) coord = LLVMBuildAnd(bld->builder, coord, length_minus_one, ""); - else - /* Signed remainder won't give the right results for negative - * dividends but unsigned remainder does.*/ + else { + /* Add a bias to the texcoord to handle negative coords */ + LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + coord = LLVMBuildAdd(bld->builder, coord, bias, ""); coord = LLVMBuildURem(bld->builder, coord, length, ""); + } break; case PIPE_TEX_WRAP_CLAMP_TO_EDGE: @@ -197,8 +199,9 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, ""); } else { - /* Signed remainder won't give the right results for negative - * dividends but unsigned remainder does.*/ + /* Add a bias to the texcoord to handle negative coords */ + LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + coord0 = LLVMBuildAdd(bld->builder, coord0, bias, ""); coord0 = LLVMBuildURem(bld->builder, coord0, length, ""); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index e3e8548d93b..f53ad915945 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -280,8 +280,10 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord1 = LLVMBuildAnd(bld->builder, coord1, length_minus_one, ""); } else { - /* Signed remainder won't give the right results for negative - * dividends but unsigned remainder does.*/ + /* Add a bias to the texcoord to handle negative coords */ + LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + coord0 = LLVMBuildAdd(bld->builder, coord0, bias, ""); + coord1 = LLVMBuildAdd(bld->builder, coord1, bias, ""); coord0 = LLVMBuildURem(bld->builder, coord0, length, ""); coord1 = LLVMBuildURem(bld->builder, coord1, length, ""); } @@ -476,10 +478,12 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, icoord = lp_build_ifloor(coord_bld, coord); if (is_pot) icoord = LLVMBuildAnd(bld->builder, icoord, length_minus_one, ""); - else - /* Signed remainder won't give the right results for negative - * dividends but unsigned remainder does.*/ + else { + /* Add a bias to the texcoord to handle negative coords */ + LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + icoord = LLVMBuildAdd(bld->builder, icoord, bias, ""); icoord = LLVMBuildURem(bld->builder, icoord, length, ""); + } break; case PIPE_TEX_WRAP_CLAMP: -- cgit v1.2.3 From 5ba62cd4139e95c752453a1591eb3e47b6b18238 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 13:10:26 -0600 Subject: swrast: update comments for REMAINDER() macro --- src/mesa/swrast/s_texfilter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 3fc554c5a20..1aa2bcaf74d 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -135,8 +135,11 @@ lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, /** - * If A is a signed integer, A % B doesn't give the right value for A < 0 - * (in terms of texture repeat). Just casting to unsigned fixes that. + * Used for GL_REPEAT wrap mode. Using A % B doesn't produce the + * right results for A<0. Casting to A to be unsigned only works if B + * is a power of two. Adding a bias to A (which is a multiple of B) + * avoids the problems with A < 0 (for reasonable A) without using a + * conditional. */ #define REMAINDER(A, B) (((A) + (B) * 1024) % (B)) -- cgit v1.2.3 From f8ee415e3c2fa8e475e9f7fad0315c06c232ff94 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 25 Sep 2010 12:38:29 -0700 Subject: st/dri: Remove unnecessary header. --- src/gallium/state_trackers/dri/common/dri_screen.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 7e4b11d83f7..b3b09b605fa 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -33,7 +33,6 @@ #include "xmlpool.h" #include "dri_screen.h" -#include "dri_context.h" #include "util/u_inlines.h" #include "pipe/p_screen.h" -- cgit v1.2.3 From 72c6d16f8fe31b1b711465d20e4d2c4cbd13825f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 13:50:30 -0600 Subject: softpipe: rename sp_state_fs.c -> sp_state_shader.c --- src/gallium/drivers/softpipe/Makefile | 2 +- src/gallium/drivers/softpipe/SConscript | 2 +- src/gallium/drivers/softpipe/sp_state_fs.c | 281 ------------------------- src/gallium/drivers/softpipe/sp_state_shader.c | 281 +++++++++++++++++++++++++ 4 files changed, 283 insertions(+), 283 deletions(-) delete mode 100644 src/gallium/drivers/softpipe/sp_state_fs.c create mode 100644 src/gallium/drivers/softpipe/sp_state_shader.c (limited to 'src') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 35d426aa3ea..28953582f0a 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -23,8 +23,8 @@ C_SOURCES = \ sp_state_blend.c \ sp_state_clip.c \ sp_state_derived.c \ - sp_state_fs.c \ sp_state_sampler.c \ + sp_state_shader.c \ sp_state_so.c \ sp_state_rasterizer.c \ sp_state_surface.c \ diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index be5917a6886..d5f4d28aeff 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -24,9 +24,9 @@ softpipe = env.ConvenienceLibrary( 'sp_state_blend.c', 'sp_state_clip.c', 'sp_state_derived.c', - 'sp_state_fs.c', 'sp_state_rasterizer.c', 'sp_state_sampler.c', + 'sp_state_shader.c', 'sp_state_so.c', 'sp_state_surface.c', 'sp_state_vertex.c', diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c deleted file mode 100644 index 50bc2eea5ff..00000000000 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ /dev/null @@ -1,281 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#include "sp_context.h" -#include "sp_state.h" -#include "sp_fs.h" -#include "sp_texture.h" - -#include "pipe/p_defines.h" -#include "util/u_memory.h" -#include "util/u_inlines.h" -#include "draw/draw_context.h" -#include "draw/draw_vs.h" -#include "draw/draw_gs.h" -#include "tgsi/tgsi_dump.h" -#include "tgsi/tgsi_exec.h" -#include "tgsi/tgsi_scan.h" -#include "tgsi/tgsi_parse.h" - - -void * -softpipe_create_fs_state(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_fragment_shader *state; - unsigned i; - - /* debug */ - if (softpipe->dump_fs) - tgsi_dump(templ->tokens, 0); - - /* codegen */ - state = softpipe_create_fs_sse( softpipe, templ ); - if (!state) { - state = softpipe_create_fs_exec( softpipe, templ ); - } - - if (!state) - return NULL; - - /* draw's fs state */ - state->draw_shader = draw_create_fragment_shader(softpipe->draw, templ); - if (!state->draw_shader) { - state->delete( state ); - return NULL; - } - - /* get/save the summary info for this shader */ - tgsi_scan_shader(templ->tokens, &state->info); - - for (i = 0; i < state->info.num_properties; ++i) { - if (state->info.properties[i].name == TGSI_PROPERTY_FS_COORD_ORIGIN) - state->origin_lower_left = state->info.properties[i].data[0]; - else if (state->info.properties[i].name == TGSI_PROPERTY_FS_COORD_PIXEL_CENTER) - state->pixel_center_integer = state->info.properties[i].data[0]; - } - - return state; -} - - -void -softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - draw_flush(softpipe->draw); - - if (softpipe->fs == fs) - return; - - draw_flush(softpipe->draw); - - softpipe->fs = fs; - - draw_bind_fragment_shader(softpipe->draw, - (softpipe->fs ? softpipe->fs->draw_shader : NULL)); - - softpipe->dirty |= SP_NEW_FS; -} - - -void -softpipe_delete_fs_state(struct pipe_context *pipe, void *fs) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_fragment_shader *state = fs; - - assert(fs != softpipe_context(pipe)->fs); - - if (softpipe->fs_machine->Tokens == state->shader.tokens) { - /* unbind the shader from the tgsi executor if we're - * deleting it. - */ - tgsi_exec_machine_bind_shader(softpipe->fs_machine, NULL, 0, NULL); - } - - draw_delete_fragment_shader(softpipe->draw, state->draw_shader); - - state->delete( state ); -} - - -void * -softpipe_create_vs_state(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_vertex_shader *state; - - state = CALLOC_STRUCT(sp_vertex_shader); - if (state == NULL ) - goto fail; - - /* copy shader tokens, the ones passed in will go away. - */ - state->shader.tokens = tgsi_dup_tokens(templ->tokens); - if (state->shader.tokens == NULL) - goto fail; - - state->draw_data = draw_create_vertex_shader(softpipe->draw, templ); - if (state->draw_data == NULL) - goto fail; - - state->max_sampler = state->draw_data->info.file_max[TGSI_FILE_SAMPLER]; - - return state; - -fail: - if (state) { - FREE( (void *)state->shader.tokens ); - FREE( state->draw_data ); - FREE( state ); - } - return NULL; -} - - -void -softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - softpipe->vs = (struct sp_vertex_shader *) vs; - - draw_bind_vertex_shader(softpipe->draw, - (softpipe->vs ? softpipe->vs->draw_data : NULL)); - - softpipe->dirty |= SP_NEW_VS; -} - - -void -softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs; - - draw_delete_vertex_shader(softpipe->draw, state->draw_data); - FREE( (void *)state->shader.tokens ); - FREE( state ); -} - -void -softpipe_set_constant_buffer(struct pipe_context *pipe, - uint shader, uint index, - struct pipe_resource *constants) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - unsigned size = constants ? constants->width0 : 0; - const void *data = constants ? softpipe_resource(constants)->data : NULL; - - assert(shader < PIPE_SHADER_TYPES); - - draw_flush(softpipe->draw); - - /* note: reference counting */ - pipe_resource_reference(&softpipe->constants[shader][index], constants); - - if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { - draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size); - } - - softpipe->mapped_constants[shader][index] = data; - softpipe->const_buffer_size[shader][index] = size; - - softpipe->dirty |= SP_NEW_CONSTANTS; -} - - -void * -softpipe_create_gs_state(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_geometry_shader *state; - - state = CALLOC_STRUCT(sp_geometry_shader); - if (state == NULL ) - goto fail; - - /* debug */ - if (softpipe->dump_gs) - tgsi_dump(templ->tokens, 0); - - /* copy shader tokens, the ones passed in will go away. - */ - state->shader.tokens = tgsi_dup_tokens(templ->tokens); - if (state->shader.tokens == NULL) - goto fail; - - state->draw_data = draw_create_geometry_shader(softpipe->draw, templ); - if (state->draw_data == NULL) - goto fail; - - state->max_sampler = state->draw_data->info.file_max[TGSI_FILE_SAMPLER]; - - return state; - -fail: - if (state) { - FREE( (void *)state->shader.tokens ); - FREE( state->draw_data ); - FREE( state ); - } - return NULL; -} - - -void -softpipe_bind_gs_state(struct pipe_context *pipe, void *gs) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - softpipe->gs = (struct sp_geometry_shader *)gs; - - draw_bind_geometry_shader(softpipe->draw, - (softpipe->gs ? softpipe->gs->draw_data : NULL)); - - softpipe->dirty |= SP_NEW_GS; -} - - -void -softpipe_delete_gs_state(struct pipe_context *pipe, void *gs) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - struct sp_geometry_shader *state = - (struct sp_geometry_shader *)gs; - - draw_delete_geometry_shader(softpipe->draw, - (state) ? state->draw_data : 0); - FREE(state); -} diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c new file mode 100644 index 00000000000..50bc2eea5ff --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_state_shader.c @@ -0,0 +1,281 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#include "sp_context.h" +#include "sp_state.h" +#include "sp_fs.h" +#include "sp_texture.h" + +#include "pipe/p_defines.h" +#include "util/u_memory.h" +#include "util/u_inlines.h" +#include "draw/draw_context.h" +#include "draw/draw_vs.h" +#include "draw/draw_gs.h" +#include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_exec.h" +#include "tgsi/tgsi_scan.h" +#include "tgsi/tgsi_parse.h" + + +void * +softpipe_create_fs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct sp_fragment_shader *state; + unsigned i; + + /* debug */ + if (softpipe->dump_fs) + tgsi_dump(templ->tokens, 0); + + /* codegen */ + state = softpipe_create_fs_sse( softpipe, templ ); + if (!state) { + state = softpipe_create_fs_exec( softpipe, templ ); + } + + if (!state) + return NULL; + + /* draw's fs state */ + state->draw_shader = draw_create_fragment_shader(softpipe->draw, templ); + if (!state->draw_shader) { + state->delete( state ); + return NULL; + } + + /* get/save the summary info for this shader */ + tgsi_scan_shader(templ->tokens, &state->info); + + for (i = 0; i < state->info.num_properties; ++i) { + if (state->info.properties[i].name == TGSI_PROPERTY_FS_COORD_ORIGIN) + state->origin_lower_left = state->info.properties[i].data[0]; + else if (state->info.properties[i].name == TGSI_PROPERTY_FS_COORD_PIXEL_CENTER) + state->pixel_center_integer = state->info.properties[i].data[0]; + } + + return state; +} + + +void +softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + + draw_flush(softpipe->draw); + + if (softpipe->fs == fs) + return; + + draw_flush(softpipe->draw); + + softpipe->fs = fs; + + draw_bind_fragment_shader(softpipe->draw, + (softpipe->fs ? softpipe->fs->draw_shader : NULL)); + + softpipe->dirty |= SP_NEW_FS; +} + + +void +softpipe_delete_fs_state(struct pipe_context *pipe, void *fs) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct sp_fragment_shader *state = fs; + + assert(fs != softpipe_context(pipe)->fs); + + if (softpipe->fs_machine->Tokens == state->shader.tokens) { + /* unbind the shader from the tgsi executor if we're + * deleting it. + */ + tgsi_exec_machine_bind_shader(softpipe->fs_machine, NULL, 0, NULL); + } + + draw_delete_fragment_shader(softpipe->draw, state->draw_shader); + + state->delete( state ); +} + + +void * +softpipe_create_vs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct sp_vertex_shader *state; + + state = CALLOC_STRUCT(sp_vertex_shader); + if (state == NULL ) + goto fail; + + /* copy shader tokens, the ones passed in will go away. + */ + state->shader.tokens = tgsi_dup_tokens(templ->tokens); + if (state->shader.tokens == NULL) + goto fail; + + state->draw_data = draw_create_vertex_shader(softpipe->draw, templ); + if (state->draw_data == NULL) + goto fail; + + state->max_sampler = state->draw_data->info.file_max[TGSI_FILE_SAMPLER]; + + return state; + +fail: + if (state) { + FREE( (void *)state->shader.tokens ); + FREE( state->draw_data ); + FREE( state ); + } + return NULL; +} + + +void +softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + + softpipe->vs = (struct sp_vertex_shader *) vs; + + draw_bind_vertex_shader(softpipe->draw, + (softpipe->vs ? softpipe->vs->draw_data : NULL)); + + softpipe->dirty |= SP_NEW_VS; +} + + +void +softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + + struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs; + + draw_delete_vertex_shader(softpipe->draw, state->draw_data); + FREE( (void *)state->shader.tokens ); + FREE( state ); +} + +void +softpipe_set_constant_buffer(struct pipe_context *pipe, + uint shader, uint index, + struct pipe_resource *constants) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + unsigned size = constants ? constants->width0 : 0; + const void *data = constants ? softpipe_resource(constants)->data : NULL; + + assert(shader < PIPE_SHADER_TYPES); + + draw_flush(softpipe->draw); + + /* note: reference counting */ + pipe_resource_reference(&softpipe->constants[shader][index], constants); + + if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { + draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size); + } + + softpipe->mapped_constants[shader][index] = data; + softpipe->const_buffer_size[shader][index] = size; + + softpipe->dirty |= SP_NEW_CONSTANTS; +} + + +void * +softpipe_create_gs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct sp_geometry_shader *state; + + state = CALLOC_STRUCT(sp_geometry_shader); + if (state == NULL ) + goto fail; + + /* debug */ + if (softpipe->dump_gs) + tgsi_dump(templ->tokens, 0); + + /* copy shader tokens, the ones passed in will go away. + */ + state->shader.tokens = tgsi_dup_tokens(templ->tokens); + if (state->shader.tokens == NULL) + goto fail; + + state->draw_data = draw_create_geometry_shader(softpipe->draw, templ); + if (state->draw_data == NULL) + goto fail; + + state->max_sampler = state->draw_data->info.file_max[TGSI_FILE_SAMPLER]; + + return state; + +fail: + if (state) { + FREE( (void *)state->shader.tokens ); + FREE( state->draw_data ); + FREE( state ); + } + return NULL; +} + + +void +softpipe_bind_gs_state(struct pipe_context *pipe, void *gs) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + + softpipe->gs = (struct sp_geometry_shader *)gs; + + draw_bind_geometry_shader(softpipe->draw, + (softpipe->gs ? softpipe->gs->draw_data : NULL)); + + softpipe->dirty |= SP_NEW_GS; +} + + +void +softpipe_delete_gs_state(struct pipe_context *pipe, void *gs) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + + struct sp_geometry_shader *state = + (struct sp_geometry_shader *)gs; + + draw_delete_geometry_shader(softpipe->draw, + (state) ? state->draw_data : 0); + FREE(state); +} -- cgit v1.2.3 From 279b368dc34d8829bfd23b83af7f78e10e303f54 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 13:54:24 -0600 Subject: softpipe: make shader-related functions static --- src/gallium/drivers/softpipe/sp_context.c | 13 +--- src/gallium/drivers/softpipe/sp_state.h | 18 +----- src/gallium/drivers/softpipe/sp_state_shader.c | 90 ++++++++++++++++---------- 3 files changed, 58 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index a7c9959b3e1..a280879cc4d 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -246,17 +246,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state; - softpipe->pipe.create_fs_state = softpipe_create_fs_state; - softpipe->pipe.bind_fs_state = softpipe_bind_fs_state; - softpipe->pipe.delete_fs_state = softpipe_delete_fs_state; - - softpipe->pipe.create_vs_state = softpipe_create_vs_state; - softpipe->pipe.bind_vs_state = softpipe_bind_vs_state; - softpipe->pipe.delete_vs_state = softpipe_delete_vs_state; - - softpipe->pipe.create_gs_state = softpipe_create_gs_state; - softpipe->pipe.bind_gs_state = softpipe_bind_gs_state; - softpipe->pipe.delete_gs_state = softpipe_delete_gs_state; + softpipe_init_shader_funcs(&softpipe->pipe); softpipe->pipe.create_vertex_elements_state = softpipe_create_vertex_elements_state; softpipe->pipe.bind_vertex_elements_state = softpipe_bind_vertex_elements_state; @@ -270,7 +260,6 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref; softpipe->pipe.set_clip_state = softpipe_set_clip_state; softpipe->pipe.set_sample_mask = softpipe_set_sample_mask; - softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index c5d61f840f2..69243573f79 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -164,22 +164,8 @@ void softpipe_set_clip_state( struct pipe_context *, void softpipe_set_sample_mask( struct pipe_context *, unsigned sample_mask ); -void softpipe_set_constant_buffer(struct pipe_context *, - uint shader, uint index, - struct pipe_resource *buf); - -void *softpipe_create_fs_state(struct pipe_context *, - const struct pipe_shader_state *); -void softpipe_bind_fs_state(struct pipe_context *, void *); -void softpipe_delete_fs_state(struct pipe_context *, void *); -void *softpipe_create_vs_state(struct pipe_context *, - const struct pipe_shader_state *); -void softpipe_bind_vs_state(struct pipe_context *, void *); -void softpipe_delete_vs_state(struct pipe_context *, void *); -void *softpipe_create_gs_state(struct pipe_context *, - const struct pipe_shader_state *); -void softpipe_bind_gs_state(struct pipe_context *, void *); -void softpipe_delete_gs_state(struct pipe_context *, void *); +void +softpipe_init_shader_funcs(struct pipe_context *pipe); void *softpipe_create_vertex_elements_state(struct pipe_context *, unsigned count, diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c index 50bc2eea5ff..7fff338ccea 100644 --- a/src/gallium/drivers/softpipe/sp_state_shader.c +++ b/src/gallium/drivers/softpipe/sp_state_shader.c @@ -42,7 +42,7 @@ #include "tgsi/tgsi_parse.h" -void * +static void * softpipe_create_fs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { @@ -84,7 +84,7 @@ softpipe_create_fs_state(struct pipe_context *pipe, } -void +static void softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -105,7 +105,7 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) } -void +static void softpipe_delete_fs_state(struct pipe_context *pipe, void *fs) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -126,7 +126,7 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs) } -void * +static void * softpipe_create_vs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { @@ -161,7 +161,7 @@ fail: } -void +static void softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -175,7 +175,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) } -void +static void softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -187,34 +187,8 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) FREE( state ); } -void -softpipe_set_constant_buffer(struct pipe_context *pipe, - uint shader, uint index, - struct pipe_resource *constants) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - unsigned size = constants ? constants->width0 : 0; - const void *data = constants ? softpipe_resource(constants)->data : NULL; - - assert(shader < PIPE_SHADER_TYPES); - - draw_flush(softpipe->draw); - /* note: reference counting */ - pipe_resource_reference(&softpipe->constants[shader][index], constants); - - if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { - draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size); - } - - softpipe->mapped_constants[shader][index] = data; - softpipe->const_buffer_size[shader][index] = size; - - softpipe->dirty |= SP_NEW_CONSTANTS; -} - - -void * +static void * softpipe_create_gs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { @@ -253,7 +227,7 @@ fail: } -void +static void softpipe_bind_gs_state(struct pipe_context *pipe, void *gs) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -267,7 +241,7 @@ softpipe_bind_gs_state(struct pipe_context *pipe, void *gs) } -void +static void softpipe_delete_gs_state(struct pipe_context *pipe, void *gs) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -279,3 +253,49 @@ softpipe_delete_gs_state(struct pipe_context *pipe, void *gs) (state) ? state->draw_data : 0); FREE(state); } + + +static void +softpipe_set_constant_buffer(struct pipe_context *pipe, + uint shader, uint index, + struct pipe_resource *constants) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + unsigned size = constants ? constants->width0 : 0; + const void *data = constants ? softpipe_resource(constants)->data : NULL; + + assert(shader < PIPE_SHADER_TYPES); + + draw_flush(softpipe->draw); + + /* note: reference counting */ + pipe_resource_reference(&softpipe->constants[shader][index], constants); + + if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { + draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size); + } + + softpipe->mapped_constants[shader][index] = data; + softpipe->const_buffer_size[shader][index] = size; + + softpipe->dirty |= SP_NEW_CONSTANTS; +} + + +void +softpipe_init_shader_funcs(struct pipe_context *pipe) +{ + pipe->create_fs_state = softpipe_create_fs_state; + pipe->bind_fs_state = softpipe_bind_fs_state; + pipe->delete_fs_state = softpipe_delete_fs_state; + + pipe->create_vs_state = softpipe_create_vs_state; + pipe->bind_vs_state = softpipe_bind_vs_state; + pipe->delete_vs_state = softpipe_delete_vs_state; + + pipe->create_gs_state = softpipe_create_gs_state; + pipe->bind_gs_state = softpipe_bind_gs_state; + pipe->delete_gs_state = softpipe_delete_gs_state; + + pipe->set_constant_buffer = softpipe_set_constant_buffer; +} -- cgit v1.2.3 From 2739692a6edaa0233bac188855457236897a34d5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 13:58:41 -0600 Subject: softpipe: make blend/stencil/depth functions static --- src/gallium/drivers/softpipe/sp_context.c | 11 +---- src/gallium/drivers/softpipe/sp_state.h | 24 +---------- src/gallium/drivers/softpipe/sp_state_blend.c | 59 +++++++++++++++++++-------- 3 files changed, 44 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index a280879cc4d..e8daa81d119 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -228,9 +228,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.priv = priv; /* state setters */ - softpipe->pipe.create_blend_state = softpipe_create_blend_state; - softpipe->pipe.bind_blend_state = softpipe_bind_blend_state; - softpipe->pipe.delete_blend_state = softpipe_delete_blend_state; + softpipe_init_blend_funcs(&softpipe->pipe); softpipe->pipe.create_sampler_state = softpipe_create_sampler_state; softpipe->pipe.bind_fragment_sampler_states = softpipe_bind_sampler_states; @@ -238,10 +236,6 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.bind_geometry_sampler_states = softpipe_bind_geometry_sampler_states; softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state; - softpipe->pipe.create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state; - softpipe->pipe.bind_depth_stencil_alpha_state = softpipe_bind_depth_stencil_state; - softpipe->pipe.delete_depth_stencil_alpha_state = softpipe_delete_depth_stencil_state; - softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state; @@ -256,10 +250,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.bind_stream_output_state = softpipe_bind_stream_output_state; softpipe->pipe.delete_stream_output_state = softpipe_delete_stream_output_state; - softpipe->pipe.set_blend_color = softpipe_set_blend_color; - softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref; softpipe->pipe.set_clip_state = softpipe_set_clip_state; - softpipe->pipe.set_sample_mask = softpipe_set_sample_mask; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 69243573f79..1326f49fe99 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -115,13 +115,8 @@ struct sp_so_state { }; -void * -softpipe_create_blend_state(struct pipe_context *, - const struct pipe_blend_state *); -void softpipe_bind_blend_state(struct pipe_context *, - void *); -void softpipe_delete_blend_state(struct pipe_context *, - void *); +void +softpipe_init_blend_funcs(struct pipe_context *pipe); void * softpipe_create_sampler_state(struct pipe_context *, @@ -137,12 +132,6 @@ softpipe_bind_geometry_sampler_states(struct pipe_context *, void **samplers); void softpipe_delete_sampler_state(struct pipe_context *, void *); -void * -softpipe_create_depth_stencil_state(struct pipe_context *, - const struct pipe_depth_stencil_alpha_state *); -void softpipe_bind_depth_stencil_state(struct pipe_context *, void *); -void softpipe_delete_depth_stencil_state(struct pipe_context *, void *); - void * softpipe_create_rasterizer_state(struct pipe_context *, const struct pipe_rasterizer_state *); @@ -152,18 +141,9 @@ void softpipe_delete_rasterizer_state(struct pipe_context *, void *); void softpipe_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); -void softpipe_set_blend_color( struct pipe_context *pipe, - const struct pipe_blend_color *blend_color ); - -void softpipe_set_stencil_ref( struct pipe_context *pipe, - const struct pipe_stencil_ref *stencil_ref ); - void softpipe_set_clip_state( struct pipe_context *, const struct pipe_clip_state * ); -void softpipe_set_sample_mask( struct pipe_context *, - unsigned sample_mask ); - void softpipe_init_shader_funcs(struct pipe_context *pipe); diff --git a/src/gallium/drivers/softpipe/sp_state_blend.c b/src/gallium/drivers/softpipe/sp_state_blend.c index 2a203f44e50..12863824b8e 100644 --- a/src/gallium/drivers/softpipe/sp_state_blend.c +++ b/src/gallium/drivers/softpipe/sp_state_blend.c @@ -34,15 +34,17 @@ #include "sp_state.h" -void * +static void * softpipe_create_blend_state(struct pipe_context *pipe, const struct pipe_blend_state *blend) { return mem_dup(blend, sizeof(*blend)); } -void softpipe_bind_blend_state( struct pipe_context *pipe, - void *blend ) + +static void +softpipe_bind_blend_state(struct pipe_context *pipe, + void *blend) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -53,15 +55,18 @@ void softpipe_bind_blend_state( struct pipe_context *pipe, softpipe->dirty |= SP_NEW_BLEND; } -void softpipe_delete_blend_state(struct pipe_context *pipe, - void *blend) + +static void +softpipe_delete_blend_state(struct pipe_context *pipe, + void *blend) { FREE( blend ); } -void softpipe_set_blend_color( struct pipe_context *pipe, - const struct pipe_blend_color *blend_color ) +static void +softpipe_set_blend_color(struct pipe_context *pipe, + const struct pipe_blend_color *blend_color) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -73,19 +78,15 @@ void softpipe_set_blend_color( struct pipe_context *pipe, } -/** XXX move someday? Or consolidate all these simple state setters - * into one file. - */ - - -void * +static void * softpipe_create_depth_stencil_state(struct pipe_context *pipe, const struct pipe_depth_stencil_alpha_state *depth_stencil) { return mem_dup(depth_stencil, sizeof(*depth_stencil)); } -void + +static void softpipe_bind_depth_stencil_state(struct pipe_context *pipe, void *depth_stencil) { @@ -96,14 +97,17 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe, softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; } -void + +static void softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth) { FREE( depth ); } -void softpipe_set_stencil_ref( struct pipe_context *pipe, - const struct pipe_stencil_ref *stencil_ref ) + +static void +softpipe_set_stencil_ref(struct pipe_context *pipe, + const struct pipe_stencil_ref *stencil_ref) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -112,9 +116,28 @@ void softpipe_set_stencil_ref( struct pipe_context *pipe, softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; } -void + +static void softpipe_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask) { } + +void +softpipe_init_blend_funcs(struct pipe_context *pipe) +{ + pipe->create_blend_state = softpipe_create_blend_state; + pipe->bind_blend_state = softpipe_bind_blend_state; + pipe->delete_blend_state = softpipe_delete_blend_state; + + pipe->set_blend_color = softpipe_set_blend_color; + + pipe->create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state; + pipe->bind_depth_stencil_alpha_state = softpipe_bind_depth_stencil_state; + pipe->delete_depth_stencil_alpha_state = softpipe_delete_depth_stencil_state; + + pipe->set_stencil_ref = softpipe_set_stencil_ref; + + pipe->set_sample_mask = softpipe_set_sample_mask; +} -- cgit v1.2.3 From c5dd2e40e268e40335a47b86b7c4ce201e337a77 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 14:02:38 -0600 Subject: softpipe: make sampler state functions static --- src/gallium/drivers/softpipe/sp_context.c | 13 ++------ src/gallium/drivers/softpipe/sp_state.h | 36 ++-------------------- src/gallium/drivers/softpipe/sp_state_sampler.c | 41 ++++++++++++++++--------- 3 files changed, 31 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e8daa81d119..e7b6fc445d9 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -229,12 +229,7 @@ softpipe_create_context( struct pipe_screen *screen, /* state setters */ softpipe_init_blend_funcs(&softpipe->pipe); - - softpipe->pipe.create_sampler_state = softpipe_create_sampler_state; - softpipe->pipe.bind_fragment_sampler_states = softpipe_bind_sampler_states; - softpipe->pipe.bind_vertex_sampler_states = softpipe_bind_vertex_sampler_states; - softpipe->pipe.bind_geometry_sampler_states = softpipe_bind_geometry_sampler_states; - softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state; + softpipe_init_sampler_funcs(&softpipe->pipe); softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; @@ -254,11 +249,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; - softpipe->pipe.set_fragment_sampler_views = softpipe_set_sampler_views; - softpipe->pipe.set_vertex_sampler_views = softpipe_set_vertex_sampler_views; - softpipe->pipe.set_geometry_sampler_views = softpipe_set_geometry_sampler_views; - softpipe->pipe.create_sampler_view = softpipe_create_sampler_view; - softpipe->pipe.sampler_view_destroy = softpipe_sampler_view_destroy; + softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; softpipe->pipe.set_stream_output_buffers = softpipe_set_stream_output_buffers; softpipe->pipe.set_vertex_buffers = softpipe_set_vertex_buffers; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 1326f49fe99..8d4efb1c661 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -118,19 +118,9 @@ struct sp_so_state { void softpipe_init_blend_funcs(struct pipe_context *pipe); -void * -softpipe_create_sampler_state(struct pipe_context *, - const struct pipe_sampler_state *); -void softpipe_bind_sampler_states(struct pipe_context *, unsigned, void **); -void -softpipe_bind_vertex_sampler_states(struct pipe_context *, - unsigned num_samplers, - void **samplers); void -softpipe_bind_geometry_sampler_states(struct pipe_context *, - unsigned num_samplers, - void **samplers); -void softpipe_delete_sampler_state(struct pipe_context *, void *); +softpipe_init_sampler_funcs(struct pipe_context *pipe); + void * softpipe_create_rasterizer_state(struct pipe_context *, @@ -159,28 +149,6 @@ void softpipe_set_polygon_stipple( struct pipe_context *, void softpipe_set_scissor_state( struct pipe_context *, const struct pipe_scissor_state * ); -void softpipe_set_sampler_views( struct pipe_context *, - unsigned num, - struct pipe_sampler_view ** ); - -void -softpipe_set_vertex_sampler_views(struct pipe_context *, - unsigned num, - struct pipe_sampler_view **); - -void -softpipe_set_geometry_sampler_views(struct pipe_context *, - unsigned num, - struct pipe_sampler_view **); - -struct pipe_sampler_view * -softpipe_create_sampler_view(struct pipe_context *pipe, - struct pipe_resource *texture, - const struct pipe_sampler_view *templ); - -void -softpipe_sampler_view_destroy(struct pipe_context *pipe, - struct pipe_sampler_view *view); void softpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 1be5136f0ea..aedb5bb19b3 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -54,7 +54,7 @@ static struct sp_sampler *sp_sampler( struct pipe_sampler_state *sampler ) } -void * +static void * softpipe_create_sampler_state(struct pipe_context *pipe, const struct pipe_sampler_state *sampler) { @@ -67,7 +67,7 @@ softpipe_create_sampler_state(struct pipe_context *pipe, } -void +static void softpipe_bind_sampler_states(struct pipe_context *pipe, unsigned num, void **sampler) { @@ -94,7 +94,7 @@ softpipe_bind_sampler_states(struct pipe_context *pipe, } -void +static void softpipe_bind_vertex_sampler_states(struct pipe_context *pipe, unsigned num_samplers, void **samplers) @@ -125,7 +125,7 @@ softpipe_bind_vertex_sampler_states(struct pipe_context *pipe, softpipe->dirty |= SP_NEW_SAMPLER; } -void +static void softpipe_bind_geometry_sampler_states(struct pipe_context *pipe, unsigned num_samplers, void **samplers) @@ -153,7 +153,7 @@ softpipe_bind_geometry_sampler_states(struct pipe_context *pipe, } -struct pipe_sampler_view * +static struct pipe_sampler_view * softpipe_create_sampler_view(struct pipe_context *pipe, struct pipe_resource *resource, const struct pipe_sampler_view *templ) @@ -172,7 +172,7 @@ softpipe_create_sampler_view(struct pipe_context *pipe, } -void +static void softpipe_sampler_view_destroy(struct pipe_context *pipe, struct pipe_sampler_view *view) { @@ -181,7 +181,7 @@ softpipe_sampler_view_destroy(struct pipe_context *pipe, } -void +static void softpipe_set_sampler_views(struct pipe_context *pipe, unsigned num, struct pipe_sampler_view **views) @@ -211,7 +211,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe, } -void +static void softpipe_set_vertex_sampler_views(struct pipe_context *pipe, unsigned num, struct pipe_sampler_view **views) @@ -245,7 +245,8 @@ softpipe_set_vertex_sampler_views(struct pipe_context *pipe, softpipe->dirty |= SP_NEW_TEXTURE; } -void + +static void softpipe_set_geometry_sampler_views(struct pipe_context *pipe, unsigned num, struct pipe_sampler_view **views) @@ -327,8 +328,6 @@ get_sampler_varient( unsigned unit, } - - void softpipe_reset_sampler_varients(struct softpipe_context *softpipe) { @@ -403,9 +402,7 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) } } - - -void +static void softpipe_delete_sampler_state(struct pipe_context *pipe, void *sampler) { @@ -421,4 +418,20 @@ softpipe_delete_sampler_state(struct pipe_context *pipe, } +void +softpipe_init_sampler_funcs(struct pipe_context *pipe) +{ + pipe->create_sampler_state = softpipe_create_sampler_state; + pipe->bind_fragment_sampler_states = softpipe_bind_sampler_states; + pipe->bind_vertex_sampler_states = softpipe_bind_vertex_sampler_states; + pipe->bind_geometry_sampler_states = softpipe_bind_geometry_sampler_states; + pipe->delete_sampler_state = softpipe_delete_sampler_state; + + pipe->set_fragment_sampler_views = softpipe_set_sampler_views; + pipe->set_vertex_sampler_views = softpipe_set_vertex_sampler_views; + pipe->set_geometry_sampler_views = softpipe_set_geometry_sampler_views; + + pipe->create_sampler_view = softpipe_create_sampler_view; + pipe->sampler_view_destroy = softpipe_sampler_view_destroy; +} -- cgit v1.2.3 From eed4509b086828c6229a7b1865978ffa27377874 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 14:06:58 -0600 Subject: softpipe: make vertex state functions static --- src/gallium/drivers/softpipe/sp_context.c | 6 +----- src/gallium/drivers/softpipe/sp_state.h | 14 ++------------ src/gallium/drivers/softpipe/sp_state_vertex.c | 26 +++++++++++++++++++++----- 3 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e7b6fc445d9..ad8975a59d3 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -237,9 +237,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe_init_shader_funcs(&softpipe->pipe); - softpipe->pipe.create_vertex_elements_state = softpipe_create_vertex_elements_state; - softpipe->pipe.bind_vertex_elements_state = softpipe_bind_vertex_elements_state; - softpipe->pipe.delete_vertex_elements_state = softpipe_delete_vertex_elements_state; + softpipe_init_vertex_funcs(&softpipe->pipe); softpipe->pipe.create_stream_output_state = softpipe_create_stream_output_state; softpipe->pipe.bind_stream_output_state = softpipe_bind_stream_output_state; @@ -252,8 +250,6 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; softpipe->pipe.set_stream_output_buffers = softpipe_set_stream_output_buffers; - softpipe->pipe.set_vertex_buffers = softpipe_set_vertex_buffers; - softpipe->pipe.set_index_buffer = softpipe_set_index_buffer; softpipe->pipe.draw_vbo = softpipe_draw_vbo; softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 8d4efb1c661..62a9aaa46a8 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -137,11 +137,8 @@ void softpipe_set_clip_state( struct pipe_context *, void softpipe_init_shader_funcs(struct pipe_context *pipe); -void *softpipe_create_vertex_elements_state(struct pipe_context *, - unsigned count, - const struct pipe_vertex_element *); -void softpipe_bind_vertex_elements_state(struct pipe_context *, void *); -void softpipe_delete_vertex_elements_state(struct pipe_context *, void *); +void +softpipe_init_vertex_funcs(struct pipe_context *pipe); void softpipe_set_polygon_stipple( struct pipe_context *, const struct pipe_poly_stipple * ); @@ -153,13 +150,6 @@ void softpipe_set_scissor_state( struct pipe_context *, void softpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); -void softpipe_set_vertex_buffers(struct pipe_context *, - unsigned count, - const struct pipe_vertex_buffer *); - -void softpipe_set_index_buffer(struct pipe_context *, - const struct pipe_index_buffer *); - void softpipe_update_derived( struct softpipe_context *softpipe ); diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c index b650fcaea5c..7d8055f2baf 100644 --- a/src/gallium/drivers/softpipe/sp_state_vertex.c +++ b/src/gallium/drivers/softpipe/sp_state_vertex.c @@ -36,7 +36,7 @@ #include "draw/draw_context.h" -void * +static void * softpipe_create_vertex_elements_state(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_element *attribs) @@ -51,7 +51,8 @@ softpipe_create_vertex_elements_state(struct pipe_context *pipe, return velems; } -void + +static void softpipe_bind_vertex_elements_state(struct pipe_context *pipe, void *velems) { @@ -66,13 +67,15 @@ softpipe_bind_vertex_elements_state(struct pipe_context *pipe, draw_set_vertex_elements(softpipe->draw, sp_velems->count, sp_velems->velem); } -void + +static void softpipe_delete_vertex_elements_state(struct pipe_context *pipe, void *velems) { FREE( velems ); } -void + +static void softpipe_set_vertex_buffers(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_buffer *buffers) @@ -89,7 +92,8 @@ softpipe_set_vertex_buffers(struct pipe_context *pipe, draw_set_vertex_buffers(softpipe->draw, count, buffers); } -void + +static void softpipe_set_index_buffer(struct pipe_context *pipe, const struct pipe_index_buffer *ib) { @@ -102,3 +106,15 @@ softpipe_set_index_buffer(struct pipe_context *pipe, draw_set_index_buffer(softpipe->draw, ib); } + + +void +softpipe_init_vertex_funcs(struct pipe_context *pipe) +{ + pipe->create_vertex_elements_state = softpipe_create_vertex_elements_state; + pipe->bind_vertex_elements_state = softpipe_bind_vertex_elements_state; + pipe->delete_vertex_elements_state = softpipe_delete_vertex_elements_state; + + pipe->set_vertex_buffers = softpipe_set_vertex_buffers; + pipe->set_index_buffer = softpipe_set_index_buffer; +} -- cgit v1.2.3 From bd13a0d282d5468c083d06f4443dfaf375e01dda Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 14:08:49 -0600 Subject: softpipe: make rasterizer state functions static --- src/gallium/drivers/softpipe/sp_context.c | 7 +------ src/gallium/drivers/softpipe/sp_state.h | 7 ++----- src/gallium/drivers/softpipe/sp_state_rasterizer.c | 21 ++++++++++++++++----- 3 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index ad8975a59d3..346b56aab49 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -229,14 +229,9 @@ softpipe_create_context( struct pipe_screen *screen, /* state setters */ softpipe_init_blend_funcs(&softpipe->pipe); + softpipe_init_rasterizer_funcs(&softpipe->pipe); softpipe_init_sampler_funcs(&softpipe->pipe); - - softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; - softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; - softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state; - softpipe_init_shader_funcs(&softpipe->pipe); - softpipe_init_vertex_funcs(&softpipe->pipe); softpipe->pipe.create_stream_output_state = softpipe_create_stream_output_state; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 62a9aaa46a8..8c539ca25f6 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -121,12 +121,9 @@ softpipe_init_blend_funcs(struct pipe_context *pipe); void softpipe_init_sampler_funcs(struct pipe_context *pipe); +void +softpipe_init_rasterizer_funcs(struct pipe_context *pipe); -void * -softpipe_create_rasterizer_state(struct pipe_context *, - const struct pipe_rasterizer_state *); -void softpipe_bind_rasterizer_state(struct pipe_context *, void *); -void softpipe_delete_rasterizer_state(struct pipe_context *, void *); void softpipe_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); diff --git a/src/gallium/drivers/softpipe/sp_state_rasterizer.c b/src/gallium/drivers/softpipe/sp_state_rasterizer.c index c9ede09f268..3cd4acd7432 100644 --- a/src/gallium/drivers/softpipe/sp_state_rasterizer.c +++ b/src/gallium/drivers/softpipe/sp_state_rasterizer.c @@ -33,15 +33,17 @@ -void * +static void * softpipe_create_rasterizer_state(struct pipe_context *pipe, const struct pipe_rasterizer_state *rast) { return mem_dup(rast, sizeof(*rast)); } -void softpipe_bind_rasterizer_state(struct pipe_context *pipe, - void *rasterizer) + +static void +softpipe_bind_rasterizer_state(struct pipe_context *pipe, + void *rasterizer) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -56,10 +58,19 @@ void softpipe_bind_rasterizer_state(struct pipe_context *pipe, softpipe->dirty |= SP_NEW_RASTERIZER; } -void softpipe_delete_rasterizer_state(struct pipe_context *pipe, - void *rasterizer) + +static void +softpipe_delete_rasterizer_state(struct pipe_context *pipe, + void *rasterizer) { FREE( rasterizer ); } +void +softpipe_init_rasterizer_funcs(struct pipe_context *pipe) +{ + pipe->create_rasterizer_state = softpipe_create_rasterizer_state; + pipe->bind_rasterizer_state = softpipe_bind_rasterizer_state; + pipe->delete_rasterizer_state = softpipe_delete_rasterizer_state; +} -- cgit v1.2.3 From 5b2406c0b9069363259a3d4b9486b081be5ade03 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 14:12:12 -0600 Subject: softpipe: make stream out state functions static --- src/gallium/drivers/softpipe/sp_context.c | 6 +----- src/gallium/drivers/softpipe/sp_state.h | 18 +++--------------- src/gallium/drivers/softpipe/sp_state_so.c | 24 ++++++++++++++++++++---- 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 346b56aab49..c2b35942021 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -232,19 +232,15 @@ softpipe_create_context( struct pipe_screen *screen, softpipe_init_rasterizer_funcs(&softpipe->pipe); softpipe_init_sampler_funcs(&softpipe->pipe); softpipe_init_shader_funcs(&softpipe->pipe); + softpipe_init_streamout_funcs(&softpipe->pipe); softpipe_init_vertex_funcs(&softpipe->pipe); - softpipe->pipe.create_stream_output_state = softpipe_create_stream_output_state; - softpipe->pipe.bind_stream_output_state = softpipe_bind_stream_output_state; - softpipe->pipe.delete_stream_output_state = softpipe_delete_stream_output_state; - softpipe->pipe.set_clip_state = softpipe_set_clip_state; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; - softpipe->pipe.set_stream_output_buffers = softpipe_set_stream_output_buffers; softpipe->pipe.draw_vbo = softpipe_draw_vbo; softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 8c539ca25f6..d6a435d2de3 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -124,6 +124,9 @@ softpipe_init_sampler_funcs(struct pipe_context *pipe); void softpipe_init_rasterizer_funcs(struct pipe_context *pipe); +void +softpipe_init_streamout_funcs(struct pipe_context *pipe); + void softpipe_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); @@ -176,20 +179,5 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe); struct vertex_info * softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe); -void * -softpipe_create_stream_output_state( - struct pipe_context *pipe, - const struct pipe_stream_output_state *templ); -void -softpipe_bind_stream_output_state(struct pipe_context *pipe, - void *so); -void -softpipe_delete_stream_output_state(struct pipe_context *pipe, void *so); - -void -softpipe_set_stream_output_buffers(struct pipe_context *pipe, - struct pipe_resource **buffers, - int *offsets, - int num_buffers); #endif diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c index cfe23f9e846..ddfa3ef765a 100644 --- a/src/gallium/drivers/softpipe/sp_state_so.c +++ b/src/gallium/drivers/softpipe/sp_state_so.c @@ -34,7 +34,7 @@ #include "draw/draw_context.h" -void * +static void * softpipe_create_stream_output_state(struct pipe_context *pipe, const struct pipe_stream_output_state *templ) { @@ -57,7 +57,8 @@ softpipe_create_stream_output_state(struct pipe_context *pipe, return so; } -void + +static void softpipe_bind_stream_output_state(struct pipe_context *pipe, void *so) { @@ -72,13 +73,15 @@ softpipe_bind_stream_output_state(struct pipe_context *pipe, draw_set_so_state(softpipe->draw, &sp_so->base); } -void + +static void softpipe_delete_stream_output_state(struct pipe_context *pipe, void *so) { FREE( so ); } -void + +static void softpipe_set_stream_output_buffers(struct pipe_context *pipe, struct pipe_resource **buffers, int *offsets, @@ -122,3 +125,16 @@ softpipe_set_stream_output_buffers(struct pipe_context *pipe, draw_set_mapped_so_buffers(softpipe->draw, map_buffers, num_buffers); } + + + +void +softpipe_init_streamout_funcs(struct pipe_context *pipe) +{ + pipe->create_stream_output_state = softpipe_create_stream_output_state; + pipe->bind_stream_output_state = softpipe_bind_stream_output_state; + pipe->delete_stream_output_state = softpipe_delete_stream_output_state; + + pipe->set_stream_output_buffers = softpipe_set_stream_output_buffers; +} + -- cgit v1.2.3 From 63a5b7d7cc92bd7b670e02225f355ed2f8341022 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 14:15:11 -0600 Subject: softpipe: make clip state functions static --- src/gallium/drivers/softpipe/sp_context.c | 6 +----- src/gallium/drivers/softpipe/sp_state.h | 16 +++------------ src/gallium/drivers/softpipe/sp_state_clip.c | 30 ++++++++++++++++++++-------- 3 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index c2b35942021..36aa8546efd 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -229,18 +229,14 @@ softpipe_create_context( struct pipe_screen *screen, /* state setters */ softpipe_init_blend_funcs(&softpipe->pipe); + softpipe_init_clip_funcs(&softpipe->pipe); softpipe_init_rasterizer_funcs(&softpipe->pipe); softpipe_init_sampler_funcs(&softpipe->pipe); softpipe_init_shader_funcs(&softpipe->pipe); softpipe_init_streamout_funcs(&softpipe->pipe); softpipe_init_vertex_funcs(&softpipe->pipe); - softpipe->pipe.set_clip_state = softpipe_set_clip_state; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; - softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; - softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; - - softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; softpipe->pipe.draw_vbo = softpipe_draw_vbo; softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index d6a435d2de3..a7dcde28a89 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -118,6 +118,9 @@ struct sp_so_state { void softpipe_init_blend_funcs(struct pipe_context *pipe); +void +softpipe_init_clip_funcs(struct pipe_context *pipe); + void softpipe_init_sampler_funcs(struct pipe_context *pipe); @@ -131,25 +134,12 @@ softpipe_init_streamout_funcs(struct pipe_context *pipe); void softpipe_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); -void softpipe_set_clip_state( struct pipe_context *, - const struct pipe_clip_state * ); - void softpipe_init_shader_funcs(struct pipe_context *pipe); void softpipe_init_vertex_funcs(struct pipe_context *pipe); -void softpipe_set_polygon_stipple( struct pipe_context *, - const struct pipe_poly_stipple * ); - -void softpipe_set_scissor_state( struct pipe_context *, - const struct pipe_scissor_state * ); - - -void softpipe_set_viewport_state( struct pipe_context *, - const struct pipe_viewport_state * ); - void softpipe_update_derived( struct softpipe_context *softpipe ); diff --git a/src/gallium/drivers/softpipe/sp_state_clip.c b/src/gallium/drivers/softpipe/sp_state_clip.c index 4946c776e3e..f3a4c234e27 100644 --- a/src/gallium/drivers/softpipe/sp_state_clip.c +++ b/src/gallium/drivers/softpipe/sp_state_clip.c @@ -32,8 +32,9 @@ #include "draw/draw_context.h" -void softpipe_set_clip_state( struct pipe_context *pipe, - const struct pipe_clip_state *clip ) +static void +softpipe_set_clip_state(struct pipe_context *pipe, + const struct pipe_clip_state *clip) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -42,8 +43,9 @@ void softpipe_set_clip_state( struct pipe_context *pipe, } -void softpipe_set_viewport_state( struct pipe_context *pipe, - const struct pipe_viewport_state *viewport ) +static void +softpipe_set_viewport_state(struct pipe_context *pipe, + const struct pipe_viewport_state *viewport) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -55,8 +57,9 @@ void softpipe_set_viewport_state( struct pipe_context *pipe, } -void softpipe_set_scissor_state( struct pipe_context *pipe, - const struct pipe_scissor_state *scissor ) +static void +softpipe_set_scissor_state(struct pipe_context *pipe, + const struct pipe_scissor_state *scissor) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -67,8 +70,9 @@ void softpipe_set_scissor_state( struct pipe_context *pipe, } -void softpipe_set_polygon_stipple( struct pipe_context *pipe, - const struct pipe_poly_stipple *stipple ) +static void +softpipe_set_polygon_stipple(struct pipe_context *pipe, + const struct pipe_poly_stipple *stipple) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -77,3 +81,13 @@ void softpipe_set_polygon_stipple( struct pipe_context *pipe, softpipe->poly_stipple = *stipple; /* struct copy */ softpipe->dirty |= SP_NEW_STIPPLE; } + + +void +softpipe_init_clip_funcs(struct pipe_context *pipe) +{ + pipe->set_clip_state = softpipe_set_clip_state; + pipe->set_viewport_state = softpipe_set_viewport_state; + pipe->set_scissor_state = softpipe_set_scissor_state; + pipe->set_polygon_stipple = softpipe_set_polygon_stipple; +} -- cgit v1.2.3 From 1e35f6472df3341aca4d62eb3a3210603701c285 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 25 Sep 2010 14:19:18 -0600 Subject: softpipe: minor asst. clean-ups --- src/gallium/drivers/softpipe/sp_context.c | 5 ++--- src/gallium/drivers/softpipe/sp_state.h | 18 +++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 36aa8546efd..b5d30bc6fc9 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -230,10 +230,12 @@ softpipe_create_context( struct pipe_screen *screen, /* state setters */ softpipe_init_blend_funcs(&softpipe->pipe); softpipe_init_clip_funcs(&softpipe->pipe); + softpipe_init_query_funcs( softpipe ); softpipe_init_rasterizer_funcs(&softpipe->pipe); softpipe_init_sampler_funcs(&softpipe->pipe); softpipe_init_shader_funcs(&softpipe->pipe); softpipe_init_streamout_funcs(&softpipe->pipe); + softpipe_init_texture_funcs( &softpipe->pipe ); softpipe_init_vertex_funcs(&softpipe->pipe); softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; @@ -246,9 +248,6 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.is_resource_referenced = softpipe_is_resource_referenced; - softpipe_init_query_funcs( softpipe ); - softpipe_init_texture_funcs( &softpipe->pipe ); - softpipe->pipe.render_condition = softpipe_render_condition; /* diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index a7dcde28a89..525bf23734a 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -128,27 +128,27 @@ void softpipe_init_rasterizer_funcs(struct pipe_context *pipe); void -softpipe_init_streamout_funcs(struct pipe_context *pipe); - - -void softpipe_set_framebuffer_state( struct pipe_context *, - const struct pipe_framebuffer_state * ); +softpipe_init_shader_funcs(struct pipe_context *pipe); void -softpipe_init_shader_funcs(struct pipe_context *pipe); +softpipe_init_streamout_funcs(struct pipe_context *pipe); void softpipe_init_vertex_funcs(struct pipe_context *pipe); +void +softpipe_set_framebuffer_state(struct pipe_context *, + const struct pipe_framebuffer_state *); -void softpipe_update_derived( struct softpipe_context *softpipe ); - +void +softpipe_update_derived( struct softpipe_context *softpipe ); void softpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info); -void softpipe_draw_stream_output(struct pipe_context *pipe, unsigned mode); +void +softpipe_draw_stream_output(struct pipe_context *pipe, unsigned mode); void softpipe_map_transfers(struct softpipe_context *sp); -- cgit v1.2.3 From 522e994a22e8b46c8a41f2920af88c5ebad43cd8 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 24 Sep 2010 22:14:43 -0700 Subject: r300/compiler: Fix two mistakes in the presubtract optimization pass. 1. We can't turn an instruction into a presubtract operation if it writes to one of the registers it reads from. 2. If we turn an instruction into a presubtract operation, we can't remove that intruction unless all readers can use the presubtract operation. This fixes fdo bug 30337. This is a candidate for the 7.9 branch. --- .../drivers/dri/r300/compiler/radeon_optimize.c | 45 +++++++++++++++------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index c15a9b1c451..e2889302e69 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -475,8 +475,8 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * } /** - * This function returns a writemask that indicates wich components are - * read by src and also written by dst. + * If src and dst use the same register, this function returns a writemask that + * indicates wich components are read by src. Otherwise zero is returned. */ static unsigned int src_reads_dst_mask(struct rc_src_register src, struct rc_dst_register dst) @@ -563,10 +563,18 @@ static int presub_helper( * s->Inst->U.I.DstReg, because if it does we must not * remove s->Inst. */ for(i = 0; i < info->NumSrcRegs; i++) { - if(s->Inst->U.I.DstReg.WriteMask != - src_reads_dst_mask(inst->U.I.SrcReg[i], - s->Inst->U.I.DstReg)) { - continue; + unsigned int mask = src_reads_dst_mask( + inst->U.I.SrcReg[i], s->Inst->U.I.DstReg); + /* XXX We could be more aggressive here using + * presubtract. It is okay if SrcReg[i] only reads + * from some of the mask components. */ + if(s->Inst->U.I.DstReg.WriteMask != mask) { + if (s->Inst->U.I.DstReg.WriteMask & mask) { + can_remove = 0; + break; + } else { + continue; + } } if (cant_sub || !can_use_presub) { can_remove = 0; @@ -626,6 +634,21 @@ static void presub_replace_add(struct peephole_state *s, inst->U.I.SrcReg[src_index].Index = presub_opcode; } +static int is_presub_candidate(struct rc_instruction * inst) +{ + const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode); + unsigned int i; + + if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE || inst->U.I.SaturateMode) + return 0; + + for(i = 0; i < info->NumSrcRegs; i++) { + if (src_reads_dst_mask(inst->U.I.SrcReg[i], inst->U.I.DstReg)) + return 0; + } + return 1; +} + static int peephole_add_presub_add( struct radeon_compiler * c, struct rc_instruction * inst_add) @@ -635,10 +658,7 @@ static int peephole_add_presub_add( unsigned int i; struct peephole_state s; - if (inst_add->U.I.PreSub.Opcode != RC_PRESUB_NONE) - return 0; - - if (inst_add->U.I.SaturateMode) + if (!is_presub_candidate(inst_add)) return 0; if (inst_add->U.I.SrcReg[0].Swizzle != inst_add->U.I.SrcReg[1].Swizzle) @@ -705,10 +725,7 @@ static int peephole_add_presub_inv( unsigned int i, swz, mask; struct peephole_state s; - if (inst_add->U.I.PreSub.Opcode != RC_PRESUB_NONE) - return 0; - - if (inst_add->U.I.SaturateMode) + if (!is_presub_candidate(inst_add)) return 0; mask = inst_add->U.I.DstReg.WriteMask; -- cgit v1.2.3 From 048bda175b07d48cd8660eb43b37af5ac8a732d2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 25 Sep 2010 15:19:29 -0700 Subject: r600g: Remove unused variable. Fixes this GCC warning. radeon_bo_pb.c: In function 'radeon_bo_pb_create_buffer': radeon_bo_pb.c:178: warning: unused variable 'domain' --- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 897938c2caf..aac3d7b6049 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -175,7 +175,6 @@ radeon_bo_pb_create_buffer(struct pb_manager *_mgr, struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr); struct radeon *radeon = mgr->radeon; struct radeon_bo_pb *bo; - uint32_t domain; bo = CALLOC_STRUCT(radeon_bo_pb); if (!bo) -- cgit v1.2.3 From 81b7de5bf039ecefe104f9892e2bdeaee71e40c6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 26 Sep 2010 17:38:11 +1000 Subject: r300g: fix glsl-fs-pointcoord Move GB_ENABLE to derived rs state, and find sprite coord for the correct generic and enable the tex coord for that generic. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_context.h | 5 ++++- src/gallium/drivers/r300/r300_emit.c | 4 +++- src/gallium/drivers/r300/r300_state.c | 19 +++---------------- src/gallium/drivers/r300/r300_state_derived.c | 23 ++++++++++++++++++----- 4 files changed, 28 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 8f4e2de02d1..1927370325e 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -125,6 +125,8 @@ struct r300_gpu_flush { uint32_t cb_flush_clean[6]; }; +#define RS_STATE_MAIN_SIZE 23 + struct r300_rs_state { /* Original rasterizer state. */ struct pipe_rasterizer_state rs; @@ -132,7 +134,7 @@ struct r300_rs_state { struct pipe_rasterizer_state rs_draw; /* Command buffers. */ - uint32_t cb_main[25]; + uint32_t cb_main[RS_STATE_MAIN_SIZE]; uint32_t cb_poly_offset_zb16[5]; uint32_t cb_poly_offset_zb24[5]; @@ -150,6 +152,7 @@ struct r300_rs_block { uint32_t vap_vtx_state_cntl; /* R300_VAP_VTX_STATE_CNTL: 0x2180 */ uint32_t vap_vsm_vtx_assm; /* R300_VAP_VSM_VTX_ASSM: 0x2184 */ uint32_t vap_out_vtx_fmt[2]; /* R300_VAP_OUTPUT_VTX_FMT_[0-1]: 0x2090 */ + uint32_t gb_enable; uint32_t ip[8]; /* R300_RS_IP_[0-7], R500_RS_IP_[0-7] */ uint32_t count; /* R300_RS_COUNT */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b2b34c3efcb..db783ff0add 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -667,7 +667,7 @@ void r300_emit_rs_state(struct r300_context* r300, unsigned size, void* state) CS_LOCALS(r300); BEGIN_CS(size); - OUT_CS_TABLE(rs->cb_main, 25); + OUT_CS_TABLE(rs->cb_main, RS_STATE_MAIN_SIZE); if (rs->polygon_offset_enable) { if (r300->zbuffer_bpp == 16) { OUT_CS_TABLE(rs->cb_poly_offset_zb16, 5); @@ -709,6 +709,8 @@ void r300_emit_rs_block_state(struct r300_context* r300, OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2); OUT_CS(rs->vap_out_vtx_fmt[0]); OUT_CS(rs->vap_out_vtx_fmt[1]); + OUT_CS_REG_SEQ(R300_GB_ENABLE, 1); + OUT_CS(rs->gb_enable); if (r300->screen->caps.is_r500) { OUT_CS_REG_SEQ(R500_RS_IP_0, count); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index ad3282a4e6b..cfb0a85243e 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -935,10 +935,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe, uint32_t polygon_mode; /* R300_GA_POLY_MODE: 0x4288 */ uint32_t clip_rule; /* R300_SC_CLIP_RULE: 0x43D0 */ - /* Specifies top of Raster pipe specific enable controls, - * i.e. texture coordinates stuffing for points, lines, triangles */ - uint32_t stuffing_enable; /* R300_GB_ENABLE: 0x4008 */ - /* Point sprites texture coordinates, 0: lower left, 1: upper right */ float point_texcoord_left = 0; /* R300_GA_POINT_S0: 0x4200 */ float point_texcoord_bottom = 0;/* R300_GA_POINT_T0: 0x4204 */ @@ -1052,16 +1048,8 @@ static void* r300_create_rs_state(struct pipe_context* pipe, clip_rule = state->scissor ? 0xAAAA : 0xFFFF; - /* Point sprites */ - stuffing_enable = 0; + /* Point sprites coord mode */ if (rs->rs.sprite_coord_enable) { - stuffing_enable = R300_GB_POINT_STUFF_ENABLE; - for (i = 0; i < 8; i++) { - if (rs->rs.sprite_coord_enable & (1 << i)) - stuffing_enable |= - R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (i*2)); - } - switch (state->sprite_coord_mode) { case PIPE_SPRITE_COORD_UPPER_LEFT: point_texcoord_top = 0.0f; @@ -1075,7 +1063,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe, } /* Build the main command buffer. */ - BEGIN_CB(rs->cb_main, 25); + BEGIN_CB(rs->cb_main, RS_STATE_MAIN_SIZE); OUT_CB_REG(R300_VAP_CNTL_STATUS, vap_control_status); OUT_CB_REG(R300_GA_POINT_SIZE, point_size); OUT_CB_REG_SEQ(R300_GA_POINT_MINMAX, 2); @@ -1089,7 +1077,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe, OUT_CB_REG(R300_GA_LINE_STIPPLE_VALUE, line_stipple_value); OUT_CB_REG(R300_GA_POLY_MODE, polygon_mode); OUT_CB_REG(R300_SC_CLIP_RULE, clip_rule); - OUT_CB_REG(R300_GB_ENABLE, stuffing_enable); OUT_CB_REG_SEQ(R300_GA_POINT_S0, 4); OUT_CB_32F(point_texcoord_left); OUT_CB_32F(point_texcoord_bottom); @@ -1147,7 +1134,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) } UPDATE_STATE(state, r300->rs_state); - r300->rs_state.size = 25 + (r300->polygon_offset_enabled ? 5 : 0); + r300->rs_state.size = RS_STATE_MAIN_SIZE + (r300->polygon_offset_enabled ? 5 : 0); if (last_sprite_coord_enable != r300->sprite_coord_enable || last_two_sided_color != r300->two_sided_color) { diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 0c3fa200c82..7b7f59a9a62 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -324,6 +324,7 @@ static void r300_update_rs_block(struct r300_context *r300) boolean any_bcolor_used = vs_outputs->bcolor[0] != ATTR_UNUSED || vs_outputs->bcolor[1] != ATTR_UNUSED; int *stream_loc_notcl = r300->stream_loc_notcl; + uint32_t stuffing_enable = 0; if (r300->screen->caps.is_r500) { rX00_rs_col = r500_rs_col; @@ -436,7 +437,11 @@ static void r300_update_rs_block(struct r300_context *r300) /* Rasterize texture coordinates. */ for (i = 0; i < ATTR_GENERIC_COUNT && tex_count < 8; i++) { - bool sprite_coord = !!(r300->sprite_coord_enable & (1 << i)); + bool sprite_coord = false; + + if (fs_inputs->generic[i] != ATTR_UNUSED) { + sprite_coord = !!(r300->sprite_coord_enable & (1 << i)); + } if (vs_outputs->generic[i] != ATTR_UNUSED || sprite_coord) { if (!sprite_coord) { @@ -444,7 +449,9 @@ static void r300_update_rs_block(struct r300_context *r300) rs.vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << tex_count); rs.vap_out_vtx_fmt[1] |= (4 << (3 * tex_count)); stream_loc_notcl[loc++] = 6 + tex_count; - } + } else + stuffing_enable |= + R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (tex_count*2)); /* Rasterize it. */ rX00_rs_tex(&rs, tex_count, tex_ptr, @@ -456,8 +463,8 @@ static void r300_update_rs_block(struct r300_context *r300) fp_offset++; DBG(r300, DBG_RS, - "r300: Rasterized generic %i written to FS%s.\n", - i, sprite_coord ? " (sprite coord)" : ""); + "r300: Rasterized generic %i written to FS%s in texcoord %d.\n", + i, sprite_coord ? " (sprite coord)" : "", tex_count); } else { DBG(r300, DBG_RS, "r300: Rasterized generic %i unused%s.\n", @@ -560,10 +567,16 @@ static void r300_update_rs_block(struct r300_context *r300) count = MAX3(col_count, tex_count, 1); rs.inst_count = count - 1; + /* set the GB enable flags */ + if (r300->sprite_coord_enable) + stuffing_enable |= R300_GB_POINT_STUFF_ENABLE; + + rs.gb_enable = stuffing_enable; + /* Now, after all that, see if we actually need to update the state. */ if (memcmp(r300->rs_block_state.state, &rs, sizeof(struct r300_rs_block))) { memcpy(r300->rs_block_state.state, &rs, sizeof(struct r300_rs_block)); - r300->rs_block_state.size = 11 + count*2; + r300->rs_block_state.size = 13 + count*2; } } -- cgit v1.2.3 From 4743c7fbe766624889411f71ebfec87e09c6e21b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 26 Sep 2010 03:08:14 -0700 Subject: r300g: Remove unused variable. Fixes this GCC warning. r300_state.c: In function 'r300_create_rs_state': r300_state.c:925: warning: unused variable 'i' --- src/gallium/drivers/r300/r300_state.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index cfb0a85243e..f2479a994c8 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -922,7 +922,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe, const struct pipe_rasterizer_state* state) { struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state); - int i; float psiz; uint32_t vap_control_status; /* R300_VAP_CNTL_STATUS: 0x2140 */ uint32_t point_size; /* R300_GA_POINT_SIZE: 0x421c */ -- cgit v1.2.3 From 51bfd4e34a259243ce60915944d2c37204934620 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 26 Sep 2010 03:10:58 -0700 Subject: r600g: Don't return a value in function returning void. Fixes this GCC warning. radeon_state.c: In function 'radeon_state_fini': radeon_state.c:140: warning: 'return' with a value, in function returning void --- src/gallium/winsys/r600/drm/radeon_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index b237b39c2b1..c7aa73c8d4e 100644 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ b/src/gallium/winsys/r600/drm/radeon_state.c @@ -137,7 +137,7 @@ void radeon_state_fini(struct radeon_state *state) unsigned i; if (state == NULL) - return NULL; + return; for (i = 0; i < state->nbo; i++) { radeon_ws_bo_reference(state->radeon, &state->bo[i], NULL); } -- cgit v1.2.3 From 15f16328be41a5804151c30866a2bc329fc4369a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 26 Sep 2010 03:18:12 -0700 Subject: r600g: Remove unused variables. Fixes these GCC warnings. radeon.c: In function 'radeon_new': radeon.c:59: warning: unused variable 'k' radeon.c:59: warning: unused variable 'j' radeon.c:59: warning: unused variable 'id' radeon.c:59: warning: unused variable 'i' --- src/gallium/winsys/r600/drm/radeon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index c3d345fef92..f7e3e354de1 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -56,7 +56,7 @@ static int radeon_get_device(struct radeon *radeon) struct radeon *radeon_new(int fd, unsigned device) { struct radeon *radeon; - int r, i, id, j, k; + int r; radeon = calloc(1, sizeof(*radeon)); if (radeon == NULL) { -- cgit v1.2.3 From 6f16e497af9bf5938541d2088e91cc79f1641a19 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 26 Sep 2010 03:23:31 -0700 Subject: r600g: Include p_compiler.h instead of malloc.h. --- src/gallium/winsys/r600/drm/radeon_ws_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c index daaf2cbc51a..4a64be23a28 100644 --- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c @@ -1,4 +1,4 @@ -#include +#include #include #include #include "radeon_priv.h" -- cgit v1.2.3 From a852615946b98de2d832d4907f09649803577db7 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 26 Sep 2010 12:06:46 -0400 Subject: r600g: disable early cull optimization when occlusion query running When occlusion query are running we want to have accurate fragment count thus disable any early culling optimization GPU has. Based on work from Bas Nieuwenhuizen Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 1 + src/gallium/winsys/r600/drm/evergreen_state.c | 13 +++++++++++++ src/gallium/winsys/r600/drm/r600_priv.h | 21 +++++++++++++++++++++ src/gallium/winsys/r600/drm/r600_state2.c | 16 ++++++++++++++++ src/gallium/winsys/r600/drm/r600d.h | 10 ++++++++++ 5 files changed, 61 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 65b029b065f..17d34409dc4 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -246,6 +246,7 @@ struct r600_context { struct radeon_bo **bo; u32 *pm4; struct list_head query_list; + unsigned num_query_running; }; struct r600_draw { diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index f2038638d6b..860c836e858 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -75,6 +75,7 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_009100_SPI_CONFIG_CNTL}, {0, 0, R_00913C_SPI_CONFIG_CNTL_1}, {0, 0, R_028000_DB_RENDER_CONTROL}, + {0, 0, R_028004_DB_COUNT_CONTROL}, {0, 0, R_028008_DB_DEPTH_VIEW}, {0, 0, R_02800C_DB_RENDER_OVERRIDE}, {0, 0, R_028010_DB_RENDER_OVERRIDE2}, @@ -589,6 +590,18 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } } + /* queries need some special values */ + if (ctx->num_query_running) { + r600_context_reg(ctx, R600_GROUP_CONTEXT, + R_028004_DB_COUNT_CONTROL, + S_028004_PERFECT_ZPASS_COUNTS(1), + S_028004_PERFECT_ZPASS_COUNTS(1)); + r600_context_reg(ctx, R600_GROUP_CONTEXT, + R_02800C_DB_RENDER_OVERRIDE, + S_02800C_NOOP_CULL_DISABLE(1), + S_02800C_NOOP_CULL_DISABLE(1)); + } + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { /* need to flush */ r600_context_flush(ctx); diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 92b2eb1dff1..25a65c6a10f 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -54,4 +54,25 @@ struct r600_reg { /* radeon_pciid.c */ unsigned radeon_family_from_device(unsigned device); + +static void inline r600_context_reg(struct r600_context *ctx, unsigned group_id, + unsigned offset, unsigned value, + unsigned mask) +{ + struct r600_group *group = &ctx->groups[group_id]; + struct r600_group_block *block; + unsigned id; + + id = group->offset_block_id[(offset - group->start_offset) >> 2]; + block = &group->blocks[id]; + id = (offset - block->start_offset) >> 2; + block->pm4[id] &= ~mask; + block->pm4[id] |= value; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; +} + #endif diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index e1f32da91b0..d60c37fc90d 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -943,6 +943,20 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } } + /* queries need some special values */ + if (ctx->num_query_running) { + if (ctx->radeon->family >= CHIP_RV770) { + r600_context_reg(ctx, R600_GROUP_CONTEXT, + R_028D0C_DB_RENDER_CONTROL, + S_028D0C_R700_PERFECT_ZPASS_COUNTS(1), + S_028D0C_R700_PERFECT_ZPASS_COUNTS(1)); + } + r600_context_reg(ctx, R600_GROUP_CONTEXT, + R_028D10_DB_RENDER_OVERRIDE, + S_028D10_NOOP_CULL_DISABLE(1), + S_028D10_NOOP_CULL_DISABLE(1)); + } + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { /* need to flush */ r600_context_flush(ctx); @@ -1181,6 +1195,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) query->state |= R600_QUERY_STATE_STARTED; query->state ^= R600_QUERY_STATE_ENDED; + ctx->num_query_running++; } void r600_query_end(struct r600_context *ctx, struct r600_query *query) @@ -1197,6 +1212,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) query->num_results += 16; query->state ^= R600_QUERY_STATE_STARTED; query->state |= R600_QUERY_STATE_ENDED; + ctx->num_query_running--; } struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type) diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index 3c60e5c11a7..fcce2934d39 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -839,6 +839,16 @@ #define R_028800_DB_DEPTH_CONTROL 0x028800 #define R_02880C_DB_SHADER_CONTROL 0x02880C #define R_028D0C_DB_RENDER_CONTROL 0x028D0C +#define S_028D0C_DEPTH_CLEAR_ENABLE(x) (((x) & 0x1) << 0) +#define S_028D0C_STENCIL_CLEAR_ENABLE(x) (((x) & 0x1) << 1) +#define S_028D0C_DEPTH_COPY_ENABLE(x) (((x) & 0x1) << 2) +#define S_028D0C_STENCIL_COPY_ENABLE(x) (((x) & 0x1) << 3) +#define S_028D0C_RESUMMARIZE_ENABLE(x) (((x) & 0x1) << 4) +#define S_028D0C_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5) +#define S_028D0C_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6) +#define S_028D0C_COPY_CENTROID(x) (((x) & 0x1) << 7) +#define S_028D0C_COPY_SAMPLE(x) (((x) & 0x1) << 8) +#define S_028D0C_R700_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15) #define R_028D10_DB_RENDER_OVERRIDE 0x028D10 #define R_028D2C_DB_SRESULTS_COMPARE_STATE1 0x028D2C #define R_028D30_DB_PRELOAD_CONTROL 0x028D30 -- cgit v1.2.3 From c622174f73d0113dbba79520028d3a101b116e39 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sat, 25 Sep 2010 16:11:40 +0200 Subject: r600g: set ENABLE_KILL in the shader state in the new design --- src/gallium/drivers/r600/r600_state2.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index c4e06a5f528..986ede3f39c 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -173,6 +173,14 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0x00000000, 0xFFFFFFFF, NULL); + + if (rshader->uses_kill) { + /* only set some bits here, the other bits are set in the dsa state */ + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02880C_DB_SHADER_CONTROL, + S_02880C_KILL_ENABLE(1), + S_02880C_KILL_ENABLE(1), NULL); + } } static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) -- cgit v1.2.3 From bc8b8d06b672f19d91fda835d38083d5751299f2 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sat, 25 Sep 2010 16:11:42 +0200 Subject: r600g: set ENABLE_KILL on evergreen too --- src/gallium/drivers/r600/evergreen_state.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index c54b78aa6f0..7031e4cc77d 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1576,6 +1576,14 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader S_0286E0_PERSP_CENTROID_ENA(1) | S_0286E0_LINEAR_CENTROID_ENA(1), 0xFFFFFFFF, NULL); + + if (rshader->uses_kill) { + /* only set some bits here, the other bits are set in the dsa state */ + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + R_02880C_DB_SHADER_CONTROL, + S_02880C_KILL_ENABLE(1), + S_02880C_KILL_ENABLE(1), NULL); + } } void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) -- cgit v1.2.3 From b51f6e7c2350f637337fc3935436e2f99f669dfd Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Sun, 26 Sep 2010 19:03:02 +0200 Subject: util/u_blitter: fix leak --- src/gallium/auxiliary/util/u_blitter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index c160716e6a7..a163f93cb82 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -268,7 +268,7 @@ void util_blitter_destroy(struct blitter_context *blitter) pipe->delete_fs_state(pipe, ctx->fs_texfetch_depth[i]); } - for (i = 0; i <= PIPE_MAX_COLOR_BUFS && ctx->fs_col[i]; i++) + for (i = 0; i <= PIPE_MAX_COLOR_BUFS; i++) if (ctx->fs_col[i]) pipe->delete_fs_state(pipe, ctx->fs_col[i]); -- cgit v1.2.3 From 16baa465a249cc9a382fa2834ec6133561d0a562 Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Sun, 26 Sep 2010 19:39:05 +0200 Subject: radeong: fix leaks --- src/gallium/winsys/radeon/drm/radeon_r300.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index 58400986421..420522f5c1f 100644 --- a/src/gallium/winsys/radeon/drm/radeon_r300.c +++ b/src/gallium/winsys/radeon/drm/radeon_r300.c @@ -250,6 +250,7 @@ static void radeon_r300_winsys_cs_destroy(struct r300_winsys_cs *rcs) { struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs); radeon_cs_destroy(cs->cs); + FREE(cs); } static void radeon_winsys_destroy(struct r300_winsys_screen *rws) @@ -261,6 +262,8 @@ static void radeon_winsys_destroy(struct r300_winsys_screen *rws) radeon_bo_manager_gem_dtor(ws->bom); radeon_cs_manager_gem_dtor(ws->csm); + + FREE(rws); } boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws) -- cgit v1.2.3 From 4ca1a92b7fe44158a13910d01c76f41f6946165c Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 26 Sep 2010 16:25:47 -0400 Subject: r600g: move around variables to share depth uncompression code Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_blit.c | 11 ++++------- src/gallium/drivers/r600/r600_context.h | 9 +++++---- src/gallium/drivers/r600/r600_state.c | 3 ++- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index c30a7c187c9..52326534e6e 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -180,10 +180,8 @@ void r600_init_blit_functions(struct r600_context *rctx) int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) { struct r600_context *rctx = r600_context(ctx); - struct r600_screen *rscreen = rctx->screen; - struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; + struct pipe_framebuffer_state *fb = rctx->pframebuffer; struct pipe_surface *zsurf, *cbsurf; - enum radeon_family family; int level = 0; float depth = 1.0f; @@ -196,11 +194,10 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te r600_blitter_save_states(ctx); util_blitter_save_framebuffer(rctx->blitter, fb); - family = radeon_get_family(rscreen->rw); - if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || - family == CHIP_RV635) + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) depth = 0.0f; - + util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); /* resume queries */ diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index aec0dab338c..d104531d365 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -198,10 +198,14 @@ extern struct r600_context_hw_state_vtbl eg_hw_state_vtbl; struct r600_context { struct pipe_context context; + struct blitter_context *blitter; + struct pipe_framebuffer_state *pframebuffer; + unsigned family; + void *custom_dsa_flush; + struct list_head query_list; struct r600_screen *screen; struct radeon *rw; struct radeon_ctx *ctx; - struct blitter_context *blitter; struct radeon_draw draw; struct r600_context_hw_state_vtbl *vtbl; struct radeon_state config; @@ -238,14 +242,11 @@ struct r600_context { struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_index_buffer index_buffer; struct pipe_blend_color blend_color; - struct list_head query_list; /* upload managers */ struct u_upload_mgr *upload_vb; struct u_upload_mgr *upload_ib; bool any_user_vbs; - - void *custom_dsa_flush; }; /* Convenience cast wrapper. */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 424f7a8913f..791b39a001e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -389,7 +389,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, } clean_flush(rctx, &rctx->hw_states.cb_flush); clean_flush(rctx, &rctx->hw_states.db_flush); - + rctx->pframebuffer = NULL; r600_context_state_decref(rctx->framebuffer); rstate = r600_new_context_state(pipe_framebuffer_type); @@ -399,6 +399,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, } pipe_reference(NULL, &state->zsbuf->reference); rctx->framebuffer = rstate; + rctx->pframebuffer = &rstate->state.framebuffer; for (i = 0; i < state->nr_cbufs; i++) { rctx->vtbl->cb(rctx, &rstate->rstate[i+1], state, i); } -- cgit v1.2.3 From d2f24c4d75579acf27cf6d1b0620afa302a1b78f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 26 Sep 2010 16:27:36 -0400 Subject: r600g: use depth decompression in new path Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_pipe.h | 7 +++-- src/gallium/drivers/r600/r600_state2.c | 57 ++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 19cfbccf4f1..4ca83a42d77 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -84,9 +84,13 @@ struct r600_vertex_element struct r600_pipe_context { struct pipe_context context; + struct blitter_context *blitter; + struct pipe_framebuffer_state *pframebuffer; + unsigned family; + void *custom_dsa_flush; + struct list_head query_list; /* fake member for depth remove once merged */ struct r600_screen *screen; struct radeon *radeon; - struct blitter_context *blitter; struct r600_pipe_state *states[R600_PIPE_NSTATES]; struct r600_context ctx; struct r600_vertex_element *vertex_elements; @@ -116,7 +120,6 @@ struct r600_pipe_context { bool flatshade; struct u_upload_mgr *upload_vb; struct u_upload_mgr *upload_ib; - enum radeon_family family; unsigned any_user_vbs; }; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 986ede3f39c..e5b2dc99274 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -677,7 +677,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, #if 0 sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 20) { + if (dc < 4) { r600_context_dump_bof(&rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } @@ -1191,14 +1191,11 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c bo[1] = rbuffer->bo; /* FIXME depth texture decompression */ if (tmp->depth) { -#if 0 - r = r600_texture_from_depth(ctx, tmp, view->first_level); - if (r) { - return; - } - bo[0] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); - bo[1] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); -#endif + r600_texture_depth_flush(ctx, texture); + tmp = (struct r600_resource_texture*)texture; + rbuffer = &tmp->flushed_depth_texture->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; } pitch = align(tmp->pitch[0] / tmp->bpt, 8); @@ -1598,6 +1595,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, } pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf); rctx->framebuffer = *state; + rctx->pframebuffer = &rctx->framebuffer; /* build states */ for (int i = 0; i < state->nr_cbufs; i++) { @@ -2133,6 +2131,44 @@ static void r600_init_query_functions2(struct r600_pipe_context *rctx) rctx->context.get_query_result = r600_get_query_result; } +static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) +{ + struct pipe_depth_stencil_alpha_state dsa; + struct r600_pipe_state *rstate; + boolean quirk = false; + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + quirk = true; + + memset(&dsa, 0, sizeof(dsa)); + + if (quirk) { + dsa.depth.enabled = 1; + dsa.depth.func = PIPE_FUNC_LEQUAL; + dsa.stencil[0].enabled = 1; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; + dsa.stencil[0].writemask = 0xff; + } + + rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02880C_DB_SHADER_CONTROL, + 0x0, + S_02880C_DUAL_EXPORT_ENABLE(1), NULL); + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_028D0C_DB_RENDER_CONTROL, + S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1), + S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1), NULL); + return rstate; +} + static struct pipe_context *r600_create_context2(struct pipe_screen *screen, void *priv) { struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); @@ -2215,6 +2251,9 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi return NULL; } + LIST_INITHEAD(&rctx->query_list); + rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); + return &rctx->context; } -- cgit v1.2.3 From 311ab3d468ea5291c10bd5cada9b77a528fb7b7f Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 25 Sep 2010 14:57:32 +0200 Subject: r300g: fix macrotiling on R350 MACRO_SWITCH on R350 appears to use the RV350 mode by default. Who knew? NOTE: This is a candidate for the 7.9 branch. --- src/gallium/drivers/r300/r300_texture_desc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 20d1fdab426..6a1030f8eee 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -256,7 +256,7 @@ static void r300_setup_miptree(struct r300_screen *screen, { struct pipe_resource *base = &desc->b.b; unsigned stride, size, layer_size, nblocksy, i; - boolean rv350_mode = screen->caps.is_rv350; + boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350; boolean aligned_for_cbzb; desc->size_in_bytes = 0; @@ -351,7 +351,7 @@ static void r300_setup_tiling(struct r300_screen *screen, { struct r300_winsys_screen *rws = screen->rws; enum pipe_format format = desc->b.b.format; - boolean rv350_mode = screen->caps.is_rv350; + boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350; boolean is_zb = util_format_is_depth_or_stencil(format); boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING); -- cgit v1.2.3 From 84b2773f00161441c4fe06ce6dbf979c5ce78dae Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 26 Sep 2010 14:34:05 -0700 Subject: r600g: Silence uninitialized variable warnings. Fixes these GCC warnings. r600_shader.c: In function 'tgsi_tex': r600_shader.c:1611: warning: 'src2_chan' may be used uninitialized in this function r600_shader.c:1611: warning: 'src_chan' may be used uninitialized in this function --- src/gallium/drivers/r600/r600_shader.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 3274f3be71a..0c27bb7d879 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1631,6 +1631,11 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) src_chan = 1; src2_chan = 2; break; + default: + assert(0); + src_chan = 0; + src2_chan = 0; + break; } r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); if (r) -- cgit v1.2.3 From 7eab5ef425e1e08c0dc0ea8d161c33610a91586f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 27 Sep 2010 14:35:41 +1000 Subject: r600g: add evergreen texture resource properly. adding sampler border looks impossible with current design, another day, another corner case not worked out. --- src/gallium/drivers/r600/evergreen_state.c | 16 ++-- src/gallium/drivers/r600/r600.h | 5 ++ src/gallium/winsys/r600/drm/evergreen_state.c | 112 +++++++++++++++++++++++++- 3 files changed, 122 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7031e4cc77d..b0b0f5ce776 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -491,7 +491,7 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou for (int i = 0; i < count; i++) { if (resource[i]) { - r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); + evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); } } } @@ -513,7 +513,7 @@ static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count, struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; for (int i = 0; i < count; i++) { - r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); + evergreen_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); } } @@ -524,7 +524,7 @@ static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned count, /* TODO implement */ for (int i = 0; i < count; i++) { - r600_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); + evergreen_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); } } @@ -1469,19 +1469,19 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) return; } offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); } diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 17d34409dc4..44fae4bcef6 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -282,4 +282,9 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); +void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); +void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); +void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id); +void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id); + #endif diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index 860c836e858..b9d333060fc 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -528,7 +528,7 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } /* VS RESOURCE */ - for (int j = 0, offset = 0x1600; j < 176; j++, offset += 0x20) { + for (int j = 0, offset = 0x1600; j < 160; j++, offset += 0x20) { r = evergreen_state_resource_init(ctx, offset); if (r) goto out_err; @@ -558,6 +558,112 @@ out_err: return r; } +static inline void evergreen_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_group_block *block; + unsigned id; + + offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; + id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; + block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; + block->pm4[0] = state->regs[0].value; + block->pm4[1] = state->regs[1].value; + block->pm4[2] = state->regs[2].value; + block->pm4[3] = state->regs[3].value; + block->pm4[4] = state->regs[4].value; + block->pm4[5] = state->regs[5].value; + block->pm4[6] = state->regs[6].value; + block->pm4[7] = state->regs[7].value; + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + if (state->regs[0].bo) { + /* VERTEX RESOURCE, we preted there is 2 bo to relocate so + * we have single case btw VERTEX & TEXTURE resource + */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + } else { + /* TEXTURE RESOURCE */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; +} + +void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x20 * rid; + + evergreen_context_pipe_state_set_resource(ctx, state, offset); +} + +void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x1600 + 0x20 * rid; + + evergreen_context_pipe_state_set_resource(ctx, state, offset); +} + +static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_group_block *block; + unsigned id; + + offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER].start_offset; + id = ctx->groups[EVERGREEN_GROUP_SAMPLER].offset_block_id[offset >> 2]; + block = &ctx->groups[EVERGREEN_GROUP_SAMPLER].blocks[id]; + block->pm4[0] = state->regs[0].value; + block->pm4[1] = state->regs[1].value; + block->pm4[2] = state->regs[2].value; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; +} + +static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_group_block *block; + unsigned id; + + offset -= ctx->groups[EVERGREEN_GROUP_CONFIG].start_offset; + id = ctx->groups[EVERGREEN_GROUP_CONFIG].offset_block_id[offset >> 2]; + block = &ctx->groups[EVERGREEN_GROUP_CONFIG].blocks[id]; + block->pm4[0] = state->regs[3].value; + block->pm4[1] = state->regs[4].value; + block->pm4[2] = state->regs[5].value; + block->pm4[3] = state->regs[6].value; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; +} + +void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) +{ + unsigned offset; + + offset = 0x0003C000 + id * 0xc; + evergreen_context_pipe_state_set_sampler(ctx, state, offset); + if (state->nregs > 3) { + offset = 0x0000A400 + id * 0x10; + // evergreen_context_pipe_state_set_sampler_border(ctx, state, offset); + } +} + +void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) +{ + unsigned offset; + + offset = 0x0003C0D8 + id * 0xc; + evergreen_context_pipe_state_set_sampler(ctx, state, offset); + if (state->nregs > 3) { + offset = 0x0000A600 + id * 0x10; + // evergreen_context_pipe_state_set_sampler_border(ctx, state, offset); + } +} + + void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw) { struct radeon_bo *cb[12]; @@ -592,11 +698,11 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr /* queries need some special values */ if (ctx->num_query_running) { - r600_context_reg(ctx, R600_GROUP_CONTEXT, + r600_context_reg(ctx, EVERGREEN_GROUP_CONTEXT, R_028004_DB_COUNT_CONTROL, S_028004_PERFECT_ZPASS_COUNTS(1), S_028004_PERFECT_ZPASS_COUNTS(1)); - r600_context_reg(ctx, R600_GROUP_CONTEXT, + r600_context_reg(ctx, EVERGREEN_GROUP_CONTEXT, R_02800C_DB_RENDER_OVERRIDE, S_02800C_NOOP_CULL_DISABLE(1), S_02800C_NOOP_CULL_DISABLE(1)); -- cgit v1.2.3 From 4c6344f569c5417b0ea804f6f8216a2b40321480 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 27 Sep 2010 08:32:50 +0200 Subject: r600g: Fixed two texture surface leaks in r600_blit_uncompress_depth(). Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/r600_blit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 52326534e6e..357776c55ef 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -200,6 +200,9 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); + pipe_surface_reference(&zsurf, NULL); + pipe_surface_reference(&cbsurf, NULL); + /* resume queries */ r600_queries_resume(ctx); return 0; -- cgit v1.2.3 From e507e4ec05eb8dda23f7c54aaf2eea143f8e573d Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 14:04:39 +0200 Subject: gallium: add $(PROGS_DEPS) as dependencies for $(PROGS) Commit 80ee3a440cd3c0403004cf35e0638fc52088b9ff added a PROGS_DEPS definition, but no uses, even though it seems clearly intended to be a set of additional dependencies for $(PROGS). Correct this. --- src/gallium/Makefile.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template index bff399ec64f..036c11986ee 100644 --- a/src/gallium/Makefile.template +++ b/src/gallium/Makefile.template @@ -40,7 +40,7 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURC touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null -$(PROGS): % : %.o +$(PROGS): % : %.o $(PROGS_DEPS) $(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group # Emacs tags -- cgit v1.2.3 From 8d0ed47d940ffe2ffdc2ec27a1bab917590e7d9e Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 14:07:34 +0200 Subject: d3d1x: fix parallel build --- src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile | 3 ++- src/gallium/state_trackers/d3d1x/gd3d1x/Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 3754c23983a..f132518ccc7 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile @@ -2,7 +2,8 @@ LIBNAME=d3d1xshader CPP_SOURCES=$(wildcard src/*.cpp) src/sm4_text.cpp LIBRARY_INCLUDES=-Iinclude -I../d3dapi -I../w32api PROGS=tools/fxdis -LIBS=libd3d1xshader.a +PROGS_DEPS=libd3d1xshader.a +LIBS=$(PROGS_DEPS) include ../Makefile.inc diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile index a1ab425f1a0..32d29563ecc 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile @@ -2,5 +2,6 @@ LIBNAME=gd3d1x CPP_SOURCES=$(wildcard *.cpp) LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common PROGS=tools/dxbc2tgsi -LIBS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../d3d1xstutil/libd3d1xstutil.a ../../../auxiliary/libgallium.a -ldl +PROGS_DEPS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../d3d1xstutil/libd3d1xstutil.a ../../../auxiliary/libgallium.a +LIBS=$(PROGS_DEPS) -ldl include ../Makefile.inc -- cgit v1.2.3 From 9ba4b30eae1031cdd1f441218eea77de30175104 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 14:16:31 +0200 Subject: d3d1x: add private gitignore file --- src/gallium/state_trackers/d3d1x/.gitignore | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/gallium/state_trackers/d3d1x/.gitignore (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/.gitignore b/src/gallium/state_trackers/d3d1x/.gitignore new file mode 100644 index 00000000000..f23bac71769 --- /dev/null +++ b/src/gallium/state_trackers/d3d1x/.gitignore @@ -0,0 +1,20 @@ +d3d1xshader/include/sm4_defs.h +d3d1xshader/src/sm4_text.cpp +d3d1xshader/tools/fxdis +d3dapi/*.h +docs/module_dependencies.svg +docs/module_dependencies.pdf +gd3d10/*.generated.* +gd3d1x/tools/dxbc2tgsi +gd3dapi/*.h +mstools/DXSDK +mstools/*.dll +mstools/*.exe +progs/bin/* +winedlls/*/version.res +winedlls/*/*.def +*.suo +*.vcxproj.filters +*.vcxproj.user +Debug +Release -- cgit v1.2.3 From 31d8f64f3f0befd154b0aa8b234d2c0dd40ab9b6 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 14:23:33 +0200 Subject: d3d1x: fix progs linking if not all EGL platforms are enabled --- src/gallium/state_trackers/d3d1x/progs/Makefile | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index bb37012a3d7..2f54079a447 100644 --- a/src/gallium/state_trackers/d3d1x/progs/Makefile +++ b/src/gallium/state_trackers/d3d1x/progs/Makefile @@ -9,15 +9,29 @@ LIBS= \ ../../../winsys/sw/wrapper/libwsw.a \ ../../../winsys/sw/xlib/libws_xlib.a \ ../../../winsys/sw/dri/libswdri.a \ - ../../../winsys/sw/fbdev/libfbdev.a \ ../../../../../lib/libEGL.so -LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS) -LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS) -LDADD=-lXext -lXfixes -lX11 -ldrm -ldl + +LDADD=-ldl all: bin/d3d10tri bin/d3d11tri bin/d3d11tex bin/d3d11gears include ../Makefile.inc +ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) +LIBS += ../../../winsys/sw/fbdev/libfbdev.a +endif + +ifneq ($(findstring x11, $(EGL_PLATFORMS)),) +LDADD += -lX11 -lXext -lXfixes +LIBS += ../../../winsys/sw/xlib/libws_xlib.a +endif + +ifneq ($(findstring kms, $(EGL_PLATFORMS)),) +LDADD += -ldrm +endif + +LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS) +LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS) + bin/d3d10tri: d3d10app/d3d10x11main.o d3d10tri/d3d10tri.o $(LIBS_D3D10) $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D10) -Wl,--end-group $(LDADD) -- cgit v1.2.3 From 99486bfc5b26f6deec38a2ccf2ee5645a92ae249 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 14:26:12 +0200 Subject: d3d1x: link progs with CXXFLAGS --- src/gallium/state_trackers/d3d1x/progs/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index 2f54079a447..938c77cc662 100644 --- a/src/gallium/state_trackers/d3d1x/progs/Makefile +++ b/src/gallium/state_trackers/d3d1x/progs/Makefile @@ -33,14 +33,14 @@ LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS) LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS) bin/d3d10tri: d3d10app/d3d10x11main.o d3d10tri/d3d10tri.o $(LIBS_D3D10) - $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D10) -Wl,--end-group $(LDADD) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D10) -Wl,--end-group $(LDADD) bin/d3d11tri: d3d11app/d3d11x11main.o d3d11tri/d3d11tri.o $(LIBS_D3D11) - $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) bin/d3d11tex: d3d11app/d3d11x11main.o d3d11tex/d3d11tex.o $(LIBS_D3D11) - $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) bin/d3d11gears: d3d11app/d3d11x11main.o d3d11gears/d3d11gears.o $(LIBS_D3D11) - $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS_D3D11) -Wl,--end-group $(LDADD) -- cgit v1.2.3 From 58a31758e3b8249b12f0e797034bec235343aa15 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 27 Sep 2010 09:01:55 -0400 Subject: r600g: fix index buffer drawing Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 3 ++- src/gallium/drivers/r600/r600_state2.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index b0b0f5ce776..89f7c7f53a4 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1349,6 +1349,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; draw.min_index = info->min_index; draw.max_index = info->max_index; draw.index_bias = info->index_bias; @@ -1495,7 +1496,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) if (draw.index_buffer) { rbuffer = (struct r600_resource*)draw.index_buffer; rdraw.indices = rbuffer->bo; - rdraw.indices_bo_offset = 0; + rdraw.indices_bo_offset = draw.index_buffer_offset; } evergreen_context_draw(&rctx->ctx, &rdraw); } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index e5b2dc99274..8bf8d24549c 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -589,7 +589,7 @@ static void r600_draw_common(struct r600_drawl *draw) if (draw->index_buffer) { rbuffer = (struct r600_resource*)draw->index_buffer; rdraw.indices = rbuffer->bo; - rdraw.indices_bo_offset = 0; + rdraw.indices_bo_offset = draw->index_buffer_offset; } r600_context_draw(&rctx->ctx, &rdraw); } @@ -636,6 +636,7 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; draw.min_index = info->min_index; draw.max_index = info->max_index; draw.index_bias = info->index_bias; @@ -677,7 +678,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, #if 0 sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 4) { + if (dc < 20) { r600_context_dump_bof(&rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } -- cgit v1.2.3 From 99c422ef5ab3924aad66af026945f491d75d226f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 27 Sep 2010 11:53:34 -0400 Subject: r600g: build packet header once Build packet header once and allow to add fake register support so we can handle things like indexed set of register (evergreen sampler border registers for instance. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreend.h | 16 +++ src/gallium/drivers/r600/r600.h | 2 + src/gallium/winsys/r600/drm/evergreen_state.c | 152 ++++++++++++++++++-------- src/gallium/winsys/r600/drm/r600_state2.c | 93 +++++++++------- 4 files changed, 178 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 0a0a91eea2a..486cb29005d 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1113,6 +1113,22 @@ #define S_03000C_DST_SEL_W(x) (((x) & 0x7) << 12) #define G_03000C_DST_SEL_W(x) (((x) >> 12) & 0x7) +#define R_00A400_TD_PS_SAMPLER0_BORDER_INDEX 0x00A400 +#define R_00A404_TD_PS_SAMPLER0_BORDER_RED 0x00A404 +#define R_00A408_TD_PS_SAMPLER0_BORDER_GREEN 0x00A408 +#define R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE 0x00A40C +#define R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA 0x00A410 +#define R_00A414_TD_VS_SAMPLER0_BORDER_INDEX 0x00A414 +#define R_00A418_TD_VS_SAMPLER0_BORDER_RED 0x00A418 +#define R_00A41C_TD_VS_SAMPLER0_BORDER_GREEN 0x00A41C +#define R_00A420_TD_VS_SAMPLER0_BORDER_BLUE 0x00A420 +#define R_00A424_TD_VS_SAMPLER0_BORDER_ALPHA 0x00A424 +#define R_00A428_TD_GS_SAMPLER0_BORDER_INDEX 0x00A428 +#define R_00A42C_TD_GS_SAMPLER0_BORDER_RED 0x00A42C +#define R_00A430_TD_GS_SAMPLER0_BORDER_GREEN 0x00A430 +#define R_00A434_TD_GS_SAMPLER0_BORDER_BLUE 0x00A434 +#define R_00A438_TD_GS_SAMPLER0_BORDER_ALPHA 0x00A438 + #define R_03C000_SQ_TEX_SAMPLER_WORD0_0 0x03C000 #define S_03C000_CLAMP_X(x) (((x) & 0x7) << 0) #define G_03C000_CLAMP_X(x) (((x) >> 0) & 0x7) diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 44fae4bcef6..b8c74675e60 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -137,6 +137,7 @@ enum evergreen_group_id { EVERGREEN_GROUP_CTL_CONST, EVERGREEN_GROUP_LOOP_CONST, EVERGREEN_GROUP_BOOL_CONST, + EVERGREEN_GROUP_SAMPLER_BORDER, EVERGREEN_NGROUPS }; @@ -183,6 +184,7 @@ struct r600_group_block { unsigned pm4_ndwords; unsigned nbo; unsigned nreg; + u32 *reg; u32 pm4[R600_BLOCK_MAX_REG]; unsigned pm4_bo_index[R600_BLOCK_MAX_REG]; struct r600_block_reloc reloc[R600_BLOCK_MAX_BO]; diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index b9d333060fc..c2455e3a490 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -53,13 +53,13 @@ struct radeon_ws_bo { struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset); -void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group, unsigned opcode); +void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group); void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg, unsigned opcode); int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset); #define GROUP_FORCE_NEW_BLOCK 0 -static const struct r600_reg evergreen_reg_list[] = { +static const struct r600_reg evergreen_config_reg_list[] = { {0, 0, R_008958_VGT_PRIMITIVE_TYPE}, {0, 0, R_008A14_PA_CL_ENHANCE}, {0, 0, R_008C00_SQ_CONFIG}, @@ -74,6 +74,9 @@ static const struct r600_reg evergreen_reg_list[] = { {0, 0, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ}, {0, 0, R_009100_SPI_CONFIG_CNTL}, {0, 0, R_00913C_SPI_CONFIG_CNTL_1}, +}; + +static const struct r600_reg evergreen_context_reg_list[] = { {0, 0, R_028000_DB_RENDER_CONTROL}, {0, 0, R_028004_DB_COUNT_CONTROL}, {0, 0, R_028008_DB_DEPTH_VIEW}, @@ -450,7 +453,7 @@ static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) for (int i = 0; i < nreg; i++) { r600_shader_resource[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_resource, nreg); + return r600_context_add_block(ctx, r600_shader_resource, nreg, PKT3_SET_RESOURCE); } /* SHADER SAMPLER R600/R700 */ @@ -466,7 +469,39 @@ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) for (int i = 0; i < nreg; i++) { r600_shader_sampler[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_sampler, nreg); + return r600_context_add_block(ctx, r600_shader_sampler, nreg, PKT3_SET_SAMPLER); +} + +/* SHADER SAMPLER BORDER R600/R700 */ +static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id) +{ + struct r600_reg r600_shader_sampler_border[] = { + {0, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX}, + {0, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED}, + {0, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN}, + {0, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE}, + {0, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA}, + }; + unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); + unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + struct r600_group_block *block; + struct r600_group *group; + int r; + + for (int i = 0; i < nreg; i++) { + r600_shader_sampler_border[i].offset -= R_00A400_TD_PS_SAMPLER0_BORDER_INDEX; + r600_shader_sampler_border[i].offset += fake_offset; + } + r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg, PKT3_SET_CONFIG_REG); + if (r) { + return r; + } + /* set proper offset */ + group = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER]; + id = group->offset_block_id[((fake_offset - group->start_offset) >> 2)]; + block = &group->blocks[id]; + block->pm4[1] = (offset - EVERGREEN_CONFIG_REG_OFFSET) >> 2; + return 0; } int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) @@ -502,10 +537,22 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) if (r) { goto out_err; } + /* we use unassigned range of GPU reg to fake border color register */ + r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER], 0x40000, 0x41000); + if (r) { + goto out_err; + } ctx->ngroups = EVERGREEN_NGROUPS; /* add blocks */ - r = r600_context_add_block(ctx, evergreen_reg_list, sizeof(evergreen_reg_list)/sizeof(struct r600_reg)); + r = r600_context_add_block(ctx, evergreen_config_reg_list, + sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg), + PKT3_SET_CONFIG_REG); + if (r) + goto out_err; + r = r600_context_add_block(ctx, evergreen_context_reg_list, + sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg), + PKT3_SET_CONTEXT_REG); if (r) goto out_err; @@ -521,6 +568,18 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) if (r) goto out_err; } + /* PS SAMPLER BORDER */ + for (int j = 0; j < 18; j++) { + r = evergreen_state_sampler_border_init(ctx, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, j); + if (r) + goto out_err; + } + /* VS SAMPLER BORDER */ + for (int j = 0; j < 18; j++) { + r = evergreen_state_sampler_border_init(ctx, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, j); + if (r) + goto out_err; + } /* PS RESOURCE */ for (int j = 0, offset = 0; j < 176; j++, offset += 0x20) { r = evergreen_state_resource_init(ctx, offset); @@ -566,14 +625,14 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; - block->pm4[0] = state->regs[0].value; - block->pm4[1] = state->regs[1].value; - block->pm4[2] = state->regs[2].value; - block->pm4[3] = state->regs[3].value; - block->pm4[4] = state->regs[4].value; - block->pm4[5] = state->regs[5].value; - block->pm4[6] = state->regs[6].value; - block->pm4[7] = state->regs[7].value; + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->reg[3] = state->regs[3].value; + block->reg[4] = state->regs[4].value; + block->reg[5] = state->regs[5].value; + block->reg[6] = state->regs[6].value; + block->reg[7] = state->regs[7].value; radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { @@ -589,7 +648,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context } block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) @@ -614,29 +673,29 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER].start_offset; id = ctx->groups[EVERGREEN_GROUP_SAMPLER].offset_block_id[offset >> 2]; block = &ctx->groups[EVERGREEN_GROUP_SAMPLER].blocks[id]; - block->pm4[0] = state->regs[0].value; - block->pm4[1] = state->regs[1].value; - block->pm4[2] = state->regs[2].value; + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } -static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) { struct r600_group_block *block; - unsigned id; - - offset -= ctx->groups[EVERGREEN_GROUP_CONFIG].start_offset; - id = ctx->groups[EVERGREEN_GROUP_CONFIG].offset_block_id[offset >> 2]; - block = &ctx->groups[EVERGREEN_GROUP_CONFIG].blocks[id]; - block->pm4[0] = state->regs[3].value; - block->pm4[1] = state->regs[4].value; - block->pm4[2] = state->regs[5].value; - block->pm4[3] = state->regs[6].value; + unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + + fake_offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].start_offset; + id = ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].offset_block_id[fake_offset >> 2]; + block = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].blocks[id]; + block->reg[0] = id; + block->reg[1] = state->regs[3].value; + block->reg[2] = state->regs[4].value; + block->reg[3] = state->regs[5].value; block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) @@ -646,8 +705,7 @@ void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struc offset = 0x0003C000 + id * 0xc; evergreen_context_pipe_state_set_sampler(ctx, state, offset); if (state->nregs > 3) { - offset = 0x0000A400 + id * 0x10; - // evergreen_context_pipe_state_set_sampler_border(ctx, state, offset); + evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id); } } @@ -658,8 +716,7 @@ void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struc offset = 0x0003C0D8 + id * 0xc; evergreen_context_pipe_state_set_sampler(ctx, state, offset); if (state->nregs > 3) { - offset = 0x0000A600 + id * 0x10; - // evergreen_context_pipe_state_set_sampler_border(ctx, state, offset); + evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id); } } @@ -719,10 +776,11 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } /* enough room to copy packet */ - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONFIG], PKT3_SET_CONFIG_REG); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONTEXT], PKT3_SET_CONTEXT_REG); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_RESOURCE], PKT3_SET_RESOURCE); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER], PKT3_SET_SAMPLER); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONFIG]); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONTEXT]); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_RESOURCE]); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER]); + r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER]); /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -773,14 +831,14 @@ static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_ offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; - block->pm4[0] = state->regs[0].value; - block->pm4[1] = state->regs[1].value; - block->pm4[2] = state->regs[2].value; - block->pm4[3] = state->regs[3].value; - block->pm4[4] = state->regs[4].value; - block->pm4[5] = state->regs[5].value; - block->pm4[6] = state->regs[6].value; - block->pm4[7] = state->regs[7].value; + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->reg[3] = state->regs[3].value; + block->reg[4] = state->regs[4].value; + block->reg[5] = state->regs[5].value; + block->reg[6] = state->regs[6].value; + block->reg[7] = state->regs[7].value; radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { @@ -796,7 +854,7 @@ static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_ } block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index d60c37fc90d..c4b45e565c5 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -75,7 +75,7 @@ static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offs return -1; } -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg, unsigned opcode) { struct r600_group_block *block, *tmp; struct r600_group *group; @@ -109,6 +109,12 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, if (tmp == NULL) { return -ENOMEM; } + /* update reg pointer */ + if (tmp != group->blocks) { + for (int j = 0; j < group->nblocks; j++) { + tmp[j].reg = &tmp[j].pm4[2]; + } + } group->blocks = tmp; block = &group->blocks[group->nblocks++]; for (int j = 0; j < n; j++) { @@ -118,7 +124,10 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, /* initialize block */ memset(block, 0, sizeof(struct r600_group_block)); block->start_offset = reg[i].offset; - block->pm4_ndwords = n; + block->pm4[block->pm4_ndwords++] = PKT3(opcode, n); + block->pm4[block->pm4_ndwords++] = (block->start_offset - group->start_offset) >> 2; + block->reg = &block->pm4[block->pm4_ndwords]; + block->pm4_ndwords += n; block->nreg = n; for (j = 0; j < n; j++) { if (reg[i+j].need_bo) { @@ -168,7 +177,8 @@ static void r600_group_fini(struct r600_group *group) } /* R600/R700 configuration */ -static const struct r600_reg r600_reg_list[] = { +static const struct r600_reg r600_config_reg_list[] = { + {0, 0, R_008958_VGT_PRIMITIVE_TYPE}, {0, 0, R_008C00_SQ_CONFIG}, {0, 0, R_008C04_SQ_GPR_RESOURCE_MGMT_1}, {0, 0, R_008C08_SQ_GPR_RESOURCE_MGMT_2}, @@ -180,6 +190,9 @@ static const struct r600_reg r600_reg_list[] = { {0, 0, R_009714_VC_ENHANCE}, {0, 0, R_009830_DB_DEBUG}, {0, 0, R_009838_DB_WATERMARKS}, +}; + +static const struct r600_reg r600_context_reg_list[] = { {0, 0, R_028350_SX_MISC}, {0, 0, R_0286C8_SPI_THREAD_GROUPING}, {0, 0, R_0288A8_SQ_ESGS_RING_ITEMSIZE}, @@ -509,7 +522,6 @@ static const struct r600_reg r600_reg_list[] = { {0, 0, R_028850_SQ_PGM_RESOURCES_PS}, {0, 0, R_028854_SQ_PGM_EXPORTS_PS}, {0, 0, R_0288CC_SQ_PGM_CF_OFFSET_PS}, - {0, 0, R_008958_VGT_PRIMITIVE_TYPE}, {0, 0, R_028400_VGT_MAX_VTX_INDX}, {0, 0, R_028404_VGT_MIN_VTX_INDX}, {0, 0, R_028408_VGT_INDX_OFFSET}, @@ -534,7 +546,7 @@ static int r600_state_constant_init(struct r600_context *ctx, u32 offset) for (int i = 0; i < nreg; i++) { r600_shader_constant[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_constant, nreg); + return r600_context_add_block(ctx, r600_shader_constant, nreg, PKT3_SET_ALU_CONST); } /* SHADER RESOURCE R600/R700 */ @@ -554,7 +566,7 @@ static int r600_state_resource_init(struct r600_context *ctx, u32 offset) for (int i = 0; i < nreg; i++) { r600_shader_resource[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_resource, nreg); + return r600_context_add_block(ctx, r600_shader_resource, nreg, PKT3_SET_RESOURCE); } /* SHADER SAMPLER R600/R700 */ @@ -570,7 +582,7 @@ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) for (int i = 0; i < nreg; i++) { r600_shader_sampler[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_sampler, nreg); + return r600_context_add_block(ctx, r600_shader_sampler, nreg, PKT3_SET_SAMPLER); } /* SHADER SAMPLER BORDER R600/R700 */ @@ -587,7 +599,7 @@ static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) for (int i = 0; i < nreg; i++) { r600_shader_sampler_border[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_sampler_border, nreg); + return r600_context_add_block(ctx, r600_shader_sampler_border, nreg, PKT3_SET_CONFIG_REG); } /* initialize */ @@ -644,7 +656,14 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) ctx->ngroups = R600_NGROUPS; /* add blocks */ - r = r600_context_add_block(ctx, r600_reg_list, sizeof(r600_reg_list)/sizeof(struct r600_reg)); + r = r600_context_add_block(ctx, r600_config_reg_list, + sizeof(r600_config_reg_list)/sizeof(struct r600_reg), + PKT3_SET_CONFIG_REG); + if (r) + goto out_err; + r = r600_context_add_block(ctx, r600_context_reg_list, + sizeof(r600_context_reg_list)/sizeof(struct r600_reg), + PKT3_SET_CONTEXT_REG); if (r) goto out_err; @@ -762,8 +781,8 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat id = group->offset_block_id[(state->regs[i].offset - group->start_offset) >> 2]; block = &group->blocks[id]; id = (state->regs[i].offset - block->start_offset) >> 2; - block->pm4[id] &= ~state->regs[i].mask; - block->pm4[id] |= state->regs[i].value; + block->reg[id] &= ~state->regs[i].mask; + block->reg[id] |= state->regs[i].value; if (block->pm4_bo_index[id]) { /* find relocation */ id = block->pm4_bo_index[id]; @@ -771,7 +790,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat } block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } } @@ -783,13 +802,13 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx offset -= ctx->groups[R600_GROUP_RESOURCE].start_offset; id = ctx->groups[R600_GROUP_RESOURCE].offset_block_id[offset >> 2]; block = &ctx->groups[R600_GROUP_RESOURCE].blocks[id]; - block->pm4[0] = state->regs[0].value; - block->pm4[1] = state->regs[1].value; - block->pm4[2] = state->regs[2].value; - block->pm4[3] = state->regs[3].value; - block->pm4[4] = state->regs[4].value; - block->pm4[5] = state->regs[5].value; - block->pm4[6] = state->regs[6].value; + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->reg[3] = state->regs[3].value; + block->reg[4] = state->regs[4].value; + block->reg[5] = state->regs[5].value; + block->reg[6] = state->regs[6].value; radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { @@ -805,7 +824,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx } block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) @@ -830,12 +849,12 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, offset -= ctx->groups[R600_GROUP_SAMPLER].start_offset; id = ctx->groups[R600_GROUP_SAMPLER].offset_block_id[offset >> 2]; block = &ctx->groups[R600_GROUP_SAMPLER].blocks[id]; - block->pm4[0] = state->regs[0].value; - block->pm4[1] = state->regs[1].value; - block->pm4[2] = state->regs[2].value; + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) @@ -846,13 +865,13 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex offset -= ctx->groups[R600_GROUP_CONFIG].start_offset; id = ctx->groups[R600_GROUP_CONFIG].offset_block_id[offset >> 2]; block = &ctx->groups[R600_GROUP_CONFIG].blocks[id]; - block->pm4[0] = state->regs[3].value; - block->pm4[1] = state->regs[4].value; - block->pm4[2] = state->regs[5].value; - block->pm4[3] = state->regs[6].value; + block->reg[0] = state->regs[3].value; + block->reg[1] = state->regs[4].value; + block->reg[2] = state->regs[5].value; + block->reg[3] = state->regs[6].value; block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) @@ -879,7 +898,7 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 } } -void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group, unsigned opcode) +void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group) { struct radeon_bo *bo; int id; @@ -898,8 +917,6 @@ void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group * } } - ctx->pm4[ctx->pm4_cdwords++] = PKT3(opcode, block->nreg); - ctx->pm4[ctx->pm4_cdwords++] = (block->start_offset - group->start_offset) >> 2; memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); ctx->pm4_cdwords += block->pm4_ndwords; block->status ^= R600_BLOCK_STATUS_DIRTY; @@ -968,11 +985,11 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } /* enough room to copy packet */ - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONFIG], PKT3_SET_CONFIG_REG); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONTEXT], PKT3_SET_CONTEXT_REG); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_ALU_CONST], PKT3_SET_ALU_CONST); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_RESOURCE], PKT3_SET_RESOURCE); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_SAMPLER], PKT3_SET_SAMPLER); + r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONFIG]); + r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONTEXT]); + r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_ALU_CONST]); + r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_RESOURCE]); + r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_SAMPLER]); /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -1063,7 +1080,7 @@ void r600_context_flush(struct r600_context *ctx) /* mark enabled block as dirty */ block = &ctx->groups[i].blocks[j]; if (block->status & R600_BLOCK_STATUS_ENABLED) { - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; block->status |= R600_BLOCK_STATUS_DIRTY; } } -- cgit v1.2.3 From 1617daaf496573eba70b35a760183b427adeff1b Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 27 Sep 2010 14:58:01 -0400 Subject: r600g: fix pointsprite & resource unbinding When asking to bind NULL resource assume it's unbinding so free resource and unreference assoicated buffer. Also fix pointsprite parameter. Fix glsl-fs-pointcoord & fp-fragment-position Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 3 ++- src/gallium/drivers/r600/r600_state2.c | 3 ++- src/gallium/winsys/r600/drm/evergreen_state.c | 25 +++++++++++++++++------ src/gallium/winsys/r600/drm/r600_state2.c | 29 +++++++++++++++++++-------- 4 files changed, 44 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 89f7c7f53a4..1553088aa21 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1524,7 +1524,8 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader } if (rshader->input[i].name == TGSI_SEMANTIC_FACE) have_face = TRUE; - if (rctx->sprite_coord_enable & (1 << i)) { + if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && + rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) { tmp |= S_028644_PT_SPRITE_TEX(1); } r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 8bf8d24549c..06a6f0d80cc 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -127,7 +127,8 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade } if (rshader->input[i].name == TGSI_SEMANTIC_FACE) have_face = TRUE; - if (rctx->sprite_coord_enable & (1 << i)) { + if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && + rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) { tmp |= S_028644_PT_SPRITE_TEX(1); } r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index c2455e3a490..1cc22a98fd1 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -625,6 +625,12 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + return; + } block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; @@ -673,6 +679,10 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER].start_offset; id = ctx->groups[EVERGREEN_GROUP_SAMPLER].offset_block_id[offset >> 2]; block = &ctx->groups[EVERGREEN_GROUP_SAMPLER].blocks[id]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; @@ -689,6 +699,13 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c fake_offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].start_offset; id = ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].offset_block_id[fake_offset >> 2]; block = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].blocks[id]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } + if (state->nregs <= 3) { + return; + } block->reg[0] = id; block->reg[1] = state->regs[3].value; block->reg[2] = state->regs[4].value; @@ -704,9 +721,7 @@ void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struc offset = 0x0003C000 + id * 0xc; evergreen_context_pipe_state_set_sampler(ctx, state, offset); - if (state->nregs > 3) { - evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id); - } + evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id); } void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) @@ -715,9 +730,7 @@ void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struc offset = 0x0003C0D8 + id * 0xc; evergreen_context_pipe_state_set_sampler(ctx, state, offset); - if (state->nregs > 3) { - evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id); - } + evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id); } diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index c4b45e565c5..97aecc7a42c 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -802,6 +802,12 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx offset -= ctx->groups[R600_GROUP_RESOURCE].start_offset; id = ctx->groups[R600_GROUP_RESOURCE].offset_block_id[offset >> 2]; block = &ctx->groups[R600_GROUP_RESOURCE].blocks[id]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + return; + } block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; @@ -849,6 +855,10 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, offset -= ctx->groups[R600_GROUP_SAMPLER].start_offset; id = ctx->groups[R600_GROUP_SAMPLER].offset_block_id[offset >> 2]; block = &ctx->groups[R600_GROUP_SAMPLER].blocks[id]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; @@ -865,6 +875,13 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex offset -= ctx->groups[R600_GROUP_CONFIG].start_offset; id = ctx->groups[R600_GROUP_CONFIG].offset_block_id[offset >> 2]; block = &ctx->groups[R600_GROUP_CONFIG].blocks[id]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } + if (state->nregs <= 3) { + return; + } block->reg[0] = state->regs[3].value; block->reg[1] = state->regs[4].value; block->reg[2] = state->regs[5].value; @@ -880,10 +897,8 @@ void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r60 offset = 0x0003C000 + id * 0xc; r600_context_pipe_state_set_sampler(ctx, state, offset); - if (state->nregs > 3) { - offset = 0x0000A400 + id * 0x10; - r600_context_pipe_state_set_sampler_border(ctx, state, offset); - } + offset = 0x0000A400 + id * 0x10; + r600_context_pipe_state_set_sampler_border(ctx, state, offset); } void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) @@ -892,10 +907,8 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 offset = 0x0003C0D8 + id * 0xc; r600_context_pipe_state_set_sampler(ctx, state, offset); - if (state->nregs > 3) { - offset = 0x0000A600 + id * 0x10; - r600_context_pipe_state_set_sampler_border(ctx, state, offset); - } + offset = 0x0000A600 + id * 0x10; + r600_context_pipe_state_set_sampler_border(ctx, state, offset); } void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group) -- cgit v1.2.3 From 5e07483ed9783cd34e3d3dca74f9f1d002f1ce9d Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 27 Sep 2010 15:13:14 -0400 Subject: r600g: fix routing btw vertex & pixel shader Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_pipe.h | 2 ++ src/gallium/drivers/r600/r600_state2.c | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 1553088aa21..71c4a4b9d85 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1513,7 +1513,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader rstate->nregs = 0; for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 4ca83a42d77..5abf910c81c 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -149,6 +149,8 @@ void r600_translate_index_buffer2(struct r600_pipe_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, unsigned *start, unsigned count); +int r600_find_vs_semantic_index2(struct r600_shader *vs, + struct r600_shader *ps, int id); /* evergreen_state.c */ void evergreen_init_state_functions2(struct r600_pipe_context *rctx); diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 06a6f0d80cc..a88426fc9a4 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -104,6 +104,20 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade 0x00000000, 0xFFFFFFFF, shader->bo); } +int r600_find_vs_semantic_index2(struct r600_shader *vs, + struct r600_shader *ps, int id) +{ + struct r600_shader_io *input = &ps->input[id]; + + for (int i = 0; i < vs->noutput; i++) { + if (input->name == vs->output[i].name && + input->sid == vs->output[i].sid) { + return i - 1; + } + } + return 0; +} + static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; @@ -116,7 +130,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade rstate->nregs = 0; for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; -- cgit v1.2.3 From dfc546c047b0f6df254586e991f656faa781ddba Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 15:34:26 +0200 Subject: d3d11: advertise IDXGIDevice1, not just IDXGIDevice Fixes failure to create device in DirectX SDK samples. --- src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 2b613b82d11..af355f02272 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h @@ -1008,7 +1008,7 @@ COM_INTERFACE(IDXGIAdapter1, IDXGIAdapter) COM_INTERFACE(IDXGIFactory1, IDXGIFactory) template -struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObject +struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObject { ComPtr adapter; int priority; -- cgit v1.2.3 From f1afa8794e9dffa1f91a68c1c6aacb60aea54a18 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 15:40:41 +0200 Subject: d3d11: ignore StructureByteStride D3D11 applications are allowed to pass a random value if the buffer is not structured --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 1ecd67ca474..b7c6a44ab86 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -804,10 +804,6 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen { SYNCHRONIZED; -#if API >= 11 - if(desc->StructureByteStride > 1) - return E_NOTIMPL; -#endif struct pipe_resource* resource; DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc->BindFlags, desc->MiscFlags); HRESULT hr = create_resource(PIPE_BUFFER, desc->ByteWidth, 1, 1, 1, 1, DXGI_FORMAT_R8_UNORM, 0, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_buffer ? &resource : 0); -- cgit v1.2.3 From 94c2be73f417d5617946db306c28c318dbc094a2 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 16:15:44 +0200 Subject: d3d1x: link to libdrm for X11 platform too Thanks to Xavier Chantry. --- src/gallium/state_trackers/d3d1x/progs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index 938c77cc662..143e5316626 100644 --- a/src/gallium/state_trackers/d3d1x/progs/Makefile +++ b/src/gallium/state_trackers/d3d1x/progs/Makefile @@ -21,7 +21,7 @@ LIBS += ../../../winsys/sw/fbdev/libfbdev.a endif ifneq ($(findstring x11, $(EGL_PLATFORMS)),) -LDADD += -lX11 -lXext -lXfixes +LDADD += -ldrm -lX11 -lXext -lXfixes LIBS += ../../../winsys/sw/xlib/libws_xlib.a endif -- cgit v1.2.3 From ff531c5b05cb4c078b42c6b14e707646d3d158c9 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 18:07:45 +0200 Subject: ureg: support centroid interpolation --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 16 +++++++++++----- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 24 ++++++++++++++++++++---- 2 files changed, 31 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 3cf6893a9b9..7d13a17bdbc 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -96,7 +96,8 @@ struct ureg_program unsigned semantic_name; unsigned semantic_index; unsigned interp; - unsigned cylindrical_wrap; + unsigned char cylindrical_wrap; + unsigned char centroid; } fs_input[UREG_MAX_INPUT]; unsigned nr_fs_inputs; @@ -286,11 +287,12 @@ ureg_property_fs_coord_pixel_center(struct ureg_program *ureg, struct ureg_src -ureg_DECL_fs_input_cyl(struct ureg_program *ureg, +ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, unsigned semantic_name, unsigned semantic_index, unsigned interp_mode, - unsigned cylindrical_wrap) + unsigned cylindrical_wrap, + unsigned centroid) { unsigned i; @@ -306,6 +308,7 @@ ureg_DECL_fs_input_cyl(struct ureg_program *ureg, ureg->fs_input[i].semantic_index = semantic_index; ureg->fs_input[i].interp = interp_mode; ureg->fs_input[i].cylindrical_wrap = cylindrical_wrap; + ureg->fs_input[i].centroid = centroid; ureg->nr_fs_inputs++; } else { set_bad(ureg); @@ -1126,7 +1129,8 @@ emit_decl_fs(struct ureg_program *ureg, unsigned semantic_name, unsigned semantic_index, unsigned interpolate, - unsigned cylindrical_wrap) + unsigned cylindrical_wrap, + unsigned centroid) { union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3); @@ -1138,6 +1142,7 @@ emit_decl_fs(struct ureg_program *ureg, out[0].decl.Interpolate = interpolate; out[0].decl.Semantic = 1; out[0].decl.CylindricalWrap = cylindrical_wrap; + out[0].decl.Centroid = centroid; out[1].value = 0; out[1].decl_range.First = index; @@ -1287,7 +1292,8 @@ static void emit_decls( struct ureg_program *ureg ) ureg->fs_input[i].semantic_name, ureg->fs_input[i].semantic_index, ureg->fs_input[i].interp, - ureg->fs_input[i].cylindrical_wrap); + ureg->fs_input[i].cylindrical_wrap, + ureg->fs_input[i].centroid); } } else { for (i = 0; i < ureg->nr_gs_inputs; i++) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 07fb01ab7b3..acc463200a6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -158,11 +158,27 @@ ureg_property_fs_coord_pixel_center(struct ureg_program *ureg, */ struct ureg_src -ureg_DECL_fs_input_cyl(struct ureg_program *, +ureg_DECL_fs_input_cyl_centroid(struct ureg_program *, unsigned semantic_name, unsigned semantic_index, unsigned interp_mode, - unsigned cylindrical_wrap); + unsigned cylindrical_wrap, + unsigned centroid); + +static INLINE struct ureg_src +ureg_DECL_fs_input_cyl(struct ureg_program *ureg, + unsigned semantic_name, + unsigned semantic_index, + unsigned interp_mode, + unsigned cylindrical_wrap) +{ + return ureg_DECL_fs_input_cyl_centroid(ureg, + semantic_name, + semantic_index, + interp_mode, + cylindrical_wrap, + 0); +} static INLINE struct ureg_src ureg_DECL_fs_input(struct ureg_program *ureg, @@ -170,11 +186,11 @@ ureg_DECL_fs_input(struct ureg_program *ureg, unsigned semantic_index, unsigned interp_mode) { - return ureg_DECL_fs_input_cyl(ureg, + return ureg_DECL_fs_input_cyl_centroid(ureg, semantic_name, semantic_index, interp_mode, - 0); + 0, 0); } struct ureg_src -- cgit v1.2.3 From db6f1d0436b66435bac5e2b6db5d2f4e07e80473 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 18:08:58 +0200 Subject: d3d1x: support centroid interpolation --- .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp index 66b686687cf..615ce8c2550 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -37,18 +37,24 @@ #define fail(x) throw(x) #endif -static unsigned sm4_to_pipe_interpolation[] = +struct tgsi_interpolation { - TGSI_INTERPOLATE_PERSPECTIVE, /* UNDEFINED */ - TGSI_INTERPOLATE_CONSTANT, - TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR */ - TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_CENTROID */ - TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE */ - TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_CENTROID */ + unsigned interpolation; + bool centroid; +}; + +static tgsi_interpolation sm4_to_pipe_interpolation[] = +{ + {TGSI_INTERPOLATE_PERSPECTIVE, false}, /* UNDEFINED */ + {TGSI_INTERPOLATE_CONSTANT, false}, + {TGSI_INTERPOLATE_PERSPECTIVE, false}, /* LINEAR */ + {TGSI_INTERPOLATE_PERSPECTIVE, true}, /* LINEAR_CENTROID */ + {TGSI_INTERPOLATE_LINEAR, false}, /* LINEAR_NOPERSPECTIVE */ + {TGSI_INTERPOLATE_LINEAR, true}, /* LINEAR_NOPERSPECTIVE_CENTROID */ // Added in D3D10.1 - TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_SAMPLE */ - TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_SAMPLE */ + {TGSI_INTERPOLATE_PERSPECTIVE, true}, /* LINEAR_SAMPLE */ + {TGSI_INTERPOLATE_LINEAR, true}, /* LINEAR_NOPERSPECTIVE_SAMPLE */ }; static int sm4_to_pipe_sv[] = @@ -741,7 +747,7 @@ next:; check(idx >= 0); if(inputs.size() <= (unsigned)idx) inputs.resize(idx + 1); - inputs[idx] = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, idx, sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation]); + inputs[idx] = ureg_DECL_fs_input_cyl_centroid(ureg, TGSI_SEMANTIC_GENERIC, idx, sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation].interpolation, 0, sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation].centroid); break; case SM4_OPCODE_DCL_OUTPUT: check(idx >= 0); -- cgit v1.2.3 From b821fdd563d2a46f11f956fab049f6807fcdbf7f Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 18:25:41 +0200 Subject: d3d1x: properly support specifying MipLevels as 0 --- .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index b7c6a44ab86..9852dafa353 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -684,7 +684,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen templat.width0 = width; templat.height0 = height; templat.depth0 = depth; - templat.last_level = mip_levels ? (mip_levels - 1) : 0; + if(mip_levels) + templat.last_level = mip_levels - 1; + else + templat.last_level = MAX2(MAX2(util_logbase2(templat.width0), util_logbase2(templat.height0)), util_logbase2(templat.depth0)); templat.format = dxgi_to_pipe_format[format]; templat.bind = d3d11_to_pipe_bind_flags(bind_flags); if(c_p_u_access_flags & D3D11_CPU_ACCESS_READ) @@ -758,7 +761,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen HRESULT hr = create_resource(PIPE_TEXTURE_1D, desc->Width, 1, 1, desc->MipLevels, desc->ArraySize, desc->Format, 0, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_texture1d ? &resource : 0); if(hr != S_OK) return hr; - *out_texture1d = new GalliumD3D11Texture1D(this, resource, *desc, dxgi_usage); + D3D11_TEXTURE1D_DESC cdesc = *desc; + cdesc.MipLevels = resource->last_level + 1; + *out_texture1d = new GalliumD3D11Texture1D(this, resource, cdesc, dxgi_usage); return S_OK; } @@ -774,10 +779,12 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen HRESULT hr = create_resource(PIPE_TEXTURE_2D, desc->Width, desc->Height, 1, desc->MipLevels, desc->ArraySize, desc->Format, &desc->SampleDesc, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_texture2d ? &resource : 0); if(hr != S_OK) return hr; - if(desc->MipLevels == 1 && desc->ArraySize == 1) - *out_texture2d = new GalliumD3D11Surface(this, resource, *desc, dxgi_usage); + D3D11_TEXTURE2D_DESC cdesc = *desc; + cdesc.MipLevels = resource->last_level + 1; + if(cdesc.MipLevels == 1 && cdesc.ArraySize == 1) + *out_texture2d = new GalliumD3D11Surface(this, resource, cdesc, dxgi_usage); else - *out_texture2d = new GalliumD3D11Texture2D(this, resource, *desc, dxgi_usage); + *out_texture2d = new GalliumD3D11Texture2D(this, resource, cdesc, dxgi_usage); return S_OK; } @@ -793,7 +800,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen HRESULT hr = create_resource(PIPE_TEXTURE_3D, desc->Width, desc->Height, desc->Depth, desc->MipLevels, 1, desc->Format, 0, desc->Usage, desc->BindFlags, desc->CPUAccessFlags, desc->MiscFlags, initial_data, dxgi_usage, out_texture3d ? &resource : 0); if(hr != S_OK) return hr; - *out_texture3d = new GalliumD3D11Texture3D(this, resource, *desc, dxgi_usage); + D3D11_TEXTURE3D_DESC cdesc = *desc; + cdesc.MipLevels = resource->last_level + 1; + *out_texture3d = new GalliumD3D11Texture3D(this, resource, cdesc, dxgi_usage); return S_OK; } -- cgit v1.2.3 From e01e2e1883b57fdc84807496fdab4fed22f23900 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 19:30:34 +0200 Subject: d3d1x: put proper calling convention in headers, fixes 64-bit builds --- src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl | 2 +- src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl index d2b72f56a1c..40a0d6a8862 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl @@ -27,4 +27,4 @@ import "ocidl.idl"; import "d3d10_1.idl"; -HRESULT GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D10Device1** ppDevice); +HRESULT __stdcall GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D10Device1** ppDevice); diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl index 640cbfa881a..4dca1bcf91b 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl @@ -27,5 +27,5 @@ import "ocidl.idl"; import "d3d11.idl"; -HRESULT GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice); +HRESULT __stdcall GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice); -- cgit v1.2.3 From f976cd0c9ead6a5e63146c11823770176c149a12 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 20:25:17 +0200 Subject: d3d1x: rework DXGI for occlusion testing and default width/height --- .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 89 ++++++++++++++++++++-- .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl | 26 +++++-- .../state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c | 88 ++++++++++++++++----- 3 files changed, 174 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index a75a953abfb..e1c34611d14 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -65,10 +65,12 @@ struct GalliumDXGIObject : public GalliumPrivateDataComObject COM_INTERFACE(IGalliumDXGIBackend, IUnknown) +// TODO: somehow check whether the window is fully obscured or not struct GalliumDXGIIdentityBackend : public GalliumComObject { - virtual void * STDMETHODCALLTYPE BeginPresent( + virtual HRESULT STDMETHODCALLTYPE BeginPresent( HWND hwnd, + void** present_cookie, void** window, RECT *rect, RGNDATA **rgndata, @@ -84,7 +86,8 @@ struct GalliumDXGIIdentityBackend : public GalliumComObject // yes, because we like things looking good *preserve_aspect_ratio = TRUE; - return 0; + *present_cookie = 0; + return S_OK; } virtual void STDMETHODCALLTYPE EndPresent( @@ -92,6 +95,45 @@ struct GalliumDXGIIdentityBackend : public GalliumComObject void* present_cookie ) {} + + virtual HRESULT STDMETHODCALLTYPE TestPresent(HWND hwnd) + { + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetPresentSize( + HWND hwnd, + unsigned* width, + unsigned* height + ) + { + *width = 0; + *height = 0; + return S_OK; + } +}; + +// TODO: maybe install an X11 error hook, so we can return errors properly +struct GalliumDXGIX11IdentityBackend : public GalliumDXGIIdentityBackend +{ + Display* dpy; + + GalliumDXGIX11IdentityBackend(Display* dpy) + : dpy(dpy) + {} + + virtual HRESULT STDMETHODCALLTYPE GetPresentSize( + HWND hwnd, + unsigned* width, + unsigned* height + ) + { + XWindowAttributes xwa; + XGetWindowAttributes(dpy, (Window)hwnd, &xwa); + *width = xwa.width; + *height = xwa.height; + return S_OK; + } }; struct GalliumDXGIFactory : public GalliumDXGIObject @@ -107,6 +149,8 @@ struct GalliumDXGIFactory : public GalliumDXGIObject { if(p_backend) backend = p_backend; + else if(!strcmp(platform->name, "X11")) + backend.reset(new GalliumDXGIX11IdentityBackend((Display*)display)); else backend.reset(new GalliumDXGIIdentityBackend()); } @@ -887,6 +931,10 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectbackend->GetPresentSize(desc.OutputWindow, &width, &height); + if(!SUCCEEDED(hr)) + return hr; + + // On Windows, 8 is used, and a debug message saying so gets printed + if(!width) + width = 8; + if(!height) + height = 8; + + if(!desc.BufferDesc.Width) + desc.BufferDesc.Width = width; + if(!desc.BufferDesc.Height) + desc.BufferDesc.Height = height; + return S_OK; + } + virtual HRESULT STDMETHODCALLTYPE Present( UINT sync_interval, UINT flags) { + HRESULT hr; if(flags & DXGI_PRESENT_TEST) - return S_OK; + return parent->backend->TestPresent(desc.OutputWindow); if(!buffer0) { @@ -1030,7 +1102,11 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectbackend->BeginPresent(desc.OutputWindow, &cur_window, &rect, &rgndata, &preserve_aspect_ratio); + void* present_cookie; + hr = parent->backend->BeginPresent(desc.OutputWindow, &present_cookie, &cur_window, &rect, &rgndata, &preserve_aspect_ratio); + if(hr != S_OK) + return hr; + if(!cur_window || rect.left >= rect.right || rect.top >= rect.bottom) goto end_present; @@ -1051,6 +1127,9 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectright = prect->left + client_rect.right; prect->bottom = prect->top + client_rect.bottom; - rgndata_size = GetRegionData(hrgn, 0, NULL); - rgndata = HeapAlloc(GetProcessHeap(), 0, rgndata_size); - GetRegionData(hrgn, rgndata_size, rgndata); - *prgndata = rgndata; - // Windows doesn't preserve the aspect ratio // TODO: maybe let the user turn this on somehow *ppreserve_aspect_ratio = FALSE; - DeleteObject(hrgn); + *ppresent_cookie = rgndata; - return rgndata; + // TODO: check for errors and return them + return S_OK; } static void STDMETHODCALLTYPE WineDXGIBackend_EndPresent( - IGalliumDXGIBackend* This, - HWND hwnd, - void *present_cookie) + IGalliumDXGIBackend* This, + HWND hwnd, + void *present_cookie) { HeapFree(GetProcessHeap(), 0, present_cookie); } +static HRESULT STDMETHODCALLTYPE WineDXGIBackend_TestPresent( + IGalliumDXGIBackend* This, + HWND hwnd) +{ + HDC hdc; + HRGN hrgn; + RECT rgn_box; + int rgn_box_type; + + // TODO: is there a simpler way to check this? + hdc = GetDC(hwnd); + hrgn = CreateRectRgn(0, 0, 0, 0); + GetRandomRgn(hdc, hrgn, SYSRGN); + rgn_box_type = GetRgnBox(hrgn, &rgn_box); + DeleteObject(hrgn); + ReleaseDC(hwnd, hdc); + + return rgn_box_type == NULLREGION ? DXGI_STATUS_OCCLUDED : S_OK; +} + +static HRESULT STDMETHODCALLTYPE WineDXGIBackend_GetPresentSize( + IGalliumDXGIBackend* This, + HWND hwnd, + unsigned* width, + unsigned* height) +{ + RECT client_rect; + GetClientRect(hwnd, &client_rect); + *width = client_rect.right - client_rect.left; + *height = client_rect.bottom - client_rect.top; + + // TODO: check for errors and return them + return S_OK; +} + /* Wine should switch to C++ at least to be able to implement COM interfaces in a sensible way, * instead of this ridiculous amount of clumsy duplicated code everywhere * C++ exists exactly to avoid having to write the following code */ @@ -165,7 +213,9 @@ static IGalliumDXGIBackendVtbl WineDXGIBackend_vtbl = WineDXGIBackend_AddRef, WineDXGIBackend_Release, WineDXGIBackend_BeginPresent, - WineDXGIBackend_EndPresent + WineDXGIBackend_EndPresent, + WineDXGIBackend_TestPresent, + WineDXGIBackend_GetPresentSize }; IGalliumDXGIBackend* new_WineDXGIBackend() -- cgit v1.2.3 From a359eb80c5e141f625cfe42b4d97bf78cf25d128 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 21:40:13 +0200 Subject: d3d1x: fix Map --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 4abb4ac6b0f..36110595c20 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -1433,6 +1433,10 @@ changed: return sr; } + /* TODO: deferred contexts will need a different implementation of this, + * because we can't put the transfer info into the resource itself. + * Also, there are very different restrictions, for obvious reasons. + */ virtual HRESULT STDMETHODCALLTYPE Map( ID3D11Resource *iresource, unsigned subresource, @@ -1445,8 +1449,7 @@ changed: if(resource->transfers.count(subresource)) return E_FAIL; pipe_subresource sr = d3d11_to_pipe_subresource(resource->resource, subresource); - pipe_box box; - d3d11_to_pipe_box(resource->resource, sr.level, 0); + pipe_box box = d3d11_to_pipe_box(resource->resource, sr.level, 0); unsigned usage = 0; if(map_type == D3D11_MAP_READ) usage = PIPE_TRANSFER_READ; @@ -1470,8 +1473,7 @@ changed: return E_FAIL; } resource->transfers[subresource] = transfer; - pipe->transfer_map(pipe, transfer); - mapped_resource->pData = transfer->data; + mapped_resource->pData = pipe->transfer_map(pipe, transfer); mapped_resource->RowPitch = transfer->stride; mapped_resource->DepthPitch = transfer->slice_stride; return S_OK; -- cgit v1.2.3 From 029c099b54b24a4ecbe63f5fbe2df6c91da79b63 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Sep 2010 14:30:56 -0600 Subject: softpipe: allocate tile data on demand Changes in v2: - Invalidate last_tile_addr on any change, fixing regressions - Correct coding style Currently softpipe ends up allocating more than 200 MB of memory for each context due to the tile caches. Even worse, this memory is all explicitly cleared, which means that the kernel must actually back it with physical RAM right away. This change allocates tile memory on demand. Signed-off-by: Brian Paul --- src/gallium/drivers/softpipe/sp_tile_cache.c | 146 ++++++++++++++++++++------- src/gallium/drivers/softpipe/sp_tile_cache.h | 9 +- 2 files changed, 113 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index bf33fd94173..aa76b8aa1ec 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -38,6 +38,8 @@ #include "util/u_tile.h" #include "sp_tile_cache.h" +static struct softpipe_cached_tile * +sp_alloc_tile(struct softpipe_tile_cache *tc); /** @@ -94,9 +96,19 @@ sp_create_tile_cache( struct pipe_context *pipe ) if (tc) { tc->pipe = pipe; for (pos = 0; pos < NUM_ENTRIES; pos++) { - tc->entries[pos].addr.bits.invalid = 1; + tc->tile_addrs[pos].bits.invalid = 1; + } + tc->last_tile_addr.bits.invalid = 1; + + /* this allocation allows us to guarantee that allocation + * failures are never fatal later + */ + tc->tile = MALLOC_STRUCT( softpipe_cached_tile ); + if (!tc->tile) + { + FREE(tc); + return NULL; } - tc->last_tile = &tc->entries[0]; /* any tile */ /* XXX this code prevents valgrind warnings about use of uninitialized * memory in programs that don't clear the surface before rendering. @@ -120,7 +132,10 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc) for (pos = 0; pos < NUM_ENTRIES; pos++) { /*assert(tc->entries[pos].x < 0);*/ + FREE( tc->entries[pos] ); } + FREE( tc->tile ); + if (tc->transfer) { tc->pipe->transfer_destroy(tc->pipe, tc->transfer); } @@ -285,11 +300,14 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) uint numCleared = 0; assert(pt->resource); + if (!tc->tile) + tc->tile = sp_alloc_tile(tc); + /* clear the scratch tile to the clear value */ if (tc->depth_stencil) { - clear_tile(&tc->tile, pt->resource->format, tc->clear_val); + clear_tile(tc->tile, pt->resource->format, tc->clear_val); } else { - clear_tile_rgba(&tc->tile, pt->resource->format, tc->clear_color); + clear_tile_rgba(tc->tile, pt->resource->format, tc->clear_color); } /* push the tile to all positions marked as clear */ @@ -303,12 +321,12 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) pipe_put_tile_raw(tc->pipe, pt, x, y, TILE_SIZE, TILE_SIZE, - tc->tile.data.any, 0/*STRIDE*/); + tc->tile->data.any, 0/*STRIDE*/); } else { pipe_put_tile_rgba(tc->pipe, pt, x, y, TILE_SIZE, TILE_SIZE, - (float *) tc->tile.data.color); + (float *) tc->tile->data.color); } numCleared++; } @@ -323,6 +341,27 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) #endif } +static void +sp_flush_tile(struct softpipe_tile_cache* tc, unsigned pos) +{ + if (!tc->tile_addrs[pos].bits.invalid) { + if (tc->depth_stencil) { + pipe_put_tile_raw(tc->pipe, tc->transfer, + tc->tile_addrs[pos].bits.x * TILE_SIZE, + tc->tile_addrs[pos].bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, + tc->entries[pos]->data.depth32, 0/*STRIDE*/); + } + else { + pipe_put_tile_rgba(tc->pipe, tc->transfer, + tc->tile_addrs[pos].bits.x * TILE_SIZE, + tc->tile_addrs[pos].bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, + (float *) tc->entries[pos]->data.color); + } + tc->tile_addrs[pos].bits.invalid = 1; /* mark as empty */ + } +} /** * Flush the tile cache: write all dirty tiles back to the transfer. @@ -337,28 +376,21 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) if (pt) { /* caching a drawing transfer */ for (pos = 0; pos < NUM_ENTRIES; pos++) { - struct softpipe_cached_tile *tile = tc->entries + pos; - if (!tile->addr.bits.invalid) { - if (tc->depth_stencil) { - pipe_put_tile_raw(tc->pipe, pt, - tile->addr.bits.x * TILE_SIZE, - tile->addr.bits.y * TILE_SIZE, - TILE_SIZE, TILE_SIZE, - tile->data.depth32, 0/*STRIDE*/); - } - else { - pipe_put_tile_rgba(tc->pipe, pt, - tile->addr.bits.x * TILE_SIZE, - tile->addr.bits.y * TILE_SIZE, - TILE_SIZE, TILE_SIZE, - (float *) tile->data.color); - } - tile->addr.bits.invalid = 1; /* mark as empty */ - inuse++; + struct softpipe_cached_tile *tile = tc->entries[pos]; + if (!tile) + { + assert(tc->tile_addrs[pos].bits.invalid); + continue; } + + sp_flush_tile(tc, pos); + ++inuse; } sp_tile_cache_flush_clear(tc); + + + tc->last_tile_addr.bits.invalid = 1; } #if 0 @@ -366,6 +398,38 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) #endif } +static struct softpipe_cached_tile * +sp_alloc_tile(struct softpipe_tile_cache *tc) +{ + struct softpipe_cached_tile * tile = MALLOC_STRUCT(softpipe_cached_tile); + if (!tile) + { + /* in this case, steal an existing tile */ + if (!tc->tile) + { + unsigned pos; + for (pos = 0; pos < NUM_ENTRIES; ++pos) { + if (!tc->entries[pos]) + continue; + + sp_flush_tile(tc, pos); + tc->tile = tc->entries[pos]; + tc->entries[pos] = NULL; + break; + } + + /* this should never happen */ + if (!tc->tile) + abort(); + } + + tile = tc->tile; + tc->tile = NULL; + + tc->last_tile_addr.bits.invalid = 1; + } + return tile; +} /** * Get a tile from the cache. @@ -380,30 +444,35 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, /* cache pos/entry: */ const int pos = CACHE_POS(addr.bits.x, addr.bits.y); - struct softpipe_cached_tile *tile = tc->entries + pos; + struct softpipe_cached_tile *tile = tc->entries[pos]; + + if (!tile) { + tile = sp_alloc_tile(tc); + tc->entries[pos] = tile; + } - if (addr.value != tile->addr.value) { + if (addr.value != tc->tile_addrs[pos].value) { assert(pt->resource); - if (tile->addr.bits.invalid == 0) { + if (tc->tile_addrs[pos].bits.invalid == 0) { /* put dirty tile back in framebuffer */ if (tc->depth_stencil) { pipe_put_tile_raw(tc->pipe, pt, - tile->addr.bits.x * TILE_SIZE, - tile->addr.bits.y * TILE_SIZE, + tc->tile_addrs[pos].bits.x * TILE_SIZE, + tc->tile_addrs[pos].bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { pipe_put_tile_rgba(tc->pipe, pt, - tile->addr.bits.x * TILE_SIZE, - tile->addr.bits.y * TILE_SIZE, + tc->tile_addrs[pos].bits.x * TILE_SIZE, + tc->tile_addrs[pos].bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, (float *) tile->data.color); } } - tile->addr = addr; + tc->tile_addrs[pos] = addr; if (is_clear_flag_set(tc->clear_flags, addr)) { /* don't get tile from framebuffer, just clear it */ @@ -419,15 +488,15 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, /* get new tile data from transfer */ if (tc->depth_stencil) { pipe_get_tile_raw(tc->pipe, pt, - tile->addr.bits.x * TILE_SIZE, - tile->addr.bits.y * TILE_SIZE, + tc->tile_addrs[pos].bits.x * TILE_SIZE, + tc->tile_addrs[pos].bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { pipe_get_tile_rgba(tc->pipe, pt, - tile->addr.bits.x * TILE_SIZE, - tile->addr.bits.y * TILE_SIZE, + tc->tile_addrs[pos].bits.x * TILE_SIZE, + tc->tile_addrs[pos].bits.y * TILE_SIZE, TILE_SIZE, TILE_SIZE, (float *) tile->data.color); } @@ -435,6 +504,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, } tc->last_tile = tile; + tc->last_tile_addr = addr; return tile; } @@ -464,7 +534,7 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba, memset(tc->clear_flags, 255, sizeof(tc->clear_flags)); for (pos = 0; pos < NUM_ENTRIES; pos++) { - struct softpipe_cached_tile *tile = tc->entries + pos; - tile->addr.bits.invalid = 1; + tc->tile_addrs[pos].bits.invalid = 1; } + tc->last_tile_addr.bits.invalid = 1; } diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index e03d53eb24e..031c7c1ea5c 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -57,7 +57,6 @@ union tile_address { struct softpipe_cached_tile { - union tile_address addr; union { float color[TILE_SIZE][TILE_SIZE][4]; uint color32[TILE_SIZE][TILE_SIZE]; @@ -83,14 +82,16 @@ struct softpipe_tile_cache struct pipe_transfer *transfer; void *transfer_map; - struct softpipe_cached_tile entries[NUM_ENTRIES]; + union tile_address tile_addrs[NUM_ENTRIES]; + struct softpipe_cached_tile *entries[NUM_ENTRIES]; uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32]; float clear_color[4]; /**< for color bufs */ uint clear_val; /**< for z+stencil, or packed color clear value */ boolean depth_stencil; /**< Is the surface a depth/stencil format? */ - struct softpipe_cached_tile tile; /**< scratch tile for clears */ + struct softpipe_cached_tile *tile; /**< scratch tile for clears */ + union tile_address last_tile_addr; struct softpipe_cached_tile *last_tile; /**< most recently retrieved tile */ }; @@ -147,7 +148,7 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, { union tile_address addr = tile_address( x, y ); - if (tc->last_tile->addr.value == addr.value) + if (tc->last_tile_addr.value == addr.value) return tc->last_tile; return sp_find_cached_tile( tc, addr ); -- cgit v1.2.3 From 0282682e98561b8f0c6e8bd1b70b80ea00296e08 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 27 Sep 2010 17:00:07 -0400 Subject: r600g: fix occlusion query after change to block structure block->reg point to register value not block->pm4 which point to packet. Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600_priv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 25a65c6a10f..189644f31cd 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -66,10 +66,10 @@ static void inline r600_context_reg(struct r600_context *ctx, unsigned group_id, id = group->offset_block_id[(offset - group->start_offset) >> 2]; block = &group->blocks[id]; id = (offset - block->start_offset) >> 2; - block->pm4[id] &= ~mask; - block->pm4[id] |= value; + block->reg[id] &= ~mask; + block->reg[id] |= value; if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { - ctx->pm4_dirty_cdwords += 2 + block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; } block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; -- cgit v1.2.3 From 3446af01798bd4bfcdb68f984a3ecd8f7ff9a4a4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Sep 2010 15:00:22 -0600 Subject: llvmpipe: fix swizzling of texture border color The pipe_sampler_view's swizzle terms also apply to the texture border color. Simply move the apply_sampler_swizzle() call after we fetch the border color. Fixes many piglit texwrap failures. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index f53ad915945..33740f97599 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -171,8 +171,6 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, i, j, texel_out); - apply_sampler_swizzle(bld, texel_out); - /* * Note: if we find an app which frequently samples the texture border * we might want to implement a true conditional here to avoid sampling @@ -204,6 +202,8 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, border_chan_vec, texel_out[chan]); } } + + apply_sampler_swizzle(bld, texel_out); } -- cgit v1.2.3 From de2dfce0d97aca1b6242eb4db5d6e4b78301bb49 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Sep 2010 15:05:29 -0600 Subject: softpipe: fix swizzling of texture border color We ask the texture tile cache to swizzle the color for us since that's where the view/swizzling info is available. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 6 ++++-- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 20 ++++++++++++++++++++ src/gallium/drivers/softpipe/sp_tex_tile_cache.h | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 96ccf1da988..088e48f81fe 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -656,7 +656,8 @@ get_texel_2d(const struct sp_sampler_varient *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level)) { - return samp->sampler->border_color; + return sp_tex_tile_cache_border_color(samp->cache, + samp->sampler->border_color); } else { return get_texel_2d_no_border( samp, addr, x, y ); @@ -750,7 +751,8 @@ get_texel_3d(const struct sp_sampler_varient *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level) || z < 0 || z >= (int) u_minify(texture->depth0, level)) { - return samp->sampler->border_color; + return sp_tex_tile_cache_border_color(samp->cache, + samp->sampler->border_color); } else { return get_texel_3d_no_border( samp, addr, x, y, z ); diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index eb74f14a7be..e817c0c8cf5 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -298,3 +298,23 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, +/** + * Return the swizzled border color. + */ +const float * +sp_tex_tile_cache_border_color(struct softpipe_tex_tile_cache *tc, + const float border_color[4]) +{ + float rgba01[6]; + + COPY_4V(rgba01, border_color); + rgba01[PIPE_SWIZZLE_ZERO] = 0.0f; + rgba01[PIPE_SWIZZLE_ONE] = 1.0f; + + tc->swz_border_color[0] = rgba01[tc->swizzle_r]; + tc->swz_border_color[1] = rgba01[tc->swizzle_g]; + tc->swz_border_color[2] = rgba01[tc->swizzle_b]; + tc->swz_border_color[3] = rgba01[tc->swizzle_a]; + + return tc->swz_border_color; +} diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h index 0794ffa0c53..05f25133daa 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h @@ -90,6 +90,8 @@ struct softpipe_tex_tile_cache unsigned format; struct softpipe_tex_cached_tile *last_tile; /**< most recently retrieved tile */ + + float swz_border_color[4]; /**< swizzled border color */ }; @@ -154,7 +156,9 @@ sp_get_cached_tile_tex(struct softpipe_tex_tile_cache *tc, } - +const float * +sp_tex_tile_cache_border_color(struct softpipe_tex_tile_cache *tc, + const float border_color[4]); #endif /* SP_TEX_TILE_CACHE_H */ -- cgit v1.2.3 From 912682659414f45dc0afca1950db3be1738c0dad Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 27 Sep 2010 22:52:34 +0200 Subject: d3d11: fix reference counting so devices get freed --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 9852dafa353..95ea4e00fc1 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -145,6 +145,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #if API >= 11 immediate_context = GalliumD3D11ImmediateDeviceContext_Create(this, immediate_pipe, owns_immediate_pipe); + // release to the reference to ourselves that the immediate context took, to avoid a garbage cycle + immediate_context->Release(); #endif } -- cgit v1.2.3 From a73c6ce67b272b71dc814b3384d8c1c99f6c75e3 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Tue, 28 Sep 2010 00:16:22 +0200 Subject: d3d1x: work around crash in widl --- src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl | 7 ++++++- src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl index 40a0d6a8862..dddb3431b6f 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl @@ -27,4 +27,9 @@ import "ocidl.idl"; import "d3d10_1.idl"; -HRESULT __stdcall GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D10Device1** ppDevice); +// just adding __stdcall to the function makes at least one version of widl crash +[object, local] +interface IDummyInterfaceToPutWidlInComModeForGalliumD3D10 +{} + +HRESULT GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D10Device1** ppDevice); diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl index 4dca1bcf91b..76f8a7f7f6e 100644 --- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl +++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl @@ -27,5 +27,10 @@ import "ocidl.idl"; import "d3d11.idl"; -HRESULT __stdcall GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice); +// just adding __stdcall to the function makes at least one version of widl crash +[object, local] +interface IDummyInterfaceToPutWidlInComModeForGalliumD3D11 +{} + +HRESULT GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct pipe_context* context, BOOL owns_context, unsigned creation_flags, IDXGIAdapter* adapter, ID3D11Device** ppDevice); -- cgit v1.2.3 From 4da5f1b7c52fb02a3b2baa846931c2dd5ee1b92e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 27 Sep 2010 14:29:12 -0700 Subject: mesa: Force GL_ARB_copy_buffer to always be enabled As per discussions at XDS. --- src/mesa/drivers/dri/common/utils.c | 2 ++ src/mesa/drivers/dri/intel/intel_extensions.c | 2 -- src/mesa/main/bufferobj.c | 10 ++-------- src/mesa/main/extensions.c | 4 ++-- 4 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 0dd879abc96..0685d2f0e61 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -140,6 +140,7 @@ driGetRendererString( char * buffer, const char * hardware_name, +#define need_GL_ARB_copy_buffer #define need_GL_ARB_draw_buffers #define need_GL_ARB_multisample #define need_GL_ARB_texture_compression @@ -164,6 +165,7 @@ driGetRendererString( char * buffer, const char * hardware_name, #include "main/remap_helper.h" static const struct dri_extension all_mesa_extensions[] = { + { "GL_ARB_copy_buffer", GL_ARB_copy_buffer_functions }, { "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions }, { "GL_ARB_multisample", GL_ARB_multisample_functions }, { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 2edd6d21b48..112f71d3b8b 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -31,7 +31,6 @@ #include "utils.h" -#define need_GL_ARB_copy_buffer #define need_GL_ARB_draw_elements_base_vertex #define need_GL_ARB_framebuffer_object #define need_GL_ARB_map_buffer_range @@ -79,7 +78,6 @@ * i965_dri. */ static const struct dri_extension card_extensions[] = { - { "GL_ARB_copy_buffer", GL_ARB_copy_buffer_functions }, { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, { "GL_ARB_half_float_pixel", NULL }, { "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions }, diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 4797f29b4dc..61d46b936b2 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -74,15 +74,9 @@ get_buffer_target(GLcontext *ctx, GLenum target) case GL_PIXEL_UNPACK_BUFFER_EXT: return &ctx->Unpack.BufferObj; case GL_COPY_READ_BUFFER: - if (ctx->Extensions.ARB_copy_buffer) { - return &ctx->CopyReadBuffer; - } - break; + return &ctx->CopyReadBuffer; case GL_COPY_WRITE_BUFFER: - if (ctx->Extensions.ARB_copy_buffer) { - return &ctx->CopyWriteBuffer; - } - break; + return &ctx->CopyWriteBuffer; #if FEATURE_EXT_transform_feedback case GL_TRANSFORM_FEEDBACK_BUFFER: if (ctx->Extensions.EXT_transform_feedback) { diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index c5febc77cff..fe7eade3ebf 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -45,7 +45,7 @@ static const struct { int flag_offset; } default_extensions[] = { { OFF, "GL_ARB_blend_func_extended", F(ARB_blend_func_extended) }, - { OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) }, + { ON, "GL_ARB_copy_buffer", F(ARB_copy_buffer) }, { OFF, "GL_ARB_depth_buffer_float", F(ARB_depth_buffer_float) }, { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) }, { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, @@ -229,7 +229,7 @@ static const struct { void _mesa_enable_sw_extensions(GLcontext *ctx) { - ctx->Extensions.ARB_copy_buffer = GL_TRUE; + /*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/ ctx->Extensions.ARB_depth_clamp = GL_TRUE; ctx->Extensions.ARB_depth_texture = GL_TRUE; /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/ -- cgit v1.2.3 From 7f11d471e6bafae2282ec82ba4a19d30c440d28f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 27 Sep 2010 14:55:52 -0700 Subject: mesa: Force GL_SGIS_generate_mipmap to always be enabled As per discussions at XDS. --- src/mesa/drivers/dri/i810/i810context.c | 1 - src/mesa/drivers/dri/intel/intel_extensions.c | 1 - src/mesa/drivers/dri/mach64/mach64_context.c | 1 - src/mesa/drivers/dri/mga/mga_xmesa.c | 1 - src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 - src/mesa/drivers/dri/r128/r128_context.c | 1 - src/mesa/drivers/dri/r200/r200_context.c | 1 - src/mesa/drivers/dri/r300/r300_context.c | 1 - src/mesa/drivers/dri/r600/r600_context.c | 1 - src/mesa/drivers/dri/radeon/radeon_context.c | 1 - src/mesa/drivers/dri/tdfx/tdfx_context.c | 2 -- src/mesa/main/extensions.c | 6 +++--- src/mesa/main/hint.c | 4 ---- src/mesa/main/texparam.c | 28 ++++++-------------------- 14 files changed, 9 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 49f3ee88a61..8f52c20c2de 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -127,7 +127,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_texture_rectangle", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 112f71d3b8b..a946ee447a9 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -130,7 +130,6 @@ static const struct dri_extension card_extensions[] = { { "GL_NV_blend_square", NULL }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { "GL_NV_vertex_program1_1", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, #if FEATURE_OES_EGL_image { "GL_OES_EGL_image", GL_OES_EGL_image_functions }, #endif diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 72a44d96424..a20a1c9655b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -79,7 +79,6 @@ static const struct dri_extension card_extensions[] = { "GL_ARB_multitexture", NULL }, { "GL_EXT_texture_edge_clamp", NULL }, { "GL_MESA_ycbcr_texture", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 3a31dfb44a3..069947e252a 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -394,7 +394,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_stencil_wrap", NULL }, { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, { "GL_MESA_ycbcr_texture", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 0fecdee66e2..fbe4edea584 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -62,7 +62,6 @@ static const struct dri_extension nouveau_extensions[] = { { "GL_EXT_texture_lod_bias", NULL }, { "GL_NV_blend_square", NULL }, { "GL_NV_texture_env_combine4", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 78607083830..b917e0e0dcd 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -81,7 +81,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_stencil_wrap", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 5896296021f..3b85e84d903 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -137,7 +137,6 @@ static const struct dri_extension card_extensions[] = { "GL_ATI_texture_mirror_once", NULL }, { "GL_MESA_pack_invert", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 3d2f8928fa6..ef495aabb91 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -134,7 +134,6 @@ static const struct dri_extension card_extensions[] = { {"GL_MESAX_texture_float", NULL}, {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_SGIS_generate_mipmap", NULL}, {NULL, NULL} /* *INDENT-ON* */ }; diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index f4e67163506..cd34e6208d8 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -146,7 +146,6 @@ static const struct dri_extension card_extensions[] = { {"GL_MESAX_texture_float", NULL}, {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_SGIS_generate_mipmap", NULL}, {"GL_ARB_pixel_buffer_object", NULL}, {"GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, {NULL, NULL} diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index ee65d7ff3d0..0b92c514660 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -101,7 +101,6 @@ static const struct dri_extension card_extensions[] = { "GL_ATI_texture_mirror_once", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index c30fcf3a6f7..6f1e8bfc498 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -136,8 +136,6 @@ static void tdfxDDInitExtensions( GLcontext *ctx ) if ( TDFX_IS_NAPALM( fxMesa ) ) { driInitExtensions( ctx, napalm_extensions, GL_FALSE ); - } else { - _mesa_enable_extension( ctx, "GL_SGIS_generate_mipmap" ); } } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index fe7eade3ebf..0ca068c2db2 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -206,7 +206,7 @@ static const struct { { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { ON, "GL_OES_read_format", F(OES_read_format) }, { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) }, - { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, + { ON, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, @@ -364,7 +364,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.NV_fragment_program_option = GL_TRUE; #endif ctx->Extensions.SGI_texture_color_table = GL_TRUE; - ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; + /*ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;*/ ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; @@ -437,7 +437,7 @@ _mesa_enable_1_4_extensions(GLcontext *ctx) ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_stencil_wrap = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; - ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; + /*ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;*/ } diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index e2d4129a382..8902ae37763 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -97,10 +97,6 @@ _mesa_Hint( GLenum target, GLenum mode ) /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (!ctx->Extensions.SGIS_generate_mipmap) { - _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); - return; - } if (ctx->Hint.GenerateMipmap == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 745a0aeec9d..187049c0701 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -291,17 +291,10 @@ set_tex_parameteri(GLcontext *ctx, return GL_TRUE; case GL_GENERATE_MIPMAP_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - if (texObj->GenerateMipmap != params[0]) { - flush(ctx, texObj); - texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; - return GL_TRUE; - } - return GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); + if (texObj->GenerateMipmap != params[0]) { + flush(ctx, texObj); + texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; + return GL_TRUE; } return GL_FALSE; @@ -1126,11 +1119,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) error = GL_TRUE; break; case GL_GENERATE_MIPMAP_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLfloat) obj->GenerateMipmap; - } - else - error = GL_TRUE; + *params = (GLfloat) obj->GenerateMipmap; break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { @@ -1291,12 +1280,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) } break; case GL_GENERATE_MIPMAP_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLint) obj->GenerateMipmap; - } - else { - error = GL_TRUE; - } + *params = (GLint) obj->GenerateMipmap; break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { -- cgit v1.2.3 From 4b1f98241f9601c2b163bb41e45aa567f9cd61dd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 18 Sep 2010 16:21:00 +0200 Subject: Remove GL_MESA_packed_depth_stencil This extension was never enabled in any driver. --- src/glx/compsize.c | 8 -------- src/mesa/drivers/dri/mga/mgapixel.c | 12 +++--------- src/mesa/main/extensions.c | 1 - src/mesa/main/mtypes.h | 1 - 4 files changed, 3 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/glx/compsize.c b/src/glx/compsize.c index 5ba6dc919e5..ccb3a0e924e 100644 --- a/src/glx/compsize.c +++ b/src/glx/compsize.c @@ -52,15 +52,11 @@ __glElementsPerGroup(GLenum format, GLenum type) case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: - case GL_UNSIGNED_SHORT_15_1_MESA: - case GL_UNSIGNED_SHORT_1_15_REV_MESA: case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_NV: - case GL_UNSIGNED_INT_24_8_MESA: - case GL_UNSIGNED_INT_8_24_REV_MESA: return 1; default: break; @@ -114,8 +110,6 @@ __glBytesPerElement(GLenum type) case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: - case GL_UNSIGNED_SHORT_15_1_MESA: - case GL_UNSIGNED_SHORT_1_15_REV_MESA: return 2; case GL_UNSIGNED_BYTE: case GL_BYTE: @@ -130,8 +124,6 @@ __glBytesPerElement(GLenum type) case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_NV: - case GL_UNSIGNED_INT_24_8_MESA: - case GL_UNSIGNED_INT_8_24_REV_MESA: return 4; default: return 0; diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c index 664f7c77c2b..9cbdbe02c94 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.c +++ b/src/mesa/drivers/dri/mga/mgapixel.c @@ -55,7 +55,6 @@ (((unsigned long)p) - (unsigned long)mmesa->mgaScreen->buffers.map) -#if defined(MESA_packed_depth_stencil) static GLboolean check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -64,7 +63,7 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - return ( type == GL_UNSIGNED_INT_24_8_MESA && + return ( type == GL_UNSIGNED_INT_24_8 && ctx->Visual->DepthBits == 24 && ctx->Visual->StencilBits == 8 && mmesa->mgaScreen->cpp == 4 && @@ -78,7 +77,6 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, pitch % 32 == 0 && pitch < 4096 ); } -#endif static GLboolean @@ -252,13 +250,11 @@ mgaTryReadPixels( GLcontext *ctx, return GL_FALSE; switch (format) { -#if defined(MESA_packed_depth_stencil) - case GL_DEPTH_STENCIL_MESA: + case GL_DEPTH_STENCIL: ok = check_depth_stencil_24_8(ctx, type, pack, pixels, size, pitch); planemask = ~0; source = mmesa->mgaScreen->depthOffset; break; -#endif case GL_DEPTH_COMPONENT: ok = check_depth(ctx, type, pack, pixels, size, pitch); @@ -494,8 +490,7 @@ mgaTryDrawPixels( GLcontext *ctx, switch (format) { -#if defined(MESA_packed_depth_stencil) - case GL_DEPTH_STENCIL_MESA: + case GL_DEPTH_STENCIL: dest = mmesa->mgaScreen->depthOffset; planemask = ~0; if (!check_depth_stencil_24_8(ctx, type, unpack, pixels, size, pitch) || @@ -503,7 +498,6 @@ mgaTryDrawPixels( GLcontext *ctx, !check_stencil_per_fragment_ops(ctx)) return GL_FALSE; break; -#endif case GL_DEPTH_COMPONENT: dest = mmesa->mgaScreen->depthOffset; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 0ca068c2db2..966c687b9ce 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -184,7 +184,6 @@ static const struct { { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) }, { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, - { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, { OFF, "GL_MESA_texture_array", F(MESA_texture_array) }, { OFF, "GL_MESA_texture_signed_rgba", F(MESA_texture_signed_rgba) }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d7c5d28c2cf..4cd968e40f7 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2687,7 +2687,6 @@ struct gl_extensions GLboolean IBM_rasterpos_clip; GLboolean IBM_multimode_draw_arrays; GLboolean MESA_pack_invert; - GLboolean MESA_packed_depth_stencil; GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; GLboolean MESA_texture_array; -- cgit v1.2.3 From 02984e3536bf9a4f149916b45d727659c8dc9a7c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 18 Sep 2010 16:41:44 +0200 Subject: Remove GL_EXT_cull_vertex This is only used in the i915 driver where it provides little benefit for very few applications that use it with fixed function TNL. --- src/mesa/drivers/dri/i915/intel_render.c | 1 - src/mesa/drivers/dri/intel/intel_extensions.c | 2 - src/mesa/drivers/windows/fx/fxopengl.def | 2 - src/mesa/main/api_exec.c | 2 - src/mesa/main/clip.c | 43 - src/mesa/main/clip.h | 7 - src/mesa/main/enable.c | 7 - src/mesa/main/extensions.c | 1 - src/mesa/main/mtypes.h | 2 - src/mesa/main/remap_helper.h | 3439 ++++++++++++------------- src/mesa/sources.mak | 1 - src/mesa/tnl/t_pipeline.h | 1 - src/mesa/tnl/t_vb_cull.c | 96 - 13 files changed, 1719 insertions(+), 1885 deletions(-) delete mode 100644 src/mesa/tnl/t_vb_cull.c (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c index add0adacb56..dc6bc9a71c0 100644 --- a/src/mesa/drivers/dri/i915/intel_render.c +++ b/src/mesa/drivers/dri/i915/intel_render.c @@ -266,7 +266,6 @@ static const struct tnl_pipeline_stage _intel_render_stage = { const struct tnl_pipeline_stage *intel_pipeline[] = { &_tnl_vertex_transform_stage, - &_tnl_vertex_cull_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, &_tnl_fog_coordinate_stage, diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index a946ee447a9..d741f827678 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -46,7 +46,6 @@ #define need_GL_EXT_blend_equation_separate #define need_GL_EXT_blend_func_separate #define need_GL_EXT_blend_minmax -#define need_GL_EXT_cull_vertex #define need_GL_EXT_draw_buffers2 #define need_GL_EXT_fog_coord #define need_GL_EXT_framebuffer_blit @@ -106,7 +105,6 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, { "GL_EXT_blend_logic_op", NULL }, { "GL_EXT_blend_subtract", NULL }, - { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions }, diff --git a/src/mesa/drivers/windows/fx/fxopengl.def b/src/mesa/drivers/windows/fx/fxopengl.def index d65b763d25e..bc615e93ae6 100644 --- a/src/mesa/drivers/windows/fx/fxopengl.def +++ b/src/mesa/drivers/windows/fx/fxopengl.def @@ -135,8 +135,6 @@ EXPORTS glCopyTexSubImage3D glCopyTexSubImage3DEXT glCullFace - glCullParameterdvEXT - glCullParameterfvEXT glDeleteBuffersARB glDeleteFencesNV glDeleteLists diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index c3c710f5ef9..b87aa47d88b 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -224,8 +224,6 @@ _mesa_create_exec_table(void) SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); SET_ColorMaterial(exec, _mesa_ColorMaterial); - SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); - SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); SET_DepthFunc(exec, _mesa_DepthFunc); SET_DepthMask(exec, _mesa_DepthMask); SET_DepthRange(exec, _mesa_DepthRange); diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index 96c80e6ef8d..be8ce4278cd 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -114,46 +114,3 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation ) equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; } - -void GLAPIENTRY -_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - switch (cap) { - case GL_CULL_VERTEX_EYE_POSITION_EXT: - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - COPY_4FV(ctx->Transform.CullEyePos, v); - - _mesa_transform_vector( ctx->Transform.CullObjPos, - ctx->Transform.CullEyePos, - ctx->ModelviewMatrixStack.Top->inv ); - break; - - case GL_CULL_VERTEX_OBJECT_POSITION_EXT: - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - COPY_4FV(ctx->Transform.CullObjPos, v); - - _mesa_transform_vector( ctx->Transform.CullEyePos, - ctx->Transform.CullObjPos, - ctx->ModelviewMatrixStack.Top->m ); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glCullParameterfvEXT" ); - } -} - -void GLAPIENTRY -_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v) -{ - GLfloat f[4]; - - f[0] = (GLfloat)v[0]; - f[1] = (GLfloat)v[1]; - f[2] = (GLfloat)v[2]; - f[3] = (GLfloat)v[3]; - - _mesa_CullParameterfvEXT(cap, f); -} - diff --git a/src/mesa/main/clip.h b/src/mesa/main/clip.h index ac472d66e08..11431dcfce0 100644 --- a/src/mesa/main/clip.h +++ b/src/mesa/main/clip.h @@ -39,11 +39,4 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *equation ); extern void GLAPIENTRY _mesa_GetClipPlane( GLenum plane, GLdouble *equation ); -extern void GLAPIENTRY -_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v); - -extern void GLAPIENTRY -_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v); - - #endif diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 15ce2d12254..b2be44830a0 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -335,13 +335,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.CullFlag = state; break; - case GL_CULL_VERTEX_EXT: - CHECK_EXTENSION(EXT_cull_vertex, cap); - if (ctx->Transform.CullVertexFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.CullVertexFlag = state; - break; case GL_DEPTH_TEST: if (ctx->Depth.Test == state) return; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 966c687b9ce..9b723ef74bd 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -114,7 +114,6 @@ static const struct { { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, { OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, - { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) }, { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4cd968e40f7..0a69bcc4e32 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1405,7 +1405,6 @@ struct gl_transform_attrib GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */ GLboolean DepthClamp; /**< GL_ARB_depth_clamp */ - GLboolean CullVertexFlag; /**< True if GL_CULL_VERTEX_EXT is enabled */ GLfloat CullEyePos[4]; GLfloat CullObjPos[4]; }; @@ -2624,7 +2623,6 @@ struct gl_extensions GLboolean EXT_blend_minmax; GLboolean EXT_blend_subtract; GLboolean EXT_clip_volume_hint; - GLboolean EXT_cull_vertex; GLboolean EXT_compiled_vertex_array; GLboolean EXT_copy_texture; GLboolean EXT_depth_bounds_test; diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h index 631cc901588..fe3e0fd9123 100644 --- a/src/mesa/main/remap_helper.h +++ b/src/mesa/main/remap_helper.h @@ -65,4122 +65,4122 @@ static const char _mesa_function_pool[] = "\0" "glLoadIdentity\0" "\0" - /* _mesa_function_pool[172]: SampleCoverageARB (will be remapped) */ + /* _mesa_function_pool[172]: GetCombinerOutputParameterfvNV (will be remapped) */ + "iiip\0" + "glGetCombinerOutputParameterfvNV\0" + "\0" + /* _mesa_function_pool[211]: SampleCoverageARB (will be remapped) */ "fi\0" "glSampleCoverage\0" "glSampleCoverageARB\0" "\0" - /* _mesa_function_pool[213]: ConvolutionFilter1D (offset 348) */ + /* _mesa_function_pool[252]: ConvolutionFilter1D (offset 348) */ "iiiiip\0" "glConvolutionFilter1D\0" "glConvolutionFilter1DEXT\0" "\0" - /* _mesa_function_pool[268]: BeginQueryARB (will be remapped) */ + /* _mesa_function_pool[307]: BeginQueryARB (will be remapped) */ "ii\0" "glBeginQuery\0" "glBeginQueryARB\0" "\0" - /* _mesa_function_pool[301]: RasterPos3dv (offset 71) */ + /* _mesa_function_pool[340]: RasterPos3dv (offset 71) */ "p\0" "glRasterPos3dv\0" "\0" - /* _mesa_function_pool[319]: PointParameteriNV (will be remapped) */ + /* _mesa_function_pool[358]: PointParameteriNV (will be remapped) */ "ii\0" "glPointParameteri\0" "glPointParameteriNV\0" "\0" - /* _mesa_function_pool[361]: GetProgramiv (will be remapped) */ + /* _mesa_function_pool[400]: GetProgramiv (will be remapped) */ "iip\0" "glGetProgramiv\0" "\0" - /* _mesa_function_pool[381]: MultiTexCoord3sARB (offset 398) */ + /* _mesa_function_pool[420]: MultiTexCoord3sARB (offset 398) */ "iiii\0" "glMultiTexCoord3s\0" "glMultiTexCoord3sARB\0" "\0" - /* _mesa_function_pool[426]: SecondaryColor3iEXT (will be remapped) */ + /* _mesa_function_pool[465]: SecondaryColor3iEXT (will be remapped) */ "iii\0" "glSecondaryColor3i\0" "glSecondaryColor3iEXT\0" "\0" - /* _mesa_function_pool[472]: WindowPos3fMESA (will be remapped) */ + /* _mesa_function_pool[511]: WindowPos3fMESA (will be remapped) */ "fff\0" "glWindowPos3f\0" "glWindowPos3fARB\0" "glWindowPos3fMESA\0" "\0" - /* _mesa_function_pool[526]: TexCoord1iv (offset 99) */ + /* _mesa_function_pool[565]: TexCoord1iv (offset 99) */ "p\0" "glTexCoord1iv\0" "\0" - /* _mesa_function_pool[543]: TexCoord4sv (offset 125) */ + /* _mesa_function_pool[582]: TexCoord4sv (offset 125) */ "p\0" "glTexCoord4sv\0" "\0" - /* _mesa_function_pool[560]: RasterPos4s (offset 84) */ + /* _mesa_function_pool[599]: RasterPos4s (offset 84) */ "iiii\0" "glRasterPos4s\0" "\0" - /* _mesa_function_pool[580]: PixelTexGenParameterfvSGIS (will be remapped) */ + /* _mesa_function_pool[619]: PixelTexGenParameterfvSGIS (will be remapped) */ "ip\0" "glPixelTexGenParameterfvSGIS\0" "\0" - /* _mesa_function_pool[613]: ActiveTextureARB (offset 374) */ + /* _mesa_function_pool[652]: ActiveTextureARB (offset 374) */ "i\0" "glActiveTexture\0" "glActiveTextureARB\0" "\0" - /* _mesa_function_pool[651]: BlitFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[690]: BlitFramebufferEXT (will be remapped) */ "iiiiiiiiii\0" "glBlitFramebuffer\0" "glBlitFramebufferEXT\0" "\0" - /* _mesa_function_pool[702]: TexCoord1f (offset 96) */ + /* _mesa_function_pool[741]: TexCoord1f (offset 96) */ "f\0" "glTexCoord1f\0" "\0" - /* _mesa_function_pool[718]: TexCoord1d (offset 94) */ + /* _mesa_function_pool[757]: TexCoord1d (offset 94) */ "d\0" "glTexCoord1d\0" "\0" - /* _mesa_function_pool[734]: VertexAttrib4ubvNV (will be remapped) */ + /* _mesa_function_pool[773]: VertexAttrib4ubvNV (will be remapped) */ "ip\0" "glVertexAttrib4ubvNV\0" "\0" - /* _mesa_function_pool[759]: TexCoord1i (offset 98) */ + /* _mesa_function_pool[798]: TexCoord1i (offset 98) */ "i\0" "glTexCoord1i\0" "\0" - /* _mesa_function_pool[775]: GetProgramNamedParameterdvNV (will be remapped) */ + /* _mesa_function_pool[814]: GetProgramNamedParameterdvNV (will be remapped) */ "iipp\0" "glGetProgramNamedParameterdvNV\0" "\0" - /* _mesa_function_pool[812]: Histogram (offset 367) */ + /* _mesa_function_pool[851]: Histogram (offset 367) */ "iiii\0" "glHistogram\0" "glHistogramEXT\0" "\0" - /* _mesa_function_pool[845]: TexCoord1s (offset 100) */ + /* _mesa_function_pool[884]: TexCoord1s (offset 100) */ "i\0" "glTexCoord1s\0" "\0" - /* _mesa_function_pool[861]: GetMapfv (offset 267) */ + /* _mesa_function_pool[900]: GetMapfv (offset 267) */ "iip\0" "glGetMapfv\0" "\0" - /* _mesa_function_pool[877]: EvalCoord1f (offset 230) */ + /* _mesa_function_pool[916]: EvalCoord1f (offset 230) */ "f\0" "glEvalCoord1f\0" "\0" - /* _mesa_function_pool[894]: TexImage4DSGIS (dynamic) */ + /* _mesa_function_pool[933]: TexImage4DSGIS (dynamic) */ "iiiiiiiiiip\0" "glTexImage4DSGIS\0" "\0" - /* _mesa_function_pool[924]: PolygonStipple (offset 175) */ + /* _mesa_function_pool[963]: PolygonStipple (offset 175) */ "p\0" "glPolygonStipple\0" "\0" - /* _mesa_function_pool[944]: WindowPos2dvMESA (will be remapped) */ + /* _mesa_function_pool[983]: WindowPos2dvMESA (will be remapped) */ "p\0" "glWindowPos2dv\0" "glWindowPos2dvARB\0" "glWindowPos2dvMESA\0" "\0" - /* _mesa_function_pool[999]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[1038]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiColor3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[1043]: BlendEquationSeparateEXT (will be remapped) */ + /* _mesa_function_pool[1082]: BlendEquationSeparateEXT (will be remapped) */ "ii\0" "glBlendEquationSeparate\0" "glBlendEquationSeparateEXT\0" "glBlendEquationSeparateATI\0" "\0" - /* _mesa_function_pool[1125]: ListParameterfSGIX (dynamic) */ + /* _mesa_function_pool[1164]: ListParameterfSGIX (dynamic) */ "iif\0" "glListParameterfSGIX\0" "\0" - /* _mesa_function_pool[1151]: SecondaryColor3bEXT (will be remapped) */ + /* _mesa_function_pool[1190]: SecondaryColor3bEXT (will be remapped) */ "iii\0" "glSecondaryColor3b\0" "glSecondaryColor3bEXT\0" "\0" - /* _mesa_function_pool[1197]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */ + /* _mesa_function_pool[1236]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */ "pppp\0" "glTexCoord4fColor4fNormal3fVertex4fvSUN\0" "\0" - /* _mesa_function_pool[1243]: GetPixelMapfv (offset 271) */ + /* _mesa_function_pool[1282]: GetPixelMapfv (offset 271) */ "ip\0" "glGetPixelMapfv\0" "\0" - /* _mesa_function_pool[1263]: Color3uiv (offset 22) */ + /* _mesa_function_pool[1302]: Color3uiv (offset 22) */ "p\0" "glColor3uiv\0" "\0" - /* _mesa_function_pool[1278]: IsEnabled (offset 286) */ + /* _mesa_function_pool[1317]: IsEnabled (offset 286) */ "i\0" "glIsEnabled\0" "\0" - /* _mesa_function_pool[1293]: VertexAttrib4svNV (will be remapped) */ + /* _mesa_function_pool[1332]: VertexAttrib4svNV (will be remapped) */ "ip\0" "glVertexAttrib4svNV\0" "\0" - /* _mesa_function_pool[1317]: EvalCoord2fv (offset 235) */ + /* _mesa_function_pool[1356]: EvalCoord2fv (offset 235) */ "p\0" "glEvalCoord2fv\0" "\0" - /* _mesa_function_pool[1335]: GetBufferSubDataARB (will be remapped) */ + /* _mesa_function_pool[1374]: GetBufferSubDataARB (will be remapped) */ "iiip\0" "glGetBufferSubData\0" "glGetBufferSubDataARB\0" "\0" - /* _mesa_function_pool[1382]: BufferSubDataARB (will be remapped) */ + /* _mesa_function_pool[1421]: BufferSubDataARB (will be remapped) */ "iiip\0" "glBufferSubData\0" "glBufferSubDataARB\0" "\0" - /* _mesa_function_pool[1423]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[1462]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */ "ppp\0" "glTexCoord2fColor4ubVertex3fvSUN\0" "\0" - /* _mesa_function_pool[1461]: AttachShader (will be remapped) */ + /* _mesa_function_pool[1500]: AttachShader (will be remapped) */ "ii\0" "glAttachShader\0" "\0" - /* _mesa_function_pool[1480]: VertexAttrib2fARB (will be remapped) */ + /* _mesa_function_pool[1519]: VertexAttrib2fARB (will be remapped) */ "iff\0" "glVertexAttrib2f\0" "glVertexAttrib2fARB\0" "\0" - /* _mesa_function_pool[1522]: GetDebugLogLengthMESA (dynamic) */ + /* _mesa_function_pool[1561]: GetDebugLogLengthMESA (dynamic) */ "iii\0" "glGetDebugLogLengthMESA\0" "\0" - /* _mesa_function_pool[1551]: GetMapiv (offset 268) */ + /* _mesa_function_pool[1590]: GetMapiv (offset 268) */ "iip\0" "glGetMapiv\0" "\0" - /* _mesa_function_pool[1567]: VertexAttrib3fARB (will be remapped) */ + /* _mesa_function_pool[1606]: VertexAttrib3fARB (will be remapped) */ "ifff\0" "glVertexAttrib3f\0" "glVertexAttrib3fARB\0" "\0" - /* _mesa_function_pool[1610]: Indexubv (offset 316) */ + /* _mesa_function_pool[1649]: Indexubv (offset 316) */ "p\0" "glIndexubv\0" "\0" - /* _mesa_function_pool[1624]: GetQueryivARB (will be remapped) */ + /* _mesa_function_pool[1663]: GetQueryivARB (will be remapped) */ "iip\0" "glGetQueryiv\0" "glGetQueryivARB\0" "\0" - /* _mesa_function_pool[1658]: TexImage3D (offset 371) */ + /* _mesa_function_pool[1697]: TexImage3D (offset 371) */ "iiiiiiiiip\0" "glTexImage3D\0" "glTexImage3DEXT\0" "\0" - /* _mesa_function_pool[1699]: ReplacementCodeuiVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[1738]: ReplacementCodeuiVertex3fvSUN (dynamic) */ "pp\0" "glReplacementCodeuiVertex3fvSUN\0" "\0" - /* _mesa_function_pool[1735]: EdgeFlagPointer (offset 312) */ + /* _mesa_function_pool[1774]: EdgeFlagPointer (offset 312) */ "ip\0" "glEdgeFlagPointer\0" "\0" - /* _mesa_function_pool[1757]: Color3ubv (offset 20) */ + /* _mesa_function_pool[1796]: Color3ubv (offset 20) */ "p\0" "glColor3ubv\0" "\0" - /* _mesa_function_pool[1772]: GetQueryObjectivARB (will be remapped) */ + /* _mesa_function_pool[1811]: GetQueryObjectivARB (will be remapped) */ "iip\0" "glGetQueryObjectiv\0" "glGetQueryObjectivARB\0" "\0" - /* _mesa_function_pool[1818]: Vertex3dv (offset 135) */ + /* _mesa_function_pool[1857]: Vertex3dv (offset 135) */ "p\0" "glVertex3dv\0" "\0" - /* _mesa_function_pool[1833]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[1872]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiTexCoord2fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[1880]: CompressedTexSubImage2DARB (will be remapped) */ + /* _mesa_function_pool[1919]: CompressedTexSubImage2DARB (will be remapped) */ "iiiiiiiip\0" "glCompressedTexSubImage2D\0" "glCompressedTexSubImage2DARB\0" "\0" - /* _mesa_function_pool[1946]: CombinerOutputNV (will be remapped) */ + /* _mesa_function_pool[1985]: CombinerOutputNV (will be remapped) */ "iiiiiiiiii\0" "glCombinerOutputNV\0" "\0" - /* _mesa_function_pool[1977]: VertexAttribs3fvNV (will be remapped) */ + /* _mesa_function_pool[2016]: VertexAttribs3fvNV (will be remapped) */ "iip\0" "glVertexAttribs3fvNV\0" "\0" - /* _mesa_function_pool[2003]: Uniform2fARB (will be remapped) */ + /* _mesa_function_pool[2042]: Uniform2fARB (will be remapped) */ "iff\0" "glUniform2f\0" "glUniform2fARB\0" "\0" - /* _mesa_function_pool[2035]: LightModeliv (offset 166) */ + /* _mesa_function_pool[2074]: LightModeliv (offset 166) */ "ip\0" "glLightModeliv\0" "\0" - /* _mesa_function_pool[2054]: VertexAttrib1svARB (will be remapped) */ + /* _mesa_function_pool[2093]: VertexAttrib1svARB (will be remapped) */ "ip\0" "glVertexAttrib1sv\0" "glVertexAttrib1svARB\0" "\0" - /* _mesa_function_pool[2097]: VertexAttribs1dvNV (will be remapped) */ + /* _mesa_function_pool[2136]: VertexAttribs1dvNV (will be remapped) */ "iip\0" "glVertexAttribs1dvNV\0" "\0" - /* _mesa_function_pool[2123]: Uniform2ivARB (will be remapped) */ + /* _mesa_function_pool[2162]: Uniform2ivARB (will be remapped) */ "iip\0" "glUniform2iv\0" "glUniform2ivARB\0" "\0" - /* _mesa_function_pool[2157]: GetImageTransformParameterfvHP (dynamic) */ + /* _mesa_function_pool[2196]: GetImageTransformParameterfvHP (dynamic) */ "iip\0" "glGetImageTransformParameterfvHP\0" "\0" - /* _mesa_function_pool[2195]: Normal3bv (offset 53) */ + /* _mesa_function_pool[2234]: Normal3bv (offset 53) */ "p\0" "glNormal3bv\0" "\0" - /* _mesa_function_pool[2210]: TexGeniv (offset 193) */ + /* _mesa_function_pool[2249]: TexGeniv (offset 193) */ "iip\0" "glTexGeniv\0" "\0" - /* _mesa_function_pool[2226]: WeightubvARB (dynamic) */ + /* _mesa_function_pool[2265]: WeightubvARB (dynamic) */ "ip\0" "glWeightubvARB\0" "\0" - /* _mesa_function_pool[2245]: VertexAttrib1fvNV (will be remapped) */ + /* _mesa_function_pool[2284]: VertexAttrib1fvNV (will be remapped) */ "ip\0" "glVertexAttrib1fvNV\0" "\0" - /* _mesa_function_pool[2269]: Vertex3iv (offset 139) */ + /* _mesa_function_pool[2308]: Vertex3iv (offset 139) */ "p\0" "glVertex3iv\0" "\0" - /* _mesa_function_pool[2284]: CopyConvolutionFilter1D (offset 354) */ + /* _mesa_function_pool[2323]: CopyConvolutionFilter1D (offset 354) */ "iiiii\0" "glCopyConvolutionFilter1D\0" "glCopyConvolutionFilter1DEXT\0" "\0" - /* _mesa_function_pool[2346]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[2385]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */ "iffffff\0" "glReplacementCodeuiNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[2394]: DeleteSync (will be remapped) */ + /* _mesa_function_pool[2433]: DeleteSync (will be remapped) */ "i\0" "glDeleteSync\0" "\0" - /* _mesa_function_pool[2410]: FragmentMaterialfvSGIX (dynamic) */ + /* _mesa_function_pool[2449]: FragmentMaterialfvSGIX (dynamic) */ "iip\0" "glFragmentMaterialfvSGIX\0" "\0" - /* _mesa_function_pool[2440]: BlendColor (offset 336) */ + /* _mesa_function_pool[2479]: BlendColor (offset 336) */ "ffff\0" "glBlendColor\0" "glBlendColorEXT\0" "\0" - /* _mesa_function_pool[2475]: UniformMatrix4fvARB (will be remapped) */ + /* _mesa_function_pool[2514]: UniformMatrix4fvARB (will be remapped) */ "iiip\0" "glUniformMatrix4fv\0" "glUniformMatrix4fvARB\0" "\0" - /* _mesa_function_pool[2522]: DeleteVertexArraysAPPLE (will be remapped) */ + /* _mesa_function_pool[2561]: DeleteVertexArraysAPPLE (will be remapped) */ "ip\0" "glDeleteVertexArrays\0" "glDeleteVertexArraysAPPLE\0" "\0" - /* _mesa_function_pool[2573]: ReadInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[2612]: ReadInstrumentsSGIX (dynamic) */ "i\0" "glReadInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[2598]: CallLists (offset 3) */ + /* _mesa_function_pool[2637]: CallLists (offset 3) */ "iip\0" "glCallLists\0" "\0" - /* _mesa_function_pool[2615]: UniformMatrix2x4fv (will be remapped) */ + /* _mesa_function_pool[2654]: UniformMatrix2x4fv (will be remapped) */ "iiip\0" "glUniformMatrix2x4fv\0" "\0" - /* _mesa_function_pool[2642]: Color4ubVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[2681]: Color4ubVertex3fvSUN (dynamic) */ "pp\0" "glColor4ubVertex3fvSUN\0" "\0" - /* _mesa_function_pool[2669]: Normal3iv (offset 59) */ + /* _mesa_function_pool[2708]: Normal3iv (offset 59) */ "p\0" "glNormal3iv\0" "\0" - /* _mesa_function_pool[2684]: PassThrough (offset 199) */ + /* _mesa_function_pool[2723]: PassThrough (offset 199) */ "f\0" "glPassThrough\0" "\0" - /* _mesa_function_pool[2701]: FramebufferTextureLayerEXT (will be remapped) */ + /* _mesa_function_pool[2740]: FramebufferTextureLayerEXT (will be remapped) */ "iiiii\0" "glFramebufferTextureLayer\0" "glFramebufferTextureLayerEXT\0" "\0" - /* _mesa_function_pool[2763]: GetListParameterfvSGIX (dynamic) */ + /* _mesa_function_pool[2802]: GetListParameterfvSGIX (dynamic) */ "iip\0" "glGetListParameterfvSGIX\0" "\0" - /* _mesa_function_pool[2793]: Viewport (offset 305) */ + /* _mesa_function_pool[2832]: Viewport (offset 305) */ "iiii\0" "glViewport\0" "\0" - /* _mesa_function_pool[2810]: VertexAttrib4NusvARB (will be remapped) */ + /* _mesa_function_pool[2849]: VertexAttrib4NusvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nusv\0" "glVertexAttrib4NusvARB\0" "\0" - /* _mesa_function_pool[2857]: WindowPos4svMESA (will be remapped) */ + /* _mesa_function_pool[2896]: WindowPos4svMESA (will be remapped) */ "p\0" "glWindowPos4svMESA\0" "\0" - /* _mesa_function_pool[2879]: CreateProgramObjectARB (will be remapped) */ + /* _mesa_function_pool[2918]: CreateProgramObjectARB (will be remapped) */ "\0" "glCreateProgramObjectARB\0" "\0" - /* _mesa_function_pool[2906]: DeleteTransformFeedbacks (will be remapped) */ + /* _mesa_function_pool[2945]: DeleteTransformFeedbacks (will be remapped) */ "ip\0" "glDeleteTransformFeedbacks\0" "\0" - /* _mesa_function_pool[2937]: UniformMatrix4x3fv (will be remapped) */ + /* _mesa_function_pool[2976]: UniformMatrix4x3fv (will be remapped) */ "iiip\0" "glUniformMatrix4x3fv\0" "\0" - /* _mesa_function_pool[2964]: PrioritizeTextures (offset 331) */ + /* _mesa_function_pool[3003]: PrioritizeTextures (offset 331) */ "ipp\0" "glPrioritizeTextures\0" "glPrioritizeTexturesEXT\0" "\0" - /* _mesa_function_pool[3014]: AsyncMarkerSGIX (dynamic) */ + /* _mesa_function_pool[3053]: AsyncMarkerSGIX (dynamic) */ "i\0" "glAsyncMarkerSGIX\0" "\0" - /* _mesa_function_pool[3035]: GlobalAlphaFactorubSUN (dynamic) */ + /* _mesa_function_pool[3074]: GlobalAlphaFactorubSUN (dynamic) */ "i\0" "glGlobalAlphaFactorubSUN\0" "\0" - /* _mesa_function_pool[3063]: ClearDebugLogMESA (dynamic) */ + /* _mesa_function_pool[3102]: ClearDebugLogMESA (dynamic) */ "iii\0" "glClearDebugLogMESA\0" "\0" - /* _mesa_function_pool[3088]: ResetHistogram (offset 369) */ + /* _mesa_function_pool[3127]: ResetHistogram (offset 369) */ "i\0" "glResetHistogram\0" "glResetHistogramEXT\0" "\0" - /* _mesa_function_pool[3128]: GetProgramNamedParameterfvNV (will be remapped) */ + /* _mesa_function_pool[3167]: GetProgramNamedParameterfvNV (will be remapped) */ "iipp\0" "glGetProgramNamedParameterfvNV\0" "\0" - /* _mesa_function_pool[3165]: PointParameterfEXT (will be remapped) */ + /* _mesa_function_pool[3204]: PointParameterfEXT (will be remapped) */ "if\0" "glPointParameterf\0" "glPointParameterfARB\0" "glPointParameterfEXT\0" "glPointParameterfSGIS\0" "\0" - /* _mesa_function_pool[3251]: LoadIdentityDeformationMapSGIX (dynamic) */ + /* _mesa_function_pool[3290]: LoadIdentityDeformationMapSGIX (dynamic) */ "i\0" "glLoadIdentityDeformationMapSGIX\0" "\0" - /* _mesa_function_pool[3287]: GenFencesNV (will be remapped) */ + /* _mesa_function_pool[3326]: GenFencesNV (will be remapped) */ "ip\0" "glGenFencesNV\0" "\0" - /* _mesa_function_pool[3305]: ImageTransformParameterfHP (dynamic) */ + /* _mesa_function_pool[3344]: ImageTransformParameterfHP (dynamic) */ "iif\0" "glImageTransformParameterfHP\0" "\0" - /* _mesa_function_pool[3339]: MatrixIndexusvARB (dynamic) */ + /* _mesa_function_pool[3378]: MatrixIndexusvARB (dynamic) */ "ip\0" "glMatrixIndexusvARB\0" "\0" - /* _mesa_function_pool[3363]: DrawElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[3402]: DrawElementsBaseVertex (will be remapped) */ "iiipi\0" "glDrawElementsBaseVertex\0" "\0" - /* _mesa_function_pool[3395]: DisableVertexAttribArrayARB (will be remapped) */ + /* _mesa_function_pool[3434]: DisableVertexAttribArrayARB (will be remapped) */ "i\0" "glDisableVertexAttribArray\0" "glDisableVertexAttribArrayARB\0" "\0" - /* _mesa_function_pool[3455]: TexCoord2sv (offset 109) */ + /* _mesa_function_pool[3494]: TexCoord2sv (offset 109) */ "p\0" "glTexCoord2sv\0" "\0" - /* _mesa_function_pool[3472]: Vertex4dv (offset 143) */ + /* _mesa_function_pool[3511]: Vertex4dv (offset 143) */ "p\0" "glVertex4dv\0" "\0" - /* _mesa_function_pool[3487]: StencilMaskSeparate (will be remapped) */ + /* _mesa_function_pool[3526]: StencilMaskSeparate (will be remapped) */ "ii\0" "glStencilMaskSeparate\0" "\0" - /* _mesa_function_pool[3513]: ProgramLocalParameter4dARB (will be remapped) */ + /* _mesa_function_pool[3552]: ProgramLocalParameter4dARB (will be remapped) */ "iidddd\0" "glProgramLocalParameter4dARB\0" "\0" - /* _mesa_function_pool[3550]: CompressedTexImage3DARB (will be remapped) */ + /* _mesa_function_pool[3589]: CompressedTexImage3DARB (will be remapped) */ "iiiiiiiip\0" "glCompressedTexImage3D\0" "glCompressedTexImage3DARB\0" "\0" - /* _mesa_function_pool[3610]: Color3sv (offset 18) */ + /* _mesa_function_pool[3649]: Color3sv (offset 18) */ "p\0" "glColor3sv\0" "\0" - /* _mesa_function_pool[3624]: GetConvolutionParameteriv (offset 358) */ + /* _mesa_function_pool[3663]: GetConvolutionParameteriv (offset 358) */ "iip\0" "glGetConvolutionParameteriv\0" "glGetConvolutionParameterivEXT\0" "\0" - /* _mesa_function_pool[3688]: VertexAttrib1fARB (will be remapped) */ + /* _mesa_function_pool[3727]: VertexAttrib1fARB (will be remapped) */ "if\0" "glVertexAttrib1f\0" "glVertexAttrib1fARB\0" "\0" - /* _mesa_function_pool[3729]: Vertex2dv (offset 127) */ + /* _mesa_function_pool[3768]: Vertex2dv (offset 127) */ "p\0" "glVertex2dv\0" "\0" - /* _mesa_function_pool[3744]: TestFenceNV (will be remapped) */ + /* _mesa_function_pool[3783]: TestFenceNV (will be remapped) */ "i\0" "glTestFenceNV\0" "\0" - /* _mesa_function_pool[3761]: MultiTexCoord1fvARB (offset 379) */ + /* _mesa_function_pool[3800]: MultiTexCoord1fvARB (offset 379) */ "ip\0" "glMultiTexCoord1fv\0" "glMultiTexCoord1fvARB\0" "\0" - /* _mesa_function_pool[3806]: TexCoord3iv (offset 115) */ + /* _mesa_function_pool[3845]: TexCoord3iv (offset 115) */ "p\0" "glTexCoord3iv\0" "\0" - /* _mesa_function_pool[3823]: ColorFragmentOp2ATI (will be remapped) */ + /* _mesa_function_pool[3862]: ColorFragmentOp2ATI (will be remapped) */ "iiiiiiiiii\0" "glColorFragmentOp2ATI\0" "\0" - /* _mesa_function_pool[3857]: SecondaryColorPointerListIBM (dynamic) */ + /* _mesa_function_pool[3896]: SecondaryColorPointerListIBM (dynamic) */ "iiipi\0" "glSecondaryColorPointerListIBM\0" "\0" - /* _mesa_function_pool[3895]: GetPixelTexGenParameterivSGIS (will be remapped) */ + /* _mesa_function_pool[3934]: GetPixelTexGenParameterivSGIS (will be remapped) */ "ip\0" "glGetPixelTexGenParameterivSGIS\0" "\0" - /* _mesa_function_pool[3931]: Color3fv (offset 14) */ + /* _mesa_function_pool[3970]: Color3fv (offset 14) */ "p\0" "glColor3fv\0" "\0" - /* _mesa_function_pool[3945]: VertexAttrib4fNV (will be remapped) */ + /* _mesa_function_pool[3984]: VertexAttrib4fNV (will be remapped) */ "iffff\0" "glVertexAttrib4fNV\0" "\0" - /* _mesa_function_pool[3971]: ReplacementCodeubSUN (dynamic) */ + /* _mesa_function_pool[4010]: ReplacementCodeubSUN (dynamic) */ "i\0" "glReplacementCodeubSUN\0" "\0" - /* _mesa_function_pool[3997]: FinishAsyncSGIX (dynamic) */ + /* _mesa_function_pool[4036]: FinishAsyncSGIX (dynamic) */ "p\0" "glFinishAsyncSGIX\0" "\0" - /* _mesa_function_pool[4018]: GetDebugLogMESA (dynamic) */ + /* _mesa_function_pool[4057]: GetDebugLogMESA (dynamic) */ "iiiipp\0" "glGetDebugLogMESA\0" "\0" - /* _mesa_function_pool[4044]: FogCoorddEXT (will be remapped) */ + /* _mesa_function_pool[4083]: FogCoorddEXT (will be remapped) */ "d\0" "glFogCoordd\0" "glFogCoorddEXT\0" "\0" - /* _mesa_function_pool[4074]: BeginConditionalRenderNV (will be remapped) */ + /* _mesa_function_pool[4113]: BeginConditionalRenderNV (will be remapped) */ "ii\0" "glBeginConditionalRenderNV\0" "\0" - /* _mesa_function_pool[4105]: Color4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[4144]: Color4ubVertex3fSUN (dynamic) */ "iiiifff\0" "glColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[4136]: FogCoordfEXT (will be remapped) */ + /* _mesa_function_pool[4175]: FogCoordfEXT (will be remapped) */ "f\0" "glFogCoordf\0" "glFogCoordfEXT\0" "\0" - /* _mesa_function_pool[4166]: PointSize (offset 173) */ + /* _mesa_function_pool[4205]: PointSize (offset 173) */ "f\0" "glPointSize\0" "\0" - /* _mesa_function_pool[4181]: TexCoord2fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[4220]: TexCoord2fVertex3fSUN (dynamic) */ "fffff\0" "glTexCoord2fVertex3fSUN\0" "\0" - /* _mesa_function_pool[4212]: PopName (offset 200) */ + /* _mesa_function_pool[4251]: PopName (offset 200) */ "\0" "glPopName\0" "\0" - /* _mesa_function_pool[4224]: GlobalAlphaFactoriSUN (dynamic) */ + /* _mesa_function_pool[4263]: GlobalAlphaFactoriSUN (dynamic) */ "i\0" "glGlobalAlphaFactoriSUN\0" "\0" - /* _mesa_function_pool[4251]: VertexAttrib2dNV (will be remapped) */ + /* _mesa_function_pool[4290]: VertexAttrib2dNV (will be remapped) */ "idd\0" "glVertexAttrib2dNV\0" "\0" - /* _mesa_function_pool[4275]: GetProgramInfoLog (will be remapped) */ + /* _mesa_function_pool[4314]: GetProgramInfoLog (will be remapped) */ "iipp\0" "glGetProgramInfoLog\0" "\0" - /* _mesa_function_pool[4301]: VertexAttrib4NbvARB (will be remapped) */ + /* _mesa_function_pool[4340]: VertexAttrib4NbvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nbv\0" "glVertexAttrib4NbvARB\0" "\0" - /* _mesa_function_pool[4346]: GetActiveAttribARB (will be remapped) */ + /* _mesa_function_pool[4385]: GetActiveAttribARB (will be remapped) */ "iiipppp\0" "glGetActiveAttrib\0" "glGetActiveAttribARB\0" "\0" - /* _mesa_function_pool[4394]: Vertex4sv (offset 149) */ + /* _mesa_function_pool[4433]: Vertex4sv (offset 149) */ "p\0" "glVertex4sv\0" "\0" - /* _mesa_function_pool[4409]: VertexAttrib4ubNV (will be remapped) */ + /* _mesa_function_pool[4448]: VertexAttrib4ubNV (will be remapped) */ "iiiii\0" "glVertexAttrib4ubNV\0" "\0" - /* _mesa_function_pool[4436]: TextureRangeAPPLE (will be remapped) */ + /* _mesa_function_pool[4475]: TextureRangeAPPLE (will be remapped) */ "iip\0" "glTextureRangeAPPLE\0" "\0" - /* _mesa_function_pool[4461]: GetTexEnvfv (offset 276) */ + /* _mesa_function_pool[4500]: GetTexEnvfv (offset 276) */ "iip\0" "glGetTexEnvfv\0" "\0" - /* _mesa_function_pool[4480]: BindTransformFeedback (will be remapped) */ + /* _mesa_function_pool[4519]: BindTransformFeedback (will be remapped) */ "ii\0" "glBindTransformFeedback\0" "\0" - /* _mesa_function_pool[4508]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[4547]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ "ffffffffffff\0" "glTexCoord2fColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[4561]: Indexub (offset 315) */ + /* _mesa_function_pool[4600]: Indexub (offset 315) */ "i\0" "glIndexub\0" "\0" - /* _mesa_function_pool[4574]: TexEnvi (offset 186) */ + /* _mesa_function_pool[4613]: ColorMaskIndexedEXT (will be remapped) */ + "iiiii\0" + "glColorMaskIndexedEXT\0" + "\0" + /* _mesa_function_pool[4642]: TexEnvi (offset 186) */ "iii\0" "glTexEnvi\0" "\0" - /* _mesa_function_pool[4589]: GetClipPlane (offset 259) */ + /* _mesa_function_pool[4657]: GetClipPlane (offset 259) */ "ip\0" "glGetClipPlane\0" "\0" - /* _mesa_function_pool[4608]: CombinerParameterfvNV (will be remapped) */ + /* _mesa_function_pool[4676]: CombinerParameterfvNV (will be remapped) */ "ip\0" "glCombinerParameterfvNV\0" "\0" - /* _mesa_function_pool[4636]: VertexAttribs3dvNV (will be remapped) */ + /* _mesa_function_pool[4704]: VertexAttribs3dvNV (will be remapped) */ "iip\0" "glVertexAttribs3dvNV\0" "\0" - /* _mesa_function_pool[4662]: VertexAttribs4fvNV (will be remapped) */ + /* _mesa_function_pool[4730]: VertexAttribs4fvNV (will be remapped) */ "iip\0" "glVertexAttribs4fvNV\0" "\0" - /* _mesa_function_pool[4688]: VertexArrayRangeNV (will be remapped) */ + /* _mesa_function_pool[4756]: VertexArrayRangeNV (will be remapped) */ "ip\0" "glVertexArrayRangeNV\0" "\0" - /* _mesa_function_pool[4713]: FragmentLightiSGIX (dynamic) */ + /* _mesa_function_pool[4781]: FragmentLightiSGIX (dynamic) */ "iii\0" "glFragmentLightiSGIX\0" "\0" - /* _mesa_function_pool[4739]: PolygonOffsetEXT (will be remapped) */ + /* _mesa_function_pool[4807]: PolygonOffsetEXT (will be remapped) */ "ff\0" "glPolygonOffsetEXT\0" "\0" - /* _mesa_function_pool[4762]: PollAsyncSGIX (dynamic) */ + /* _mesa_function_pool[4830]: PollAsyncSGIX (dynamic) */ "p\0" "glPollAsyncSGIX\0" "\0" - /* _mesa_function_pool[4781]: DeleteFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[4849]: DeleteFragmentShaderATI (will be remapped) */ "i\0" "glDeleteFragmentShaderATI\0" "\0" - /* _mesa_function_pool[4810]: Scaled (offset 301) */ + /* _mesa_function_pool[4878]: Scaled (offset 301) */ "ddd\0" "glScaled\0" "\0" - /* _mesa_function_pool[4824]: ResumeTransformFeedback (will be remapped) */ + /* _mesa_function_pool[4892]: ResumeTransformFeedback (will be remapped) */ "\0" "glResumeTransformFeedback\0" "\0" - /* _mesa_function_pool[4852]: Scalef (offset 302) */ + /* _mesa_function_pool[4920]: Scalef (offset 302) */ "fff\0" "glScalef\0" "\0" - /* _mesa_function_pool[4866]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[4934]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glTexCoord2fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[4904]: MultTransposeMatrixdARB (will be remapped) */ + /* _mesa_function_pool[4972]: MultTransposeMatrixdARB (will be remapped) */ "p\0" "glMultTransposeMatrixd\0" "glMultTransposeMatrixdARB\0" "\0" - /* _mesa_function_pool[4956]: ColorMaskIndexedEXT (will be remapped) */ - "iiiii\0" - "glColorMaskIndexedEXT\0" - "\0" - /* _mesa_function_pool[4985]: ObjectUnpurgeableAPPLE (will be remapped) */ + /* _mesa_function_pool[5024]: ObjectUnpurgeableAPPLE (will be remapped) */ "iii\0" "glObjectUnpurgeableAPPLE\0" "\0" - /* _mesa_function_pool[5015]: AlphaFunc (offset 240) */ + /* _mesa_function_pool[5054]: AlphaFunc (offset 240) */ "if\0" "glAlphaFunc\0" "\0" - /* _mesa_function_pool[5031]: WindowPos2svMESA (will be remapped) */ + /* _mesa_function_pool[5070]: WindowPos2svMESA (will be remapped) */ "p\0" "glWindowPos2sv\0" "glWindowPos2svARB\0" "glWindowPos2svMESA\0" "\0" - /* _mesa_function_pool[5086]: EdgeFlag (offset 41) */ + /* _mesa_function_pool[5125]: EdgeFlag (offset 41) */ "i\0" "glEdgeFlag\0" "\0" - /* _mesa_function_pool[5100]: TexCoord2iv (offset 107) */ + /* _mesa_function_pool[5139]: TexCoord2iv (offset 107) */ "p\0" "glTexCoord2iv\0" "\0" - /* _mesa_function_pool[5117]: CompressedTexImage1DARB (will be remapped) */ + /* _mesa_function_pool[5156]: CompressedTexImage1DARB (will be remapped) */ "iiiiiip\0" "glCompressedTexImage1D\0" "glCompressedTexImage1DARB\0" "\0" - /* _mesa_function_pool[5175]: Rotated (offset 299) */ + /* _mesa_function_pool[5214]: Rotated (offset 299) */ "dddd\0" "glRotated\0" "\0" - /* _mesa_function_pool[5191]: VertexAttrib2sNV (will be remapped) */ + /* _mesa_function_pool[5230]: VertexAttrib2sNV (will be remapped) */ "iii\0" "glVertexAttrib2sNV\0" "\0" - /* _mesa_function_pool[5215]: ReadPixels (offset 256) */ + /* _mesa_function_pool[5254]: ReadPixels (offset 256) */ "iiiiiip\0" "glReadPixels\0" "\0" - /* _mesa_function_pool[5237]: EdgeFlagv (offset 42) */ + /* _mesa_function_pool[5276]: EdgeFlagv (offset 42) */ "p\0" "glEdgeFlagv\0" "\0" - /* _mesa_function_pool[5252]: NormalPointerListIBM (dynamic) */ + /* _mesa_function_pool[5291]: NormalPointerListIBM (dynamic) */ "iipi\0" "glNormalPointerListIBM\0" "\0" - /* _mesa_function_pool[5281]: IndexPointerEXT (will be remapped) */ + /* _mesa_function_pool[5320]: IndexPointerEXT (will be remapped) */ "iiip\0" "glIndexPointerEXT\0" "\0" - /* _mesa_function_pool[5305]: Color4iv (offset 32) */ + /* _mesa_function_pool[5344]: Color4iv (offset 32) */ "p\0" "glColor4iv\0" "\0" - /* _mesa_function_pool[5319]: TexParameterf (offset 178) */ + /* _mesa_function_pool[5358]: TexParameterf (offset 178) */ "iif\0" "glTexParameterf\0" "\0" - /* _mesa_function_pool[5340]: TexParameteri (offset 180) */ + /* _mesa_function_pool[5379]: TexParameteri (offset 180) */ "iii\0" "glTexParameteri\0" "\0" - /* _mesa_function_pool[5361]: NormalPointerEXT (will be remapped) */ + /* _mesa_function_pool[5400]: NormalPointerEXT (will be remapped) */ "iiip\0" "glNormalPointerEXT\0" "\0" - /* _mesa_function_pool[5386]: MultiTexCoord3dARB (offset 392) */ + /* _mesa_function_pool[5425]: MultiTexCoord3dARB (offset 392) */ "iddd\0" "glMultiTexCoord3d\0" "glMultiTexCoord3dARB\0" "\0" - /* _mesa_function_pool[5431]: MultiTexCoord2iARB (offset 388) */ + /* _mesa_function_pool[5470]: MultiTexCoord2iARB (offset 388) */ "iii\0" "glMultiTexCoord2i\0" "glMultiTexCoord2iARB\0" "\0" - /* _mesa_function_pool[5475]: DrawPixels (offset 257) */ + /* _mesa_function_pool[5514]: DrawPixels (offset 257) */ "iiiip\0" "glDrawPixels\0" "\0" - /* _mesa_function_pool[5495]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[5534]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */ "iffffffff\0" "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[5555]: MultiTexCoord2svARB (offset 391) */ + /* _mesa_function_pool[5594]: MultiTexCoord2svARB (offset 391) */ "ip\0" "glMultiTexCoord2sv\0" "glMultiTexCoord2svARB\0" "\0" - /* _mesa_function_pool[5600]: ReplacementCodeubvSUN (dynamic) */ + /* _mesa_function_pool[5639]: ReplacementCodeubvSUN (dynamic) */ "p\0" "glReplacementCodeubvSUN\0" "\0" - /* _mesa_function_pool[5627]: Uniform3iARB (will be remapped) */ + /* _mesa_function_pool[5666]: Uniform3iARB (will be remapped) */ "iiii\0" "glUniform3i\0" "glUniform3iARB\0" "\0" - /* _mesa_function_pool[5660]: DrawTransformFeedback (will be remapped) */ + /* _mesa_function_pool[5699]: DrawTransformFeedback (will be remapped) */ "ii\0" "glDrawTransformFeedback\0" "\0" - /* _mesa_function_pool[5688]: GetFragmentMaterialfvSGIX (dynamic) */ + /* _mesa_function_pool[5727]: GetFragmentMaterialfvSGIX (dynamic) */ "iip\0" "glGetFragmentMaterialfvSGIX\0" "\0" - /* _mesa_function_pool[5721]: GetShaderInfoLog (will be remapped) */ + /* _mesa_function_pool[5760]: GetShaderInfoLog (will be remapped) */ "iipp\0" "glGetShaderInfoLog\0" "\0" - /* _mesa_function_pool[5746]: WeightivARB (dynamic) */ + /* _mesa_function_pool[5785]: WeightivARB (dynamic) */ "ip\0" "glWeightivARB\0" "\0" - /* _mesa_function_pool[5764]: PollInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[5803]: PollInstrumentsSGIX (dynamic) */ "p\0" "glPollInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[5789]: GlobalAlphaFactordSUN (dynamic) */ + /* _mesa_function_pool[5828]: GlobalAlphaFactordSUN (dynamic) */ "d\0" "glGlobalAlphaFactordSUN\0" "\0" - /* _mesa_function_pool[5816]: GetFinalCombinerInputParameterfvNV (will be remapped) */ + /* _mesa_function_pool[5855]: GetFinalCombinerInputParameterfvNV (will be remapped) */ "iip\0" "glGetFinalCombinerInputParameterfvNV\0" "\0" - /* _mesa_function_pool[5858]: GenerateMipmapEXT (will be remapped) */ + /* _mesa_function_pool[5897]: GenerateMipmapEXT (will be remapped) */ "i\0" "glGenerateMipmap\0" "glGenerateMipmapEXT\0" "\0" - /* _mesa_function_pool[5898]: GenLists (offset 5) */ + /* _mesa_function_pool[5937]: GenLists (offset 5) */ "i\0" "glGenLists\0" "\0" - /* _mesa_function_pool[5912]: SetFragmentShaderConstantATI (will be remapped) */ + /* _mesa_function_pool[5951]: SetFragmentShaderConstantATI (will be remapped) */ "ip\0" "glSetFragmentShaderConstantATI\0" "\0" - /* _mesa_function_pool[5947]: GetMapAttribParameterivNV (dynamic) */ + /* _mesa_function_pool[5986]: GetMapAttribParameterivNV (dynamic) */ "iiip\0" "glGetMapAttribParameterivNV\0" "\0" - /* _mesa_function_pool[5981]: CreateShaderObjectARB (will be remapped) */ + /* _mesa_function_pool[6020]: CreateShaderObjectARB (will be remapped) */ "i\0" "glCreateShaderObjectARB\0" "\0" - /* _mesa_function_pool[6008]: GetSharpenTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[6047]: GetSharpenTexFuncSGIS (dynamic) */ "ip\0" "glGetSharpenTexFuncSGIS\0" "\0" - /* _mesa_function_pool[6036]: BufferDataARB (will be remapped) */ + /* _mesa_function_pool[6075]: BufferDataARB (will be remapped) */ "iipi\0" "glBufferData\0" "glBufferDataARB\0" "\0" - /* _mesa_function_pool[6071]: FlushVertexArrayRangeNV (will be remapped) */ + /* _mesa_function_pool[6110]: FlushVertexArrayRangeNV (will be remapped) */ "\0" "glFlushVertexArrayRangeNV\0" "\0" - /* _mesa_function_pool[6099]: MapGrid2d (offset 226) */ + /* _mesa_function_pool[6138]: MapGrid2d (offset 226) */ "iddidd\0" "glMapGrid2d\0" "\0" - /* _mesa_function_pool[6119]: MapGrid2f (offset 227) */ + /* _mesa_function_pool[6158]: MapGrid2f (offset 227) */ "iffiff\0" "glMapGrid2f\0" "\0" - /* _mesa_function_pool[6139]: SampleMapATI (will be remapped) */ + /* _mesa_function_pool[6178]: SampleMapATI (will be remapped) */ "iii\0" "glSampleMapATI\0" "\0" - /* _mesa_function_pool[6159]: VertexPointerEXT (will be remapped) */ + /* _mesa_function_pool[6198]: VertexPointerEXT (will be remapped) */ "iiiip\0" "glVertexPointerEXT\0" "\0" - /* _mesa_function_pool[6185]: GetTexFilterFuncSGIS (dynamic) */ + /* _mesa_function_pool[6224]: GetTexFilterFuncSGIS (dynamic) */ "iip\0" "glGetTexFilterFuncSGIS\0" "\0" - /* _mesa_function_pool[6213]: Scissor (offset 176) */ + /* _mesa_function_pool[6252]: Scissor (offset 176) */ "iiii\0" "glScissor\0" "\0" - /* _mesa_function_pool[6229]: Fogf (offset 153) */ + /* _mesa_function_pool[6268]: Fogf (offset 153) */ "if\0" "glFogf\0" "\0" - /* _mesa_function_pool[6240]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[6279]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiColor4ubVertex3fvSUN\0" "\0" - /* _mesa_function_pool[6285]: TexSubImage1D (offset 332) */ + /* _mesa_function_pool[6324]: TexSubImage1D (offset 332) */ "iiiiiip\0" "glTexSubImage1D\0" "glTexSubImage1DEXT\0" "\0" - /* _mesa_function_pool[6329]: VertexAttrib1sARB (will be remapped) */ + /* _mesa_function_pool[6368]: VertexAttrib1sARB (will be remapped) */ "ii\0" "glVertexAttrib1s\0" "glVertexAttrib1sARB\0" "\0" - /* _mesa_function_pool[6370]: FenceSync (will be remapped) */ + /* _mesa_function_pool[6409]: FenceSync (will be remapped) */ "ii\0" "glFenceSync\0" "\0" - /* _mesa_function_pool[6386]: Color4usv (offset 40) */ + /* _mesa_function_pool[6425]: Color4usv (offset 40) */ "p\0" "glColor4usv\0" "\0" - /* _mesa_function_pool[6401]: Fogi (offset 155) */ + /* _mesa_function_pool[6440]: Fogi (offset 155) */ "ii\0" "glFogi\0" "\0" - /* _mesa_function_pool[6412]: DepthRange (offset 288) */ + /* _mesa_function_pool[6451]: DepthRange (offset 288) */ "dd\0" "glDepthRange\0" "\0" - /* _mesa_function_pool[6429]: RasterPos3iv (offset 75) */ + /* _mesa_function_pool[6468]: RasterPos3iv (offset 75) */ "p\0" "glRasterPos3iv\0" "\0" - /* _mesa_function_pool[6447]: FinalCombinerInputNV (will be remapped) */ + /* _mesa_function_pool[6486]: FinalCombinerInputNV (will be remapped) */ "iiii\0" "glFinalCombinerInputNV\0" "\0" - /* _mesa_function_pool[6476]: TexCoord2i (offset 106) */ + /* _mesa_function_pool[6515]: TexCoord2i (offset 106) */ "ii\0" "glTexCoord2i\0" "\0" - /* _mesa_function_pool[6493]: PixelMapfv (offset 251) */ + /* _mesa_function_pool[6532]: PixelMapfv (offset 251) */ "iip\0" "glPixelMapfv\0" "\0" - /* _mesa_function_pool[6511]: Color4ui (offset 37) */ + /* _mesa_function_pool[6550]: Color4ui (offset 37) */ "iiii\0" "glColor4ui\0" "\0" - /* _mesa_function_pool[6528]: RasterPos3s (offset 76) */ + /* _mesa_function_pool[6567]: RasterPos3s (offset 76) */ "iii\0" "glRasterPos3s\0" "\0" - /* _mesa_function_pool[6547]: Color3usv (offset 24) */ + /* _mesa_function_pool[6586]: Color3usv (offset 24) */ "p\0" "glColor3usv\0" "\0" - /* _mesa_function_pool[6562]: FlushRasterSGIX (dynamic) */ + /* _mesa_function_pool[6601]: FlushRasterSGIX (dynamic) */ "\0" "glFlushRasterSGIX\0" "\0" - /* _mesa_function_pool[6582]: TexCoord2f (offset 104) */ + /* _mesa_function_pool[6621]: TexCoord2f (offset 104) */ "ff\0" "glTexCoord2f\0" "\0" - /* _mesa_function_pool[6599]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[6638]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */ "ifffff\0" "glReplacementCodeuiTexCoord2fVertex3fSUN\0" "\0" - /* _mesa_function_pool[6648]: TexCoord2d (offset 102) */ + /* _mesa_function_pool[6687]: TexCoord2d (offset 102) */ "dd\0" "glTexCoord2d\0" "\0" - /* _mesa_function_pool[6665]: RasterPos3d (offset 70) */ + /* _mesa_function_pool[6704]: RasterPos3d (offset 70) */ "ddd\0" "glRasterPos3d\0" "\0" - /* _mesa_function_pool[6684]: RasterPos3f (offset 72) */ + /* _mesa_function_pool[6723]: RasterPos3f (offset 72) */ "fff\0" "glRasterPos3f\0" "\0" - /* _mesa_function_pool[6703]: Uniform1fARB (will be remapped) */ + /* _mesa_function_pool[6742]: Uniform1fARB (will be remapped) */ "if\0" "glUniform1f\0" "glUniform1fARB\0" "\0" - /* _mesa_function_pool[6734]: AreTexturesResident (offset 322) */ + /* _mesa_function_pool[6773]: AreTexturesResident (offset 322) */ "ipp\0" "glAreTexturesResident\0" "glAreTexturesResidentEXT\0" "\0" - /* _mesa_function_pool[6786]: TexCoord2s (offset 108) */ + /* _mesa_function_pool[6825]: TexCoord2s (offset 108) */ "ii\0" "glTexCoord2s\0" "\0" - /* _mesa_function_pool[6803]: StencilOpSeparate (will be remapped) */ + /* _mesa_function_pool[6842]: StencilOpSeparate (will be remapped) */ "iiii\0" "glStencilOpSeparate\0" "glStencilOpSeparateATI\0" "\0" - /* _mesa_function_pool[6852]: ColorTableParameteriv (offset 341) */ + /* _mesa_function_pool[6891]: ColorTableParameteriv (offset 341) */ "iip\0" "glColorTableParameteriv\0" "glColorTableParameterivSGI\0" "\0" - /* _mesa_function_pool[6908]: FogCoordPointerListIBM (dynamic) */ + /* _mesa_function_pool[6947]: FogCoordPointerListIBM (dynamic) */ "iipi\0" "glFogCoordPointerListIBM\0" "\0" - /* _mesa_function_pool[6939]: WindowPos3dMESA (will be remapped) */ + /* _mesa_function_pool[6978]: WindowPos3dMESA (will be remapped) */ "ddd\0" "glWindowPos3d\0" "glWindowPos3dARB\0" "glWindowPos3dMESA\0" "\0" - /* _mesa_function_pool[6993]: Color4us (offset 39) */ + /* _mesa_function_pool[7032]: Color4us (offset 39) */ "iiii\0" "glColor4us\0" "\0" - /* _mesa_function_pool[7010]: PointParameterfvEXT (will be remapped) */ + /* _mesa_function_pool[7049]: PointParameterfvEXT (will be remapped) */ "ip\0" "glPointParameterfv\0" "glPointParameterfvARB\0" "glPointParameterfvEXT\0" "glPointParameterfvSGIS\0" "\0" - /* _mesa_function_pool[7100]: Color3bv (offset 10) */ + /* _mesa_function_pool[7139]: Color3bv (offset 10) */ "p\0" "glColor3bv\0" "\0" - /* _mesa_function_pool[7114]: WindowPos2fvMESA (will be remapped) */ + /* _mesa_function_pool[7153]: WindowPos2fvMESA (will be remapped) */ "p\0" "glWindowPos2fv\0" "glWindowPos2fvARB\0" "glWindowPos2fvMESA\0" "\0" - /* _mesa_function_pool[7169]: SecondaryColor3bvEXT (will be remapped) */ + /* _mesa_function_pool[7208]: SecondaryColor3bvEXT (will be remapped) */ "p\0" "glSecondaryColor3bv\0" "glSecondaryColor3bvEXT\0" "\0" - /* _mesa_function_pool[7215]: VertexPointerListIBM (dynamic) */ + /* _mesa_function_pool[7254]: VertexPointerListIBM (dynamic) */ "iiipi\0" "glVertexPointerListIBM\0" "\0" - /* _mesa_function_pool[7245]: GetProgramLocalParameterfvARB (will be remapped) */ + /* _mesa_function_pool[7284]: GetProgramLocalParameterfvARB (will be remapped) */ "iip\0" "glGetProgramLocalParameterfvARB\0" "\0" - /* _mesa_function_pool[7282]: FragmentMaterialfSGIX (dynamic) */ + /* _mesa_function_pool[7321]: FragmentMaterialfSGIX (dynamic) */ "iif\0" "glFragmentMaterialfSGIX\0" "\0" - /* _mesa_function_pool[7311]: TexCoord2fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[7350]: TexCoord2fNormal3fVertex3fSUN (dynamic) */ "ffffffff\0" "glTexCoord2fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[7353]: RenderbufferStorageEXT (will be remapped) */ + /* _mesa_function_pool[7392]: RenderbufferStorageEXT (will be remapped) */ "iiii\0" "glRenderbufferStorage\0" "glRenderbufferStorageEXT\0" "\0" - /* _mesa_function_pool[7406]: IsFenceNV (will be remapped) */ + /* _mesa_function_pool[7445]: IsFenceNV (will be remapped) */ "i\0" "glIsFenceNV\0" "\0" - /* _mesa_function_pool[7421]: AttachObjectARB (will be remapped) */ + /* _mesa_function_pool[7460]: AttachObjectARB (will be remapped) */ "ii\0" "glAttachObjectARB\0" "\0" - /* _mesa_function_pool[7443]: GetFragmentLightivSGIX (dynamic) */ + /* _mesa_function_pool[7482]: GetFragmentLightivSGIX (dynamic) */ "iip\0" "glGetFragmentLightivSGIX\0" "\0" - /* _mesa_function_pool[7473]: UniformMatrix2fvARB (will be remapped) */ + /* _mesa_function_pool[7512]: UniformMatrix2fvARB (will be remapped) */ "iiip\0" "glUniformMatrix2fv\0" "glUniformMatrix2fvARB\0" "\0" - /* _mesa_function_pool[7520]: MultiTexCoord2fARB (offset 386) */ + /* _mesa_function_pool[7559]: MultiTexCoord2fARB (offset 386) */ "iff\0" "glMultiTexCoord2f\0" "glMultiTexCoord2fARB\0" "\0" - /* _mesa_function_pool[7564]: ColorTable (offset 339) */ + /* _mesa_function_pool[7603]: ColorTable (offset 339) */ "iiiiip\0" "glColorTable\0" "glColorTableSGI\0" "glColorTableEXT\0" "\0" - /* _mesa_function_pool[7617]: IndexPointer (offset 314) */ + /* _mesa_function_pool[7656]: IndexPointer (offset 314) */ "iip\0" "glIndexPointer\0" "\0" - /* _mesa_function_pool[7637]: Accum (offset 213) */ + /* _mesa_function_pool[7676]: Accum (offset 213) */ "if\0" "glAccum\0" "\0" - /* _mesa_function_pool[7649]: GetTexImage (offset 281) */ + /* _mesa_function_pool[7688]: GetTexImage (offset 281) */ "iiiip\0" "glGetTexImage\0" "\0" - /* _mesa_function_pool[7670]: MapControlPointsNV (dynamic) */ + /* _mesa_function_pool[7709]: MapControlPointsNV (dynamic) */ "iiiiiiiip\0" "glMapControlPointsNV\0" "\0" - /* _mesa_function_pool[7702]: ConvolutionFilter2D (offset 349) */ + /* _mesa_function_pool[7741]: ConvolutionFilter2D (offset 349) */ "iiiiiip\0" "glConvolutionFilter2D\0" "glConvolutionFilter2DEXT\0" "\0" - /* _mesa_function_pool[7758]: Finish (offset 216) */ + /* _mesa_function_pool[7797]: Finish (offset 216) */ "\0" "glFinish\0" "\0" - /* _mesa_function_pool[7769]: MapParameterfvNV (dynamic) */ + /* _mesa_function_pool[7808]: MapParameterfvNV (dynamic) */ "iip\0" "glMapParameterfvNV\0" "\0" - /* _mesa_function_pool[7793]: ClearStencil (offset 207) */ + /* _mesa_function_pool[7832]: ClearStencil (offset 207) */ "i\0" "glClearStencil\0" "\0" - /* _mesa_function_pool[7811]: VertexAttrib3dvARB (will be remapped) */ + /* _mesa_function_pool[7850]: VertexAttrib3dvARB (will be remapped) */ "ip\0" "glVertexAttrib3dv\0" "glVertexAttrib3dvARB\0" "\0" - /* _mesa_function_pool[7854]: HintPGI (dynamic) */ + /* _mesa_function_pool[7893]: HintPGI (dynamic) */ "ii\0" "glHintPGI\0" "\0" - /* _mesa_function_pool[7868]: ConvolutionParameteriv (offset 353) */ + /* _mesa_function_pool[7907]: ConvolutionParameteriv (offset 353) */ "iip\0" "glConvolutionParameteriv\0" "glConvolutionParameterivEXT\0" "\0" - /* _mesa_function_pool[7926]: Color4s (offset 33) */ + /* _mesa_function_pool[7965]: Color4s (offset 33) */ "iiii\0" "glColor4s\0" "\0" - /* _mesa_function_pool[7942]: InterleavedArrays (offset 317) */ + /* _mesa_function_pool[7981]: InterleavedArrays (offset 317) */ "iip\0" "glInterleavedArrays\0" "\0" - /* _mesa_function_pool[7967]: RasterPos2fv (offset 65) */ + /* _mesa_function_pool[8006]: RasterPos2fv (offset 65) */ "p\0" "glRasterPos2fv\0" "\0" - /* _mesa_function_pool[7985]: TexCoord1fv (offset 97) */ + /* _mesa_function_pool[8024]: TexCoord1fv (offset 97) */ "p\0" "glTexCoord1fv\0" "\0" - /* _mesa_function_pool[8002]: Vertex2d (offset 126) */ + /* _mesa_function_pool[8041]: Vertex2d (offset 126) */ "dd\0" "glVertex2d\0" "\0" - /* _mesa_function_pool[8017]: CullParameterdvEXT (will be remapped) */ + /* _mesa_function_pool[8056]: CullParameterdvEXT (dynamic) */ "ip\0" "glCullParameterdvEXT\0" "\0" - /* _mesa_function_pool[8042]: ProgramNamedParameter4fNV (will be remapped) */ + /* _mesa_function_pool[8081]: ProgramNamedParameter4fNV (will be remapped) */ "iipffff\0" "glProgramNamedParameter4fNV\0" "\0" - /* _mesa_function_pool[8079]: Color3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[8118]: Color3fVertex3fSUN (dynamic) */ "ffffff\0" "glColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[8108]: ProgramEnvParameter4fvARB (will be remapped) */ + /* _mesa_function_pool[8147]: ProgramEnvParameter4fvARB (will be remapped) */ "iip\0" "glProgramEnvParameter4fvARB\0" "glProgramParameter4fvNV\0" "\0" - /* _mesa_function_pool[8165]: Color4i (offset 31) */ + /* _mesa_function_pool[8204]: Color4i (offset 31) */ "iiii\0" "glColor4i\0" "\0" - /* _mesa_function_pool[8181]: Color4f (offset 29) */ + /* _mesa_function_pool[8220]: Color4f (offset 29) */ "ffff\0" "glColor4f\0" "\0" - /* _mesa_function_pool[8197]: RasterPos4fv (offset 81) */ + /* _mesa_function_pool[8236]: RasterPos4fv (offset 81) */ "p\0" "glRasterPos4fv\0" "\0" - /* _mesa_function_pool[8215]: Color4d (offset 27) */ + /* _mesa_function_pool[8254]: Color4d (offset 27) */ "dddd\0" "glColor4d\0" "\0" - /* _mesa_function_pool[8231]: ClearIndex (offset 205) */ + /* _mesa_function_pool[8270]: ClearIndex (offset 205) */ "f\0" "glClearIndex\0" "\0" - /* _mesa_function_pool[8247]: Color4b (offset 25) */ + /* _mesa_function_pool[8286]: Color4b (offset 25) */ "iiii\0" "glColor4b\0" "\0" - /* _mesa_function_pool[8263]: LoadMatrixd (offset 292) */ + /* _mesa_function_pool[8302]: LoadMatrixd (offset 292) */ "p\0" "glLoadMatrixd\0" "\0" - /* _mesa_function_pool[8280]: FragmentLightModeliSGIX (dynamic) */ + /* _mesa_function_pool[8319]: FragmentLightModeliSGIX (dynamic) */ "ii\0" "glFragmentLightModeliSGIX\0" "\0" - /* _mesa_function_pool[8310]: RasterPos2dv (offset 63) */ + /* _mesa_function_pool[8349]: RasterPos2dv (offset 63) */ "p\0" "glRasterPos2dv\0" "\0" - /* _mesa_function_pool[8328]: ConvolutionParameterfv (offset 351) */ + /* _mesa_function_pool[8367]: ConvolutionParameterfv (offset 351) */ "iip\0" "glConvolutionParameterfv\0" "glConvolutionParameterfvEXT\0" "\0" - /* _mesa_function_pool[8386]: TbufferMask3DFX (dynamic) */ + /* _mesa_function_pool[8425]: TbufferMask3DFX (dynamic) */ "i\0" "glTbufferMask3DFX\0" "\0" - /* _mesa_function_pool[8407]: GetTexGendv (offset 278) */ + /* _mesa_function_pool[8446]: GetTexGendv (offset 278) */ "iip\0" "glGetTexGendv\0" "\0" - /* _mesa_function_pool[8426]: GetVertexAttribfvNV (will be remapped) */ + /* _mesa_function_pool[8465]: GetVertexAttribfvNV (will be remapped) */ "iip\0" "glGetVertexAttribfvNV\0" "\0" - /* _mesa_function_pool[8453]: BeginTransformFeedbackEXT (will be remapped) */ + /* _mesa_function_pool[8492]: BeginTransformFeedbackEXT (will be remapped) */ "i\0" "glBeginTransformFeedbackEXT\0" "glBeginTransformFeedback\0" "\0" - /* _mesa_function_pool[8509]: LoadProgramNV (will be remapped) */ + /* _mesa_function_pool[8548]: LoadProgramNV (will be remapped) */ "iiip\0" "glLoadProgramNV\0" "\0" - /* _mesa_function_pool[8531]: WaitSync (will be remapped) */ + /* _mesa_function_pool[8570]: WaitSync (will be remapped) */ "iii\0" "glWaitSync\0" "\0" - /* _mesa_function_pool[8547]: EndList (offset 1) */ + /* _mesa_function_pool[8586]: EndList (offset 1) */ "\0" "glEndList\0" "\0" - /* _mesa_function_pool[8559]: VertexAttrib4fvNV (will be remapped) */ + /* _mesa_function_pool[8598]: VertexAttrib4fvNV (will be remapped) */ "ip\0" "glVertexAttrib4fvNV\0" "\0" - /* _mesa_function_pool[8583]: GetAttachedObjectsARB (will be remapped) */ + /* _mesa_function_pool[8622]: GetAttachedObjectsARB (will be remapped) */ "iipp\0" "glGetAttachedObjectsARB\0" "\0" - /* _mesa_function_pool[8613]: Uniform3fvARB (will be remapped) */ + /* _mesa_function_pool[8652]: Uniform3fvARB (will be remapped) */ "iip\0" "glUniform3fv\0" "glUniform3fvARB\0" "\0" - /* _mesa_function_pool[8647]: EvalCoord1fv (offset 231) */ + /* _mesa_function_pool[8686]: EvalCoord1fv (offset 231) */ "p\0" "glEvalCoord1fv\0" "\0" - /* _mesa_function_pool[8665]: DrawRangeElements (offset 338) */ + /* _mesa_function_pool[8704]: DrawRangeElements (offset 338) */ "iiiiip\0" "glDrawRangeElements\0" "glDrawRangeElementsEXT\0" "\0" - /* _mesa_function_pool[8716]: EvalMesh2 (offset 238) */ + /* _mesa_function_pool[8755]: EvalMesh2 (offset 238) */ "iiiii\0" "glEvalMesh2\0" "\0" - /* _mesa_function_pool[8735]: Vertex4fv (offset 145) */ + /* _mesa_function_pool[8774]: Vertex4fv (offset 145) */ "p\0" "glVertex4fv\0" "\0" - /* _mesa_function_pool[8750]: GenTransformFeedbacks (will be remapped) */ + /* _mesa_function_pool[8789]: GenTransformFeedbacks (will be remapped) */ "ip\0" "glGenTransformFeedbacks\0" "\0" - /* _mesa_function_pool[8778]: SpriteParameterfvSGIX (dynamic) */ + /* _mesa_function_pool[8817]: SpriteParameterfvSGIX (dynamic) */ "ip\0" "glSpriteParameterfvSGIX\0" "\0" - /* _mesa_function_pool[8806]: CheckFramebufferStatusEXT (will be remapped) */ + /* _mesa_function_pool[8845]: CheckFramebufferStatusEXT (will be remapped) */ "i\0" "glCheckFramebufferStatus\0" "glCheckFramebufferStatusEXT\0" "\0" - /* _mesa_function_pool[8862]: GlobalAlphaFactoruiSUN (dynamic) */ + /* _mesa_function_pool[8901]: GlobalAlphaFactoruiSUN (dynamic) */ "i\0" "glGlobalAlphaFactoruiSUN\0" "\0" - /* _mesa_function_pool[8890]: GetHandleARB (will be remapped) */ + /* _mesa_function_pool[8929]: GetHandleARB (will be remapped) */ "i\0" "glGetHandleARB\0" "\0" - /* _mesa_function_pool[8908]: GetVertexAttribivARB (will be remapped) */ + /* _mesa_function_pool[8947]: GetVertexAttribivARB (will be remapped) */ "iip\0" "glGetVertexAttribiv\0" "glGetVertexAttribivARB\0" "\0" - /* _mesa_function_pool[8956]: GetCombinerInputParameterfvNV (will be remapped) */ + /* _mesa_function_pool[8995]: GetCombinerInputParameterfvNV (will be remapped) */ "iiiip\0" "glGetCombinerInputParameterfvNV\0" "\0" - /* _mesa_function_pool[8995]: CreateProgram (will be remapped) */ + /* _mesa_function_pool[9034]: CreateProgram (will be remapped) */ "\0" "glCreateProgram\0" "\0" - /* _mesa_function_pool[9013]: LoadTransposeMatrixdARB (will be remapped) */ + /* _mesa_function_pool[9052]: LoadTransposeMatrixdARB (will be remapped) */ "p\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixdARB\0" "\0" - /* _mesa_function_pool[9065]: GetMinmax (offset 364) */ + /* _mesa_function_pool[9104]: GetMinmax (offset 364) */ "iiiip\0" "glGetMinmax\0" "glGetMinmaxEXT\0" "\0" - /* _mesa_function_pool[9099]: StencilFuncSeparate (will be remapped) */ + /* _mesa_function_pool[9138]: StencilFuncSeparate (will be remapped) */ "iiii\0" "glStencilFuncSeparate\0" "\0" - /* _mesa_function_pool[9127]: SecondaryColor3sEXT (will be remapped) */ + /* _mesa_function_pool[9166]: SecondaryColor3sEXT (will be remapped) */ "iii\0" "glSecondaryColor3s\0" "glSecondaryColor3sEXT\0" "\0" - /* _mesa_function_pool[9173]: Color3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[9212]: Color3fVertex3fvSUN (dynamic) */ "pp\0" "glColor3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[9199]: Normal3fv (offset 57) */ + /* _mesa_function_pool[9238]: Normal3fv (offset 57) */ "p\0" "glNormal3fv\0" "\0" - /* _mesa_function_pool[9214]: GlobalAlphaFactorbSUN (dynamic) */ + /* _mesa_function_pool[9253]: GlobalAlphaFactorbSUN (dynamic) */ "i\0" "glGlobalAlphaFactorbSUN\0" "\0" - /* _mesa_function_pool[9241]: Color3us (offset 23) */ + /* _mesa_function_pool[9280]: Color3us (offset 23) */ "iii\0" "glColor3us\0" "\0" - /* _mesa_function_pool[9257]: ImageTransformParameterfvHP (dynamic) */ + /* _mesa_function_pool[9296]: ImageTransformParameterfvHP (dynamic) */ "iip\0" "glImageTransformParameterfvHP\0" "\0" - /* _mesa_function_pool[9292]: VertexAttrib4ivARB (will be remapped) */ + /* _mesa_function_pool[9331]: VertexAttrib4ivARB (will be remapped) */ "ip\0" "glVertexAttrib4iv\0" "glVertexAttrib4ivARB\0" "\0" - /* _mesa_function_pool[9335]: End (offset 43) */ + /* _mesa_function_pool[9374]: End (offset 43) */ "\0" "glEnd\0" "\0" - /* _mesa_function_pool[9343]: VertexAttrib3fNV (will be remapped) */ + /* _mesa_function_pool[9382]: VertexAttrib3fNV (will be remapped) */ "ifff\0" "glVertexAttrib3fNV\0" "\0" - /* _mesa_function_pool[9368]: VertexAttribs2dvNV (will be remapped) */ + /* _mesa_function_pool[9407]: VertexAttribs2dvNV (will be remapped) */ "iip\0" "glVertexAttribs2dvNV\0" "\0" - /* _mesa_function_pool[9394]: GetQueryObjectui64vEXT (will be remapped) */ + /* _mesa_function_pool[9433]: GetQueryObjectui64vEXT (will be remapped) */ "iip\0" "glGetQueryObjectui64vEXT\0" "\0" - /* _mesa_function_pool[9424]: MultiTexCoord3fvARB (offset 395) */ + /* _mesa_function_pool[9463]: MultiTexCoord3fvARB (offset 395) */ "ip\0" "glMultiTexCoord3fv\0" "glMultiTexCoord3fvARB\0" "\0" - /* _mesa_function_pool[9469]: SecondaryColor3dEXT (will be remapped) */ + /* _mesa_function_pool[9508]: SecondaryColor3dEXT (will be remapped) */ "ddd\0" "glSecondaryColor3d\0" "glSecondaryColor3dEXT\0" "\0" - /* _mesa_function_pool[9515]: Color3ub (offset 19) */ + /* _mesa_function_pool[9554]: Color3ub (offset 19) */ "iii\0" "glColor3ub\0" "\0" - /* _mesa_function_pool[9531]: GetProgramParameterfvNV (will be remapped) */ + /* _mesa_function_pool[9570]: GetProgramParameterfvNV (will be remapped) */ "iiip\0" "glGetProgramParameterfvNV\0" "\0" - /* _mesa_function_pool[9563]: TangentPointerEXT (dynamic) */ + /* _mesa_function_pool[9602]: TangentPointerEXT (dynamic) */ "iip\0" "glTangentPointerEXT\0" "\0" - /* _mesa_function_pool[9588]: Color4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[9627]: Color4fNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[9623]: GetInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[9662]: GetInstrumentsSGIX (dynamic) */ "\0" "glGetInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[9646]: Color3ui (offset 21) */ + /* _mesa_function_pool[9685]: Color3ui (offset 21) */ "iii\0" "glColor3ui\0" "\0" - /* _mesa_function_pool[9662]: EvalMapsNV (dynamic) */ + /* _mesa_function_pool[9701]: EvalMapsNV (dynamic) */ "ii\0" "glEvalMapsNV\0" "\0" - /* _mesa_function_pool[9679]: TexSubImage2D (offset 333) */ + /* _mesa_function_pool[9718]: TexSubImage2D (offset 333) */ "iiiiiiiip\0" "glTexSubImage2D\0" "glTexSubImage2DEXT\0" "\0" - /* _mesa_function_pool[9725]: FragmentLightivSGIX (dynamic) */ + /* _mesa_function_pool[9764]: FragmentLightivSGIX (dynamic) */ "iip\0" "glFragmentLightivSGIX\0" "\0" - /* _mesa_function_pool[9752]: GetTexParameterPointervAPPLE (will be remapped) */ + /* _mesa_function_pool[9791]: GetTexParameterPointervAPPLE (will be remapped) */ "iip\0" "glGetTexParameterPointervAPPLE\0" "\0" - /* _mesa_function_pool[9788]: TexGenfv (offset 191) */ + /* _mesa_function_pool[9827]: TexGenfv (offset 191) */ "iip\0" "glTexGenfv\0" "\0" - /* _mesa_function_pool[9804]: GetTransformFeedbackVaryingEXT (will be remapped) */ + /* _mesa_function_pool[9843]: GetTransformFeedbackVaryingEXT (will be remapped) */ "iiipppp\0" "glGetTransformFeedbackVaryingEXT\0" "glGetTransformFeedbackVarying\0" "\0" - /* _mesa_function_pool[9876]: VertexAttrib4bvARB (will be remapped) */ + /* _mesa_function_pool[9915]: VertexAttrib4bvARB (will be remapped) */ "ip\0" "glVertexAttrib4bv\0" "glVertexAttrib4bvARB\0" "\0" - /* _mesa_function_pool[9919]: AlphaFragmentOp2ATI (will be remapped) */ + /* _mesa_function_pool[9958]: AlphaFragmentOp2ATI (will be remapped) */ "iiiiiiiii\0" "glAlphaFragmentOp2ATI\0" "\0" - /* _mesa_function_pool[9952]: GetIntegerIndexedvEXT (will be remapped) */ + /* _mesa_function_pool[9991]: GetIntegerIndexedvEXT (will be remapped) */ "iip\0" "glGetIntegerIndexedvEXT\0" "\0" - /* _mesa_function_pool[9981]: MultiTexCoord4sARB (offset 406) */ + /* _mesa_function_pool[10020]: MultiTexCoord4sARB (offset 406) */ "iiiii\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sARB\0" "\0" - /* _mesa_function_pool[10027]: GetFragmentMaterialivSGIX (dynamic) */ + /* _mesa_function_pool[10066]: GetFragmentMaterialivSGIX (dynamic) */ "iip\0" "glGetFragmentMaterialivSGIX\0" "\0" - /* _mesa_function_pool[10060]: WindowPos4dMESA (will be remapped) */ + /* _mesa_function_pool[10099]: WindowPos4dMESA (will be remapped) */ "dddd\0" "glWindowPos4dMESA\0" "\0" - /* _mesa_function_pool[10084]: WeightPointerARB (dynamic) */ + /* _mesa_function_pool[10123]: WeightPointerARB (dynamic) */ "iiip\0" "glWeightPointerARB\0" "\0" - /* _mesa_function_pool[10109]: WindowPos2dMESA (will be remapped) */ + /* _mesa_function_pool[10148]: WindowPos2dMESA (will be remapped) */ "dd\0" "glWindowPos2d\0" "glWindowPos2dARB\0" "glWindowPos2dMESA\0" "\0" - /* _mesa_function_pool[10162]: FramebufferTexture3DEXT (will be remapped) */ + /* _mesa_function_pool[10201]: FramebufferTexture3DEXT (will be remapped) */ "iiiiii\0" "glFramebufferTexture3D\0" "glFramebufferTexture3DEXT\0" "\0" - /* _mesa_function_pool[10219]: BlendEquation (offset 337) */ + /* _mesa_function_pool[10258]: BlendEquation (offset 337) */ "i\0" "glBlendEquation\0" "glBlendEquationEXT\0" "\0" - /* _mesa_function_pool[10257]: VertexAttrib3dNV (will be remapped) */ + /* _mesa_function_pool[10296]: VertexAttrib3dNV (will be remapped) */ "iddd\0" "glVertexAttrib3dNV\0" "\0" - /* _mesa_function_pool[10282]: VertexAttrib3dARB (will be remapped) */ + /* _mesa_function_pool[10321]: VertexAttrib3dARB (will be remapped) */ "iddd\0" "glVertexAttrib3d\0" "glVertexAttrib3dARB\0" "\0" - /* _mesa_function_pool[10325]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[10364]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ "ppppp\0" "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[10389]: VertexAttrib4fARB (will be remapped) */ + /* _mesa_function_pool[10428]: VertexAttrib4fARB (will be remapped) */ "iffff\0" "glVertexAttrib4f\0" "glVertexAttrib4fARB\0" "\0" - /* _mesa_function_pool[10433]: GetError (offset 261) */ + /* _mesa_function_pool[10472]: GetError (offset 261) */ "\0" "glGetError\0" "\0" - /* _mesa_function_pool[10446]: IndexFuncEXT (dynamic) */ + /* _mesa_function_pool[10485]: IndexFuncEXT (dynamic) */ "if\0" "glIndexFuncEXT\0" "\0" - /* _mesa_function_pool[10465]: TexCoord3dv (offset 111) */ + /* _mesa_function_pool[10504]: TexCoord3dv (offset 111) */ "p\0" "glTexCoord3dv\0" "\0" - /* _mesa_function_pool[10482]: Indexdv (offset 45) */ + /* _mesa_function_pool[10521]: Indexdv (offset 45) */ "p\0" "glIndexdv\0" "\0" - /* _mesa_function_pool[10495]: FramebufferTexture2DEXT (will be remapped) */ + /* _mesa_function_pool[10534]: FramebufferTexture2DEXT (will be remapped) */ "iiiii\0" "glFramebufferTexture2D\0" "glFramebufferTexture2DEXT\0" "\0" - /* _mesa_function_pool[10551]: Normal3s (offset 60) */ + /* _mesa_function_pool[10590]: Normal3s (offset 60) */ "iii\0" "glNormal3s\0" "\0" - /* _mesa_function_pool[10567]: GetObjectParameterivAPPLE (will be remapped) */ + /* _mesa_function_pool[10606]: GetObjectParameterivAPPLE (will be remapped) */ "iiip\0" "glGetObjectParameterivAPPLE\0" "\0" - /* _mesa_function_pool[10601]: PushName (offset 201) */ + /* _mesa_function_pool[10640]: PushName (offset 201) */ "i\0" "glPushName\0" "\0" - /* _mesa_function_pool[10615]: MultiTexCoord2dvARB (offset 385) */ + /* _mesa_function_pool[10654]: MultiTexCoord2dvARB (offset 385) */ "ip\0" "glMultiTexCoord2dv\0" "glMultiTexCoord2dvARB\0" "\0" - /* _mesa_function_pool[10660]: CullParameterfvEXT (will be remapped) */ + /* _mesa_function_pool[10699]: CullParameterfvEXT (dynamic) */ "ip\0" "glCullParameterfvEXT\0" "\0" - /* _mesa_function_pool[10685]: Normal3i (offset 58) */ + /* _mesa_function_pool[10724]: Normal3i (offset 58) */ "iii\0" "glNormal3i\0" "\0" - /* _mesa_function_pool[10701]: ProgramNamedParameter4fvNV (will be remapped) */ + /* _mesa_function_pool[10740]: ProgramNamedParameter4fvNV (will be remapped) */ "iipp\0" "glProgramNamedParameter4fvNV\0" "\0" - /* _mesa_function_pool[10736]: SecondaryColorPointerEXT (will be remapped) */ + /* _mesa_function_pool[10775]: SecondaryColorPointerEXT (will be remapped) */ "iiip\0" "glSecondaryColorPointer\0" "glSecondaryColorPointerEXT\0" "\0" - /* _mesa_function_pool[10793]: VertexAttrib4fvARB (will be remapped) */ + /* _mesa_function_pool[10832]: VertexAttrib4fvARB (will be remapped) */ "ip\0" "glVertexAttrib4fv\0" "glVertexAttrib4fvARB\0" "\0" - /* _mesa_function_pool[10836]: ColorPointerListIBM (dynamic) */ + /* _mesa_function_pool[10875]: ColorPointerListIBM (dynamic) */ "iiipi\0" "glColorPointerListIBM\0" "\0" - /* _mesa_function_pool[10865]: GetActiveUniformARB (will be remapped) */ + /* _mesa_function_pool[10904]: GetActiveUniformARB (will be remapped) */ "iiipppp\0" "glGetActiveUniform\0" "glGetActiveUniformARB\0" "\0" - /* _mesa_function_pool[10915]: ImageTransformParameteriHP (dynamic) */ + /* _mesa_function_pool[10954]: ImageTransformParameteriHP (dynamic) */ "iii\0" "glImageTransformParameteriHP\0" "\0" - /* _mesa_function_pool[10949]: Normal3b (offset 52) */ + /* _mesa_function_pool[10988]: Normal3b (offset 52) */ "iii\0" "glNormal3b\0" "\0" - /* _mesa_function_pool[10965]: Normal3d (offset 54) */ + /* _mesa_function_pool[11004]: Normal3d (offset 54) */ "ddd\0" "glNormal3d\0" "\0" - /* _mesa_function_pool[10981]: Normal3f (offset 56) */ + /* _mesa_function_pool[11020]: Normal3f (offset 56) */ "fff\0" "glNormal3f\0" "\0" - /* _mesa_function_pool[10997]: MultiTexCoord1svARB (offset 383) */ + /* _mesa_function_pool[11036]: MultiTexCoord1svARB (offset 383) */ "ip\0" "glMultiTexCoord1sv\0" "glMultiTexCoord1svARB\0" "\0" - /* _mesa_function_pool[11042]: Indexi (offset 48) */ + /* _mesa_function_pool[11081]: Indexi (offset 48) */ "i\0" "glIndexi\0" "\0" - /* _mesa_function_pool[11054]: EGLImageTargetTexture2DOES (will be remapped) */ + /* _mesa_function_pool[11093]: EGLImageTargetTexture2DOES (will be remapped) */ "ip\0" "glEGLImageTargetTexture2DOES\0" "\0" - /* _mesa_function_pool[11087]: EndQueryARB (will be remapped) */ + /* _mesa_function_pool[11126]: EndQueryARB (will be remapped) */ "i\0" "glEndQuery\0" "glEndQueryARB\0" "\0" - /* _mesa_function_pool[11115]: DeleteFencesNV (will be remapped) */ + /* _mesa_function_pool[11154]: DeleteFencesNV (will be remapped) */ "ip\0" "glDeleteFencesNV\0" "\0" - /* _mesa_function_pool[11136]: BindBufferRangeEXT (will be remapped) */ + /* _mesa_function_pool[11175]: DeformationMap3dSGIX (dynamic) */ + "iddiiddiiddiip\0" + "glDeformationMap3dSGIX\0" + "\0" + /* _mesa_function_pool[11214]: BindBufferRangeEXT (will be remapped) */ "iiiii\0" "glBindBufferRangeEXT\0" "glBindBufferRange\0" "\0" - /* _mesa_function_pool[11182]: DepthMask (offset 211) */ + /* _mesa_function_pool[11260]: DepthMask (offset 211) */ "i\0" "glDepthMask\0" "\0" - /* _mesa_function_pool[11197]: IsShader (will be remapped) */ + /* _mesa_function_pool[11275]: IsShader (will be remapped) */ "i\0" "glIsShader\0" "\0" - /* _mesa_function_pool[11211]: Indexf (offset 46) */ + /* _mesa_function_pool[11289]: Indexf (offset 46) */ "f\0" "glIndexf\0" "\0" - /* _mesa_function_pool[11223]: GetImageTransformParameterivHP (dynamic) */ + /* _mesa_function_pool[11301]: GetImageTransformParameterivHP (dynamic) */ "iip\0" "glGetImageTransformParameterivHP\0" "\0" - /* _mesa_function_pool[11261]: Indexd (offset 44) */ + /* _mesa_function_pool[11339]: Indexd (offset 44) */ "d\0" "glIndexd\0" "\0" - /* _mesa_function_pool[11273]: GetMaterialiv (offset 270) */ + /* _mesa_function_pool[11351]: GetMaterialiv (offset 270) */ "iip\0" "glGetMaterialiv\0" "\0" - /* _mesa_function_pool[11294]: StencilOp (offset 244) */ + /* _mesa_function_pool[11372]: StencilOp (offset 244) */ "iii\0" "glStencilOp\0" "\0" - /* _mesa_function_pool[11311]: WindowPos4ivMESA (will be remapped) */ + /* _mesa_function_pool[11389]: WindowPos4ivMESA (will be remapped) */ "p\0" "glWindowPos4ivMESA\0" "\0" - /* _mesa_function_pool[11333]: FramebufferTextureLayer (dynamic) */ + /* _mesa_function_pool[11411]: FramebufferTextureLayer (dynamic) */ "iiiii\0" "glFramebufferTextureLayerARB\0" "\0" - /* _mesa_function_pool[11369]: MultiTexCoord3svARB (offset 399) */ + /* _mesa_function_pool[11447]: MultiTexCoord3svARB (offset 399) */ "ip\0" "glMultiTexCoord3sv\0" "glMultiTexCoord3svARB\0" "\0" - /* _mesa_function_pool[11414]: TexEnvfv (offset 185) */ + /* _mesa_function_pool[11492]: TexEnvfv (offset 185) */ "iip\0" "glTexEnvfv\0" "\0" - /* _mesa_function_pool[11430]: MultiTexCoord4iARB (offset 404) */ + /* _mesa_function_pool[11508]: MultiTexCoord4iARB (offset 404) */ "iiiii\0" "glMultiTexCoord4i\0" "glMultiTexCoord4iARB\0" "\0" - /* _mesa_function_pool[11476]: Indexs (offset 50) */ + /* _mesa_function_pool[11554]: Indexs (offset 50) */ "i\0" "glIndexs\0" "\0" - /* _mesa_function_pool[11488]: Binormal3ivEXT (dynamic) */ + /* _mesa_function_pool[11566]: Binormal3ivEXT (dynamic) */ "p\0" "glBinormal3ivEXT\0" "\0" - /* _mesa_function_pool[11508]: ResizeBuffersMESA (will be remapped) */ + /* _mesa_function_pool[11586]: ResizeBuffersMESA (will be remapped) */ "\0" "glResizeBuffersMESA\0" "\0" - /* _mesa_function_pool[11530]: GetUniformivARB (will be remapped) */ + /* _mesa_function_pool[11608]: GetUniformivARB (will be remapped) */ "iip\0" "glGetUniformiv\0" "glGetUniformivARB\0" "\0" - /* _mesa_function_pool[11568]: PixelTexGenParameteriSGIS (will be remapped) */ + /* _mesa_function_pool[11646]: PixelTexGenParameteriSGIS (will be remapped) */ "ii\0" "glPixelTexGenParameteriSGIS\0" "\0" - /* _mesa_function_pool[11600]: VertexPointervINTEL (dynamic) */ + /* _mesa_function_pool[11678]: VertexPointervINTEL (dynamic) */ "iip\0" "glVertexPointervINTEL\0" "\0" - /* _mesa_function_pool[11627]: Vertex2i (offset 130) */ + /* _mesa_function_pool[11705]: Vertex2i (offset 130) */ "ii\0" "glVertex2i\0" "\0" - /* _mesa_function_pool[11642]: LoadMatrixf (offset 291) */ + /* _mesa_function_pool[11720]: LoadMatrixf (offset 291) */ "p\0" "glLoadMatrixf\0" "\0" - /* _mesa_function_pool[11659]: Vertex2f (offset 128) */ + /* _mesa_function_pool[11737]: Vertex2f (offset 128) */ "ff\0" "glVertex2f\0" "\0" - /* _mesa_function_pool[11674]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[11752]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[11727]: Color4bv (offset 26) */ + /* _mesa_function_pool[11805]: Color4bv (offset 26) */ "p\0" "glColor4bv\0" "\0" - /* _mesa_function_pool[11741]: VertexPointer (offset 321) */ + /* _mesa_function_pool[11819]: VertexPointer (offset 321) */ "iiip\0" "glVertexPointer\0" "\0" - /* _mesa_function_pool[11763]: SecondaryColor3uiEXT (will be remapped) */ + /* _mesa_function_pool[11841]: SecondaryColor3uiEXT (will be remapped) */ "iii\0" "glSecondaryColor3ui\0" "glSecondaryColor3uiEXT\0" "\0" - /* _mesa_function_pool[11811]: StartInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[11889]: StartInstrumentsSGIX (dynamic) */ "\0" "glStartInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[11836]: SecondaryColor3usvEXT (will be remapped) */ + /* _mesa_function_pool[11914]: SecondaryColor3usvEXT (will be remapped) */ "p\0" "glSecondaryColor3usv\0" "glSecondaryColor3usvEXT\0" "\0" - /* _mesa_function_pool[11884]: VertexAttrib2fvNV (will be remapped) */ + /* _mesa_function_pool[11962]: VertexAttrib2fvNV (will be remapped) */ "ip\0" "glVertexAttrib2fvNV\0" "\0" - /* _mesa_function_pool[11908]: ProgramLocalParameter4dvARB (will be remapped) */ + /* _mesa_function_pool[11986]: ProgramLocalParameter4dvARB (will be remapped) */ "iip\0" "glProgramLocalParameter4dvARB\0" "\0" - /* _mesa_function_pool[11943]: DeleteLists (offset 4) */ + /* _mesa_function_pool[12021]: DeleteLists (offset 4) */ "ii\0" "glDeleteLists\0" "\0" - /* _mesa_function_pool[11961]: LogicOp (offset 242) */ + /* _mesa_function_pool[12039]: LogicOp (offset 242) */ "i\0" "glLogicOp\0" "\0" - /* _mesa_function_pool[11974]: MatrixIndexuivARB (dynamic) */ + /* _mesa_function_pool[12052]: MatrixIndexuivARB (dynamic) */ "ip\0" "glMatrixIndexuivARB\0" "\0" - /* _mesa_function_pool[11998]: Vertex2s (offset 132) */ + /* _mesa_function_pool[12076]: Vertex2s (offset 132) */ "ii\0" "glVertex2s\0" "\0" - /* _mesa_function_pool[12013]: RenderbufferStorageMultisample (will be remapped) */ + /* _mesa_function_pool[12091]: RenderbufferStorageMultisample (will be remapped) */ "iiiii\0" "glRenderbufferStorageMultisample\0" "glRenderbufferStorageMultisampleEXT\0" "\0" - /* _mesa_function_pool[12089]: TexCoord4fv (offset 121) */ + /* _mesa_function_pool[12167]: TexCoord4fv (offset 121) */ "p\0" "glTexCoord4fv\0" "\0" - /* _mesa_function_pool[12106]: Tangent3sEXT (dynamic) */ + /* _mesa_function_pool[12184]: Tangent3sEXT (dynamic) */ "iii\0" "glTangent3sEXT\0" "\0" - /* _mesa_function_pool[12126]: GlobalAlphaFactorfSUN (dynamic) */ + /* _mesa_function_pool[12204]: GlobalAlphaFactorfSUN (dynamic) */ "f\0" "glGlobalAlphaFactorfSUN\0" "\0" - /* _mesa_function_pool[12153]: MultiTexCoord3iARB (offset 396) */ + /* _mesa_function_pool[12231]: MultiTexCoord3iARB (offset 396) */ "iiii\0" "glMultiTexCoord3i\0" "glMultiTexCoord3iARB\0" "\0" - /* _mesa_function_pool[12198]: IsProgram (will be remapped) */ + /* _mesa_function_pool[12276]: IsProgram (will be remapped) */ "i\0" "glIsProgram\0" "\0" - /* _mesa_function_pool[12213]: TexCoordPointerListIBM (dynamic) */ + /* _mesa_function_pool[12291]: TexCoordPointerListIBM (dynamic) */ "iiipi\0" "glTexCoordPointerListIBM\0" "\0" - /* _mesa_function_pool[12245]: GlobalAlphaFactorusSUN (dynamic) */ + /* _mesa_function_pool[12323]: GlobalAlphaFactorusSUN (dynamic) */ "i\0" "glGlobalAlphaFactorusSUN\0" "\0" - /* _mesa_function_pool[12273]: VertexAttrib2dvNV (will be remapped) */ + /* _mesa_function_pool[12351]: VertexAttrib2dvNV (will be remapped) */ "ip\0" "glVertexAttrib2dvNV\0" "\0" - /* _mesa_function_pool[12297]: FramebufferRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[12375]: FramebufferRenderbufferEXT (will be remapped) */ "iiii\0" "glFramebufferRenderbuffer\0" "glFramebufferRenderbufferEXT\0" "\0" - /* _mesa_function_pool[12358]: VertexAttrib1dvNV (will be remapped) */ + /* _mesa_function_pool[12436]: VertexAttrib1dvNV (will be remapped) */ "ip\0" "glVertexAttrib1dvNV\0" "\0" - /* _mesa_function_pool[12382]: GenTextures (offset 328) */ + /* _mesa_function_pool[12460]: GenTextures (offset 328) */ "ip\0" "glGenTextures\0" "glGenTexturesEXT\0" "\0" - /* _mesa_function_pool[12417]: FramebufferTextureARB (will be remapped) */ + /* _mesa_function_pool[12495]: FramebufferTextureARB (will be remapped) */ "iiii\0" "glFramebufferTextureARB\0" "\0" - /* _mesa_function_pool[12447]: SetFenceNV (will be remapped) */ + /* _mesa_function_pool[12525]: SetFenceNV (will be remapped) */ "ii\0" "glSetFenceNV\0" "\0" - /* _mesa_function_pool[12464]: FramebufferTexture1DEXT (will be remapped) */ + /* _mesa_function_pool[12542]: FramebufferTexture1DEXT (will be remapped) */ "iiiii\0" "glFramebufferTexture1D\0" "glFramebufferTexture1DEXT\0" "\0" - /* _mesa_function_pool[12520]: GetCombinerOutputParameterivNV (will be remapped) */ + /* _mesa_function_pool[12598]: GetCombinerOutputParameterivNV (will be remapped) */ "iiip\0" "glGetCombinerOutputParameterivNV\0" "\0" - /* _mesa_function_pool[12559]: MultiModeDrawArraysIBM (will be remapped) */ - "pppii\0" - "glMultiModeDrawArraysIBM\0" - "\0" - /* _mesa_function_pool[12591]: PixelTexGenParameterivSGIS (will be remapped) */ + /* _mesa_function_pool[12637]: PixelTexGenParameterivSGIS (will be remapped) */ "ip\0" "glPixelTexGenParameterivSGIS\0" "\0" - /* _mesa_function_pool[12624]: TextureNormalEXT (dynamic) */ + /* _mesa_function_pool[12670]: TextureNormalEXT (dynamic) */ "i\0" "glTextureNormalEXT\0" "\0" - /* _mesa_function_pool[12646]: IndexPointerListIBM (dynamic) */ + /* _mesa_function_pool[12692]: IndexPointerListIBM (dynamic) */ "iipi\0" "glIndexPointerListIBM\0" "\0" - /* _mesa_function_pool[12674]: WeightfvARB (dynamic) */ + /* _mesa_function_pool[12720]: WeightfvARB (dynamic) */ "ip\0" "glWeightfvARB\0" "\0" - /* _mesa_function_pool[12692]: GetCombinerOutputParameterfvNV (will be remapped) */ - "iiip\0" - "glGetCombinerOutputParameterfvNV\0" - "\0" - /* _mesa_function_pool[12731]: RasterPos2sv (offset 69) */ + /* _mesa_function_pool[12738]: RasterPos2sv (offset 69) */ "p\0" "glRasterPos2sv\0" "\0" - /* _mesa_function_pool[12749]: Color4ubv (offset 36) */ + /* _mesa_function_pool[12756]: Color4ubv (offset 36) */ "p\0" "glColor4ubv\0" "\0" - /* _mesa_function_pool[12764]: DrawBuffer (offset 202) */ + /* _mesa_function_pool[12771]: DrawBuffer (offset 202) */ "i\0" "glDrawBuffer\0" "\0" - /* _mesa_function_pool[12780]: TexCoord2fv (offset 105) */ + /* _mesa_function_pool[12787]: TexCoord2fv (offset 105) */ "p\0" "glTexCoord2fv\0" "\0" - /* _mesa_function_pool[12797]: WindowPos4fMESA (will be remapped) */ + /* _mesa_function_pool[12804]: WindowPos4fMESA (will be remapped) */ "ffff\0" "glWindowPos4fMESA\0" "\0" - /* _mesa_function_pool[12821]: TexCoord1sv (offset 101) */ + /* _mesa_function_pool[12828]: TexCoord1sv (offset 101) */ "p\0" "glTexCoord1sv\0" "\0" - /* _mesa_function_pool[12838]: WindowPos3dvMESA (will be remapped) */ + /* _mesa_function_pool[12845]: WindowPos3dvMESA (will be remapped) */ "p\0" "glWindowPos3dv\0" "glWindowPos3dvARB\0" "glWindowPos3dvMESA\0" "\0" - /* _mesa_function_pool[12893]: DepthFunc (offset 245) */ + /* _mesa_function_pool[12900]: DepthFunc (offset 245) */ "i\0" "glDepthFunc\0" "\0" - /* _mesa_function_pool[12908]: PixelMapusv (offset 253) */ + /* _mesa_function_pool[12915]: PixelMapusv (offset 253) */ "iip\0" "glPixelMapusv\0" "\0" - /* _mesa_function_pool[12927]: GetQueryObjecti64vEXT (will be remapped) */ + /* _mesa_function_pool[12934]: GetQueryObjecti64vEXT (will be remapped) */ "iip\0" "glGetQueryObjecti64vEXT\0" "\0" - /* _mesa_function_pool[12956]: MultiTexCoord1dARB (offset 376) */ + /* _mesa_function_pool[12963]: MultiTexCoord1dARB (offset 376) */ "id\0" "glMultiTexCoord1d\0" "glMultiTexCoord1dARB\0" "\0" - /* _mesa_function_pool[12999]: PointParameterivNV (will be remapped) */ + /* _mesa_function_pool[13006]: PointParameterivNV (will be remapped) */ "ip\0" "glPointParameteriv\0" "glPointParameterivNV\0" "\0" - /* _mesa_function_pool[13043]: BlendFunc (offset 241) */ + /* _mesa_function_pool[13050]: BlendFunc (offset 241) */ "ii\0" "glBlendFunc\0" "\0" - /* _mesa_function_pool[13059]: EndTransformFeedbackEXT (will be remapped) */ + /* _mesa_function_pool[13066]: EndTransformFeedbackEXT (will be remapped) */ "\0" "glEndTransformFeedbackEXT\0" "glEndTransformFeedback\0" "\0" - /* _mesa_function_pool[13110]: Uniform2fvARB (will be remapped) */ + /* _mesa_function_pool[13117]: Uniform2fvARB (will be remapped) */ "iip\0" "glUniform2fv\0" "glUniform2fvARB\0" "\0" - /* _mesa_function_pool[13144]: BufferParameteriAPPLE (will be remapped) */ + /* _mesa_function_pool[13151]: BufferParameteriAPPLE (will be remapped) */ "iii\0" "glBufferParameteriAPPLE\0" "\0" - /* _mesa_function_pool[13173]: MultiTexCoord3dvARB (offset 393) */ + /* _mesa_function_pool[13180]: MultiTexCoord3dvARB (offset 393) */ "ip\0" "glMultiTexCoord3dv\0" "glMultiTexCoord3dvARB\0" "\0" - /* _mesa_function_pool[13218]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[13225]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[13274]: DeleteObjectARB (will be remapped) */ + /* _mesa_function_pool[13281]: DeleteObjectARB (will be remapped) */ "i\0" "glDeleteObjectARB\0" "\0" - /* _mesa_function_pool[13295]: MatrixIndexPointerARB (dynamic) */ + /* _mesa_function_pool[13302]: MatrixIndexPointerARB (dynamic) */ "iiip\0" "glMatrixIndexPointerARB\0" "\0" - /* _mesa_function_pool[13325]: ProgramNamedParameter4dvNV (will be remapped) */ + /* _mesa_function_pool[13332]: ProgramNamedParameter4dvNV (will be remapped) */ "iipp\0" "glProgramNamedParameter4dvNV\0" "\0" - /* _mesa_function_pool[13360]: Tangent3fvEXT (dynamic) */ + /* _mesa_function_pool[13367]: Tangent3fvEXT (dynamic) */ "p\0" "glTangent3fvEXT\0" "\0" - /* _mesa_function_pool[13379]: Flush (offset 217) */ + /* _mesa_function_pool[13386]: Flush (offset 217) */ "\0" "glFlush\0" "\0" - /* _mesa_function_pool[13389]: Color4uiv (offset 38) */ + /* _mesa_function_pool[13396]: Color4uiv (offset 38) */ "p\0" "glColor4uiv\0" "\0" - /* _mesa_function_pool[13404]: GenVertexArrays (will be remapped) */ + /* _mesa_function_pool[13411]: GenVertexArrays (will be remapped) */ "ip\0" "glGenVertexArrays\0" "\0" - /* _mesa_function_pool[13426]: RasterPos3sv (offset 77) */ + /* _mesa_function_pool[13433]: RasterPos3sv (offset 77) */ "p\0" "glRasterPos3sv\0" "\0" - /* _mesa_function_pool[13444]: BindFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[13451]: BindFramebufferEXT (will be remapped) */ "ii\0" "glBindFramebuffer\0" "glBindFramebufferEXT\0" "\0" - /* _mesa_function_pool[13487]: ReferencePlaneSGIX (dynamic) */ + /* _mesa_function_pool[13494]: ReferencePlaneSGIX (dynamic) */ "p\0" "glReferencePlaneSGIX\0" "\0" - /* _mesa_function_pool[13511]: PushAttrib (offset 219) */ + /* _mesa_function_pool[13518]: PushAttrib (offset 219) */ "i\0" "glPushAttrib\0" "\0" - /* _mesa_function_pool[13527]: RasterPos2i (offset 66) */ + /* _mesa_function_pool[13534]: RasterPos2i (offset 66) */ "ii\0" "glRasterPos2i\0" "\0" - /* _mesa_function_pool[13545]: ValidateProgramARB (will be remapped) */ + /* _mesa_function_pool[13552]: ValidateProgramARB (will be remapped) */ "i\0" "glValidateProgram\0" "glValidateProgramARB\0" "\0" - /* _mesa_function_pool[13587]: TexParameteriv (offset 181) */ + /* _mesa_function_pool[13594]: TexParameteriv (offset 181) */ "iip\0" "glTexParameteriv\0" "\0" - /* _mesa_function_pool[13609]: UnlockArraysEXT (will be remapped) */ + /* _mesa_function_pool[13616]: UnlockArraysEXT (will be remapped) */ "\0" "glUnlockArraysEXT\0" "\0" - /* _mesa_function_pool[13629]: TexCoord2fColor3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[13636]: TexCoord2fColor3fVertex3fSUN (dynamic) */ "ffffffff\0" "glTexCoord2fColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[13670]: WindowPos3fvMESA (will be remapped) */ + /* _mesa_function_pool[13677]: WindowPos3fvMESA (will be remapped) */ "p\0" "glWindowPos3fv\0" "glWindowPos3fvARB\0" "glWindowPos3fvMESA\0" "\0" - /* _mesa_function_pool[13725]: RasterPos2f (offset 64) */ + /* _mesa_function_pool[13732]: RasterPos2f (offset 64) */ "ff\0" "glRasterPos2f\0" "\0" - /* _mesa_function_pool[13743]: VertexAttrib1svNV (will be remapped) */ + /* _mesa_function_pool[13750]: VertexAttrib1svNV (will be remapped) */ "ip\0" "glVertexAttrib1svNV\0" "\0" - /* _mesa_function_pool[13767]: RasterPos2d (offset 62) */ + /* _mesa_function_pool[13774]: RasterPos2d (offset 62) */ "dd\0" "glRasterPos2d\0" "\0" - /* _mesa_function_pool[13785]: RasterPos3fv (offset 73) */ + /* _mesa_function_pool[13792]: RasterPos3fv (offset 73) */ "p\0" "glRasterPos3fv\0" "\0" - /* _mesa_function_pool[13803]: CopyTexSubImage3D (offset 373) */ + /* _mesa_function_pool[13810]: CopyTexSubImage3D (offset 373) */ "iiiiiiiii\0" "glCopyTexSubImage3D\0" "glCopyTexSubImage3DEXT\0" "\0" - /* _mesa_function_pool[13857]: VertexAttrib2dARB (will be remapped) */ + /* _mesa_function_pool[13864]: VertexAttrib2dARB (will be remapped) */ "idd\0" "glVertexAttrib2d\0" "glVertexAttrib2dARB\0" "\0" - /* _mesa_function_pool[13899]: Color4ub (offset 35) */ + /* _mesa_function_pool[13906]: Color4ub (offset 35) */ "iiii\0" "glColor4ub\0" "\0" - /* _mesa_function_pool[13916]: GetInteger64v (will be remapped) */ + /* _mesa_function_pool[13923]: GetInteger64v (will be remapped) */ "ip\0" "glGetInteger64v\0" "\0" - /* _mesa_function_pool[13936]: TextureColorMaskSGIS (dynamic) */ + /* _mesa_function_pool[13943]: TextureColorMaskSGIS (dynamic) */ "iiii\0" "glTextureColorMaskSGIS\0" "\0" - /* _mesa_function_pool[13965]: RasterPos2s (offset 68) */ + /* _mesa_function_pool[13972]: RasterPos2s (offset 68) */ "ii\0" "glRasterPos2s\0" "\0" - /* _mesa_function_pool[13983]: GetColorTable (offset 343) */ + /* _mesa_function_pool[13990]: GetColorTable (offset 343) */ "iiip\0" "glGetColorTable\0" "glGetColorTableSGI\0" "glGetColorTableEXT\0" "\0" - /* _mesa_function_pool[14043]: SelectBuffer (offset 195) */ + /* _mesa_function_pool[14050]: SelectBuffer (offset 195) */ "ip\0" "glSelectBuffer\0" "\0" - /* _mesa_function_pool[14062]: Indexiv (offset 49) */ + /* _mesa_function_pool[14069]: Indexiv (offset 49) */ "p\0" "glIndexiv\0" "\0" - /* _mesa_function_pool[14075]: TexCoord3i (offset 114) */ + /* _mesa_function_pool[14082]: TexCoord3i (offset 114) */ "iii\0" "glTexCoord3i\0" "\0" - /* _mesa_function_pool[14093]: CopyColorTable (offset 342) */ + /* _mesa_function_pool[14100]: CopyColorTable (offset 342) */ "iiiii\0" "glCopyColorTable\0" "glCopyColorTableSGI\0" "\0" - /* _mesa_function_pool[14137]: GetHistogramParameterfv (offset 362) */ + /* _mesa_function_pool[14144]: GetHistogramParameterfv (offset 362) */ "iip\0" "glGetHistogramParameterfv\0" "glGetHistogramParameterfvEXT\0" "\0" - /* _mesa_function_pool[14197]: Frustum (offset 289) */ + /* _mesa_function_pool[14204]: Frustum (offset 289) */ "dddddd\0" "glFrustum\0" "\0" - /* _mesa_function_pool[14215]: GetString (offset 275) */ + /* _mesa_function_pool[14222]: GetString (offset 275) */ "i\0" "glGetString\0" "\0" - /* _mesa_function_pool[14230]: ColorPointervINTEL (dynamic) */ + /* _mesa_function_pool[14237]: ColorPointervINTEL (dynamic) */ "iip\0" "glColorPointervINTEL\0" "\0" - /* _mesa_function_pool[14256]: TexEnvf (offset 184) */ + /* _mesa_function_pool[14263]: TexEnvf (offset 184) */ "iif\0" "glTexEnvf\0" "\0" - /* _mesa_function_pool[14271]: TexCoord3d (offset 110) */ + /* _mesa_function_pool[14278]: TexCoord3d (offset 110) */ "ddd\0" "glTexCoord3d\0" "\0" - /* _mesa_function_pool[14289]: AlphaFragmentOp1ATI (will be remapped) */ + /* _mesa_function_pool[14296]: AlphaFragmentOp1ATI (will be remapped) */ "iiiiii\0" "glAlphaFragmentOp1ATI\0" "\0" - /* _mesa_function_pool[14319]: TexCoord3f (offset 112) */ + /* _mesa_function_pool[14326]: TexCoord3f (offset 112) */ "fff\0" "glTexCoord3f\0" "\0" - /* _mesa_function_pool[14337]: MultiTexCoord3ivARB (offset 397) */ + /* _mesa_function_pool[14344]: MultiTexCoord3ivARB (offset 397) */ "ip\0" "glMultiTexCoord3iv\0" "glMultiTexCoord3ivARB\0" "\0" - /* _mesa_function_pool[14382]: MultiTexCoord2sARB (offset 390) */ + /* _mesa_function_pool[14389]: MultiTexCoord2sARB (offset 390) */ "iii\0" "glMultiTexCoord2s\0" "glMultiTexCoord2sARB\0" "\0" - /* _mesa_function_pool[14426]: VertexAttrib1dvARB (will be remapped) */ + /* _mesa_function_pool[14433]: VertexAttrib1dvARB (will be remapped) */ "ip\0" "glVertexAttrib1dv\0" "glVertexAttrib1dvARB\0" "\0" - /* _mesa_function_pool[14469]: DeleteTextures (offset 327) */ + /* _mesa_function_pool[14476]: DeleteTextures (offset 327) */ "ip\0" "glDeleteTextures\0" "glDeleteTexturesEXT\0" "\0" - /* _mesa_function_pool[14510]: TexCoordPointerEXT (will be remapped) */ + /* _mesa_function_pool[14517]: TexCoordPointerEXT (will be remapped) */ "iiiip\0" "glTexCoordPointerEXT\0" "\0" - /* _mesa_function_pool[14538]: TexSubImage4DSGIS (dynamic) */ + /* _mesa_function_pool[14545]: TexSubImage4DSGIS (dynamic) */ "iiiiiiiiiiiip\0" "glTexSubImage4DSGIS\0" "\0" - /* _mesa_function_pool[14573]: TexCoord3s (offset 116) */ + /* _mesa_function_pool[14580]: TexCoord3s (offset 116) */ "iii\0" "glTexCoord3s\0" "\0" - /* _mesa_function_pool[14591]: GetTexLevelParameteriv (offset 285) */ + /* _mesa_function_pool[14598]: GetTexLevelParameteriv (offset 285) */ "iiip\0" "glGetTexLevelParameteriv\0" "\0" - /* _mesa_function_pool[14622]: DrawArraysInstanced (will be remapped) */ + /* _mesa_function_pool[14629]: DrawArraysInstanced (will be remapped) */ "iiii\0" "glDrawArraysInstanced\0" "glDrawArraysInstancedARB\0" "glDrawArraysInstancedEXT\0" "\0" - /* _mesa_function_pool[14700]: CombinerStageParameterfvNV (dynamic) */ + /* _mesa_function_pool[14707]: CombinerStageParameterfvNV (dynamic) */ "iip\0" "glCombinerStageParameterfvNV\0" "\0" - /* _mesa_function_pool[14734]: StopInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[14741]: StopInstrumentsSGIX (dynamic) */ "i\0" "glStopInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[14759]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ + /* _mesa_function_pool[14766]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ "fffffffffffffff\0" "glTexCoord4fColor4fNormal3fVertex4fSUN\0" "\0" - /* _mesa_function_pool[14815]: ClearAccum (offset 204) */ + /* _mesa_function_pool[14822]: ClearAccum (offset 204) */ "ffff\0" "glClearAccum\0" "\0" - /* _mesa_function_pool[14834]: DeformSGIX (dynamic) */ + /* _mesa_function_pool[14841]: DeformSGIX (dynamic) */ "i\0" "glDeformSGIX\0" "\0" - /* _mesa_function_pool[14850]: GetVertexAttribfvARB (will be remapped) */ + /* _mesa_function_pool[14857]: GetVertexAttribfvARB (will be remapped) */ "iip\0" "glGetVertexAttribfv\0" "glGetVertexAttribfvARB\0" "\0" - /* _mesa_function_pool[14898]: SecondaryColor3ivEXT (will be remapped) */ + /* _mesa_function_pool[14905]: SecondaryColor3ivEXT (will be remapped) */ "p\0" "glSecondaryColor3iv\0" "glSecondaryColor3ivEXT\0" "\0" - /* _mesa_function_pool[14944]: TexCoord4iv (offset 123) */ + /* _mesa_function_pool[14951]: TexCoord4iv (offset 123) */ "p\0" "glTexCoord4iv\0" "\0" - /* _mesa_function_pool[14961]: UniformMatrix4x2fv (will be remapped) */ + /* _mesa_function_pool[14968]: UniformMatrix4x2fv (will be remapped) */ "iiip\0" "glUniformMatrix4x2fv\0" "\0" - /* _mesa_function_pool[14988]: GetDetailTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[14995]: GetDetailTexFuncSGIS (dynamic) */ "ip\0" "glGetDetailTexFuncSGIS\0" "\0" - /* _mesa_function_pool[15015]: GetCombinerStageParameterfvNV (dynamic) */ + /* _mesa_function_pool[15022]: GetCombinerStageParameterfvNV (dynamic) */ "iip\0" "glGetCombinerStageParameterfvNV\0" "\0" - /* _mesa_function_pool[15052]: PolygonOffset (offset 319) */ + /* _mesa_function_pool[15059]: PolygonOffset (offset 319) */ "ff\0" "glPolygonOffset\0" "\0" - /* _mesa_function_pool[15072]: BindVertexArray (will be remapped) */ + /* _mesa_function_pool[15079]: BindVertexArray (will be remapped) */ "i\0" "glBindVertexArray\0" "\0" - /* _mesa_function_pool[15093]: Color4ubVertex2fvSUN (dynamic) */ + /* _mesa_function_pool[15100]: Color4ubVertex2fvSUN (dynamic) */ "pp\0" "glColor4ubVertex2fvSUN\0" "\0" - /* _mesa_function_pool[15120]: Rectd (offset 86) */ + /* _mesa_function_pool[15127]: Rectd (offset 86) */ "dddd\0" "glRectd\0" "\0" - /* _mesa_function_pool[15134]: TexFilterFuncSGIS (dynamic) */ + /* _mesa_function_pool[15141]: TexFilterFuncSGIS (dynamic) */ "iiip\0" "glTexFilterFuncSGIS\0" "\0" - /* _mesa_function_pool[15160]: SampleMaskSGIS (will be remapped) */ + /* _mesa_function_pool[15167]: SampleMaskSGIS (will be remapped) */ "fi\0" "glSampleMaskSGIS\0" "glSampleMaskEXT\0" "\0" - /* _mesa_function_pool[15197]: GetAttribLocationARB (will be remapped) */ + /* _mesa_function_pool[15204]: GetAttribLocationARB (will be remapped) */ "ip\0" "glGetAttribLocation\0" "glGetAttribLocationARB\0" "\0" - /* _mesa_function_pool[15244]: RasterPos3i (offset 74) */ + /* _mesa_function_pool[15251]: RasterPos3i (offset 74) */ "iii\0" "glRasterPos3i\0" "\0" - /* _mesa_function_pool[15263]: VertexAttrib4ubvARB (will be remapped) */ + /* _mesa_function_pool[15270]: VertexAttrib4ubvARB (will be remapped) */ "ip\0" "glVertexAttrib4ubv\0" "glVertexAttrib4ubvARB\0" "\0" - /* _mesa_function_pool[15308]: DetailTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[15315]: DetailTexFuncSGIS (dynamic) */ "iip\0" "glDetailTexFuncSGIS\0" "\0" - /* _mesa_function_pool[15333]: Normal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[15340]: Normal3fVertex3fSUN (dynamic) */ "ffffff\0" "glNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[15363]: CopyTexImage2D (offset 324) */ + /* _mesa_function_pool[15370]: CopyTexImage2D (offset 324) */ "iiiiiiii\0" "glCopyTexImage2D\0" "glCopyTexImage2DEXT\0" "\0" - /* _mesa_function_pool[15410]: GetBufferPointervARB (will be remapped) */ + /* _mesa_function_pool[15417]: GetBufferPointervARB (will be remapped) */ "iip\0" "glGetBufferPointerv\0" "glGetBufferPointervARB\0" "\0" - /* _mesa_function_pool[15458]: ProgramEnvParameter4fARB (will be remapped) */ + /* _mesa_function_pool[15465]: ProgramEnvParameter4fARB (will be remapped) */ "iiffff\0" "glProgramEnvParameter4fARB\0" "glProgramParameter4fNV\0" "\0" - /* _mesa_function_pool[15516]: Uniform3ivARB (will be remapped) */ + /* _mesa_function_pool[15523]: Uniform3ivARB (will be remapped) */ "iip\0" "glUniform3iv\0" "glUniform3ivARB\0" "\0" - /* _mesa_function_pool[15550]: Lightfv (offset 160) */ + /* _mesa_function_pool[15557]: Lightfv (offset 160) */ "iip\0" "glLightfv\0" "\0" - /* _mesa_function_pool[15565]: ClearDepth (offset 208) */ + /* _mesa_function_pool[15572]: ClearDepth (offset 208) */ "d\0" "glClearDepth\0" "\0" - /* _mesa_function_pool[15581]: GetFenceivNV (will be remapped) */ + /* _mesa_function_pool[15588]: GetFenceivNV (will be remapped) */ "iip\0" "glGetFenceivNV\0" "\0" - /* _mesa_function_pool[15601]: WindowPos4dvMESA (will be remapped) */ + /* _mesa_function_pool[15608]: WindowPos4dvMESA (will be remapped) */ "p\0" "glWindowPos4dvMESA\0" "\0" - /* _mesa_function_pool[15623]: ColorSubTable (offset 346) */ + /* _mesa_function_pool[15630]: ColorSubTable (offset 346) */ "iiiiip\0" "glColorSubTable\0" "glColorSubTableEXT\0" "\0" - /* _mesa_function_pool[15666]: Color4fv (offset 30) */ + /* _mesa_function_pool[15673]: Color4fv (offset 30) */ "p\0" "glColor4fv\0" "\0" - /* _mesa_function_pool[15680]: MultiTexCoord4ivARB (offset 405) */ + /* _mesa_function_pool[15687]: MultiTexCoord4ivARB (offset 405) */ "ip\0" "glMultiTexCoord4iv\0" "glMultiTexCoord4ivARB\0" "\0" - /* _mesa_function_pool[15725]: DrawElementsInstanced (will be remapped) */ + /* _mesa_function_pool[15732]: DrawElementsInstanced (will be remapped) */ "iiipi\0" "glDrawElementsInstanced\0" "glDrawElementsInstancedARB\0" "glDrawElementsInstancedEXT\0" "\0" - /* _mesa_function_pool[15810]: ColorPointer (offset 308) */ + /* _mesa_function_pool[15817]: ColorPointer (offset 308) */ "iiip\0" "glColorPointer\0" "\0" - /* _mesa_function_pool[15831]: Rects (offset 92) */ + /* _mesa_function_pool[15838]: Rects (offset 92) */ "iiii\0" "glRects\0" "\0" - /* _mesa_function_pool[15845]: GetMapAttribParameterfvNV (dynamic) */ + /* _mesa_function_pool[15852]: GetMapAttribParameterfvNV (dynamic) */ "iiip\0" "glGetMapAttribParameterfvNV\0" "\0" - /* _mesa_function_pool[15879]: Lightiv (offset 162) */ + /* _mesa_function_pool[15886]: Lightiv (offset 162) */ "iip\0" "glLightiv\0" "\0" - /* _mesa_function_pool[15894]: VertexAttrib4sARB (will be remapped) */ + /* _mesa_function_pool[15901]: VertexAttrib4sARB (will be remapped) */ "iiiii\0" "glVertexAttrib4s\0" "glVertexAttrib4sARB\0" "\0" - /* _mesa_function_pool[15938]: GetQueryObjectuivARB (will be remapped) */ + /* _mesa_function_pool[15945]: GetQueryObjectuivARB (will be remapped) */ "iip\0" "glGetQueryObjectuiv\0" "glGetQueryObjectuivARB\0" "\0" - /* _mesa_function_pool[15986]: GetTexParameteriv (offset 283) */ + /* _mesa_function_pool[15993]: GetTexParameteriv (offset 283) */ "iip\0" "glGetTexParameteriv\0" "\0" - /* _mesa_function_pool[16011]: MapParameterivNV (dynamic) */ + /* _mesa_function_pool[16018]: MapParameterivNV (dynamic) */ "iip\0" "glMapParameterivNV\0" "\0" - /* _mesa_function_pool[16035]: GenRenderbuffersEXT (will be remapped) */ + /* _mesa_function_pool[16042]: GenRenderbuffersEXT (will be remapped) */ "ip\0" "glGenRenderbuffers\0" "glGenRenderbuffersEXT\0" "\0" - /* _mesa_function_pool[16080]: VertexAttrib2dvARB (will be remapped) */ + /* _mesa_function_pool[16087]: VertexAttrib2dvARB (will be remapped) */ "ip\0" "glVertexAttrib2dv\0" "glVertexAttrib2dvARB\0" "\0" - /* _mesa_function_pool[16123]: EdgeFlagPointerEXT (will be remapped) */ + /* _mesa_function_pool[16130]: EdgeFlagPointerEXT (will be remapped) */ "iip\0" "glEdgeFlagPointerEXT\0" "\0" - /* _mesa_function_pool[16149]: VertexAttribs2svNV (will be remapped) */ + /* _mesa_function_pool[16156]: VertexAttribs2svNV (will be remapped) */ "iip\0" "glVertexAttribs2svNV\0" "\0" - /* _mesa_function_pool[16175]: WeightbvARB (dynamic) */ + /* _mesa_function_pool[16182]: WeightbvARB (dynamic) */ "ip\0" "glWeightbvARB\0" "\0" - /* _mesa_function_pool[16193]: VertexAttrib2fvARB (will be remapped) */ + /* _mesa_function_pool[16200]: VertexAttrib2fvARB (will be remapped) */ "ip\0" "glVertexAttrib2fv\0" "glVertexAttrib2fvARB\0" "\0" - /* _mesa_function_pool[16236]: GetBufferParameterivARB (will be remapped) */ + /* _mesa_function_pool[16243]: GetBufferParameterivARB (will be remapped) */ "iip\0" "glGetBufferParameteriv\0" "glGetBufferParameterivARB\0" "\0" - /* _mesa_function_pool[16290]: Rectdv (offset 87) */ + /* _mesa_function_pool[16297]: Rectdv (offset 87) */ "pp\0" "glRectdv\0" "\0" - /* _mesa_function_pool[16303]: ListParameteriSGIX (dynamic) */ + /* _mesa_function_pool[16310]: ListParameteriSGIX (dynamic) */ "iii\0" "glListParameteriSGIX\0" "\0" - /* _mesa_function_pool[16329]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[16336]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ "iffffffffff\0" "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[16388]: InstrumentsBufferSGIX (dynamic) */ + /* _mesa_function_pool[16395]: InstrumentsBufferSGIX (dynamic) */ "ip\0" "glInstrumentsBufferSGIX\0" "\0" - /* _mesa_function_pool[16416]: VertexAttrib4NivARB (will be remapped) */ + /* _mesa_function_pool[16423]: VertexAttrib4NivARB (will be remapped) */ "ip\0" "glVertexAttrib4Niv\0" "glVertexAttrib4NivARB\0" "\0" - /* _mesa_function_pool[16461]: GetAttachedShaders (will be remapped) */ + /* _mesa_function_pool[16468]: GetAttachedShaders (will be remapped) */ "iipp\0" "glGetAttachedShaders\0" "\0" - /* _mesa_function_pool[16488]: GenVertexArraysAPPLE (will be remapped) */ + /* _mesa_function_pool[16495]: GenVertexArraysAPPLE (will be remapped) */ "ip\0" "glGenVertexArraysAPPLE\0" "\0" - /* _mesa_function_pool[16515]: Materialiv (offset 172) */ + /* _mesa_function_pool[16522]: Materialiv (offset 172) */ "iip\0" "glMaterialiv\0" "\0" - /* _mesa_function_pool[16533]: PushClientAttrib (offset 335) */ + /* _mesa_function_pool[16540]: PushClientAttrib (offset 335) */ "i\0" "glPushClientAttrib\0" "\0" - /* _mesa_function_pool[16555]: ProgramEnvParameters4fvEXT (will be remapped) */ + /* _mesa_function_pool[16562]: ProgramEnvParameters4fvEXT (will be remapped) */ "iiip\0" "glProgramEnvParameters4fvEXT\0" "\0" - /* _mesa_function_pool[16590]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[16597]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[16636]: WindowPos2iMESA (will be remapped) */ + /* _mesa_function_pool[16643]: WindowPos2iMESA (will be remapped) */ "ii\0" "glWindowPos2i\0" "glWindowPos2iARB\0" "glWindowPos2iMESA\0" "\0" - /* _mesa_function_pool[16689]: SecondaryColor3fvEXT (will be remapped) */ + /* _mesa_function_pool[16696]: SecondaryColor3fvEXT (will be remapped) */ "p\0" "glSecondaryColor3fv\0" "glSecondaryColor3fvEXT\0" "\0" - /* _mesa_function_pool[16735]: PolygonMode (offset 174) */ + /* _mesa_function_pool[16742]: PolygonMode (offset 174) */ "ii\0" "glPolygonMode\0" "\0" - /* _mesa_function_pool[16753]: CompressedTexSubImage1DARB (will be remapped) */ + /* _mesa_function_pool[16760]: CompressedTexSubImage1DARB (will be remapped) */ "iiiiiip\0" "glCompressedTexSubImage1D\0" "glCompressedTexSubImage1DARB\0" "\0" - /* _mesa_function_pool[16817]: GetVertexAttribivNV (will be remapped) */ + /* _mesa_function_pool[16824]: GetVertexAttribivNV (will be remapped) */ "iip\0" "glGetVertexAttribivNV\0" "\0" - /* _mesa_function_pool[16844]: GetProgramStringARB (will be remapped) */ + /* _mesa_function_pool[16851]: GetProgramStringARB (will be remapped) */ "iip\0" "glGetProgramStringARB\0" "\0" - /* _mesa_function_pool[16871]: TexBumpParameterfvATI (will be remapped) */ + /* _mesa_function_pool[16878]: TexBumpParameterfvATI (will be remapped) */ "ip\0" "glTexBumpParameterfvATI\0" "\0" - /* _mesa_function_pool[16899]: CompileShaderARB (will be remapped) */ + /* _mesa_function_pool[16906]: CompileShaderARB (will be remapped) */ "i\0" "glCompileShader\0" "glCompileShaderARB\0" "\0" - /* _mesa_function_pool[16937]: DeleteShader (will be remapped) */ + /* _mesa_function_pool[16944]: DeleteShader (will be remapped) */ "i\0" "glDeleteShader\0" "\0" - /* _mesa_function_pool[16955]: DisableClientState (offset 309) */ + /* _mesa_function_pool[16962]: DisableClientState (offset 309) */ "i\0" "glDisableClientState\0" "\0" - /* _mesa_function_pool[16979]: TexGeni (offset 192) */ + /* _mesa_function_pool[16986]: TexGeni (offset 192) */ "iii\0" "glTexGeni\0" "\0" - /* _mesa_function_pool[16994]: TexGenf (offset 190) */ + /* _mesa_function_pool[17001]: TexGenf (offset 190) */ "iif\0" "glTexGenf\0" "\0" - /* _mesa_function_pool[17009]: Uniform3fARB (will be remapped) */ + /* _mesa_function_pool[17016]: Uniform3fARB (will be remapped) */ "ifff\0" "glUniform3f\0" "glUniform3fARB\0" "\0" - /* _mesa_function_pool[17042]: TexGend (offset 188) */ + /* _mesa_function_pool[17049]: TexGend (offset 188) */ "iid\0" "glTexGend\0" "\0" - /* _mesa_function_pool[17057]: ListParameterfvSGIX (dynamic) */ + /* _mesa_function_pool[17064]: ListParameterfvSGIX (dynamic) */ "iip\0" "glListParameterfvSGIX\0" "\0" - /* _mesa_function_pool[17084]: GetPolygonStipple (offset 274) */ + /* _mesa_function_pool[17091]: GetPolygonStipple (offset 274) */ "p\0" "glGetPolygonStipple\0" "\0" - /* _mesa_function_pool[17107]: Tangent3dvEXT (dynamic) */ + /* _mesa_function_pool[17114]: Tangent3dvEXT (dynamic) */ "p\0" "glTangent3dvEXT\0" "\0" - /* _mesa_function_pool[17126]: BindBufferOffsetEXT (will be remapped) */ + /* _mesa_function_pool[17133]: BindBufferOffsetEXT (will be remapped) */ "iiii\0" "glBindBufferOffsetEXT\0" "\0" - /* _mesa_function_pool[17154]: WindowPos3sMESA (will be remapped) */ + /* _mesa_function_pool[17161]: WindowPos3sMESA (will be remapped) */ "iii\0" "glWindowPos3s\0" "glWindowPos3sARB\0" "glWindowPos3sMESA\0" "\0" - /* _mesa_function_pool[17208]: VertexAttrib2svNV (will be remapped) */ + /* _mesa_function_pool[17215]: VertexAttrib2svNV (will be remapped) */ "ip\0" "glVertexAttrib2svNV\0" "\0" - /* _mesa_function_pool[17232]: DisableIndexedEXT (will be remapped) */ + /* _mesa_function_pool[17239]: DisableIndexedEXT (will be remapped) */ "ii\0" "glDisableIndexedEXT\0" "\0" - /* _mesa_function_pool[17256]: BindBufferBaseEXT (will be remapped) */ + /* _mesa_function_pool[17263]: BindBufferBaseEXT (will be remapped) */ "iii\0" "glBindBufferBaseEXT\0" "glBindBufferBase\0" "\0" - /* _mesa_function_pool[17298]: TexCoord2fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[17305]: TexCoord2fVertex3fvSUN (dynamic) */ "pp\0" "glTexCoord2fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[17327]: WindowPos4sMESA (will be remapped) */ + /* _mesa_function_pool[17334]: WindowPos4sMESA (will be remapped) */ "iiii\0" "glWindowPos4sMESA\0" "\0" - /* _mesa_function_pool[17351]: VertexAttrib4NuivARB (will be remapped) */ + /* _mesa_function_pool[17358]: VertexAttrib4NuivARB (will be remapped) */ "ip\0" "glVertexAttrib4Nuiv\0" "glVertexAttrib4NuivARB\0" "\0" - /* _mesa_function_pool[17398]: ClientActiveTextureARB (offset 375) */ + /* _mesa_function_pool[17405]: ClientActiveTextureARB (offset 375) */ "i\0" "glClientActiveTexture\0" "glClientActiveTextureARB\0" "\0" - /* _mesa_function_pool[17448]: PixelTexGenSGIX (will be remapped) */ + /* _mesa_function_pool[17455]: PixelTexGenSGIX (will be remapped) */ "i\0" "glPixelTexGenSGIX\0" "\0" - /* _mesa_function_pool[17469]: ReplacementCodeusvSUN (dynamic) */ + /* _mesa_function_pool[17476]: ReplacementCodeusvSUN (dynamic) */ "p\0" "glReplacementCodeusvSUN\0" "\0" - /* _mesa_function_pool[17496]: Uniform4fARB (will be remapped) */ + /* _mesa_function_pool[17503]: Uniform4fARB (will be remapped) */ "iffff\0" "glUniform4f\0" "glUniform4fARB\0" "\0" - /* _mesa_function_pool[17530]: Color4sv (offset 34) */ + /* _mesa_function_pool[17537]: Color4sv (offset 34) */ "p\0" "glColor4sv\0" "\0" - /* _mesa_function_pool[17544]: FlushMappedBufferRange (will be remapped) */ + /* _mesa_function_pool[17551]: FlushMappedBufferRange (will be remapped) */ "iii\0" "glFlushMappedBufferRange\0" "\0" - /* _mesa_function_pool[17574]: IsProgramNV (will be remapped) */ + /* _mesa_function_pool[17581]: IsProgramNV (will be remapped) */ "i\0" "glIsProgramARB\0" "glIsProgramNV\0" "\0" - /* _mesa_function_pool[17606]: FlushMappedBufferRangeAPPLE (will be remapped) */ + /* _mesa_function_pool[17613]: FlushMappedBufferRangeAPPLE (will be remapped) */ "iii\0" "glFlushMappedBufferRangeAPPLE\0" "\0" - /* _mesa_function_pool[17641]: PixelZoom (offset 246) */ + /* _mesa_function_pool[17648]: PixelZoom (offset 246) */ "ff\0" "glPixelZoom\0" "\0" - /* _mesa_function_pool[17657]: ReplacementCodePointerSUN (dynamic) */ + /* _mesa_function_pool[17664]: ReplacementCodePointerSUN (dynamic) */ "iip\0" "glReplacementCodePointerSUN\0" "\0" - /* _mesa_function_pool[17690]: ProgramEnvParameter4dARB (will be remapped) */ + /* _mesa_function_pool[17697]: ProgramEnvParameter4dARB (will be remapped) */ "iidddd\0" "glProgramEnvParameter4dARB\0" "glProgramParameter4dNV\0" "\0" - /* _mesa_function_pool[17748]: ColorTableParameterfv (offset 340) */ + /* _mesa_function_pool[17755]: ColorTableParameterfv (offset 340) */ "iip\0" "glColorTableParameterfv\0" "glColorTableParameterfvSGI\0" "\0" - /* _mesa_function_pool[17804]: FragmentLightModelfSGIX (dynamic) */ + /* _mesa_function_pool[17811]: FragmentLightModelfSGIX (dynamic) */ "if\0" "glFragmentLightModelfSGIX\0" "\0" - /* _mesa_function_pool[17834]: Binormal3bvEXT (dynamic) */ + /* _mesa_function_pool[17841]: Binormal3bvEXT (dynamic) */ "p\0" "glBinormal3bvEXT\0" "\0" - /* _mesa_function_pool[17854]: PixelMapuiv (offset 252) */ + /* _mesa_function_pool[17861]: PixelMapuiv (offset 252) */ "iip\0" "glPixelMapuiv\0" "\0" - /* _mesa_function_pool[17873]: Color3dv (offset 12) */ + /* _mesa_function_pool[17880]: Color3dv (offset 12) */ "p\0" "glColor3dv\0" "\0" - /* _mesa_function_pool[17887]: IsTexture (offset 330) */ + /* _mesa_function_pool[17894]: IsTexture (offset 330) */ "i\0" "glIsTexture\0" "glIsTextureEXT\0" "\0" - /* _mesa_function_pool[17917]: VertexWeightfvEXT (dynamic) */ + /* _mesa_function_pool[17924]: VertexWeightfvEXT (dynamic) */ "p\0" "glVertexWeightfvEXT\0" "\0" - /* _mesa_function_pool[17940]: VertexAttrib1dARB (will be remapped) */ + /* _mesa_function_pool[17947]: VertexAttrib1dARB (will be remapped) */ "id\0" "glVertexAttrib1d\0" "glVertexAttrib1dARB\0" "\0" - /* _mesa_function_pool[17981]: ImageTransformParameterivHP (dynamic) */ + /* _mesa_function_pool[17988]: ImageTransformParameterivHP (dynamic) */ "iip\0" "glImageTransformParameterivHP\0" "\0" - /* _mesa_function_pool[18016]: TexCoord4i (offset 122) */ + /* _mesa_function_pool[18023]: TexCoord4i (offset 122) */ "iiii\0" "glTexCoord4i\0" "\0" - /* _mesa_function_pool[18035]: DeleteQueriesARB (will be remapped) */ + /* _mesa_function_pool[18042]: DeleteQueriesARB (will be remapped) */ "ip\0" "glDeleteQueries\0" "glDeleteQueriesARB\0" "\0" - /* _mesa_function_pool[18074]: Color4ubVertex2fSUN (dynamic) */ + /* _mesa_function_pool[18081]: Color4ubVertex2fSUN (dynamic) */ "iiiiff\0" "glColor4ubVertex2fSUN\0" "\0" - /* _mesa_function_pool[18104]: FragmentColorMaterialSGIX (dynamic) */ + /* _mesa_function_pool[18111]: FragmentColorMaterialSGIX (dynamic) */ "ii\0" "glFragmentColorMaterialSGIX\0" "\0" - /* _mesa_function_pool[18136]: CurrentPaletteMatrixARB (dynamic) */ + /* _mesa_function_pool[18143]: CurrentPaletteMatrixARB (dynamic) */ "i\0" "glCurrentPaletteMatrixARB\0" "\0" - /* _mesa_function_pool[18165]: GetMapdv (offset 266) */ + /* _mesa_function_pool[18172]: GetMapdv (offset 266) */ "iip\0" "glGetMapdv\0" "\0" - /* _mesa_function_pool[18181]: ObjectPurgeableAPPLE (will be remapped) */ + /* _mesa_function_pool[18188]: ObjectPurgeableAPPLE (will be remapped) */ "iii\0" "glObjectPurgeableAPPLE\0" "\0" - /* _mesa_function_pool[18209]: SamplePatternSGIS (will be remapped) */ + /* _mesa_function_pool[18216]: SamplePatternSGIS (will be remapped) */ "i\0" "glSamplePatternSGIS\0" "glSamplePatternEXT\0" "\0" - /* _mesa_function_pool[18251]: PixelStoref (offset 249) */ + /* _mesa_function_pool[18258]: PixelStoref (offset 249) */ "if\0" "glPixelStoref\0" "\0" - /* _mesa_function_pool[18269]: IsQueryARB (will be remapped) */ + /* _mesa_function_pool[18276]: IsQueryARB (will be remapped) */ "i\0" "glIsQuery\0" "glIsQueryARB\0" "\0" - /* _mesa_function_pool[18295]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[18302]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ "iiiiifff\0" "glReplacementCodeuiColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[18344]: PixelStorei (offset 250) */ + /* _mesa_function_pool[18351]: PixelStorei (offset 250) */ "ii\0" "glPixelStorei\0" "\0" - /* _mesa_function_pool[18362]: VertexAttrib4usvARB (will be remapped) */ + /* _mesa_function_pool[18369]: VertexAttrib4usvARB (will be remapped) */ "ip\0" "glVertexAttrib4usv\0" "glVertexAttrib4usvARB\0" "\0" - /* _mesa_function_pool[18407]: LinkProgramARB (will be remapped) */ + /* _mesa_function_pool[18414]: LinkProgramARB (will be remapped) */ "i\0" "glLinkProgram\0" "glLinkProgramARB\0" "\0" - /* _mesa_function_pool[18441]: VertexAttrib2fNV (will be remapped) */ + /* _mesa_function_pool[18448]: VertexAttrib2fNV (will be remapped) */ "iff\0" "glVertexAttrib2fNV\0" "\0" - /* _mesa_function_pool[18465]: ShaderSourceARB (will be remapped) */ + /* _mesa_function_pool[18472]: ShaderSourceARB (will be remapped) */ "iipp\0" "glShaderSource\0" "glShaderSourceARB\0" "\0" - /* _mesa_function_pool[18504]: FragmentMaterialiSGIX (dynamic) */ + /* _mesa_function_pool[18511]: FragmentMaterialiSGIX (dynamic) */ "iii\0" "glFragmentMaterialiSGIX\0" "\0" - /* _mesa_function_pool[18533]: EvalCoord2dv (offset 233) */ + /* _mesa_function_pool[18540]: EvalCoord2dv (offset 233) */ "p\0" "glEvalCoord2dv\0" "\0" - /* _mesa_function_pool[18551]: VertexAttrib3svARB (will be remapped) */ + /* _mesa_function_pool[18558]: VertexAttrib3svARB (will be remapped) */ "ip\0" "glVertexAttrib3sv\0" "glVertexAttrib3svARB\0" "\0" - /* _mesa_function_pool[18594]: ColorMaterial (offset 151) */ + /* _mesa_function_pool[18601]: ColorMaterial (offset 151) */ "ii\0" "glColorMaterial\0" "\0" - /* _mesa_function_pool[18614]: CompressedTexSubImage3DARB (will be remapped) */ + /* _mesa_function_pool[18621]: CompressedTexSubImage3DARB (will be remapped) */ "iiiiiiiiiip\0" "glCompressedTexSubImage3D\0" "glCompressedTexSubImage3DARB\0" "\0" - /* _mesa_function_pool[18682]: WindowPos2ivMESA (will be remapped) */ + /* _mesa_function_pool[18689]: WindowPos2ivMESA (will be remapped) */ "p\0" "glWindowPos2iv\0" "glWindowPos2ivARB\0" "glWindowPos2ivMESA\0" "\0" - /* _mesa_function_pool[18737]: IsFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[18744]: IsFramebufferEXT (will be remapped) */ "i\0" "glIsFramebuffer\0" "glIsFramebufferEXT\0" "\0" - /* _mesa_function_pool[18775]: Uniform4ivARB (will be remapped) */ + /* _mesa_function_pool[18782]: Uniform4ivARB (will be remapped) */ "iip\0" "glUniform4iv\0" "glUniform4ivARB\0" "\0" - /* _mesa_function_pool[18809]: GetVertexAttribdvARB (will be remapped) */ + /* _mesa_function_pool[18816]: GetVertexAttribdvARB (will be remapped) */ "iip\0" "glGetVertexAttribdv\0" "glGetVertexAttribdvARB\0" "\0" - /* _mesa_function_pool[18857]: TexBumpParameterivATI (will be remapped) */ + /* _mesa_function_pool[18864]: TexBumpParameterivATI (will be remapped) */ "ip\0" "glTexBumpParameterivATI\0" "\0" - /* _mesa_function_pool[18885]: GetSeparableFilter (offset 359) */ + /* _mesa_function_pool[18892]: GetSeparableFilter (offset 359) */ "iiippp\0" "glGetSeparableFilter\0" "glGetSeparableFilterEXT\0" "\0" - /* _mesa_function_pool[18938]: Binormal3dEXT (dynamic) */ + /* _mesa_function_pool[18945]: Binormal3dEXT (dynamic) */ "ddd\0" "glBinormal3dEXT\0" "\0" - /* _mesa_function_pool[18959]: SpriteParameteriSGIX (dynamic) */ + /* _mesa_function_pool[18966]: SpriteParameteriSGIX (dynamic) */ "ii\0" "glSpriteParameteriSGIX\0" "\0" - /* _mesa_function_pool[18986]: RequestResidentProgramsNV (will be remapped) */ + /* _mesa_function_pool[18993]: RequestResidentProgramsNV (will be remapped) */ "ip\0" "glRequestResidentProgramsNV\0" "\0" - /* _mesa_function_pool[19018]: TagSampleBufferSGIX (dynamic) */ + /* _mesa_function_pool[19025]: TagSampleBufferSGIX (dynamic) */ "\0" "glTagSampleBufferSGIX\0" "\0" - /* _mesa_function_pool[19042]: TransformFeedbackVaryingsEXT (will be remapped) */ + /* _mesa_function_pool[19049]: TransformFeedbackVaryingsEXT (will be remapped) */ "iipi\0" "glTransformFeedbackVaryingsEXT\0" "glTransformFeedbackVaryings\0" "\0" - /* _mesa_function_pool[19107]: FeedbackBuffer (offset 194) */ + /* _mesa_function_pool[19114]: FeedbackBuffer (offset 194) */ "iip\0" "glFeedbackBuffer\0" "\0" - /* _mesa_function_pool[19129]: RasterPos2iv (offset 67) */ + /* _mesa_function_pool[19136]: RasterPos2iv (offset 67) */ "p\0" "glRasterPos2iv\0" "\0" - /* _mesa_function_pool[19147]: TexImage1D (offset 182) */ + /* _mesa_function_pool[19154]: TexImage1D (offset 182) */ "iiiiiiip\0" "glTexImage1D\0" "\0" - /* _mesa_function_pool[19170]: ListParameterivSGIX (dynamic) */ + /* _mesa_function_pool[19177]: ListParameterivSGIX (dynamic) */ "iip\0" "glListParameterivSGIX\0" "\0" - /* _mesa_function_pool[19197]: MultiDrawElementsEXT (will be remapped) */ + /* _mesa_function_pool[19204]: MultiDrawElementsEXT (will be remapped) */ "ipipi\0" "glMultiDrawElements\0" "glMultiDrawElementsEXT\0" "\0" - /* _mesa_function_pool[19247]: Color3s (offset 17) */ + /* _mesa_function_pool[19254]: Color3s (offset 17) */ "iii\0" "glColor3s\0" "\0" - /* _mesa_function_pool[19262]: Uniform1ivARB (will be remapped) */ + /* _mesa_function_pool[19269]: Uniform1ivARB (will be remapped) */ "iip\0" "glUniform1iv\0" "glUniform1ivARB\0" "\0" - /* _mesa_function_pool[19296]: WindowPos2sMESA (will be remapped) */ + /* _mesa_function_pool[19303]: WindowPos2sMESA (will be remapped) */ "ii\0" "glWindowPos2s\0" "glWindowPos2sARB\0" "glWindowPos2sMESA\0" "\0" - /* _mesa_function_pool[19349]: WeightusvARB (dynamic) */ + /* _mesa_function_pool[19356]: WeightusvARB (dynamic) */ "ip\0" "glWeightusvARB\0" "\0" - /* _mesa_function_pool[19368]: TexCoordPointer (offset 320) */ + /* _mesa_function_pool[19375]: TexCoordPointer (offset 320) */ "iiip\0" "glTexCoordPointer\0" "\0" - /* _mesa_function_pool[19392]: FogCoordPointerEXT (will be remapped) */ + /* _mesa_function_pool[19399]: FogCoordPointerEXT (will be remapped) */ "iip\0" "glFogCoordPointer\0" "glFogCoordPointerEXT\0" "\0" - /* _mesa_function_pool[19436]: IndexMaterialEXT (dynamic) */ + /* _mesa_function_pool[19443]: IndexMaterialEXT (dynamic) */ "ii\0" "glIndexMaterialEXT\0" "\0" - /* _mesa_function_pool[19459]: Color3i (offset 15) */ + /* _mesa_function_pool[19466]: Color3i (offset 15) */ "iii\0" "glColor3i\0" "\0" - /* _mesa_function_pool[19474]: FrontFace (offset 157) */ + /* _mesa_function_pool[19481]: FrontFace (offset 157) */ "i\0" "glFrontFace\0" "\0" - /* _mesa_function_pool[19489]: EvalCoord2d (offset 232) */ + /* _mesa_function_pool[19496]: EvalCoord2d (offset 232) */ "dd\0" "glEvalCoord2d\0" "\0" - /* _mesa_function_pool[19507]: SecondaryColor3ubvEXT (will be remapped) */ + /* _mesa_function_pool[19514]: SecondaryColor3ubvEXT (will be remapped) */ "p\0" "glSecondaryColor3ubv\0" "glSecondaryColor3ubvEXT\0" "\0" - /* _mesa_function_pool[19555]: EvalCoord2f (offset 234) */ + /* _mesa_function_pool[19562]: EvalCoord2f (offset 234) */ "ff\0" "glEvalCoord2f\0" "\0" - /* _mesa_function_pool[19573]: VertexAttrib4dvARB (will be remapped) */ + /* _mesa_function_pool[19580]: VertexAttrib4dvARB (will be remapped) */ "ip\0" "glVertexAttrib4dv\0" "glVertexAttrib4dvARB\0" "\0" - /* _mesa_function_pool[19616]: BindAttribLocationARB (will be remapped) */ + /* _mesa_function_pool[19623]: BindAttribLocationARB (will be remapped) */ "iip\0" "glBindAttribLocation\0" "glBindAttribLocationARB\0" "\0" - /* _mesa_function_pool[19666]: Color3b (offset 9) */ + /* _mesa_function_pool[19673]: Color3b (offset 9) */ "iii\0" "glColor3b\0" "\0" - /* _mesa_function_pool[19681]: MultiTexCoord2dARB (offset 384) */ + /* _mesa_function_pool[19688]: MultiTexCoord2dARB (offset 384) */ "idd\0" "glMultiTexCoord2d\0" "glMultiTexCoord2dARB\0" "\0" - /* _mesa_function_pool[19725]: ExecuteProgramNV (will be remapped) */ + /* _mesa_function_pool[19732]: ExecuteProgramNV (will be remapped) */ "iip\0" "glExecuteProgramNV\0" "\0" - /* _mesa_function_pool[19749]: Color3f (offset 13) */ + /* _mesa_function_pool[19756]: Color3f (offset 13) */ "fff\0" "glColor3f\0" "\0" - /* _mesa_function_pool[19764]: LightEnviSGIX (dynamic) */ + /* _mesa_function_pool[19771]: LightEnviSGIX (dynamic) */ "ii\0" "glLightEnviSGIX\0" "\0" - /* _mesa_function_pool[19784]: Color3d (offset 11) */ + /* _mesa_function_pool[19791]: Color3d (offset 11) */ "ddd\0" "glColor3d\0" "\0" - /* _mesa_function_pool[19799]: Normal3dv (offset 55) */ + /* _mesa_function_pool[19806]: Normal3dv (offset 55) */ "p\0" "glNormal3dv\0" "\0" - /* _mesa_function_pool[19814]: Lightf (offset 159) */ + /* _mesa_function_pool[19821]: Lightf (offset 159) */ "iif\0" "glLightf\0" "\0" - /* _mesa_function_pool[19828]: ReplacementCodeuiSUN (dynamic) */ + /* _mesa_function_pool[19835]: ReplacementCodeuiSUN (dynamic) */ "i\0" "glReplacementCodeuiSUN\0" "\0" - /* _mesa_function_pool[19854]: MatrixMode (offset 293) */ + /* _mesa_function_pool[19861]: MatrixMode (offset 293) */ "i\0" "glMatrixMode\0" "\0" - /* _mesa_function_pool[19870]: GetPixelMapusv (offset 273) */ + /* _mesa_function_pool[19877]: GetPixelMapusv (offset 273) */ "ip\0" "glGetPixelMapusv\0" "\0" - /* _mesa_function_pool[19891]: Lighti (offset 161) */ + /* _mesa_function_pool[19898]: Lighti (offset 161) */ "iii\0" "glLighti\0" "\0" - /* _mesa_function_pool[19905]: VertexAttribPointerNV (will be remapped) */ + /* _mesa_function_pool[19912]: VertexAttribPointerNV (will be remapped) */ "iiiip\0" "glVertexAttribPointerNV\0" "\0" - /* _mesa_function_pool[19936]: ProgramLocalParameters4fvEXT (will be remapped) */ + /* _mesa_function_pool[19943]: ProgramLocalParameters4fvEXT (will be remapped) */ "iiip\0" "glProgramLocalParameters4fvEXT\0" "\0" - /* _mesa_function_pool[19973]: GetBooleanIndexedvEXT (will be remapped) */ + /* _mesa_function_pool[19980]: GetBooleanIndexedvEXT (will be remapped) */ "iip\0" "glGetBooleanIndexedvEXT\0" "\0" - /* _mesa_function_pool[20002]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ + /* _mesa_function_pool[20009]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ "iiip\0" "glGetFramebufferAttachmentParameteriv\0" "glGetFramebufferAttachmentParameterivEXT\0" "\0" - /* _mesa_function_pool[20087]: PixelTransformParameterfEXT (dynamic) */ + /* _mesa_function_pool[20094]: PixelTransformParameterfEXT (dynamic) */ "iif\0" "glPixelTransformParameterfEXT\0" "\0" - /* _mesa_function_pool[20122]: MultiTexCoord4dvARB (offset 401) */ + /* _mesa_function_pool[20129]: MultiTexCoord4dvARB (offset 401) */ "ip\0" "glMultiTexCoord4dv\0" "glMultiTexCoord4dvARB\0" "\0" - /* _mesa_function_pool[20167]: PixelTransformParameteriEXT (dynamic) */ + /* _mesa_function_pool[20174]: PixelTransformParameteriEXT (dynamic) */ "iii\0" "glPixelTransformParameteriEXT\0" "\0" - /* _mesa_function_pool[20202]: GetDoublev (offset 260) */ + /* _mesa_function_pool[20209]: GetDoublev (offset 260) */ "ip\0" "glGetDoublev\0" "\0" - /* _mesa_function_pool[20219]: MultMatrixd (offset 295) */ + /* _mesa_function_pool[20226]: MultMatrixd (offset 295) */ "p\0" "glMultMatrixd\0" "\0" - /* _mesa_function_pool[20236]: MultMatrixf (offset 294) */ + /* _mesa_function_pool[20243]: MultMatrixf (offset 294) */ "p\0" "glMultMatrixf\0" "\0" - /* _mesa_function_pool[20253]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[20260]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ "ffiiiifff\0" "glTexCoord2fColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[20296]: Uniform1iARB (will be remapped) */ + /* _mesa_function_pool[20303]: Uniform1iARB (will be remapped) */ "ii\0" "glUniform1i\0" "glUniform1iARB\0" "\0" - /* _mesa_function_pool[20327]: VertexAttribPointerARB (will be remapped) */ + /* _mesa_function_pool[20334]: VertexAttribPointerARB (will be remapped) */ "iiiiip\0" "glVertexAttribPointer\0" "glVertexAttribPointerARB\0" "\0" - /* _mesa_function_pool[20382]: VertexAttrib3sNV (will be remapped) */ + /* _mesa_function_pool[20389]: VertexAttrib3sNV (will be remapped) */ "iiii\0" "glVertexAttrib3sNV\0" "\0" - /* _mesa_function_pool[20407]: SharpenTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[20414]: SharpenTexFuncSGIS (dynamic) */ "iip\0" "glSharpenTexFuncSGIS\0" "\0" - /* _mesa_function_pool[20433]: MultiTexCoord4fvARB (offset 403) */ + /* _mesa_function_pool[20440]: MultiTexCoord4fvARB (offset 403) */ "ip\0" "glMultiTexCoord4fv\0" "glMultiTexCoord4fvARB\0" "\0" - /* _mesa_function_pool[20478]: UniformMatrix2x3fv (will be remapped) */ + /* _mesa_function_pool[20485]: UniformMatrix2x3fv (will be remapped) */ "iiip\0" "glUniformMatrix2x3fv\0" "\0" - /* _mesa_function_pool[20505]: TrackMatrixNV (will be remapped) */ + /* _mesa_function_pool[20512]: TrackMatrixNV (will be remapped) */ "iiii\0" "glTrackMatrixNV\0" "\0" - /* _mesa_function_pool[20527]: CombinerParameteriNV (will be remapped) */ + /* _mesa_function_pool[20534]: CombinerParameteriNV (will be remapped) */ "ii\0" "glCombinerParameteriNV\0" "\0" - /* _mesa_function_pool[20554]: DeleteAsyncMarkersSGIX (dynamic) */ + /* _mesa_function_pool[20561]: DeleteAsyncMarkersSGIX (dynamic) */ "ii\0" "glDeleteAsyncMarkersSGIX\0" "\0" - /* _mesa_function_pool[20583]: ReplacementCodeusSUN (dynamic) */ + /* _mesa_function_pool[20590]: ReplacementCodeusSUN (dynamic) */ "i\0" "glReplacementCodeusSUN\0" "\0" - /* _mesa_function_pool[20609]: IsAsyncMarkerSGIX (dynamic) */ + /* _mesa_function_pool[20616]: IsAsyncMarkerSGIX (dynamic) */ "i\0" "glIsAsyncMarkerSGIX\0" "\0" - /* _mesa_function_pool[20632]: FrameZoomSGIX (dynamic) */ + /* _mesa_function_pool[20639]: FrameZoomSGIX (dynamic) */ "i\0" "glFrameZoomSGIX\0" "\0" - /* _mesa_function_pool[20651]: Normal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[20658]: Normal3fVertex3fvSUN (dynamic) */ "pp\0" "glNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[20678]: RasterPos4sv (offset 85) */ + /* _mesa_function_pool[20685]: RasterPos4sv (offset 85) */ "p\0" "glRasterPos4sv\0" "\0" - /* _mesa_function_pool[20696]: VertexAttrib4NsvARB (will be remapped) */ + /* _mesa_function_pool[20703]: VertexAttrib4NsvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nsv\0" "glVertexAttrib4NsvARB\0" "\0" - /* _mesa_function_pool[20741]: VertexAttrib3fvARB (will be remapped) */ + /* _mesa_function_pool[20748]: VertexAttrib3fvARB (will be remapped) */ "ip\0" "glVertexAttrib3fv\0" "glVertexAttrib3fvARB\0" "\0" - /* _mesa_function_pool[20784]: ClearColor (offset 206) */ + /* _mesa_function_pool[20791]: ClearColor (offset 206) */ "ffff\0" "glClearColor\0" "\0" - /* _mesa_function_pool[20803]: GetSynciv (will be remapped) */ + /* _mesa_function_pool[20810]: GetSynciv (will be remapped) */ "iiipp\0" "glGetSynciv\0" "\0" - /* _mesa_function_pool[20822]: DeleteFramebuffersEXT (will be remapped) */ + /* _mesa_function_pool[20829]: DeleteFramebuffersEXT (will be remapped) */ "ip\0" "glDeleteFramebuffers\0" "glDeleteFramebuffersEXT\0" "\0" - /* _mesa_function_pool[20871]: GlobalAlphaFactorsSUN (dynamic) */ + /* _mesa_function_pool[20878]: GlobalAlphaFactorsSUN (dynamic) */ "i\0" "glGlobalAlphaFactorsSUN\0" "\0" - /* _mesa_function_pool[20898]: IsEnabledIndexedEXT (will be remapped) */ + /* _mesa_function_pool[20905]: IsEnabledIndexedEXT (will be remapped) */ "ii\0" "glIsEnabledIndexedEXT\0" "\0" - /* _mesa_function_pool[20924]: TexEnviv (offset 187) */ + /* _mesa_function_pool[20931]: TexEnviv (offset 187) */ "iip\0" "glTexEnviv\0" "\0" - /* _mesa_function_pool[20940]: TexSubImage3D (offset 372) */ + /* _mesa_function_pool[20947]: TexSubImage3D (offset 372) */ "iiiiiiiiiip\0" "glTexSubImage3D\0" "glTexSubImage3DEXT\0" "\0" - /* _mesa_function_pool[20988]: Tangent3fEXT (dynamic) */ + /* _mesa_function_pool[20995]: Tangent3fEXT (dynamic) */ "fff\0" "glTangent3fEXT\0" "\0" - /* _mesa_function_pool[21008]: SecondaryColor3uivEXT (will be remapped) */ + /* _mesa_function_pool[21015]: SecondaryColor3uivEXT (will be remapped) */ "p\0" "glSecondaryColor3uiv\0" "glSecondaryColor3uivEXT\0" "\0" - /* _mesa_function_pool[21056]: MatrixIndexubvARB (dynamic) */ + /* _mesa_function_pool[21063]: MatrixIndexubvARB (dynamic) */ "ip\0" "glMatrixIndexubvARB\0" "\0" - /* _mesa_function_pool[21080]: Color4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[21087]: Color4fNormal3fVertex3fSUN (dynamic) */ "ffffffffff\0" "glColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[21121]: PixelTexGenParameterfSGIS (will be remapped) */ + /* _mesa_function_pool[21128]: PixelTexGenParameterfSGIS (will be remapped) */ "if\0" "glPixelTexGenParameterfSGIS\0" "\0" - /* _mesa_function_pool[21153]: CreateShader (will be remapped) */ + /* _mesa_function_pool[21160]: CreateShader (will be remapped) */ "i\0" "glCreateShader\0" "\0" - /* _mesa_function_pool[21171]: GetColorTableParameterfv (offset 344) */ + /* _mesa_function_pool[21178]: GetColorTableParameterfv (offset 344) */ "iip\0" "glGetColorTableParameterfv\0" "glGetColorTableParameterfvSGI\0" "glGetColorTableParameterfvEXT\0" "\0" - /* _mesa_function_pool[21263]: FragmentLightModelfvSGIX (dynamic) */ + /* _mesa_function_pool[21270]: FragmentLightModelfvSGIX (dynamic) */ "ip\0" "glFragmentLightModelfvSGIX\0" "\0" - /* _mesa_function_pool[21294]: Bitmap (offset 8) */ + /* _mesa_function_pool[21301]: Bitmap (offset 8) */ "iiffffp\0" "glBitmap\0" "\0" - /* _mesa_function_pool[21312]: MultiTexCoord3fARB (offset 394) */ + /* _mesa_function_pool[21319]: MultiTexCoord3fARB (offset 394) */ "ifff\0" "glMultiTexCoord3f\0" "glMultiTexCoord3fARB\0" "\0" - /* _mesa_function_pool[21357]: GetTexLevelParameterfv (offset 284) */ + /* _mesa_function_pool[21364]: GetTexLevelParameterfv (offset 284) */ "iiip\0" "glGetTexLevelParameterfv\0" "\0" - /* _mesa_function_pool[21388]: GetPixelTexGenParameterfvSGIS (will be remapped) */ + /* _mesa_function_pool[21395]: GetPixelTexGenParameterfvSGIS (will be remapped) */ "ip\0" "glGetPixelTexGenParameterfvSGIS\0" "\0" - /* _mesa_function_pool[21424]: GenFramebuffersEXT (will be remapped) */ + /* _mesa_function_pool[21431]: GenFramebuffersEXT (will be remapped) */ "ip\0" "glGenFramebuffers\0" "glGenFramebuffersEXT\0" "\0" - /* _mesa_function_pool[21467]: GetProgramParameterdvNV (will be remapped) */ + /* _mesa_function_pool[21474]: GetProgramParameterdvNV (will be remapped) */ "iiip\0" "glGetProgramParameterdvNV\0" "\0" - /* _mesa_function_pool[21499]: Vertex2sv (offset 133) */ + /* _mesa_function_pool[21506]: Vertex2sv (offset 133) */ "p\0" "glVertex2sv\0" "\0" - /* _mesa_function_pool[21514]: GetIntegerv (offset 263) */ + /* _mesa_function_pool[21521]: GetIntegerv (offset 263) */ "ip\0" "glGetIntegerv\0" "\0" - /* _mesa_function_pool[21532]: IsVertexArrayAPPLE (will be remapped) */ + /* _mesa_function_pool[21539]: IsVertexArrayAPPLE (will be remapped) */ "i\0" "glIsVertexArray\0" "glIsVertexArrayAPPLE\0" "\0" - /* _mesa_function_pool[21572]: FragmentLightfvSGIX (dynamic) */ + /* _mesa_function_pool[21579]: FragmentLightfvSGIX (dynamic) */ "iip\0" "glFragmentLightfvSGIX\0" "\0" - /* _mesa_function_pool[21599]: DetachShader (will be remapped) */ + /* _mesa_function_pool[21606]: DetachShader (will be remapped) */ "ii\0" "glDetachShader\0" "\0" - /* _mesa_function_pool[21618]: VertexAttrib4NubARB (will be remapped) */ + /* _mesa_function_pool[21625]: VertexAttrib4NubARB (will be remapped) */ "iiiii\0" "glVertexAttrib4Nub\0" "glVertexAttrib4NubARB\0" "\0" - /* _mesa_function_pool[21666]: GetProgramEnvParameterfvARB (will be remapped) */ + /* _mesa_function_pool[21673]: GetProgramEnvParameterfvARB (will be remapped) */ "iip\0" "glGetProgramEnvParameterfvARB\0" "\0" - /* _mesa_function_pool[21701]: GetTrackMatrixivNV (will be remapped) */ + /* _mesa_function_pool[21708]: GetTrackMatrixivNV (will be remapped) */ "iiip\0" "glGetTrackMatrixivNV\0" "\0" - /* _mesa_function_pool[21728]: VertexAttrib3svNV (will be remapped) */ + /* _mesa_function_pool[21735]: VertexAttrib3svNV (will be remapped) */ "ip\0" "glVertexAttrib3svNV\0" "\0" - /* _mesa_function_pool[21752]: Uniform4fvARB (will be remapped) */ + /* _mesa_function_pool[21759]: Uniform4fvARB (will be remapped) */ "iip\0" "glUniform4fv\0" "glUniform4fvARB\0" "\0" - /* _mesa_function_pool[21786]: MultTransposeMatrixfARB (will be remapped) */ + /* _mesa_function_pool[21793]: MultTransposeMatrixfARB (will be remapped) */ "p\0" "glMultTransposeMatrixf\0" "glMultTransposeMatrixfARB\0" "\0" - /* _mesa_function_pool[21838]: GetTexEnviv (offset 277) */ + /* _mesa_function_pool[21845]: GetTexEnviv (offset 277) */ "iip\0" "glGetTexEnviv\0" "\0" - /* _mesa_function_pool[21857]: ColorFragmentOp1ATI (will be remapped) */ + /* _mesa_function_pool[21864]: ColorFragmentOp1ATI (will be remapped) */ "iiiiiii\0" "glColorFragmentOp1ATI\0" "\0" - /* _mesa_function_pool[21888]: GetUniformfvARB (will be remapped) */ + /* _mesa_function_pool[21895]: GetUniformfvARB (will be remapped) */ "iip\0" "glGetUniformfv\0" "glGetUniformfvARB\0" "\0" - /* _mesa_function_pool[21926]: EGLImageTargetRenderbufferStorageOES (will be remapped) */ + /* _mesa_function_pool[21933]: EGLImageTargetRenderbufferStorageOES (will be remapped) */ "ip\0" "glEGLImageTargetRenderbufferStorageOES\0" "\0" - /* _mesa_function_pool[21969]: PopClientAttrib (offset 334) */ + /* _mesa_function_pool[21976]: PopClientAttrib (offset 334) */ "\0" "glPopClientAttrib\0" "\0" - /* _mesa_function_pool[21989]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[21996]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ "iffffffffffff\0" "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[22060]: DetachObjectARB (will be remapped) */ + /* _mesa_function_pool[22067]: DetachObjectARB (will be remapped) */ "ii\0" "glDetachObjectARB\0" "\0" - /* _mesa_function_pool[22082]: VertexBlendARB (dynamic) */ + /* _mesa_function_pool[22089]: VertexBlendARB (dynamic) */ "i\0" "glVertexBlendARB\0" "\0" - /* _mesa_function_pool[22102]: WindowPos3iMESA (will be remapped) */ + /* _mesa_function_pool[22109]: WindowPos3iMESA (will be remapped) */ "iii\0" "glWindowPos3i\0" "glWindowPos3iARB\0" "glWindowPos3iMESA\0" "\0" - /* _mesa_function_pool[22156]: SeparableFilter2D (offset 360) */ + /* _mesa_function_pool[22163]: SeparableFilter2D (offset 360) */ "iiiiiipp\0" "glSeparableFilter2D\0" "glSeparableFilter2DEXT\0" "\0" - /* _mesa_function_pool[22209]: ProgramParameteriARB (will be remapped) */ + /* _mesa_function_pool[22216]: ProgramParameteriARB (will be remapped) */ "iii\0" "glProgramParameteriARB\0" "\0" - /* _mesa_function_pool[22237]: Map1d (offset 220) */ + /* _mesa_function_pool[22244]: Map1d (offset 220) */ "iddiip\0" "glMap1d\0" "\0" - /* _mesa_function_pool[22253]: Map1f (offset 221) */ + /* _mesa_function_pool[22260]: Map1f (offset 221) */ "iffiip\0" "glMap1f\0" "\0" - /* _mesa_function_pool[22269]: CompressedTexImage2DARB (will be remapped) */ + /* _mesa_function_pool[22276]: CompressedTexImage2DARB (will be remapped) */ "iiiiiiip\0" "glCompressedTexImage2D\0" "glCompressedTexImage2DARB\0" "\0" - /* _mesa_function_pool[22328]: ArrayElement (offset 306) */ + /* _mesa_function_pool[22335]: ArrayElement (offset 306) */ "i\0" "glArrayElement\0" "glArrayElementEXT\0" "\0" - /* _mesa_function_pool[22364]: TexImage2D (offset 183) */ + /* _mesa_function_pool[22371]: TexImage2D (offset 183) */ "iiiiiiiip\0" "glTexImage2D\0" "\0" - /* _mesa_function_pool[22388]: DepthBoundsEXT (will be remapped) */ + /* _mesa_function_pool[22395]: DepthBoundsEXT (will be remapped) */ "dd\0" "glDepthBoundsEXT\0" "\0" - /* _mesa_function_pool[22409]: ProgramParameters4fvNV (will be remapped) */ + /* _mesa_function_pool[22416]: ProgramParameters4fvNV (will be remapped) */ "iiip\0" "glProgramParameters4fvNV\0" "\0" - /* _mesa_function_pool[22440]: DeformationMap3fSGIX (dynamic) */ + /* _mesa_function_pool[22447]: DeformationMap3fSGIX (dynamic) */ "iffiiffiiffiip\0" "glDeformationMap3fSGIX\0" "\0" - /* _mesa_function_pool[22479]: GetProgramivNV (will be remapped) */ + /* _mesa_function_pool[22486]: GetProgramivNV (will be remapped) */ "iip\0" "glGetProgramivNV\0" "\0" - /* _mesa_function_pool[22501]: GetMinmaxParameteriv (offset 366) */ + /* _mesa_function_pool[22508]: GetMinmaxParameteriv (offset 366) */ "iip\0" "glGetMinmaxParameteriv\0" "glGetMinmaxParameterivEXT\0" "\0" - /* _mesa_function_pool[22555]: PixelTransferf (offset 247) */ + /* _mesa_function_pool[22562]: PixelTransferf (offset 247) */ "if\0" "glPixelTransferf\0" "\0" - /* _mesa_function_pool[22576]: CopyTexImage1D (offset 323) */ + /* _mesa_function_pool[22583]: CopyTexImage1D (offset 323) */ "iiiiiii\0" "glCopyTexImage1D\0" "glCopyTexImage1DEXT\0" "\0" - /* _mesa_function_pool[22622]: PushMatrix (offset 298) */ + /* _mesa_function_pool[22629]: PushMatrix (offset 298) */ "\0" "glPushMatrix\0" "\0" - /* _mesa_function_pool[22637]: Fogiv (offset 156) */ + /* _mesa_function_pool[22644]: Fogiv (offset 156) */ "ip\0" "glFogiv\0" "\0" - /* _mesa_function_pool[22649]: TexCoord1dv (offset 95) */ + /* _mesa_function_pool[22656]: TexCoord1dv (offset 95) */ "p\0" "glTexCoord1dv\0" "\0" - /* _mesa_function_pool[22666]: AlphaFragmentOp3ATI (will be remapped) */ + /* _mesa_function_pool[22673]: AlphaFragmentOp3ATI (will be remapped) */ "iiiiiiiiiiii\0" "glAlphaFragmentOp3ATI\0" "\0" - /* _mesa_function_pool[22702]: PixelTransferi (offset 248) */ + /* _mesa_function_pool[22709]: PixelTransferi (offset 248) */ "ii\0" "glPixelTransferi\0" "\0" - /* _mesa_function_pool[22723]: GetVertexAttribdvNV (will be remapped) */ + /* _mesa_function_pool[22730]: GetVertexAttribdvNV (will be remapped) */ "iip\0" "glGetVertexAttribdvNV\0" "\0" - /* _mesa_function_pool[22750]: VertexAttrib3fvNV (will be remapped) */ + /* _mesa_function_pool[22757]: VertexAttrib3fvNV (will be remapped) */ "ip\0" "glVertexAttrib3fvNV\0" "\0" - /* _mesa_function_pool[22774]: Rotatef (offset 300) */ + /* _mesa_function_pool[22781]: Rotatef (offset 300) */ "ffff\0" "glRotatef\0" "\0" - /* _mesa_function_pool[22790]: GetFinalCombinerInputParameterivNV (will be remapped) */ + /* _mesa_function_pool[22797]: GetFinalCombinerInputParameterivNV (will be remapped) */ "iip\0" "glGetFinalCombinerInputParameterivNV\0" "\0" - /* _mesa_function_pool[22832]: Vertex3i (offset 138) */ + /* _mesa_function_pool[22839]: Vertex3i (offset 138) */ "iii\0" "glVertex3i\0" "\0" - /* _mesa_function_pool[22848]: Vertex3f (offset 136) */ + /* _mesa_function_pool[22855]: Vertex3f (offset 136) */ "fff\0" "glVertex3f\0" "\0" - /* _mesa_function_pool[22864]: Clear (offset 203) */ + /* _mesa_function_pool[22871]: Clear (offset 203) */ "i\0" "glClear\0" "\0" - /* _mesa_function_pool[22875]: Vertex3d (offset 134) */ + /* _mesa_function_pool[22882]: Vertex3d (offset 134) */ "ddd\0" "glVertex3d\0" "\0" - /* _mesa_function_pool[22891]: GetMapParameterivNV (dynamic) */ + /* _mesa_function_pool[22898]: GetMapParameterivNV (dynamic) */ "iip\0" "glGetMapParameterivNV\0" "\0" - /* _mesa_function_pool[22918]: Uniform4iARB (will be remapped) */ + /* _mesa_function_pool[22925]: Uniform4iARB (will be remapped) */ "iiiii\0" "glUniform4i\0" "glUniform4iARB\0" "\0" - /* _mesa_function_pool[22952]: ReadBuffer (offset 254) */ + /* _mesa_function_pool[22959]: ReadBuffer (offset 254) */ "i\0" "glReadBuffer\0" "\0" - /* _mesa_function_pool[22968]: ConvolutionParameteri (offset 352) */ + /* _mesa_function_pool[22975]: ConvolutionParameteri (offset 352) */ "iii\0" "glConvolutionParameteri\0" "glConvolutionParameteriEXT\0" "\0" - /* _mesa_function_pool[23024]: Ortho (offset 296) */ + /* _mesa_function_pool[23031]: Ortho (offset 296) */ "dddddd\0" "glOrtho\0" "\0" - /* _mesa_function_pool[23040]: Binormal3sEXT (dynamic) */ + /* _mesa_function_pool[23047]: Binormal3sEXT (dynamic) */ "iii\0" "glBinormal3sEXT\0" "\0" - /* _mesa_function_pool[23061]: ListBase (offset 6) */ + /* _mesa_function_pool[23068]: ListBase (offset 6) */ "i\0" "glListBase\0" "\0" - /* _mesa_function_pool[23075]: Vertex3s (offset 140) */ + /* _mesa_function_pool[23082]: Vertex3s (offset 140) */ "iii\0" "glVertex3s\0" "\0" - /* _mesa_function_pool[23091]: ConvolutionParameterf (offset 350) */ + /* _mesa_function_pool[23098]: ConvolutionParameterf (offset 350) */ "iif\0" "glConvolutionParameterf\0" "glConvolutionParameterfEXT\0" "\0" - /* _mesa_function_pool[23147]: GetColorTableParameteriv (offset 345) */ + /* _mesa_function_pool[23154]: GetColorTableParameteriv (offset 345) */ "iip\0" "glGetColorTableParameteriv\0" "glGetColorTableParameterivSGI\0" "glGetColorTableParameterivEXT\0" "\0" - /* _mesa_function_pool[23239]: ProgramEnvParameter4dvARB (will be remapped) */ + /* _mesa_function_pool[23246]: ProgramEnvParameter4dvARB (will be remapped) */ "iip\0" "glProgramEnvParameter4dvARB\0" "glProgramParameter4dvNV\0" "\0" - /* _mesa_function_pool[23296]: ShadeModel (offset 177) */ + /* _mesa_function_pool[23303]: ShadeModel (offset 177) */ "i\0" "glShadeModel\0" "\0" - /* _mesa_function_pool[23312]: VertexAttribs2fvNV (will be remapped) */ + /* _mesa_function_pool[23319]: VertexAttribs2fvNV (will be remapped) */ "iip\0" "glVertexAttribs2fvNV\0" "\0" - /* _mesa_function_pool[23338]: Rectiv (offset 91) */ + /* _mesa_function_pool[23345]: Rectiv (offset 91) */ "pp\0" "glRectiv\0" "\0" - /* _mesa_function_pool[23351]: UseProgramObjectARB (will be remapped) */ + /* _mesa_function_pool[23358]: UseProgramObjectARB (will be remapped) */ "i\0" "glUseProgram\0" "glUseProgramObjectARB\0" "\0" - /* _mesa_function_pool[23389]: GetMapParameterfvNV (dynamic) */ + /* _mesa_function_pool[23396]: GetMapParameterfvNV (dynamic) */ "iip\0" "glGetMapParameterfvNV\0" "\0" - /* _mesa_function_pool[23416]: EndConditionalRenderNV (will be remapped) */ + /* _mesa_function_pool[23423]: EndConditionalRenderNV (will be remapped) */ "\0" "glEndConditionalRenderNV\0" "\0" - /* _mesa_function_pool[23443]: PassTexCoordATI (will be remapped) */ + /* _mesa_function_pool[23450]: PassTexCoordATI (will be remapped) */ "iii\0" "glPassTexCoordATI\0" "\0" - /* _mesa_function_pool[23466]: DeleteProgram (will be remapped) */ + /* _mesa_function_pool[23473]: DeleteProgram (will be remapped) */ "i\0" "glDeleteProgram\0" "\0" - /* _mesa_function_pool[23485]: Tangent3ivEXT (dynamic) */ + /* _mesa_function_pool[23492]: Tangent3ivEXT (dynamic) */ "p\0" "glTangent3ivEXT\0" "\0" - /* _mesa_function_pool[23504]: Tangent3dEXT (dynamic) */ + /* _mesa_function_pool[23511]: Tangent3dEXT (dynamic) */ "ddd\0" "glTangent3dEXT\0" "\0" - /* _mesa_function_pool[23524]: SecondaryColor3dvEXT (will be remapped) */ + /* _mesa_function_pool[23531]: SecondaryColor3dvEXT (will be remapped) */ "p\0" "glSecondaryColor3dv\0" "glSecondaryColor3dvEXT\0" "\0" - /* _mesa_function_pool[23570]: Vertex2fv (offset 129) */ + /* _mesa_function_pool[23577]: Vertex2fv (offset 129) */ "p\0" "glVertex2fv\0" "\0" - /* _mesa_function_pool[23585]: MultiDrawArraysEXT (will be remapped) */ + /* _mesa_function_pool[23592]: MultiDrawArraysEXT (will be remapped) */ "ippi\0" "glMultiDrawArrays\0" "glMultiDrawArraysEXT\0" "\0" - /* _mesa_function_pool[23630]: BindRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[23637]: BindRenderbufferEXT (will be remapped) */ "ii\0" "glBindRenderbuffer\0" "glBindRenderbufferEXT\0" "\0" - /* _mesa_function_pool[23675]: MultiTexCoord4dARB (offset 400) */ + /* _mesa_function_pool[23682]: MultiTexCoord4dARB (offset 400) */ "idddd\0" "glMultiTexCoord4d\0" "glMultiTexCoord4dARB\0" "\0" - /* _mesa_function_pool[23721]: FramebufferTextureFaceARB (will be remapped) */ + /* _mesa_function_pool[23728]: FramebufferTextureFaceARB (will be remapped) */ "iiiii\0" "glFramebufferTextureFaceARB\0" "\0" - /* _mesa_function_pool[23756]: Vertex3sv (offset 141) */ + /* _mesa_function_pool[23763]: Vertex3sv (offset 141) */ "p\0" "glVertex3sv\0" "\0" - /* _mesa_function_pool[23771]: SecondaryColor3usEXT (will be remapped) */ + /* _mesa_function_pool[23778]: SecondaryColor3usEXT (will be remapped) */ "iii\0" "glSecondaryColor3us\0" "glSecondaryColor3usEXT\0" "\0" - /* _mesa_function_pool[23819]: ProgramLocalParameter4fvARB (will be remapped) */ + /* _mesa_function_pool[23826]: ProgramLocalParameter4fvARB (will be remapped) */ "iip\0" "glProgramLocalParameter4fvARB\0" "\0" - /* _mesa_function_pool[23854]: DeleteProgramsNV (will be remapped) */ + /* _mesa_function_pool[23861]: DeleteProgramsNV (will be remapped) */ "ip\0" "glDeleteProgramsARB\0" "glDeleteProgramsNV\0" "\0" - /* _mesa_function_pool[23897]: EvalMesh1 (offset 236) */ + /* _mesa_function_pool[23904]: EvalMesh1 (offset 236) */ "iii\0" "glEvalMesh1\0" "\0" - /* _mesa_function_pool[23914]: PauseTransformFeedback (will be remapped) */ + /* _mesa_function_pool[23921]: PauseTransformFeedback (will be remapped) */ "\0" "glPauseTransformFeedback\0" "\0" - /* _mesa_function_pool[23941]: MultiTexCoord1sARB (offset 382) */ + /* _mesa_function_pool[23948]: MultiTexCoord1sARB (offset 382) */ "ii\0" "glMultiTexCoord1s\0" "glMultiTexCoord1sARB\0" "\0" - /* _mesa_function_pool[23984]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[23991]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ "iffffff\0" "glReplacementCodeuiColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[24031]: GetVertexAttribPointervNV (will be remapped) */ + /* _mesa_function_pool[24038]: GetVertexAttribPointervNV (will be remapped) */ "iip\0" "glGetVertexAttribPointerv\0" "glGetVertexAttribPointervARB\0" "glGetVertexAttribPointervNV\0" "\0" - /* _mesa_function_pool[24119]: VertexAttribs1fvNV (will be remapped) */ + /* _mesa_function_pool[24126]: VertexAttribs1fvNV (will be remapped) */ "iip\0" "glVertexAttribs1fvNV\0" "\0" - /* _mesa_function_pool[24145]: MultiTexCoord1dvARB (offset 377) */ + /* _mesa_function_pool[24152]: MultiTexCoord1dvARB (offset 377) */ "ip\0" "glMultiTexCoord1dv\0" "glMultiTexCoord1dvARB\0" "\0" - /* _mesa_function_pool[24190]: Uniform2iARB (will be remapped) */ + /* _mesa_function_pool[24197]: Uniform2iARB (will be remapped) */ "iii\0" "glUniform2i\0" "glUniform2iARB\0" "\0" - /* _mesa_function_pool[24222]: Vertex2iv (offset 131) */ + /* _mesa_function_pool[24229]: Vertex2iv (offset 131) */ "p\0" "glVertex2iv\0" "\0" - /* _mesa_function_pool[24237]: GetProgramStringNV (will be remapped) */ + /* _mesa_function_pool[24244]: GetProgramStringNV (will be remapped) */ "iip\0" "glGetProgramStringNV\0" "\0" - /* _mesa_function_pool[24263]: ColorPointerEXT (will be remapped) */ + /* _mesa_function_pool[24270]: ColorPointerEXT (will be remapped) */ "iiiip\0" "glColorPointerEXT\0" "\0" - /* _mesa_function_pool[24288]: LineWidth (offset 168) */ + /* _mesa_function_pool[24295]: LineWidth (offset 168) */ "f\0" "glLineWidth\0" "\0" - /* _mesa_function_pool[24303]: MapBufferARB (will be remapped) */ + /* _mesa_function_pool[24310]: MapBufferARB (will be remapped) */ "ii\0" "glMapBuffer\0" "glMapBufferARB\0" "\0" - /* _mesa_function_pool[24334]: MultiDrawElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[24341]: MultiDrawElementsBaseVertex (will be remapped) */ "ipipip\0" "glMultiDrawElementsBaseVertex\0" "\0" - /* _mesa_function_pool[24372]: Binormal3svEXT (dynamic) */ + /* _mesa_function_pool[24379]: Binormal3svEXT (dynamic) */ "p\0" "glBinormal3svEXT\0" "\0" - /* _mesa_function_pool[24392]: ApplyTextureEXT (dynamic) */ + /* _mesa_function_pool[24399]: ApplyTextureEXT (dynamic) */ "i\0" "glApplyTextureEXT\0" "\0" - /* _mesa_function_pool[24413]: TexGendv (offset 189) */ + /* _mesa_function_pool[24420]: TexGendv (offset 189) */ "iip\0" "glTexGendv\0" "\0" - /* _mesa_function_pool[24429]: EnableIndexedEXT (will be remapped) */ + /* _mesa_function_pool[24436]: EnableIndexedEXT (will be remapped) */ "ii\0" "glEnableIndexedEXT\0" "\0" - /* _mesa_function_pool[24452]: TextureMaterialEXT (dynamic) */ + /* _mesa_function_pool[24459]: TextureMaterialEXT (dynamic) */ "ii\0" "glTextureMaterialEXT\0" "\0" - /* _mesa_function_pool[24477]: TextureLightEXT (dynamic) */ + /* _mesa_function_pool[24484]: TextureLightEXT (dynamic) */ "i\0" "glTextureLightEXT\0" "\0" - /* _mesa_function_pool[24498]: ResetMinmax (offset 370) */ + /* _mesa_function_pool[24505]: ResetMinmax (offset 370) */ "i\0" "glResetMinmax\0" "glResetMinmaxEXT\0" "\0" - /* _mesa_function_pool[24532]: SpriteParameterfSGIX (dynamic) */ + /* _mesa_function_pool[24539]: SpriteParameterfSGIX (dynamic) */ "if\0" "glSpriteParameterfSGIX\0" "\0" - /* _mesa_function_pool[24559]: EnableClientState (offset 313) */ + /* _mesa_function_pool[24566]: EnableClientState (offset 313) */ "i\0" "glEnableClientState\0" "\0" - /* _mesa_function_pool[24582]: VertexAttrib4sNV (will be remapped) */ + /* _mesa_function_pool[24589]: VertexAttrib4sNV (will be remapped) */ "iiiii\0" "glVertexAttrib4sNV\0" "\0" - /* _mesa_function_pool[24608]: GetConvolutionParameterfv (offset 357) */ + /* _mesa_function_pool[24615]: GetConvolutionParameterfv (offset 357) */ "iip\0" "glGetConvolutionParameterfv\0" "glGetConvolutionParameterfvEXT\0" "\0" - /* _mesa_function_pool[24672]: VertexAttribs4dvNV (will be remapped) */ + /* _mesa_function_pool[24679]: VertexAttribs4dvNV (will be remapped) */ "iip\0" "glVertexAttribs4dvNV\0" "\0" - /* _mesa_function_pool[24698]: VertexAttrib4dARB (will be remapped) */ + /* _mesa_function_pool[24705]: MultiModeDrawArraysIBM (will be remapped) */ + "pppii\0" + "glMultiModeDrawArraysIBM\0" + "\0" + /* _mesa_function_pool[24737]: VertexAttrib4dARB (will be remapped) */ "idddd\0" "glVertexAttrib4d\0" "glVertexAttrib4dARB\0" "\0" - /* _mesa_function_pool[24742]: GetTexBumpParameterfvATI (will be remapped) */ + /* _mesa_function_pool[24781]: GetTexBumpParameterfvATI (will be remapped) */ "ip\0" "glGetTexBumpParameterfvATI\0" "\0" - /* _mesa_function_pool[24773]: ProgramNamedParameter4dNV (will be remapped) */ + /* _mesa_function_pool[24812]: ProgramNamedParameter4dNV (will be remapped) */ "iipdddd\0" "glProgramNamedParameter4dNV\0" "\0" - /* _mesa_function_pool[24810]: GetMaterialfv (offset 269) */ + /* _mesa_function_pool[24849]: GetMaterialfv (offset 269) */ "iip\0" "glGetMaterialfv\0" "\0" - /* _mesa_function_pool[24831]: VertexWeightfEXT (dynamic) */ + /* _mesa_function_pool[24870]: VertexWeightfEXT (dynamic) */ "f\0" "glVertexWeightfEXT\0" "\0" - /* _mesa_function_pool[24853]: Binormal3fEXT (dynamic) */ + /* _mesa_function_pool[24892]: Binormal3fEXT (dynamic) */ "fff\0" "glBinormal3fEXT\0" "\0" - /* _mesa_function_pool[24874]: CallList (offset 2) */ + /* _mesa_function_pool[24913]: CallList (offset 2) */ "i\0" "glCallList\0" "\0" - /* _mesa_function_pool[24888]: Materialfv (offset 170) */ + /* _mesa_function_pool[24927]: Materialfv (offset 170) */ "iip\0" "glMaterialfv\0" "\0" - /* _mesa_function_pool[24906]: TexCoord3fv (offset 113) */ + /* _mesa_function_pool[24945]: TexCoord3fv (offset 113) */ "p\0" "glTexCoord3fv\0" "\0" - /* _mesa_function_pool[24923]: FogCoordfvEXT (will be remapped) */ + /* _mesa_function_pool[24962]: FogCoordfvEXT (will be remapped) */ "p\0" "glFogCoordfv\0" "glFogCoordfvEXT\0" "\0" - /* _mesa_function_pool[24955]: MultiTexCoord1ivARB (offset 381) */ + /* _mesa_function_pool[24994]: MultiTexCoord1ivARB (offset 381) */ "ip\0" "glMultiTexCoord1iv\0" "glMultiTexCoord1ivARB\0" "\0" - /* _mesa_function_pool[25000]: SecondaryColor3ubEXT (will be remapped) */ + /* _mesa_function_pool[25039]: SecondaryColor3ubEXT (will be remapped) */ "iii\0" "glSecondaryColor3ub\0" "glSecondaryColor3ubEXT\0" "\0" - /* _mesa_function_pool[25048]: MultiTexCoord2ivARB (offset 389) */ + /* _mesa_function_pool[25087]: MultiTexCoord2ivARB (offset 389) */ "ip\0" "glMultiTexCoord2iv\0" "glMultiTexCoord2ivARB\0" "\0" - /* _mesa_function_pool[25093]: FogFuncSGIS (dynamic) */ + /* _mesa_function_pool[25132]: FogFuncSGIS (dynamic) */ "ip\0" "glFogFuncSGIS\0" "\0" - /* _mesa_function_pool[25111]: CopyTexSubImage2D (offset 326) */ + /* _mesa_function_pool[25150]: CopyTexSubImage2D (offset 326) */ "iiiiiiii\0" "glCopyTexSubImage2D\0" "glCopyTexSubImage2DEXT\0" "\0" - /* _mesa_function_pool[25164]: GetObjectParameterivARB (will be remapped) */ + /* _mesa_function_pool[25203]: GetObjectParameterivARB (will be remapped) */ "iip\0" "glGetObjectParameterivARB\0" "\0" - /* _mesa_function_pool[25195]: Color3iv (offset 16) */ + /* _mesa_function_pool[25234]: Color3iv (offset 16) */ "p\0" "glColor3iv\0" "\0" - /* _mesa_function_pool[25209]: TexCoord4fVertex4fSUN (dynamic) */ + /* _mesa_function_pool[25248]: TexCoord4fVertex4fSUN (dynamic) */ "ffffffff\0" "glTexCoord4fVertex4fSUN\0" "\0" - /* _mesa_function_pool[25243]: DrawElements (offset 311) */ + /* _mesa_function_pool[25282]: DrawElements (offset 311) */ "iiip\0" "glDrawElements\0" "\0" - /* _mesa_function_pool[25264]: BindVertexArrayAPPLE (will be remapped) */ + /* _mesa_function_pool[25303]: BindVertexArrayAPPLE (will be remapped) */ "i\0" "glBindVertexArrayAPPLE\0" "\0" - /* _mesa_function_pool[25290]: GetProgramLocalParameterdvARB (will be remapped) */ + /* _mesa_function_pool[25329]: GetProgramLocalParameterdvARB (will be remapped) */ "iip\0" "glGetProgramLocalParameterdvARB\0" "\0" - /* _mesa_function_pool[25327]: GetHistogramParameteriv (offset 363) */ + /* _mesa_function_pool[25366]: GetHistogramParameteriv (offset 363) */ "iip\0" "glGetHistogramParameteriv\0" "glGetHistogramParameterivEXT\0" "\0" - /* _mesa_function_pool[25387]: MultiTexCoord1iARB (offset 380) */ + /* _mesa_function_pool[25426]: MultiTexCoord1iARB (offset 380) */ "ii\0" "glMultiTexCoord1i\0" "glMultiTexCoord1iARB\0" "\0" - /* _mesa_function_pool[25430]: GetConvolutionFilter (offset 356) */ + /* _mesa_function_pool[25469]: GetConvolutionFilter (offset 356) */ "iiip\0" "glGetConvolutionFilter\0" "glGetConvolutionFilterEXT\0" "\0" - /* _mesa_function_pool[25485]: GetProgramivARB (will be remapped) */ + /* _mesa_function_pool[25524]: GetProgramivARB (will be remapped) */ "iip\0" "glGetProgramivARB\0" "\0" - /* _mesa_function_pool[25508]: BlendFuncSeparateEXT (will be remapped) */ + /* _mesa_function_pool[25547]: BlendFuncSeparateEXT (will be remapped) */ "iiii\0" "glBlendFuncSeparate\0" "glBlendFuncSeparateEXT\0" "glBlendFuncSeparateINGR\0" "\0" - /* _mesa_function_pool[25581]: MapBufferRange (will be remapped) */ + /* _mesa_function_pool[25620]: MapBufferRange (will be remapped) */ "iiii\0" "glMapBufferRange\0" "\0" - /* _mesa_function_pool[25604]: ProgramParameters4dvNV (will be remapped) */ + /* _mesa_function_pool[25643]: ProgramParameters4dvNV (will be remapped) */ "iiip\0" "glProgramParameters4dvNV\0" "\0" - /* _mesa_function_pool[25635]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[25674]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ "ppp\0" "glTexCoord2fColor3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[25672]: EvalPoint2 (offset 239) */ + /* _mesa_function_pool[25711]: EvalPoint2 (offset 239) */ "ii\0" "glEvalPoint2\0" "\0" - /* _mesa_function_pool[25689]: EvalPoint1 (offset 237) */ + /* _mesa_function_pool[25728]: EvalPoint1 (offset 237) */ "i\0" "glEvalPoint1\0" "\0" - /* _mesa_function_pool[25705]: Binormal3dvEXT (dynamic) */ + /* _mesa_function_pool[25744]: Binormal3dvEXT (dynamic) */ "p\0" "glBinormal3dvEXT\0" "\0" - /* _mesa_function_pool[25725]: PopMatrix (offset 297) */ + /* _mesa_function_pool[25764]: PopMatrix (offset 297) */ "\0" "glPopMatrix\0" "\0" - /* _mesa_function_pool[25739]: FinishFenceNV (will be remapped) */ + /* _mesa_function_pool[25778]: FinishFenceNV (will be remapped) */ "i\0" "glFinishFenceNV\0" "\0" - /* _mesa_function_pool[25758]: GetFogFuncSGIS (dynamic) */ + /* _mesa_function_pool[25797]: GetFogFuncSGIS (dynamic) */ "p\0" "glGetFogFuncSGIS\0" "\0" - /* _mesa_function_pool[25778]: GetUniformLocationARB (will be remapped) */ + /* _mesa_function_pool[25817]: GetUniformLocationARB (will be remapped) */ "ip\0" "glGetUniformLocation\0" "glGetUniformLocationARB\0" "\0" - /* _mesa_function_pool[25827]: SecondaryColor3fEXT (will be remapped) */ + /* _mesa_function_pool[25866]: SecondaryColor3fEXT (will be remapped) */ "fff\0" "glSecondaryColor3f\0" "glSecondaryColor3fEXT\0" "\0" - /* _mesa_function_pool[25873]: GetTexGeniv (offset 280) */ + /* _mesa_function_pool[25912]: GetTexGeniv (offset 280) */ "iip\0" "glGetTexGeniv\0" "\0" - /* _mesa_function_pool[25892]: CombinerInputNV (will be remapped) */ + /* _mesa_function_pool[25931]: CombinerInputNV (will be remapped) */ "iiiiii\0" "glCombinerInputNV\0" "\0" - /* _mesa_function_pool[25918]: VertexAttrib3sARB (will be remapped) */ + /* _mesa_function_pool[25957]: VertexAttrib3sARB (will be remapped) */ "iiii\0" "glVertexAttrib3s\0" "glVertexAttrib3sARB\0" "\0" - /* _mesa_function_pool[25961]: IsTransformFeedback (will be remapped) */ + /* _mesa_function_pool[26000]: IsTransformFeedback (will be remapped) */ "i\0" "glIsTransformFeedback\0" "\0" - /* _mesa_function_pool[25986]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[26025]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[26031]: Map2d (offset 222) */ + /* _mesa_function_pool[26070]: Map2d (offset 222) */ "iddiiddiip\0" "glMap2d\0" "\0" - /* _mesa_function_pool[26051]: Map2f (offset 223) */ + /* _mesa_function_pool[26090]: Map2f (offset 223) */ "iffiiffiip\0" "glMap2f\0" "\0" - /* _mesa_function_pool[26071]: ProgramStringARB (will be remapped) */ + /* _mesa_function_pool[26110]: ProgramStringARB (will be remapped) */ "iiip\0" "glProgramStringARB\0" "\0" - /* _mesa_function_pool[26096]: Vertex4s (offset 148) */ + /* _mesa_function_pool[26135]: Vertex4s (offset 148) */ "iiii\0" "glVertex4s\0" "\0" - /* _mesa_function_pool[26113]: TexCoord4fVertex4fvSUN (dynamic) */ + /* _mesa_function_pool[26152]: TexCoord4fVertex4fvSUN (dynamic) */ "pp\0" "glTexCoord4fVertex4fvSUN\0" "\0" - /* _mesa_function_pool[26142]: FragmentLightModelivSGIX (dynamic) */ + /* _mesa_function_pool[26181]: FragmentLightModelivSGIX (dynamic) */ "ip\0" "glFragmentLightModelivSGIX\0" "\0" - /* _mesa_function_pool[26173]: VertexAttrib1fNV (will be remapped) */ + /* _mesa_function_pool[26212]: VertexAttrib1fNV (will be remapped) */ "if\0" "glVertexAttrib1fNV\0" "\0" - /* _mesa_function_pool[26196]: Vertex4f (offset 144) */ + /* _mesa_function_pool[26235]: Vertex4f (offset 144) */ "ffff\0" "glVertex4f\0" "\0" - /* _mesa_function_pool[26213]: EvalCoord1d (offset 228) */ + /* _mesa_function_pool[26252]: EvalCoord1d (offset 228) */ "d\0" "glEvalCoord1d\0" "\0" - /* _mesa_function_pool[26230]: Vertex4d (offset 142) */ + /* _mesa_function_pool[26269]: Vertex4d (offset 142) */ "dddd\0" "glVertex4d\0" "\0" - /* _mesa_function_pool[26247]: RasterPos4dv (offset 79) */ + /* _mesa_function_pool[26286]: RasterPos4dv (offset 79) */ "p\0" "glRasterPos4dv\0" "\0" - /* _mesa_function_pool[26265]: FragmentLightfSGIX (dynamic) */ + /* _mesa_function_pool[26304]: FragmentLightfSGIX (dynamic) */ "iif\0" "glFragmentLightfSGIX\0" "\0" - /* _mesa_function_pool[26291]: GetCompressedTexImageARB (will be remapped) */ + /* _mesa_function_pool[26330]: GetCompressedTexImageARB (will be remapped) */ "iip\0" "glGetCompressedTexImage\0" "glGetCompressedTexImageARB\0" "\0" - /* _mesa_function_pool[26347]: GetTexGenfv (offset 279) */ + /* _mesa_function_pool[26386]: GetTexGenfv (offset 279) */ "iip\0" "glGetTexGenfv\0" "\0" - /* _mesa_function_pool[26366]: Vertex4i (offset 146) */ + /* _mesa_function_pool[26405]: Vertex4i (offset 146) */ "iiii\0" "glVertex4i\0" "\0" - /* _mesa_function_pool[26383]: VertexWeightPointerEXT (dynamic) */ + /* _mesa_function_pool[26422]: VertexWeightPointerEXT (dynamic) */ "iiip\0" "glVertexWeightPointerEXT\0" "\0" - /* _mesa_function_pool[26414]: GetHistogram (offset 361) */ + /* _mesa_function_pool[26453]: GetHistogram (offset 361) */ "iiiip\0" "glGetHistogram\0" "glGetHistogramEXT\0" "\0" - /* _mesa_function_pool[26454]: ActiveStencilFaceEXT (will be remapped) */ + /* _mesa_function_pool[26493]: ActiveStencilFaceEXT (will be remapped) */ "i\0" "glActiveStencilFaceEXT\0" "\0" - /* _mesa_function_pool[26480]: StencilFuncSeparateATI (will be remapped) */ + /* _mesa_function_pool[26519]: StencilFuncSeparateATI (will be remapped) */ "iiii\0" "glStencilFuncSeparateATI\0" "\0" - /* _mesa_function_pool[26511]: Materialf (offset 169) */ + /* _mesa_function_pool[26550]: Materialf (offset 169) */ "iif\0" "glMaterialf\0" "\0" - /* _mesa_function_pool[26528]: GetShaderSourceARB (will be remapped) */ + /* _mesa_function_pool[26567]: GetShaderSourceARB (will be remapped) */ "iipp\0" "glGetShaderSource\0" "glGetShaderSourceARB\0" "\0" - /* _mesa_function_pool[26573]: IglooInterfaceSGIX (dynamic) */ + /* _mesa_function_pool[26612]: IglooInterfaceSGIX (dynamic) */ "ip\0" "glIglooInterfaceSGIX\0" "\0" - /* _mesa_function_pool[26598]: Materiali (offset 171) */ + /* _mesa_function_pool[26637]: Materiali (offset 171) */ "iii\0" "glMateriali\0" "\0" - /* _mesa_function_pool[26615]: VertexAttrib4dNV (will be remapped) */ + /* _mesa_function_pool[26654]: VertexAttrib4dNV (will be remapped) */ "idddd\0" "glVertexAttrib4dNV\0" "\0" - /* _mesa_function_pool[26641]: MultiModeDrawElementsIBM (will be remapped) */ + /* _mesa_function_pool[26680]: MultiModeDrawElementsIBM (will be remapped) */ "ppipii\0" "glMultiModeDrawElementsIBM\0" "\0" - /* _mesa_function_pool[26676]: Indexsv (offset 51) */ + /* _mesa_function_pool[26715]: Indexsv (offset 51) */ "p\0" "glIndexsv\0" "\0" - /* _mesa_function_pool[26689]: MultiTexCoord4svARB (offset 407) */ + /* _mesa_function_pool[26728]: MultiTexCoord4svARB (offset 407) */ "ip\0" "glMultiTexCoord4sv\0" "glMultiTexCoord4svARB\0" "\0" - /* _mesa_function_pool[26734]: LightModelfv (offset 164) */ + /* _mesa_function_pool[26773]: LightModelfv (offset 164) */ "ip\0" "glLightModelfv\0" "\0" - /* _mesa_function_pool[26753]: TexCoord2dv (offset 103) */ + /* _mesa_function_pool[26792]: TexCoord2dv (offset 103) */ "p\0" "glTexCoord2dv\0" "\0" - /* _mesa_function_pool[26770]: GenQueriesARB (will be remapped) */ + /* _mesa_function_pool[26809]: GenQueriesARB (will be remapped) */ "ip\0" "glGenQueries\0" "glGenQueriesARB\0" "\0" - /* _mesa_function_pool[26803]: EvalCoord1dv (offset 229) */ + /* _mesa_function_pool[26842]: EvalCoord1dv (offset 229) */ "p\0" "glEvalCoord1dv\0" "\0" - /* _mesa_function_pool[26821]: ReplacementCodeuiVertex3fSUN (dynamic) */ + /* _mesa_function_pool[26860]: ReplacementCodeuiVertex3fSUN (dynamic) */ "ifff\0" "glReplacementCodeuiVertex3fSUN\0" "\0" - /* _mesa_function_pool[26858]: Translated (offset 303) */ + /* _mesa_function_pool[26897]: Translated (offset 303) */ "ddd\0" "glTranslated\0" "\0" - /* _mesa_function_pool[26876]: Translatef (offset 304) */ + /* _mesa_function_pool[26915]: Translatef (offset 304) */ "fff\0" "glTranslatef\0" "\0" - /* _mesa_function_pool[26894]: StencilMask (offset 209) */ + /* _mesa_function_pool[26933]: StencilMask (offset 209) */ "i\0" "glStencilMask\0" "\0" - /* _mesa_function_pool[26911]: Tangent3iEXT (dynamic) */ + /* _mesa_function_pool[26950]: Tangent3iEXT (dynamic) */ "iii\0" "glTangent3iEXT\0" "\0" - /* _mesa_function_pool[26931]: GetLightiv (offset 265) */ + /* _mesa_function_pool[26970]: GetLightiv (offset 265) */ "iip\0" "glGetLightiv\0" "\0" - /* _mesa_function_pool[26949]: DrawMeshArraysSUN (dynamic) */ + /* _mesa_function_pool[26988]: DrawMeshArraysSUN (dynamic) */ "iiii\0" "glDrawMeshArraysSUN\0" "\0" - /* _mesa_function_pool[26975]: IsList (offset 287) */ + /* _mesa_function_pool[27014]: IsList (offset 287) */ "i\0" "glIsList\0" "\0" - /* _mesa_function_pool[26987]: IsSync (will be remapped) */ + /* _mesa_function_pool[27026]: IsSync (will be remapped) */ "i\0" "glIsSync\0" "\0" - /* _mesa_function_pool[26999]: RenderMode (offset 196) */ + /* _mesa_function_pool[27038]: RenderMode (offset 196) */ "i\0" "glRenderMode\0" "\0" - /* _mesa_function_pool[27015]: GetMapControlPointsNV (dynamic) */ + /* _mesa_function_pool[27054]: GetMapControlPointsNV (dynamic) */ "iiiiiip\0" "glGetMapControlPointsNV\0" "\0" - /* _mesa_function_pool[27048]: DrawBuffersARB (will be remapped) */ + /* _mesa_function_pool[27087]: DrawBuffersARB (will be remapped) */ "ip\0" "glDrawBuffers\0" "glDrawBuffersARB\0" "glDrawBuffersATI\0" "\0" - /* _mesa_function_pool[27100]: ProgramLocalParameter4fARB (will be remapped) */ + /* _mesa_function_pool[27139]: ProgramLocalParameter4fARB (will be remapped) */ "iiffff\0" "glProgramLocalParameter4fARB\0" "\0" - /* _mesa_function_pool[27137]: SpriteParameterivSGIX (dynamic) */ + /* _mesa_function_pool[27176]: SpriteParameterivSGIX (dynamic) */ "ip\0" "glSpriteParameterivSGIX\0" "\0" - /* _mesa_function_pool[27165]: ProvokingVertexEXT (will be remapped) */ + /* _mesa_function_pool[27204]: ProvokingVertexEXT (will be remapped) */ "i\0" "glProvokingVertexEXT\0" "glProvokingVertex\0" "\0" - /* _mesa_function_pool[27207]: MultiTexCoord1fARB (offset 378) */ + /* _mesa_function_pool[27246]: MultiTexCoord1fARB (offset 378) */ "if\0" "glMultiTexCoord1f\0" "glMultiTexCoord1fARB\0" "\0" - /* _mesa_function_pool[27250]: LoadName (offset 198) */ + /* _mesa_function_pool[27289]: LoadName (offset 198) */ "i\0" "glLoadName\0" "\0" - /* _mesa_function_pool[27264]: VertexAttribs4ubvNV (will be remapped) */ + /* _mesa_function_pool[27303]: VertexAttribs4ubvNV (will be remapped) */ "iip\0" "glVertexAttribs4ubvNV\0" "\0" - /* _mesa_function_pool[27291]: WeightsvARB (dynamic) */ + /* _mesa_function_pool[27330]: WeightsvARB (dynamic) */ "ip\0" "glWeightsvARB\0" "\0" - /* _mesa_function_pool[27309]: Uniform1fvARB (will be remapped) */ + /* _mesa_function_pool[27348]: Uniform1fvARB (will be remapped) */ "iip\0" "glUniform1fv\0" "glUniform1fvARB\0" "\0" - /* _mesa_function_pool[27343]: CopyTexSubImage1D (offset 325) */ + /* _mesa_function_pool[27382]: CopyTexSubImage1D (offset 325) */ "iiiiii\0" "glCopyTexSubImage1D\0" "glCopyTexSubImage1DEXT\0" "\0" - /* _mesa_function_pool[27394]: CullFace (offset 152) */ + /* _mesa_function_pool[27433]: CullFace (offset 152) */ "i\0" "glCullFace\0" "\0" - /* _mesa_function_pool[27408]: BindTexture (offset 307) */ + /* _mesa_function_pool[27447]: BindTexture (offset 307) */ "ii\0" "glBindTexture\0" "glBindTextureEXT\0" "\0" - /* _mesa_function_pool[27443]: BeginFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[27482]: BeginFragmentShaderATI (will be remapped) */ "\0" "glBeginFragmentShaderATI\0" "\0" - /* _mesa_function_pool[27470]: MultiTexCoord4fARB (offset 402) */ + /* _mesa_function_pool[27509]: MultiTexCoord4fARB (offset 402) */ "iffff\0" "glMultiTexCoord4f\0" "glMultiTexCoord4fARB\0" "\0" - /* _mesa_function_pool[27516]: VertexAttribs3svNV (will be remapped) */ + /* _mesa_function_pool[27555]: VertexAttribs3svNV (will be remapped) */ "iip\0" "glVertexAttribs3svNV\0" "\0" - /* _mesa_function_pool[27542]: StencilFunc (offset 243) */ + /* _mesa_function_pool[27581]: StencilFunc (offset 243) */ "iii\0" "glStencilFunc\0" "\0" - /* _mesa_function_pool[27561]: CopyPixels (offset 255) */ + /* _mesa_function_pool[27600]: CopyPixels (offset 255) */ "iiiii\0" "glCopyPixels\0" "\0" - /* _mesa_function_pool[27581]: Rectsv (offset 93) */ + /* _mesa_function_pool[27620]: Rectsv (offset 93) */ "pp\0" "glRectsv\0" "\0" - /* _mesa_function_pool[27594]: ReplacementCodeuivSUN (dynamic) */ + /* _mesa_function_pool[27633]: ReplacementCodeuivSUN (dynamic) */ "p\0" "glReplacementCodeuivSUN\0" "\0" - /* _mesa_function_pool[27621]: EnableVertexAttribArrayARB (will be remapped) */ + /* _mesa_function_pool[27660]: EnableVertexAttribArrayARB (will be remapped) */ "i\0" "glEnableVertexAttribArray\0" "glEnableVertexAttribArrayARB\0" "\0" - /* _mesa_function_pool[27679]: NormalPointervINTEL (dynamic) */ + /* _mesa_function_pool[27718]: NormalPointervINTEL (dynamic) */ "ip\0" "glNormalPointervINTEL\0" "\0" - /* _mesa_function_pool[27705]: CopyConvolutionFilter2D (offset 355) */ + /* _mesa_function_pool[27744]: CopyConvolutionFilter2D (offset 355) */ "iiiiii\0" "glCopyConvolutionFilter2D\0" "glCopyConvolutionFilter2DEXT\0" "\0" - /* _mesa_function_pool[27768]: WindowPos3ivMESA (will be remapped) */ + /* _mesa_function_pool[27807]: WindowPos3ivMESA (will be remapped) */ "p\0" "glWindowPos3iv\0" "glWindowPos3ivARB\0" "glWindowPos3ivMESA\0" "\0" - /* _mesa_function_pool[27823]: CopyBufferSubData (will be remapped) */ + /* _mesa_function_pool[27862]: CopyBufferSubData (will be remapped) */ "iiiii\0" "glCopyBufferSubData\0" "\0" - /* _mesa_function_pool[27850]: NormalPointer (offset 318) */ + /* _mesa_function_pool[27889]: NormalPointer (offset 318) */ "iip\0" "glNormalPointer\0" "\0" - /* _mesa_function_pool[27871]: TexParameterfv (offset 179) */ + /* _mesa_function_pool[27910]: TexParameterfv (offset 179) */ "iip\0" "glTexParameterfv\0" "\0" - /* _mesa_function_pool[27893]: IsBufferARB (will be remapped) */ + /* _mesa_function_pool[27932]: IsBufferARB (will be remapped) */ "i\0" "glIsBuffer\0" "glIsBufferARB\0" "\0" - /* _mesa_function_pool[27921]: WindowPos4iMESA (will be remapped) */ + /* _mesa_function_pool[27960]: WindowPos4iMESA (will be remapped) */ "iiii\0" "glWindowPos4iMESA\0" "\0" - /* _mesa_function_pool[27945]: VertexAttrib4uivARB (will be remapped) */ + /* _mesa_function_pool[27984]: VertexAttrib4uivARB (will be remapped) */ "ip\0" "glVertexAttrib4uiv\0" "glVertexAttrib4uivARB\0" "\0" - /* _mesa_function_pool[27990]: Tangent3bvEXT (dynamic) */ + /* _mesa_function_pool[28029]: Tangent3bvEXT (dynamic) */ "p\0" "glTangent3bvEXT\0" "\0" - /* _mesa_function_pool[28009]: UniformMatrix3x4fv (will be remapped) */ + /* _mesa_function_pool[28048]: UniformMatrix3x4fv (will be remapped) */ "iiip\0" "glUniformMatrix3x4fv\0" "\0" - /* _mesa_function_pool[28036]: ClipPlane (offset 150) */ + /* _mesa_function_pool[28075]: ClipPlane (offset 150) */ "ip\0" "glClipPlane\0" "\0" - /* _mesa_function_pool[28052]: Recti (offset 90) */ + /* _mesa_function_pool[28091]: Recti (offset 90) */ "iiii\0" "glRecti\0" "\0" - /* _mesa_function_pool[28066]: DrawRangeElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[28105]: DrawRangeElementsBaseVertex (will be remapped) */ "iiiiipi\0" "glDrawRangeElementsBaseVertex\0" "\0" - /* _mesa_function_pool[28105]: TexCoordPointervINTEL (dynamic) */ + /* _mesa_function_pool[28144]: TexCoordPointervINTEL (dynamic) */ "iip\0" "glTexCoordPointervINTEL\0" "\0" - /* _mesa_function_pool[28134]: DeleteBuffersARB (will be remapped) */ + /* _mesa_function_pool[28173]: DeleteBuffersARB (will be remapped) */ "ip\0" "glDeleteBuffers\0" "glDeleteBuffersARB\0" "\0" - /* _mesa_function_pool[28173]: PixelTransformParameterfvEXT (dynamic) */ + /* _mesa_function_pool[28212]: PixelTransformParameterfvEXT (dynamic) */ "iip\0" "glPixelTransformParameterfvEXT\0" "\0" - /* _mesa_function_pool[28209]: WindowPos4fvMESA (will be remapped) */ + /* _mesa_function_pool[28248]: WindowPos4fvMESA (will be remapped) */ "p\0" "glWindowPos4fvMESA\0" "\0" - /* _mesa_function_pool[28231]: GetPixelMapuiv (offset 272) */ + /* _mesa_function_pool[28270]: GetPixelMapuiv (offset 272) */ "ip\0" "glGetPixelMapuiv\0" "\0" - /* _mesa_function_pool[28252]: Rectf (offset 88) */ + /* _mesa_function_pool[28291]: Rectf (offset 88) */ "ffff\0" "glRectf\0" "\0" - /* _mesa_function_pool[28266]: VertexAttrib1sNV (will be remapped) */ + /* _mesa_function_pool[28305]: VertexAttrib1sNV (will be remapped) */ "ii\0" "glVertexAttrib1sNV\0" "\0" - /* _mesa_function_pool[28289]: Indexfv (offset 47) */ + /* _mesa_function_pool[28328]: Indexfv (offset 47) */ "p\0" "glIndexfv\0" "\0" - /* _mesa_function_pool[28302]: SecondaryColor3svEXT (will be remapped) */ + /* _mesa_function_pool[28341]: SecondaryColor3svEXT (will be remapped) */ "p\0" "glSecondaryColor3sv\0" "glSecondaryColor3svEXT\0" "\0" - /* _mesa_function_pool[28348]: LoadTransposeMatrixfARB (will be remapped) */ + /* _mesa_function_pool[28387]: LoadTransposeMatrixfARB (will be remapped) */ "p\0" "glLoadTransposeMatrixf\0" "glLoadTransposeMatrixfARB\0" "\0" - /* _mesa_function_pool[28400]: GetPointerv (offset 329) */ + /* _mesa_function_pool[28439]: GetPointerv (offset 329) */ "ip\0" "glGetPointerv\0" "glGetPointervEXT\0" "\0" - /* _mesa_function_pool[28435]: Tangent3bEXT (dynamic) */ + /* _mesa_function_pool[28474]: Tangent3bEXT (dynamic) */ "iii\0" "glTangent3bEXT\0" "\0" - /* _mesa_function_pool[28455]: CombinerParameterfNV (will be remapped) */ + /* _mesa_function_pool[28494]: CombinerParameterfNV (will be remapped) */ "if\0" "glCombinerParameterfNV\0" "\0" - /* _mesa_function_pool[28482]: IndexMask (offset 212) */ + /* _mesa_function_pool[28521]: IndexMask (offset 212) */ "i\0" "glIndexMask\0" "\0" - /* _mesa_function_pool[28497]: BindProgramNV (will be remapped) */ + /* _mesa_function_pool[28536]: BindProgramNV (will be remapped) */ "ii\0" "glBindProgramARB\0" "glBindProgramNV\0" "\0" - /* _mesa_function_pool[28534]: VertexAttrib4svARB (will be remapped) */ + /* _mesa_function_pool[28573]: VertexAttrib4svARB (will be remapped) */ "ip\0" "glVertexAttrib4sv\0" "glVertexAttrib4svARB\0" "\0" - /* _mesa_function_pool[28577]: GetFloatv (offset 262) */ + /* _mesa_function_pool[28616]: GetFloatv (offset 262) */ "ip\0" "glGetFloatv\0" "\0" - /* _mesa_function_pool[28593]: CreateDebugObjectMESA (dynamic) */ + /* _mesa_function_pool[28632]: CreateDebugObjectMESA (dynamic) */ "\0" "glCreateDebugObjectMESA\0" "\0" - /* _mesa_function_pool[28619]: GetShaderiv (will be remapped) */ + /* _mesa_function_pool[28658]: GetShaderiv (will be remapped) */ "iip\0" "glGetShaderiv\0" "\0" - /* _mesa_function_pool[28638]: ClientWaitSync (will be remapped) */ + /* _mesa_function_pool[28677]: ClientWaitSync (will be remapped) */ "iii\0" "glClientWaitSync\0" "\0" - /* _mesa_function_pool[28660]: TexCoord4s (offset 124) */ + /* _mesa_function_pool[28699]: TexCoord4s (offset 124) */ "iiii\0" "glTexCoord4s\0" "\0" - /* _mesa_function_pool[28679]: TexCoord3sv (offset 117) */ + /* _mesa_function_pool[28718]: TexCoord3sv (offset 117) */ "p\0" "glTexCoord3sv\0" "\0" - /* _mesa_function_pool[28696]: BindFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[28735]: BindFragmentShaderATI (will be remapped) */ "i\0" "glBindFragmentShaderATI\0" "\0" - /* _mesa_function_pool[28723]: PopAttrib (offset 218) */ + /* _mesa_function_pool[28762]: PopAttrib (offset 218) */ "\0" "glPopAttrib\0" "\0" - /* _mesa_function_pool[28737]: Fogfv (offset 154) */ + /* _mesa_function_pool[28776]: Fogfv (offset 154) */ "ip\0" "glFogfv\0" "\0" - /* _mesa_function_pool[28749]: UnmapBufferARB (will be remapped) */ + /* _mesa_function_pool[28788]: UnmapBufferARB (will be remapped) */ "i\0" "glUnmapBuffer\0" "glUnmapBufferARB\0" "\0" - /* _mesa_function_pool[28783]: InitNames (offset 197) */ + /* _mesa_function_pool[28822]: InitNames (offset 197) */ "\0" "glInitNames\0" "\0" - /* _mesa_function_pool[28797]: Normal3sv (offset 61) */ + /* _mesa_function_pool[28836]: Normal3sv (offset 61) */ "p\0" "glNormal3sv\0" "\0" - /* _mesa_function_pool[28812]: Minmax (offset 368) */ + /* _mesa_function_pool[28851]: Minmax (offset 368) */ "iii\0" "glMinmax\0" "glMinmaxEXT\0" "\0" - /* _mesa_function_pool[28838]: TexCoord4d (offset 118) */ + /* _mesa_function_pool[28877]: TexCoord4d (offset 118) */ "dddd\0" "glTexCoord4d\0" "\0" - /* _mesa_function_pool[28857]: DeformationMap3dSGIX (dynamic) */ - "iddiiddiiddiip\0" - "glDeformationMap3dSGIX\0" - "\0" /* _mesa_function_pool[28896]: TexCoord4f (offset 120) */ "ffff\0" "glTexCoord4f\0" @@ -4468,534 +4468,532 @@ static const char _mesa_function_pool[] = /* these functions need to be remapped */ static const struct gl_function_pool_remap MESA_remap_table_functions[] = { - { 1461, AttachShader_remap_index }, - { 8995, CreateProgram_remap_index }, - { 21153, CreateShader_remap_index }, - { 23466, DeleteProgram_remap_index }, - { 16937, DeleteShader_remap_index }, - { 21599, DetachShader_remap_index }, - { 16461, GetAttachedShaders_remap_index }, - { 4275, GetProgramInfoLog_remap_index }, - { 361, GetProgramiv_remap_index }, - { 5721, GetShaderInfoLog_remap_index }, - { 28619, GetShaderiv_remap_index }, - { 12198, IsProgram_remap_index }, - { 11197, IsShader_remap_index }, - { 9099, StencilFuncSeparate_remap_index }, - { 3487, StencilMaskSeparate_remap_index }, - { 6803, StencilOpSeparate_remap_index }, - { 20478, UniformMatrix2x3fv_remap_index }, - { 2615, UniformMatrix2x4fv_remap_index }, + { 1500, AttachShader_remap_index }, + { 9034, CreateProgram_remap_index }, + { 21160, CreateShader_remap_index }, + { 23473, DeleteProgram_remap_index }, + { 16944, DeleteShader_remap_index }, + { 21606, DetachShader_remap_index }, + { 16468, GetAttachedShaders_remap_index }, + { 4314, GetProgramInfoLog_remap_index }, + { 400, GetProgramiv_remap_index }, + { 5760, GetShaderInfoLog_remap_index }, + { 28658, GetShaderiv_remap_index }, + { 12276, IsProgram_remap_index }, + { 11275, IsShader_remap_index }, + { 9138, StencilFuncSeparate_remap_index }, + { 3526, StencilMaskSeparate_remap_index }, + { 6842, StencilOpSeparate_remap_index }, + { 20485, UniformMatrix2x3fv_remap_index }, + { 2654, UniformMatrix2x4fv_remap_index }, { 30286, UniformMatrix3x2fv_remap_index }, - { 28009, UniformMatrix3x4fv_remap_index }, - { 14961, UniformMatrix4x2fv_remap_index }, - { 2937, UniformMatrix4x3fv_remap_index }, - { 14622, DrawArraysInstanced_remap_index }, - { 15725, DrawElementsInstanced_remap_index }, - { 9013, LoadTransposeMatrixdARB_remap_index }, - { 28348, LoadTransposeMatrixfARB_remap_index }, - { 4904, MultTransposeMatrixdARB_remap_index }, - { 21786, MultTransposeMatrixfARB_remap_index }, - { 172, SampleCoverageARB_remap_index }, - { 5117, CompressedTexImage1DARB_remap_index }, - { 22269, CompressedTexImage2DARB_remap_index }, - { 3550, CompressedTexImage3DARB_remap_index }, - { 16753, CompressedTexSubImage1DARB_remap_index }, - { 1880, CompressedTexSubImage2DARB_remap_index }, - { 18614, CompressedTexSubImage3DARB_remap_index }, - { 26291, GetCompressedTexImageARB_remap_index }, - { 3395, DisableVertexAttribArrayARB_remap_index }, - { 27621, EnableVertexAttribArrayARB_remap_index }, + { 28048, UniformMatrix3x4fv_remap_index }, + { 14968, UniformMatrix4x2fv_remap_index }, + { 2976, UniformMatrix4x3fv_remap_index }, + { 14629, DrawArraysInstanced_remap_index }, + { 15732, DrawElementsInstanced_remap_index }, + { 9052, LoadTransposeMatrixdARB_remap_index }, + { 28387, LoadTransposeMatrixfARB_remap_index }, + { 4972, MultTransposeMatrixdARB_remap_index }, + { 21793, MultTransposeMatrixfARB_remap_index }, + { 211, SampleCoverageARB_remap_index }, + { 5156, CompressedTexImage1DARB_remap_index }, + { 22276, CompressedTexImage2DARB_remap_index }, + { 3589, CompressedTexImage3DARB_remap_index }, + { 16760, CompressedTexSubImage1DARB_remap_index }, + { 1919, CompressedTexSubImage2DARB_remap_index }, + { 18621, CompressedTexSubImage3DARB_remap_index }, + { 26330, GetCompressedTexImageARB_remap_index }, + { 3434, DisableVertexAttribArrayARB_remap_index }, + { 27660, EnableVertexAttribArrayARB_remap_index }, { 29462, GetProgramEnvParameterdvARB_remap_index }, - { 21666, GetProgramEnvParameterfvARB_remap_index }, - { 25290, GetProgramLocalParameterdvARB_remap_index }, - { 7245, GetProgramLocalParameterfvARB_remap_index }, - { 16844, GetProgramStringARB_remap_index }, - { 25485, GetProgramivARB_remap_index }, - { 18809, GetVertexAttribdvARB_remap_index }, - { 14850, GetVertexAttribfvARB_remap_index }, - { 8908, GetVertexAttribivARB_remap_index }, - { 17690, ProgramEnvParameter4dARB_remap_index }, - { 23239, ProgramEnvParameter4dvARB_remap_index }, - { 15458, ProgramEnvParameter4fARB_remap_index }, - { 8108, ProgramEnvParameter4fvARB_remap_index }, - { 3513, ProgramLocalParameter4dARB_remap_index }, - { 11908, ProgramLocalParameter4dvARB_remap_index }, - { 27100, ProgramLocalParameter4fARB_remap_index }, - { 23819, ProgramLocalParameter4fvARB_remap_index }, - { 26071, ProgramStringARB_remap_index }, - { 17940, VertexAttrib1dARB_remap_index }, - { 14426, VertexAttrib1dvARB_remap_index }, - { 3688, VertexAttrib1fARB_remap_index }, + { 21673, GetProgramEnvParameterfvARB_remap_index }, + { 25329, GetProgramLocalParameterdvARB_remap_index }, + { 7284, GetProgramLocalParameterfvARB_remap_index }, + { 16851, GetProgramStringARB_remap_index }, + { 25524, GetProgramivARB_remap_index }, + { 18816, GetVertexAttribdvARB_remap_index }, + { 14857, GetVertexAttribfvARB_remap_index }, + { 8947, GetVertexAttribivARB_remap_index }, + { 17697, ProgramEnvParameter4dARB_remap_index }, + { 23246, ProgramEnvParameter4dvARB_remap_index }, + { 15465, ProgramEnvParameter4fARB_remap_index }, + { 8147, ProgramEnvParameter4fvARB_remap_index }, + { 3552, ProgramLocalParameter4dARB_remap_index }, + { 11986, ProgramLocalParameter4dvARB_remap_index }, + { 27139, ProgramLocalParameter4fARB_remap_index }, + { 23826, ProgramLocalParameter4fvARB_remap_index }, + { 26110, ProgramStringARB_remap_index }, + { 17947, VertexAttrib1dARB_remap_index }, + { 14433, VertexAttrib1dvARB_remap_index }, + { 3727, VertexAttrib1fARB_remap_index }, { 30367, VertexAttrib1fvARB_remap_index }, - { 6329, VertexAttrib1sARB_remap_index }, - { 2054, VertexAttrib1svARB_remap_index }, - { 13857, VertexAttrib2dARB_remap_index }, - { 16080, VertexAttrib2dvARB_remap_index }, - { 1480, VertexAttrib2fARB_remap_index }, - { 16193, VertexAttrib2fvARB_remap_index }, + { 6368, VertexAttrib1sARB_remap_index }, + { 2093, VertexAttrib1svARB_remap_index }, + { 13864, VertexAttrib2dARB_remap_index }, + { 16087, VertexAttrib2dvARB_remap_index }, + { 1519, VertexAttrib2fARB_remap_index }, + { 16200, VertexAttrib2fvARB_remap_index }, { 29993, VertexAttrib2sARB_remap_index }, { 29099, VertexAttrib2svARB_remap_index }, - { 10282, VertexAttrib3dARB_remap_index }, - { 7811, VertexAttrib3dvARB_remap_index }, - { 1567, VertexAttrib3fARB_remap_index }, - { 20741, VertexAttrib3fvARB_remap_index }, - { 25918, VertexAttrib3sARB_remap_index }, - { 18551, VertexAttrib3svARB_remap_index }, - { 4301, VertexAttrib4NbvARB_remap_index }, - { 16416, VertexAttrib4NivARB_remap_index }, - { 20696, VertexAttrib4NsvARB_remap_index }, - { 21618, VertexAttrib4NubARB_remap_index }, + { 10321, VertexAttrib3dARB_remap_index }, + { 7850, VertexAttrib3dvARB_remap_index }, + { 1606, VertexAttrib3fARB_remap_index }, + { 20748, VertexAttrib3fvARB_remap_index }, + { 25957, VertexAttrib3sARB_remap_index }, + { 18558, VertexAttrib3svARB_remap_index }, + { 4340, VertexAttrib4NbvARB_remap_index }, + { 16423, VertexAttrib4NivARB_remap_index }, + { 20703, VertexAttrib4NsvARB_remap_index }, + { 21625, VertexAttrib4NubARB_remap_index }, { 29345, VertexAttrib4NubvARB_remap_index }, - { 17351, VertexAttrib4NuivARB_remap_index }, - { 2810, VertexAttrib4NusvARB_remap_index }, - { 9876, VertexAttrib4bvARB_remap_index }, - { 24698, VertexAttrib4dARB_remap_index }, - { 19573, VertexAttrib4dvARB_remap_index }, - { 10389, VertexAttrib4fARB_remap_index }, - { 10793, VertexAttrib4fvARB_remap_index }, - { 9292, VertexAttrib4ivARB_remap_index }, - { 15894, VertexAttrib4sARB_remap_index }, - { 28534, VertexAttrib4svARB_remap_index }, - { 15263, VertexAttrib4ubvARB_remap_index }, - { 27945, VertexAttrib4uivARB_remap_index }, - { 18362, VertexAttrib4usvARB_remap_index }, - { 20327, VertexAttribPointerARB_remap_index }, + { 17358, VertexAttrib4NuivARB_remap_index }, + { 2849, VertexAttrib4NusvARB_remap_index }, + { 9915, VertexAttrib4bvARB_remap_index }, + { 24737, VertexAttrib4dARB_remap_index }, + { 19580, VertexAttrib4dvARB_remap_index }, + { 10428, VertexAttrib4fARB_remap_index }, + { 10832, VertexAttrib4fvARB_remap_index }, + { 9331, VertexAttrib4ivARB_remap_index }, + { 15901, VertexAttrib4sARB_remap_index }, + { 28573, VertexAttrib4svARB_remap_index }, + { 15270, VertexAttrib4ubvARB_remap_index }, + { 27984, VertexAttrib4uivARB_remap_index }, + { 18369, VertexAttrib4usvARB_remap_index }, + { 20334, VertexAttribPointerARB_remap_index }, { 30127, BindBufferARB_remap_index }, - { 6036, BufferDataARB_remap_index }, - { 1382, BufferSubDataARB_remap_index }, - { 28134, DeleteBuffersARB_remap_index }, + { 6075, BufferDataARB_remap_index }, + { 1421, BufferSubDataARB_remap_index }, + { 28173, DeleteBuffersARB_remap_index }, { 30410, GenBuffersARB_remap_index }, - { 16236, GetBufferParameterivARB_remap_index }, - { 15410, GetBufferPointervARB_remap_index }, - { 1335, GetBufferSubDataARB_remap_index }, - { 27893, IsBufferARB_remap_index }, - { 24303, MapBufferARB_remap_index }, - { 28749, UnmapBufferARB_remap_index }, - { 268, BeginQueryARB_remap_index }, - { 18035, DeleteQueriesARB_remap_index }, - { 11087, EndQueryARB_remap_index }, - { 26770, GenQueriesARB_remap_index }, - { 1772, GetQueryObjectivARB_remap_index }, - { 15938, GetQueryObjectuivARB_remap_index }, - { 1624, GetQueryivARB_remap_index }, - { 18269, IsQueryARB_remap_index }, - { 7421, AttachObjectARB_remap_index }, - { 16899, CompileShaderARB_remap_index }, - { 2879, CreateProgramObjectARB_remap_index }, - { 5981, CreateShaderObjectARB_remap_index }, - { 13274, DeleteObjectARB_remap_index }, - { 22060, DetachObjectARB_remap_index }, - { 10865, GetActiveUniformARB_remap_index }, - { 8583, GetAttachedObjectsARB_remap_index }, - { 8890, GetHandleARB_remap_index }, + { 16243, GetBufferParameterivARB_remap_index }, + { 15417, GetBufferPointervARB_remap_index }, + { 1374, GetBufferSubDataARB_remap_index }, + { 27932, IsBufferARB_remap_index }, + { 24310, MapBufferARB_remap_index }, + { 28788, UnmapBufferARB_remap_index }, + { 307, BeginQueryARB_remap_index }, + { 18042, DeleteQueriesARB_remap_index }, + { 11126, EndQueryARB_remap_index }, + { 26809, GenQueriesARB_remap_index }, + { 1811, GetQueryObjectivARB_remap_index }, + { 15945, GetQueryObjectuivARB_remap_index }, + { 1663, GetQueryivARB_remap_index }, + { 18276, IsQueryARB_remap_index }, + { 7460, AttachObjectARB_remap_index }, + { 16906, CompileShaderARB_remap_index }, + { 2918, CreateProgramObjectARB_remap_index }, + { 6020, CreateShaderObjectARB_remap_index }, + { 13281, DeleteObjectARB_remap_index }, + { 22067, DetachObjectARB_remap_index }, + { 10904, GetActiveUniformARB_remap_index }, + { 8622, GetAttachedObjectsARB_remap_index }, + { 8929, GetHandleARB_remap_index }, { 30160, GetInfoLogARB_remap_index }, { 29416, GetObjectParameterfvARB_remap_index }, - { 25164, GetObjectParameterivARB_remap_index }, - { 26528, GetShaderSourceARB_remap_index }, - { 25778, GetUniformLocationARB_remap_index }, - { 21888, GetUniformfvARB_remap_index }, - { 11530, GetUniformivARB_remap_index }, - { 18407, LinkProgramARB_remap_index }, - { 18465, ShaderSourceARB_remap_index }, - { 6703, Uniform1fARB_remap_index }, - { 27309, Uniform1fvARB_remap_index }, - { 20296, Uniform1iARB_remap_index }, - { 19262, Uniform1ivARB_remap_index }, - { 2003, Uniform2fARB_remap_index }, - { 13110, Uniform2fvARB_remap_index }, - { 24190, Uniform2iARB_remap_index }, - { 2123, Uniform2ivARB_remap_index }, - { 17009, Uniform3fARB_remap_index }, - { 8613, Uniform3fvARB_remap_index }, - { 5627, Uniform3iARB_remap_index }, - { 15516, Uniform3ivARB_remap_index }, - { 17496, Uniform4fARB_remap_index }, - { 21752, Uniform4fvARB_remap_index }, - { 22918, Uniform4iARB_remap_index }, - { 18775, Uniform4ivARB_remap_index }, - { 7473, UniformMatrix2fvARB_remap_index }, + { 25203, GetObjectParameterivARB_remap_index }, + { 26567, GetShaderSourceARB_remap_index }, + { 25817, GetUniformLocationARB_remap_index }, + { 21895, GetUniformfvARB_remap_index }, + { 11608, GetUniformivARB_remap_index }, + { 18414, LinkProgramARB_remap_index }, + { 18472, ShaderSourceARB_remap_index }, + { 6742, Uniform1fARB_remap_index }, + { 27348, Uniform1fvARB_remap_index }, + { 20303, Uniform1iARB_remap_index }, + { 19269, Uniform1ivARB_remap_index }, + { 2042, Uniform2fARB_remap_index }, + { 13117, Uniform2fvARB_remap_index }, + { 24197, Uniform2iARB_remap_index }, + { 2162, Uniform2ivARB_remap_index }, + { 17016, Uniform3fARB_remap_index }, + { 8652, Uniform3fvARB_remap_index }, + { 5666, Uniform3iARB_remap_index }, + { 15523, Uniform3ivARB_remap_index }, + { 17503, Uniform4fARB_remap_index }, + { 21759, Uniform4fvARB_remap_index }, + { 22925, Uniform4iARB_remap_index }, + { 18782, Uniform4ivARB_remap_index }, + { 7512, UniformMatrix2fvARB_remap_index }, { 17, UniformMatrix3fvARB_remap_index }, - { 2475, UniformMatrix4fvARB_remap_index }, - { 23351, UseProgramObjectARB_remap_index }, - { 13545, ValidateProgramARB_remap_index }, - { 19616, BindAttribLocationARB_remap_index }, - { 4346, GetActiveAttribARB_remap_index }, - { 15197, GetAttribLocationARB_remap_index }, - { 27048, DrawBuffersARB_remap_index }, - { 12013, RenderbufferStorageMultisample_remap_index }, - { 12417, FramebufferTextureARB_remap_index }, - { 23721, FramebufferTextureFaceARB_remap_index }, - { 22209, ProgramParameteriARB_remap_index }, - { 17544, FlushMappedBufferRange_remap_index }, - { 25581, MapBufferRange_remap_index }, - { 15072, BindVertexArray_remap_index }, - { 13404, GenVertexArrays_remap_index }, - { 27823, CopyBufferSubData_remap_index }, - { 28638, ClientWaitSync_remap_index }, - { 2394, DeleteSync_remap_index }, - { 6370, FenceSync_remap_index }, - { 13916, GetInteger64v_remap_index }, - { 20803, GetSynciv_remap_index }, - { 26987, IsSync_remap_index }, - { 8531, WaitSync_remap_index }, - { 3363, DrawElementsBaseVertex_remap_index }, - { 28066, DrawRangeElementsBaseVertex_remap_index }, - { 24334, MultiDrawElementsBaseVertex_remap_index }, - { 4480, BindTransformFeedback_remap_index }, - { 2906, DeleteTransformFeedbacks_remap_index }, - { 5660, DrawTransformFeedback_remap_index }, - { 8750, GenTransformFeedbacks_remap_index }, - { 25961, IsTransformFeedback_remap_index }, - { 23914, PauseTransformFeedback_remap_index }, - { 4824, ResumeTransformFeedback_remap_index }, - { 4739, PolygonOffsetEXT_remap_index }, - { 21388, GetPixelTexGenParameterfvSGIS_remap_index }, - { 3895, GetPixelTexGenParameterivSGIS_remap_index }, - { 21121, PixelTexGenParameterfSGIS_remap_index }, - { 580, PixelTexGenParameterfvSGIS_remap_index }, - { 11568, PixelTexGenParameteriSGIS_remap_index }, - { 12591, PixelTexGenParameterivSGIS_remap_index }, - { 15160, SampleMaskSGIS_remap_index }, - { 18209, SamplePatternSGIS_remap_index }, - { 24263, ColorPointerEXT_remap_index }, - { 16123, EdgeFlagPointerEXT_remap_index }, - { 5281, IndexPointerEXT_remap_index }, - { 5361, NormalPointerEXT_remap_index }, - { 14510, TexCoordPointerEXT_remap_index }, - { 6159, VertexPointerEXT_remap_index }, - { 3165, PointParameterfEXT_remap_index }, - { 7010, PointParameterfvEXT_remap_index }, + { 2514, UniformMatrix4fvARB_remap_index }, + { 23358, UseProgramObjectARB_remap_index }, + { 13552, ValidateProgramARB_remap_index }, + { 19623, BindAttribLocationARB_remap_index }, + { 4385, GetActiveAttribARB_remap_index }, + { 15204, GetAttribLocationARB_remap_index }, + { 27087, DrawBuffersARB_remap_index }, + { 12091, RenderbufferStorageMultisample_remap_index }, + { 12495, FramebufferTextureARB_remap_index }, + { 23728, FramebufferTextureFaceARB_remap_index }, + { 22216, ProgramParameteriARB_remap_index }, + { 17551, FlushMappedBufferRange_remap_index }, + { 25620, MapBufferRange_remap_index }, + { 15079, BindVertexArray_remap_index }, + { 13411, GenVertexArrays_remap_index }, + { 27862, CopyBufferSubData_remap_index }, + { 28677, ClientWaitSync_remap_index }, + { 2433, DeleteSync_remap_index }, + { 6409, FenceSync_remap_index }, + { 13923, GetInteger64v_remap_index }, + { 20810, GetSynciv_remap_index }, + { 27026, IsSync_remap_index }, + { 8570, WaitSync_remap_index }, + { 3402, DrawElementsBaseVertex_remap_index }, + { 28105, DrawRangeElementsBaseVertex_remap_index }, + { 24341, MultiDrawElementsBaseVertex_remap_index }, + { 4519, BindTransformFeedback_remap_index }, + { 2945, DeleteTransformFeedbacks_remap_index }, + { 5699, DrawTransformFeedback_remap_index }, + { 8789, GenTransformFeedbacks_remap_index }, + { 26000, IsTransformFeedback_remap_index }, + { 23921, PauseTransformFeedback_remap_index }, + { 4892, ResumeTransformFeedback_remap_index }, + { 4807, PolygonOffsetEXT_remap_index }, + { 21395, GetPixelTexGenParameterfvSGIS_remap_index }, + { 3934, GetPixelTexGenParameterivSGIS_remap_index }, + { 21128, PixelTexGenParameterfSGIS_remap_index }, + { 619, PixelTexGenParameterfvSGIS_remap_index }, + { 11646, PixelTexGenParameteriSGIS_remap_index }, + { 12637, PixelTexGenParameterivSGIS_remap_index }, + { 15167, SampleMaskSGIS_remap_index }, + { 18216, SamplePatternSGIS_remap_index }, + { 24270, ColorPointerEXT_remap_index }, + { 16130, EdgeFlagPointerEXT_remap_index }, + { 5320, IndexPointerEXT_remap_index }, + { 5400, NormalPointerEXT_remap_index }, + { 14517, TexCoordPointerEXT_remap_index }, + { 6198, VertexPointerEXT_remap_index }, + { 3204, PointParameterfEXT_remap_index }, + { 7049, PointParameterfvEXT_remap_index }, { 29514, LockArraysEXT_remap_index }, - { 13609, UnlockArraysEXT_remap_index }, - { 8017, CullParameterdvEXT_remap_index }, - { 10660, CullParameterfvEXT_remap_index }, - { 1151, SecondaryColor3bEXT_remap_index }, - { 7169, SecondaryColor3bvEXT_remap_index }, - { 9469, SecondaryColor3dEXT_remap_index }, - { 23524, SecondaryColor3dvEXT_remap_index }, - { 25827, SecondaryColor3fEXT_remap_index }, - { 16689, SecondaryColor3fvEXT_remap_index }, - { 426, SecondaryColor3iEXT_remap_index }, - { 14898, SecondaryColor3ivEXT_remap_index }, - { 9127, SecondaryColor3sEXT_remap_index }, - { 28302, SecondaryColor3svEXT_remap_index }, - { 25000, SecondaryColor3ubEXT_remap_index }, - { 19507, SecondaryColor3ubvEXT_remap_index }, - { 11763, SecondaryColor3uiEXT_remap_index }, - { 21008, SecondaryColor3uivEXT_remap_index }, - { 23771, SecondaryColor3usEXT_remap_index }, - { 11836, SecondaryColor3usvEXT_remap_index }, - { 10736, SecondaryColorPointerEXT_remap_index }, - { 23585, MultiDrawArraysEXT_remap_index }, - { 19197, MultiDrawElementsEXT_remap_index }, - { 19392, FogCoordPointerEXT_remap_index }, - { 4044, FogCoorddEXT_remap_index }, + { 13616, UnlockArraysEXT_remap_index }, + { 1190, SecondaryColor3bEXT_remap_index }, + { 7208, SecondaryColor3bvEXT_remap_index }, + { 9508, SecondaryColor3dEXT_remap_index }, + { 23531, SecondaryColor3dvEXT_remap_index }, + { 25866, SecondaryColor3fEXT_remap_index }, + { 16696, SecondaryColor3fvEXT_remap_index }, + { 465, SecondaryColor3iEXT_remap_index }, + { 14905, SecondaryColor3ivEXT_remap_index }, + { 9166, SecondaryColor3sEXT_remap_index }, + { 28341, SecondaryColor3svEXT_remap_index }, + { 25039, SecondaryColor3ubEXT_remap_index }, + { 19514, SecondaryColor3ubvEXT_remap_index }, + { 11841, SecondaryColor3uiEXT_remap_index }, + { 21015, SecondaryColor3uivEXT_remap_index }, + { 23778, SecondaryColor3usEXT_remap_index }, + { 11914, SecondaryColor3usvEXT_remap_index }, + { 10775, SecondaryColorPointerEXT_remap_index }, + { 23592, MultiDrawArraysEXT_remap_index }, + { 19204, MultiDrawElementsEXT_remap_index }, + { 19399, FogCoordPointerEXT_remap_index }, + { 4083, FogCoorddEXT_remap_index }, { 28915, FogCoorddvEXT_remap_index }, - { 4136, FogCoordfEXT_remap_index }, - { 24923, FogCoordfvEXT_remap_index }, - { 17448, PixelTexGenSGIX_remap_index }, - { 25508, BlendFuncSeparateEXT_remap_index }, - { 6071, FlushVertexArrayRangeNV_remap_index }, - { 4688, VertexArrayRangeNV_remap_index }, - { 25892, CombinerInputNV_remap_index }, - { 1946, CombinerOutputNV_remap_index }, - { 28455, CombinerParameterfNV_remap_index }, - { 4608, CombinerParameterfvNV_remap_index }, - { 20527, CombinerParameteriNV_remap_index }, + { 4175, FogCoordfEXT_remap_index }, + { 24962, FogCoordfvEXT_remap_index }, + { 17455, PixelTexGenSGIX_remap_index }, + { 25547, BlendFuncSeparateEXT_remap_index }, + { 6110, FlushVertexArrayRangeNV_remap_index }, + { 4756, VertexArrayRangeNV_remap_index }, + { 25931, CombinerInputNV_remap_index }, + { 1985, CombinerOutputNV_remap_index }, + { 28494, CombinerParameterfNV_remap_index }, + { 4676, CombinerParameterfvNV_remap_index }, + { 20534, CombinerParameteriNV_remap_index }, { 29885, CombinerParameterivNV_remap_index }, - { 6447, FinalCombinerInputNV_remap_index }, - { 8956, GetCombinerInputParameterfvNV_remap_index }, + { 6486, FinalCombinerInputNV_remap_index }, + { 8995, GetCombinerInputParameterfvNV_remap_index }, { 29722, GetCombinerInputParameterivNV_remap_index }, - { 12692, GetCombinerOutputParameterfvNV_remap_index }, - { 12520, GetCombinerOutputParameterivNV_remap_index }, - { 5816, GetFinalCombinerInputParameterfvNV_remap_index }, - { 22790, GetFinalCombinerInputParameterivNV_remap_index }, - { 11508, ResizeBuffersMESA_remap_index }, - { 10109, WindowPos2dMESA_remap_index }, - { 944, WindowPos2dvMESA_remap_index }, + { 172, GetCombinerOutputParameterfvNV_remap_index }, + { 12598, GetCombinerOutputParameterivNV_remap_index }, + { 5855, GetFinalCombinerInputParameterfvNV_remap_index }, + { 22797, GetFinalCombinerInputParameterivNV_remap_index }, + { 11586, ResizeBuffersMESA_remap_index }, + { 10148, WindowPos2dMESA_remap_index }, + { 983, WindowPos2dvMESA_remap_index }, { 30713, WindowPos2fMESA_remap_index }, - { 7114, WindowPos2fvMESA_remap_index }, - { 16636, WindowPos2iMESA_remap_index }, - { 18682, WindowPos2ivMESA_remap_index }, - { 19296, WindowPos2sMESA_remap_index }, - { 5031, WindowPos2svMESA_remap_index }, - { 6939, WindowPos3dMESA_remap_index }, - { 12838, WindowPos3dvMESA_remap_index }, - { 472, WindowPos3fMESA_remap_index }, - { 13670, WindowPos3fvMESA_remap_index }, - { 22102, WindowPos3iMESA_remap_index }, - { 27768, WindowPos3ivMESA_remap_index }, - { 17154, WindowPos3sMESA_remap_index }, + { 7153, WindowPos2fvMESA_remap_index }, + { 16643, WindowPos2iMESA_remap_index }, + { 18689, WindowPos2ivMESA_remap_index }, + { 19303, WindowPos2sMESA_remap_index }, + { 5070, WindowPos2svMESA_remap_index }, + { 6978, WindowPos3dMESA_remap_index }, + { 12845, WindowPos3dvMESA_remap_index }, + { 511, WindowPos3fMESA_remap_index }, + { 13677, WindowPos3fvMESA_remap_index }, + { 22109, WindowPos3iMESA_remap_index }, + { 27807, WindowPos3ivMESA_remap_index }, + { 17161, WindowPos3sMESA_remap_index }, { 29171, WindowPos3svMESA_remap_index }, - { 10060, WindowPos4dMESA_remap_index }, - { 15601, WindowPos4dvMESA_remap_index }, - { 12797, WindowPos4fMESA_remap_index }, - { 28209, WindowPos4fvMESA_remap_index }, - { 27921, WindowPos4iMESA_remap_index }, - { 11311, WindowPos4ivMESA_remap_index }, - { 17327, WindowPos4sMESA_remap_index }, - { 2857, WindowPos4svMESA_remap_index }, - { 12559, MultiModeDrawArraysIBM_remap_index }, - { 26641, MultiModeDrawElementsIBM_remap_index }, - { 11115, DeleteFencesNV_remap_index }, - { 25739, FinishFenceNV_remap_index }, - { 3287, GenFencesNV_remap_index }, - { 15581, GetFenceivNV_remap_index }, - { 7406, IsFenceNV_remap_index }, - { 12447, SetFenceNV_remap_index }, - { 3744, TestFenceNV_remap_index }, + { 10099, WindowPos4dMESA_remap_index }, + { 15608, WindowPos4dvMESA_remap_index }, + { 12804, WindowPos4fMESA_remap_index }, + { 28248, WindowPos4fvMESA_remap_index }, + { 27960, WindowPos4iMESA_remap_index }, + { 11389, WindowPos4ivMESA_remap_index }, + { 17334, WindowPos4sMESA_remap_index }, + { 2896, WindowPos4svMESA_remap_index }, + { 24705, MultiModeDrawArraysIBM_remap_index }, + { 26680, MultiModeDrawElementsIBM_remap_index }, + { 11154, DeleteFencesNV_remap_index }, + { 25778, FinishFenceNV_remap_index }, + { 3326, GenFencesNV_remap_index }, + { 15588, GetFenceivNV_remap_index }, + { 7445, IsFenceNV_remap_index }, + { 12525, SetFenceNV_remap_index }, + { 3783, TestFenceNV_remap_index }, { 29142, AreProgramsResidentNV_remap_index }, - { 28497, BindProgramNV_remap_index }, - { 23854, DeleteProgramsNV_remap_index }, - { 19725, ExecuteProgramNV_remap_index }, + { 28536, BindProgramNV_remap_index }, + { 23861, DeleteProgramsNV_remap_index }, + { 19732, ExecuteProgramNV_remap_index }, { 30606, GenProgramsNV_remap_index }, - { 21467, GetProgramParameterdvNV_remap_index }, - { 9531, GetProgramParameterfvNV_remap_index }, - { 24237, GetProgramStringNV_remap_index }, - { 22479, GetProgramivNV_remap_index }, - { 21701, GetTrackMatrixivNV_remap_index }, - { 24031, GetVertexAttribPointervNV_remap_index }, - { 22723, GetVertexAttribdvNV_remap_index }, - { 8426, GetVertexAttribfvNV_remap_index }, - { 16817, GetVertexAttribivNV_remap_index }, - { 17574, IsProgramNV_remap_index }, - { 8509, LoadProgramNV_remap_index }, - { 25604, ProgramParameters4dvNV_remap_index }, - { 22409, ProgramParameters4fvNV_remap_index }, - { 18986, RequestResidentProgramsNV_remap_index }, - { 20505, TrackMatrixNV_remap_index }, + { 21474, GetProgramParameterdvNV_remap_index }, + { 9570, GetProgramParameterfvNV_remap_index }, + { 24244, GetProgramStringNV_remap_index }, + { 22486, GetProgramivNV_remap_index }, + { 21708, GetTrackMatrixivNV_remap_index }, + { 24038, GetVertexAttribPointervNV_remap_index }, + { 22730, GetVertexAttribdvNV_remap_index }, + { 8465, GetVertexAttribfvNV_remap_index }, + { 16824, GetVertexAttribivNV_remap_index }, + { 17581, IsProgramNV_remap_index }, + { 8548, LoadProgramNV_remap_index }, + { 25643, ProgramParameters4dvNV_remap_index }, + { 22416, ProgramParameters4fvNV_remap_index }, + { 18993, RequestResidentProgramsNV_remap_index }, + { 20512, TrackMatrixNV_remap_index }, { 29699, VertexAttrib1dNV_remap_index }, - { 12358, VertexAttrib1dvNV_remap_index }, - { 26173, VertexAttrib1fNV_remap_index }, - { 2245, VertexAttrib1fvNV_remap_index }, - { 28266, VertexAttrib1sNV_remap_index }, - { 13743, VertexAttrib1svNV_remap_index }, - { 4251, VertexAttrib2dNV_remap_index }, - { 12273, VertexAttrib2dvNV_remap_index }, - { 18441, VertexAttrib2fNV_remap_index }, - { 11884, VertexAttrib2fvNV_remap_index }, - { 5191, VertexAttrib2sNV_remap_index }, - { 17208, VertexAttrib2svNV_remap_index }, - { 10257, VertexAttrib3dNV_remap_index }, + { 12436, VertexAttrib1dvNV_remap_index }, + { 26212, VertexAttrib1fNV_remap_index }, + { 2284, VertexAttrib1fvNV_remap_index }, + { 28305, VertexAttrib1sNV_remap_index }, + { 13750, VertexAttrib1svNV_remap_index }, + { 4290, VertexAttrib2dNV_remap_index }, + { 12351, VertexAttrib2dvNV_remap_index }, + { 18448, VertexAttrib2fNV_remap_index }, + { 11962, VertexAttrib2fvNV_remap_index }, + { 5230, VertexAttrib2sNV_remap_index }, + { 17215, VertexAttrib2svNV_remap_index }, + { 10296, VertexAttrib3dNV_remap_index }, { 29392, VertexAttrib3dvNV_remap_index }, - { 9343, VertexAttrib3fNV_remap_index }, - { 22750, VertexAttrib3fvNV_remap_index }, - { 20382, VertexAttrib3sNV_remap_index }, - { 21728, VertexAttrib3svNV_remap_index }, - { 26615, VertexAttrib4dNV_remap_index }, + { 9382, VertexAttrib3fNV_remap_index }, + { 22757, VertexAttrib3fvNV_remap_index }, + { 20389, VertexAttrib3sNV_remap_index }, + { 21735, VertexAttrib3svNV_remap_index }, + { 26654, VertexAttrib4dNV_remap_index }, { 30643, VertexAttrib4dvNV_remap_index }, - { 3945, VertexAttrib4fNV_remap_index }, - { 8559, VertexAttrib4fvNV_remap_index }, - { 24582, VertexAttrib4sNV_remap_index }, - { 1293, VertexAttrib4svNV_remap_index }, - { 4409, VertexAttrib4ubNV_remap_index }, - { 734, VertexAttrib4ubvNV_remap_index }, - { 19905, VertexAttribPointerNV_remap_index }, - { 2097, VertexAttribs1dvNV_remap_index }, - { 24119, VertexAttribs1fvNV_remap_index }, + { 3984, VertexAttrib4fNV_remap_index }, + { 8598, VertexAttrib4fvNV_remap_index }, + { 24589, VertexAttrib4sNV_remap_index }, + { 1332, VertexAttrib4svNV_remap_index }, + { 4448, VertexAttrib4ubNV_remap_index }, + { 773, VertexAttrib4ubvNV_remap_index }, + { 19912, VertexAttribPointerNV_remap_index }, + { 2136, VertexAttribs1dvNV_remap_index }, + { 24126, VertexAttribs1fvNV_remap_index }, { 30443, VertexAttribs1svNV_remap_index }, - { 9368, VertexAttribs2dvNV_remap_index }, - { 23312, VertexAttribs2fvNV_remap_index }, - { 16149, VertexAttribs2svNV_remap_index }, - { 4636, VertexAttribs3dvNV_remap_index }, - { 1977, VertexAttribs3fvNV_remap_index }, - { 27516, VertexAttribs3svNV_remap_index }, - { 24672, VertexAttribs4dvNV_remap_index }, - { 4662, VertexAttribs4fvNV_remap_index }, + { 9407, VertexAttribs2dvNV_remap_index }, + { 23319, VertexAttribs2fvNV_remap_index }, + { 16156, VertexAttribs2svNV_remap_index }, + { 4704, VertexAttribs3dvNV_remap_index }, + { 2016, VertexAttribs3fvNV_remap_index }, + { 27555, VertexAttribs3svNV_remap_index }, + { 24679, VertexAttribs4dvNV_remap_index }, + { 4730, VertexAttribs4fvNV_remap_index }, { 30230, VertexAttribs4svNV_remap_index }, - { 27264, VertexAttribs4ubvNV_remap_index }, - { 24742, GetTexBumpParameterfvATI_remap_index }, + { 27303, VertexAttribs4ubvNV_remap_index }, + { 24781, GetTexBumpParameterfvATI_remap_index }, { 30484, GetTexBumpParameterivATI_remap_index }, - { 16871, TexBumpParameterfvATI_remap_index }, - { 18857, TexBumpParameterivATI_remap_index }, - { 14289, AlphaFragmentOp1ATI_remap_index }, - { 9919, AlphaFragmentOp2ATI_remap_index }, - { 22666, AlphaFragmentOp3ATI_remap_index }, - { 27443, BeginFragmentShaderATI_remap_index }, - { 28696, BindFragmentShaderATI_remap_index }, - { 21857, ColorFragmentOp1ATI_remap_index }, - { 3823, ColorFragmentOp2ATI_remap_index }, + { 16878, TexBumpParameterfvATI_remap_index }, + { 18864, TexBumpParameterivATI_remap_index }, + { 14296, AlphaFragmentOp1ATI_remap_index }, + { 9958, AlphaFragmentOp2ATI_remap_index }, + { 22673, AlphaFragmentOp3ATI_remap_index }, + { 27482, BeginFragmentShaderATI_remap_index }, + { 28735, BindFragmentShaderATI_remap_index }, + { 21864, ColorFragmentOp1ATI_remap_index }, + { 3862, ColorFragmentOp2ATI_remap_index }, { 29037, ColorFragmentOp3ATI_remap_index }, - { 4781, DeleteFragmentShaderATI_remap_index }, + { 4849, DeleteFragmentShaderATI_remap_index }, { 30667, EndFragmentShaderATI_remap_index }, { 29913, GenFragmentShadersATI_remap_index }, - { 23443, PassTexCoordATI_remap_index }, - { 6139, SampleMapATI_remap_index }, - { 5912, SetFragmentShaderConstantATI_remap_index }, - { 319, PointParameteriNV_remap_index }, - { 12999, PointParameterivNV_remap_index }, - { 26454, ActiveStencilFaceEXT_remap_index }, - { 25264, BindVertexArrayAPPLE_remap_index }, - { 2522, DeleteVertexArraysAPPLE_remap_index }, - { 16488, GenVertexArraysAPPLE_remap_index }, - { 21532, IsVertexArrayAPPLE_remap_index }, - { 775, GetProgramNamedParameterdvNV_remap_index }, - { 3128, GetProgramNamedParameterfvNV_remap_index }, - { 24773, ProgramNamedParameter4dNV_remap_index }, - { 13325, ProgramNamedParameter4dvNV_remap_index }, - { 8042, ProgramNamedParameter4fNV_remap_index }, - { 10701, ProgramNamedParameter4fvNV_remap_index }, - { 22388, DepthBoundsEXT_remap_index }, - { 1043, BlendEquationSeparateEXT_remap_index }, - { 13444, BindFramebufferEXT_remap_index }, - { 23630, BindRenderbufferEXT_remap_index }, - { 8806, CheckFramebufferStatusEXT_remap_index }, - { 20822, DeleteFramebuffersEXT_remap_index }, + { 23450, PassTexCoordATI_remap_index }, + { 6178, SampleMapATI_remap_index }, + { 5951, SetFragmentShaderConstantATI_remap_index }, + { 358, PointParameteriNV_remap_index }, + { 13006, PointParameterivNV_remap_index }, + { 26493, ActiveStencilFaceEXT_remap_index }, + { 25303, BindVertexArrayAPPLE_remap_index }, + { 2561, DeleteVertexArraysAPPLE_remap_index }, + { 16495, GenVertexArraysAPPLE_remap_index }, + { 21539, IsVertexArrayAPPLE_remap_index }, + { 814, GetProgramNamedParameterdvNV_remap_index }, + { 3167, GetProgramNamedParameterfvNV_remap_index }, + { 24812, ProgramNamedParameter4dNV_remap_index }, + { 13332, ProgramNamedParameter4dvNV_remap_index }, + { 8081, ProgramNamedParameter4fNV_remap_index }, + { 10740, ProgramNamedParameter4fvNV_remap_index }, + { 22395, DepthBoundsEXT_remap_index }, + { 1082, BlendEquationSeparateEXT_remap_index }, + { 13451, BindFramebufferEXT_remap_index }, + { 23637, BindRenderbufferEXT_remap_index }, + { 8845, CheckFramebufferStatusEXT_remap_index }, + { 20829, DeleteFramebuffersEXT_remap_index }, { 29294, DeleteRenderbuffersEXT_remap_index }, - { 12297, FramebufferRenderbufferEXT_remap_index }, - { 12464, FramebufferTexture1DEXT_remap_index }, - { 10495, FramebufferTexture2DEXT_remap_index }, - { 10162, FramebufferTexture3DEXT_remap_index }, - { 21424, GenFramebuffersEXT_remap_index }, - { 16035, GenRenderbuffersEXT_remap_index }, - { 5858, GenerateMipmapEXT_remap_index }, - { 20002, GetFramebufferAttachmentParameterivEXT_remap_index }, + { 12375, FramebufferRenderbufferEXT_remap_index }, + { 12542, FramebufferTexture1DEXT_remap_index }, + { 10534, FramebufferTexture2DEXT_remap_index }, + { 10201, FramebufferTexture3DEXT_remap_index }, + { 21431, GenFramebuffersEXT_remap_index }, + { 16042, GenRenderbuffersEXT_remap_index }, + { 5897, GenerateMipmapEXT_remap_index }, + { 20009, GetFramebufferAttachmentParameterivEXT_remap_index }, { 29819, GetRenderbufferParameterivEXT_remap_index }, - { 18737, IsFramebufferEXT_remap_index }, + { 18744, IsFramebufferEXT_remap_index }, { 30566, IsRenderbufferEXT_remap_index }, - { 7353, RenderbufferStorageEXT_remap_index }, - { 651, BlitFramebufferEXT_remap_index }, - { 13144, BufferParameteriAPPLE_remap_index }, - { 17606, FlushMappedBufferRangeAPPLE_remap_index }, - { 2701, FramebufferTextureLayerEXT_remap_index }, - { 4956, ColorMaskIndexedEXT_remap_index }, - { 17232, DisableIndexedEXT_remap_index }, - { 24429, EnableIndexedEXT_remap_index }, - { 19973, GetBooleanIndexedvEXT_remap_index }, - { 9952, GetIntegerIndexedvEXT_remap_index }, - { 20898, IsEnabledIndexedEXT_remap_index }, - { 4074, BeginConditionalRenderNV_remap_index }, - { 23416, EndConditionalRenderNV_remap_index }, - { 8453, BeginTransformFeedbackEXT_remap_index }, - { 17256, BindBufferBaseEXT_remap_index }, - { 17126, BindBufferOffsetEXT_remap_index }, - { 11136, BindBufferRangeEXT_remap_index }, - { 13059, EndTransformFeedbackEXT_remap_index }, - { 9804, GetTransformFeedbackVaryingEXT_remap_index }, - { 19042, TransformFeedbackVaryingsEXT_remap_index }, - { 27165, ProvokingVertexEXT_remap_index }, - { 9752, GetTexParameterPointervAPPLE_remap_index }, - { 4436, TextureRangeAPPLE_remap_index }, - { 10567, GetObjectParameterivAPPLE_remap_index }, - { 18181, ObjectPurgeableAPPLE_remap_index }, - { 4985, ObjectUnpurgeableAPPLE_remap_index }, - { 26480, StencilFuncSeparateATI_remap_index }, - { 16555, ProgramEnvParameters4fvEXT_remap_index }, - { 19936, ProgramLocalParameters4fvEXT_remap_index }, - { 12927, GetQueryObjecti64vEXT_remap_index }, - { 9394, GetQueryObjectui64vEXT_remap_index }, - { 21926, EGLImageTargetRenderbufferStorageOES_remap_index }, - { 11054, EGLImageTargetTexture2DOES_remap_index }, + { 7392, RenderbufferStorageEXT_remap_index }, + { 690, BlitFramebufferEXT_remap_index }, + { 13151, BufferParameteriAPPLE_remap_index }, + { 17613, FlushMappedBufferRangeAPPLE_remap_index }, + { 2740, FramebufferTextureLayerEXT_remap_index }, + { 4613, ColorMaskIndexedEXT_remap_index }, + { 17239, DisableIndexedEXT_remap_index }, + { 24436, EnableIndexedEXT_remap_index }, + { 19980, GetBooleanIndexedvEXT_remap_index }, + { 9991, GetIntegerIndexedvEXT_remap_index }, + { 20905, IsEnabledIndexedEXT_remap_index }, + { 4113, BeginConditionalRenderNV_remap_index }, + { 23423, EndConditionalRenderNV_remap_index }, + { 8492, BeginTransformFeedbackEXT_remap_index }, + { 17263, BindBufferBaseEXT_remap_index }, + { 17133, BindBufferOffsetEXT_remap_index }, + { 11214, BindBufferRangeEXT_remap_index }, + { 13066, EndTransformFeedbackEXT_remap_index }, + { 9843, GetTransformFeedbackVaryingEXT_remap_index }, + { 19049, TransformFeedbackVaryingsEXT_remap_index }, + { 27204, ProvokingVertexEXT_remap_index }, + { 9791, GetTexParameterPointervAPPLE_remap_index }, + { 4475, TextureRangeAPPLE_remap_index }, + { 10606, GetObjectParameterivAPPLE_remap_index }, + { 18188, ObjectPurgeableAPPLE_remap_index }, + { 5024, ObjectUnpurgeableAPPLE_remap_index }, + { 26519, StencilFuncSeparateATI_remap_index }, + { 16562, ProgramEnvParameters4fvEXT_remap_index }, + { 19943, ProgramLocalParameters4fvEXT_remap_index }, + { 12934, GetQueryObjecti64vEXT_remap_index }, + { 9433, GetQueryObjectui64vEXT_remap_index }, + { 21933, EGLImageTargetRenderbufferStorageOES_remap_index }, + { 11093, EGLImageTargetTexture2DOES_remap_index }, { -1, -1 } }; /* these functions are in the ABI, but have alternative names */ static const struct gl_function_remap MESA_alt_functions[] = { /* from GL_EXT_blend_color */ - { 2440, _gloffset_BlendColor }, + { 2479, _gloffset_BlendColor }, /* from GL_EXT_blend_minmax */ - { 10219, _gloffset_BlendEquation }, + { 10258, _gloffset_BlendEquation }, /* from GL_EXT_color_subtable */ - { 15623, _gloffset_ColorSubTable }, + { 15630, _gloffset_ColorSubTable }, { 29226, _gloffset_CopyColorSubTable }, /* from GL_EXT_convolution */ - { 213, _gloffset_ConvolutionFilter1D }, - { 2284, _gloffset_CopyConvolutionFilter1D }, - { 3624, _gloffset_GetConvolutionParameteriv }, - { 7702, _gloffset_ConvolutionFilter2D }, - { 7868, _gloffset_ConvolutionParameteriv }, - { 8328, _gloffset_ConvolutionParameterfv }, - { 18885, _gloffset_GetSeparableFilter }, - { 22156, _gloffset_SeparableFilter2D }, - { 22968, _gloffset_ConvolutionParameteri }, - { 23091, _gloffset_ConvolutionParameterf }, - { 24608, _gloffset_GetConvolutionParameterfv }, - { 25430, _gloffset_GetConvolutionFilter }, - { 27705, _gloffset_CopyConvolutionFilter2D }, + { 252, _gloffset_ConvolutionFilter1D }, + { 2323, _gloffset_CopyConvolutionFilter1D }, + { 3663, _gloffset_GetConvolutionParameteriv }, + { 7741, _gloffset_ConvolutionFilter2D }, + { 7907, _gloffset_ConvolutionParameteriv }, + { 8367, _gloffset_ConvolutionParameterfv }, + { 18892, _gloffset_GetSeparableFilter }, + { 22163, _gloffset_SeparableFilter2D }, + { 22975, _gloffset_ConvolutionParameteri }, + { 23098, _gloffset_ConvolutionParameterf }, + { 24615, _gloffset_GetConvolutionParameterfv }, + { 25469, _gloffset_GetConvolutionFilter }, + { 27744, _gloffset_CopyConvolutionFilter2D }, /* from GL_EXT_copy_texture */ - { 13803, _gloffset_CopyTexSubImage3D }, - { 15363, _gloffset_CopyTexImage2D }, - { 22576, _gloffset_CopyTexImage1D }, - { 25111, _gloffset_CopyTexSubImage2D }, - { 27343, _gloffset_CopyTexSubImage1D }, + { 13810, _gloffset_CopyTexSubImage3D }, + { 15370, _gloffset_CopyTexImage2D }, + { 22583, _gloffset_CopyTexImage1D }, + { 25150, _gloffset_CopyTexSubImage2D }, + { 27382, _gloffset_CopyTexSubImage1D }, /* from GL_EXT_draw_range_elements */ - { 8665, _gloffset_DrawRangeElements }, + { 8704, _gloffset_DrawRangeElements }, /* from GL_EXT_histogram */ - { 812, _gloffset_Histogram }, - { 3088, _gloffset_ResetHistogram }, - { 9065, _gloffset_GetMinmax }, - { 14137, _gloffset_GetHistogramParameterfv }, - { 22501, _gloffset_GetMinmaxParameteriv }, - { 24498, _gloffset_ResetMinmax }, - { 25327, _gloffset_GetHistogramParameteriv }, - { 26414, _gloffset_GetHistogram }, - { 28812, _gloffset_Minmax }, + { 851, _gloffset_Histogram }, + { 3127, _gloffset_ResetHistogram }, + { 9104, _gloffset_GetMinmax }, + { 14144, _gloffset_GetHistogramParameterfv }, + { 22508, _gloffset_GetMinmaxParameteriv }, + { 24505, _gloffset_ResetMinmax }, + { 25366, _gloffset_GetHistogramParameteriv }, + { 26453, _gloffset_GetHistogram }, + { 28851, _gloffset_Minmax }, { 30313, _gloffset_GetMinmaxParameterfv }, /* from GL_EXT_paletted_texture */ - { 7564, _gloffset_ColorTable }, - { 13983, _gloffset_GetColorTable }, - { 21171, _gloffset_GetColorTableParameterfv }, - { 23147, _gloffset_GetColorTableParameteriv }, + { 7603, _gloffset_ColorTable }, + { 13990, _gloffset_GetColorTable }, + { 21178, _gloffset_GetColorTableParameterfv }, + { 23154, _gloffset_GetColorTableParameteriv }, /* from GL_EXT_subtexture */ - { 6285, _gloffset_TexSubImage1D }, - { 9679, _gloffset_TexSubImage2D }, + { 6324, _gloffset_TexSubImage1D }, + { 9718, _gloffset_TexSubImage2D }, /* from GL_EXT_texture3D */ - { 1658, _gloffset_TexImage3D }, - { 20940, _gloffset_TexSubImage3D }, + { 1697, _gloffset_TexImage3D }, + { 20947, _gloffset_TexSubImage3D }, /* from GL_EXT_texture_object */ - { 2964, _gloffset_PrioritizeTextures }, - { 6734, _gloffset_AreTexturesResident }, - { 12382, _gloffset_GenTextures }, - { 14469, _gloffset_DeleteTextures }, - { 17887, _gloffset_IsTexture }, - { 27408, _gloffset_BindTexture }, + { 3003, _gloffset_PrioritizeTextures }, + { 6773, _gloffset_AreTexturesResident }, + { 12460, _gloffset_GenTextures }, + { 14476, _gloffset_DeleteTextures }, + { 17894, _gloffset_IsTexture }, + { 27447, _gloffset_BindTexture }, /* from GL_EXT_vertex_array */ - { 22328, _gloffset_ArrayElement }, - { 28400, _gloffset_GetPointerv }, + { 22335, _gloffset_ArrayElement }, + { 28439, _gloffset_GetPointerv }, { 29940, _gloffset_DrawArrays }, /* from GL_SGI_color_table */ - { 6852, _gloffset_ColorTableParameteriv }, - { 7564, _gloffset_ColorTable }, - { 13983, _gloffset_GetColorTable }, - { 14093, _gloffset_CopyColorTable }, - { 17748, _gloffset_ColorTableParameterfv }, - { 21171, _gloffset_GetColorTableParameterfv }, - { 23147, _gloffset_GetColorTableParameteriv }, + { 6891, _gloffset_ColorTableParameteriv }, + { 7603, _gloffset_ColorTable }, + { 13990, _gloffset_GetColorTable }, + { 14100, _gloffset_CopyColorTable }, + { 17755, _gloffset_ColorTableParameterfv }, + { 21178, _gloffset_GetColorTableParameterfv }, + { 23154, _gloffset_GetColorTableParameteriv }, /* from GL_VERSION_1_3 */ - { 381, _gloffset_MultiTexCoord3sARB }, - { 613, _gloffset_ActiveTextureARB }, - { 3761, _gloffset_MultiTexCoord1fvARB }, - { 5386, _gloffset_MultiTexCoord3dARB }, - { 5431, _gloffset_MultiTexCoord2iARB }, - { 5555, _gloffset_MultiTexCoord2svARB }, - { 7520, _gloffset_MultiTexCoord2fARB }, - { 9424, _gloffset_MultiTexCoord3fvARB }, - { 9981, _gloffset_MultiTexCoord4sARB }, - { 10615, _gloffset_MultiTexCoord2dvARB }, - { 10997, _gloffset_MultiTexCoord1svARB }, - { 11369, _gloffset_MultiTexCoord3svARB }, - { 11430, _gloffset_MultiTexCoord4iARB }, - { 12153, _gloffset_MultiTexCoord3iARB }, - { 12956, _gloffset_MultiTexCoord1dARB }, - { 13173, _gloffset_MultiTexCoord3dvARB }, - { 14337, _gloffset_MultiTexCoord3ivARB }, - { 14382, _gloffset_MultiTexCoord2sARB }, - { 15680, _gloffset_MultiTexCoord4ivARB }, - { 17398, _gloffset_ClientActiveTextureARB }, - { 19681, _gloffset_MultiTexCoord2dARB }, - { 20122, _gloffset_MultiTexCoord4dvARB }, - { 20433, _gloffset_MultiTexCoord4fvARB }, - { 21312, _gloffset_MultiTexCoord3fARB }, - { 23675, _gloffset_MultiTexCoord4dARB }, - { 23941, _gloffset_MultiTexCoord1sARB }, - { 24145, _gloffset_MultiTexCoord1dvARB }, - { 24955, _gloffset_MultiTexCoord1ivARB }, - { 25048, _gloffset_MultiTexCoord2ivARB }, - { 25387, _gloffset_MultiTexCoord1iARB }, - { 26689, _gloffset_MultiTexCoord4svARB }, - { 27207, _gloffset_MultiTexCoord1fARB }, - { 27470, _gloffset_MultiTexCoord4fARB }, + { 420, _gloffset_MultiTexCoord3sARB }, + { 652, _gloffset_ActiveTextureARB }, + { 3800, _gloffset_MultiTexCoord1fvARB }, + { 5425, _gloffset_MultiTexCoord3dARB }, + { 5470, _gloffset_MultiTexCoord2iARB }, + { 5594, _gloffset_MultiTexCoord2svARB }, + { 7559, _gloffset_MultiTexCoord2fARB }, + { 9463, _gloffset_MultiTexCoord3fvARB }, + { 10020, _gloffset_MultiTexCoord4sARB }, + { 10654, _gloffset_MultiTexCoord2dvARB }, + { 11036, _gloffset_MultiTexCoord1svARB }, + { 11447, _gloffset_MultiTexCoord3svARB }, + { 11508, _gloffset_MultiTexCoord4iARB }, + { 12231, _gloffset_MultiTexCoord3iARB }, + { 12963, _gloffset_MultiTexCoord1dARB }, + { 13180, _gloffset_MultiTexCoord3dvARB }, + { 14344, _gloffset_MultiTexCoord3ivARB }, + { 14389, _gloffset_MultiTexCoord2sARB }, + { 15687, _gloffset_MultiTexCoord4ivARB }, + { 17405, _gloffset_ClientActiveTextureARB }, + { 19688, _gloffset_MultiTexCoord2dARB }, + { 20129, _gloffset_MultiTexCoord4dvARB }, + { 20440, _gloffset_MultiTexCoord4fvARB }, + { 21319, _gloffset_MultiTexCoord3fARB }, + { 23682, _gloffset_MultiTexCoord4dARB }, + { 23948, _gloffset_MultiTexCoord1sARB }, + { 24152, _gloffset_MultiTexCoord1dvARB }, + { 24994, _gloffset_MultiTexCoord1ivARB }, + { 25087, _gloffset_MultiTexCoord2ivARB }, + { 25426, _gloffset_MultiTexCoord1iARB }, + { 26728, _gloffset_MultiTexCoord4svARB }, + { 27246, _gloffset_MultiTexCoord1fARB }, + { 27509, _gloffset_MultiTexCoord4fARB }, { 29774, _gloffset_MultiTexCoord2fvARB }, { -1, -1 } }; @@ -5004,7 +5002,7 @@ static const struct gl_function_remap MESA_alt_functions[] = { #if defined(need_GL_3DFX_tbuffer) static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = { - { 8386, -1 }, /* TbufferMask3DFX */ + { 8425, -1 }, /* TbufferMask3DFX */ { -1, -1 } }; #endif @@ -5075,7 +5073,7 @@ static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = { #if defined(need_GL_ARB_geometry_shader4) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_ARB_geometry_shader4_functions[] = { - { 11333, -1 }, /* FramebufferTextureLayer */ + { 11411, -1 }, /* FramebufferTextureLayer */ { -1, -1 } }; #endif @@ -5089,11 +5087,11 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = { #if defined(need_GL_ARB_matrix_palette) static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = { - { 3339, -1 }, /* MatrixIndexusvARB */ - { 11974, -1 }, /* MatrixIndexuivARB */ - { 13295, -1 }, /* MatrixIndexPointerARB */ - { 18136, -1 }, /* CurrentPaletteMatrixARB */ - { 21056, -1 }, /* MatrixIndexubvARB */ + { 3378, -1 }, /* MatrixIndexusvARB */ + { 12052, -1 }, /* MatrixIndexuivARB */ + { 13302, -1 }, /* MatrixIndexPointerARB */ + { 18143, -1 }, /* CurrentPaletteMatrixARB */ + { 21063, -1 }, /* MatrixIndexubvARB */ { -1, -1 } }; #endif @@ -5170,14 +5168,14 @@ static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = { #if defined(need_GL_ARB_vertex_blend) static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = { - { 2226, -1 }, /* WeightubvARB */ - { 5746, -1 }, /* WeightivARB */ - { 10084, -1 }, /* WeightPointerARB */ - { 12674, -1 }, /* WeightfvARB */ - { 16175, -1 }, /* WeightbvARB */ - { 19349, -1 }, /* WeightusvARB */ - { 22082, -1 }, /* VertexBlendARB */ - { 27291, -1 }, /* WeightsvARB */ + { 2265, -1 }, /* WeightubvARB */ + { 5785, -1 }, /* WeightivARB */ + { 10123, -1 }, /* WeightPointerARB */ + { 12720, -1 }, /* WeightfvARB */ + { 16182, -1 }, /* WeightbvARB */ + { 19356, -1 }, /* WeightusvARB */ + { 22089, -1 }, /* VertexBlendARB */ + { 27330, -1 }, /* WeightsvARB */ { 29276, -1 }, /* WeightdvARB */ { 29974, -1 }, /* WeightuivARB */ { -1, -1 } @@ -5249,7 +5247,7 @@ static const struct gl_function_remap GL_ATI_separate_stencil_functions[] = { #if defined(need_GL_EXT_blend_color) static const struct gl_function_remap GL_EXT_blend_color_functions[] = { - { 2440, _gloffset_BlendColor }, + { 2479, _gloffset_BlendColor }, { -1, -1 } }; #endif @@ -5270,14 +5268,14 @@ static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = { #if defined(need_GL_EXT_blend_minmax) static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = { - { 10219, _gloffset_BlendEquation }, + { 10258, _gloffset_BlendEquation }, { -1, -1 } }; #endif #if defined(need_GL_EXT_color_subtable) static const struct gl_function_remap GL_EXT_color_subtable_functions[] = { - { 15623, _gloffset_ColorSubTable }, + { 15630, _gloffset_ColorSubTable }, { 29226, _gloffset_CopyColorSubTable }, { -1, -1 } }; @@ -5292,42 +5290,42 @@ static const struct gl_function_remap GL_EXT_compiled_vertex_array_functions[] = #if defined(need_GL_EXT_convolution) static const struct gl_function_remap GL_EXT_convolution_functions[] = { - { 213, _gloffset_ConvolutionFilter1D }, - { 2284, _gloffset_CopyConvolutionFilter1D }, - { 3624, _gloffset_GetConvolutionParameteriv }, - { 7702, _gloffset_ConvolutionFilter2D }, - { 7868, _gloffset_ConvolutionParameteriv }, - { 8328, _gloffset_ConvolutionParameterfv }, - { 18885, _gloffset_GetSeparableFilter }, - { 22156, _gloffset_SeparableFilter2D }, - { 22968, _gloffset_ConvolutionParameteri }, - { 23091, _gloffset_ConvolutionParameterf }, - { 24608, _gloffset_GetConvolutionParameterfv }, - { 25430, _gloffset_GetConvolutionFilter }, - { 27705, _gloffset_CopyConvolutionFilter2D }, + { 252, _gloffset_ConvolutionFilter1D }, + { 2323, _gloffset_CopyConvolutionFilter1D }, + { 3663, _gloffset_GetConvolutionParameteriv }, + { 7741, _gloffset_ConvolutionFilter2D }, + { 7907, _gloffset_ConvolutionParameteriv }, + { 8367, _gloffset_ConvolutionParameterfv }, + { 18892, _gloffset_GetSeparableFilter }, + { 22163, _gloffset_SeparableFilter2D }, + { 22975, _gloffset_ConvolutionParameteri }, + { 23098, _gloffset_ConvolutionParameterf }, + { 24615, _gloffset_GetConvolutionParameterfv }, + { 25469, _gloffset_GetConvolutionFilter }, + { 27744, _gloffset_CopyConvolutionFilter2D }, { -1, -1 } }; #endif #if defined(need_GL_EXT_coordinate_frame) static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = { - { 9563, -1 }, /* TangentPointerEXT */ - { 11488, -1 }, /* Binormal3ivEXT */ - { 12106, -1 }, /* Tangent3sEXT */ - { 13360, -1 }, /* Tangent3fvEXT */ - { 17107, -1 }, /* Tangent3dvEXT */ - { 17834, -1 }, /* Binormal3bvEXT */ - { 18938, -1 }, /* Binormal3dEXT */ - { 20988, -1 }, /* Tangent3fEXT */ - { 23040, -1 }, /* Binormal3sEXT */ - { 23485, -1 }, /* Tangent3ivEXT */ - { 23504, -1 }, /* Tangent3dEXT */ - { 24372, -1 }, /* Binormal3svEXT */ - { 24853, -1 }, /* Binormal3fEXT */ - { 25705, -1 }, /* Binormal3dvEXT */ - { 26911, -1 }, /* Tangent3iEXT */ - { 27990, -1 }, /* Tangent3bvEXT */ - { 28435, -1 }, /* Tangent3bEXT */ + { 9602, -1 }, /* TangentPointerEXT */ + { 11566, -1 }, /* Binormal3ivEXT */ + { 12184, -1 }, /* Tangent3sEXT */ + { 13367, -1 }, /* Tangent3fvEXT */ + { 17114, -1 }, /* Tangent3dvEXT */ + { 17841, -1 }, /* Binormal3bvEXT */ + { 18945, -1 }, /* Binormal3dEXT */ + { 20995, -1 }, /* Tangent3fEXT */ + { 23047, -1 }, /* Binormal3sEXT */ + { 23492, -1 }, /* Tangent3ivEXT */ + { 23511, -1 }, /* Tangent3dEXT */ + { 24379, -1 }, /* Binormal3svEXT */ + { 24892, -1 }, /* Binormal3fEXT */ + { 25744, -1 }, /* Binormal3dvEXT */ + { 26950, -1 }, /* Tangent3iEXT */ + { 28029, -1 }, /* Tangent3bvEXT */ + { 28474, -1 }, /* Tangent3bEXT */ { 28999, -1 }, /* Binormal3fvEXT */ { 29673, -1 }, /* BinormalPointerEXT */ { 30078, -1 }, /* Tangent3svEXT */ @@ -5339,18 +5337,19 @@ static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = { #if defined(need_GL_EXT_copy_texture) static const struct gl_function_remap GL_EXT_copy_texture_functions[] = { - { 13803, _gloffset_CopyTexSubImage3D }, - { 15363, _gloffset_CopyTexImage2D }, - { 22576, _gloffset_CopyTexImage1D }, - { 25111, _gloffset_CopyTexSubImage2D }, - { 27343, _gloffset_CopyTexSubImage1D }, + { 13810, _gloffset_CopyTexSubImage3D }, + { 15370, _gloffset_CopyTexImage2D }, + { 22583, _gloffset_CopyTexImage1D }, + { 25150, _gloffset_CopyTexSubImage2D }, + { 27382, _gloffset_CopyTexSubImage1D }, { -1, -1 } }; #endif #if defined(need_GL_EXT_cull_vertex) -/* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_EXT_cull_vertex_functions[] = { + { 8056, -1 }, /* CullParameterdvEXT */ + { 10699, -1 }, /* CullParameterfvEXT */ { -1, -1 } }; #endif @@ -5378,7 +5377,7 @@ static const struct gl_function_remap GL_EXT_draw_instanced_functions[] = { #if defined(need_GL_EXT_draw_range_elements) static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = { - { 8665, _gloffset_DrawRangeElements }, + { 8704, _gloffset_DrawRangeElements }, { -1, -1 } }; #endif @@ -5420,15 +5419,15 @@ static const struct gl_function_remap GL_EXT_gpu_program_parameters_functions[] #if defined(need_GL_EXT_histogram) static const struct gl_function_remap GL_EXT_histogram_functions[] = { - { 812, _gloffset_Histogram }, - { 3088, _gloffset_ResetHistogram }, - { 9065, _gloffset_GetMinmax }, - { 14137, _gloffset_GetHistogramParameterfv }, - { 22501, _gloffset_GetMinmaxParameteriv }, - { 24498, _gloffset_ResetMinmax }, - { 25327, _gloffset_GetHistogramParameteriv }, - { 26414, _gloffset_GetHistogram }, - { 28812, _gloffset_Minmax }, + { 851, _gloffset_Histogram }, + { 3127, _gloffset_ResetHistogram }, + { 9104, _gloffset_GetMinmax }, + { 14144, _gloffset_GetHistogramParameterfv }, + { 22508, _gloffset_GetMinmaxParameteriv }, + { 24505, _gloffset_ResetMinmax }, + { 25366, _gloffset_GetHistogramParameteriv }, + { 26453, _gloffset_GetHistogram }, + { 28851, _gloffset_Minmax }, { 30313, _gloffset_GetMinmaxParameterfv }, { -1, -1 } }; @@ -5436,23 +5435,23 @@ static const struct gl_function_remap GL_EXT_histogram_functions[] = { #if defined(need_GL_EXT_index_func) static const struct gl_function_remap GL_EXT_index_func_functions[] = { - { 10446, -1 }, /* IndexFuncEXT */ + { 10485, -1 }, /* IndexFuncEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_index_material) static const struct gl_function_remap GL_EXT_index_material_functions[] = { - { 19436, -1 }, /* IndexMaterialEXT */ + { 19443, -1 }, /* IndexMaterialEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_light_texture) static const struct gl_function_remap GL_EXT_light_texture_functions[] = { - { 24392, -1 }, /* ApplyTextureEXT */ - { 24452, -1 }, /* TextureMaterialEXT */ - { 24477, -1 }, /* TextureLightEXT */ + { 24399, -1 }, /* ApplyTextureEXT */ + { 24459, -1 }, /* TextureMaterialEXT */ + { 24484, -1 }, /* TextureLightEXT */ { -1, -1 } }; #endif @@ -5473,19 +5472,19 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = { #if defined(need_GL_EXT_paletted_texture) static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = { - { 7564, _gloffset_ColorTable }, - { 13983, _gloffset_GetColorTable }, - { 21171, _gloffset_GetColorTableParameterfv }, - { 23147, _gloffset_GetColorTableParameteriv }, + { 7603, _gloffset_ColorTable }, + { 13990, _gloffset_GetColorTable }, + { 21178, _gloffset_GetColorTableParameterfv }, + { 23154, _gloffset_GetColorTableParameteriv }, { -1, -1 } }; #endif #if defined(need_GL_EXT_pixel_transform) static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = { - { 20087, -1 }, /* PixelTransformParameterfEXT */ - { 20167, -1 }, /* PixelTransformParameteriEXT */ - { 28173, -1 }, /* PixelTransformParameterfvEXT */ + { 20094, -1 }, /* PixelTransformParameterfEXT */ + { 20174, -1 }, /* PixelTransformParameteriEXT */ + { 28212, -1 }, /* PixelTransformParameterfvEXT */ { 29637, -1 }, /* PixelTransformParameterivEXT */ { -1, -1 } }; @@ -5528,16 +5527,16 @@ static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = { #if defined(need_GL_EXT_subtexture) static const struct gl_function_remap GL_EXT_subtexture_functions[] = { - { 6285, _gloffset_TexSubImage1D }, - { 9679, _gloffset_TexSubImage2D }, + { 6324, _gloffset_TexSubImage1D }, + { 9718, _gloffset_TexSubImage2D }, { -1, -1 } }; #endif #if defined(need_GL_EXT_texture3D) static const struct gl_function_remap GL_EXT_texture3D_functions[] = { - { 1658, _gloffset_TexImage3D }, - { 20940, _gloffset_TexSubImage3D }, + { 1697, _gloffset_TexImage3D }, + { 20947, _gloffset_TexSubImage3D }, { -1, -1 } }; #endif @@ -5551,19 +5550,19 @@ static const struct gl_function_remap GL_EXT_texture_array_functions[] = { #if defined(need_GL_EXT_texture_object) static const struct gl_function_remap GL_EXT_texture_object_functions[] = { - { 2964, _gloffset_PrioritizeTextures }, - { 6734, _gloffset_AreTexturesResident }, - { 12382, _gloffset_GenTextures }, - { 14469, _gloffset_DeleteTextures }, - { 17887, _gloffset_IsTexture }, - { 27408, _gloffset_BindTexture }, + { 3003, _gloffset_PrioritizeTextures }, + { 6773, _gloffset_AreTexturesResident }, + { 12460, _gloffset_GenTextures }, + { 14476, _gloffset_DeleteTextures }, + { 17894, _gloffset_IsTexture }, + { 27447, _gloffset_BindTexture }, { -1, -1 } }; #endif #if defined(need_GL_EXT_texture_perturb_normal) static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = { - { 12624, -1 }, /* TextureNormalEXT */ + { 12670, -1 }, /* TextureNormalEXT */ { -1, -1 } }; #endif @@ -5585,8 +5584,8 @@ static const struct gl_function_remap GL_EXT_transform_feedback_functions[] = { #if defined(need_GL_EXT_vertex_array) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_EXT_vertex_array_functions[] = { - { 22328, _gloffset_ArrayElement }, - { 28400, _gloffset_GetPointerv }, + { 22335, _gloffset_ArrayElement }, + { 28439, _gloffset_GetPointerv }, { 29940, _gloffset_DrawArrays }, { -1, -1 } }; @@ -5594,21 +5593,21 @@ static const struct gl_function_remap GL_EXT_vertex_array_functions[] = { #if defined(need_GL_EXT_vertex_weighting) static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = { - { 17917, -1 }, /* VertexWeightfvEXT */ - { 24831, -1 }, /* VertexWeightfEXT */ - { 26383, -1 }, /* VertexWeightPointerEXT */ + { 17924, -1 }, /* VertexWeightfvEXT */ + { 24870, -1 }, /* VertexWeightfEXT */ + { 26422, -1 }, /* VertexWeightPointerEXT */ { -1, -1 } }; #endif #if defined(need_GL_HP_image_transform) static const struct gl_function_remap GL_HP_image_transform_functions[] = { - { 2157, -1 }, /* GetImageTransformParameterfvHP */ - { 3305, -1 }, /* ImageTransformParameterfHP */ - { 9257, -1 }, /* ImageTransformParameterfvHP */ - { 10915, -1 }, /* ImageTransformParameteriHP */ - { 11223, -1 }, /* GetImageTransformParameterivHP */ - { 17981, -1 }, /* ImageTransformParameterivHP */ + { 2196, -1 }, /* GetImageTransformParameterfvHP */ + { 3344, -1 }, /* ImageTransformParameterfHP */ + { 9296, -1 }, /* ImageTransformParameterfvHP */ + { 10954, -1 }, /* ImageTransformParameteriHP */ + { 11301, -1 }, /* GetImageTransformParameterivHP */ + { 17988, -1 }, /* ImageTransformParameterivHP */ { -1, -1 } }; #endif @@ -5622,13 +5621,13 @@ static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] = #if defined(need_GL_IBM_vertex_array_lists) static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = { - { 3857, -1 }, /* SecondaryColorPointerListIBM */ - { 5252, -1 }, /* NormalPointerListIBM */ - { 6908, -1 }, /* FogCoordPointerListIBM */ - { 7215, -1 }, /* VertexPointerListIBM */ - { 10836, -1 }, /* ColorPointerListIBM */ - { 12213, -1 }, /* TexCoordPointerListIBM */ - { 12646, -1 }, /* IndexPointerListIBM */ + { 3896, -1 }, /* SecondaryColorPointerListIBM */ + { 5291, -1 }, /* NormalPointerListIBM */ + { 6947, -1 }, /* FogCoordPointerListIBM */ + { 7254, -1 }, /* VertexPointerListIBM */ + { 10875, -1 }, /* ColorPointerListIBM */ + { 12291, -1 }, /* TexCoordPointerListIBM */ + { 12692, -1 }, /* IndexPointerListIBM */ { 30256, -1 }, /* EdgeFlagPointerListIBM */ { -1, -1 } }; @@ -5643,10 +5642,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] = #if defined(need_GL_INTEL_parallel_arrays) static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = { - { 11600, -1 }, /* VertexPointervINTEL */ - { 14230, -1 }, /* ColorPointervINTEL */ - { 27679, -1 }, /* NormalPointervINTEL */ - { 28105, -1 }, /* TexCoordPointervINTEL */ + { 11678, -1 }, /* VertexPointervINTEL */ + { 14237, -1 }, /* ColorPointervINTEL */ + { 27718, -1 }, /* NormalPointervINTEL */ + { 28144, -1 }, /* TexCoordPointervINTEL */ { -1, -1 } }; #endif @@ -5660,10 +5659,10 @@ static const struct gl_function_remap GL_MESA_resize_buffers_functions[] = { #if defined(need_GL_MESA_shader_debug) static const struct gl_function_remap GL_MESA_shader_debug_functions[] = { - { 1522, -1 }, /* GetDebugLogLengthMESA */ - { 3063, -1 }, /* ClearDebugLogMESA */ - { 4018, -1 }, /* GetDebugLogMESA */ - { 28593, -1 }, /* CreateDebugObjectMESA */ + { 1561, -1 }, /* GetDebugLogLengthMESA */ + { 3102, -1 }, /* ClearDebugLogMESA */ + { 4057, -1 }, /* GetDebugLogMESA */ + { 28632, -1 }, /* CreateDebugObjectMESA */ { -1, -1 } }; #endif @@ -5684,15 +5683,15 @@ static const struct gl_function_remap GL_NV_condtitional_render_functions[] = { #if defined(need_GL_NV_evaluators) static const struct gl_function_remap GL_NV_evaluators_functions[] = { - { 5947, -1 }, /* GetMapAttribParameterivNV */ - { 7670, -1 }, /* MapControlPointsNV */ - { 7769, -1 }, /* MapParameterfvNV */ - { 9662, -1 }, /* EvalMapsNV */ - { 15845, -1 }, /* GetMapAttribParameterfvNV */ - { 16011, -1 }, /* MapParameterivNV */ - { 22891, -1 }, /* GetMapParameterivNV */ - { 23389, -1 }, /* GetMapParameterfvNV */ - { 27015, -1 }, /* GetMapControlPointsNV */ + { 5986, -1 }, /* GetMapAttribParameterivNV */ + { 7709, -1 }, /* MapControlPointsNV */ + { 7808, -1 }, /* MapParameterfvNV */ + { 9701, -1 }, /* EvalMapsNV */ + { 15852, -1 }, /* GetMapAttribParameterfvNV */ + { 16018, -1 }, /* MapParameterivNV */ + { 22898, -1 }, /* GetMapParameterivNV */ + { 23396, -1 }, /* GetMapParameterfvNV */ + { 27054, -1 }, /* GetMapControlPointsNV */ { -1, -1 } }; #endif @@ -5727,8 +5726,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = { #if defined(need_GL_NV_register_combiners2) static const struct gl_function_remap GL_NV_register_combiners2_functions[] = { - { 14700, -1 }, /* CombinerStageParameterfvNV */ - { 15015, -1 }, /* GetCombinerStageParameterfvNV */ + { 14707, -1 }, /* CombinerStageParameterfvNV */ + { 15022, -1 }, /* GetCombinerStageParameterfvNV */ { -1, -1 } }; #endif @@ -5756,23 +5755,23 @@ static const struct gl_function_remap GL_OES_EGL_image_functions[] = { #if defined(need_GL_PGI_misc_hints) static const struct gl_function_remap GL_PGI_misc_hints_functions[] = { - { 7854, -1 }, /* HintPGI */ + { 7893, -1 }, /* HintPGI */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_detail_texture) static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = { - { 14988, -1 }, /* GetDetailTexFuncSGIS */ - { 15308, -1 }, /* DetailTexFuncSGIS */ + { 14995, -1 }, /* GetDetailTexFuncSGIS */ + { 15315, -1 }, /* DetailTexFuncSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_fog_function) static const struct gl_function_remap GL_SGIS_fog_function_functions[] = { - { 25093, -1 }, /* FogFuncSGIS */ - { 25758, -1 }, /* GetFogFuncSGIS */ + { 25132, -1 }, /* FogFuncSGIS */ + { 25797, -1 }, /* GetFogFuncSGIS */ { -1, -1 } }; #endif @@ -5800,42 +5799,42 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = { #if defined(need_GL_SGIS_sharpen_texture) static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = { - { 6008, -1 }, /* GetSharpenTexFuncSGIS */ - { 20407, -1 }, /* SharpenTexFuncSGIS */ + { 6047, -1 }, /* GetSharpenTexFuncSGIS */ + { 20414, -1 }, /* SharpenTexFuncSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_texture4D) static const struct gl_function_remap GL_SGIS_texture4D_functions[] = { - { 894, -1 }, /* TexImage4DSGIS */ - { 14538, -1 }, /* TexSubImage4DSGIS */ + { 933, -1 }, /* TexImage4DSGIS */ + { 14545, -1 }, /* TexSubImage4DSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_texture_color_mask) static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = { - { 13936, -1 }, /* TextureColorMaskSGIS */ + { 13943, -1 }, /* TextureColorMaskSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_texture_filter4) static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = { - { 6185, -1 }, /* GetTexFilterFuncSGIS */ - { 15134, -1 }, /* TexFilterFuncSGIS */ + { 6224, -1 }, /* GetTexFilterFuncSGIS */ + { 15141, -1 }, /* TexFilterFuncSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_async) static const struct gl_function_remap GL_SGIX_async_functions[] = { - { 3014, -1 }, /* AsyncMarkerSGIX */ - { 3997, -1 }, /* FinishAsyncSGIX */ - { 4762, -1 }, /* PollAsyncSGIX */ - { 20554, -1 }, /* DeleteAsyncMarkersSGIX */ - { 20609, -1 }, /* IsAsyncMarkerSGIX */ + { 3053, -1 }, /* AsyncMarkerSGIX */ + { 4036, -1 }, /* FinishAsyncSGIX */ + { 4830, -1 }, /* PollAsyncSGIX */ + { 20561, -1 }, /* DeleteAsyncMarkersSGIX */ + { 20616, -1 }, /* IsAsyncMarkerSGIX */ { 30053, -1 }, /* GenAsyncMarkersSGIX */ { -1, -1 } }; @@ -5843,29 +5842,29 @@ static const struct gl_function_remap GL_SGIX_async_functions[] = { #if defined(need_GL_SGIX_flush_raster) static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = { - { 6562, -1 }, /* FlushRasterSGIX */ + { 6601, -1 }, /* FlushRasterSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_fragment_lighting) static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = { - { 2410, -1 }, /* FragmentMaterialfvSGIX */ - { 4713, -1 }, /* FragmentLightiSGIX */ - { 5688, -1 }, /* GetFragmentMaterialfvSGIX */ - { 7282, -1 }, /* FragmentMaterialfSGIX */ - { 7443, -1 }, /* GetFragmentLightivSGIX */ - { 8280, -1 }, /* FragmentLightModeliSGIX */ - { 9725, -1 }, /* FragmentLightivSGIX */ - { 10027, -1 }, /* GetFragmentMaterialivSGIX */ - { 17804, -1 }, /* FragmentLightModelfSGIX */ - { 18104, -1 }, /* FragmentColorMaterialSGIX */ - { 18504, -1 }, /* FragmentMaterialiSGIX */ - { 19764, -1 }, /* LightEnviSGIX */ - { 21263, -1 }, /* FragmentLightModelfvSGIX */ - { 21572, -1 }, /* FragmentLightfvSGIX */ - { 26142, -1 }, /* FragmentLightModelivSGIX */ - { 26265, -1 }, /* FragmentLightfSGIX */ + { 2449, -1 }, /* FragmentMaterialfvSGIX */ + { 4781, -1 }, /* FragmentLightiSGIX */ + { 5727, -1 }, /* GetFragmentMaterialfvSGIX */ + { 7321, -1 }, /* FragmentMaterialfSGIX */ + { 7482, -1 }, /* GetFragmentLightivSGIX */ + { 8319, -1 }, /* FragmentLightModeliSGIX */ + { 9764, -1 }, /* FragmentLightivSGIX */ + { 10066, -1 }, /* GetFragmentMaterialivSGIX */ + { 17811, -1 }, /* FragmentLightModelfSGIX */ + { 18111, -1 }, /* FragmentColorMaterialSGIX */ + { 18511, -1 }, /* FragmentMaterialiSGIX */ + { 19771, -1 }, /* LightEnviSGIX */ + { 21270, -1 }, /* FragmentLightModelfvSGIX */ + { 21579, -1 }, /* FragmentLightfvSGIX */ + { 26181, -1 }, /* FragmentLightModelivSGIX */ + { 26304, -1 }, /* FragmentLightfSGIX */ { 28969, -1 }, /* GetFragmentLightfvSGIX */ { 30536, -1 }, /* FragmentMaterialivSGIX */ { -1, -1 } @@ -5874,37 +5873,37 @@ static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = { #if defined(need_GL_SGIX_framezoom) static const struct gl_function_remap GL_SGIX_framezoom_functions[] = { - { 20632, -1 }, /* FrameZoomSGIX */ + { 20639, -1 }, /* FrameZoomSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_igloo_interface) static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = { - { 26573, -1 }, /* IglooInterfaceSGIX */ + { 26612, -1 }, /* IglooInterfaceSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_instruments) static const struct gl_function_remap GL_SGIX_instruments_functions[] = { - { 2573, -1 }, /* ReadInstrumentsSGIX */ - { 5764, -1 }, /* PollInstrumentsSGIX */ - { 9623, -1 }, /* GetInstrumentsSGIX */ - { 11811, -1 }, /* StartInstrumentsSGIX */ - { 14734, -1 }, /* StopInstrumentsSGIX */ - { 16388, -1 }, /* InstrumentsBufferSGIX */ + { 2612, -1 }, /* ReadInstrumentsSGIX */ + { 5803, -1 }, /* PollInstrumentsSGIX */ + { 9662, -1 }, /* GetInstrumentsSGIX */ + { 11889, -1 }, /* StartInstrumentsSGIX */ + { 14741, -1 }, /* StopInstrumentsSGIX */ + { 16395, -1 }, /* InstrumentsBufferSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_list_priority) static const struct gl_function_remap GL_SGIX_list_priority_functions[] = { - { 1125, -1 }, /* ListParameterfSGIX */ - { 2763, -1 }, /* GetListParameterfvSGIX */ - { 16303, -1 }, /* ListParameteriSGIX */ - { 17057, -1 }, /* ListParameterfvSGIX */ - { 19170, -1 }, /* ListParameterivSGIX */ + { 1164, -1 }, /* ListParameterfSGIX */ + { 2802, -1 }, /* GetListParameterfvSGIX */ + { 16310, -1 }, /* ListParameteriSGIX */ + { 17064, -1 }, /* ListParameterfvSGIX */ + { 19177, -1 }, /* ListParameterivSGIX */ { 30097, -1 }, /* GetListParameterivSGIX */ { -1, -1 } }; @@ -5919,47 +5918,47 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = { #if defined(need_GL_SGIX_polynomial_ffd) static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = { - { 3251, -1 }, /* LoadIdentityDeformationMapSGIX */ - { 14834, -1 }, /* DeformSGIX */ - { 22440, -1 }, /* DeformationMap3fSGIX */ - { 28857, -1 }, /* DeformationMap3dSGIX */ + { 3290, -1 }, /* LoadIdentityDeformationMapSGIX */ + { 11175, -1 }, /* DeformationMap3dSGIX */ + { 14841, -1 }, /* DeformSGIX */ + { 22447, -1 }, /* DeformationMap3fSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_reference_plane) static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = { - { 13487, -1 }, /* ReferencePlaneSGIX */ + { 13494, -1 }, /* ReferencePlaneSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_sprite) static const struct gl_function_remap GL_SGIX_sprite_functions[] = { - { 8778, -1 }, /* SpriteParameterfvSGIX */ - { 18959, -1 }, /* SpriteParameteriSGIX */ - { 24532, -1 }, /* SpriteParameterfSGIX */ - { 27137, -1 }, /* SpriteParameterivSGIX */ + { 8817, -1 }, /* SpriteParameterfvSGIX */ + { 18966, -1 }, /* SpriteParameteriSGIX */ + { 24539, -1 }, /* SpriteParameterfSGIX */ + { 27176, -1 }, /* SpriteParameterivSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_tag_sample_buffer) static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = { - { 19018, -1 }, /* TagSampleBufferSGIX */ + { 19025, -1 }, /* TagSampleBufferSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGI_color_table) static const struct gl_function_remap GL_SGI_color_table_functions[] = { - { 6852, _gloffset_ColorTableParameteriv }, - { 7564, _gloffset_ColorTable }, - { 13983, _gloffset_GetColorTable }, - { 14093, _gloffset_CopyColorTable }, - { 17748, _gloffset_ColorTableParameterfv }, - { 21171, _gloffset_GetColorTableParameterfv }, - { 23147, _gloffset_GetColorTableParameteriv }, + { 6891, _gloffset_ColorTableParameteriv }, + { 7603, _gloffset_ColorTable }, + { 13990, _gloffset_GetColorTable }, + { 14100, _gloffset_CopyColorTable }, + { 17755, _gloffset_ColorTableParameterfv }, + { 21178, _gloffset_GetColorTableParameterfv }, + { 23154, _gloffset_GetColorTableParameteriv }, { -1, -1 } }; #endif @@ -5973,80 +5972,80 @@ static const struct gl_function_remap GL_SUNX_constant_data_functions[] = { #if defined(need_GL_SUN_global_alpha) static const struct gl_function_remap GL_SUN_global_alpha_functions[] = { - { 3035, -1 }, /* GlobalAlphaFactorubSUN */ - { 4224, -1 }, /* GlobalAlphaFactoriSUN */ - { 5789, -1 }, /* GlobalAlphaFactordSUN */ - { 8862, -1 }, /* GlobalAlphaFactoruiSUN */ - { 9214, -1 }, /* GlobalAlphaFactorbSUN */ - { 12126, -1 }, /* GlobalAlphaFactorfSUN */ - { 12245, -1 }, /* GlobalAlphaFactorusSUN */ - { 20871, -1 }, /* GlobalAlphaFactorsSUN */ + { 3074, -1 }, /* GlobalAlphaFactorubSUN */ + { 4263, -1 }, /* GlobalAlphaFactoriSUN */ + { 5828, -1 }, /* GlobalAlphaFactordSUN */ + { 8901, -1 }, /* GlobalAlphaFactoruiSUN */ + { 9253, -1 }, /* GlobalAlphaFactorbSUN */ + { 12204, -1 }, /* GlobalAlphaFactorfSUN */ + { 12323, -1 }, /* GlobalAlphaFactorusSUN */ + { 20878, -1 }, /* GlobalAlphaFactorsSUN */ { -1, -1 } }; #endif #if defined(need_GL_SUN_mesh_array) static const struct gl_function_remap GL_SUN_mesh_array_functions[] = { - { 26949, -1 }, /* DrawMeshArraysSUN */ + { 26988, -1 }, /* DrawMeshArraysSUN */ { -1, -1 } }; #endif #if defined(need_GL_SUN_triangle_list) static const struct gl_function_remap GL_SUN_triangle_list_functions[] = { - { 3971, -1 }, /* ReplacementCodeubSUN */ - { 5600, -1 }, /* ReplacementCodeubvSUN */ - { 17469, -1 }, /* ReplacementCodeusvSUN */ - { 17657, -1 }, /* ReplacementCodePointerSUN */ - { 19828, -1 }, /* ReplacementCodeuiSUN */ - { 20583, -1 }, /* ReplacementCodeusSUN */ - { 27594, -1 }, /* ReplacementCodeuivSUN */ + { 4010, -1 }, /* ReplacementCodeubSUN */ + { 5639, -1 }, /* ReplacementCodeubvSUN */ + { 17476, -1 }, /* ReplacementCodeusvSUN */ + { 17664, -1 }, /* ReplacementCodePointerSUN */ + { 19835, -1 }, /* ReplacementCodeuiSUN */ + { 20590, -1 }, /* ReplacementCodeusSUN */ + { 27633, -1 }, /* ReplacementCodeuivSUN */ { -1, -1 } }; #endif #if defined(need_GL_SUN_vertex) static const struct gl_function_remap GL_SUN_vertex_functions[] = { - { 999, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */ - { 1197, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */ - { 1423, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */ - { 1699, -1 }, /* ReplacementCodeuiVertex3fvSUN */ - { 1833, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */ - { 2346, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */ - { 2642, -1 }, /* Color4ubVertex3fvSUN */ - { 4105, -1 }, /* Color4ubVertex3fSUN */ - { 4181, -1 }, /* TexCoord2fVertex3fSUN */ - { 4508, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */ - { 4866, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */ - { 5495, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */ - { 6240, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ - { 6599, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */ - { 7311, -1 }, /* TexCoord2fNormal3fVertex3fSUN */ - { 8079, -1 }, /* Color3fVertex3fSUN */ - { 9173, -1 }, /* Color3fVertex3fvSUN */ - { 9588, -1 }, /* Color4fNormal3fVertex3fvSUN */ - { 10325, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */ - { 11674, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ - { 13218, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ - { 13629, -1 }, /* TexCoord2fColor3fVertex3fSUN */ - { 14759, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ - { 15093, -1 }, /* Color4ubVertex2fvSUN */ - { 15333, -1 }, /* Normal3fVertex3fSUN */ - { 16329, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ - { 16590, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ - { 17298, -1 }, /* TexCoord2fVertex3fvSUN */ - { 18074, -1 }, /* Color4ubVertex2fSUN */ - { 18295, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ - { 20253, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ - { 20651, -1 }, /* Normal3fVertex3fvSUN */ - { 21080, -1 }, /* Color4fNormal3fVertex3fSUN */ - { 21989, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ - { 23984, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ - { 25209, -1 }, /* TexCoord4fVertex4fSUN */ - { 25635, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ - { 25986, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ - { 26113, -1 }, /* TexCoord4fVertex4fvSUN */ - { 26821, -1 }, /* ReplacementCodeuiVertex3fSUN */ + { 1038, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */ + { 1236, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */ + { 1462, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */ + { 1738, -1 }, /* ReplacementCodeuiVertex3fvSUN */ + { 1872, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */ + { 2385, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */ + { 2681, -1 }, /* Color4ubVertex3fvSUN */ + { 4144, -1 }, /* Color4ubVertex3fSUN */ + { 4220, -1 }, /* TexCoord2fVertex3fSUN */ + { 4547, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */ + { 4934, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */ + { 5534, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */ + { 6279, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ + { 6638, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */ + { 7350, -1 }, /* TexCoord2fNormal3fVertex3fSUN */ + { 8118, -1 }, /* Color3fVertex3fSUN */ + { 9212, -1 }, /* Color3fVertex3fvSUN */ + { 9627, -1 }, /* Color4fNormal3fVertex3fvSUN */ + { 10364, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */ + { 11752, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ + { 13225, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ + { 13636, -1 }, /* TexCoord2fColor3fVertex3fSUN */ + { 14766, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ + { 15100, -1 }, /* Color4ubVertex2fvSUN */ + { 15340, -1 }, /* Normal3fVertex3fSUN */ + { 16336, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ + { 16597, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ + { 17305, -1 }, /* TexCoord2fVertex3fvSUN */ + { 18081, -1 }, /* Color4ubVertex2fSUN */ + { 18302, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ + { 20260, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ + { 20658, -1 }, /* Normal3fVertex3fvSUN */ + { 21087, -1 }, /* Color4fNormal3fVertex3fSUN */ + { 21996, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ + { 23991, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ + { 25248, -1 }, /* TexCoord4fVertex4fSUN */ + { 25674, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ + { 26025, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ + { 26152, -1 }, /* TexCoord4fVertex4fvSUN */ + { 26860, -1 }, /* ReplacementCodeuiVertex3fSUN */ { -1, -1 } }; #endif @@ -6054,39 +6053,39 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = { #if defined(need_GL_VERSION_1_3) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_VERSION_1_3_functions[] = { - { 381, _gloffset_MultiTexCoord3sARB }, - { 613, _gloffset_ActiveTextureARB }, - { 3761, _gloffset_MultiTexCoord1fvARB }, - { 5386, _gloffset_MultiTexCoord3dARB }, - { 5431, _gloffset_MultiTexCoord2iARB }, - { 5555, _gloffset_MultiTexCoord2svARB }, - { 7520, _gloffset_MultiTexCoord2fARB }, - { 9424, _gloffset_MultiTexCoord3fvARB }, - { 9981, _gloffset_MultiTexCoord4sARB }, - { 10615, _gloffset_MultiTexCoord2dvARB }, - { 10997, _gloffset_MultiTexCoord1svARB }, - { 11369, _gloffset_MultiTexCoord3svARB }, - { 11430, _gloffset_MultiTexCoord4iARB }, - { 12153, _gloffset_MultiTexCoord3iARB }, - { 12956, _gloffset_MultiTexCoord1dARB }, - { 13173, _gloffset_MultiTexCoord3dvARB }, - { 14337, _gloffset_MultiTexCoord3ivARB }, - { 14382, _gloffset_MultiTexCoord2sARB }, - { 15680, _gloffset_MultiTexCoord4ivARB }, - { 17398, _gloffset_ClientActiveTextureARB }, - { 19681, _gloffset_MultiTexCoord2dARB }, - { 20122, _gloffset_MultiTexCoord4dvARB }, - { 20433, _gloffset_MultiTexCoord4fvARB }, - { 21312, _gloffset_MultiTexCoord3fARB }, - { 23675, _gloffset_MultiTexCoord4dARB }, - { 23941, _gloffset_MultiTexCoord1sARB }, - { 24145, _gloffset_MultiTexCoord1dvARB }, - { 24955, _gloffset_MultiTexCoord1ivARB }, - { 25048, _gloffset_MultiTexCoord2ivARB }, - { 25387, _gloffset_MultiTexCoord1iARB }, - { 26689, _gloffset_MultiTexCoord4svARB }, - { 27207, _gloffset_MultiTexCoord1fARB }, - { 27470, _gloffset_MultiTexCoord4fARB }, + { 420, _gloffset_MultiTexCoord3sARB }, + { 652, _gloffset_ActiveTextureARB }, + { 3800, _gloffset_MultiTexCoord1fvARB }, + { 5425, _gloffset_MultiTexCoord3dARB }, + { 5470, _gloffset_MultiTexCoord2iARB }, + { 5594, _gloffset_MultiTexCoord2svARB }, + { 7559, _gloffset_MultiTexCoord2fARB }, + { 9463, _gloffset_MultiTexCoord3fvARB }, + { 10020, _gloffset_MultiTexCoord4sARB }, + { 10654, _gloffset_MultiTexCoord2dvARB }, + { 11036, _gloffset_MultiTexCoord1svARB }, + { 11447, _gloffset_MultiTexCoord3svARB }, + { 11508, _gloffset_MultiTexCoord4iARB }, + { 12231, _gloffset_MultiTexCoord3iARB }, + { 12963, _gloffset_MultiTexCoord1dARB }, + { 13180, _gloffset_MultiTexCoord3dvARB }, + { 14344, _gloffset_MultiTexCoord3ivARB }, + { 14389, _gloffset_MultiTexCoord2sARB }, + { 15687, _gloffset_MultiTexCoord4ivARB }, + { 17405, _gloffset_ClientActiveTextureARB }, + { 19688, _gloffset_MultiTexCoord2dARB }, + { 20129, _gloffset_MultiTexCoord4dvARB }, + { 20440, _gloffset_MultiTexCoord4fvARB }, + { 21319, _gloffset_MultiTexCoord3fARB }, + { 23682, _gloffset_MultiTexCoord4dARB }, + { 23948, _gloffset_MultiTexCoord1sARB }, + { 24152, _gloffset_MultiTexCoord1dvARB }, + { 24994, _gloffset_MultiTexCoord1ivARB }, + { 25087, _gloffset_MultiTexCoord2ivARB }, + { 25426, _gloffset_MultiTexCoord1iARB }, + { 26728, _gloffset_MultiTexCoord4svARB }, + { 27246, _gloffset_MultiTexCoord1fARB }, + { 27509, _gloffset_MultiTexCoord4fARB }, { 29774, _gloffset_MultiTexCoord2fvARB }, { -1, -1 } }; diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index b35d09335d2..6f6598db82b 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -154,7 +154,6 @@ TNL_SOURCES = \ tnl/t_vb_texgen.c \ tnl/t_vb_texmat.c \ tnl/t_vb_vertex.c \ - tnl/t_vb_cull.c \ tnl/t_vb_fog.c \ tnl/t_vb_light.c \ tnl/t_vb_normals.c \ diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h index d110010f04e..a6429869cb9 100644 --- a/src/mesa/tnl/t_pipeline.h +++ b/src/mesa/tnl/t_pipeline.h @@ -44,7 +44,6 @@ extern void _tnl_install_pipeline( GLcontext *ctx, /* These are implemented in the t_vb_*.c files: */ extern const struct tnl_pipeline_stage _tnl_vertex_transform_stage; -extern const struct tnl_pipeline_stage _tnl_vertex_cull_stage; extern const struct tnl_pipeline_stage _tnl_normal_transform_stage; extern const struct tnl_pipeline_stage _tnl_lighting_stage; extern const struct tnl_pipeline_stage _tnl_fog_coordinate_stage; diff --git a/src/mesa/tnl/t_vb_cull.c b/src/mesa/tnl/t_vb_cull.c deleted file mode 100644 index 22df7166735..00000000000 --- a/src/mesa/tnl/t_vb_cull.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 Brian Paul 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL 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. - * - * Authors: - * Keith Whitwell - */ - - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "math/m_xform.h" - -#include "t_context.h" -#include "t_pipeline.h" - - - -/* EXT_vertex_cull. Not really a big win, but probably depends on - * your application. This stage not included in the default pipeline. - */ -static GLboolean run_cull_stage( GLcontext *ctx, - struct tnl_pipeline_stage *stage ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - - const GLfloat a = ctx->Transform.CullObjPos[0]; - const GLfloat b = ctx->Transform.CullObjPos[1]; - const GLfloat c = ctx->Transform.CullObjPos[2]; - GLfloat *norm = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data; - GLuint stride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride; - GLuint count = VB->Count; - GLuint i; - - if (ctx->VertexProgram._Current || - !ctx->Transform.CullVertexFlag) - return GL_TRUE; - - VB->ClipOrMask &= ~CLIP_CULL_BIT; - VB->ClipAndMask |= CLIP_CULL_BIT; - - for (i = 0 ; i < count ; i++) { - GLfloat dp = (norm[0] * a + - norm[1] * b + - norm[2] * c); - - if (dp < 0) { - VB->ClipMask[i] |= CLIP_CULL_BIT; - VB->ClipOrMask |= CLIP_CULL_BIT; - } - else { - VB->ClipMask[i] &= ~CLIP_CULL_BIT; - VB->ClipAndMask &= ~CLIP_CULL_BIT; - } - - STRIDE_F(norm, stride); - } - - return !(VB->ClipAndMask & CLIP_CULL_BIT); -} - - - -const struct tnl_pipeline_stage _tnl_vertex_cull_stage = -{ - "EXT_cull_vertex", - NULL, /* private data */ - NULL, /* ctr */ - NULL, /* destructor */ - NULL, - run_cull_stage /* run -- initially set to init */ -}; -- cgit v1.2.3 From 78db8c8b66370ba3af3880c08b59f59a87137a0c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 18 Sep 2010 16:43:08 +0200 Subject: Regenerate files changed by previous commit --- src/mapi/glapi/gen/gl_API.xml | 4 +- src/mapi/glapi/glapi_sparc.S | 84 +- src/mapi/glapi/glapi_x86-64.S | 2120 +++++++++++++++++++--------------------- src/mapi/glapi/glapi_x86.S | 114 ++- src/mapi/glapi/glapidispatch.h | 450 +++++---- src/mapi/glapi/glapioffsets.h | 440 +++++---- src/mapi/glapi/glapitable.h | 436 ++++----- src/mapi/glapi/glapitemp.h | 156 ++- src/mapi/glapi/glprocs.h | 1144 +++++++++++----------- 9 files changed, 2410 insertions(+), 2538 deletions(-) (limited to 'src') diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 5cf216c91fd..d391895f878 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -9384,13 +9384,13 @@ - + - + diff --git a/src/mapi/glapi/glapi_sparc.S b/src/mapi/glapi/glapi_sparc.S index c353ece567f..da823282e54 100644 --- a/src/mapi/glapi/glapi_sparc.S +++ b/src/mapi/glapi/glapi_sparc.S @@ -813,10 +813,6 @@ gl_dispatch_functions_start: GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT) GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT) GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT) - GL_STUB(gl_dispatch_stub_608, _gloffset_CullParameterdvEXT) - HIDDEN(gl_dispatch_stub_608) - GL_STUB(gl_dispatch_stub_609, _gloffset_CullParameterfvEXT) - HIDDEN(gl_dispatch_stub_609) GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT) GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT) GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT) @@ -841,8 +837,8 @@ gl_dispatch_functions_start: GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT) GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT) GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT) - GL_STUB(gl_dispatch_stub_634, _gloffset_PixelTexGenSGIX) - HIDDEN(gl_dispatch_stub_634) + GL_STUB(gl_dispatch_stub_632, _gloffset_PixelTexGenSGIX) + HIDDEN(gl_dispatch_stub_632) GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT) GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV) GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV) @@ -884,24 +880,24 @@ gl_dispatch_functions_start: GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA) GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA) GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA) - GL_STUB(gl_dispatch_stub_676, _gloffset_MultiModeDrawArraysIBM) + GL_STUB(gl_dispatch_stub_674, _gloffset_MultiModeDrawArraysIBM) + HIDDEN(gl_dispatch_stub_674) + GL_STUB(gl_dispatch_stub_675, _gloffset_MultiModeDrawElementsIBM) + HIDDEN(gl_dispatch_stub_675) + GL_STUB(gl_dispatch_stub_676, _gloffset_DeleteFencesNV) HIDDEN(gl_dispatch_stub_676) - GL_STUB(gl_dispatch_stub_677, _gloffset_MultiModeDrawElementsIBM) + GL_STUB(gl_dispatch_stub_677, _gloffset_FinishFenceNV) HIDDEN(gl_dispatch_stub_677) - GL_STUB(gl_dispatch_stub_678, _gloffset_DeleteFencesNV) + GL_STUB(gl_dispatch_stub_678, _gloffset_GenFencesNV) HIDDEN(gl_dispatch_stub_678) - GL_STUB(gl_dispatch_stub_679, _gloffset_FinishFenceNV) + GL_STUB(gl_dispatch_stub_679, _gloffset_GetFenceivNV) HIDDEN(gl_dispatch_stub_679) - GL_STUB(gl_dispatch_stub_680, _gloffset_GenFencesNV) + GL_STUB(gl_dispatch_stub_680, _gloffset_IsFenceNV) HIDDEN(gl_dispatch_stub_680) - GL_STUB(gl_dispatch_stub_681, _gloffset_GetFenceivNV) + GL_STUB(gl_dispatch_stub_681, _gloffset_SetFenceNV) HIDDEN(gl_dispatch_stub_681) - GL_STUB(gl_dispatch_stub_682, _gloffset_IsFenceNV) + GL_STUB(gl_dispatch_stub_682, _gloffset_TestFenceNV) HIDDEN(gl_dispatch_stub_682) - GL_STUB(gl_dispatch_stub_683, _gloffset_SetFenceNV) - HIDDEN(gl_dispatch_stub_683) - GL_STUB(gl_dispatch_stub_684, _gloffset_TestFenceNV) - HIDDEN(gl_dispatch_stub_684) GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV) GL_STUB(glBindProgramNV, _gloffset_BindProgramNV) GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV) @@ -982,26 +978,26 @@ gl_dispatch_functions_start: GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI) GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV) GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV) - GL_STUB(gl_dispatch_stub_765, _gloffset_ActiveStencilFaceEXT) + GL_STUB(gl_dispatch_stub_763, _gloffset_ActiveStencilFaceEXT) + HIDDEN(gl_dispatch_stub_763) + GL_STUB(gl_dispatch_stub_764, _gloffset_BindVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_764) + GL_STUB(gl_dispatch_stub_765, _gloffset_DeleteVertexArraysAPPLE) HIDDEN(gl_dispatch_stub_765) - GL_STUB(gl_dispatch_stub_766, _gloffset_BindVertexArrayAPPLE) + GL_STUB(gl_dispatch_stub_766, _gloffset_GenVertexArraysAPPLE) HIDDEN(gl_dispatch_stub_766) - GL_STUB(gl_dispatch_stub_767, _gloffset_DeleteVertexArraysAPPLE) + GL_STUB(gl_dispatch_stub_767, _gloffset_IsVertexArrayAPPLE) HIDDEN(gl_dispatch_stub_767) - GL_STUB(gl_dispatch_stub_768, _gloffset_GenVertexArraysAPPLE) - HIDDEN(gl_dispatch_stub_768) - GL_STUB(gl_dispatch_stub_769, _gloffset_IsVertexArrayAPPLE) - HIDDEN(gl_dispatch_stub_769) GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV) GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV) GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV) GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV) GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV) GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV) - GL_STUB(gl_dispatch_stub_776, _gloffset_DepthBoundsEXT) - HIDDEN(gl_dispatch_stub_776) - GL_STUB(gl_dispatch_stub_777, _gloffset_BlendEquationSeparateEXT) - HIDDEN(gl_dispatch_stub_777) + GL_STUB(gl_dispatch_stub_774, _gloffset_DepthBoundsEXT) + HIDDEN(gl_dispatch_stub_774) + GL_STUB(gl_dispatch_stub_775, _gloffset_BlendEquationSeparateEXT) + HIDDEN(gl_dispatch_stub_775) GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT) GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT) GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT) @@ -1019,12 +1015,12 @@ gl_dispatch_functions_start: GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT) GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT) GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT) - GL_STUB(gl_dispatch_stub_795, _gloffset_BlitFramebufferEXT) + GL_STUB(gl_dispatch_stub_793, _gloffset_BlitFramebufferEXT) + HIDDEN(gl_dispatch_stub_793) + GL_STUB(gl_dispatch_stub_794, _gloffset_BufferParameteriAPPLE) + HIDDEN(gl_dispatch_stub_794) + GL_STUB(gl_dispatch_stub_795, _gloffset_FlushMappedBufferRangeAPPLE) HIDDEN(gl_dispatch_stub_795) - GL_STUB(gl_dispatch_stub_796, _gloffset_BufferParameteriAPPLE) - HIDDEN(gl_dispatch_stub_796) - GL_STUB(gl_dispatch_stub_797, _gloffset_FlushMappedBufferRangeAPPLE) - HIDDEN(gl_dispatch_stub_797) GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT) GL_STUB(glColorMaskIndexedEXT, _gloffset_ColorMaskIndexedEXT) GL_STUB(glDisableIndexedEXT, _gloffset_DisableIndexedEXT) @@ -1042,23 +1038,23 @@ gl_dispatch_functions_start: GL_STUB(glGetTransformFeedbackVaryingEXT, _gloffset_GetTransformFeedbackVaryingEXT) GL_STUB(glTransformFeedbackVaryingsEXT, _gloffset_TransformFeedbackVaryingsEXT) GL_STUB(glProvokingVertexEXT, _gloffset_ProvokingVertexEXT) - GL_STUB(gl_dispatch_stub_815, _gloffset_GetTexParameterPointervAPPLE) - HIDDEN(gl_dispatch_stub_815) - GL_STUB(gl_dispatch_stub_816, _gloffset_TextureRangeAPPLE) - HIDDEN(gl_dispatch_stub_816) + GL_STUB(gl_dispatch_stub_813, _gloffset_GetTexParameterPointervAPPLE) + HIDDEN(gl_dispatch_stub_813) + GL_STUB(gl_dispatch_stub_814, _gloffset_TextureRangeAPPLE) + HIDDEN(gl_dispatch_stub_814) GL_STUB(glGetObjectParameterivAPPLE, _gloffset_GetObjectParameterivAPPLE) GL_STUB(glObjectPurgeableAPPLE, _gloffset_ObjectPurgeableAPPLE) GL_STUB(glObjectUnpurgeableAPPLE, _gloffset_ObjectUnpurgeableAPPLE) - GL_STUB(gl_dispatch_stub_820, _gloffset_StencilFuncSeparateATI) + GL_STUB(gl_dispatch_stub_818, _gloffset_StencilFuncSeparateATI) + HIDDEN(gl_dispatch_stub_818) + GL_STUB(gl_dispatch_stub_819, _gloffset_ProgramEnvParameters4fvEXT) + HIDDEN(gl_dispatch_stub_819) + GL_STUB(gl_dispatch_stub_820, _gloffset_ProgramLocalParameters4fvEXT) HIDDEN(gl_dispatch_stub_820) - GL_STUB(gl_dispatch_stub_821, _gloffset_ProgramEnvParameters4fvEXT) + GL_STUB(gl_dispatch_stub_821, _gloffset_GetQueryObjecti64vEXT) HIDDEN(gl_dispatch_stub_821) - GL_STUB(gl_dispatch_stub_822, _gloffset_ProgramLocalParameters4fvEXT) + GL_STUB(gl_dispatch_stub_822, _gloffset_GetQueryObjectui64vEXT) HIDDEN(gl_dispatch_stub_822) - GL_STUB(gl_dispatch_stub_823, _gloffset_GetQueryObjecti64vEXT) - HIDDEN(gl_dispatch_stub_823) - GL_STUB(gl_dispatch_stub_824, _gloffset_GetQueryObjectui64vEXT) - HIDDEN(gl_dispatch_stub_824) GL_STUB(glEGLImageTargetRenderbufferStorageOES, _gloffset_EGLImageTargetRenderbufferStorageOES) GL_STUB(glEGLImageTargetTexture2DOES, _gloffset_EGLImageTargetTexture2DOES) GL_STUB_ALIAS(glArrayElementEXT, glArrayElement) diff --git a/src/mapi/glapi/glapi_x86-64.S b/src/mapi/glapi/glapi_x86-64.S index 8cfd815a500..8b44351a6c4 100644 --- a/src/mapi/glapi/glapi_x86-64.S +++ b/src/mapi/glapi/glapi_x86-64.S @@ -22938,89 +22938,13 @@ GL_PREFIX(UnlockArraysEXT): #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(UnlockArraysEXT), .-GL_PREFIX(UnlockArraysEXT) - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_608) - .type GL_PREFIX(_dispatch_stub_608), @function - HIDDEN(GL_PREFIX(_dispatch_stub_608)) -GL_PREFIX(_dispatch_stub_608): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 4864(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rbp - call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi - popq %rdi - movq 4864(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 4864(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - pushq %rsi - pushq %rbp - call _glapi_get_dispatch - popq %rbp - popq %rsi - popq %rdi - movq 4864(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_608), .-GL_PREFIX(_dispatch_stub_608) - - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_609) - .type GL_PREFIX(_dispatch_stub_609), @function - HIDDEN(GL_PREFIX(_dispatch_stub_609)) -GL_PREFIX(_dispatch_stub_609): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 4872(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rbp - call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi - popq %rdi - movq 4872(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 4872(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - pushq %rsi - pushq %rbp - call _glapi_get_dispatch - popq %rbp - popq %rsi - popq %rdi - movq 4872(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_609), .-GL_PREFIX(_dispatch_stub_609) - .p2align 4,,15 .globl GL_PREFIX(SecondaryColor3bEXT) .type GL_PREFIX(SecondaryColor3bEXT), @function GL_PREFIX(SecondaryColor3bEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4880(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23030,13 +22954,13 @@ GL_PREFIX(SecondaryColor3bEXT): popq %rdx popq %rsi popq %rdi - movq 4880(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4880(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23046,7 +22970,7 @@ GL_PREFIX(SecondaryColor3bEXT): popq %rdx popq %rsi popq %rdi - movq 4880(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3bEXT), .-GL_PREFIX(SecondaryColor3bEXT) @@ -23057,25 +22981,25 @@ GL_PREFIX(SecondaryColor3bEXT): GL_PREFIX(SecondaryColor3bvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4888(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4888(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4888(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4888(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3bvEXT), .-GL_PREFIX(SecondaryColor3bvEXT) @@ -23086,7 +23010,7 @@ GL_PREFIX(SecondaryColor3bvEXT): GL_PREFIX(SecondaryColor3dEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4896(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23098,13 +23022,13 @@ GL_PREFIX(SecondaryColor3dEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4896(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4896(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23116,7 +23040,7 @@ GL_PREFIX(SecondaryColor3dEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4896(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3dEXT), .-GL_PREFIX(SecondaryColor3dEXT) @@ -23127,25 +23051,25 @@ GL_PREFIX(SecondaryColor3dEXT): GL_PREFIX(SecondaryColor3dvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4904(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4904(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4904(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4904(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3dvEXT), .-GL_PREFIX(SecondaryColor3dvEXT) @@ -23156,7 +23080,7 @@ GL_PREFIX(SecondaryColor3dvEXT): GL_PREFIX(SecondaryColor3fEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4912(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23168,13 +23092,13 @@ GL_PREFIX(SecondaryColor3fEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4912(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4912(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23186,7 +23110,7 @@ GL_PREFIX(SecondaryColor3fEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4912(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3fEXT), .-GL_PREFIX(SecondaryColor3fEXT) @@ -23197,25 +23121,25 @@ GL_PREFIX(SecondaryColor3fEXT): GL_PREFIX(SecondaryColor3fvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4920(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4920(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4920(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4920(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3fvEXT), .-GL_PREFIX(SecondaryColor3fvEXT) @@ -23226,7 +23150,7 @@ GL_PREFIX(SecondaryColor3fvEXT): GL_PREFIX(SecondaryColor3iEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4928(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23236,13 +23160,13 @@ GL_PREFIX(SecondaryColor3iEXT): popq %rdx popq %rsi popq %rdi - movq 4928(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4928(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23252,7 +23176,7 @@ GL_PREFIX(SecondaryColor3iEXT): popq %rdx popq %rsi popq %rdi - movq 4928(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3iEXT), .-GL_PREFIX(SecondaryColor3iEXT) @@ -23263,25 +23187,25 @@ GL_PREFIX(SecondaryColor3iEXT): GL_PREFIX(SecondaryColor3ivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4936(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4936(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4936(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4936(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ivEXT), .-GL_PREFIX(SecondaryColor3ivEXT) @@ -23292,7 +23216,7 @@ GL_PREFIX(SecondaryColor3ivEXT): GL_PREFIX(SecondaryColor3sEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4944(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23302,13 +23226,13 @@ GL_PREFIX(SecondaryColor3sEXT): popq %rdx popq %rsi popq %rdi - movq 4944(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4944(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23318,7 +23242,7 @@ GL_PREFIX(SecondaryColor3sEXT): popq %rdx popq %rsi popq %rdi - movq 4944(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3sEXT), .-GL_PREFIX(SecondaryColor3sEXT) @@ -23329,25 +23253,25 @@ GL_PREFIX(SecondaryColor3sEXT): GL_PREFIX(SecondaryColor3svEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4952(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4952(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4952(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4952(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3svEXT), .-GL_PREFIX(SecondaryColor3svEXT) @@ -23358,7 +23282,7 @@ GL_PREFIX(SecondaryColor3svEXT): GL_PREFIX(SecondaryColor3ubEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4960(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23368,13 +23292,13 @@ GL_PREFIX(SecondaryColor3ubEXT): popq %rdx popq %rsi popq %rdi - movq 4960(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4960(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23384,7 +23308,7 @@ GL_PREFIX(SecondaryColor3ubEXT): popq %rdx popq %rsi popq %rdi - movq 4960(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ubEXT), .-GL_PREFIX(SecondaryColor3ubEXT) @@ -23395,25 +23319,25 @@ GL_PREFIX(SecondaryColor3ubEXT): GL_PREFIX(SecondaryColor3ubvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4968(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4968(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4968(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4968(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ubvEXT), .-GL_PREFIX(SecondaryColor3ubvEXT) @@ -23424,7 +23348,7 @@ GL_PREFIX(SecondaryColor3ubvEXT): GL_PREFIX(SecondaryColor3uiEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4976(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23434,13 +23358,13 @@ GL_PREFIX(SecondaryColor3uiEXT): popq %rdx popq %rsi popq %rdi - movq 4976(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4976(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23450,7 +23374,7 @@ GL_PREFIX(SecondaryColor3uiEXT): popq %rdx popq %rsi popq %rdi - movq 4976(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3uiEXT), .-GL_PREFIX(SecondaryColor3uiEXT) @@ -23461,25 +23385,25 @@ GL_PREFIX(SecondaryColor3uiEXT): GL_PREFIX(SecondaryColor3uivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4984(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4984(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4984(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4984(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3uivEXT), .-GL_PREFIX(SecondaryColor3uivEXT) @@ -23490,7 +23414,7 @@ GL_PREFIX(SecondaryColor3uivEXT): GL_PREFIX(SecondaryColor3usEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4992(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23500,13 +23424,13 @@ GL_PREFIX(SecondaryColor3usEXT): popq %rdx popq %rsi popq %rdi - movq 4992(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4992(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23516,7 +23440,7 @@ GL_PREFIX(SecondaryColor3usEXT): popq %rdx popq %rsi popq %rdi - movq 4992(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3usEXT), .-GL_PREFIX(SecondaryColor3usEXT) @@ -23527,25 +23451,25 @@ GL_PREFIX(SecondaryColor3usEXT): GL_PREFIX(SecondaryColor3usvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5000(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5000(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5000(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5000(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3usvEXT), .-GL_PREFIX(SecondaryColor3usvEXT) @@ -23556,7 +23480,7 @@ GL_PREFIX(SecondaryColor3usvEXT): GL_PREFIX(SecondaryColorPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5008(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23570,13 +23494,13 @@ GL_PREFIX(SecondaryColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 5008(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5008(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23590,7 +23514,7 @@ GL_PREFIX(SecondaryColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 5008(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColorPointerEXT), .-GL_PREFIX(SecondaryColorPointerEXT) @@ -23601,7 +23525,7 @@ GL_PREFIX(SecondaryColorPointerEXT): GL_PREFIX(MultiDrawArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5016(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23615,13 +23539,13 @@ GL_PREFIX(MultiDrawArraysEXT): popq %rdx popq %rsi popq %rdi - movq 5016(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5016(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23635,7 +23559,7 @@ GL_PREFIX(MultiDrawArraysEXT): popq %rdx popq %rsi popq %rdi - movq 5016(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(MultiDrawArraysEXT), .-GL_PREFIX(MultiDrawArraysEXT) @@ -23646,7 +23570,7 @@ GL_PREFIX(MultiDrawArraysEXT): GL_PREFIX(MultiDrawElementsEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5024(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23660,13 +23584,13 @@ GL_PREFIX(MultiDrawElementsEXT): popq %rdx popq %rsi popq %rdi - movq 5024(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5024(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23680,7 +23604,7 @@ GL_PREFIX(MultiDrawElementsEXT): popq %rdx popq %rsi popq %rdi - movq 5024(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(MultiDrawElementsEXT), .-GL_PREFIX(MultiDrawElementsEXT) @@ -23691,7 +23615,7 @@ GL_PREFIX(MultiDrawElementsEXT): GL_PREFIX(FogCoordPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5032(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23701,13 +23625,13 @@ GL_PREFIX(FogCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 5032(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5032(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23717,7 +23641,7 @@ GL_PREFIX(FogCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 5032(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordPointerEXT), .-GL_PREFIX(FogCoordPointerEXT) @@ -23728,7 +23652,7 @@ GL_PREFIX(FogCoordPointerEXT): GL_PREFIX(FogCoorddEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5040(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $8, %rsp @@ -23736,13 +23660,13 @@ GL_PREFIX(FogCoorddEXT): call _x86_64_get_dispatch@PLT movq (%rsp), %xmm0 addq $8, %rsp - movq 5040(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5040(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 1: subq $8, %rsp @@ -23750,7 +23674,7 @@ GL_PREFIX(FogCoorddEXT): call _glapi_get_dispatch movq (%rsp), %xmm0 addq $8, %rsp - movq 5040(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoorddEXT), .-GL_PREFIX(FogCoorddEXT) @@ -23761,25 +23685,25 @@ GL_PREFIX(FogCoorddEXT): GL_PREFIX(FogCoorddvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5048(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5048(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5048(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5048(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoorddvEXT), .-GL_PREFIX(FogCoorddvEXT) @@ -23790,7 +23714,7 @@ GL_PREFIX(FogCoorddvEXT): GL_PREFIX(FogCoordfEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5056(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $8, %rsp @@ -23798,13 +23722,13 @@ GL_PREFIX(FogCoordfEXT): call _x86_64_get_dispatch@PLT movq (%rsp), %xmm0 addq $8, %rsp - movq 5056(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5056(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 1: subq $8, %rsp @@ -23812,7 +23736,7 @@ GL_PREFIX(FogCoordfEXT): call _glapi_get_dispatch movq (%rsp), %xmm0 addq $8, %rsp - movq 5056(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordfEXT), .-GL_PREFIX(FogCoordfEXT) @@ -23823,58 +23747,58 @@ GL_PREFIX(FogCoordfEXT): GL_PREFIX(FogCoordfvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5064(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5064(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5064(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5064(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordfvEXT), .-GL_PREFIX(FogCoordfvEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_634) - .type GL_PREFIX(_dispatch_stub_634), @function - HIDDEN(GL_PREFIX(_dispatch_stub_634)) -GL_PREFIX(_dispatch_stub_634): + .globl GL_PREFIX(_dispatch_stub_632) + .type GL_PREFIX(_dispatch_stub_632), @function + HIDDEN(GL_PREFIX(_dispatch_stub_632)) +GL_PREFIX(_dispatch_stub_632): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5072(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5072(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5072(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5072(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_634), .-GL_PREFIX(_dispatch_stub_634) + .size GL_PREFIX(_dispatch_stub_632), .-GL_PREFIX(_dispatch_stub_632) .p2align 4,,15 .globl GL_PREFIX(BlendFuncSeparateEXT) @@ -23882,7 +23806,7 @@ GL_PREFIX(_dispatch_stub_634): GL_PREFIX(BlendFuncSeparateEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5080(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23896,13 +23820,13 @@ GL_PREFIX(BlendFuncSeparateEXT): popq %rdx popq %rsi popq %rdi - movq 5080(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5080(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23916,7 +23840,7 @@ GL_PREFIX(BlendFuncSeparateEXT): popq %rdx popq %rsi popq %rdi - movq 5080(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BlendFuncSeparateEXT), .-GL_PREFIX(BlendFuncSeparateEXT) @@ -23927,25 +23851,25 @@ GL_PREFIX(BlendFuncSeparateEXT): GL_PREFIX(FlushVertexArrayRangeNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5088(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5088(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5088(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5088(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FlushVertexArrayRangeNV), .-GL_PREFIX(FlushVertexArrayRangeNV) @@ -23956,7 +23880,7 @@ GL_PREFIX(FlushVertexArrayRangeNV): GL_PREFIX(VertexArrayRangeNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5096(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23966,13 +23890,13 @@ GL_PREFIX(VertexArrayRangeNV): popq %rbp popq %rsi popq %rdi - movq 5096(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5096(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23982,7 +23906,7 @@ GL_PREFIX(VertexArrayRangeNV): popq %rbp popq %rsi popq %rdi - movq 5096(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexArrayRangeNV), .-GL_PREFIX(VertexArrayRangeNV) @@ -23993,7 +23917,7 @@ GL_PREFIX(VertexArrayRangeNV): GL_PREFIX(CombinerInputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5104(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24011,13 +23935,13 @@ GL_PREFIX(CombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 5104(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5104(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24035,7 +23959,7 @@ GL_PREFIX(CombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 5104(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerInputNV), .-GL_PREFIX(CombinerInputNV) @@ -24046,7 +23970,7 @@ GL_PREFIX(CombinerInputNV): GL_PREFIX(CombinerOutputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5112(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24064,13 +23988,13 @@ GL_PREFIX(CombinerOutputNV): popq %rdx popq %rsi popq %rdi - movq 5112(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5112(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24088,7 +24012,7 @@ GL_PREFIX(CombinerOutputNV): popq %rdx popq %rsi popq %rdi - movq 5112(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerOutputNV), .-GL_PREFIX(CombinerOutputNV) @@ -24099,7 +24023,7 @@ GL_PREFIX(CombinerOutputNV): GL_PREFIX(CombinerParameterfNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5120(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -24109,13 +24033,13 @@ GL_PREFIX(CombinerParameterfNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5120(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5120(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -24125,7 +24049,7 @@ GL_PREFIX(CombinerParameterfNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5120(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterfNV), .-GL_PREFIX(CombinerParameterfNV) @@ -24136,7 +24060,7 @@ GL_PREFIX(CombinerParameterfNV): GL_PREFIX(CombinerParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5128(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24146,13 +24070,13 @@ GL_PREFIX(CombinerParameterfvNV): popq %rbp popq %rsi popq %rdi - movq 5128(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5128(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24162,7 +24086,7 @@ GL_PREFIX(CombinerParameterfvNV): popq %rbp popq %rsi popq %rdi - movq 5128(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterfvNV), .-GL_PREFIX(CombinerParameterfvNV) @@ -24173,7 +24097,7 @@ GL_PREFIX(CombinerParameterfvNV): GL_PREFIX(CombinerParameteriNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5136(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24183,13 +24107,13 @@ GL_PREFIX(CombinerParameteriNV): popq %rbp popq %rsi popq %rdi - movq 5136(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5136(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24199,7 +24123,7 @@ GL_PREFIX(CombinerParameteriNV): popq %rbp popq %rsi popq %rdi - movq 5136(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameteriNV), .-GL_PREFIX(CombinerParameteriNV) @@ -24210,7 +24134,7 @@ GL_PREFIX(CombinerParameteriNV): GL_PREFIX(CombinerParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5144(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24220,13 +24144,13 @@ GL_PREFIX(CombinerParameterivNV): popq %rbp popq %rsi popq %rdi - movq 5144(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5144(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24236,7 +24160,7 @@ GL_PREFIX(CombinerParameterivNV): popq %rbp popq %rsi popq %rdi - movq 5144(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterivNV), .-GL_PREFIX(CombinerParameterivNV) @@ -24247,7 +24171,7 @@ GL_PREFIX(CombinerParameterivNV): GL_PREFIX(FinalCombinerInputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5152(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24261,13 +24185,13 @@ GL_PREFIX(FinalCombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 5152(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5152(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24281,7 +24205,7 @@ GL_PREFIX(FinalCombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 5152(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FinalCombinerInputNV), .-GL_PREFIX(FinalCombinerInputNV) @@ -24292,7 +24216,7 @@ GL_PREFIX(FinalCombinerInputNV): GL_PREFIX(GetCombinerInputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5160(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24306,13 +24230,13 @@ GL_PREFIX(GetCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5160(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5160(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24326,7 +24250,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5160(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerInputParameterfvNV), .-GL_PREFIX(GetCombinerInputParameterfvNV) @@ -24337,7 +24261,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV): GL_PREFIX(GetCombinerInputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5168(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24351,13 +24275,13 @@ GL_PREFIX(GetCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 5168(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5168(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24371,7 +24295,7 @@ GL_PREFIX(GetCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 5168(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerInputParameterivNV), .-GL_PREFIX(GetCombinerInputParameterivNV) @@ -24382,7 +24306,7 @@ GL_PREFIX(GetCombinerInputParameterivNV): GL_PREFIX(GetCombinerOutputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5176(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24396,13 +24320,13 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5176(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5176(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24416,7 +24340,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5176(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerOutputParameterfvNV), .-GL_PREFIX(GetCombinerOutputParameterfvNV) @@ -24427,7 +24351,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): GL_PREFIX(GetCombinerOutputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5184(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24441,13 +24365,13 @@ GL_PREFIX(GetCombinerOutputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 5184(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5184(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24461,7 +24385,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 5184(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerOutputParameterivNV), .-GL_PREFIX(GetCombinerOutputParameterivNV) @@ -24472,7 +24396,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV): GL_PREFIX(GetFinalCombinerInputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5192(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24482,13 +24406,13 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5192(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5192(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24498,7 +24422,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5192(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFinalCombinerInputParameterfvNV), .-GL_PREFIX(GetFinalCombinerInputParameterfvNV) @@ -24509,7 +24433,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): GL_PREFIX(GetFinalCombinerInputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5200(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24519,13 +24443,13 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 5200(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5200(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24535,7 +24459,7 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 5200(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFinalCombinerInputParameterivNV), .-GL_PREFIX(GetFinalCombinerInputParameterivNV) @@ -24546,25 +24470,25 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): GL_PREFIX(ResizeBuffersMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5208(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5208(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5208(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5208(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ResizeBuffersMESA), .-GL_PREFIX(ResizeBuffersMESA) @@ -24575,7 +24499,7 @@ GL_PREFIX(ResizeBuffersMESA): GL_PREFIX(WindowPos2dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5216(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -24585,13 +24509,13 @@ GL_PREFIX(WindowPos2dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5216(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5216(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -24601,7 +24525,7 @@ GL_PREFIX(WindowPos2dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5216(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2dMESA), .-GL_PREFIX(WindowPos2dMESA) @@ -24612,25 +24536,25 @@ GL_PREFIX(WindowPos2dMESA): GL_PREFIX(WindowPos2dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5224(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5224(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5224(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5224(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2dvMESA), .-GL_PREFIX(WindowPos2dvMESA) @@ -24641,7 +24565,7 @@ GL_PREFIX(WindowPos2dvMESA): GL_PREFIX(WindowPos2fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5232(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -24651,13 +24575,13 @@ GL_PREFIX(WindowPos2fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5232(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5232(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -24667,7 +24591,7 @@ GL_PREFIX(WindowPos2fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5232(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2fMESA), .-GL_PREFIX(WindowPos2fMESA) @@ -24678,25 +24602,25 @@ GL_PREFIX(WindowPos2fMESA): GL_PREFIX(WindowPos2fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5240(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5240(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5240(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5240(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2fvMESA), .-GL_PREFIX(WindowPos2fvMESA) @@ -24707,7 +24631,7 @@ GL_PREFIX(WindowPos2fvMESA): GL_PREFIX(WindowPos2iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5248(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24717,13 +24641,13 @@ GL_PREFIX(WindowPos2iMESA): popq %rbp popq %rsi popq %rdi - movq 5248(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5248(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24733,7 +24657,7 @@ GL_PREFIX(WindowPos2iMESA): popq %rbp popq %rsi popq %rdi - movq 5248(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2iMESA), .-GL_PREFIX(WindowPos2iMESA) @@ -24744,25 +24668,25 @@ GL_PREFIX(WindowPos2iMESA): GL_PREFIX(WindowPos2ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5256(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5256(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5256(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5256(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2ivMESA), .-GL_PREFIX(WindowPos2ivMESA) @@ -24773,7 +24697,7 @@ GL_PREFIX(WindowPos2ivMESA): GL_PREFIX(WindowPos2sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5264(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24783,13 +24707,13 @@ GL_PREFIX(WindowPos2sMESA): popq %rbp popq %rsi popq %rdi - movq 5264(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5264(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24799,7 +24723,7 @@ GL_PREFIX(WindowPos2sMESA): popq %rbp popq %rsi popq %rdi - movq 5264(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2sMESA), .-GL_PREFIX(WindowPos2sMESA) @@ -24810,25 +24734,25 @@ GL_PREFIX(WindowPos2sMESA): GL_PREFIX(WindowPos2svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5272(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5272(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5272(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5272(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2svMESA), .-GL_PREFIX(WindowPos2svMESA) @@ -24839,7 +24763,7 @@ GL_PREFIX(WindowPos2svMESA): GL_PREFIX(WindowPos3dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5280(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -24851,13 +24775,13 @@ GL_PREFIX(WindowPos3dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5280(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5280(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -24869,7 +24793,7 @@ GL_PREFIX(WindowPos3dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5280(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3dMESA), .-GL_PREFIX(WindowPos3dMESA) @@ -24880,25 +24804,25 @@ GL_PREFIX(WindowPos3dMESA): GL_PREFIX(WindowPos3dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5288(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5288(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5288(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5288(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3dvMESA), .-GL_PREFIX(WindowPos3dvMESA) @@ -24909,7 +24833,7 @@ GL_PREFIX(WindowPos3dvMESA): GL_PREFIX(WindowPos3fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5296(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -24921,13 +24845,13 @@ GL_PREFIX(WindowPos3fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5296(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5296(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -24939,7 +24863,7 @@ GL_PREFIX(WindowPos3fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5296(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3fMESA), .-GL_PREFIX(WindowPos3fMESA) @@ -24950,25 +24874,25 @@ GL_PREFIX(WindowPos3fMESA): GL_PREFIX(WindowPos3fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5304(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5304(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5304(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5304(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3fvMESA), .-GL_PREFIX(WindowPos3fvMESA) @@ -24979,7 +24903,7 @@ GL_PREFIX(WindowPos3fvMESA): GL_PREFIX(WindowPos3iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5312(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24989,13 +24913,13 @@ GL_PREFIX(WindowPos3iMESA): popq %rdx popq %rsi popq %rdi - movq 5312(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5312(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25005,7 +24929,7 @@ GL_PREFIX(WindowPos3iMESA): popq %rdx popq %rsi popq %rdi - movq 5312(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3iMESA), .-GL_PREFIX(WindowPos3iMESA) @@ -25016,25 +24940,25 @@ GL_PREFIX(WindowPos3iMESA): GL_PREFIX(WindowPos3ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5320(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5320(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5320(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5320(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3ivMESA), .-GL_PREFIX(WindowPos3ivMESA) @@ -25045,7 +24969,7 @@ GL_PREFIX(WindowPos3ivMESA): GL_PREFIX(WindowPos3sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5328(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25055,13 +24979,13 @@ GL_PREFIX(WindowPos3sMESA): popq %rdx popq %rsi popq %rdi - movq 5328(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5328(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25071,7 +24995,7 @@ GL_PREFIX(WindowPos3sMESA): popq %rdx popq %rsi popq %rdi - movq 5328(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3sMESA), .-GL_PREFIX(WindowPos3sMESA) @@ -25082,25 +25006,25 @@ GL_PREFIX(WindowPos3sMESA): GL_PREFIX(WindowPos3svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5336(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5336(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5336(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5336(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3svMESA), .-GL_PREFIX(WindowPos3svMESA) @@ -25111,7 +25035,7 @@ GL_PREFIX(WindowPos3svMESA): GL_PREFIX(WindowPos4dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5344(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -25125,13 +25049,13 @@ GL_PREFIX(WindowPos4dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5344(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5344(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -25145,7 +25069,7 @@ GL_PREFIX(WindowPos4dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5344(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4dMESA), .-GL_PREFIX(WindowPos4dMESA) @@ -25156,25 +25080,25 @@ GL_PREFIX(WindowPos4dMESA): GL_PREFIX(WindowPos4dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5352(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5352(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5352(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5352(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4dvMESA), .-GL_PREFIX(WindowPos4dvMESA) @@ -25185,7 +25109,7 @@ GL_PREFIX(WindowPos4dvMESA): GL_PREFIX(WindowPos4fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5360(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -25199,13 +25123,13 @@ GL_PREFIX(WindowPos4fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5360(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5360(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -25219,7 +25143,7 @@ GL_PREFIX(WindowPos4fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5360(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4fMESA), .-GL_PREFIX(WindowPos4fMESA) @@ -25230,25 +25154,25 @@ GL_PREFIX(WindowPos4fMESA): GL_PREFIX(WindowPos4fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5368(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5368(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5368(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5368(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4fvMESA), .-GL_PREFIX(WindowPos4fvMESA) @@ -25259,7 +25183,7 @@ GL_PREFIX(WindowPos4fvMESA): GL_PREFIX(WindowPos4iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5376(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25273,13 +25197,13 @@ GL_PREFIX(WindowPos4iMESA): popq %rdx popq %rsi popq %rdi - movq 5376(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5376(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25293,7 +25217,7 @@ GL_PREFIX(WindowPos4iMESA): popq %rdx popq %rsi popq %rdi - movq 5376(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4iMESA), .-GL_PREFIX(WindowPos4iMESA) @@ -25304,25 +25228,25 @@ GL_PREFIX(WindowPos4iMESA): GL_PREFIX(WindowPos4ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5384(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5384(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5384(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5384(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4ivMESA), .-GL_PREFIX(WindowPos4ivMESA) @@ -25333,7 +25257,7 @@ GL_PREFIX(WindowPos4ivMESA): GL_PREFIX(WindowPos4sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5392(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25347,13 +25271,13 @@ GL_PREFIX(WindowPos4sMESA): popq %rdx popq %rsi popq %rdi - movq 5392(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5392(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25367,7 +25291,7 @@ GL_PREFIX(WindowPos4sMESA): popq %rdx popq %rsi popq %rdi - movq 5392(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4sMESA), .-GL_PREFIX(WindowPos4sMESA) @@ -25378,37 +25302,37 @@ GL_PREFIX(WindowPos4sMESA): GL_PREFIX(WindowPos4svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5400(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5400(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5400(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5400(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_676) - .type GL_PREFIX(_dispatch_stub_676), @function - HIDDEN(GL_PREFIX(_dispatch_stub_676)) -GL_PREFIX(_dispatch_stub_676): + .globl GL_PREFIX(_dispatch_stub_674) + .type GL_PREFIX(_dispatch_stub_674), @function + HIDDEN(GL_PREFIX(_dispatch_stub_674)) +GL_PREFIX(_dispatch_stub_674): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5408(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25422,13 +25346,13 @@ GL_PREFIX(_dispatch_stub_676): popq %rdx popq %rsi popq %rdi - movq 5408(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5408(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25442,19 +25366,19 @@ GL_PREFIX(_dispatch_stub_676): popq %rdx popq %rsi popq %rdi - movq 5408(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_676), .-GL_PREFIX(_dispatch_stub_676) + .size GL_PREFIX(_dispatch_stub_674), .-GL_PREFIX(_dispatch_stub_674) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_677) - .type GL_PREFIX(_dispatch_stub_677), @function - HIDDEN(GL_PREFIX(_dispatch_stub_677)) -GL_PREFIX(_dispatch_stub_677): + .globl GL_PREFIX(_dispatch_stub_675) + .type GL_PREFIX(_dispatch_stub_675), @function + HIDDEN(GL_PREFIX(_dispatch_stub_675)) +GL_PREFIX(_dispatch_stub_675): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5416(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25472,13 +25396,13 @@ GL_PREFIX(_dispatch_stub_677): popq %rdx popq %rsi popq %rdi - movq 5416(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5416(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25496,6 +25420,74 @@ GL_PREFIX(_dispatch_stub_677): popq %rdx popq %rsi popq %rdi + movq 5400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_675), .-GL_PREFIX(_dispatch_stub_675) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_676) + .type GL_PREFIX(_dispatch_stub_676), @function + HIDDEN(GL_PREFIX(_dispatch_stub_676)) +GL_PREFIX(_dispatch_stub_676): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_676), .-GL_PREFIX(_dispatch_stub_676) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_677) + .type GL_PREFIX(_dispatch_stub_677), @function + HIDDEN(GL_PREFIX(_dispatch_stub_677)) +GL_PREFIX(_dispatch_stub_677): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi movq 5416(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ @@ -25550,7 +25542,11 @@ GL_PREFIX(_dispatch_stub_679): jmp *%r11 #elif defined(PTHREADS) pushq %rdi + pushq %rsi + pushq %rdx call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi popq %rdi movq 5432(%rax), %r11 jmp *%r11 @@ -25562,7 +25558,11 @@ GL_PREFIX(_dispatch_stub_679): jmp *%r11 1: pushq %rdi + pushq %rsi + pushq %rdx call _glapi_get_dispatch + popq %rdx + popq %rsi popq %rdi movq 5432(%rax), %r11 jmp *%r11 @@ -25580,11 +25580,7 @@ GL_PREFIX(_dispatch_stub_680): jmp *%r11 #elif defined(PTHREADS) pushq %rdi - pushq %rsi - pushq %rbp call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi popq %rdi movq 5440(%rax), %r11 jmp *%r11 @@ -25596,11 +25592,7 @@ GL_PREFIX(_dispatch_stub_680): jmp *%r11 1: pushq %rdi - pushq %rsi - pushq %rbp call _glapi_get_dispatch - popq %rbp - popq %rsi popq %rdi movq 5440(%rax), %r11 jmp *%r11 @@ -25619,9 +25611,9 @@ GL_PREFIX(_dispatch_stub_681): #elif defined(PTHREADS) pushq %rdi pushq %rsi - pushq %rdx + pushq %rbp call _x86_64_get_dispatch@PLT - popq %rdx + popq %rbp popq %rsi popq %rdi movq 5448(%rax), %r11 @@ -25635,9 +25627,9 @@ GL_PREFIX(_dispatch_stub_681): 1: pushq %rdi pushq %rsi - pushq %rdx + pushq %rbp call _glapi_get_dispatch - popq %rdx + popq %rbp popq %rsi popq %rdi movq 5448(%rax), %r11 @@ -25675,81 +25667,13 @@ GL_PREFIX(_dispatch_stub_682): #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_682), .-GL_PREFIX(_dispatch_stub_682) - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_683) - .type GL_PREFIX(_dispatch_stub_683), @function - HIDDEN(GL_PREFIX(_dispatch_stub_683)) -GL_PREFIX(_dispatch_stub_683): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 5464(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rbp - call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi - popq %rdi - movq 5464(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 5464(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - pushq %rsi - pushq %rbp - call _glapi_get_dispatch - popq %rbp - popq %rsi - popq %rdi - movq 5464(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_683), .-GL_PREFIX(_dispatch_stub_683) - - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_684) - .type GL_PREFIX(_dispatch_stub_684), @function - HIDDEN(GL_PREFIX(_dispatch_stub_684)) -GL_PREFIX(_dispatch_stub_684): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 5472(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - call _x86_64_get_dispatch@PLT - popq %rdi - movq 5472(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 5472(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - call _glapi_get_dispatch - popq %rdi - movq 5472(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_684), .-GL_PREFIX(_dispatch_stub_684) - .p2align 4,,15 .globl GL_PREFIX(AreProgramsResidentNV) .type GL_PREFIX(AreProgramsResidentNV), @function GL_PREFIX(AreProgramsResidentNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5480(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25759,13 +25683,13 @@ GL_PREFIX(AreProgramsResidentNV): popq %rdx popq %rsi popq %rdi - movq 5480(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5480(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25775,7 +25699,7 @@ GL_PREFIX(AreProgramsResidentNV): popq %rdx popq %rsi popq %rdi - movq 5480(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AreProgramsResidentNV), .-GL_PREFIX(AreProgramsResidentNV) @@ -25786,7 +25710,7 @@ GL_PREFIX(AreProgramsResidentNV): GL_PREFIX(BindProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5488(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25796,13 +25720,13 @@ GL_PREFIX(BindProgramNV): popq %rbp popq %rsi popq %rdi - movq 5488(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5488(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25812,7 +25736,7 @@ GL_PREFIX(BindProgramNV): popq %rbp popq %rsi popq %rdi - movq 5488(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindProgramNV), .-GL_PREFIX(BindProgramNV) @@ -25823,7 +25747,7 @@ GL_PREFIX(BindProgramNV): GL_PREFIX(DeleteProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5496(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25833,13 +25757,13 @@ GL_PREFIX(DeleteProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5496(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5496(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25849,7 +25773,7 @@ GL_PREFIX(DeleteProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5496(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteProgramsNV), .-GL_PREFIX(DeleteProgramsNV) @@ -25860,7 +25784,7 @@ GL_PREFIX(DeleteProgramsNV): GL_PREFIX(ExecuteProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5504(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25870,13 +25794,13 @@ GL_PREFIX(ExecuteProgramNV): popq %rdx popq %rsi popq %rdi - movq 5504(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5504(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25886,7 +25810,7 @@ GL_PREFIX(ExecuteProgramNV): popq %rdx popq %rsi popq %rdi - movq 5504(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ExecuteProgramNV), .-GL_PREFIX(ExecuteProgramNV) @@ -25897,7 +25821,7 @@ GL_PREFIX(ExecuteProgramNV): GL_PREFIX(GenProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5512(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25907,13 +25831,13 @@ GL_PREFIX(GenProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5512(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5512(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25923,7 +25847,7 @@ GL_PREFIX(GenProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5512(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenProgramsNV), .-GL_PREFIX(GenProgramsNV) @@ -25934,7 +25858,7 @@ GL_PREFIX(GenProgramsNV): GL_PREFIX(GetProgramParameterdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5520(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25948,13 +25872,13 @@ GL_PREFIX(GetProgramParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5520(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5520(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25968,7 +25892,7 @@ GL_PREFIX(GetProgramParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5520(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramParameterdvNV), .-GL_PREFIX(GetProgramParameterdvNV) @@ -25979,7 +25903,7 @@ GL_PREFIX(GetProgramParameterdvNV): GL_PREFIX(GetProgramParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5528(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25993,13 +25917,13 @@ GL_PREFIX(GetProgramParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5528(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5528(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26013,7 +25937,7 @@ GL_PREFIX(GetProgramParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5528(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramParameterfvNV), .-GL_PREFIX(GetProgramParameterfvNV) @@ -26024,7 +25948,7 @@ GL_PREFIX(GetProgramParameterfvNV): GL_PREFIX(GetProgramStringNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5536(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26034,13 +25958,13 @@ GL_PREFIX(GetProgramStringNV): popq %rdx popq %rsi popq %rdi - movq 5536(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5536(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26050,7 +25974,7 @@ GL_PREFIX(GetProgramStringNV): popq %rdx popq %rsi popq %rdi - movq 5536(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramStringNV), .-GL_PREFIX(GetProgramStringNV) @@ -26061,7 +25985,7 @@ GL_PREFIX(GetProgramStringNV): GL_PREFIX(GetProgramivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5544(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26071,13 +25995,13 @@ GL_PREFIX(GetProgramivNV): popq %rdx popq %rsi popq %rdi - movq 5544(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5544(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26087,7 +26011,7 @@ GL_PREFIX(GetProgramivNV): popq %rdx popq %rsi popq %rdi - movq 5544(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramivNV), .-GL_PREFIX(GetProgramivNV) @@ -26098,7 +26022,7 @@ GL_PREFIX(GetProgramivNV): GL_PREFIX(GetTrackMatrixivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5552(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26112,13 +26036,13 @@ GL_PREFIX(GetTrackMatrixivNV): popq %rdx popq %rsi popq %rdi - movq 5552(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5552(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26132,7 +26056,7 @@ GL_PREFIX(GetTrackMatrixivNV): popq %rdx popq %rsi popq %rdi - movq 5552(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTrackMatrixivNV), .-GL_PREFIX(GetTrackMatrixivNV) @@ -26143,7 +26067,7 @@ GL_PREFIX(GetTrackMatrixivNV): GL_PREFIX(GetVertexAttribPointervNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5560(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26153,13 +26077,13 @@ GL_PREFIX(GetVertexAttribPointervNV): popq %rdx popq %rsi popq %rdi - movq 5560(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5560(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26169,7 +26093,7 @@ GL_PREFIX(GetVertexAttribPointervNV): popq %rdx popq %rsi popq %rdi - movq 5560(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribPointervNV), .-GL_PREFIX(GetVertexAttribPointervNV) @@ -26180,7 +26104,7 @@ GL_PREFIX(GetVertexAttribPointervNV): GL_PREFIX(GetVertexAttribdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5568(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26190,13 +26114,13 @@ GL_PREFIX(GetVertexAttribdvNV): popq %rdx popq %rsi popq %rdi - movq 5568(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5568(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26206,7 +26130,7 @@ GL_PREFIX(GetVertexAttribdvNV): popq %rdx popq %rsi popq %rdi - movq 5568(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribdvNV), .-GL_PREFIX(GetVertexAttribdvNV) @@ -26217,7 +26141,7 @@ GL_PREFIX(GetVertexAttribdvNV): GL_PREFIX(GetVertexAttribfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5576(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26227,13 +26151,13 @@ GL_PREFIX(GetVertexAttribfvNV): popq %rdx popq %rsi popq %rdi - movq 5576(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5576(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26243,7 +26167,7 @@ GL_PREFIX(GetVertexAttribfvNV): popq %rdx popq %rsi popq %rdi - movq 5576(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribfvNV), .-GL_PREFIX(GetVertexAttribfvNV) @@ -26254,7 +26178,7 @@ GL_PREFIX(GetVertexAttribfvNV): GL_PREFIX(GetVertexAttribivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5584(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26264,13 +26188,13 @@ GL_PREFIX(GetVertexAttribivNV): popq %rdx popq %rsi popq %rdi - movq 5584(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5584(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26280,7 +26204,7 @@ GL_PREFIX(GetVertexAttribivNV): popq %rdx popq %rsi popq %rdi - movq 5584(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribivNV), .-GL_PREFIX(GetVertexAttribivNV) @@ -26291,25 +26215,25 @@ GL_PREFIX(GetVertexAttribivNV): GL_PREFIX(IsProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5592(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5592(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5592(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5592(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsProgramNV), .-GL_PREFIX(IsProgramNV) @@ -26320,7 +26244,7 @@ GL_PREFIX(IsProgramNV): GL_PREFIX(LoadProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5600(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26334,13 +26258,13 @@ GL_PREFIX(LoadProgramNV): popq %rdx popq %rsi popq %rdi - movq 5600(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5600(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26354,7 +26278,7 @@ GL_PREFIX(LoadProgramNV): popq %rdx popq %rsi popq %rdi - movq 5600(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(LoadProgramNV), .-GL_PREFIX(LoadProgramNV) @@ -26365,7 +26289,7 @@ GL_PREFIX(LoadProgramNV): GL_PREFIX(ProgramParameters4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5608(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26379,13 +26303,13 @@ GL_PREFIX(ProgramParameters4dvNV): popq %rdx popq %rsi popq %rdi - movq 5608(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5608(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26399,7 +26323,7 @@ GL_PREFIX(ProgramParameters4dvNV): popq %rdx popq %rsi popq %rdi - movq 5608(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramParameters4dvNV), .-GL_PREFIX(ProgramParameters4dvNV) @@ -26410,7 +26334,7 @@ GL_PREFIX(ProgramParameters4dvNV): GL_PREFIX(ProgramParameters4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5616(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26424,13 +26348,13 @@ GL_PREFIX(ProgramParameters4fvNV): popq %rdx popq %rsi popq %rdi - movq 5616(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5616(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26444,7 +26368,7 @@ GL_PREFIX(ProgramParameters4fvNV): popq %rdx popq %rsi popq %rdi - movq 5616(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramParameters4fvNV), .-GL_PREFIX(ProgramParameters4fvNV) @@ -26455,7 +26379,7 @@ GL_PREFIX(ProgramParameters4fvNV): GL_PREFIX(RequestResidentProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5624(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26465,13 +26389,13 @@ GL_PREFIX(RequestResidentProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5624(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5624(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26481,7 +26405,7 @@ GL_PREFIX(RequestResidentProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5624(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(RequestResidentProgramsNV), .-GL_PREFIX(RequestResidentProgramsNV) @@ -26492,7 +26416,7 @@ GL_PREFIX(RequestResidentProgramsNV): GL_PREFIX(TrackMatrixNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5632(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26506,13 +26430,13 @@ GL_PREFIX(TrackMatrixNV): popq %rdx popq %rsi popq %rdi - movq 5632(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5632(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26526,7 +26450,7 @@ GL_PREFIX(TrackMatrixNV): popq %rdx popq %rsi popq %rdi - movq 5632(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TrackMatrixNV), .-GL_PREFIX(TrackMatrixNV) @@ -26537,7 +26461,7 @@ GL_PREFIX(TrackMatrixNV): GL_PREFIX(VertexAttrib1dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5640(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -26547,13 +26471,13 @@ GL_PREFIX(VertexAttrib1dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5640(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5640(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -26563,7 +26487,7 @@ GL_PREFIX(VertexAttrib1dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5640(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1dNV), .-GL_PREFIX(VertexAttrib1dNV) @@ -26574,7 +26498,7 @@ GL_PREFIX(VertexAttrib1dNV): GL_PREFIX(VertexAttrib1dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5648(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26584,13 +26508,13 @@ GL_PREFIX(VertexAttrib1dvNV): popq %rbp popq %rsi popq %rdi - movq 5648(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5648(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26600,7 +26524,7 @@ GL_PREFIX(VertexAttrib1dvNV): popq %rbp popq %rsi popq %rdi - movq 5648(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1dvNV), .-GL_PREFIX(VertexAttrib1dvNV) @@ -26611,7 +26535,7 @@ GL_PREFIX(VertexAttrib1dvNV): GL_PREFIX(VertexAttrib1fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5656(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -26621,13 +26545,13 @@ GL_PREFIX(VertexAttrib1fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5656(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5656(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -26637,7 +26561,7 @@ GL_PREFIX(VertexAttrib1fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5656(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1fNV), .-GL_PREFIX(VertexAttrib1fNV) @@ -26648,7 +26572,7 @@ GL_PREFIX(VertexAttrib1fNV): GL_PREFIX(VertexAttrib1fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5664(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26658,13 +26582,13 @@ GL_PREFIX(VertexAttrib1fvNV): popq %rbp popq %rsi popq %rdi - movq 5664(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5664(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26674,7 +26598,7 @@ GL_PREFIX(VertexAttrib1fvNV): popq %rbp popq %rsi popq %rdi - movq 5664(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1fvNV), .-GL_PREFIX(VertexAttrib1fvNV) @@ -26685,7 +26609,7 @@ GL_PREFIX(VertexAttrib1fvNV): GL_PREFIX(VertexAttrib1sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5672(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26695,13 +26619,13 @@ GL_PREFIX(VertexAttrib1sNV): popq %rbp popq %rsi popq %rdi - movq 5672(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5672(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26711,7 +26635,7 @@ GL_PREFIX(VertexAttrib1sNV): popq %rbp popq %rsi popq %rdi - movq 5672(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV) @@ -26722,7 +26646,7 @@ GL_PREFIX(VertexAttrib1sNV): GL_PREFIX(VertexAttrib1svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5680(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26732,13 +26656,13 @@ GL_PREFIX(VertexAttrib1svNV): popq %rbp popq %rsi popq %rdi - movq 5680(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5680(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26748,7 +26672,7 @@ GL_PREFIX(VertexAttrib1svNV): popq %rbp popq %rsi popq %rdi - movq 5680(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV) @@ -26759,7 +26683,7 @@ GL_PREFIX(VertexAttrib1svNV): GL_PREFIX(VertexAttrib2dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5688(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -26771,13 +26695,13 @@ GL_PREFIX(VertexAttrib2dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5688(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5688(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -26789,7 +26713,7 @@ GL_PREFIX(VertexAttrib2dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5688(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV) @@ -26800,7 +26724,7 @@ GL_PREFIX(VertexAttrib2dNV): GL_PREFIX(VertexAttrib2dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5696(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26810,13 +26734,13 @@ GL_PREFIX(VertexAttrib2dvNV): popq %rbp popq %rsi popq %rdi - movq 5696(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5696(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26826,7 +26750,7 @@ GL_PREFIX(VertexAttrib2dvNV): popq %rbp popq %rsi popq %rdi - movq 5696(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV) @@ -26837,7 +26761,7 @@ GL_PREFIX(VertexAttrib2dvNV): GL_PREFIX(VertexAttrib2fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5704(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -26849,13 +26773,13 @@ GL_PREFIX(VertexAttrib2fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5704(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5704(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -26867,7 +26791,7 @@ GL_PREFIX(VertexAttrib2fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5704(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV) @@ -26878,7 +26802,7 @@ GL_PREFIX(VertexAttrib2fNV): GL_PREFIX(VertexAttrib2fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5712(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26888,13 +26812,13 @@ GL_PREFIX(VertexAttrib2fvNV): popq %rbp popq %rsi popq %rdi - movq 5712(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5712(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26904,7 +26828,7 @@ GL_PREFIX(VertexAttrib2fvNV): popq %rbp popq %rsi popq %rdi - movq 5712(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2fvNV), .-GL_PREFIX(VertexAttrib2fvNV) @@ -26915,7 +26839,7 @@ GL_PREFIX(VertexAttrib2fvNV): GL_PREFIX(VertexAttrib2sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5720(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26925,13 +26849,13 @@ GL_PREFIX(VertexAttrib2sNV): popq %rdx popq %rsi popq %rdi - movq 5720(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5720(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26941,7 +26865,7 @@ GL_PREFIX(VertexAttrib2sNV): popq %rdx popq %rsi popq %rdi - movq 5720(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2sNV), .-GL_PREFIX(VertexAttrib2sNV) @@ -26952,7 +26876,7 @@ GL_PREFIX(VertexAttrib2sNV): GL_PREFIX(VertexAttrib2svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5728(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26962,13 +26886,13 @@ GL_PREFIX(VertexAttrib2svNV): popq %rbp popq %rsi popq %rdi - movq 5728(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5728(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26978,7 +26902,7 @@ GL_PREFIX(VertexAttrib2svNV): popq %rbp popq %rsi popq %rdi - movq 5728(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2svNV), .-GL_PREFIX(VertexAttrib2svNV) @@ -26989,7 +26913,7 @@ GL_PREFIX(VertexAttrib2svNV): GL_PREFIX(VertexAttrib3dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5736(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -27003,13 +26927,13 @@ GL_PREFIX(VertexAttrib3dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5736(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5736(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -27023,7 +26947,7 @@ GL_PREFIX(VertexAttrib3dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5736(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3dNV), .-GL_PREFIX(VertexAttrib3dNV) @@ -27034,7 +26958,7 @@ GL_PREFIX(VertexAttrib3dNV): GL_PREFIX(VertexAttrib3dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5744(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27044,13 +26968,13 @@ GL_PREFIX(VertexAttrib3dvNV): popq %rbp popq %rsi popq %rdi - movq 5744(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5744(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27060,7 +26984,7 @@ GL_PREFIX(VertexAttrib3dvNV): popq %rbp popq %rsi popq %rdi - movq 5744(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3dvNV), .-GL_PREFIX(VertexAttrib3dvNV) @@ -27071,7 +26995,7 @@ GL_PREFIX(VertexAttrib3dvNV): GL_PREFIX(VertexAttrib3fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5752(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -27085,13 +27009,13 @@ GL_PREFIX(VertexAttrib3fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5752(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5752(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -27105,7 +27029,7 @@ GL_PREFIX(VertexAttrib3fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5752(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3fNV), .-GL_PREFIX(VertexAttrib3fNV) @@ -27116,7 +27040,7 @@ GL_PREFIX(VertexAttrib3fNV): GL_PREFIX(VertexAttrib3fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5760(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27126,13 +27050,13 @@ GL_PREFIX(VertexAttrib3fvNV): popq %rbp popq %rsi popq %rdi - movq 5760(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5760(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27142,7 +27066,7 @@ GL_PREFIX(VertexAttrib3fvNV): popq %rbp popq %rsi popq %rdi - movq 5760(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3fvNV), .-GL_PREFIX(VertexAttrib3fvNV) @@ -27153,7 +27077,7 @@ GL_PREFIX(VertexAttrib3fvNV): GL_PREFIX(VertexAttrib3sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5768(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27167,13 +27091,13 @@ GL_PREFIX(VertexAttrib3sNV): popq %rdx popq %rsi popq %rdi - movq 5768(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5768(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27187,7 +27111,7 @@ GL_PREFIX(VertexAttrib3sNV): popq %rdx popq %rsi popq %rdi - movq 5768(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3sNV), .-GL_PREFIX(VertexAttrib3sNV) @@ -27198,7 +27122,7 @@ GL_PREFIX(VertexAttrib3sNV): GL_PREFIX(VertexAttrib3svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5776(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27208,13 +27132,13 @@ GL_PREFIX(VertexAttrib3svNV): popq %rbp popq %rsi popq %rdi - movq 5776(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5776(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27224,7 +27148,7 @@ GL_PREFIX(VertexAttrib3svNV): popq %rbp popq %rsi popq %rdi - movq 5776(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3svNV), .-GL_PREFIX(VertexAttrib3svNV) @@ -27235,7 +27159,7 @@ GL_PREFIX(VertexAttrib3svNV): GL_PREFIX(VertexAttrib4dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5784(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -27251,13 +27175,13 @@ GL_PREFIX(VertexAttrib4dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5784(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5784(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -27273,7 +27197,7 @@ GL_PREFIX(VertexAttrib4dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5784(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4dNV), .-GL_PREFIX(VertexAttrib4dNV) @@ -27284,7 +27208,7 @@ GL_PREFIX(VertexAttrib4dNV): GL_PREFIX(VertexAttrib4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5792(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27294,13 +27218,13 @@ GL_PREFIX(VertexAttrib4dvNV): popq %rbp popq %rsi popq %rdi - movq 5792(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5792(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27310,7 +27234,7 @@ GL_PREFIX(VertexAttrib4dvNV): popq %rbp popq %rsi popq %rdi - movq 5792(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4dvNV), .-GL_PREFIX(VertexAttrib4dvNV) @@ -27321,7 +27245,7 @@ GL_PREFIX(VertexAttrib4dvNV): GL_PREFIX(VertexAttrib4fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5800(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -27337,13 +27261,13 @@ GL_PREFIX(VertexAttrib4fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5800(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5800(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -27359,7 +27283,7 @@ GL_PREFIX(VertexAttrib4fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5800(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4fNV), .-GL_PREFIX(VertexAttrib4fNV) @@ -27370,7 +27294,7 @@ GL_PREFIX(VertexAttrib4fNV): GL_PREFIX(VertexAttrib4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5808(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27380,13 +27304,13 @@ GL_PREFIX(VertexAttrib4fvNV): popq %rbp popq %rsi popq %rdi - movq 5808(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5808(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27396,7 +27320,7 @@ GL_PREFIX(VertexAttrib4fvNV): popq %rbp popq %rsi popq %rdi - movq 5808(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4fvNV), .-GL_PREFIX(VertexAttrib4fvNV) @@ -27407,7 +27331,7 @@ GL_PREFIX(VertexAttrib4fvNV): GL_PREFIX(VertexAttrib4sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5816(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27421,13 +27345,13 @@ GL_PREFIX(VertexAttrib4sNV): popq %rdx popq %rsi popq %rdi - movq 5816(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5816(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27441,7 +27365,7 @@ GL_PREFIX(VertexAttrib4sNV): popq %rdx popq %rsi popq %rdi - movq 5816(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4sNV), .-GL_PREFIX(VertexAttrib4sNV) @@ -27452,7 +27376,7 @@ GL_PREFIX(VertexAttrib4sNV): GL_PREFIX(VertexAttrib4svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5824(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27462,13 +27386,13 @@ GL_PREFIX(VertexAttrib4svNV): popq %rbp popq %rsi popq %rdi - movq 5824(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5824(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27478,7 +27402,7 @@ GL_PREFIX(VertexAttrib4svNV): popq %rbp popq %rsi popq %rdi - movq 5824(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4svNV), .-GL_PREFIX(VertexAttrib4svNV) @@ -27489,7 +27413,7 @@ GL_PREFIX(VertexAttrib4svNV): GL_PREFIX(VertexAttrib4ubNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5832(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27503,13 +27427,13 @@ GL_PREFIX(VertexAttrib4ubNV): popq %rdx popq %rsi popq %rdi - movq 5832(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5832(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27523,7 +27447,7 @@ GL_PREFIX(VertexAttrib4ubNV): popq %rdx popq %rsi popq %rdi - movq 5832(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4ubNV), .-GL_PREFIX(VertexAttrib4ubNV) @@ -27534,7 +27458,7 @@ GL_PREFIX(VertexAttrib4ubNV): GL_PREFIX(VertexAttrib4ubvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5840(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27544,13 +27468,13 @@ GL_PREFIX(VertexAttrib4ubvNV): popq %rbp popq %rsi popq %rdi - movq 5840(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5840(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27560,7 +27484,7 @@ GL_PREFIX(VertexAttrib4ubvNV): popq %rbp popq %rsi popq %rdi - movq 5840(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4ubvNV), .-GL_PREFIX(VertexAttrib4ubvNV) @@ -27571,7 +27495,7 @@ GL_PREFIX(VertexAttrib4ubvNV): GL_PREFIX(VertexAttribPointerNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5848(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27585,13 +27509,13 @@ GL_PREFIX(VertexAttribPointerNV): popq %rdx popq %rsi popq %rdi - movq 5848(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5848(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27605,7 +27529,7 @@ GL_PREFIX(VertexAttribPointerNV): popq %rdx popq %rsi popq %rdi - movq 5848(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribPointerNV), .-GL_PREFIX(VertexAttribPointerNV) @@ -27616,7 +27540,7 @@ GL_PREFIX(VertexAttribPointerNV): GL_PREFIX(VertexAttribs1dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5856(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27626,13 +27550,13 @@ GL_PREFIX(VertexAttribs1dvNV): popq %rdx popq %rsi popq %rdi - movq 5856(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5856(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27642,7 +27566,7 @@ GL_PREFIX(VertexAttribs1dvNV): popq %rdx popq %rsi popq %rdi - movq 5856(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1dvNV), .-GL_PREFIX(VertexAttribs1dvNV) @@ -27653,7 +27577,7 @@ GL_PREFIX(VertexAttribs1dvNV): GL_PREFIX(VertexAttribs1fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5864(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27663,13 +27587,13 @@ GL_PREFIX(VertexAttribs1fvNV): popq %rdx popq %rsi popq %rdi - movq 5864(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5864(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27679,7 +27603,7 @@ GL_PREFIX(VertexAttribs1fvNV): popq %rdx popq %rsi popq %rdi - movq 5864(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1fvNV), .-GL_PREFIX(VertexAttribs1fvNV) @@ -27690,7 +27614,7 @@ GL_PREFIX(VertexAttribs1fvNV): GL_PREFIX(VertexAttribs1svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5872(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27700,13 +27624,13 @@ GL_PREFIX(VertexAttribs1svNV): popq %rdx popq %rsi popq %rdi - movq 5872(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5872(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27716,7 +27640,7 @@ GL_PREFIX(VertexAttribs1svNV): popq %rdx popq %rsi popq %rdi - movq 5872(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1svNV), .-GL_PREFIX(VertexAttribs1svNV) @@ -27727,7 +27651,7 @@ GL_PREFIX(VertexAttribs1svNV): GL_PREFIX(VertexAttribs2dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5880(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27737,13 +27661,13 @@ GL_PREFIX(VertexAttribs2dvNV): popq %rdx popq %rsi popq %rdi - movq 5880(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5880(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27753,7 +27677,7 @@ GL_PREFIX(VertexAttribs2dvNV): popq %rdx popq %rsi popq %rdi - movq 5880(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2dvNV), .-GL_PREFIX(VertexAttribs2dvNV) @@ -27764,7 +27688,7 @@ GL_PREFIX(VertexAttribs2dvNV): GL_PREFIX(VertexAttribs2fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5888(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27774,13 +27698,13 @@ GL_PREFIX(VertexAttribs2fvNV): popq %rdx popq %rsi popq %rdi - movq 5888(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5888(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27790,7 +27714,7 @@ GL_PREFIX(VertexAttribs2fvNV): popq %rdx popq %rsi popq %rdi - movq 5888(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2fvNV), .-GL_PREFIX(VertexAttribs2fvNV) @@ -27801,7 +27725,7 @@ GL_PREFIX(VertexAttribs2fvNV): GL_PREFIX(VertexAttribs2svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5896(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27811,13 +27735,13 @@ GL_PREFIX(VertexAttribs2svNV): popq %rdx popq %rsi popq %rdi - movq 5896(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5896(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27827,7 +27751,7 @@ GL_PREFIX(VertexAttribs2svNV): popq %rdx popq %rsi popq %rdi - movq 5896(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2svNV), .-GL_PREFIX(VertexAttribs2svNV) @@ -27838,7 +27762,7 @@ GL_PREFIX(VertexAttribs2svNV): GL_PREFIX(VertexAttribs3dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5904(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27848,13 +27772,13 @@ GL_PREFIX(VertexAttribs3dvNV): popq %rdx popq %rsi popq %rdi - movq 5904(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5904(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27864,7 +27788,7 @@ GL_PREFIX(VertexAttribs3dvNV): popq %rdx popq %rsi popq %rdi - movq 5904(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3dvNV), .-GL_PREFIX(VertexAttribs3dvNV) @@ -27875,7 +27799,7 @@ GL_PREFIX(VertexAttribs3dvNV): GL_PREFIX(VertexAttribs3fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5912(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27885,13 +27809,13 @@ GL_PREFIX(VertexAttribs3fvNV): popq %rdx popq %rsi popq %rdi - movq 5912(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5912(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27901,7 +27825,7 @@ GL_PREFIX(VertexAttribs3fvNV): popq %rdx popq %rsi popq %rdi - movq 5912(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3fvNV), .-GL_PREFIX(VertexAttribs3fvNV) @@ -27912,7 +27836,7 @@ GL_PREFIX(VertexAttribs3fvNV): GL_PREFIX(VertexAttribs3svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5920(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27922,13 +27846,13 @@ GL_PREFIX(VertexAttribs3svNV): popq %rdx popq %rsi popq %rdi - movq 5920(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5920(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27938,7 +27862,7 @@ GL_PREFIX(VertexAttribs3svNV): popq %rdx popq %rsi popq %rdi - movq 5920(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3svNV), .-GL_PREFIX(VertexAttribs3svNV) @@ -27949,7 +27873,7 @@ GL_PREFIX(VertexAttribs3svNV): GL_PREFIX(VertexAttribs4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5928(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27959,13 +27883,13 @@ GL_PREFIX(VertexAttribs4dvNV): popq %rdx popq %rsi popq %rdi - movq 5928(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5928(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27975,7 +27899,7 @@ GL_PREFIX(VertexAttribs4dvNV): popq %rdx popq %rsi popq %rdi - movq 5928(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4dvNV), .-GL_PREFIX(VertexAttribs4dvNV) @@ -27986,7 +27910,7 @@ GL_PREFIX(VertexAttribs4dvNV): GL_PREFIX(VertexAttribs4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5936(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27996,13 +27920,13 @@ GL_PREFIX(VertexAttribs4fvNV): popq %rdx popq %rsi popq %rdi - movq 5936(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5936(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28012,7 +27936,7 @@ GL_PREFIX(VertexAttribs4fvNV): popq %rdx popq %rsi popq %rdi - movq 5936(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4fvNV), .-GL_PREFIX(VertexAttribs4fvNV) @@ -28023,7 +27947,7 @@ GL_PREFIX(VertexAttribs4fvNV): GL_PREFIX(VertexAttribs4svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5944(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28033,13 +27957,13 @@ GL_PREFIX(VertexAttribs4svNV): popq %rdx popq %rsi popq %rdi - movq 5944(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5944(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28049,7 +27973,7 @@ GL_PREFIX(VertexAttribs4svNV): popq %rdx popq %rsi popq %rdi - movq 5944(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4svNV), .-GL_PREFIX(VertexAttribs4svNV) @@ -28060,7 +27984,7 @@ GL_PREFIX(VertexAttribs4svNV): GL_PREFIX(VertexAttribs4ubvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5952(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28070,13 +27994,13 @@ GL_PREFIX(VertexAttribs4ubvNV): popq %rdx popq %rsi popq %rdi - movq 5952(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5952(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28086,7 +28010,7 @@ GL_PREFIX(VertexAttribs4ubvNV): popq %rdx popq %rsi popq %rdi - movq 5952(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV) @@ -28097,7 +28021,7 @@ GL_PREFIX(VertexAttribs4ubvNV): GL_PREFIX(GetTexBumpParameterfvATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5960(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28107,13 +28031,13 @@ GL_PREFIX(GetTexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5960(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5960(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28123,7 +28047,7 @@ GL_PREFIX(GetTexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5960(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI) @@ -28134,7 +28058,7 @@ GL_PREFIX(GetTexBumpParameterfvATI): GL_PREFIX(GetTexBumpParameterivATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5968(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28144,13 +28068,13 @@ GL_PREFIX(GetTexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5968(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5968(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28160,7 +28084,7 @@ GL_PREFIX(GetTexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5968(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI) @@ -28171,7 +28095,7 @@ GL_PREFIX(GetTexBumpParameterivATI): GL_PREFIX(TexBumpParameterfvATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5976(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28181,13 +28105,13 @@ GL_PREFIX(TexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5976(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5976(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28197,7 +28121,7 @@ GL_PREFIX(TexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5976(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI) @@ -28208,7 +28132,7 @@ GL_PREFIX(TexBumpParameterfvATI): GL_PREFIX(TexBumpParameterivATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5984(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28218,13 +28142,13 @@ GL_PREFIX(TexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5984(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5984(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28234,7 +28158,7 @@ GL_PREFIX(TexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5984(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI) @@ -28245,7 +28169,7 @@ GL_PREFIX(TexBumpParameterivATI): GL_PREFIX(AlphaFragmentOp1ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5992(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28263,13 +28187,13 @@ GL_PREFIX(AlphaFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5992(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5992(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28287,7 +28211,7 @@ GL_PREFIX(AlphaFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5992(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI) @@ -28298,7 +28222,7 @@ GL_PREFIX(AlphaFragmentOp1ATI): GL_PREFIX(AlphaFragmentOp2ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6000(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28316,13 +28240,13 @@ GL_PREFIX(AlphaFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 6000(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6000(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28340,7 +28264,7 @@ GL_PREFIX(AlphaFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 6000(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI) @@ -28351,7 +28275,7 @@ GL_PREFIX(AlphaFragmentOp2ATI): GL_PREFIX(AlphaFragmentOp3ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6008(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28369,13 +28293,13 @@ GL_PREFIX(AlphaFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 6008(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6008(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28393,7 +28317,7 @@ GL_PREFIX(AlphaFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 6008(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI) @@ -28404,25 +28328,25 @@ GL_PREFIX(AlphaFragmentOp3ATI): GL_PREFIX(BeginFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6016(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 6016(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6016(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 6016(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI) @@ -28433,25 +28357,25 @@ GL_PREFIX(BeginFragmentShaderATI): GL_PREFIX(BindFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6024(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6024(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6024(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6024(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI) @@ -28462,7 +28386,7 @@ GL_PREFIX(BindFragmentShaderATI): GL_PREFIX(ColorFragmentOp1ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6032(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28480,13 +28404,13 @@ GL_PREFIX(ColorFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 6032(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6032(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28504,7 +28428,7 @@ GL_PREFIX(ColorFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 6032(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI) @@ -28515,7 +28439,7 @@ GL_PREFIX(ColorFragmentOp1ATI): GL_PREFIX(ColorFragmentOp2ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6040(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28533,13 +28457,13 @@ GL_PREFIX(ColorFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 6040(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6040(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28557,7 +28481,7 @@ GL_PREFIX(ColorFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 6040(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI) @@ -28568,7 +28492,7 @@ GL_PREFIX(ColorFragmentOp2ATI): GL_PREFIX(ColorFragmentOp3ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6048(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28586,13 +28510,13 @@ GL_PREFIX(ColorFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 6048(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6048(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28610,7 +28534,7 @@ GL_PREFIX(ColorFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 6048(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI) @@ -28621,25 +28545,25 @@ GL_PREFIX(ColorFragmentOp3ATI): GL_PREFIX(DeleteFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6056(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6056(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6056(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6056(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI) @@ -28650,25 +28574,25 @@ GL_PREFIX(DeleteFragmentShaderATI): GL_PREFIX(EndFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6064(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 6064(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6064(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 6064(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI) @@ -28679,25 +28603,25 @@ GL_PREFIX(EndFragmentShaderATI): GL_PREFIX(GenFragmentShadersATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6072(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6072(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6072(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6072(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI) @@ -28708,7 +28632,7 @@ GL_PREFIX(GenFragmentShadersATI): GL_PREFIX(PassTexCoordATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6080(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28718,13 +28642,13 @@ GL_PREFIX(PassTexCoordATI): popq %rdx popq %rsi popq %rdi - movq 6080(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6080(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28734,7 +28658,7 @@ GL_PREFIX(PassTexCoordATI): popq %rdx popq %rsi popq %rdi - movq 6080(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI) @@ -28745,7 +28669,7 @@ GL_PREFIX(PassTexCoordATI): GL_PREFIX(SampleMapATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6088(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28755,13 +28679,13 @@ GL_PREFIX(SampleMapATI): popq %rdx popq %rsi popq %rdi - movq 6088(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6088(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28771,7 +28695,7 @@ GL_PREFIX(SampleMapATI): popq %rdx popq %rsi popq %rdi - movq 6088(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI) @@ -28782,7 +28706,7 @@ GL_PREFIX(SampleMapATI): GL_PREFIX(SetFragmentShaderConstantATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6096(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28792,13 +28716,13 @@ GL_PREFIX(SetFragmentShaderConstantATI): popq %rbp popq %rsi popq %rdi - movq 6096(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6096(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28808,7 +28732,7 @@ GL_PREFIX(SetFragmentShaderConstantATI): popq %rbp popq %rsi popq %rdi - movq 6096(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI) @@ -28819,7 +28743,7 @@ GL_PREFIX(SetFragmentShaderConstantATI): GL_PREFIX(PointParameteriNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6104(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28829,13 +28753,13 @@ GL_PREFIX(PointParameteriNV): popq %rbp popq %rsi popq %rdi - movq 6104(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6104(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28845,7 +28769,7 @@ GL_PREFIX(PointParameteriNV): popq %rbp popq %rsi popq %rdi - movq 6104(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV) @@ -28856,7 +28780,7 @@ GL_PREFIX(PointParameteriNV): GL_PREFIX(PointParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6112(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28866,13 +28790,13 @@ GL_PREFIX(PointParameterivNV): popq %rbp popq %rsi popq %rdi - movq 6112(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6112(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28882,79 +28806,79 @@ GL_PREFIX(PointParameterivNV): popq %rbp popq %rsi popq %rdi - movq 6112(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_765) - .type GL_PREFIX(_dispatch_stub_765), @function - HIDDEN(GL_PREFIX(_dispatch_stub_765)) -GL_PREFIX(_dispatch_stub_765): + .globl GL_PREFIX(_dispatch_stub_763) + .type GL_PREFIX(_dispatch_stub_763), @function + HIDDEN(GL_PREFIX(_dispatch_stub_763)) +GL_PREFIX(_dispatch_stub_763): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6120(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6120(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6120(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6120(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_765), .-GL_PREFIX(_dispatch_stub_765) + .size GL_PREFIX(_dispatch_stub_763), .-GL_PREFIX(_dispatch_stub_763) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_766) - .type GL_PREFIX(_dispatch_stub_766), @function - HIDDEN(GL_PREFIX(_dispatch_stub_766)) -GL_PREFIX(_dispatch_stub_766): + .globl GL_PREFIX(_dispatch_stub_764) + .type GL_PREFIX(_dispatch_stub_764), @function + HIDDEN(GL_PREFIX(_dispatch_stub_764)) +GL_PREFIX(_dispatch_stub_764): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6128(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6128(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6128(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6128(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_766), .-GL_PREFIX(_dispatch_stub_766) + .size GL_PREFIX(_dispatch_stub_764), .-GL_PREFIX(_dispatch_stub_764) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_767) - .type GL_PREFIX(_dispatch_stub_767), @function - HIDDEN(GL_PREFIX(_dispatch_stub_767)) -GL_PREFIX(_dispatch_stub_767): + .globl GL_PREFIX(_dispatch_stub_765) + .type GL_PREFIX(_dispatch_stub_765), @function + HIDDEN(GL_PREFIX(_dispatch_stub_765)) +GL_PREFIX(_dispatch_stub_765): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6136(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28964,13 +28888,13 @@ GL_PREFIX(_dispatch_stub_767): popq %rbp popq %rsi popq %rdi - movq 6136(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6136(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28980,19 +28904,19 @@ GL_PREFIX(_dispatch_stub_767): popq %rbp popq %rsi popq %rdi - movq 6136(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_767), .-GL_PREFIX(_dispatch_stub_767) + .size GL_PREFIX(_dispatch_stub_765), .-GL_PREFIX(_dispatch_stub_765) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_768) - .type GL_PREFIX(_dispatch_stub_768), @function - HIDDEN(GL_PREFIX(_dispatch_stub_768)) -GL_PREFIX(_dispatch_stub_768): + .globl GL_PREFIX(_dispatch_stub_766) + .type GL_PREFIX(_dispatch_stub_766), @function + HIDDEN(GL_PREFIX(_dispatch_stub_766)) +GL_PREFIX(_dispatch_stub_766): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6144(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29002,13 +28926,13 @@ GL_PREFIX(_dispatch_stub_768): popq %rbp popq %rsi popq %rdi - movq 6144(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6144(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29018,40 +28942,40 @@ GL_PREFIX(_dispatch_stub_768): popq %rbp popq %rsi popq %rdi - movq 6144(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_768), .-GL_PREFIX(_dispatch_stub_768) + .size GL_PREFIX(_dispatch_stub_766), .-GL_PREFIX(_dispatch_stub_766) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_769) - .type GL_PREFIX(_dispatch_stub_769), @function - HIDDEN(GL_PREFIX(_dispatch_stub_769)) -GL_PREFIX(_dispatch_stub_769): + .globl GL_PREFIX(_dispatch_stub_767) + .type GL_PREFIX(_dispatch_stub_767), @function + HIDDEN(GL_PREFIX(_dispatch_stub_767)) +GL_PREFIX(_dispatch_stub_767): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6152(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6152(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6152(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6152(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_769), .-GL_PREFIX(_dispatch_stub_769) + .size GL_PREFIX(_dispatch_stub_767), .-GL_PREFIX(_dispatch_stub_767) .p2align 4,,15 .globl GL_PREFIX(GetProgramNamedParameterdvNV) @@ -29059,7 +28983,7 @@ GL_PREFIX(_dispatch_stub_769): GL_PREFIX(GetProgramNamedParameterdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6160(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29073,13 +28997,13 @@ GL_PREFIX(GetProgramNamedParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 6160(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6160(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29093,7 +29017,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 6160(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV) @@ -29104,7 +29028,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV): GL_PREFIX(GetProgramNamedParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6168(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29118,13 +29042,13 @@ GL_PREFIX(GetProgramNamedParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 6168(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6168(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29138,7 +29062,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 6168(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV) @@ -29149,7 +29073,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV): GL_PREFIX(ProgramNamedParameter4dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6176(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $56, %rsp @@ -29169,13 +29093,13 @@ GL_PREFIX(ProgramNamedParameter4dNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 6176(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6176(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 1: subq $56, %rsp @@ -29195,7 +29119,7 @@ GL_PREFIX(ProgramNamedParameter4dNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 6176(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV) @@ -29206,7 +29130,7 @@ GL_PREFIX(ProgramNamedParameter4dNV): GL_PREFIX(ProgramNamedParameter4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6184(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29220,13 +29144,13 @@ GL_PREFIX(ProgramNamedParameter4dvNV): popq %rdx popq %rsi popq %rdi - movq 6184(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6184(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29240,7 +29164,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV): popq %rdx popq %rsi popq %rdi - movq 6184(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV) @@ -29251,7 +29175,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV): GL_PREFIX(ProgramNamedParameter4fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6192(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $56, %rsp @@ -29271,13 +29195,13 @@ GL_PREFIX(ProgramNamedParameter4fNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 6192(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6192(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 1: subq $56, %rsp @@ -29297,7 +29221,7 @@ GL_PREFIX(ProgramNamedParameter4fNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 6192(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV) @@ -29308,7 +29232,7 @@ GL_PREFIX(ProgramNamedParameter4fNV): GL_PREFIX(ProgramNamedParameter4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6200(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29322,13 +29246,13 @@ GL_PREFIX(ProgramNamedParameter4fvNV): popq %rdx popq %rsi popq %rdi - movq 6200(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6200(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29342,19 +29266,19 @@ GL_PREFIX(ProgramNamedParameter4fvNV): popq %rdx popq %rsi popq %rdi - movq 6200(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_776) - .type GL_PREFIX(_dispatch_stub_776), @function - HIDDEN(GL_PREFIX(_dispatch_stub_776)) -GL_PREFIX(_dispatch_stub_776): + .globl GL_PREFIX(_dispatch_stub_774) + .type GL_PREFIX(_dispatch_stub_774), @function + HIDDEN(GL_PREFIX(_dispatch_stub_774)) +GL_PREFIX(_dispatch_stub_774): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6208(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29364,13 +29288,13 @@ GL_PREFIX(_dispatch_stub_776): popq %rbp popq %rsi popq %rdi - movq 6208(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6208(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29380,19 +29304,19 @@ GL_PREFIX(_dispatch_stub_776): popq %rbp popq %rsi popq %rdi - movq 6208(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_776), .-GL_PREFIX(_dispatch_stub_776) + .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_777) - .type GL_PREFIX(_dispatch_stub_777), @function - HIDDEN(GL_PREFIX(_dispatch_stub_777)) -GL_PREFIX(_dispatch_stub_777): + .globl GL_PREFIX(_dispatch_stub_775) + .type GL_PREFIX(_dispatch_stub_775), @function + HIDDEN(GL_PREFIX(_dispatch_stub_775)) +GL_PREFIX(_dispatch_stub_775): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6216(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29402,13 +29326,13 @@ GL_PREFIX(_dispatch_stub_777): popq %rbp popq %rsi popq %rdi - movq 6216(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6216(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29418,10 +29342,10 @@ GL_PREFIX(_dispatch_stub_777): popq %rbp popq %rsi popq %rdi - movq 6216(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_777), .-GL_PREFIX(_dispatch_stub_777) + .size GL_PREFIX(_dispatch_stub_775), .-GL_PREFIX(_dispatch_stub_775) .p2align 4,,15 .globl GL_PREFIX(BindFramebufferEXT) @@ -29429,7 +29353,7 @@ GL_PREFIX(_dispatch_stub_777): GL_PREFIX(BindFramebufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6224(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29439,13 +29363,13 @@ GL_PREFIX(BindFramebufferEXT): popq %rbp popq %rsi popq %rdi - movq 6224(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6224(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29455,7 +29379,7 @@ GL_PREFIX(BindFramebufferEXT): popq %rbp popq %rsi popq %rdi - movq 6224(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT) @@ -29466,7 +29390,7 @@ GL_PREFIX(BindFramebufferEXT): GL_PREFIX(BindRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6232(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29476,13 +29400,13 @@ GL_PREFIX(BindRenderbufferEXT): popq %rbp popq %rsi popq %rdi - movq 6232(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6232(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29492,7 +29416,7 @@ GL_PREFIX(BindRenderbufferEXT): popq %rbp popq %rsi popq %rdi - movq 6232(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT) @@ -29503,25 +29427,25 @@ GL_PREFIX(BindRenderbufferEXT): GL_PREFIX(CheckFramebufferStatusEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6240(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6240(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6240(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6240(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT) @@ -29532,7 +29456,7 @@ GL_PREFIX(CheckFramebufferStatusEXT): GL_PREFIX(DeleteFramebuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6248(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29542,13 +29466,13 @@ GL_PREFIX(DeleteFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6248(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6248(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29558,7 +29482,7 @@ GL_PREFIX(DeleteFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6248(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT) @@ -29569,7 +29493,7 @@ GL_PREFIX(DeleteFramebuffersEXT): GL_PREFIX(DeleteRenderbuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6256(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29579,13 +29503,13 @@ GL_PREFIX(DeleteRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6256(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6256(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29595,7 +29519,7 @@ GL_PREFIX(DeleteRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6256(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT) @@ -29606,7 +29530,7 @@ GL_PREFIX(DeleteRenderbuffersEXT): GL_PREFIX(FramebufferRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6264(%rax), %r11 + movq 6248(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29620,13 +29544,13 @@ GL_PREFIX(FramebufferRenderbufferEXT): popq %rdx popq %rsi popq %rdi - movq 6264(%rax), %r11 + movq 6248(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6264(%rax), %r11 + movq 6248(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29640,7 +29564,7 @@ GL_PREFIX(FramebufferRenderbufferEXT): popq %rdx popq %rsi popq %rdi - movq 6264(%rax), %r11 + movq 6248(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT) @@ -29651,7 +29575,7 @@ GL_PREFIX(FramebufferRenderbufferEXT): GL_PREFIX(FramebufferTexture1DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6272(%rax), %r11 + movq 6256(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29665,13 +29589,13 @@ GL_PREFIX(FramebufferTexture1DEXT): popq %rdx popq %rsi popq %rdi - movq 6272(%rax), %r11 + movq 6256(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6272(%rax), %r11 + movq 6256(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29685,7 +29609,7 @@ GL_PREFIX(FramebufferTexture1DEXT): popq %rdx popq %rsi popq %rdi - movq 6272(%rax), %r11 + movq 6256(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT) @@ -29696,7 +29620,7 @@ GL_PREFIX(FramebufferTexture1DEXT): GL_PREFIX(FramebufferTexture2DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6280(%rax), %r11 + movq 6264(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29710,13 +29634,13 @@ GL_PREFIX(FramebufferTexture2DEXT): popq %rdx popq %rsi popq %rdi - movq 6280(%rax), %r11 + movq 6264(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6280(%rax), %r11 + movq 6264(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29730,7 +29654,7 @@ GL_PREFIX(FramebufferTexture2DEXT): popq %rdx popq %rsi popq %rdi - movq 6280(%rax), %r11 + movq 6264(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT) @@ -29741,7 +29665,7 @@ GL_PREFIX(FramebufferTexture2DEXT): GL_PREFIX(FramebufferTexture3DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6288(%rax), %r11 + movq 6272(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29759,13 +29683,13 @@ GL_PREFIX(FramebufferTexture3DEXT): popq %rdx popq %rsi popq %rdi - movq 6288(%rax), %r11 + movq 6272(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6288(%rax), %r11 + movq 6272(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29783,7 +29707,7 @@ GL_PREFIX(FramebufferTexture3DEXT): popq %rdx popq %rsi popq %rdi - movq 6288(%rax), %r11 + movq 6272(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT) @@ -29794,7 +29718,7 @@ GL_PREFIX(FramebufferTexture3DEXT): GL_PREFIX(GenFramebuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6296(%rax), %r11 + movq 6280(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29804,13 +29728,13 @@ GL_PREFIX(GenFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6296(%rax), %r11 + movq 6280(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6296(%rax), %r11 + movq 6280(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29820,7 +29744,7 @@ GL_PREFIX(GenFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6296(%rax), %r11 + movq 6280(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT) @@ -29831,7 +29755,7 @@ GL_PREFIX(GenFramebuffersEXT): GL_PREFIX(GenRenderbuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6304(%rax), %r11 + movq 6288(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29841,13 +29765,13 @@ GL_PREFIX(GenRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6304(%rax), %r11 + movq 6288(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6304(%rax), %r11 + movq 6288(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29857,7 +29781,7 @@ GL_PREFIX(GenRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6304(%rax), %r11 + movq 6288(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT) @@ -29868,25 +29792,25 @@ GL_PREFIX(GenRenderbuffersEXT): GL_PREFIX(GenerateMipmapEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6312(%rax), %r11 + movq 6296(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6312(%rax), %r11 + movq 6296(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6312(%rax), %r11 + movq 6296(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6312(%rax), %r11 + movq 6296(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT) @@ -29897,7 +29821,7 @@ GL_PREFIX(GenerateMipmapEXT): GL_PREFIX(GetFramebufferAttachmentParameterivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6320(%rax), %r11 + movq 6304(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29911,13 +29835,13 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6320(%rax), %r11 + movq 6304(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6320(%rax), %r11 + movq 6304(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29931,7 +29855,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6320(%rax), %r11 + movq 6304(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT) @@ -29942,7 +29866,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): GL_PREFIX(GetRenderbufferParameterivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6328(%rax), %r11 + movq 6312(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29952,13 +29876,13 @@ GL_PREFIX(GetRenderbufferParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6328(%rax), %r11 + movq 6312(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6328(%rax), %r11 + movq 6312(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29968,7 +29892,7 @@ GL_PREFIX(GetRenderbufferParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6328(%rax), %r11 + movq 6312(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT) @@ -29979,25 +29903,25 @@ GL_PREFIX(GetRenderbufferParameterivEXT): GL_PREFIX(IsFramebufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6336(%rax), %r11 + movq 6320(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6336(%rax), %r11 + movq 6320(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6336(%rax), %r11 + movq 6320(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6336(%rax), %r11 + movq 6320(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT) @@ -30008,25 +29932,25 @@ GL_PREFIX(IsFramebufferEXT): GL_PREFIX(IsRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6344(%rax), %r11 + movq 6328(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6344(%rax), %r11 + movq 6328(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6344(%rax), %r11 + movq 6328(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6344(%rax), %r11 + movq 6328(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT) @@ -30037,7 +29961,7 @@ GL_PREFIX(IsRenderbufferEXT): GL_PREFIX(RenderbufferStorageEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6352(%rax), %r11 + movq 6336(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30051,13 +29975,13 @@ GL_PREFIX(RenderbufferStorageEXT): popq %rdx popq %rsi popq %rdi - movq 6352(%rax), %r11 + movq 6336(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6352(%rax), %r11 + movq 6336(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30071,19 +29995,19 @@ GL_PREFIX(RenderbufferStorageEXT): popq %rdx popq %rsi popq %rdi - movq 6352(%rax), %r11 + movq 6336(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_795) - .type GL_PREFIX(_dispatch_stub_795), @function - HIDDEN(GL_PREFIX(_dispatch_stub_795)) -GL_PREFIX(_dispatch_stub_795): + .globl GL_PREFIX(_dispatch_stub_793) + .type GL_PREFIX(_dispatch_stub_793), @function + HIDDEN(GL_PREFIX(_dispatch_stub_793)) +GL_PREFIX(_dispatch_stub_793): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6360(%rax), %r11 + movq 6344(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30101,13 +30025,13 @@ GL_PREFIX(_dispatch_stub_795): popq %rdx popq %rsi popq %rdi - movq 6360(%rax), %r11 + movq 6344(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6360(%rax), %r11 + movq 6344(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30125,19 +30049,19 @@ GL_PREFIX(_dispatch_stub_795): popq %rdx popq %rsi popq %rdi - movq 6360(%rax), %r11 + movq 6344(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_795), .-GL_PREFIX(_dispatch_stub_795) + .size GL_PREFIX(_dispatch_stub_793), .-GL_PREFIX(_dispatch_stub_793) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_796) - .type GL_PREFIX(_dispatch_stub_796), @function - HIDDEN(GL_PREFIX(_dispatch_stub_796)) -GL_PREFIX(_dispatch_stub_796): + .globl GL_PREFIX(_dispatch_stub_794) + .type GL_PREFIX(_dispatch_stub_794), @function + HIDDEN(GL_PREFIX(_dispatch_stub_794)) +GL_PREFIX(_dispatch_stub_794): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6368(%rax), %r11 + movq 6352(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30147,13 +30071,13 @@ GL_PREFIX(_dispatch_stub_796): popq %rdx popq %rsi popq %rdi - movq 6368(%rax), %r11 + movq 6352(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6368(%rax), %r11 + movq 6352(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30163,19 +30087,19 @@ GL_PREFIX(_dispatch_stub_796): popq %rdx popq %rsi popq %rdi - movq 6368(%rax), %r11 + movq 6352(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_796), .-GL_PREFIX(_dispatch_stub_796) + .size GL_PREFIX(_dispatch_stub_794), .-GL_PREFIX(_dispatch_stub_794) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_797) - .type GL_PREFIX(_dispatch_stub_797), @function - HIDDEN(GL_PREFIX(_dispatch_stub_797)) -GL_PREFIX(_dispatch_stub_797): + .globl GL_PREFIX(_dispatch_stub_795) + .type GL_PREFIX(_dispatch_stub_795), @function + HIDDEN(GL_PREFIX(_dispatch_stub_795)) +GL_PREFIX(_dispatch_stub_795): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6376(%rax), %r11 + movq 6360(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30185,13 +30109,13 @@ GL_PREFIX(_dispatch_stub_797): popq %rdx popq %rsi popq %rdi - movq 6376(%rax), %r11 + movq 6360(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6376(%rax), %r11 + movq 6360(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30201,10 +30125,10 @@ GL_PREFIX(_dispatch_stub_797): popq %rdx popq %rsi popq %rdi - movq 6376(%rax), %r11 + movq 6360(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_797), .-GL_PREFIX(_dispatch_stub_797) + .size GL_PREFIX(_dispatch_stub_795), .-GL_PREFIX(_dispatch_stub_795) .p2align 4,,15 .globl GL_PREFIX(FramebufferTextureLayerEXT) @@ -30212,7 +30136,7 @@ GL_PREFIX(_dispatch_stub_797): GL_PREFIX(FramebufferTextureLayerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6384(%rax), %r11 + movq 6368(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30226,13 +30150,13 @@ GL_PREFIX(FramebufferTextureLayerEXT): popq %rdx popq %rsi popq %rdi - movq 6384(%rax), %r11 + movq 6368(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6384(%rax), %r11 + movq 6368(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30246,7 +30170,7 @@ GL_PREFIX(FramebufferTextureLayerEXT): popq %rdx popq %rsi popq %rdi - movq 6384(%rax), %r11 + movq 6368(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT) @@ -30257,7 +30181,7 @@ GL_PREFIX(FramebufferTextureLayerEXT): GL_PREFIX(ColorMaskIndexedEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6392(%rax), %r11 + movq 6376(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30271,13 +30195,13 @@ GL_PREFIX(ColorMaskIndexedEXT): popq %rdx popq %rsi popq %rdi - movq 6392(%rax), %r11 + movq 6376(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6392(%rax), %r11 + movq 6376(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30291,7 +30215,7 @@ GL_PREFIX(ColorMaskIndexedEXT): popq %rdx popq %rsi popq %rdi - movq 6392(%rax), %r11 + movq 6376(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorMaskIndexedEXT), .-GL_PREFIX(ColorMaskIndexedEXT) @@ -30302,7 +30226,7 @@ GL_PREFIX(ColorMaskIndexedEXT): GL_PREFIX(DisableIndexedEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6400(%rax), %r11 + movq 6384(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30312,13 +30236,13 @@ GL_PREFIX(DisableIndexedEXT): popq %rbp popq %rsi popq %rdi - movq 6400(%rax), %r11 + movq 6384(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6400(%rax), %r11 + movq 6384(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30328,7 +30252,7 @@ GL_PREFIX(DisableIndexedEXT): popq %rbp popq %rsi popq %rdi - movq 6400(%rax), %r11 + movq 6384(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DisableIndexedEXT), .-GL_PREFIX(DisableIndexedEXT) @@ -30339,7 +30263,7 @@ GL_PREFIX(DisableIndexedEXT): GL_PREFIX(EnableIndexedEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6408(%rax), %r11 + movq 6392(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30349,13 +30273,13 @@ GL_PREFIX(EnableIndexedEXT): popq %rbp popq %rsi popq %rdi - movq 6408(%rax), %r11 + movq 6392(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6408(%rax), %r11 + movq 6392(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30365,7 +30289,7 @@ GL_PREFIX(EnableIndexedEXT): popq %rbp popq %rsi popq %rdi - movq 6408(%rax), %r11 + movq 6392(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EnableIndexedEXT), .-GL_PREFIX(EnableIndexedEXT) @@ -30376,7 +30300,7 @@ GL_PREFIX(EnableIndexedEXT): GL_PREFIX(GetBooleanIndexedvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6416(%rax), %r11 + movq 6400(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30386,13 +30310,13 @@ GL_PREFIX(GetBooleanIndexedvEXT): popq %rdx popq %rsi popq %rdi - movq 6416(%rax), %r11 + movq 6400(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6416(%rax), %r11 + movq 6400(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30402,7 +30326,7 @@ GL_PREFIX(GetBooleanIndexedvEXT): popq %rdx popq %rsi popq %rdi - movq 6416(%rax), %r11 + movq 6400(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetBooleanIndexedvEXT), .-GL_PREFIX(GetBooleanIndexedvEXT) @@ -30413,7 +30337,7 @@ GL_PREFIX(GetBooleanIndexedvEXT): GL_PREFIX(GetIntegerIndexedvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6424(%rax), %r11 + movq 6408(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30423,13 +30347,13 @@ GL_PREFIX(GetIntegerIndexedvEXT): popq %rdx popq %rsi popq %rdi - movq 6424(%rax), %r11 + movq 6408(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6424(%rax), %r11 + movq 6408(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30439,7 +30363,7 @@ GL_PREFIX(GetIntegerIndexedvEXT): popq %rdx popq %rsi popq %rdi - movq 6424(%rax), %r11 + movq 6408(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetIntegerIndexedvEXT), .-GL_PREFIX(GetIntegerIndexedvEXT) @@ -30450,7 +30374,7 @@ GL_PREFIX(GetIntegerIndexedvEXT): GL_PREFIX(IsEnabledIndexedEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6432(%rax), %r11 + movq 6416(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30460,13 +30384,13 @@ GL_PREFIX(IsEnabledIndexedEXT): popq %rbp popq %rsi popq %rdi - movq 6432(%rax), %r11 + movq 6416(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6432(%rax), %r11 + movq 6416(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30476,7 +30400,7 @@ GL_PREFIX(IsEnabledIndexedEXT): popq %rbp popq %rsi popq %rdi - movq 6432(%rax), %r11 + movq 6416(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsEnabledIndexedEXT), .-GL_PREFIX(IsEnabledIndexedEXT) @@ -30487,7 +30411,7 @@ GL_PREFIX(IsEnabledIndexedEXT): GL_PREFIX(BeginConditionalRenderNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6440(%rax), %r11 + movq 6424(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30497,13 +30421,13 @@ GL_PREFIX(BeginConditionalRenderNV): popq %rbp popq %rsi popq %rdi - movq 6440(%rax), %r11 + movq 6424(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6440(%rax), %r11 + movq 6424(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30513,7 +30437,7 @@ GL_PREFIX(BeginConditionalRenderNV): popq %rbp popq %rsi popq %rdi - movq 6440(%rax), %r11 + movq 6424(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BeginConditionalRenderNV), .-GL_PREFIX(BeginConditionalRenderNV) @@ -30524,25 +30448,25 @@ GL_PREFIX(BeginConditionalRenderNV): GL_PREFIX(EndConditionalRenderNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6448(%rax), %r11 + movq 6432(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 6448(%rax), %r11 + movq 6432(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6448(%rax), %r11 + movq 6432(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 6448(%rax), %r11 + movq 6432(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EndConditionalRenderNV), .-GL_PREFIX(EndConditionalRenderNV) @@ -30553,25 +30477,25 @@ GL_PREFIX(EndConditionalRenderNV): GL_PREFIX(BeginTransformFeedbackEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6456(%rax), %r11 + movq 6440(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6456(%rax), %r11 + movq 6440(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6456(%rax), %r11 + movq 6440(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6456(%rax), %r11 + movq 6440(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BeginTransformFeedbackEXT), .-GL_PREFIX(BeginTransformFeedbackEXT) @@ -30582,7 +30506,7 @@ GL_PREFIX(BeginTransformFeedbackEXT): GL_PREFIX(BindBufferBaseEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6464(%rax), %r11 + movq 6448(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30592,13 +30516,13 @@ GL_PREFIX(BindBufferBaseEXT): popq %rdx popq %rsi popq %rdi - movq 6464(%rax), %r11 + movq 6448(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6464(%rax), %r11 + movq 6448(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30608,7 +30532,7 @@ GL_PREFIX(BindBufferBaseEXT): popq %rdx popq %rsi popq %rdi - movq 6464(%rax), %r11 + movq 6448(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindBufferBaseEXT), .-GL_PREFIX(BindBufferBaseEXT) @@ -30619,7 +30543,7 @@ GL_PREFIX(BindBufferBaseEXT): GL_PREFIX(BindBufferOffsetEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6472(%rax), %r11 + movq 6456(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30633,13 +30557,13 @@ GL_PREFIX(BindBufferOffsetEXT): popq %rdx popq %rsi popq %rdi - movq 6472(%rax), %r11 + movq 6456(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6472(%rax), %r11 + movq 6456(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30653,7 +30577,7 @@ GL_PREFIX(BindBufferOffsetEXT): popq %rdx popq %rsi popq %rdi - movq 6472(%rax), %r11 + movq 6456(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindBufferOffsetEXT), .-GL_PREFIX(BindBufferOffsetEXT) @@ -30664,7 +30588,7 @@ GL_PREFIX(BindBufferOffsetEXT): GL_PREFIX(BindBufferRangeEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6480(%rax), %r11 + movq 6464(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30678,13 +30602,13 @@ GL_PREFIX(BindBufferRangeEXT): popq %rdx popq %rsi popq %rdi - movq 6480(%rax), %r11 + movq 6464(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6480(%rax), %r11 + movq 6464(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30698,7 +30622,7 @@ GL_PREFIX(BindBufferRangeEXT): popq %rdx popq %rsi popq %rdi - movq 6480(%rax), %r11 + movq 6464(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindBufferRangeEXT), .-GL_PREFIX(BindBufferRangeEXT) @@ -30709,25 +30633,25 @@ GL_PREFIX(BindBufferRangeEXT): GL_PREFIX(EndTransformFeedbackEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6488(%rax), %r11 + movq 6472(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 6488(%rax), %r11 + movq 6472(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6488(%rax), %r11 + movq 6472(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 6488(%rax), %r11 + movq 6472(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EndTransformFeedbackEXT), .-GL_PREFIX(EndTransformFeedbackEXT) @@ -30738,7 +30662,7 @@ GL_PREFIX(EndTransformFeedbackEXT): GL_PREFIX(GetTransformFeedbackVaryingEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6496(%rax), %r11 + movq 6480(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30756,13 +30680,13 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT): popq %rdx popq %rsi popq %rdi - movq 6496(%rax), %r11 + movq 6480(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6496(%rax), %r11 + movq 6480(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30780,7 +30704,7 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT): popq %rdx popq %rsi popq %rdi - movq 6496(%rax), %r11 + movq 6480(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTransformFeedbackVaryingEXT), .-GL_PREFIX(GetTransformFeedbackVaryingEXT) @@ -30791,7 +30715,7 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT): GL_PREFIX(TransformFeedbackVaryingsEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6504(%rax), %r11 + movq 6488(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30805,13 +30729,13 @@ GL_PREFIX(TransformFeedbackVaryingsEXT): popq %rdx popq %rsi popq %rdi - movq 6504(%rax), %r11 + movq 6488(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6504(%rax), %r11 + movq 6488(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30825,7 +30749,7 @@ GL_PREFIX(TransformFeedbackVaryingsEXT): popq %rdx popq %rsi popq %rdi - movq 6504(%rax), %r11 + movq 6488(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TransformFeedbackVaryingsEXT), .-GL_PREFIX(TransformFeedbackVaryingsEXT) @@ -30836,37 +30760,37 @@ GL_PREFIX(TransformFeedbackVaryingsEXT): GL_PREFIX(ProvokingVertexEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6512(%rax), %r11 + movq 6496(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6512(%rax), %r11 + movq 6496(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6512(%rax), %r11 + movq 6496(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6512(%rax), %r11 + movq 6496(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_815) - .type GL_PREFIX(_dispatch_stub_815), @function - HIDDEN(GL_PREFIX(_dispatch_stub_815)) -GL_PREFIX(_dispatch_stub_815): + .globl GL_PREFIX(_dispatch_stub_813) + .type GL_PREFIX(_dispatch_stub_813), @function + HIDDEN(GL_PREFIX(_dispatch_stub_813)) +GL_PREFIX(_dispatch_stub_813): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6520(%rax), %r11 + movq 6504(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30876,13 +30800,13 @@ GL_PREFIX(_dispatch_stub_815): popq %rdx popq %rsi popq %rdi - movq 6520(%rax), %r11 + movq 6504(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6520(%rax), %r11 + movq 6504(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30892,19 +30816,19 @@ GL_PREFIX(_dispatch_stub_815): popq %rdx popq %rsi popq %rdi - movq 6520(%rax), %r11 + movq 6504(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_815), .-GL_PREFIX(_dispatch_stub_815) + .size GL_PREFIX(_dispatch_stub_813), .-GL_PREFIX(_dispatch_stub_813) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_816) - .type GL_PREFIX(_dispatch_stub_816), @function - HIDDEN(GL_PREFIX(_dispatch_stub_816)) -GL_PREFIX(_dispatch_stub_816): + .globl GL_PREFIX(_dispatch_stub_814) + .type GL_PREFIX(_dispatch_stub_814), @function + HIDDEN(GL_PREFIX(_dispatch_stub_814)) +GL_PREFIX(_dispatch_stub_814): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6528(%rax), %r11 + movq 6512(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30914,13 +30838,13 @@ GL_PREFIX(_dispatch_stub_816): popq %rdx popq %rsi popq %rdi - movq 6528(%rax), %r11 + movq 6512(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6528(%rax), %r11 + movq 6512(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30930,10 +30854,10 @@ GL_PREFIX(_dispatch_stub_816): popq %rdx popq %rsi popq %rdi - movq 6528(%rax), %r11 + movq 6512(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_816), .-GL_PREFIX(_dispatch_stub_816) + .size GL_PREFIX(_dispatch_stub_814), .-GL_PREFIX(_dispatch_stub_814) .p2align 4,,15 .globl GL_PREFIX(GetObjectParameterivAPPLE) @@ -30941,7 +30865,7 @@ GL_PREFIX(_dispatch_stub_816): GL_PREFIX(GetObjectParameterivAPPLE): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6536(%rax), %r11 + movq 6520(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30955,13 +30879,13 @@ GL_PREFIX(GetObjectParameterivAPPLE): popq %rdx popq %rsi popq %rdi - movq 6536(%rax), %r11 + movq 6520(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6536(%rax), %r11 + movq 6520(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -30975,7 +30899,7 @@ GL_PREFIX(GetObjectParameterivAPPLE): popq %rdx popq %rsi popq %rdi - movq 6536(%rax), %r11 + movq 6520(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetObjectParameterivAPPLE), .-GL_PREFIX(GetObjectParameterivAPPLE) @@ -30986,7 +30910,7 @@ GL_PREFIX(GetObjectParameterivAPPLE): GL_PREFIX(ObjectPurgeableAPPLE): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6544(%rax), %r11 + movq 6528(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -30996,13 +30920,13 @@ GL_PREFIX(ObjectPurgeableAPPLE): popq %rdx popq %rsi popq %rdi - movq 6544(%rax), %r11 + movq 6528(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6544(%rax), %r11 + movq 6528(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31012,7 +30936,7 @@ GL_PREFIX(ObjectPurgeableAPPLE): popq %rdx popq %rsi popq %rdi - movq 6544(%rax), %r11 + movq 6528(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ObjectPurgeableAPPLE), .-GL_PREFIX(ObjectPurgeableAPPLE) @@ -31023,7 +30947,7 @@ GL_PREFIX(ObjectPurgeableAPPLE): GL_PREFIX(ObjectUnpurgeableAPPLE): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6552(%rax), %r11 + movq 6536(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31033,13 +30957,13 @@ GL_PREFIX(ObjectUnpurgeableAPPLE): popq %rdx popq %rsi popq %rdi - movq 6552(%rax), %r11 + movq 6536(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6552(%rax), %r11 + movq 6536(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31049,19 +30973,19 @@ GL_PREFIX(ObjectUnpurgeableAPPLE): popq %rdx popq %rsi popq %rdi - movq 6552(%rax), %r11 + movq 6536(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ObjectUnpurgeableAPPLE), .-GL_PREFIX(ObjectUnpurgeableAPPLE) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_820) - .type GL_PREFIX(_dispatch_stub_820), @function - HIDDEN(GL_PREFIX(_dispatch_stub_820)) -GL_PREFIX(_dispatch_stub_820): + .globl GL_PREFIX(_dispatch_stub_818) + .type GL_PREFIX(_dispatch_stub_818), @function + HIDDEN(GL_PREFIX(_dispatch_stub_818)) +GL_PREFIX(_dispatch_stub_818): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6560(%rax), %r11 + movq 6544(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31075,13 +30999,13 @@ GL_PREFIX(_dispatch_stub_820): popq %rdx popq %rsi popq %rdi - movq 6560(%rax), %r11 + movq 6544(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6560(%rax), %r11 + movq 6544(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31095,19 +31019,19 @@ GL_PREFIX(_dispatch_stub_820): popq %rdx popq %rsi popq %rdi - movq 6560(%rax), %r11 + movq 6544(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_820), .-GL_PREFIX(_dispatch_stub_820) + .size GL_PREFIX(_dispatch_stub_818), .-GL_PREFIX(_dispatch_stub_818) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_821) - .type GL_PREFIX(_dispatch_stub_821), @function - HIDDEN(GL_PREFIX(_dispatch_stub_821)) -GL_PREFIX(_dispatch_stub_821): + .globl GL_PREFIX(_dispatch_stub_819) + .type GL_PREFIX(_dispatch_stub_819), @function + HIDDEN(GL_PREFIX(_dispatch_stub_819)) +GL_PREFIX(_dispatch_stub_819): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6568(%rax), %r11 + movq 6552(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31121,13 +31045,13 @@ GL_PREFIX(_dispatch_stub_821): popq %rdx popq %rsi popq %rdi - movq 6568(%rax), %r11 + movq 6552(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6568(%rax), %r11 + movq 6552(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31141,19 +31065,19 @@ GL_PREFIX(_dispatch_stub_821): popq %rdx popq %rsi popq %rdi - movq 6568(%rax), %r11 + movq 6552(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_821), .-GL_PREFIX(_dispatch_stub_821) + .size GL_PREFIX(_dispatch_stub_819), .-GL_PREFIX(_dispatch_stub_819) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_822) - .type GL_PREFIX(_dispatch_stub_822), @function - HIDDEN(GL_PREFIX(_dispatch_stub_822)) -GL_PREFIX(_dispatch_stub_822): + .globl GL_PREFIX(_dispatch_stub_820) + .type GL_PREFIX(_dispatch_stub_820), @function + HIDDEN(GL_PREFIX(_dispatch_stub_820)) +GL_PREFIX(_dispatch_stub_820): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6576(%rax), %r11 + movq 6560(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31167,13 +31091,13 @@ GL_PREFIX(_dispatch_stub_822): popq %rdx popq %rsi popq %rdi - movq 6576(%rax), %r11 + movq 6560(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6576(%rax), %r11 + movq 6560(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31187,19 +31111,19 @@ GL_PREFIX(_dispatch_stub_822): popq %rdx popq %rsi popq %rdi - movq 6576(%rax), %r11 + movq 6560(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_822), .-GL_PREFIX(_dispatch_stub_822) + .size GL_PREFIX(_dispatch_stub_820), .-GL_PREFIX(_dispatch_stub_820) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_823) - .type GL_PREFIX(_dispatch_stub_823), @function - HIDDEN(GL_PREFIX(_dispatch_stub_823)) -GL_PREFIX(_dispatch_stub_823): + .globl GL_PREFIX(_dispatch_stub_821) + .type GL_PREFIX(_dispatch_stub_821), @function + HIDDEN(GL_PREFIX(_dispatch_stub_821)) +GL_PREFIX(_dispatch_stub_821): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6584(%rax), %r11 + movq 6568(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31209,13 +31133,13 @@ GL_PREFIX(_dispatch_stub_823): popq %rdx popq %rsi popq %rdi - movq 6584(%rax), %r11 + movq 6568(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6584(%rax), %r11 + movq 6568(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31225,19 +31149,19 @@ GL_PREFIX(_dispatch_stub_823): popq %rdx popq %rsi popq %rdi - movq 6584(%rax), %r11 + movq 6568(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_823), .-GL_PREFIX(_dispatch_stub_823) + .size GL_PREFIX(_dispatch_stub_821), .-GL_PREFIX(_dispatch_stub_821) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_824) - .type GL_PREFIX(_dispatch_stub_824), @function - HIDDEN(GL_PREFIX(_dispatch_stub_824)) -GL_PREFIX(_dispatch_stub_824): + .globl GL_PREFIX(_dispatch_stub_822) + .type GL_PREFIX(_dispatch_stub_822), @function + HIDDEN(GL_PREFIX(_dispatch_stub_822)) +GL_PREFIX(_dispatch_stub_822): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6592(%rax), %r11 + movq 6576(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31247,13 +31171,13 @@ GL_PREFIX(_dispatch_stub_824): popq %rdx popq %rsi popq %rdi - movq 6592(%rax), %r11 + movq 6576(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6592(%rax), %r11 + movq 6576(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31263,10 +31187,10 @@ GL_PREFIX(_dispatch_stub_824): popq %rdx popq %rsi popq %rdi - movq 6592(%rax), %r11 + movq 6576(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_824), .-GL_PREFIX(_dispatch_stub_824) + .size GL_PREFIX(_dispatch_stub_822), .-GL_PREFIX(_dispatch_stub_822) .p2align 4,,15 .globl GL_PREFIX(EGLImageTargetRenderbufferStorageOES) @@ -31274,7 +31198,7 @@ GL_PREFIX(_dispatch_stub_824): GL_PREFIX(EGLImageTargetRenderbufferStorageOES): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6600(%rax), %r11 + movq 6584(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31284,13 +31208,13 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES): popq %rbp popq %rsi popq %rdi - movq 6600(%rax), %r11 + movq 6584(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6600(%rax), %r11 + movq 6584(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31300,7 +31224,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES): popq %rbp popq %rsi popq %rdi - movq 6600(%rax), %r11 + movq 6584(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EGLImageTargetRenderbufferStorageOES), .-GL_PREFIX(EGLImageTargetRenderbufferStorageOES) @@ -31311,7 +31235,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES): GL_PREFIX(EGLImageTargetTexture2DOES): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6608(%rax), %r11 + movq 6592(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -31321,13 +31245,13 @@ GL_PREFIX(EGLImageTargetTexture2DOES): popq %rbp popq %rsi popq %rdi - movq 6608(%rax), %r11 + movq 6592(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6608(%rax), %r11 + movq 6592(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -31337,7 +31261,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES): popq %rbp popq %rsi popq %rdi - movq 6608(%rax), %r11 + movq 6592(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EGLImageTargetTexture2DOES), .-GL_PREFIX(EGLImageTargetTexture2DOES) @@ -31600,9 +31524,9 @@ GL_PREFIX(EGLImageTargetTexture2DOES): .globl GL_PREFIX(IsProgramARB) ; .set GL_PREFIX(IsProgramARB), GL_PREFIX(IsProgramNV) .globl GL_PREFIX(PointParameteri) ; .set GL_PREFIX(PointParameteri), GL_PREFIX(PointParameteriNV) .globl GL_PREFIX(PointParameteriv) ; .set GL_PREFIX(PointParameteriv), GL_PREFIX(PointParameterivNV) - .globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_767) - .globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_769) - .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_777) + .globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_765) + .globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_767) + .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_775) .globl GL_PREFIX(BindFramebuffer) ; .set GL_PREFIX(BindFramebuffer), GL_PREFIX(BindFramebufferEXT) .globl GL_PREFIX(BindRenderbuffer) ; .set GL_PREFIX(BindRenderbuffer), GL_PREFIX(BindRenderbufferEXT) .globl GL_PREFIX(CheckFramebufferStatus) ; .set GL_PREFIX(CheckFramebufferStatus), GL_PREFIX(CheckFramebufferStatusEXT) @@ -31620,7 +31544,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES): .globl GL_PREFIX(IsFramebuffer) ; .set GL_PREFIX(IsFramebuffer), GL_PREFIX(IsFramebufferEXT) .globl GL_PREFIX(IsRenderbuffer) ; .set GL_PREFIX(IsRenderbuffer), GL_PREFIX(IsRenderbufferEXT) .globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT) - .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_795) + .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_793) .globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT) .globl GL_PREFIX(BeginTransformFeedback) ; .set GL_PREFIX(BeginTransformFeedback), GL_PREFIX(BeginTransformFeedbackEXT) .globl GL_PREFIX(BindBufferBase) ; .set GL_PREFIX(BindBufferBase), GL_PREFIX(BindBufferBaseEXT) diff --git a/src/mapi/glapi/glapi_x86.S b/src/mapi/glapi/glapi_x86.S index 8b764c993cb..872df4a1cb6 100644 --- a/src/mapi/glapi/glapi_x86.S +++ b/src/mapi/glapi/glapi_x86.S @@ -767,10 +767,6 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(PointParameterfvEXT, _gloffset_PointParameterfvEXT, PointParameterfvEXT@8) GL_STUB(LockArraysEXT, _gloffset_LockArraysEXT, LockArraysEXT@8) GL_STUB(UnlockArraysEXT, _gloffset_UnlockArraysEXT, UnlockArraysEXT@0) - GL_STUB(_dispatch_stub_608, _gloffset_CullParameterdvEXT, _dispatch_stub_608@8) - HIDDEN(GL_PREFIX(_dispatch_stub_608, _dispatch_stub_608@8)) - GL_STUB(_dispatch_stub_609, _gloffset_CullParameterfvEXT, _dispatch_stub_609@8) - HIDDEN(GL_PREFIX(_dispatch_stub_609, _dispatch_stub_609@8)) GL_STUB(SecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT, SecondaryColor3bEXT@12) GL_STUB(SecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) GL_STUB(SecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT, SecondaryColor3dEXT@24) @@ -795,8 +791,8 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(FogCoorddvEXT, _gloffset_FogCoorddvEXT, FogCoorddvEXT@4) GL_STUB(FogCoordfEXT, _gloffset_FogCoordfEXT, FogCoordfEXT@4) GL_STUB(FogCoordfvEXT, _gloffset_FogCoordfvEXT, FogCoordfvEXT@4) - GL_STUB(_dispatch_stub_634, _gloffset_PixelTexGenSGIX, _dispatch_stub_634@4) - HIDDEN(GL_PREFIX(_dispatch_stub_634, _dispatch_stub_634@4)) + GL_STUB(_dispatch_stub_632, _gloffset_PixelTexGenSGIX, _dispatch_stub_632@4) + HIDDEN(GL_PREFIX(_dispatch_stub_632, _dispatch_stub_632@4)) GL_STUB(BlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) GL_STUB(FlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV, FlushVertexArrayRangeNV@0) GL_STUB(VertexArrayRangeNV, _gloffset_VertexArrayRangeNV, VertexArrayRangeNV@8) @@ -838,24 +834,24 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(WindowPos4ivMESA, _gloffset_WindowPos4ivMESA, WindowPos4ivMESA@4) GL_STUB(WindowPos4sMESA, _gloffset_WindowPos4sMESA, WindowPos4sMESA@16) GL_STUB(WindowPos4svMESA, _gloffset_WindowPos4svMESA, WindowPos4svMESA@4) - GL_STUB(_dispatch_stub_676, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_676@20) - HIDDEN(GL_PREFIX(_dispatch_stub_676, _dispatch_stub_676@20)) - GL_STUB(_dispatch_stub_677, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_677@24) - HIDDEN(GL_PREFIX(_dispatch_stub_677, _dispatch_stub_677@24)) - GL_STUB(_dispatch_stub_678, _gloffset_DeleteFencesNV, _dispatch_stub_678@8) + GL_STUB(_dispatch_stub_674, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_674@20) + HIDDEN(GL_PREFIX(_dispatch_stub_674, _dispatch_stub_674@20)) + GL_STUB(_dispatch_stub_675, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_675@24) + HIDDEN(GL_PREFIX(_dispatch_stub_675, _dispatch_stub_675@24)) + GL_STUB(_dispatch_stub_676, _gloffset_DeleteFencesNV, _dispatch_stub_676@8) + HIDDEN(GL_PREFIX(_dispatch_stub_676, _dispatch_stub_676@8)) + GL_STUB(_dispatch_stub_677, _gloffset_FinishFenceNV, _dispatch_stub_677@4) + HIDDEN(GL_PREFIX(_dispatch_stub_677, _dispatch_stub_677@4)) + GL_STUB(_dispatch_stub_678, _gloffset_GenFencesNV, _dispatch_stub_678@8) HIDDEN(GL_PREFIX(_dispatch_stub_678, _dispatch_stub_678@8)) - GL_STUB(_dispatch_stub_679, _gloffset_FinishFenceNV, _dispatch_stub_679@4) - HIDDEN(GL_PREFIX(_dispatch_stub_679, _dispatch_stub_679@4)) - GL_STUB(_dispatch_stub_680, _gloffset_GenFencesNV, _dispatch_stub_680@8) - HIDDEN(GL_PREFIX(_dispatch_stub_680, _dispatch_stub_680@8)) - GL_STUB(_dispatch_stub_681, _gloffset_GetFenceivNV, _dispatch_stub_681@12) - HIDDEN(GL_PREFIX(_dispatch_stub_681, _dispatch_stub_681@12)) - GL_STUB(_dispatch_stub_682, _gloffset_IsFenceNV, _dispatch_stub_682@4) + GL_STUB(_dispatch_stub_679, _gloffset_GetFenceivNV, _dispatch_stub_679@12) + HIDDEN(GL_PREFIX(_dispatch_stub_679, _dispatch_stub_679@12)) + GL_STUB(_dispatch_stub_680, _gloffset_IsFenceNV, _dispatch_stub_680@4) + HIDDEN(GL_PREFIX(_dispatch_stub_680, _dispatch_stub_680@4)) + GL_STUB(_dispatch_stub_681, _gloffset_SetFenceNV, _dispatch_stub_681@8) + HIDDEN(GL_PREFIX(_dispatch_stub_681, _dispatch_stub_681@8)) + GL_STUB(_dispatch_stub_682, _gloffset_TestFenceNV, _dispatch_stub_682@4) HIDDEN(GL_PREFIX(_dispatch_stub_682, _dispatch_stub_682@4)) - GL_STUB(_dispatch_stub_683, _gloffset_SetFenceNV, _dispatch_stub_683@8) - HIDDEN(GL_PREFIX(_dispatch_stub_683, _dispatch_stub_683@8)) - GL_STUB(_dispatch_stub_684, _gloffset_TestFenceNV, _dispatch_stub_684@4) - HIDDEN(GL_PREFIX(_dispatch_stub_684, _dispatch_stub_684@4)) GL_STUB(AreProgramsResidentNV, _gloffset_AreProgramsResidentNV, AreProgramsResidentNV@12) GL_STUB(BindProgramNV, _gloffset_BindProgramNV, BindProgramNV@8) GL_STUB(DeleteProgramsNV, _gloffset_DeleteProgramsNV, DeleteProgramsNV@8) @@ -936,26 +932,26 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(SetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI, SetFragmentShaderConstantATI@8) GL_STUB(PointParameteriNV, _gloffset_PointParameteriNV, PointParameteriNV@8) GL_STUB(PointParameterivNV, _gloffset_PointParameterivNV, PointParameterivNV@8) - GL_STUB(_dispatch_stub_765, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_765@4) - HIDDEN(GL_PREFIX(_dispatch_stub_765, _dispatch_stub_765@4)) - GL_STUB(_dispatch_stub_766, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_766@4) - HIDDEN(GL_PREFIX(_dispatch_stub_766, _dispatch_stub_766@4)) - GL_STUB(_dispatch_stub_767, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_767@8) - HIDDEN(GL_PREFIX(_dispatch_stub_767, _dispatch_stub_767@8)) - GL_STUB(_dispatch_stub_768, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_768@8) - HIDDEN(GL_PREFIX(_dispatch_stub_768, _dispatch_stub_768@8)) - GL_STUB(_dispatch_stub_769, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_769@4) - HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@4)) + GL_STUB(_dispatch_stub_763, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_763@4) + HIDDEN(GL_PREFIX(_dispatch_stub_763, _dispatch_stub_763@4)) + GL_STUB(_dispatch_stub_764, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_764@4) + HIDDEN(GL_PREFIX(_dispatch_stub_764, _dispatch_stub_764@4)) + GL_STUB(_dispatch_stub_765, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_765@8) + HIDDEN(GL_PREFIX(_dispatch_stub_765, _dispatch_stub_765@8)) + GL_STUB(_dispatch_stub_766, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_766@8) + HIDDEN(GL_PREFIX(_dispatch_stub_766, _dispatch_stub_766@8)) + GL_STUB(_dispatch_stub_767, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_767@4) + HIDDEN(GL_PREFIX(_dispatch_stub_767, _dispatch_stub_767@4)) GL_STUB(GetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV, GetProgramNamedParameterdvNV@16) GL_STUB(GetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV, GetProgramNamedParameterfvNV@16) GL_STUB(ProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV, ProgramNamedParameter4dNV@44) GL_STUB(ProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV, ProgramNamedParameter4dvNV@16) GL_STUB(ProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV, ProgramNamedParameter4fNV@28) GL_STUB(ProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV, ProgramNamedParameter4fvNV@16) - GL_STUB(_dispatch_stub_776, _gloffset_DepthBoundsEXT, _dispatch_stub_776@16) - HIDDEN(GL_PREFIX(_dispatch_stub_776, _dispatch_stub_776@16)) - GL_STUB(_dispatch_stub_777, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_777@8) - HIDDEN(GL_PREFIX(_dispatch_stub_777, _dispatch_stub_777@8)) + GL_STUB(_dispatch_stub_774, _gloffset_DepthBoundsEXT, _dispatch_stub_774@16) + HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@16)) + GL_STUB(_dispatch_stub_775, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_775@8) + HIDDEN(GL_PREFIX(_dispatch_stub_775, _dispatch_stub_775@8)) GL_STUB(BindFramebufferEXT, _gloffset_BindFramebufferEXT, BindFramebufferEXT@8) GL_STUB(BindRenderbufferEXT, _gloffset_BindRenderbufferEXT, BindRenderbufferEXT@8) GL_STUB(CheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) @@ -973,12 +969,12 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(IsFramebufferEXT, _gloffset_IsFramebufferEXT, IsFramebufferEXT@4) GL_STUB(IsRenderbufferEXT, _gloffset_IsRenderbufferEXT, IsRenderbufferEXT@4) GL_STUB(RenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT, RenderbufferStorageEXT@16) - GL_STUB(_dispatch_stub_795, _gloffset_BlitFramebufferEXT, _dispatch_stub_795@40) - HIDDEN(GL_PREFIX(_dispatch_stub_795, _dispatch_stub_795@40)) - GL_STUB(_dispatch_stub_796, _gloffset_BufferParameteriAPPLE, _dispatch_stub_796@12) - HIDDEN(GL_PREFIX(_dispatch_stub_796, _dispatch_stub_796@12)) - GL_STUB(_dispatch_stub_797, _gloffset_FlushMappedBufferRangeAPPLE, _dispatch_stub_797@12) - HIDDEN(GL_PREFIX(_dispatch_stub_797, _dispatch_stub_797@12)) + GL_STUB(_dispatch_stub_793, _gloffset_BlitFramebufferEXT, _dispatch_stub_793@40) + HIDDEN(GL_PREFIX(_dispatch_stub_793, _dispatch_stub_793@40)) + GL_STUB(_dispatch_stub_794, _gloffset_BufferParameteriAPPLE, _dispatch_stub_794@12) + HIDDEN(GL_PREFIX(_dispatch_stub_794, _dispatch_stub_794@12)) + GL_STUB(_dispatch_stub_795, _gloffset_FlushMappedBufferRangeAPPLE, _dispatch_stub_795@12) + HIDDEN(GL_PREFIX(_dispatch_stub_795, _dispatch_stub_795@12)) GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) GL_STUB(ColorMaskIndexedEXT, _gloffset_ColorMaskIndexedEXT, ColorMaskIndexedEXT@20) GL_STUB(DisableIndexedEXT, _gloffset_DisableIndexedEXT, DisableIndexedEXT@8) @@ -996,23 +992,23 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(GetTransformFeedbackVaryingEXT, _gloffset_GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28) GL_STUB(TransformFeedbackVaryingsEXT, _gloffset_TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16) GL_STUB(ProvokingVertexEXT, _gloffset_ProvokingVertexEXT, ProvokingVertexEXT@4) - GL_STUB(_dispatch_stub_815, _gloffset_GetTexParameterPointervAPPLE, _dispatch_stub_815@12) - HIDDEN(GL_PREFIX(_dispatch_stub_815, _dispatch_stub_815@12)) - GL_STUB(_dispatch_stub_816, _gloffset_TextureRangeAPPLE, _dispatch_stub_816@12) - HIDDEN(GL_PREFIX(_dispatch_stub_816, _dispatch_stub_816@12)) + GL_STUB(_dispatch_stub_813, _gloffset_GetTexParameterPointervAPPLE, _dispatch_stub_813@12) + HIDDEN(GL_PREFIX(_dispatch_stub_813, _dispatch_stub_813@12)) + GL_STUB(_dispatch_stub_814, _gloffset_TextureRangeAPPLE, _dispatch_stub_814@12) + HIDDEN(GL_PREFIX(_dispatch_stub_814, _dispatch_stub_814@12)) GL_STUB(GetObjectParameterivAPPLE, _gloffset_GetObjectParameterivAPPLE, GetObjectParameterivAPPLE@16) GL_STUB(ObjectPurgeableAPPLE, _gloffset_ObjectPurgeableAPPLE, ObjectPurgeableAPPLE@12) GL_STUB(ObjectUnpurgeableAPPLE, _gloffset_ObjectUnpurgeableAPPLE, ObjectUnpurgeableAPPLE@12) - GL_STUB(_dispatch_stub_820, _gloffset_StencilFuncSeparateATI, _dispatch_stub_820@16) + GL_STUB(_dispatch_stub_818, _gloffset_StencilFuncSeparateATI, _dispatch_stub_818@16) + HIDDEN(GL_PREFIX(_dispatch_stub_818, _dispatch_stub_818@16)) + GL_STUB(_dispatch_stub_819, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_819@16) + HIDDEN(GL_PREFIX(_dispatch_stub_819, _dispatch_stub_819@16)) + GL_STUB(_dispatch_stub_820, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_820@16) HIDDEN(GL_PREFIX(_dispatch_stub_820, _dispatch_stub_820@16)) - GL_STUB(_dispatch_stub_821, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_821@16) - HIDDEN(GL_PREFIX(_dispatch_stub_821, _dispatch_stub_821@16)) - GL_STUB(_dispatch_stub_822, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_822@16) - HIDDEN(GL_PREFIX(_dispatch_stub_822, _dispatch_stub_822@16)) - GL_STUB(_dispatch_stub_823, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_823@12) - HIDDEN(GL_PREFIX(_dispatch_stub_823, _dispatch_stub_823@12)) - GL_STUB(_dispatch_stub_824, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_824@12) - HIDDEN(GL_PREFIX(_dispatch_stub_824, _dispatch_stub_824@12)) + GL_STUB(_dispatch_stub_821, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_821@12) + HIDDEN(GL_PREFIX(_dispatch_stub_821, _dispatch_stub_821@12)) + GL_STUB(_dispatch_stub_822, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_822@12) + HIDDEN(GL_PREFIX(_dispatch_stub_822, _dispatch_stub_822@12)) GL_STUB(EGLImageTargetRenderbufferStorageOES, _gloffset_EGLImageTargetRenderbufferStorageOES, EGLImageTargetRenderbufferStorageOES@8) GL_STUB(EGLImageTargetTexture2DOES, _gloffset_EGLImageTargetTexture2DOES, EGLImageTargetTexture2DOES@8) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) @@ -1273,9 +1269,9 @@ GLNAME(gl_dispatch_functions_start): GL_STUB_ALIAS(IsProgramARB, _gloffset_IsProgramNV, IsProgramARB@4, IsProgramNV, IsProgramNV@4) GL_STUB_ALIAS(PointParameteri, _gloffset_PointParameteriNV, PointParameteri@8, PointParameteriNV, PointParameteriNV@8) GL_STUB_ALIAS(PointParameteriv, _gloffset_PointParameterivNV, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8) - GL_STUB_ALIAS(DeleteVertexArrays, _gloffset_DeleteVertexArraysAPPLE, DeleteVertexArrays@8, _dispatch_stub_767, _dispatch_stub_767@8) - GL_STUB_ALIAS(IsVertexArray, _gloffset_IsVertexArrayAPPLE, IsVertexArray@4, _dispatch_stub_769, _dispatch_stub_769@4) - GL_STUB_ALIAS(BlendEquationSeparate, _gloffset_BlendEquationSeparateEXT, BlendEquationSeparate@8, _dispatch_stub_777, _dispatch_stub_777@8) + GL_STUB_ALIAS(DeleteVertexArrays, _gloffset_DeleteVertexArraysAPPLE, DeleteVertexArrays@8, _dispatch_stub_765, _dispatch_stub_765@8) + GL_STUB_ALIAS(IsVertexArray, _gloffset_IsVertexArrayAPPLE, IsVertexArray@4, _dispatch_stub_767, _dispatch_stub_767@4) + GL_STUB_ALIAS(BlendEquationSeparate, _gloffset_BlendEquationSeparateEXT, BlendEquationSeparate@8, _dispatch_stub_775, _dispatch_stub_775@8) GL_STUB_ALIAS(BindFramebuffer, _gloffset_BindFramebufferEXT, BindFramebuffer@8, BindFramebufferEXT, BindFramebufferEXT@8) GL_STUB_ALIAS(BindRenderbuffer, _gloffset_BindRenderbufferEXT, BindRenderbuffer@8, BindRenderbufferEXT, BindRenderbufferEXT@8) GL_STUB_ALIAS(CheckFramebufferStatus, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatus@4, CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) @@ -1293,7 +1289,7 @@ GLNAME(gl_dispatch_functions_start): GL_STUB_ALIAS(IsFramebuffer, _gloffset_IsFramebufferEXT, IsFramebuffer@4, IsFramebufferEXT, IsFramebufferEXT@4) GL_STUB_ALIAS(IsRenderbuffer, _gloffset_IsRenderbufferEXT, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4) GL_STUB_ALIAS(RenderbufferStorage, _gloffset_RenderbufferStorageEXT, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16) - GL_STUB_ALIAS(BlitFramebuffer, _gloffset_BlitFramebufferEXT, BlitFramebuffer@40, _dispatch_stub_795, _dispatch_stub_795@40) + GL_STUB_ALIAS(BlitFramebuffer, _gloffset_BlitFramebufferEXT, BlitFramebuffer@40, _dispatch_stub_793, _dispatch_stub_793@40) GL_STUB_ALIAS(FramebufferTextureLayer, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) GL_STUB_ALIAS(BeginTransformFeedback, _gloffset_BeginTransformFeedbackEXT, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4) GL_STUB_ALIAS(BindBufferBase, _gloffset_BindBufferBaseEXT, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12) diff --git a/src/mapi/glapi/glapidispatch.h b/src/mapi/glapi/glapidispatch.h index 0c19d902949..1d03f4cc50c 100644 --- a/src/mapi/glapi/glapidispatch.h +++ b/src/mapi/glapi/glapidispatch.h @@ -1885,12 +1885,6 @@ #define CALL_UnlockArraysEXT(disp, parameters) (*((disp)->UnlockArraysEXT)) parameters #define GET_UnlockArraysEXT(disp) ((disp)->UnlockArraysEXT) #define SET_UnlockArraysEXT(disp, fn) ((disp)->UnlockArraysEXT = fn) -#define CALL_CullParameterdvEXT(disp, parameters) (*((disp)->CullParameterdvEXT)) parameters -#define GET_CullParameterdvEXT(disp) ((disp)->CullParameterdvEXT) -#define SET_CullParameterdvEXT(disp, fn) ((disp)->CullParameterdvEXT = fn) -#define CALL_CullParameterfvEXT(disp, parameters) (*((disp)->CullParameterfvEXT)) parameters -#define GET_CullParameterfvEXT(disp) ((disp)->CullParameterfvEXT) -#define SET_CullParameterfvEXT(disp, fn) ((disp)->CullParameterfvEXT = fn) #define CALL_SecondaryColor3bEXT(disp, parameters) (*((disp)->SecondaryColor3bEXT)) parameters #define GET_SecondaryColor3bEXT(disp) ((disp)->SecondaryColor3bEXT) #define SET_SecondaryColor3bEXT(disp, fn) ((disp)->SecondaryColor3bEXT = fn) @@ -2545,7 +2539,7 @@ #else -#define driDispatchRemapTable_size 419 +#define driDispatchRemapTable_size 417 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2748,225 +2742,223 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define PointParameterfvEXT_remap_index 197 #define LockArraysEXT_remap_index 198 #define UnlockArraysEXT_remap_index 199 -#define CullParameterdvEXT_remap_index 200 -#define CullParameterfvEXT_remap_index 201 -#define SecondaryColor3bEXT_remap_index 202 -#define SecondaryColor3bvEXT_remap_index 203 -#define SecondaryColor3dEXT_remap_index 204 -#define SecondaryColor3dvEXT_remap_index 205 -#define SecondaryColor3fEXT_remap_index 206 -#define SecondaryColor3fvEXT_remap_index 207 -#define SecondaryColor3iEXT_remap_index 208 -#define SecondaryColor3ivEXT_remap_index 209 -#define SecondaryColor3sEXT_remap_index 210 -#define SecondaryColor3svEXT_remap_index 211 -#define SecondaryColor3ubEXT_remap_index 212 -#define SecondaryColor3ubvEXT_remap_index 213 -#define SecondaryColor3uiEXT_remap_index 214 -#define SecondaryColor3uivEXT_remap_index 215 -#define SecondaryColor3usEXT_remap_index 216 -#define SecondaryColor3usvEXT_remap_index 217 -#define SecondaryColorPointerEXT_remap_index 218 -#define MultiDrawArraysEXT_remap_index 219 -#define MultiDrawElementsEXT_remap_index 220 -#define FogCoordPointerEXT_remap_index 221 -#define FogCoorddEXT_remap_index 222 -#define FogCoorddvEXT_remap_index 223 -#define FogCoordfEXT_remap_index 224 -#define FogCoordfvEXT_remap_index 225 -#define PixelTexGenSGIX_remap_index 226 -#define BlendFuncSeparateEXT_remap_index 227 -#define FlushVertexArrayRangeNV_remap_index 228 -#define VertexArrayRangeNV_remap_index 229 -#define CombinerInputNV_remap_index 230 -#define CombinerOutputNV_remap_index 231 -#define CombinerParameterfNV_remap_index 232 -#define CombinerParameterfvNV_remap_index 233 -#define CombinerParameteriNV_remap_index 234 -#define CombinerParameterivNV_remap_index 235 -#define FinalCombinerInputNV_remap_index 236 -#define GetCombinerInputParameterfvNV_remap_index 237 -#define GetCombinerInputParameterivNV_remap_index 238 -#define GetCombinerOutputParameterfvNV_remap_index 239 -#define GetCombinerOutputParameterivNV_remap_index 240 -#define GetFinalCombinerInputParameterfvNV_remap_index 241 -#define GetFinalCombinerInputParameterivNV_remap_index 242 -#define ResizeBuffersMESA_remap_index 243 -#define WindowPos2dMESA_remap_index 244 -#define WindowPos2dvMESA_remap_index 245 -#define WindowPos2fMESA_remap_index 246 -#define WindowPos2fvMESA_remap_index 247 -#define WindowPos2iMESA_remap_index 248 -#define WindowPos2ivMESA_remap_index 249 -#define WindowPos2sMESA_remap_index 250 -#define WindowPos2svMESA_remap_index 251 -#define WindowPos3dMESA_remap_index 252 -#define WindowPos3dvMESA_remap_index 253 -#define WindowPos3fMESA_remap_index 254 -#define WindowPos3fvMESA_remap_index 255 -#define WindowPos3iMESA_remap_index 256 -#define WindowPos3ivMESA_remap_index 257 -#define WindowPos3sMESA_remap_index 258 -#define WindowPos3svMESA_remap_index 259 -#define WindowPos4dMESA_remap_index 260 -#define WindowPos4dvMESA_remap_index 261 -#define WindowPos4fMESA_remap_index 262 -#define WindowPos4fvMESA_remap_index 263 -#define WindowPos4iMESA_remap_index 264 -#define WindowPos4ivMESA_remap_index 265 -#define WindowPos4sMESA_remap_index 266 -#define WindowPos4svMESA_remap_index 267 -#define MultiModeDrawArraysIBM_remap_index 268 -#define MultiModeDrawElementsIBM_remap_index 269 -#define DeleteFencesNV_remap_index 270 -#define FinishFenceNV_remap_index 271 -#define GenFencesNV_remap_index 272 -#define GetFenceivNV_remap_index 273 -#define IsFenceNV_remap_index 274 -#define SetFenceNV_remap_index 275 -#define TestFenceNV_remap_index 276 -#define AreProgramsResidentNV_remap_index 277 -#define BindProgramNV_remap_index 278 -#define DeleteProgramsNV_remap_index 279 -#define ExecuteProgramNV_remap_index 280 -#define GenProgramsNV_remap_index 281 -#define GetProgramParameterdvNV_remap_index 282 -#define GetProgramParameterfvNV_remap_index 283 -#define GetProgramStringNV_remap_index 284 -#define GetProgramivNV_remap_index 285 -#define GetTrackMatrixivNV_remap_index 286 -#define GetVertexAttribPointervNV_remap_index 287 -#define GetVertexAttribdvNV_remap_index 288 -#define GetVertexAttribfvNV_remap_index 289 -#define GetVertexAttribivNV_remap_index 290 -#define IsProgramNV_remap_index 291 -#define LoadProgramNV_remap_index 292 -#define ProgramParameters4dvNV_remap_index 293 -#define ProgramParameters4fvNV_remap_index 294 -#define RequestResidentProgramsNV_remap_index 295 -#define TrackMatrixNV_remap_index 296 -#define VertexAttrib1dNV_remap_index 297 -#define VertexAttrib1dvNV_remap_index 298 -#define VertexAttrib1fNV_remap_index 299 -#define VertexAttrib1fvNV_remap_index 300 -#define VertexAttrib1sNV_remap_index 301 -#define VertexAttrib1svNV_remap_index 302 -#define VertexAttrib2dNV_remap_index 303 -#define VertexAttrib2dvNV_remap_index 304 -#define VertexAttrib2fNV_remap_index 305 -#define VertexAttrib2fvNV_remap_index 306 -#define VertexAttrib2sNV_remap_index 307 -#define VertexAttrib2svNV_remap_index 308 -#define VertexAttrib3dNV_remap_index 309 -#define VertexAttrib3dvNV_remap_index 310 -#define VertexAttrib3fNV_remap_index 311 -#define VertexAttrib3fvNV_remap_index 312 -#define VertexAttrib3sNV_remap_index 313 -#define VertexAttrib3svNV_remap_index 314 -#define VertexAttrib4dNV_remap_index 315 -#define VertexAttrib4dvNV_remap_index 316 -#define VertexAttrib4fNV_remap_index 317 -#define VertexAttrib4fvNV_remap_index 318 -#define VertexAttrib4sNV_remap_index 319 -#define VertexAttrib4svNV_remap_index 320 -#define VertexAttrib4ubNV_remap_index 321 -#define VertexAttrib4ubvNV_remap_index 322 -#define VertexAttribPointerNV_remap_index 323 -#define VertexAttribs1dvNV_remap_index 324 -#define VertexAttribs1fvNV_remap_index 325 -#define VertexAttribs1svNV_remap_index 326 -#define VertexAttribs2dvNV_remap_index 327 -#define VertexAttribs2fvNV_remap_index 328 -#define VertexAttribs2svNV_remap_index 329 -#define VertexAttribs3dvNV_remap_index 330 -#define VertexAttribs3fvNV_remap_index 331 -#define VertexAttribs3svNV_remap_index 332 -#define VertexAttribs4dvNV_remap_index 333 -#define VertexAttribs4fvNV_remap_index 334 -#define VertexAttribs4svNV_remap_index 335 -#define VertexAttribs4ubvNV_remap_index 336 -#define GetTexBumpParameterfvATI_remap_index 337 -#define GetTexBumpParameterivATI_remap_index 338 -#define TexBumpParameterfvATI_remap_index 339 -#define TexBumpParameterivATI_remap_index 340 -#define AlphaFragmentOp1ATI_remap_index 341 -#define AlphaFragmentOp2ATI_remap_index 342 -#define AlphaFragmentOp3ATI_remap_index 343 -#define BeginFragmentShaderATI_remap_index 344 -#define BindFragmentShaderATI_remap_index 345 -#define ColorFragmentOp1ATI_remap_index 346 -#define ColorFragmentOp2ATI_remap_index 347 -#define ColorFragmentOp3ATI_remap_index 348 -#define DeleteFragmentShaderATI_remap_index 349 -#define EndFragmentShaderATI_remap_index 350 -#define GenFragmentShadersATI_remap_index 351 -#define PassTexCoordATI_remap_index 352 -#define SampleMapATI_remap_index 353 -#define SetFragmentShaderConstantATI_remap_index 354 -#define PointParameteriNV_remap_index 355 -#define PointParameterivNV_remap_index 356 -#define ActiveStencilFaceEXT_remap_index 357 -#define BindVertexArrayAPPLE_remap_index 358 -#define DeleteVertexArraysAPPLE_remap_index 359 -#define GenVertexArraysAPPLE_remap_index 360 -#define IsVertexArrayAPPLE_remap_index 361 -#define GetProgramNamedParameterdvNV_remap_index 362 -#define GetProgramNamedParameterfvNV_remap_index 363 -#define ProgramNamedParameter4dNV_remap_index 364 -#define ProgramNamedParameter4dvNV_remap_index 365 -#define ProgramNamedParameter4fNV_remap_index 366 -#define ProgramNamedParameter4fvNV_remap_index 367 -#define DepthBoundsEXT_remap_index 368 -#define BlendEquationSeparateEXT_remap_index 369 -#define BindFramebufferEXT_remap_index 370 -#define BindRenderbufferEXT_remap_index 371 -#define CheckFramebufferStatusEXT_remap_index 372 -#define DeleteFramebuffersEXT_remap_index 373 -#define DeleteRenderbuffersEXT_remap_index 374 -#define FramebufferRenderbufferEXT_remap_index 375 -#define FramebufferTexture1DEXT_remap_index 376 -#define FramebufferTexture2DEXT_remap_index 377 -#define FramebufferTexture3DEXT_remap_index 378 -#define GenFramebuffersEXT_remap_index 379 -#define GenRenderbuffersEXT_remap_index 380 -#define GenerateMipmapEXT_remap_index 381 -#define GetFramebufferAttachmentParameterivEXT_remap_index 382 -#define GetRenderbufferParameterivEXT_remap_index 383 -#define IsFramebufferEXT_remap_index 384 -#define IsRenderbufferEXT_remap_index 385 -#define RenderbufferStorageEXT_remap_index 386 -#define BlitFramebufferEXT_remap_index 387 -#define BufferParameteriAPPLE_remap_index 388 -#define FlushMappedBufferRangeAPPLE_remap_index 389 -#define FramebufferTextureLayerEXT_remap_index 390 -#define ColorMaskIndexedEXT_remap_index 391 -#define DisableIndexedEXT_remap_index 392 -#define EnableIndexedEXT_remap_index 393 -#define GetBooleanIndexedvEXT_remap_index 394 -#define GetIntegerIndexedvEXT_remap_index 395 -#define IsEnabledIndexedEXT_remap_index 396 -#define BeginConditionalRenderNV_remap_index 397 -#define EndConditionalRenderNV_remap_index 398 -#define BeginTransformFeedbackEXT_remap_index 399 -#define BindBufferBaseEXT_remap_index 400 -#define BindBufferOffsetEXT_remap_index 401 -#define BindBufferRangeEXT_remap_index 402 -#define EndTransformFeedbackEXT_remap_index 403 -#define GetTransformFeedbackVaryingEXT_remap_index 404 -#define TransformFeedbackVaryingsEXT_remap_index 405 -#define ProvokingVertexEXT_remap_index 406 -#define GetTexParameterPointervAPPLE_remap_index 407 -#define TextureRangeAPPLE_remap_index 408 -#define GetObjectParameterivAPPLE_remap_index 409 -#define ObjectPurgeableAPPLE_remap_index 410 -#define ObjectUnpurgeableAPPLE_remap_index 411 -#define StencilFuncSeparateATI_remap_index 412 -#define ProgramEnvParameters4fvEXT_remap_index 413 -#define ProgramLocalParameters4fvEXT_remap_index 414 -#define GetQueryObjecti64vEXT_remap_index 415 -#define GetQueryObjectui64vEXT_remap_index 416 -#define EGLImageTargetRenderbufferStorageOES_remap_index 417 -#define EGLImageTargetTexture2DOES_remap_index 418 +#define SecondaryColor3bEXT_remap_index 200 +#define SecondaryColor3bvEXT_remap_index 201 +#define SecondaryColor3dEXT_remap_index 202 +#define SecondaryColor3dvEXT_remap_index 203 +#define SecondaryColor3fEXT_remap_index 204 +#define SecondaryColor3fvEXT_remap_index 205 +#define SecondaryColor3iEXT_remap_index 206 +#define SecondaryColor3ivEXT_remap_index 207 +#define SecondaryColor3sEXT_remap_index 208 +#define SecondaryColor3svEXT_remap_index 209 +#define SecondaryColor3ubEXT_remap_index 210 +#define SecondaryColor3ubvEXT_remap_index 211 +#define SecondaryColor3uiEXT_remap_index 212 +#define SecondaryColor3uivEXT_remap_index 213 +#define SecondaryColor3usEXT_remap_index 214 +#define SecondaryColor3usvEXT_remap_index 215 +#define SecondaryColorPointerEXT_remap_index 216 +#define MultiDrawArraysEXT_remap_index 217 +#define MultiDrawElementsEXT_remap_index 218 +#define FogCoordPointerEXT_remap_index 219 +#define FogCoorddEXT_remap_index 220 +#define FogCoorddvEXT_remap_index 221 +#define FogCoordfEXT_remap_index 222 +#define FogCoordfvEXT_remap_index 223 +#define PixelTexGenSGIX_remap_index 224 +#define BlendFuncSeparateEXT_remap_index 225 +#define FlushVertexArrayRangeNV_remap_index 226 +#define VertexArrayRangeNV_remap_index 227 +#define CombinerInputNV_remap_index 228 +#define CombinerOutputNV_remap_index 229 +#define CombinerParameterfNV_remap_index 230 +#define CombinerParameterfvNV_remap_index 231 +#define CombinerParameteriNV_remap_index 232 +#define CombinerParameterivNV_remap_index 233 +#define FinalCombinerInputNV_remap_index 234 +#define GetCombinerInputParameterfvNV_remap_index 235 +#define GetCombinerInputParameterivNV_remap_index 236 +#define GetCombinerOutputParameterfvNV_remap_index 237 +#define GetCombinerOutputParameterivNV_remap_index 238 +#define GetFinalCombinerInputParameterfvNV_remap_index 239 +#define GetFinalCombinerInputParameterivNV_remap_index 240 +#define ResizeBuffersMESA_remap_index 241 +#define WindowPos2dMESA_remap_index 242 +#define WindowPos2dvMESA_remap_index 243 +#define WindowPos2fMESA_remap_index 244 +#define WindowPos2fvMESA_remap_index 245 +#define WindowPos2iMESA_remap_index 246 +#define WindowPos2ivMESA_remap_index 247 +#define WindowPos2sMESA_remap_index 248 +#define WindowPos2svMESA_remap_index 249 +#define WindowPos3dMESA_remap_index 250 +#define WindowPos3dvMESA_remap_index 251 +#define WindowPos3fMESA_remap_index 252 +#define WindowPos3fvMESA_remap_index 253 +#define WindowPos3iMESA_remap_index 254 +#define WindowPos3ivMESA_remap_index 255 +#define WindowPos3sMESA_remap_index 256 +#define WindowPos3svMESA_remap_index 257 +#define WindowPos4dMESA_remap_index 258 +#define WindowPos4dvMESA_remap_index 259 +#define WindowPos4fMESA_remap_index 260 +#define WindowPos4fvMESA_remap_index 261 +#define WindowPos4iMESA_remap_index 262 +#define WindowPos4ivMESA_remap_index 263 +#define WindowPos4sMESA_remap_index 264 +#define WindowPos4svMESA_remap_index 265 +#define MultiModeDrawArraysIBM_remap_index 266 +#define MultiModeDrawElementsIBM_remap_index 267 +#define DeleteFencesNV_remap_index 268 +#define FinishFenceNV_remap_index 269 +#define GenFencesNV_remap_index 270 +#define GetFenceivNV_remap_index 271 +#define IsFenceNV_remap_index 272 +#define SetFenceNV_remap_index 273 +#define TestFenceNV_remap_index 274 +#define AreProgramsResidentNV_remap_index 275 +#define BindProgramNV_remap_index 276 +#define DeleteProgramsNV_remap_index 277 +#define ExecuteProgramNV_remap_index 278 +#define GenProgramsNV_remap_index 279 +#define GetProgramParameterdvNV_remap_index 280 +#define GetProgramParameterfvNV_remap_index 281 +#define GetProgramStringNV_remap_index 282 +#define GetProgramivNV_remap_index 283 +#define GetTrackMatrixivNV_remap_index 284 +#define GetVertexAttribPointervNV_remap_index 285 +#define GetVertexAttribdvNV_remap_index 286 +#define GetVertexAttribfvNV_remap_index 287 +#define GetVertexAttribivNV_remap_index 288 +#define IsProgramNV_remap_index 289 +#define LoadProgramNV_remap_index 290 +#define ProgramParameters4dvNV_remap_index 291 +#define ProgramParameters4fvNV_remap_index 292 +#define RequestResidentProgramsNV_remap_index 293 +#define TrackMatrixNV_remap_index 294 +#define VertexAttrib1dNV_remap_index 295 +#define VertexAttrib1dvNV_remap_index 296 +#define VertexAttrib1fNV_remap_index 297 +#define VertexAttrib1fvNV_remap_index 298 +#define VertexAttrib1sNV_remap_index 299 +#define VertexAttrib1svNV_remap_index 300 +#define VertexAttrib2dNV_remap_index 301 +#define VertexAttrib2dvNV_remap_index 302 +#define VertexAttrib2fNV_remap_index 303 +#define VertexAttrib2fvNV_remap_index 304 +#define VertexAttrib2sNV_remap_index 305 +#define VertexAttrib2svNV_remap_index 306 +#define VertexAttrib3dNV_remap_index 307 +#define VertexAttrib3dvNV_remap_index 308 +#define VertexAttrib3fNV_remap_index 309 +#define VertexAttrib3fvNV_remap_index 310 +#define VertexAttrib3sNV_remap_index 311 +#define VertexAttrib3svNV_remap_index 312 +#define VertexAttrib4dNV_remap_index 313 +#define VertexAttrib4dvNV_remap_index 314 +#define VertexAttrib4fNV_remap_index 315 +#define VertexAttrib4fvNV_remap_index 316 +#define VertexAttrib4sNV_remap_index 317 +#define VertexAttrib4svNV_remap_index 318 +#define VertexAttrib4ubNV_remap_index 319 +#define VertexAttrib4ubvNV_remap_index 320 +#define VertexAttribPointerNV_remap_index 321 +#define VertexAttribs1dvNV_remap_index 322 +#define VertexAttribs1fvNV_remap_index 323 +#define VertexAttribs1svNV_remap_index 324 +#define VertexAttribs2dvNV_remap_index 325 +#define VertexAttribs2fvNV_remap_index 326 +#define VertexAttribs2svNV_remap_index 327 +#define VertexAttribs3dvNV_remap_index 328 +#define VertexAttribs3fvNV_remap_index 329 +#define VertexAttribs3svNV_remap_index 330 +#define VertexAttribs4dvNV_remap_index 331 +#define VertexAttribs4fvNV_remap_index 332 +#define VertexAttribs4svNV_remap_index 333 +#define VertexAttribs4ubvNV_remap_index 334 +#define GetTexBumpParameterfvATI_remap_index 335 +#define GetTexBumpParameterivATI_remap_index 336 +#define TexBumpParameterfvATI_remap_index 337 +#define TexBumpParameterivATI_remap_index 338 +#define AlphaFragmentOp1ATI_remap_index 339 +#define AlphaFragmentOp2ATI_remap_index 340 +#define AlphaFragmentOp3ATI_remap_index 341 +#define BeginFragmentShaderATI_remap_index 342 +#define BindFragmentShaderATI_remap_index 343 +#define ColorFragmentOp1ATI_remap_index 344 +#define ColorFragmentOp2ATI_remap_index 345 +#define ColorFragmentOp3ATI_remap_index 346 +#define DeleteFragmentShaderATI_remap_index 347 +#define EndFragmentShaderATI_remap_index 348 +#define GenFragmentShadersATI_remap_index 349 +#define PassTexCoordATI_remap_index 350 +#define SampleMapATI_remap_index 351 +#define SetFragmentShaderConstantATI_remap_index 352 +#define PointParameteriNV_remap_index 353 +#define PointParameterivNV_remap_index 354 +#define ActiveStencilFaceEXT_remap_index 355 +#define BindVertexArrayAPPLE_remap_index 356 +#define DeleteVertexArraysAPPLE_remap_index 357 +#define GenVertexArraysAPPLE_remap_index 358 +#define IsVertexArrayAPPLE_remap_index 359 +#define GetProgramNamedParameterdvNV_remap_index 360 +#define GetProgramNamedParameterfvNV_remap_index 361 +#define ProgramNamedParameter4dNV_remap_index 362 +#define ProgramNamedParameter4dvNV_remap_index 363 +#define ProgramNamedParameter4fNV_remap_index 364 +#define ProgramNamedParameter4fvNV_remap_index 365 +#define DepthBoundsEXT_remap_index 366 +#define BlendEquationSeparateEXT_remap_index 367 +#define BindFramebufferEXT_remap_index 368 +#define BindRenderbufferEXT_remap_index 369 +#define CheckFramebufferStatusEXT_remap_index 370 +#define DeleteFramebuffersEXT_remap_index 371 +#define DeleteRenderbuffersEXT_remap_index 372 +#define FramebufferRenderbufferEXT_remap_index 373 +#define FramebufferTexture1DEXT_remap_index 374 +#define FramebufferTexture2DEXT_remap_index 375 +#define FramebufferTexture3DEXT_remap_index 376 +#define GenFramebuffersEXT_remap_index 377 +#define GenRenderbuffersEXT_remap_index 378 +#define GenerateMipmapEXT_remap_index 379 +#define GetFramebufferAttachmentParameterivEXT_remap_index 380 +#define GetRenderbufferParameterivEXT_remap_index 381 +#define IsFramebufferEXT_remap_index 382 +#define IsRenderbufferEXT_remap_index 383 +#define RenderbufferStorageEXT_remap_index 384 +#define BlitFramebufferEXT_remap_index 385 +#define BufferParameteriAPPLE_remap_index 386 +#define FlushMappedBufferRangeAPPLE_remap_index 387 +#define FramebufferTextureLayerEXT_remap_index 388 +#define ColorMaskIndexedEXT_remap_index 389 +#define DisableIndexedEXT_remap_index 390 +#define EnableIndexedEXT_remap_index 391 +#define GetBooleanIndexedvEXT_remap_index 392 +#define GetIntegerIndexedvEXT_remap_index 393 +#define IsEnabledIndexedEXT_remap_index 394 +#define BeginConditionalRenderNV_remap_index 395 +#define EndConditionalRenderNV_remap_index 396 +#define BeginTransformFeedbackEXT_remap_index 397 +#define BindBufferBaseEXT_remap_index 398 +#define BindBufferOffsetEXT_remap_index 399 +#define BindBufferRangeEXT_remap_index 400 +#define EndTransformFeedbackEXT_remap_index 401 +#define GetTransformFeedbackVaryingEXT_remap_index 402 +#define TransformFeedbackVaryingsEXT_remap_index 403 +#define ProvokingVertexEXT_remap_index 404 +#define GetTexParameterPointervAPPLE_remap_index 405 +#define TextureRangeAPPLE_remap_index 406 +#define GetObjectParameterivAPPLE_remap_index 407 +#define ObjectPurgeableAPPLE_remap_index 408 +#define ObjectUnpurgeableAPPLE_remap_index 409 +#define StencilFuncSeparateATI_remap_index 410 +#define ProgramEnvParameters4fvEXT_remap_index 411 +#define ProgramLocalParameters4fvEXT_remap_index 412 +#define GetQueryObjecti64vEXT_remap_index 413 +#define GetQueryObjectui64vEXT_remap_index 414 +#define EGLImageTargetRenderbufferStorageOES_remap_index 415 +#define EGLImageTargetTexture2DOES_remap_index 416 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3568,12 +3560,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_UnlockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[UnlockArraysEXT_remap_index], parameters) #define GET_UnlockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index]) #define SET_UnlockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index], fn) -#define CALL_CullParameterdvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLdouble *)), driDispatchRemapTable[CullParameterdvEXT_remap_index], parameters) -#define GET_CullParameterdvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index]) -#define SET_CullParameterdvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index], fn) -#define CALL_CullParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[CullParameterfvEXT_remap_index], parameters) -#define GET_CullParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index]) -#define SET_CullParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index], fn) #define CALL_SecondaryColor3bEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLbyte, GLbyte, GLbyte)), driDispatchRemapTable[SecondaryColor3bEXT_remap_index], parameters) #define GET_SecondaryColor3bEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index]) #define SET_SecondaryColor3bEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index], fn) diff --git a/src/mapi/glapi/glapioffsets.h b/src/mapi/glapi/glapioffsets.h index a790d87322e..48d83431957 100644 --- a/src/mapi/glapi/glapioffsets.h +++ b/src/mapi/glapi/glapioffsets.h @@ -642,226 +642,224 @@ #define _gloffset_PointParameterfvEXT 605 #define _gloffset_LockArraysEXT 606 #define _gloffset_UnlockArraysEXT 607 -#define _gloffset_CullParameterdvEXT 608 -#define _gloffset_CullParameterfvEXT 609 -#define _gloffset_SecondaryColor3bEXT 610 -#define _gloffset_SecondaryColor3bvEXT 611 -#define _gloffset_SecondaryColor3dEXT 612 -#define _gloffset_SecondaryColor3dvEXT 613 -#define _gloffset_SecondaryColor3fEXT 614 -#define _gloffset_SecondaryColor3fvEXT 615 -#define _gloffset_SecondaryColor3iEXT 616 -#define _gloffset_SecondaryColor3ivEXT 617 -#define _gloffset_SecondaryColor3sEXT 618 -#define _gloffset_SecondaryColor3svEXT 619 -#define _gloffset_SecondaryColor3ubEXT 620 -#define _gloffset_SecondaryColor3ubvEXT 621 -#define _gloffset_SecondaryColor3uiEXT 622 -#define _gloffset_SecondaryColor3uivEXT 623 -#define _gloffset_SecondaryColor3usEXT 624 -#define _gloffset_SecondaryColor3usvEXT 625 -#define _gloffset_SecondaryColorPointerEXT 626 -#define _gloffset_MultiDrawArraysEXT 627 -#define _gloffset_MultiDrawElementsEXT 628 -#define _gloffset_FogCoordPointerEXT 629 -#define _gloffset_FogCoorddEXT 630 -#define _gloffset_FogCoorddvEXT 631 -#define _gloffset_FogCoordfEXT 632 -#define _gloffset_FogCoordfvEXT 633 -#define _gloffset_PixelTexGenSGIX 634 -#define _gloffset_BlendFuncSeparateEXT 635 -#define _gloffset_FlushVertexArrayRangeNV 636 -#define _gloffset_VertexArrayRangeNV 637 -#define _gloffset_CombinerInputNV 638 -#define _gloffset_CombinerOutputNV 639 -#define _gloffset_CombinerParameterfNV 640 -#define _gloffset_CombinerParameterfvNV 641 -#define _gloffset_CombinerParameteriNV 642 -#define _gloffset_CombinerParameterivNV 643 -#define _gloffset_FinalCombinerInputNV 644 -#define _gloffset_GetCombinerInputParameterfvNV 645 -#define _gloffset_GetCombinerInputParameterivNV 646 -#define _gloffset_GetCombinerOutputParameterfvNV 647 -#define _gloffset_GetCombinerOutputParameterivNV 648 -#define _gloffset_GetFinalCombinerInputParameterfvNV 649 -#define _gloffset_GetFinalCombinerInputParameterivNV 650 -#define _gloffset_ResizeBuffersMESA 651 -#define _gloffset_WindowPos2dMESA 652 -#define _gloffset_WindowPos2dvMESA 653 -#define _gloffset_WindowPos2fMESA 654 -#define _gloffset_WindowPos2fvMESA 655 -#define _gloffset_WindowPos2iMESA 656 -#define _gloffset_WindowPos2ivMESA 657 -#define _gloffset_WindowPos2sMESA 658 -#define _gloffset_WindowPos2svMESA 659 -#define _gloffset_WindowPos3dMESA 660 -#define _gloffset_WindowPos3dvMESA 661 -#define _gloffset_WindowPos3fMESA 662 -#define _gloffset_WindowPos3fvMESA 663 -#define _gloffset_WindowPos3iMESA 664 -#define _gloffset_WindowPos3ivMESA 665 -#define _gloffset_WindowPos3sMESA 666 -#define _gloffset_WindowPos3svMESA 667 -#define _gloffset_WindowPos4dMESA 668 -#define _gloffset_WindowPos4dvMESA 669 -#define _gloffset_WindowPos4fMESA 670 -#define _gloffset_WindowPos4fvMESA 671 -#define _gloffset_WindowPos4iMESA 672 -#define _gloffset_WindowPos4ivMESA 673 -#define _gloffset_WindowPos4sMESA 674 -#define _gloffset_WindowPos4svMESA 675 -#define _gloffset_MultiModeDrawArraysIBM 676 -#define _gloffset_MultiModeDrawElementsIBM 677 -#define _gloffset_DeleteFencesNV 678 -#define _gloffset_FinishFenceNV 679 -#define _gloffset_GenFencesNV 680 -#define _gloffset_GetFenceivNV 681 -#define _gloffset_IsFenceNV 682 -#define _gloffset_SetFenceNV 683 -#define _gloffset_TestFenceNV 684 -#define _gloffset_AreProgramsResidentNV 685 -#define _gloffset_BindProgramNV 686 -#define _gloffset_DeleteProgramsNV 687 -#define _gloffset_ExecuteProgramNV 688 -#define _gloffset_GenProgramsNV 689 -#define _gloffset_GetProgramParameterdvNV 690 -#define _gloffset_GetProgramParameterfvNV 691 -#define _gloffset_GetProgramStringNV 692 -#define _gloffset_GetProgramivNV 693 -#define _gloffset_GetTrackMatrixivNV 694 -#define _gloffset_GetVertexAttribPointervNV 695 -#define _gloffset_GetVertexAttribdvNV 696 -#define _gloffset_GetVertexAttribfvNV 697 -#define _gloffset_GetVertexAttribivNV 698 -#define _gloffset_IsProgramNV 699 -#define _gloffset_LoadProgramNV 700 -#define _gloffset_ProgramParameters4dvNV 701 -#define _gloffset_ProgramParameters4fvNV 702 -#define _gloffset_RequestResidentProgramsNV 703 -#define _gloffset_TrackMatrixNV 704 -#define _gloffset_VertexAttrib1dNV 705 -#define _gloffset_VertexAttrib1dvNV 706 -#define _gloffset_VertexAttrib1fNV 707 -#define _gloffset_VertexAttrib1fvNV 708 -#define _gloffset_VertexAttrib1sNV 709 -#define _gloffset_VertexAttrib1svNV 710 -#define _gloffset_VertexAttrib2dNV 711 -#define _gloffset_VertexAttrib2dvNV 712 -#define _gloffset_VertexAttrib2fNV 713 -#define _gloffset_VertexAttrib2fvNV 714 -#define _gloffset_VertexAttrib2sNV 715 -#define _gloffset_VertexAttrib2svNV 716 -#define _gloffset_VertexAttrib3dNV 717 -#define _gloffset_VertexAttrib3dvNV 718 -#define _gloffset_VertexAttrib3fNV 719 -#define _gloffset_VertexAttrib3fvNV 720 -#define _gloffset_VertexAttrib3sNV 721 -#define _gloffset_VertexAttrib3svNV 722 -#define _gloffset_VertexAttrib4dNV 723 -#define _gloffset_VertexAttrib4dvNV 724 -#define _gloffset_VertexAttrib4fNV 725 -#define _gloffset_VertexAttrib4fvNV 726 -#define _gloffset_VertexAttrib4sNV 727 -#define _gloffset_VertexAttrib4svNV 728 -#define _gloffset_VertexAttrib4ubNV 729 -#define _gloffset_VertexAttrib4ubvNV 730 -#define _gloffset_VertexAttribPointerNV 731 -#define _gloffset_VertexAttribs1dvNV 732 -#define _gloffset_VertexAttribs1fvNV 733 -#define _gloffset_VertexAttribs1svNV 734 -#define _gloffset_VertexAttribs2dvNV 735 -#define _gloffset_VertexAttribs2fvNV 736 -#define _gloffset_VertexAttribs2svNV 737 -#define _gloffset_VertexAttribs3dvNV 738 -#define _gloffset_VertexAttribs3fvNV 739 -#define _gloffset_VertexAttribs3svNV 740 -#define _gloffset_VertexAttribs4dvNV 741 -#define _gloffset_VertexAttribs4fvNV 742 -#define _gloffset_VertexAttribs4svNV 743 -#define _gloffset_VertexAttribs4ubvNV 744 -#define _gloffset_GetTexBumpParameterfvATI 745 -#define _gloffset_GetTexBumpParameterivATI 746 -#define _gloffset_TexBumpParameterfvATI 747 -#define _gloffset_TexBumpParameterivATI 748 -#define _gloffset_AlphaFragmentOp1ATI 749 -#define _gloffset_AlphaFragmentOp2ATI 750 -#define _gloffset_AlphaFragmentOp3ATI 751 -#define _gloffset_BeginFragmentShaderATI 752 -#define _gloffset_BindFragmentShaderATI 753 -#define _gloffset_ColorFragmentOp1ATI 754 -#define _gloffset_ColorFragmentOp2ATI 755 -#define _gloffset_ColorFragmentOp3ATI 756 -#define _gloffset_DeleteFragmentShaderATI 757 -#define _gloffset_EndFragmentShaderATI 758 -#define _gloffset_GenFragmentShadersATI 759 -#define _gloffset_PassTexCoordATI 760 -#define _gloffset_SampleMapATI 761 -#define _gloffset_SetFragmentShaderConstantATI 762 -#define _gloffset_PointParameteriNV 763 -#define _gloffset_PointParameterivNV 764 -#define _gloffset_ActiveStencilFaceEXT 765 -#define _gloffset_BindVertexArrayAPPLE 766 -#define _gloffset_DeleteVertexArraysAPPLE 767 -#define _gloffset_GenVertexArraysAPPLE 768 -#define _gloffset_IsVertexArrayAPPLE 769 -#define _gloffset_GetProgramNamedParameterdvNV 770 -#define _gloffset_GetProgramNamedParameterfvNV 771 -#define _gloffset_ProgramNamedParameter4dNV 772 -#define _gloffset_ProgramNamedParameter4dvNV 773 -#define _gloffset_ProgramNamedParameter4fNV 774 -#define _gloffset_ProgramNamedParameter4fvNV 775 -#define _gloffset_DepthBoundsEXT 776 -#define _gloffset_BlendEquationSeparateEXT 777 -#define _gloffset_BindFramebufferEXT 778 -#define _gloffset_BindRenderbufferEXT 779 -#define _gloffset_CheckFramebufferStatusEXT 780 -#define _gloffset_DeleteFramebuffersEXT 781 -#define _gloffset_DeleteRenderbuffersEXT 782 -#define _gloffset_FramebufferRenderbufferEXT 783 -#define _gloffset_FramebufferTexture1DEXT 784 -#define _gloffset_FramebufferTexture2DEXT 785 -#define _gloffset_FramebufferTexture3DEXT 786 -#define _gloffset_GenFramebuffersEXT 787 -#define _gloffset_GenRenderbuffersEXT 788 -#define _gloffset_GenerateMipmapEXT 789 -#define _gloffset_GetFramebufferAttachmentParameterivEXT 790 -#define _gloffset_GetRenderbufferParameterivEXT 791 -#define _gloffset_IsFramebufferEXT 792 -#define _gloffset_IsRenderbufferEXT 793 -#define _gloffset_RenderbufferStorageEXT 794 -#define _gloffset_BlitFramebufferEXT 795 -#define _gloffset_BufferParameteriAPPLE 796 -#define _gloffset_FlushMappedBufferRangeAPPLE 797 -#define _gloffset_FramebufferTextureLayerEXT 798 -#define _gloffset_ColorMaskIndexedEXT 799 -#define _gloffset_DisableIndexedEXT 800 -#define _gloffset_EnableIndexedEXT 801 -#define _gloffset_GetBooleanIndexedvEXT 802 -#define _gloffset_GetIntegerIndexedvEXT 803 -#define _gloffset_IsEnabledIndexedEXT 804 -#define _gloffset_BeginConditionalRenderNV 805 -#define _gloffset_EndConditionalRenderNV 806 -#define _gloffset_BeginTransformFeedbackEXT 807 -#define _gloffset_BindBufferBaseEXT 808 -#define _gloffset_BindBufferOffsetEXT 809 -#define _gloffset_BindBufferRangeEXT 810 -#define _gloffset_EndTransformFeedbackEXT 811 -#define _gloffset_GetTransformFeedbackVaryingEXT 812 -#define _gloffset_TransformFeedbackVaryingsEXT 813 -#define _gloffset_ProvokingVertexEXT 814 -#define _gloffset_GetTexParameterPointervAPPLE 815 -#define _gloffset_TextureRangeAPPLE 816 -#define _gloffset_GetObjectParameterivAPPLE 817 -#define _gloffset_ObjectPurgeableAPPLE 818 -#define _gloffset_ObjectUnpurgeableAPPLE 819 -#define _gloffset_StencilFuncSeparateATI 820 -#define _gloffset_ProgramEnvParameters4fvEXT 821 -#define _gloffset_ProgramLocalParameters4fvEXT 822 -#define _gloffset_GetQueryObjecti64vEXT 823 -#define _gloffset_GetQueryObjectui64vEXT 824 -#define _gloffset_EGLImageTargetRenderbufferStorageOES 825 -#define _gloffset_EGLImageTargetTexture2DOES 826 -#define _gloffset_FIRST_DYNAMIC 827 +#define _gloffset_SecondaryColor3bEXT 608 +#define _gloffset_SecondaryColor3bvEXT 609 +#define _gloffset_SecondaryColor3dEXT 610 +#define _gloffset_SecondaryColor3dvEXT 611 +#define _gloffset_SecondaryColor3fEXT 612 +#define _gloffset_SecondaryColor3fvEXT 613 +#define _gloffset_SecondaryColor3iEXT 614 +#define _gloffset_SecondaryColor3ivEXT 615 +#define _gloffset_SecondaryColor3sEXT 616 +#define _gloffset_SecondaryColor3svEXT 617 +#define _gloffset_SecondaryColor3ubEXT 618 +#define _gloffset_SecondaryColor3ubvEXT 619 +#define _gloffset_SecondaryColor3uiEXT 620 +#define _gloffset_SecondaryColor3uivEXT 621 +#define _gloffset_SecondaryColor3usEXT 622 +#define _gloffset_SecondaryColor3usvEXT 623 +#define _gloffset_SecondaryColorPointerEXT 624 +#define _gloffset_MultiDrawArraysEXT 625 +#define _gloffset_MultiDrawElementsEXT 626 +#define _gloffset_FogCoordPointerEXT 627 +#define _gloffset_FogCoorddEXT 628 +#define _gloffset_FogCoorddvEXT 629 +#define _gloffset_FogCoordfEXT 630 +#define _gloffset_FogCoordfvEXT 631 +#define _gloffset_PixelTexGenSGIX 632 +#define _gloffset_BlendFuncSeparateEXT 633 +#define _gloffset_FlushVertexArrayRangeNV 634 +#define _gloffset_VertexArrayRangeNV 635 +#define _gloffset_CombinerInputNV 636 +#define _gloffset_CombinerOutputNV 637 +#define _gloffset_CombinerParameterfNV 638 +#define _gloffset_CombinerParameterfvNV 639 +#define _gloffset_CombinerParameteriNV 640 +#define _gloffset_CombinerParameterivNV 641 +#define _gloffset_FinalCombinerInputNV 642 +#define _gloffset_GetCombinerInputParameterfvNV 643 +#define _gloffset_GetCombinerInputParameterivNV 644 +#define _gloffset_GetCombinerOutputParameterfvNV 645 +#define _gloffset_GetCombinerOutputParameterivNV 646 +#define _gloffset_GetFinalCombinerInputParameterfvNV 647 +#define _gloffset_GetFinalCombinerInputParameterivNV 648 +#define _gloffset_ResizeBuffersMESA 649 +#define _gloffset_WindowPos2dMESA 650 +#define _gloffset_WindowPos2dvMESA 651 +#define _gloffset_WindowPos2fMESA 652 +#define _gloffset_WindowPos2fvMESA 653 +#define _gloffset_WindowPos2iMESA 654 +#define _gloffset_WindowPos2ivMESA 655 +#define _gloffset_WindowPos2sMESA 656 +#define _gloffset_WindowPos2svMESA 657 +#define _gloffset_WindowPos3dMESA 658 +#define _gloffset_WindowPos3dvMESA 659 +#define _gloffset_WindowPos3fMESA 660 +#define _gloffset_WindowPos3fvMESA 661 +#define _gloffset_WindowPos3iMESA 662 +#define _gloffset_WindowPos3ivMESA 663 +#define _gloffset_WindowPos3sMESA 664 +#define _gloffset_WindowPos3svMESA 665 +#define _gloffset_WindowPos4dMESA 666 +#define _gloffset_WindowPos4dvMESA 667 +#define _gloffset_WindowPos4fMESA 668 +#define _gloffset_WindowPos4fvMESA 669 +#define _gloffset_WindowPos4iMESA 670 +#define _gloffset_WindowPos4ivMESA 671 +#define _gloffset_WindowPos4sMESA 672 +#define _gloffset_WindowPos4svMESA 673 +#define _gloffset_MultiModeDrawArraysIBM 674 +#define _gloffset_MultiModeDrawElementsIBM 675 +#define _gloffset_DeleteFencesNV 676 +#define _gloffset_FinishFenceNV 677 +#define _gloffset_GenFencesNV 678 +#define _gloffset_GetFenceivNV 679 +#define _gloffset_IsFenceNV 680 +#define _gloffset_SetFenceNV 681 +#define _gloffset_TestFenceNV 682 +#define _gloffset_AreProgramsResidentNV 683 +#define _gloffset_BindProgramNV 684 +#define _gloffset_DeleteProgramsNV 685 +#define _gloffset_ExecuteProgramNV 686 +#define _gloffset_GenProgramsNV 687 +#define _gloffset_GetProgramParameterdvNV 688 +#define _gloffset_GetProgramParameterfvNV 689 +#define _gloffset_GetProgramStringNV 690 +#define _gloffset_GetProgramivNV 691 +#define _gloffset_GetTrackMatrixivNV 692 +#define _gloffset_GetVertexAttribPointervNV 693 +#define _gloffset_GetVertexAttribdvNV 694 +#define _gloffset_GetVertexAttribfvNV 695 +#define _gloffset_GetVertexAttribivNV 696 +#define _gloffset_IsProgramNV 697 +#define _gloffset_LoadProgramNV 698 +#define _gloffset_ProgramParameters4dvNV 699 +#define _gloffset_ProgramParameters4fvNV 700 +#define _gloffset_RequestResidentProgramsNV 701 +#define _gloffset_TrackMatrixNV 702 +#define _gloffset_VertexAttrib1dNV 703 +#define _gloffset_VertexAttrib1dvNV 704 +#define _gloffset_VertexAttrib1fNV 705 +#define _gloffset_VertexAttrib1fvNV 706 +#define _gloffset_VertexAttrib1sNV 707 +#define _gloffset_VertexAttrib1svNV 708 +#define _gloffset_VertexAttrib2dNV 709 +#define _gloffset_VertexAttrib2dvNV 710 +#define _gloffset_VertexAttrib2fNV 711 +#define _gloffset_VertexAttrib2fvNV 712 +#define _gloffset_VertexAttrib2sNV 713 +#define _gloffset_VertexAttrib2svNV 714 +#define _gloffset_VertexAttrib3dNV 715 +#define _gloffset_VertexAttrib3dvNV 716 +#define _gloffset_VertexAttrib3fNV 717 +#define _gloffset_VertexAttrib3fvNV 718 +#define _gloffset_VertexAttrib3sNV 719 +#define _gloffset_VertexAttrib3svNV 720 +#define _gloffset_VertexAttrib4dNV 721 +#define _gloffset_VertexAttrib4dvNV 722 +#define _gloffset_VertexAttrib4fNV 723 +#define _gloffset_VertexAttrib4fvNV 724 +#define _gloffset_VertexAttrib4sNV 725 +#define _gloffset_VertexAttrib4svNV 726 +#define _gloffset_VertexAttrib4ubNV 727 +#define _gloffset_VertexAttrib4ubvNV 728 +#define _gloffset_VertexAttribPointerNV 729 +#define _gloffset_VertexAttribs1dvNV 730 +#define _gloffset_VertexAttribs1fvNV 731 +#define _gloffset_VertexAttribs1svNV 732 +#define _gloffset_VertexAttribs2dvNV 733 +#define _gloffset_VertexAttribs2fvNV 734 +#define _gloffset_VertexAttribs2svNV 735 +#define _gloffset_VertexAttribs3dvNV 736 +#define _gloffset_VertexAttribs3fvNV 737 +#define _gloffset_VertexAttribs3svNV 738 +#define _gloffset_VertexAttribs4dvNV 739 +#define _gloffset_VertexAttribs4fvNV 740 +#define _gloffset_VertexAttribs4svNV 741 +#define _gloffset_VertexAttribs4ubvNV 742 +#define _gloffset_GetTexBumpParameterfvATI 743 +#define _gloffset_GetTexBumpParameterivATI 744 +#define _gloffset_TexBumpParameterfvATI 745 +#define _gloffset_TexBumpParameterivATI 746 +#define _gloffset_AlphaFragmentOp1ATI 747 +#define _gloffset_AlphaFragmentOp2ATI 748 +#define _gloffset_AlphaFragmentOp3ATI 749 +#define _gloffset_BeginFragmentShaderATI 750 +#define _gloffset_BindFragmentShaderATI 751 +#define _gloffset_ColorFragmentOp1ATI 752 +#define _gloffset_ColorFragmentOp2ATI 753 +#define _gloffset_ColorFragmentOp3ATI 754 +#define _gloffset_DeleteFragmentShaderATI 755 +#define _gloffset_EndFragmentShaderATI 756 +#define _gloffset_GenFragmentShadersATI 757 +#define _gloffset_PassTexCoordATI 758 +#define _gloffset_SampleMapATI 759 +#define _gloffset_SetFragmentShaderConstantATI 760 +#define _gloffset_PointParameteriNV 761 +#define _gloffset_PointParameterivNV 762 +#define _gloffset_ActiveStencilFaceEXT 763 +#define _gloffset_BindVertexArrayAPPLE 764 +#define _gloffset_DeleteVertexArraysAPPLE 765 +#define _gloffset_GenVertexArraysAPPLE 766 +#define _gloffset_IsVertexArrayAPPLE 767 +#define _gloffset_GetProgramNamedParameterdvNV 768 +#define _gloffset_GetProgramNamedParameterfvNV 769 +#define _gloffset_ProgramNamedParameter4dNV 770 +#define _gloffset_ProgramNamedParameter4dvNV 771 +#define _gloffset_ProgramNamedParameter4fNV 772 +#define _gloffset_ProgramNamedParameter4fvNV 773 +#define _gloffset_DepthBoundsEXT 774 +#define _gloffset_BlendEquationSeparateEXT 775 +#define _gloffset_BindFramebufferEXT 776 +#define _gloffset_BindRenderbufferEXT 777 +#define _gloffset_CheckFramebufferStatusEXT 778 +#define _gloffset_DeleteFramebuffersEXT 779 +#define _gloffset_DeleteRenderbuffersEXT 780 +#define _gloffset_FramebufferRenderbufferEXT 781 +#define _gloffset_FramebufferTexture1DEXT 782 +#define _gloffset_FramebufferTexture2DEXT 783 +#define _gloffset_FramebufferTexture3DEXT 784 +#define _gloffset_GenFramebuffersEXT 785 +#define _gloffset_GenRenderbuffersEXT 786 +#define _gloffset_GenerateMipmapEXT 787 +#define _gloffset_GetFramebufferAttachmentParameterivEXT 788 +#define _gloffset_GetRenderbufferParameterivEXT 789 +#define _gloffset_IsFramebufferEXT 790 +#define _gloffset_IsRenderbufferEXT 791 +#define _gloffset_RenderbufferStorageEXT 792 +#define _gloffset_BlitFramebufferEXT 793 +#define _gloffset_BufferParameteriAPPLE 794 +#define _gloffset_FlushMappedBufferRangeAPPLE 795 +#define _gloffset_FramebufferTextureLayerEXT 796 +#define _gloffset_ColorMaskIndexedEXT 797 +#define _gloffset_DisableIndexedEXT 798 +#define _gloffset_EnableIndexedEXT 799 +#define _gloffset_GetBooleanIndexedvEXT 800 +#define _gloffset_GetIntegerIndexedvEXT 801 +#define _gloffset_IsEnabledIndexedEXT 802 +#define _gloffset_BeginConditionalRenderNV 803 +#define _gloffset_EndConditionalRenderNV 804 +#define _gloffset_BeginTransformFeedbackEXT 805 +#define _gloffset_BindBufferBaseEXT 806 +#define _gloffset_BindBufferOffsetEXT 807 +#define _gloffset_BindBufferRangeEXT 808 +#define _gloffset_EndTransformFeedbackEXT 809 +#define _gloffset_GetTransformFeedbackVaryingEXT 810 +#define _gloffset_TransformFeedbackVaryingsEXT 811 +#define _gloffset_ProvokingVertexEXT 812 +#define _gloffset_GetTexParameterPointervAPPLE 813 +#define _gloffset_TextureRangeAPPLE 814 +#define _gloffset_GetObjectParameterivAPPLE 815 +#define _gloffset_ObjectPurgeableAPPLE 816 +#define _gloffset_ObjectUnpurgeableAPPLE 817 +#define _gloffset_StencilFuncSeparateATI 818 +#define _gloffset_ProgramEnvParameters4fvEXT 819 +#define _gloffset_ProgramLocalParameters4fvEXT 820 +#define _gloffset_GetQueryObjecti64vEXT 821 +#define _gloffset_GetQueryObjectui64vEXT 822 +#define _gloffset_EGLImageTargetRenderbufferStorageOES 823 +#define _gloffset_EGLImageTargetTexture2DOES 824 +#define _gloffset_FIRST_DYNAMIC 825 #else @@ -1065,8 +1063,6 @@ #define _gloffset_PointParameterfvEXT driDispatchRemapTable[PointParameterfvEXT_remap_index] #define _gloffset_LockArraysEXT driDispatchRemapTable[LockArraysEXT_remap_index] #define _gloffset_UnlockArraysEXT driDispatchRemapTable[UnlockArraysEXT_remap_index] -#define _gloffset_CullParameterdvEXT driDispatchRemapTable[CullParameterdvEXT_remap_index] -#define _gloffset_CullParameterfvEXT driDispatchRemapTable[CullParameterfvEXT_remap_index] #define _gloffset_SecondaryColor3bEXT driDispatchRemapTable[SecondaryColor3bEXT_remap_index] #define _gloffset_SecondaryColor3bvEXT driDispatchRemapTable[SecondaryColor3bvEXT_remap_index] #define _gloffset_SecondaryColor3dEXT driDispatchRemapTable[SecondaryColor3dEXT_remap_index] diff --git a/src/mapi/glapi/glapitable.h b/src/mapi/glapi/glapitable.h index 7c8da64ab13..3b987d17422 100644 --- a/src/mapi/glapi/glapitable.h +++ b/src/mapi/glapi/glapitable.h @@ -648,225 +648,223 @@ struct _glapi_table void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 605 */ void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 606 */ void (GLAPIENTRYP UnlockArraysEXT)(void); /* 607 */ - void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 608 */ - void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 609 */ - void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 610 */ - void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 611 */ - void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 612 */ - void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 613 */ - void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 614 */ - void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 615 */ - void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 616 */ - void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 617 */ - void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 618 */ - void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 619 */ - void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 620 */ - void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 621 */ - void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 622 */ - void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 623 */ - void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 624 */ - void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 625 */ - void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 626 */ - void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 627 */ - void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 628 */ - void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 629 */ - void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 630 */ - void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 631 */ - void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 632 */ - void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 633 */ - void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 634 */ - void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 635 */ - void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 636 */ - void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 637 */ - void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 638 */ - void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 639 */ - void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 640 */ - void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 641 */ - void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 642 */ - void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 643 */ - void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 644 */ - void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 645 */ - void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 646 */ - void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 647 */ - void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 648 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 649 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 650 */ - void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 651 */ - void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 652 */ - void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 653 */ - void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 654 */ - void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 655 */ - void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 656 */ - void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 657 */ - void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 658 */ - void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 659 */ - void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 660 */ - void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 661 */ - void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 662 */ - void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 663 */ - void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 664 */ - void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 665 */ - void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 666 */ - void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 667 */ - void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */ - void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 669 */ - void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */ - void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 671 */ - void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 672 */ - void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 673 */ - void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 674 */ - void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 675 */ - void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 676 */ - void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 677 */ - void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 678 */ - void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 679 */ - void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 680 */ - void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 681 */ - GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 682 */ - void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 683 */ - GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 684 */ - GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 685 */ - void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 686 */ - void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 687 */ - void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 688 */ - void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 689 */ - void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 690 */ - void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 691 */ - void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 692 */ - void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 693 */ - void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 694 */ - void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 695 */ - void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 696 */ - void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 697 */ - void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 698 */ - GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 699 */ - void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 700 */ - void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 701 */ - void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 702 */ - void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 703 */ - void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 704 */ - void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 705 */ - void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 706 */ - void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 707 */ - void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 708 */ - void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 709 */ - void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 710 */ - void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 711 */ - void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 712 */ - void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 713 */ - void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 714 */ - void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 715 */ - void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 716 */ - void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 717 */ - void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 718 */ - void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 719 */ - void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 720 */ - void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 721 */ - void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 722 */ - void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 723 */ - void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 724 */ - void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 725 */ - void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 726 */ - void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 727 */ - void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 728 */ - void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 729 */ - void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 730 */ - void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 731 */ - void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 732 */ - void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 733 */ - void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 734 */ - void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 735 */ - void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 736 */ - void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 737 */ - void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 738 */ - void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 739 */ - void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 740 */ - void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 741 */ - void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 742 */ - void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 743 */ - void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 744 */ - void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 745 */ - void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 746 */ - void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 747 */ - void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 748 */ - void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 749 */ - void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 750 */ - void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 751 */ - void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 752 */ - void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 753 */ - void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 754 */ - void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 755 */ - void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 756 */ - void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 757 */ - void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 758 */ - GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 759 */ - void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 760 */ - void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 761 */ - void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 762 */ - void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 763 */ - void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 764 */ - void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 765 */ - void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 766 */ - void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 767 */ - void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 768 */ - GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 769 */ - void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 770 */ - void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 771 */ - void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 772 */ - void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 773 */ - void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 774 */ - void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 775 */ - void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 776 */ - void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 777 */ - void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 778 */ - void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 779 */ - GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 780 */ - void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 781 */ - void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 782 */ - void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 783 */ - void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 784 */ - void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 785 */ - void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 786 */ - void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 787 */ - void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 788 */ - void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 789 */ - void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 790 */ - void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 791 */ - GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 792 */ - GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 793 */ - void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 794 */ - void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 795 */ - void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 796 */ - void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 797 */ - void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 798 */ - void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 799 */ - void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 800 */ - void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 801 */ - void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 802 */ - void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 803 */ - GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 804 */ - void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 805 */ - void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 806 */ - void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 807 */ - void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 808 */ - void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 809 */ - void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 810 */ - void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 811 */ - void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 812 */ - void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 813 */ - void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 814 */ - void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 815 */ - void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 816 */ - void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 817 */ - GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 818 */ - GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 819 */ - void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 820 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 821 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 822 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 823 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 824 */ - void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 825 */ - void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 826 */ + void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 608 */ + void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 609 */ + void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 610 */ + void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 611 */ + void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 612 */ + void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 613 */ + void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 614 */ + void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 615 */ + void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 616 */ + void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 617 */ + void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 618 */ + void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 619 */ + void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 620 */ + void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 621 */ + void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 622 */ + void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 623 */ + void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 624 */ + void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 625 */ + void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 626 */ + void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 627 */ + void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 628 */ + void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 629 */ + void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 630 */ + void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 631 */ + void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 632 */ + void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 633 */ + void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 634 */ + void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 635 */ + void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 636 */ + void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 637 */ + void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 638 */ + void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 639 */ + void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 640 */ + void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 641 */ + void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 642 */ + void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 643 */ + void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 644 */ + void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 645 */ + void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 646 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 647 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 648 */ + void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 649 */ + void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 650 */ + void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 651 */ + void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 652 */ + void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 653 */ + void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 654 */ + void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 655 */ + void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 656 */ + void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 657 */ + void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 658 */ + void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 659 */ + void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 660 */ + void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 661 */ + void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 662 */ + void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 663 */ + void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 664 */ + void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 665 */ + void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 666 */ + void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 667 */ + void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 668 */ + void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 669 */ + void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 670 */ + void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 671 */ + void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 672 */ + void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 673 */ + void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 674 */ + void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 675 */ + void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 676 */ + void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 677 */ + void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 678 */ + void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 679 */ + GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 680 */ + void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 681 */ + GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 682 */ + GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 683 */ + void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 684 */ + void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 685 */ + void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 686 */ + void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 687 */ + void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 688 */ + void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 689 */ + void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 690 */ + void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 691 */ + void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 692 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 693 */ + void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 694 */ + void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 695 */ + void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 696 */ + GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 697 */ + void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 698 */ + void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 699 */ + void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 700 */ + void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 701 */ + void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 702 */ + void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 703 */ + void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 704 */ + void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 705 */ + void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 706 */ + void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 707 */ + void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 708 */ + void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 709 */ + void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 710 */ + void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 711 */ + void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 712 */ + void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 713 */ + void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 714 */ + void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 715 */ + void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 716 */ + void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 717 */ + void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 718 */ + void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 719 */ + void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 720 */ + void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 721 */ + void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 722 */ + void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 723 */ + void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 724 */ + void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 725 */ + void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 726 */ + void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 727 */ + void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 728 */ + void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 729 */ + void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 730 */ + void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 731 */ + void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 732 */ + void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 733 */ + void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 734 */ + void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 735 */ + void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 736 */ + void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 737 */ + void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 738 */ + void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 739 */ + void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 740 */ + void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 741 */ + void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 742 */ + void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 743 */ + void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 744 */ + void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 745 */ + void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 746 */ + void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 747 */ + void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 748 */ + void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 749 */ + void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 750 */ + void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 751 */ + void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 752 */ + void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 753 */ + void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 754 */ + void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 755 */ + void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 756 */ + GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 757 */ + void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 758 */ + void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 759 */ + void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 760 */ + void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 761 */ + void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 762 */ + void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 763 */ + void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 764 */ + void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 765 */ + void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 766 */ + GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 767 */ + void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 768 */ + void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 769 */ + void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 770 */ + void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 771 */ + void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 772 */ + void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 773 */ + void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 774 */ + void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 775 */ + void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 776 */ + void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 777 */ + GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 778 */ + void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 779 */ + void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 780 */ + void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 781 */ + void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 782 */ + void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 783 */ + void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 784 */ + void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 785 */ + void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 786 */ + void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 787 */ + void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 788 */ + void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 789 */ + GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 790 */ + GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 791 */ + void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 792 */ + void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 793 */ + void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 794 */ + void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 795 */ + void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 796 */ + void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 797 */ + void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 798 */ + void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 799 */ + void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 800 */ + void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 801 */ + GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 802 */ + void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 803 */ + void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 804 */ + void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 805 */ + void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 806 */ + void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 807 */ + void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 808 */ + void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 809 */ + void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 810 */ + void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 811 */ + void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 812 */ + void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 813 */ + void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 814 */ + void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 815 */ + GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 816 */ + GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 817 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 818 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 819 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 820 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 821 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 822 */ + void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 823 */ + void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 824 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mapi/glapi/glapitemp.h b/src/mapi/glapi/glapitemp.h index 2050e213d86..ac81a7dd7ff 100644 --- a/src/mapi/glapi/glapitemp.h +++ b/src/mapi/glapi/glapitemp.h @@ -4152,20 +4152,6 @@ KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pname, GLdouble * params); - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pname, GLdouble * params) -{ - DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params)); -} - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum pname, GLfloat * params); - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum pname, GLfloat * params) -{ - DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); -} - KEYWORD1 void KEYWORD2 NAME(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue) { DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3b(%d, %d, %d);\n", red, green, blue)); @@ -4406,9 +4392,9 @@ KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_634)(GLenum mode); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_632)(GLenum mode); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_634)(GLenum mode) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_632)(GLenum mode) { DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); } @@ -4423,9 +4409,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfac DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_635)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_633)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_635)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_633)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } @@ -4790,65 +4776,65 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_676)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_674)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_676)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_674)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_677)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_675)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_677)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_675)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_678)(GLsizei n, const GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_676)(GLsizei n, const GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_678)(GLsizei n, const GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_676)(GLsizei n, const GLuint * fences) { DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_679)(GLuint fence); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_677)(GLuint fence); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_679)(GLuint fence) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_677)(GLuint fence) { DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_680)(GLsizei n, GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_678)(GLsizei n, GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_680)(GLsizei n, GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_678)(GLsizei n, GLuint * fences) { DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_681)(GLuint fence, GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_679)(GLuint fence, GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_681)(GLuint fence, GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_679)(GLuint fence, GLenum pname, GLint * params) { DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_682)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_680)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_682)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_680)(GLuint fence) { RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_683)(GLuint fence, GLenum condition); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_681)(GLuint fence, GLenum condition); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_683)(GLuint fence, GLenum condition) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_681)(GLuint fence, GLenum condition) { DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_684)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_682)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_684)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_682)(GLuint fence) { RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); } @@ -5293,16 +5279,16 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * para DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLenum face); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_763)(GLenum face); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLenum face) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_763)(GLenum face) { DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLuint array); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_764)(GLuint array); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLuint array) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_764)(GLuint array) { DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array)); } @@ -5312,16 +5298,16 @@ KEYWORD1 void KEYWORD2 NAME(DeleteVertexArrays)(GLsizei n, const GLuint * arrays DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArrays(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_767)(GLsizei n, const GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLsizei n, const GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_767)(GLsizei n, const GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLsizei n, const GLuint * arrays) { DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLsizei n, GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLsizei n, GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLsizei n, GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLsizei n, GLuint * arrays) { DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } @@ -5331,9 +5317,9 @@ KEYWORD1 GLboolean KEYWORD2 NAME(IsVertexArray)(GLuint array) RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArray(%d);\n", array)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_769)(GLuint array); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_767)(GLuint array); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_769)(GLuint array) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_767)(GLuint array) { RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array)); } @@ -5368,9 +5354,9 @@ KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLclampd zmin, GLclampd zmax); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLclampd zmin, GLclampd zmax); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLclampd zmin, GLclampd zmax) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLclampd zmin, GLclampd zmax) { DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax)); } @@ -5380,9 +5366,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA) DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparate(0x%x, 0x%x);\n", modeRGB, modeA)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLenum modeRGB, GLenum modeA); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLenum modeRGB, GLenum modeA); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLenum modeRGB, GLenum modeA) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLenum modeRGB, GLenum modeA) { DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA)); } @@ -5562,23 +5548,23 @@ KEYWORD1 void KEYWORD2 NAME(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint src DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_795)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_793)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_795)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_793)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLint param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_794)(GLenum target, GLenum pname, GLint param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLint param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_794)(GLenum target, GLenum pname, GLint param) { DISPATCH(BufferParameteriAPPLE, (target, pname, param), (F, "glBufferParameteriAPPLE(0x%x, 0x%x, %d);\n", target, pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLintptr offset, GLsizeiptr size); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_795)(GLenum target, GLintptr offset, GLsizeiptr size); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLintptr offset, GLsizeiptr size) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_795)(GLenum target, GLintptr offset, GLsizeiptr size) { DISPATCH(FlushMappedBufferRangeAPPLE, (target, offset, size), (F, "glFlushMappedBufferRangeAPPLE(0x%x, %d, %d);\n", target, offset, size)); } @@ -5708,16 +5694,16 @@ KEYWORD1 void KEYWORD2 NAME(ProvokingVertex)(GLenum mode) DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertex(0x%x);\n", mode)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_815)(GLenum target, GLenum pname, GLvoid ** params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_813)(GLenum target, GLenum pname, GLvoid ** params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_815)(GLenum target, GLenum pname, GLvoid ** params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_813)(GLenum target, GLenum pname, GLvoid ** params) { DISPATCH(GetTexParameterPointervAPPLE, (target, pname, params), (F, "glGetTexParameterPointervAPPLE(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_816)(GLenum target, GLsizei length, GLvoid * pointer); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_814)(GLenum target, GLsizei length, GLvoid * pointer); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_816)(GLenum target, GLsizei length, GLvoid * pointer) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_814)(GLenum target, GLsizei length, GLvoid * pointer) { DISPATCH(TextureRangeAPPLE, (target, length, pointer), (F, "glTextureRangeAPPLE(0x%x, %d, %p);\n", target, length, (const void *) pointer)); } @@ -5737,37 +5723,37 @@ KEYWORD1 GLenum KEYWORD2 NAME(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint RETURN_DISPATCH(ObjectUnpurgeableAPPLE, (objectType, name, option), (F, "glObjectUnpurgeableAPPLE(0x%x, %d, 0x%x);\n", objectType, name, option)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_818)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_818)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) { DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_819)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_819)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_823)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_823)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_824)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_824)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6543,8 +6529,6 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(PointParameterfvEXT), TABLE_ENTRY(LockArraysEXT), TABLE_ENTRY(UnlockArraysEXT), - TABLE_ENTRY(_dispatch_stub_608), - TABLE_ENTRY(_dispatch_stub_609), TABLE_ENTRY(SecondaryColor3bEXT), TABLE_ENTRY(SecondaryColor3bvEXT), TABLE_ENTRY(SecondaryColor3dEXT), @@ -6569,7 +6553,7 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(FogCoorddvEXT), TABLE_ENTRY(FogCoordfEXT), TABLE_ENTRY(FogCoordfvEXT), - TABLE_ENTRY(_dispatch_stub_634), + TABLE_ENTRY(_dispatch_stub_632), TABLE_ENTRY(BlendFuncSeparateEXT), TABLE_ENTRY(FlushVertexArrayRangeNV), TABLE_ENTRY(VertexArrayRangeNV), @@ -6611,6 +6595,8 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(WindowPos4ivMESA), TABLE_ENTRY(WindowPos4sMESA), TABLE_ENTRY(WindowPos4svMESA), + TABLE_ENTRY(_dispatch_stub_674), + TABLE_ENTRY(_dispatch_stub_675), TABLE_ENTRY(_dispatch_stub_676), TABLE_ENTRY(_dispatch_stub_677), TABLE_ENTRY(_dispatch_stub_678), @@ -6618,8 +6604,6 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_680), TABLE_ENTRY(_dispatch_stub_681), TABLE_ENTRY(_dispatch_stub_682), - TABLE_ENTRY(_dispatch_stub_683), - TABLE_ENTRY(_dispatch_stub_684), TABLE_ENTRY(AreProgramsResidentNV), TABLE_ENTRY(BindProgramNV), TABLE_ENTRY(DeleteProgramsNV), @@ -6700,19 +6684,19 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(SetFragmentShaderConstantATI), TABLE_ENTRY(PointParameteriNV), TABLE_ENTRY(PointParameterivNV), + TABLE_ENTRY(_dispatch_stub_763), + TABLE_ENTRY(_dispatch_stub_764), TABLE_ENTRY(_dispatch_stub_765), TABLE_ENTRY(_dispatch_stub_766), TABLE_ENTRY(_dispatch_stub_767), - TABLE_ENTRY(_dispatch_stub_768), - TABLE_ENTRY(_dispatch_stub_769), TABLE_ENTRY(GetProgramNamedParameterdvNV), TABLE_ENTRY(GetProgramNamedParameterfvNV), TABLE_ENTRY(ProgramNamedParameter4dNV), TABLE_ENTRY(ProgramNamedParameter4dvNV), TABLE_ENTRY(ProgramNamedParameter4fNV), TABLE_ENTRY(ProgramNamedParameter4fvNV), - TABLE_ENTRY(_dispatch_stub_776), - TABLE_ENTRY(_dispatch_stub_777), + TABLE_ENTRY(_dispatch_stub_774), + TABLE_ENTRY(_dispatch_stub_775), TABLE_ENTRY(BindFramebufferEXT), TABLE_ENTRY(BindRenderbufferEXT), TABLE_ENTRY(CheckFramebufferStatusEXT), @@ -6730,9 +6714,9 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(IsFramebufferEXT), TABLE_ENTRY(IsRenderbufferEXT), TABLE_ENTRY(RenderbufferStorageEXT), + TABLE_ENTRY(_dispatch_stub_793), + TABLE_ENTRY(_dispatch_stub_794), TABLE_ENTRY(_dispatch_stub_795), - TABLE_ENTRY(_dispatch_stub_796), - TABLE_ENTRY(_dispatch_stub_797), TABLE_ENTRY(FramebufferTextureLayerEXT), TABLE_ENTRY(ColorMaskIndexedEXT), TABLE_ENTRY(DisableIndexedEXT), @@ -6750,16 +6734,16 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(GetTransformFeedbackVaryingEXT), TABLE_ENTRY(TransformFeedbackVaryingsEXT), TABLE_ENTRY(ProvokingVertexEXT), - TABLE_ENTRY(_dispatch_stub_815), - TABLE_ENTRY(_dispatch_stub_816), + TABLE_ENTRY(_dispatch_stub_813), + TABLE_ENTRY(_dispatch_stub_814), TABLE_ENTRY(GetObjectParameterivAPPLE), TABLE_ENTRY(ObjectPurgeableAPPLE), TABLE_ENTRY(ObjectUnpurgeableAPPLE), + TABLE_ENTRY(_dispatch_stub_818), + TABLE_ENTRY(_dispatch_stub_819), TABLE_ENTRY(_dispatch_stub_820), TABLE_ENTRY(_dispatch_stub_821), TABLE_ENTRY(_dispatch_stub_822), - TABLE_ENTRY(_dispatch_stub_823), - TABLE_ENTRY(_dispatch_stub_824), TABLE_ENTRY(EGLImageTargetRenderbufferStorageOES), TABLE_ENTRY(EGLImageTargetTexture2DOES), /* A whole bunch of no-op functions. These might be called @@ -7095,7 +7079,7 @@ _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(FogCoordf), TABLE_ENTRY(FogCoordfv), TABLE_ENTRY(BlendFuncSeparate), - TABLE_ENTRY(_dispatch_stub_635), + TABLE_ENTRY(_dispatch_stub_633), TABLE_ENTRY(WindowPos2d), TABLE_ENTRY(WindowPos2dARB), TABLE_ENTRY(WindowPos2dv), diff --git a/src/mapi/glapi/glprocs.h b/src/mapi/glapi/glprocs.h index 0ddcf4bad0c..9adab52f43a 100644 --- a/src/mapi/glapi/glprocs.h +++ b/src/mapi/glapi/glprocs.h @@ -660,8 +660,6 @@ static const char gl_string_table[] = "glPointParameterfvEXT\0" "glLockArraysEXT\0" "glUnlockArraysEXT\0" - "glCullParameterdvEXT\0" - "glCullParameterfvEXT\0" "glSecondaryColor3bEXT\0" "glSecondaryColor3bvEXT\0" "glSecondaryColor3dEXT\0" @@ -1216,9 +1214,9 @@ static const char gl_string_table[] = #define gl_dispatch_stub_595 mgl_dispatch_stub_595 #define gl_dispatch_stub_596 mgl_dispatch_stub_596 #define gl_dispatch_stub_597 mgl_dispatch_stub_597 -#define gl_dispatch_stub_608 mgl_dispatch_stub_608 -#define gl_dispatch_stub_609 mgl_dispatch_stub_609 -#define gl_dispatch_stub_634 mgl_dispatch_stub_634 +#define gl_dispatch_stub_632 mgl_dispatch_stub_632 +#define gl_dispatch_stub_674 mgl_dispatch_stub_674 +#define gl_dispatch_stub_675 mgl_dispatch_stub_675 #define gl_dispatch_stub_676 mgl_dispatch_stub_676 #define gl_dispatch_stub_677 mgl_dispatch_stub_677 #define gl_dispatch_stub_678 mgl_dispatch_stub_678 @@ -1226,25 +1224,23 @@ static const char gl_string_table[] = #define gl_dispatch_stub_680 mgl_dispatch_stub_680 #define gl_dispatch_stub_681 mgl_dispatch_stub_681 #define gl_dispatch_stub_682 mgl_dispatch_stub_682 -#define gl_dispatch_stub_683 mgl_dispatch_stub_683 -#define gl_dispatch_stub_684 mgl_dispatch_stub_684 +#define gl_dispatch_stub_763 mgl_dispatch_stub_763 +#define gl_dispatch_stub_764 mgl_dispatch_stub_764 #define gl_dispatch_stub_765 mgl_dispatch_stub_765 #define gl_dispatch_stub_766 mgl_dispatch_stub_766 #define gl_dispatch_stub_767 mgl_dispatch_stub_767 -#define gl_dispatch_stub_768 mgl_dispatch_stub_768 -#define gl_dispatch_stub_769 mgl_dispatch_stub_769 -#define gl_dispatch_stub_776 mgl_dispatch_stub_776 -#define gl_dispatch_stub_777 mgl_dispatch_stub_777 +#define gl_dispatch_stub_774 mgl_dispatch_stub_774 +#define gl_dispatch_stub_775 mgl_dispatch_stub_775 +#define gl_dispatch_stub_793 mgl_dispatch_stub_793 +#define gl_dispatch_stub_794 mgl_dispatch_stub_794 #define gl_dispatch_stub_795 mgl_dispatch_stub_795 -#define gl_dispatch_stub_796 mgl_dispatch_stub_796 -#define gl_dispatch_stub_797 mgl_dispatch_stub_797 -#define gl_dispatch_stub_815 mgl_dispatch_stub_815 -#define gl_dispatch_stub_816 mgl_dispatch_stub_816 +#define gl_dispatch_stub_813 mgl_dispatch_stub_813 +#define gl_dispatch_stub_814 mgl_dispatch_stub_814 +#define gl_dispatch_stub_818 mgl_dispatch_stub_818 +#define gl_dispatch_stub_819 mgl_dispatch_stub_819 #define gl_dispatch_stub_820 mgl_dispatch_stub_820 #define gl_dispatch_stub_821 mgl_dispatch_stub_821 #define gl_dispatch_stub_822 mgl_dispatch_stub_822 -#define gl_dispatch_stub_823 mgl_dispatch_stub_823 -#define gl_dispatch_stub_824 mgl_dispatch_stub_824 #endif /* USE_MGL_NAMESPACE */ @@ -1270,35 +1266,33 @@ void GLAPIENTRY gl_dispatch_stub_594(GLenum pname, GLint param); void GLAPIENTRY gl_dispatch_stub_595(GLenum pname, const GLint * params); void GLAPIENTRY gl_dispatch_stub_596(GLclampf value, GLboolean invert); void GLAPIENTRY gl_dispatch_stub_597(GLenum pattern); -void GLAPIENTRY gl_dispatch_stub_608(GLenum pname, GLdouble * params); -void GLAPIENTRY gl_dispatch_stub_609(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_634(GLenum mode); -void GLAPIENTRY gl_dispatch_stub_676(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_677(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_678(GLsizei n, const GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_679(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_680(GLsizei n, GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_681(GLuint fence, GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_632(GLenum mode); +void GLAPIENTRY gl_dispatch_stub_674(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_675(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_676(GLsizei n, const GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_677(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_678(GLsizei n, GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_679(GLuint fence, GLenum pname, GLint * params); +GLboolean GLAPIENTRY gl_dispatch_stub_680(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_681(GLuint fence, GLenum condition); GLboolean GLAPIENTRY gl_dispatch_stub_682(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_683(GLuint fence, GLenum condition); -GLboolean GLAPIENTRY gl_dispatch_stub_684(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_765(GLenum face); -void GLAPIENTRY gl_dispatch_stub_766(GLuint array); -void GLAPIENTRY gl_dispatch_stub_767(GLsizei n, const GLuint * arrays); -void GLAPIENTRY gl_dispatch_stub_768(GLsizei n, GLuint * arrays); -GLboolean GLAPIENTRY gl_dispatch_stub_769(GLuint array); -void GLAPIENTRY gl_dispatch_stub_776(GLclampd zmin, GLclampd zmax); -void GLAPIENTRY gl_dispatch_stub_777(GLenum modeRGB, GLenum modeA); -void GLAPIENTRY gl_dispatch_stub_795(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -void GLAPIENTRY gl_dispatch_stub_796(GLenum target, GLenum pname, GLint param); -void GLAPIENTRY gl_dispatch_stub_797(GLenum target, GLintptr offset, GLsizeiptr size); -void GLAPIENTRY gl_dispatch_stub_815(GLenum target, GLenum pname, GLvoid ** params); -void GLAPIENTRY gl_dispatch_stub_816(GLenum target, GLsizei length, GLvoid * pointer); -void GLAPIENTRY gl_dispatch_stub_820(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -void GLAPIENTRY gl_dispatch_stub_821(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_822(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_823(GLuint id, GLenum pname, GLint64EXT * params); -void GLAPIENTRY gl_dispatch_stub_824(GLuint id, GLenum pname, GLuint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_763(GLenum face); +void GLAPIENTRY gl_dispatch_stub_764(GLuint array); +void GLAPIENTRY gl_dispatch_stub_765(GLsizei n, const GLuint * arrays); +void GLAPIENTRY gl_dispatch_stub_766(GLsizei n, GLuint * arrays); +GLboolean GLAPIENTRY gl_dispatch_stub_767(GLuint array); +void GLAPIENTRY gl_dispatch_stub_774(GLclampd zmin, GLclampd zmax); +void GLAPIENTRY gl_dispatch_stub_775(GLenum modeRGB, GLenum modeA); +void GLAPIENTRY gl_dispatch_stub_793(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +void GLAPIENTRY gl_dispatch_stub_794(GLenum target, GLenum pname, GLint param); +void GLAPIENTRY gl_dispatch_stub_795(GLenum target, GLintptr offset, GLsizeiptr size); +void GLAPIENTRY gl_dispatch_stub_813(GLenum target, GLenum pname, GLvoid ** params); +void GLAPIENTRY gl_dispatch_stub_814(GLenum target, GLsizei length, GLvoid * pointer); +void GLAPIENTRY gl_dispatch_stub_818(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +void GLAPIENTRY gl_dispatch_stub_819(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_820(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_821(GLuint id, GLenum pname, GLint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_822(GLuint id, GLenum pname, GLuint64EXT * params); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1910,537 +1904,535 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET( 9921, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), NAME_FUNC_OFFSET( 9943, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), NAME_FUNC_OFFSET( 9959, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), - NAME_FUNC_OFFSET( 9977, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, _gloffset_CullParameterdvEXT), - NAME_FUNC_OFFSET( 9998, gl_dispatch_stub_609, gl_dispatch_stub_609, NULL, _gloffset_CullParameterfvEXT), - NAME_FUNC_OFFSET(10019, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(10041, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(10064, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(10086, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(10109, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(10131, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(10154, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(10176, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(10199, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(10221, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(10244, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(10267, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(10291, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(10314, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(10338, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(10361, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(10385, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(10412, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(10433, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(10456, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(10477, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(10492, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(10508, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(10523, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(10539, gl_dispatch_stub_634, gl_dispatch_stub_634, NULL, _gloffset_PixelTexGenSGIX), - NAME_FUNC_OFFSET(10557, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(10580, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), - NAME_FUNC_OFFSET(10606, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), - NAME_FUNC_OFFSET(10627, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), - NAME_FUNC_OFFSET(10645, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), - NAME_FUNC_OFFSET(10664, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), - NAME_FUNC_OFFSET(10687, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), - NAME_FUNC_OFFSET(10711, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), - NAME_FUNC_OFFSET(10734, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), - NAME_FUNC_OFFSET(10758, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), - NAME_FUNC_OFFSET(10781, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10813, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10845, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), - NAME_FUNC_OFFSET(10878, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), - NAME_FUNC_OFFSET(10911, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10948, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10985, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), - NAME_FUNC_OFFSET(11005, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(11023, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(11042, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(11060, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(11079, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(11097, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(11116, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(11134, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(11153, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(11171, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(11190, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(11208, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(11227, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(11245, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(11264, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(11282, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(11301, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), - NAME_FUNC_OFFSET(11319, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), - NAME_FUNC_OFFSET(11338, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), - NAME_FUNC_OFFSET(11356, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), - NAME_FUNC_OFFSET(11375, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), - NAME_FUNC_OFFSET(11393, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), - NAME_FUNC_OFFSET(11412, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), - NAME_FUNC_OFFSET(11430, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), - NAME_FUNC_OFFSET(11449, gl_dispatch_stub_676, gl_dispatch_stub_676, NULL, _gloffset_MultiModeDrawArraysIBM), - NAME_FUNC_OFFSET(11474, gl_dispatch_stub_677, gl_dispatch_stub_677, NULL, _gloffset_MultiModeDrawElementsIBM), - NAME_FUNC_OFFSET(11501, gl_dispatch_stub_678, gl_dispatch_stub_678, NULL, _gloffset_DeleteFencesNV), - NAME_FUNC_OFFSET(11518, gl_dispatch_stub_679, gl_dispatch_stub_679, NULL, _gloffset_FinishFenceNV), - NAME_FUNC_OFFSET(11534, gl_dispatch_stub_680, gl_dispatch_stub_680, NULL, _gloffset_GenFencesNV), - NAME_FUNC_OFFSET(11548, gl_dispatch_stub_681, gl_dispatch_stub_681, NULL, _gloffset_GetFenceivNV), - NAME_FUNC_OFFSET(11563, gl_dispatch_stub_682, gl_dispatch_stub_682, NULL, _gloffset_IsFenceNV), - NAME_FUNC_OFFSET(11575, gl_dispatch_stub_683, gl_dispatch_stub_683, NULL, _gloffset_SetFenceNV), - NAME_FUNC_OFFSET(11588, gl_dispatch_stub_684, gl_dispatch_stub_684, NULL, _gloffset_TestFenceNV), - NAME_FUNC_OFFSET(11602, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), - NAME_FUNC_OFFSET(11626, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(11642, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(11661, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), - NAME_FUNC_OFFSET(11680, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(11696, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), - NAME_FUNC_OFFSET(11722, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), - NAME_FUNC_OFFSET(11748, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), - NAME_FUNC_OFFSET(11769, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), - NAME_FUNC_OFFSET(11786, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), - NAME_FUNC_OFFSET(11807, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(11835, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), - NAME_FUNC_OFFSET(11857, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), - NAME_FUNC_OFFSET(11879, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), - NAME_FUNC_OFFSET(11901, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(11915, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), - NAME_FUNC_OFFSET(11931, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), - NAME_FUNC_OFFSET(11956, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), - NAME_FUNC_OFFSET(11981, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), - NAME_FUNC_OFFSET(12009, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), - NAME_FUNC_OFFSET(12025, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), - NAME_FUNC_OFFSET(12044, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), - NAME_FUNC_OFFSET(12064, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), - NAME_FUNC_OFFSET(12083, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), - NAME_FUNC_OFFSET(12103, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), - NAME_FUNC_OFFSET(12122, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), - NAME_FUNC_OFFSET(12142, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), - NAME_FUNC_OFFSET(12161, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), - NAME_FUNC_OFFSET(12181, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), - NAME_FUNC_OFFSET(12200, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), - NAME_FUNC_OFFSET(12220, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), - NAME_FUNC_OFFSET(12239, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), - NAME_FUNC_OFFSET(12259, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), - NAME_FUNC_OFFSET(12278, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), - NAME_FUNC_OFFSET(12298, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), - NAME_FUNC_OFFSET(12317, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), - NAME_FUNC_OFFSET(12337, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), - NAME_FUNC_OFFSET(12356, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), - NAME_FUNC_OFFSET(12376, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), - NAME_FUNC_OFFSET(12395, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), - NAME_FUNC_OFFSET(12415, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), - NAME_FUNC_OFFSET(12434, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), - NAME_FUNC_OFFSET(12454, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), - NAME_FUNC_OFFSET(12473, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), - NAME_FUNC_OFFSET(12493, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), - NAME_FUNC_OFFSET(12513, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), - NAME_FUNC_OFFSET(12534, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), - NAME_FUNC_OFFSET(12558, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), - NAME_FUNC_OFFSET(12579, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), - NAME_FUNC_OFFSET(12600, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), - NAME_FUNC_OFFSET(12621, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), - NAME_FUNC_OFFSET(12642, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), - NAME_FUNC_OFFSET(12663, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), - NAME_FUNC_OFFSET(12684, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), - NAME_FUNC_OFFSET(12705, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), - NAME_FUNC_OFFSET(12726, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), - NAME_FUNC_OFFSET(12747, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), - NAME_FUNC_OFFSET(12768, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), - NAME_FUNC_OFFSET(12789, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), - NAME_FUNC_OFFSET(12810, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), - NAME_FUNC_OFFSET(12832, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), - NAME_FUNC_OFFSET(12859, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), - NAME_FUNC_OFFSET(12886, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), - NAME_FUNC_OFFSET(12910, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), - NAME_FUNC_OFFSET(12934, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), - NAME_FUNC_OFFSET(12956, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), - NAME_FUNC_OFFSET(12978, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), - NAME_FUNC_OFFSET(13000, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), - NAME_FUNC_OFFSET(13025, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), - NAME_FUNC_OFFSET(13049, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), - NAME_FUNC_OFFSET(13071, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), - NAME_FUNC_OFFSET(13093, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), - NAME_FUNC_OFFSET(13115, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), - NAME_FUNC_OFFSET(13141, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), - NAME_FUNC_OFFSET(13164, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), - NAME_FUNC_OFFSET(13188, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), - NAME_FUNC_OFFSET(13206, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), - NAME_FUNC_OFFSET(13221, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), - NAME_FUNC_OFFSET(13252, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(13272, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(13293, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_ActiveStencilFaceEXT), - NAME_FUNC_OFFSET(13316, gl_dispatch_stub_766, gl_dispatch_stub_766, NULL, _gloffset_BindVertexArrayAPPLE), - NAME_FUNC_OFFSET(13339, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(13365, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_GenVertexArraysAPPLE), - NAME_FUNC_OFFSET(13388, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(13409, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), - NAME_FUNC_OFFSET(13440, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), - NAME_FUNC_OFFSET(13471, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), - NAME_FUNC_OFFSET(13499, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), - NAME_FUNC_OFFSET(13528, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), - NAME_FUNC_OFFSET(13556, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), - NAME_FUNC_OFFSET(13585, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL, _gloffset_DepthBoundsEXT), - NAME_FUNC_OFFSET(13602, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(13629, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(13650, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(13672, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(13700, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(13724, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(13749, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(13778, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(13804, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(13830, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(13856, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(13877, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(13899, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(13919, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(13960, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(13992, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(14011, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(14031, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(14056, gl_dispatch_stub_795, gl_dispatch_stub_795, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(14077, gl_dispatch_stub_796, gl_dispatch_stub_796, NULL, _gloffset_BufferParameteriAPPLE), - NAME_FUNC_OFFSET(14101, gl_dispatch_stub_797, gl_dispatch_stub_797, NULL, _gloffset_FlushMappedBufferRangeAPPLE), - NAME_FUNC_OFFSET(14131, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(14160, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, _gloffset_ColorMaskIndexedEXT), - NAME_FUNC_OFFSET(14182, glDisableIndexedEXT, glDisableIndexedEXT, NULL, _gloffset_DisableIndexedEXT), - NAME_FUNC_OFFSET(14202, glEnableIndexedEXT, glEnableIndexedEXT, NULL, _gloffset_EnableIndexedEXT), - NAME_FUNC_OFFSET(14221, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, _gloffset_GetBooleanIndexedvEXT), - NAME_FUNC_OFFSET(14245, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, _gloffset_GetIntegerIndexedvEXT), - NAME_FUNC_OFFSET(14269, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, _gloffset_IsEnabledIndexedEXT), - NAME_FUNC_OFFSET(14291, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, _gloffset_BeginConditionalRenderNV), - NAME_FUNC_OFFSET(14318, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, _gloffset_EndConditionalRenderNV), - NAME_FUNC_OFFSET(14343, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT), - NAME_FUNC_OFFSET(14371, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT), - NAME_FUNC_OFFSET(14391, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, _gloffset_BindBufferOffsetEXT), - NAME_FUNC_OFFSET(14413, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT), - NAME_FUNC_OFFSET(14434, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT), - NAME_FUNC_OFFSET(14460, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT), - NAME_FUNC_OFFSET(14493, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT), - NAME_FUNC_OFFSET(14524, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), - NAME_FUNC_OFFSET(14545, gl_dispatch_stub_815, gl_dispatch_stub_815, NULL, _gloffset_GetTexParameterPointervAPPLE), - NAME_FUNC_OFFSET(14576, gl_dispatch_stub_816, gl_dispatch_stub_816, NULL, _gloffset_TextureRangeAPPLE), - NAME_FUNC_OFFSET(14596, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, _gloffset_GetObjectParameterivAPPLE), - NAME_FUNC_OFFSET(14624, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, _gloffset_ObjectPurgeableAPPLE), - NAME_FUNC_OFFSET(14647, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, _gloffset_ObjectUnpurgeableAPPLE), - NAME_FUNC_OFFSET(14672, gl_dispatch_stub_820, gl_dispatch_stub_820, NULL, _gloffset_StencilFuncSeparateATI), - NAME_FUNC_OFFSET(14697, gl_dispatch_stub_821, gl_dispatch_stub_821, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(14726, gl_dispatch_stub_822, gl_dispatch_stub_822, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(14757, gl_dispatch_stub_823, gl_dispatch_stub_823, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(14781, gl_dispatch_stub_824, gl_dispatch_stub_824, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(14806, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, _gloffset_EGLImageTargetRenderbufferStorageOES), - NAME_FUNC_OFFSET(14845, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, _gloffset_EGLImageTargetTexture2DOES), - NAME_FUNC_OFFSET(14874, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(14892, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(14909, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(14925, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(14950, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(14970, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(14990, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(15013, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(15036, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(15056, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(15073, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(15090, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(15105, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(15129, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(15148, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(15167, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(15183, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(15202, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(15225, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(15241, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(15257, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(15284, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(15311, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(15331, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(15350, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(15369, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(15399, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(15429, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(15459, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(15489, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(15508, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(15531, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(15556, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(15581, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(15608, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(15636, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(15663, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(15691, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(15720, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(15749, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(15775, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(15806, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(15837, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(15861, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(15884, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(15902, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(15931, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(15960, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(15975, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(16001, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(16027, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(16042, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(16054, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(16074, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(16091, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(16107, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(16126, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(16149, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(16165, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(16187, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(16205, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(16224, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(16242, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(16261, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(16279, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(16298, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(16316, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(16335, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(16353, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(16372, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(16390, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(16409, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(16427, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(16446, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(16464, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(16483, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(16501, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(16520, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(16538, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(16557, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(16575, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(16594, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(16612, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(16631, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(16649, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(16668, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(16686, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(16705, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(16723, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(16742, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(16760, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(16779, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), - NAME_FUNC_OFFSET(16802, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), - NAME_FUNC_OFFSET(16827, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), - NAME_FUNC_OFFSET(16852, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), - NAME_FUNC_OFFSET(16879, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), - NAME_FUNC_OFFSET(16906, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(16929, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(16952, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(16975, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(16998, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(17015, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(17038, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(17061, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(17084, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(17110, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(17136, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(17162, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(17186, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(17213, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(17239, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(17259, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(17279, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(17299, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), - NAME_FUNC_OFFSET(17322, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), - NAME_FUNC_OFFSET(17346, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), - NAME_FUNC_OFFSET(17369, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), - NAME_FUNC_OFFSET(17393, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(17410, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(17428, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(17445, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(17463, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(17480, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(17498, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(17515, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(17533, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(17550, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(17568, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(17585, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(17603, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(17620, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(17638, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(17655, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(17673, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(17690, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(17708, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(17727, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(17746, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(17765, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(17784, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(17804, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(17824, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(17844, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(17862, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(17879, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(17897, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(17914, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(17932, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(17950, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(17967, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(17985, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(18004, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(18023, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(18042, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(18064, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(18077, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(18090, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(18106, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(18122, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(18135, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(18158, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(18178, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(18197, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(18208, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(18220, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(18234, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(18247, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(18263, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(18274, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(18287, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(18306, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(18326, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(18339, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(18349, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(18365, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(18384, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(18402, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(18423, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(18438, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(18453, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(18467, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(18482, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(18494, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(18507, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(18519, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(18532, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(18544, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(18557, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(18569, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(18582, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(18594, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(18607, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(18619, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(18632, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(18644, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(18657, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(18669, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(18682, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(18701, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(18720, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(18739, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(18752, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(18770, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(18791, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(18809, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(18829, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(18843, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(18860, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), - NAME_FUNC_OFFSET(18896, gl_dispatch_stub_596, gl_dispatch_stub_596, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(18912, gl_dispatch_stub_597, gl_dispatch_stub_597, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(18931, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18949, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18970, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18992, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(19011, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(19033, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(19056, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(19075, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(19095, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(19114, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(19134, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(19153, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(19173, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(19192, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(19212, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(19231, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(19251, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(19271, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(19292, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(19312, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(19333, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(19353, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(19374, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(19398, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(19416, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(19436, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(19454, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(19466, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(19479, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(19491, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(19504, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(19524, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(19548, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(19562, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(19579, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(19594, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(19612, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(19626, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(19643, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(19658, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(19676, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(19690, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(19707, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(19722, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(19740, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(19754, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(19771, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(19786, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(19804, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(19818, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(19835, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(19850, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(19868, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(19882, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(19899, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(19914, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(19932, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(19946, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(19963, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(19978, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(19996, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(20010, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(20027, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(20042, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(20060, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(20077, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(20097, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(20114, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(20140, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(20169, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(20184, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(20202, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(20221, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(20242, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(20258, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(20282, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(20309, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(20327, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(20346, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(20371, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(20392, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(20414, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(20440, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(20463, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(20486, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(20509, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(20527, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(20546, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(20563, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(20601, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(20630, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(20646, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(20663, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(20685, gl_dispatch_stub_795, gl_dispatch_stub_795, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(20703, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(20729, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT), - NAME_FUNC_OFFSET(20754, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT), - NAME_FUNC_OFFSET(20771, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT), - NAME_FUNC_OFFSET(20789, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT), - NAME_FUNC_OFFSET(20812, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT), - NAME_FUNC_OFFSET(20842, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT), - NAME_FUNC_OFFSET(20870, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), + NAME_FUNC_OFFSET( 9977, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET( 9999, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(10022, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(10044, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(10067, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(10089, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(10112, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(10134, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(10157, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(10179, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(10202, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(10225, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(10249, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(10272, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(10296, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(10319, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(10343, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(10370, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(10391, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(10414, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(10435, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(10450, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(10466, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(10481, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(10497, gl_dispatch_stub_632, gl_dispatch_stub_632, NULL, _gloffset_PixelTexGenSGIX), + NAME_FUNC_OFFSET(10515, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(10538, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), + NAME_FUNC_OFFSET(10564, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), + NAME_FUNC_OFFSET(10585, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), + NAME_FUNC_OFFSET(10603, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), + NAME_FUNC_OFFSET(10622, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), + NAME_FUNC_OFFSET(10645, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), + NAME_FUNC_OFFSET(10669, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), + NAME_FUNC_OFFSET(10692, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), + NAME_FUNC_OFFSET(10716, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), + NAME_FUNC_OFFSET(10739, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10771, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10803, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), + NAME_FUNC_OFFSET(10836, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), + NAME_FUNC_OFFSET(10869, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10906, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10943, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), + NAME_FUNC_OFFSET(10963, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(10981, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(11000, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(11018, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(11037, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(11055, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(11074, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(11092, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(11111, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(11129, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(11148, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(11166, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(11185, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(11203, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(11222, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(11240, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(11259, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), + NAME_FUNC_OFFSET(11277, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), + NAME_FUNC_OFFSET(11296, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), + NAME_FUNC_OFFSET(11314, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), + NAME_FUNC_OFFSET(11333, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), + NAME_FUNC_OFFSET(11351, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), + NAME_FUNC_OFFSET(11370, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), + NAME_FUNC_OFFSET(11388, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), + NAME_FUNC_OFFSET(11407, gl_dispatch_stub_674, gl_dispatch_stub_674, NULL, _gloffset_MultiModeDrawArraysIBM), + NAME_FUNC_OFFSET(11432, gl_dispatch_stub_675, gl_dispatch_stub_675, NULL, _gloffset_MultiModeDrawElementsIBM), + NAME_FUNC_OFFSET(11459, gl_dispatch_stub_676, gl_dispatch_stub_676, NULL, _gloffset_DeleteFencesNV), + NAME_FUNC_OFFSET(11476, gl_dispatch_stub_677, gl_dispatch_stub_677, NULL, _gloffset_FinishFenceNV), + NAME_FUNC_OFFSET(11492, gl_dispatch_stub_678, gl_dispatch_stub_678, NULL, _gloffset_GenFencesNV), + NAME_FUNC_OFFSET(11506, gl_dispatch_stub_679, gl_dispatch_stub_679, NULL, _gloffset_GetFenceivNV), + NAME_FUNC_OFFSET(11521, gl_dispatch_stub_680, gl_dispatch_stub_680, NULL, _gloffset_IsFenceNV), + NAME_FUNC_OFFSET(11533, gl_dispatch_stub_681, gl_dispatch_stub_681, NULL, _gloffset_SetFenceNV), + NAME_FUNC_OFFSET(11546, gl_dispatch_stub_682, gl_dispatch_stub_682, NULL, _gloffset_TestFenceNV), + NAME_FUNC_OFFSET(11560, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), + NAME_FUNC_OFFSET(11584, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(11600, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(11619, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), + NAME_FUNC_OFFSET(11638, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(11654, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), + NAME_FUNC_OFFSET(11680, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), + NAME_FUNC_OFFSET(11706, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), + NAME_FUNC_OFFSET(11727, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), + NAME_FUNC_OFFSET(11744, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), + NAME_FUNC_OFFSET(11765, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(11793, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), + NAME_FUNC_OFFSET(11815, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), + NAME_FUNC_OFFSET(11837, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), + NAME_FUNC_OFFSET(11859, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(11873, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), + NAME_FUNC_OFFSET(11889, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), + NAME_FUNC_OFFSET(11914, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), + NAME_FUNC_OFFSET(11939, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), + NAME_FUNC_OFFSET(11967, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), + NAME_FUNC_OFFSET(11983, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), + NAME_FUNC_OFFSET(12002, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), + NAME_FUNC_OFFSET(12022, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), + NAME_FUNC_OFFSET(12041, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), + NAME_FUNC_OFFSET(12061, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), + NAME_FUNC_OFFSET(12080, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), + NAME_FUNC_OFFSET(12100, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), + NAME_FUNC_OFFSET(12119, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), + NAME_FUNC_OFFSET(12139, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), + NAME_FUNC_OFFSET(12158, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), + NAME_FUNC_OFFSET(12178, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), + NAME_FUNC_OFFSET(12197, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), + NAME_FUNC_OFFSET(12217, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), + NAME_FUNC_OFFSET(12236, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), + NAME_FUNC_OFFSET(12256, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), + NAME_FUNC_OFFSET(12275, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), + NAME_FUNC_OFFSET(12295, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), + NAME_FUNC_OFFSET(12314, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), + NAME_FUNC_OFFSET(12334, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), + NAME_FUNC_OFFSET(12353, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), + NAME_FUNC_OFFSET(12373, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), + NAME_FUNC_OFFSET(12392, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), + NAME_FUNC_OFFSET(12412, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), + NAME_FUNC_OFFSET(12431, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), + NAME_FUNC_OFFSET(12451, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), + NAME_FUNC_OFFSET(12471, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), + NAME_FUNC_OFFSET(12492, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), + NAME_FUNC_OFFSET(12516, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), + NAME_FUNC_OFFSET(12537, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), + NAME_FUNC_OFFSET(12558, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), + NAME_FUNC_OFFSET(12579, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), + NAME_FUNC_OFFSET(12600, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), + NAME_FUNC_OFFSET(12621, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), + NAME_FUNC_OFFSET(12642, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), + NAME_FUNC_OFFSET(12663, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), + NAME_FUNC_OFFSET(12684, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), + NAME_FUNC_OFFSET(12705, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), + NAME_FUNC_OFFSET(12726, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), + NAME_FUNC_OFFSET(12747, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), + NAME_FUNC_OFFSET(12768, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), + NAME_FUNC_OFFSET(12790, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), + NAME_FUNC_OFFSET(12817, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), + NAME_FUNC_OFFSET(12844, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), + NAME_FUNC_OFFSET(12868, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), + NAME_FUNC_OFFSET(12892, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), + NAME_FUNC_OFFSET(12914, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), + NAME_FUNC_OFFSET(12936, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), + NAME_FUNC_OFFSET(12958, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), + NAME_FUNC_OFFSET(12983, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), + NAME_FUNC_OFFSET(13007, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), + NAME_FUNC_OFFSET(13029, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), + NAME_FUNC_OFFSET(13051, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), + NAME_FUNC_OFFSET(13073, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), + NAME_FUNC_OFFSET(13099, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), + NAME_FUNC_OFFSET(13122, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), + NAME_FUNC_OFFSET(13146, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), + NAME_FUNC_OFFSET(13164, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), + NAME_FUNC_OFFSET(13179, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), + NAME_FUNC_OFFSET(13210, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(13230, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(13251, gl_dispatch_stub_763, gl_dispatch_stub_763, NULL, _gloffset_ActiveStencilFaceEXT), + NAME_FUNC_OFFSET(13274, gl_dispatch_stub_764, gl_dispatch_stub_764, NULL, _gloffset_BindVertexArrayAPPLE), + NAME_FUNC_OFFSET(13297, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(13323, gl_dispatch_stub_766, gl_dispatch_stub_766, NULL, _gloffset_GenVertexArraysAPPLE), + NAME_FUNC_OFFSET(13346, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(13367, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), + NAME_FUNC_OFFSET(13398, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), + NAME_FUNC_OFFSET(13429, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), + NAME_FUNC_OFFSET(13457, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), + NAME_FUNC_OFFSET(13486, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), + NAME_FUNC_OFFSET(13514, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), + NAME_FUNC_OFFSET(13543, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_DepthBoundsEXT), + NAME_FUNC_OFFSET(13560, gl_dispatch_stub_775, gl_dispatch_stub_775, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13587, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(13608, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(13630, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(13658, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(13682, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(13707, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(13736, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(13762, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(13788, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(13814, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(13835, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(13857, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(13877, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(13918, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(13950, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(13969, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(13989, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(14014, gl_dispatch_stub_793, gl_dispatch_stub_793, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(14035, gl_dispatch_stub_794, gl_dispatch_stub_794, NULL, _gloffset_BufferParameteriAPPLE), + NAME_FUNC_OFFSET(14059, gl_dispatch_stub_795, gl_dispatch_stub_795, NULL, _gloffset_FlushMappedBufferRangeAPPLE), + NAME_FUNC_OFFSET(14089, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(14118, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, _gloffset_ColorMaskIndexedEXT), + NAME_FUNC_OFFSET(14140, glDisableIndexedEXT, glDisableIndexedEXT, NULL, _gloffset_DisableIndexedEXT), + NAME_FUNC_OFFSET(14160, glEnableIndexedEXT, glEnableIndexedEXT, NULL, _gloffset_EnableIndexedEXT), + NAME_FUNC_OFFSET(14179, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, _gloffset_GetBooleanIndexedvEXT), + NAME_FUNC_OFFSET(14203, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, _gloffset_GetIntegerIndexedvEXT), + NAME_FUNC_OFFSET(14227, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, _gloffset_IsEnabledIndexedEXT), + NAME_FUNC_OFFSET(14249, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, _gloffset_BeginConditionalRenderNV), + NAME_FUNC_OFFSET(14276, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, _gloffset_EndConditionalRenderNV), + NAME_FUNC_OFFSET(14301, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT), + NAME_FUNC_OFFSET(14329, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT), + NAME_FUNC_OFFSET(14349, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, _gloffset_BindBufferOffsetEXT), + NAME_FUNC_OFFSET(14371, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT), + NAME_FUNC_OFFSET(14392, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT), + NAME_FUNC_OFFSET(14418, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT), + NAME_FUNC_OFFSET(14451, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT), + NAME_FUNC_OFFSET(14482, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), + NAME_FUNC_OFFSET(14503, gl_dispatch_stub_813, gl_dispatch_stub_813, NULL, _gloffset_GetTexParameterPointervAPPLE), + NAME_FUNC_OFFSET(14534, gl_dispatch_stub_814, gl_dispatch_stub_814, NULL, _gloffset_TextureRangeAPPLE), + NAME_FUNC_OFFSET(14554, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, _gloffset_GetObjectParameterivAPPLE), + NAME_FUNC_OFFSET(14582, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, _gloffset_ObjectPurgeableAPPLE), + NAME_FUNC_OFFSET(14605, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, _gloffset_ObjectUnpurgeableAPPLE), + NAME_FUNC_OFFSET(14630, gl_dispatch_stub_818, gl_dispatch_stub_818, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(14655, gl_dispatch_stub_819, gl_dispatch_stub_819, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(14684, gl_dispatch_stub_820, gl_dispatch_stub_820, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(14715, gl_dispatch_stub_821, gl_dispatch_stub_821, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(14739, gl_dispatch_stub_822, gl_dispatch_stub_822, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(14764, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, _gloffset_EGLImageTargetRenderbufferStorageOES), + NAME_FUNC_OFFSET(14803, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, _gloffset_EGLImageTargetTexture2DOES), + NAME_FUNC_OFFSET(14832, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(14850, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(14867, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(14883, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(14908, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(14928, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(14948, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(14971, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(14994, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(15014, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(15031, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(15048, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(15063, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(15087, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(15106, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(15125, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(15141, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(15160, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(15183, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(15199, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(15215, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(15242, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(15269, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(15289, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(15308, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(15327, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(15357, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(15387, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(15417, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(15447, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(15466, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(15489, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(15514, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(15539, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(15566, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(15594, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(15621, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(15649, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(15678, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(15707, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(15733, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(15764, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(15795, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(15819, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(15842, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(15860, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(15889, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(15918, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(15933, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(15959, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(15985, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(16000, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(16012, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(16032, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(16049, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(16065, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(16084, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(16107, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(16123, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(16145, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(16163, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(16182, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(16200, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(16219, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(16237, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(16256, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(16274, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(16293, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(16311, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(16330, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(16348, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(16367, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(16385, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(16404, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(16422, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(16441, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(16459, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(16478, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(16496, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(16515, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(16533, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(16552, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(16570, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(16589, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(16607, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(16626, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(16644, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(16663, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(16681, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(16700, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(16718, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(16737, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), + NAME_FUNC_OFFSET(16760, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), + NAME_FUNC_OFFSET(16785, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), + NAME_FUNC_OFFSET(16810, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), + NAME_FUNC_OFFSET(16837, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), + NAME_FUNC_OFFSET(16864, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(16887, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(16910, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(16933, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(16956, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(16973, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(16996, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(17019, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(17042, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(17068, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(17094, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(17120, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(17144, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(17171, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(17197, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(17217, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(17237, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(17257, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), + NAME_FUNC_OFFSET(17280, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), + NAME_FUNC_OFFSET(17304, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), + NAME_FUNC_OFFSET(17327, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), + NAME_FUNC_OFFSET(17351, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(17368, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(17386, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(17403, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(17421, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(17438, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(17456, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(17473, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(17491, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(17508, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(17526, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(17543, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(17561, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(17578, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(17596, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(17613, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(17631, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(17648, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(17666, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(17685, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(17704, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(17723, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(17742, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(17762, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(17782, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(17802, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(17820, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(17837, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(17855, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(17872, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(17890, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(17908, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(17925, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(17943, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(17962, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(17981, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(18000, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(18022, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(18035, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(18048, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(18064, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(18080, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(18093, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(18116, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(18136, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(18155, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(18166, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(18178, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(18192, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(18205, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(18221, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(18232, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(18245, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(18264, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(18284, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(18297, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(18307, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(18323, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(18342, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(18360, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(18381, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(18396, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(18411, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(18425, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(18440, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(18452, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(18465, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(18477, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(18490, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(18502, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(18515, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(18527, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(18540, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(18552, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(18565, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(18577, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(18590, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(18602, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(18615, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(18627, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(18640, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(18659, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(18678, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(18697, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(18710, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(18728, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(18749, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(18767, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(18787, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(18801, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(18818, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), + NAME_FUNC_OFFSET(18854, gl_dispatch_stub_596, gl_dispatch_stub_596, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(18870, gl_dispatch_stub_597, gl_dispatch_stub_597, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(18889, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18907, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18928, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18950, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(18969, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(18991, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(19014, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(19033, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(19053, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(19072, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(19092, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(19111, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(19131, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(19150, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(19170, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(19189, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(19209, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(19229, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(19250, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(19270, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(19291, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(19311, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(19332, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(19356, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(19374, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(19394, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(19412, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(19424, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(19437, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(19449, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(19462, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(19482, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(19506, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(19520, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(19537, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(19552, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(19570, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(19584, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(19601, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(19616, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(19634, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(19648, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(19665, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(19680, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(19698, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(19712, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(19729, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(19744, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(19762, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(19776, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(19793, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(19808, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(19826, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(19840, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(19857, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(19872, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(19890, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(19904, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(19921, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(19936, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(19954, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(19968, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(19985, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(20000, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(20018, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(20035, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(20055, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(20072, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(20098, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(20127, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(20142, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(20160, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(20179, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(20200, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(20216, gl_dispatch_stub_775, gl_dispatch_stub_775, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(20240, gl_dispatch_stub_775, gl_dispatch_stub_775, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(20267, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(20285, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(20304, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(20329, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(20350, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(20372, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(20398, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(20421, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(20444, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(20467, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(20485, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(20504, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(20521, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(20559, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(20588, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(20604, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(20621, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(20643, gl_dispatch_stub_793, gl_dispatch_stub_793, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(20661, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(20687, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT), + NAME_FUNC_OFFSET(20712, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT), + NAME_FUNC_OFFSET(20729, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT), + NAME_FUNC_OFFSET(20747, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT), + NAME_FUNC_OFFSET(20770, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT), + NAME_FUNC_OFFSET(20800, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT), + NAME_FUNC_OFFSET(20828, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; -- cgit v1.2.3 From 8b2d5f431f8c862374d3e352f228b016060cd70a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 20 Sep 2010 15:41:39 +0200 Subject: Remove unnescessary initializations of UpdateTexturePalette This is already NULL'ed in _mesa_init_driver_functions. --- src/mesa/drivers/dri/intel/intel_tex.c | 1 - src/mesa/drivers/dri/mach64/mach64_tex.c | 2 -- src/mesa/drivers/dri/unichrome/via_tex.c | 1 - src/mesa/state_tracker/st_cb_texture.c | 1 - 4 files changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 49b7d5ef6b1..e2bff0878a5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -203,7 +203,6 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->NewTextureImage = intelNewTextureImage; functions->DeleteTexture = intelDeleteTextureObject; functions->FreeTexImageData = intelFreeTextureImageData; - functions->UpdateTexturePalette = 0; #if DO_DEBUG && !defined(__ia64__) if (INTEL_DEBUG & DEBUG_BUFMGR) diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 1bce967d58f..09367be5b42 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -559,7 +559,5 @@ void mach64InitTextureFuncs( struct dd_function_table *functions ) functions->DeleteTexture = mach64DDDeleteTexture; functions->IsTextureResident = driIsTextureResident; - functions->UpdateTexturePalette = NULL; - driInitTextureFormats(); } diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index e55129c6dab..49426fef8d7 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -951,7 +951,6 @@ void viaInitTextureFuncs(struct dd_function_table * functions) functions->TextureMemCpy = memcpy; #endif - functions->UpdateTexturePalette = 0; functions->IsTextureResident = viaIsTextureResident; } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 526417df3ba..9d232d417e4 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1998,7 +1998,6 @@ st_init_texture_functions(struct dd_function_table *functions) functions->NewTextureImage = st_NewTextureImage; functions->DeleteTexture = st_DeleteTextureObject; functions->FreeTexImageData = st_FreeTextureImageData; - functions->UpdateTexturePalette = 0; functions->TextureMemCpy = do_memcpy; -- cgit v1.2.3 From 668cdbe12958247f4a563c362dbf3247de7ccc3f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 15:46:51 -0700 Subject: glsl: Fix broadcast_index of lower_variable_index_to_cond_assign. It's trying to get an int smeared across all channels, not trying to get a 1:1 mapping of a subset of a vector's channels. This usually ended up not mattering with ir_to_mesa, since it just smears floats into every chan of a vec4. Fixes: glsl1-temp array with swizzled variable indexing --- src/glsl/lower_variable_index_to_cond_assign.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp index 68f30ca0ef8..5f0dd731135 100644 --- a/src/glsl/lower_variable_index_to_cond_assign.cpp +++ b/src/glsl/lower_variable_index_to_cond_assign.cpp @@ -117,7 +117,7 @@ struct switch_generator new(this->mem_ctx) ir_dereference_variable(index); if (comps) { - const ir_swizzle_mask m = { 0, 1, 2, 3, comps, false }; + const ir_swizzle_mask m = { 0, 0, 0, 0, comps, false }; broadcast_index = new(this->mem_ctx) ir_swizzle(broadcast_index, m); } -- cgit v1.2.3 From 5e8ed7a79b381d559b059987bd99c68d40f641ca Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 15:48:15 -0700 Subject: glsl: Add validation that a swizzle only references valid channels. Caught the bug in the previous commit. --- src/glsl/ir_validate.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index e35514aa6f9..70fb939b10a 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -67,6 +67,7 @@ public: virtual ir_visitor_status visit_enter(ir_function_signature *ir); virtual ir_visitor_status visit_leave(ir_expression *ir); + virtual ir_visitor_status visit_leave(ir_swizzle *ir); virtual ir_visitor_status visit_enter(ir_assignment *ir); @@ -364,6 +365,23 @@ ir_validate::visit_leave(ir_expression *ir) return visit_continue; } +ir_visitor_status +ir_validate::visit_leave(ir_swizzle *ir) +{ + int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w}; + + for (unsigned int i = 0; i < ir->type->vector_elements; i++) { + if (chans[i] >= ir->val->type->vector_elements) { + printf("ir_swizzle @ %p specifies a channel not present " + "in the value.\n", (void *) ir); + ir->print(); + abort(); + } + } + + return visit_continue; +} + ir_visitor_status ir_validate::visit(ir_variable *ir) { -- cgit v1.2.3 From 11ba8bafdbb31f40ecbb6478e26496b547d34c68 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 14:38:51 -0700 Subject: i965: Fix up writemasked assignments in the new FS. Not sure how I managed to get tests to succeed without this. +54 piglits. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 2b517375eb6..cf3e4e6ae84 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -868,9 +868,9 @@ fs_visitor::visit(ir_assignment *ir) inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); if (ir->condition) inst->predicated = true; + r.reg_offset++; } l.reg_offset++; - r.reg_offset++; } } -- cgit v1.2.3 From a5c6c8a31b240729baa12e2eca0ef53199efeed2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 15:10:34 -0700 Subject: i965: Remove swizzling of assignment to vector-splitting single-channel LHS. We'd end up reading some non-x component of the float RHS. +53 piglits. --- src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 9b58916cf2b..83b4af05bcb 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -319,8 +319,6 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) ir->write_mask = (1 << 0); handle_rvalue(&ir->rhs); - ir->rhs = new(mem_ctx) ir_swizzle(ir->rhs, - elem, elem, elem, elem, 1); } else { handle_rvalue(&ir->rhs); } -- cgit v1.2.3 From 169ff0cc9d189f5a00a2a94313a6ce1503d1d5b9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 16:11:18 -0700 Subject: i965: Handle all_equal/any_nequal in the new FS. These are generated for scalar operands instead of plain equal/nequal. But for scalars, they're the same anyway. +30 piglits. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index cf3e4e6ae84..9d022e07fbc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -725,11 +725,13 @@ fs_visitor::visit(ir_expression *ir) emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_equal: + case ir_binop_all_equal: /* same as nequal for scalars */ inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_Z; emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_nequal: + case ir_binop_any_nequal: /* same as nequal for scalars */ inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_NZ; emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); @@ -750,8 +752,6 @@ fs_visitor::visit(ir_expression *ir) case ir_binop_dot: case ir_binop_cross: case ir_unop_any: - case ir_binop_all_equal: - case ir_binop_any_nequal: assert(!"not reached: should be handled by brw_fs_channel_expressions"); break; -- cgit v1.2.3 From 3610e0c1a0edc87cef32b7d5d3f4d9004e31f6c4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 18:29:15 -0700 Subject: i965: Fix vector splitting RHS channel selection with sparse writemasks. Fixes: glsl-fs-all-02 glsl-fs-dot-vec2 --- src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 83b4af05bcb..552254df87b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -264,8 +264,10 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) variable_entry *rhs = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL; if (lhs_deref && rhs_deref && (lhs || rhs) && !ir->condition) { + unsigned int rhs_chan = 0; + /* Straight assignment of vector variables. */ - for (unsigned int i = 0; i < ir->rhs->type->vector_elements; i++) { + for (unsigned int i = 0; i < ir->lhs->type->vector_elements; i++) { ir_dereference *new_lhs; ir_rvalue *new_rhs; void *mem_ctx = lhs ? lhs->mem_ctx : rhs->mem_ctx; @@ -283,15 +285,18 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) } if (rhs) { - new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]); + new_rhs = + new(mem_ctx) ir_dereference_variable(rhs->components[rhs_chan]); } else { new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL), - i, i, i, i, 1); + rhs_chan, 0, 0, 0, 1); } ir->insert_before(new(mem_ctx) ir_assignment(new_lhs, new_rhs, NULL, writemask)); + + rhs_chan++; } ir->remove(); } else if (lhs) { -- cgit v1.2.3 From 94d44c33c0ced34e222517ed9c3b72d3c5e3b9f0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 18:31:53 -0700 Subject: i965: Add support for dFdx()/dFdy() to the FS backend. Fixes: glsl-fwidth glsl-derivs-swizzle --- src/mesa/drivers/dri/i965/brw_fs.cpp | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9d022e07fbc..7f2bf84a140 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -428,6 +428,8 @@ public: void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); void generate_discard(fs_inst *inst); + void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src); + void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void emit_dummy_fs(); void emit_interpolation(); @@ -1496,6 +1498,69 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) BRW_SAMPLER_SIMD_MODE_SIMD8); } + +/* For OPCODE_DDX and OPCODE_DDY, per channel of output we've got input + * looking like: + * + * arg0: ss0.tl ss0.tr ss0.bl ss0.br ss1.tl ss1.tr ss1.bl ss1.br + * + * and we're trying to produce: + * + * DDX DDY + * dst: (ss0.tr - ss0.tl) (ss0.tl - ss0.bl) + * (ss0.tr - ss0.tl) (ss0.tr - ss0.br) + * (ss0.br - ss0.bl) (ss0.tl - ss0.bl) + * (ss0.br - ss0.bl) (ss0.tr - ss0.br) + * (ss1.tr - ss1.tl) (ss1.tl - ss1.bl) + * (ss1.tr - ss1.tl) (ss1.tr - ss1.br) + * (ss1.br - ss1.bl) (ss1.tl - ss1.bl) + * (ss1.br - ss1.bl) (ss1.tr - ss1.br) + * + * and add another set of two more subspans if in 16-pixel dispatch mode. + * + * For DDX, it ends up being easy: width = 2, horiz=0 gets us the same result + * for each pair, and vertstride = 2 jumps us 2 elements after processing a + * pair. But for DDY, it's harder, as we want to produce the pairs swizzled + * between each other. We could probably do it like ddx and swizzle the right + * order later, but bail for now and just produce + * ((ss0.tl - ss0.bl)x4 (ss1.tl - ss1.bl)x4) + */ +void +fs_visitor::generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src) +{ + struct brw_reg src0 = brw_reg(src.file, src.nr, 1, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_2, + BRW_WIDTH_2, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + struct brw_reg src1 = brw_reg(src.file, src.nr, 0, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_2, + BRW_WIDTH_2, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + brw_ADD(p, dst, src0, negate(src1)); +} + +void +fs_visitor::generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src) +{ + struct brw_reg src0 = brw_reg(src.file, src.nr, 0, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_4, + BRW_WIDTH_4, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + struct brw_reg src1 = brw_reg(src.file, src.nr, 2, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_4, + BRW_WIDTH_4, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + brw_ADD(p, dst, src0, negate(src1)); +} + void fs_visitor::generate_discard(fs_inst *inst) { @@ -1795,6 +1860,12 @@ fs_visitor::generate_code() case FS_OPCODE_DISCARD: generate_discard(inst); break; + case FS_OPCODE_DDX: + generate_ddx(inst, dst, src[0]); + break; + case FS_OPCODE_DDY: + generate_ddy(inst, dst, src[0]); + break; case FS_OPCODE_FB_WRITE: generate_fb_write(inst); break; -- cgit v1.2.3 From 82f8e43bfa27b0318b01674e2a273c06becae263 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 28 Sep 2010 02:20:26 +0200 Subject: r300g: code cleanups Some random stuff I had here. 1) Fixed some misleading comments. 2) Removed fake_npot, since it's redundant. 3) lower_texture_rect -> scale_texcoords 4) Reordered and reindented some TEX transform code. --- src/gallium/drivers/r300/r300_fs.c | 55 ++--- src/mesa/drivers/dri/r300/compiler/radeon_code.h | 16 +- .../drivers/dri/r300/compiler/radeon_program_tex.c | 265 ++++++++++----------- 3 files changed, 156 insertions(+), 180 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index b8dab88ef09..3f89987897d 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -150,12 +150,16 @@ static void get_external_state( unsigned char *swizzle; for (i = 0; i < texstate->sampler_state_count; i++) { - struct r300_sampler_state* s = texstate->sampler_states[i]; + struct r300_sampler_state *s = texstate->sampler_states[i]; + struct r300_sampler_view *v = texstate->sampler_views[i]; + struct r300_texture *t; - if (!s) { + if (!s || !v) { continue; } + t = r300_texture(texstate->sampler_views[i]->base.texture); + if (s->state.compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { state->unit[i].compare_mode_enabled = 1; @@ -176,34 +180,25 @@ static void get_external_state( state->unit[i].non_normalized_coords = !s->state.normalized_coords; - if (texstate->sampler_views[i]) { - struct r300_texture *t; - t = (struct r300_texture*)texstate->sampler_views[i]->base.texture; - - /* XXX this should probably take into account STR, not just S. */ - if (t->desc.is_npot) { - switch (s->state.wrap_s) { - case PIPE_TEX_WRAP_REPEAT: - state->unit[i].wrap_mode = RC_WRAP_REPEAT; - state->unit[i].fake_npot = TRUE; - break; - - case PIPE_TEX_WRAP_MIRROR_REPEAT: - state->unit[i].wrap_mode = RC_WRAP_MIRRORED_REPEAT; - state->unit[i].fake_npot = TRUE; - break; - - case PIPE_TEX_WRAP_MIRROR_CLAMP: - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - state->unit[i].wrap_mode = RC_WRAP_MIRRORED_CLAMP; - state->unit[i].fake_npot = TRUE; - break; - - default: - state->unit[i].wrap_mode = RC_WRAP_NONE; - break; - } + /* XXX this should probably take into account STR, not just S. */ + if (t->desc.is_npot) { + switch (s->state.wrap_s) { + case PIPE_TEX_WRAP_REPEAT: + state->unit[i].wrap_mode = RC_WRAP_REPEAT; + break; + + case PIPE_TEX_WRAP_MIRROR_REPEAT: + state->unit[i].wrap_mode = RC_WRAP_MIRRORED_REPEAT; + break; + + case PIPE_TEX_WRAP_MIRROR_CLAMP: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + state->unit[i].wrap_mode = RC_WRAP_MIRRORED_CLAMP; + break; + + default: + state->unit[i].wrap_mode = RC_WRAP_NONE; } } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index f76676fae8e..53cc1bd77e9 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -126,11 +126,7 @@ struct r300_fragment_program_external_state { struct { /** * If the sampler is used as a shadow sampler, - * this field is: - * 0 - GL_LUMINANCE - * 1 - GL_INTENSITY - * 2 - GL_ALPHA - * depending on the depth texture mode. + * this field contains swizzle depending on the depth texture mode. */ unsigned depth_texture_swizzle:12; @@ -150,13 +146,9 @@ struct r300_fragment_program_external_state { unsigned compare_mode_enabled : 1; /** - * If the sampler needs to fake NPOT, this field is set. - */ - unsigned fake_npot : 1; - - /** - * If the sampler will recieve non-normalized coords, - * this field is set. + * If the sampler will receive non-normalized coords, + * this field is set. The scaling factor is given by + * RC_STATE_R300_TEXRECT_FACTOR. */ unsigned non_normalized_coords : 1; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index ddce590ee66..7ce5fb8639f 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Corbin Simpson + * Copyright (C) 2010 Marek Olšák * * All Rights Reserved. * @@ -46,31 +47,28 @@ static struct rc_src_register shadow_ambient(struct r300_fragment_program_compil return reg; } -static void lower_texture_rect(struct r300_fragment_program_compiler *compiler, - struct rc_instruction *inst) +static void scale_texcoords(struct r300_fragment_program_compiler *compiler, + struct rc_instruction *inst, + unsigned state_constant) { - struct rc_instruction *inst_rect; - unsigned temp = rc_find_free_temporary(&compiler->Base); + struct rc_instruction *inst_mov; - if (inst->U.I.TexSrcTarget == RC_TEXTURE_RECT || - compiler->state.unit[inst->U.I.TexSrcUnit].non_normalized_coords) { - inst_rect = rc_insert_new_instruction(&compiler->Base, inst->Prev); + unsigned temp = rc_find_free_temporary(&compiler->Base); - inst_rect->U.I.Opcode = RC_OPCODE_MUL; - inst_rect->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_rect->U.I.DstReg.Index = temp; - inst_rect->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_rect->U.I.SrcReg[1].File = RC_FILE_CONSTANT; - inst_rect->U.I.SrcReg[1].Index = - rc_constants_add_state(&compiler->Base.Program.Constants, - RC_STATE_R300_TEXRECT_FACTOR, inst->U.I.TexSrcUnit); + inst_mov = rc_insert_new_instruction(&compiler->Base, inst->Prev); - reset_srcreg(&inst->U.I.SrcReg[0]); - inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->U.I.SrcReg[0].Index = temp; + inst_mov->U.I.Opcode = RC_OPCODE_MUL; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mov->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + inst_mov->U.I.SrcReg[1].Index = + rc_constants_add_state(&compiler->Base.Program.Constants, + state_constant, inst->U.I.TexSrcUnit); - inst->U.I.TexSrcTarget = RC_TEXTURE_2D; - } + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; } /** @@ -88,6 +86,9 @@ int radeonTransformTEX( { struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)data; + rc_wrap_mode wrapmode = compiler->state.unit[inst->U.I.TexSrcUnit].wrap_mode; + int is_rect = inst->U.I.TexSrcTarget == RC_TEXTURE_RECT || + compiler->state.unit[inst->U.I.TexSrcUnit].non_normalized_coords; if (inst->U.I.Opcode != RC_OPCODE_TEX && inst->U.I.Opcode != RC_OPCODE_TXB && @@ -141,6 +142,7 @@ int radeonTransformTEX( inst_rcp->U.I.DstReg.Index = tmp_recip_w; inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + /* XXX do not take W, instead, see which channel is mapped to W. */ inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; } @@ -206,11 +208,15 @@ int radeonTransformTEX( } } - /* Texture wrap modes don't work on NPOT textures or texrects. - * - * The game plan is simple. We have two flags, fake_npot and - * non_normalized_coords, as well as a tex target. The RECT tex target - * will make the emitted code use non-scaled texcoords. + /* R300 cannot sample from rectangles and the wrap mode fallback needs + * normalized coordinates anyway. */ + if (inst->U.I.Opcode != RC_OPCODE_KIL && + is_rect && (!c->is_r500 || wrapmode != RC_WRAP_NONE)) { + scale_texcoords(compiler, inst, RC_STATE_R300_TEXRECT_FACTOR); + inst->U.I.TexSrcTarget = RC_TEXTURE_2D; + } + + /* Texture wrap modes don't work on NPOT textures. * * Non-wrapped/clamped texcoords with NPOT are free in HW. Repeat and * mirroring are not. If we need to repeat, we do: @@ -235,128 +241,111 @@ int radeonTransformTEX( * ~ C & M. ;) */ if (inst->U.I.Opcode != RC_OPCODE_KIL && - (inst->U.I.TexSrcTarget == RC_TEXTURE_RECT || - compiler->state.unit[inst->U.I.TexSrcUnit].fake_npot || - compiler->state.unit[inst->U.I.TexSrcUnit].non_normalized_coords)) { - rc_wrap_mode wrapmode = compiler->state.unit[inst->U.I.TexSrcUnit].wrap_mode; - - /* R300 cannot sample from rectangles. */ - if (!c->is_r500) { - lower_texture_rect(compiler, inst); - } - - if (compiler->state.unit[inst->U.I.TexSrcUnit].fake_npot && - wrapmode != RC_WRAP_NONE) { + wrapmode != RC_WRAP_NONE) { + struct rc_instruction *inst_mov; + unsigned temp = rc_find_free_temporary(c); + + if (wrapmode == RC_WRAP_REPEAT) { + /* Both instructions will be paired up. */ + struct rc_instruction *inst_frc = rc_insert_new_instruction(c, inst->Prev); + + inst_frc->U.I.Opcode = RC_OPCODE_FRC; + inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_frc->U.I.DstReg.Index = temp; + inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_frc->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + } else if (wrapmode == RC_WRAP_MIRRORED_REPEAT) { + /* + * Function: + * f(v) = 1 - abs(frac(v * 0.5) * 2 - 1) + * + * Code: + * MUL temp, src0, 0.5 + * FRC temp, temp + * MAD temp, temp, 2, -1 + * ADD temp, 1, -abs(temp) + */ + + struct rc_instruction *inst_mul, *inst_frc, *inst_mad, *inst_add; + unsigned two, two_swizzle; + + inst_mul = rc_insert_new_instruction(c, inst->Prev); + + inst_mul->U.I.Opcode = RC_OPCODE_MUL; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = temp; + inst_mul->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_HHHH; + + inst_frc = rc_insert_new_instruction(c, inst->Prev); + + inst_frc->U.I.Opcode = RC_OPCODE_FRC; + inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_frc->U.I.DstReg.Index = temp; + inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_frc->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_frc->U.I.SrcReg[0].Index = temp; + inst_frc->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; + + two = rc_constants_add_immediate_scalar(&c->Program.Constants, 2, &two_swizzle); + inst_mad = rc_insert_new_instruction(c, inst->Prev); + + inst_mad->U.I.Opcode = RC_OPCODE_MAD; + inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mad->U.I.DstReg.Index = temp; + inst_mad->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mad->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[0].Index = temp; + inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; + inst_mad->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + inst_mad->U.I.SrcReg[1].Index = two; + inst_mad->U.I.SrcReg[1].Swizzle = two_swizzle; + inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_1111; + inst_mad->U.I.SrcReg[2].Negate = RC_MASK_XYZ; + + inst_add = rc_insert_new_instruction(c, inst->Prev); + + inst_add->U.I.Opcode = RC_OPCODE_ADD; + inst_add->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_add->U.I.DstReg.Index = temp; + inst_add->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; + inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_add->U.I.SrcReg[1].Index = temp; + inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZ0; + inst_add->U.I.SrcReg[1].Abs = 1; + inst_add->U.I.SrcReg[1].Negate = RC_MASK_XYZ; + } else if (wrapmode == RC_WRAP_MIRRORED_CLAMP) { + /* + * Mirrored clamp modes are bloody simple, we just use abs + * to mirror [0, 1] into [-1, 0]. This works for + * all modes i.e. CLAMP, CLAMP_TO_EDGE, and CLAMP_TO_BORDER. + */ struct rc_instruction *inst_mov; - unsigned temp = rc_find_free_temporary(c); - /* For NPOT fallback, we need normalized coordinates anyway. */ - if (c->is_r500) { - lower_texture_rect(compiler, inst); - } - - if (wrapmode == RC_WRAP_REPEAT) { - /* Both instructions will be paired up. */ - struct rc_instruction *inst_frc = rc_insert_new_instruction(c, inst->Prev); - - inst_frc->U.I.Opcode = RC_OPCODE_FRC; - inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_frc->U.I.DstReg.Index = temp; - inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_frc->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - } else if (wrapmode == RC_WRAP_MIRRORED_REPEAT) { - /* - * Function: - * f(v) = 1 - abs(frac(v * 0.5) * 2 - 1) - * - * Code: - * MUL temp, src0, 0.5 - * FRC temp, temp - * MAD temp, temp, 2, -1 - * ADD temp, 1, -abs(temp) - */ - - struct rc_instruction *inst_mul, *inst_frc, *inst_mad, *inst_add; - unsigned two, two_swizzle; - - inst_mul = rc_insert_new_instruction(c, inst->Prev); - - inst_mul->U.I.Opcode = RC_OPCODE_MUL; - inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mul->U.I.DstReg.Index = temp; - inst_mul->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_HHHH; - - inst_frc = rc_insert_new_instruction(c, inst->Prev); - - inst_frc->U.I.Opcode = RC_OPCODE_FRC; - inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_frc->U.I.DstReg.Index = temp; - inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_frc->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_frc->U.I.SrcReg[0].Index = temp; - inst_frc->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; - - two = rc_constants_add_immediate_scalar(&c->Program.Constants, 2, &two_swizzle); - inst_mad = rc_insert_new_instruction(c, inst->Prev); - - inst_mad->U.I.Opcode = RC_OPCODE_MAD; - inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->U.I.DstReg.Index = temp; - inst_mad->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mad->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_mad->U.I.SrcReg[0].Index = temp; - inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; - inst_mad->U.I.SrcReg[1].File = RC_FILE_CONSTANT; - inst_mad->U.I.SrcReg[1].Index = two; - inst_mad->U.I.SrcReg[1].Swizzle = two_swizzle; - inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_1111; - inst_mad->U.I.SrcReg[2].Negate = RC_MASK_XYZ; - - inst_add = rc_insert_new_instruction(c, inst->Prev); - - inst_add->U.I.Opcode = RC_OPCODE_ADD; - inst_add->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_add->U.I.DstReg.Index = temp; - inst_add->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; - inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst_add->U.I.SrcReg[1].Index = temp; - inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZ0; - inst_add->U.I.SrcReg[1].Abs = 1; - inst_add->U.I.SrcReg[1].Negate = RC_MASK_XYZ; - } else if (wrapmode == RC_WRAP_MIRRORED_CLAMP) { - /* - * Mirrored clamp modes are bloody simple, we just use abs - * to mirror [0, 1] into [-1, 0]. This works for - * all modes i.e. CLAMP, CLAMP_TO_EDGE, and CLAMP_TO_BORDER. - */ - struct rc_instruction *inst_mov; - - inst_mov = rc_insert_new_instruction(c, inst->Prev); - - inst_mov->U.I.Opcode = RC_OPCODE_MOV; - inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mov->U.I.DstReg.Index = temp; - inst_mov->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mov->U.I.SrcReg[0].Abs = 1; - } - - /* Preserve W for TXP/TXB. */ inst_mov = rc_insert_new_instruction(c, inst->Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->U.I.DstReg.Index = temp; - inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_XYZ; inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - - reset_srcreg(&inst->U.I.SrcReg[0]); - inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->U.I.SrcReg[0].Index = temp; + inst_mov->U.I.SrcReg[0].Abs = 1; } + + /* Preserve W for TXP/TXB. */ + inst_mov = rc_insert_new_instruction(c, inst->Prev); + + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; } /* Cannot write texture to output registers (all chips) or with masks (non-r500) */ -- cgit v1.2.3 From 6f747567ec775f37d43b35d957e72334c511e8bc Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 28 Sep 2010 02:28:25 +0200 Subject: r300/compiler: fix projective mapping of 2D NPOT textures NOTE: This is a candidate for the 7.9 branch. --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 7ce5fb8639f..09cb8b27f65 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -71,6 +71,39 @@ static void scale_texcoords(struct r300_fragment_program_compiler *compiler, inst->U.I.SrcReg[0].Index = temp; } +static void projective_divide(struct r300_fragment_program_compiler *compiler, + struct rc_instruction *inst) +{ + struct rc_instruction *inst_mul, *inst_rcp; + + unsigned temp = rc_find_free_temporary(&compiler->Base); + + inst_rcp = rc_insert_new_instruction(&compiler->Base, inst->Prev); + inst_rcp->U.I.Opcode = RC_OPCODE_RCP; + inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_rcp->U.I.DstReg.Index = temp; + inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; + inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + /* Because the input can be arbitrarily swizzled, + * read the component mapped to W. */ + inst_rcp->U.I.SrcReg[0].Swizzle = + RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); + + inst_mul = rc_insert_new_instruction(&compiler->Base, inst->Prev); + inst_mul->U.I.Opcode = RC_OPCODE_MUL; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = temp; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_mul->U.I.SrcReg[1].Index = temp; + inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.Opcode = RC_OPCODE_TEX; + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; +} + /** * Transform TEX, TXP, TXB, and KIL instructions in the following ways: * - implement texture compare (shadow extensions) @@ -216,6 +249,12 @@ int radeonTransformTEX( inst->U.I.TexSrcTarget = RC_TEXTURE_2D; } + /* Divide by W if needed. */ + if (inst->U.I.Opcode == RC_OPCODE_TXP && + (wrapmode == RC_WRAP_REPEAT || wrapmode == RC_WRAP_MIRRORED_REPEAT)) { + projective_divide(compiler, inst); + } + /* Texture wrap modes don't work on NPOT textures. * * Non-wrapped/clamped texcoords with NPOT are free in HW. Repeat and -- cgit v1.2.3 From c2ea7ffb0a9368571bb62038aeb318307afedb40 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 28 Sep 2010 04:30:32 +0200 Subject: r300/compiler: do not use copy propagation if SaturateMode is used NOTE: This is a candidate for the 7.9 branch. --- src/mesa/drivers/dri/r300/compiler/radeon_optimize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index e2889302e69..3be50b93e4b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -163,7 +163,8 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i if (inst_mov->U.I.DstReg.File != RC_FILE_TEMPORARY || inst_mov->U.I.DstReg.RelAddr || - inst_mov->U.I.WriteALUResult) + inst_mov->U.I.WriteALUResult || + inst_mov->U.I.SaturateMode) return; memset(&s, 0, sizeof(s)); -- cgit v1.2.3 From 7128e1625bea502b9bf083f14606d679c90222a6 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 28 Sep 2010 03:58:23 +0200 Subject: r300/compiler: fix shadow sampling with swizzled coords Taking the W component from coords directly ignores swizzling. Instead, take the component which is mapped to W in the TEX instruction parameter. The same for Z. NOTE: This is a candidate for the 7.9 branch. --- src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 09cb8b27f65..de988b7c10c 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -175,17 +175,18 @@ int radeonTransformTEX( inst_rcp->U.I.DstReg.Index = tmp_recip_w; inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - /* XXX do not take W, instead, see which channel is mapped to W. */ - inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; + inst_rcp->U.I.SrcReg[0].Swizzle = + RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); } - /* Perspective-divide r by W (if it's TXP) and add the texture sample (see below). */ + /* Perspective-divide Z by W (if it's TXP) and add the texture sample (see below). */ tmp_sum = rc_find_free_temporary(c); inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mad->U.I.DstReg.Index = tmp_sum; inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; + inst_mad->U.I.SrcReg[0].Swizzle = + RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 2)); if (inst->U.I.Opcode == RC_OPCODE_TXP) { inst_mad->U.I.Opcode = RC_OPCODE_MAD; inst_mad->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; -- cgit v1.2.3 From 13359e6a4b732335cdd8da48276960d0b176ffe3 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 29 Aug 2010 03:48:42 +0200 Subject: r300g: add support for 3D NPOT textures without mipmapping The driver actually creates a 3D texture aligned to POT and does all the magic with texture coordinates in the fragment shader. It first emulates REPEAT and MIRRORED wrap modes in the fragment shader to get the coordinates into the range [0, 1]. (already done for 2D NPOT) Then it scales them to get the coordinates of the NPOT subtexture. NPOT textures are now less of a lie and we can at least display something meaningful even for the 3D ones. Supported wrap modes: - REPEAT - MIRRORED_REPEAT - CLAMP_TO_EDGE (NEAREST filtering only) - MIRROR_CLAMP_TO_EDGE (NEAREST filtering only) - The behavior of other CLAMP modes is undefined on borders, but they usually give results very close to CLAMP_TO_EDGE with mirroring working perfectly. This fixes: - piglit/fbo-3d - piglit/tex3d-npot --- src/gallium/drivers/r300/r300_context.h | 7 +++++ src/gallium/drivers/r300/r300_emit.c | 16 +++++++--- src/gallium/drivers/r300/r300_fs.c | 3 ++ src/gallium/drivers/r300/r300_texture.c | 15 ++++------ src/gallium/drivers/r300/r300_texture_desc.c | 35 ++++++++++++++-------- src/mesa/drivers/dri/r300/compiler/radeon_code.h | 9 +++++- .../drivers/dri/r300/compiler/radeon_program_tex.c | 32 +++++++++++++++++++- 7 files changed, 90 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 1927370325e..b59bc002610 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -336,6 +336,13 @@ struct r300_texture_desc { /* Parent class. */ struct u_resource b; + /* Width, height, and depth. + * Most of the time, these are equal to pipe_texture::width0, height0, + * and depth0. However, NPOT 3D textures must have dimensions aligned + * to POT, and this is the only case when these variables differ from + * pipe_texture. */ + unsigned width0, height0, depth0; + /* Buffer tiling. * Macrotiling is specified per-level because small mipmaps cannot * be macrotiled. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index db783ff0add..3a1085d2dc5 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -89,7 +89,7 @@ static const float * get_rc_constant_state( { struct r300_textures_state* texstate = r300->textures_state.state; static float vec[4] = { 0.0, 0.0, 0.0, 1.0 }; - struct pipe_resource *tex; + struct r300_texture *tex; assert(constant->Type == RC_CONSTANT_STATE); @@ -97,9 +97,17 @@ static const float * get_rc_constant_state( /* Factor for converting rectangle coords to * normalized coords. Should only show up on non-r500. */ case RC_STATE_R300_TEXRECT_FACTOR: - tex = texstate->sampler_views[constant->u.State[1]]->base.texture; - vec[0] = 1.0 / tex->width0; - vec[1] = 1.0 / tex->height0; + tex = r300_texture(texstate->sampler_views[constant->u.State[1]]->base.texture); + vec[0] = 1.0 / tex->desc.width0; + vec[1] = 1.0 / tex->desc.height0; + break; + + case RC_STATE_R300_TEXSCALE_FACTOR: + tex = r300_texture(texstate->sampler_views[constant->u.State[1]]->base.texture); + /* Add a small number to the texture size to work around rounding errors in hw. */ + vec[0] = tex->desc.b.b.width0 / (tex->desc.width0 + 0.001f); + vec[1] = tex->desc.b.b.height0 / (tex->desc.height0 + 0.001f); + vec[2] = tex->desc.b.b.depth0 / (tex->desc.depth0 + 0.001f); break; case RC_STATE_R300_VIEWPORT_SCALE: diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 3f89987897d..d9d4a9304df 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -200,6 +200,9 @@ static void get_external_state( default: state->unit[i].wrap_mode = RC_WRAP_NONE; } + + if (t->desc.b.b.target == PIPE_TEXTURE_3D) + state->unit[i].clamp_and_scale_before_fetch = TRUE; } } } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 34105aa4bcd..a7911c6fcc4 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -556,18 +556,15 @@ void r300_texture_setup_format_state(struct r300_screen *screen, out->tile_config = 0; /* Set sampler state. */ - out->format0 = R300_TX_WIDTH((u_minify(pt->width0, level) - 1) & 0x7ff) | - R300_TX_HEIGHT((u_minify(pt->height0, level) - 1) & 0x7ff); + out->format0 = + R300_TX_WIDTH((u_minify(desc->width0, level) - 1) & 0x7ff) | + R300_TX_HEIGHT((u_minify(desc->height0, level) - 1) & 0x7ff) | + R300_TX_DEPTH(util_logbase2(u_minify(desc->depth0, level)) & 0xf); if (desc->uses_stride_addressing) { /* rectangles love this */ out->format0 |= R300_TX_PITCH_EN; out->format2 = (desc->stride_in_pixels[level] - 1) & 0x1fff; - } else { - /* Power of two textures (3D, mipmaps, and no pitch), - * also NPOT textures with a width being POT. */ - out->format0 |= - R300_TX_DEPTH(util_logbase2(u_minify(pt->depth0, level)) & 0xf); } if (pt->target == PIPE_TEXTURE_CUBE) { @@ -580,10 +577,10 @@ void r300_texture_setup_format_state(struct r300_screen *screen, /* large textures on r500 */ if (is_r500) { - if (pt->width0 > 2048) { + if (desc->width0 > 2048) { out->format2 |= R500_TXWIDTH_BIT11; } - if (pt->height0 > 2048) { + if (desc->height0 > 2048) { out->format2 |= R500_TXHEIGHT_BIT11; } } diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 6a1030f8eee..a49029e1e92 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -91,9 +91,9 @@ static boolean r300_texture_macro_switch(struct r300_texture_desc *desc, tile = r300_get_pixel_alignment(desc->b.b.format, desc->b.b.nr_samples, desc->microtile, R300_BUFFER_TILED, dim); if (dim == DIM_WIDTH) { - texdim = u_minify(desc->b.b.width0, level); + texdim = u_minify(desc->width0, level); } else { - texdim = u_minify(desc->b.b.height0, level); + texdim = u_minify(desc->height0, level); } /* See TX_FILTER1_n.MACRO_SWITCH. */ @@ -124,7 +124,7 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, return 0; } - width = u_minify(desc->b.b.width0, level); + width = u_minify(desc->width0, level); if (util_format_is_plain(desc->b.b.format)) { tile_width = r300_get_pixel_alignment(desc->b.b.format, @@ -172,7 +172,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture_desc *desc, { unsigned height, tile_height; - height = u_minify(desc->b.b.height0, level); + height = u_minify(desc->height0, level); if (util_format_is_plain(desc->b.b.format)) { tile_height = r300_get_pixel_alignment(desc->b.b.format, @@ -237,7 +237,7 @@ static void r300_texture_3d_fix_mipmapping(struct r300_screen *screen, r300_texture_get_nblocksy(desc, i, FALSE); } - size *= desc->b.b.depth0; + size *= desc->depth0; desc->size_in_bytes = size; } } @@ -292,7 +292,7 @@ static void r300_setup_miptree(struct r300_screen *screen, if (base->target == PIPE_TEXTURE_CUBE) size = layer_size * 6; else - size = layer_size * u_minify(base->depth0, i); + size = layer_size * u_minify(desc->depth0, i); desc->offset_in_bytes[i] = desc->size_in_bytes; desc->size_in_bytes = desc->offset_in_bytes[i] + size; @@ -303,8 +303,8 @@ static void r300_setup_miptree(struct r300_screen *screen, SCREEN_DBG(screen, DBG_TEXALLOC, "r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes) %d bytes total, macrotiled %s\n", - i, u_minify(base->width0, i), u_minify(base->height0, i), - u_minify(base->depth0, i), stride, desc->size_in_bytes, + i, u_minify(desc->width0, i), u_minify(desc->height0, i), + u_minify(desc->depth0, i), stride, desc->size_in_bytes, desc->macrotile[i] ? "TRUE" : "FALSE"); } } @@ -313,14 +313,14 @@ static void r300_setup_flags(struct r300_texture_desc *desc) { desc->uses_stride_addressing = !util_is_power_of_two(desc->b.b.width0) || - !util_is_power_of_two(desc->b.b.height0) || (desc->stride_in_bytes_override && stride_to_width(desc->b.b.format, desc->stride_in_bytes_override) != desc->b.b.width0); desc->is_npot = desc->uses_stride_addressing || - !util_is_power_of_two(desc->b.b.height0); + !util_is_power_of_two(desc->b.b.height0) || + !util_is_power_of_two(desc->b.b.depth0); } static void r300_setup_cbzb_flags(struct r300_screen *rscreen, @@ -416,9 +416,21 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen, { desc->b.b = *base; desc->b.b.screen = &rscreen->screen; - desc->stride_in_bytes_override = stride_in_bytes_override; + desc->width0 = base->width0; + desc->height0 = base->height0; + desc->depth0 = base->depth0; + + r300_setup_flags(desc); + + /* Align a 3D NPOT texture to POT. */ + if (base->target == PIPE_TEXTURE_3D && desc->is_npot) { + desc->width0 = util_next_power_of_two(desc->width0); + desc->height0 = util_next_power_of_two(desc->height0); + desc->depth0 = util_next_power_of_two(desc->depth0); + } + /* Setup tiling. */ if (microtile == R300_BUFFER_SELECT_LAYOUT || macrotile == R300_BUFFER_SELECT_LAYOUT) { r300_setup_tiling(rscreen, desc); @@ -428,7 +440,6 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen, assert(desc->b.b.last_level == 0); } - r300_setup_flags(desc); r300_setup_cbzb_flags(rscreen, desc); /* Setup the miptree description. */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 53cc1bd77e9..2dd9c5e4bd3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -60,6 +60,7 @@ enum { RC_STATE_R300_WINDOW_DIMENSION, RC_STATE_R300_TEXRECT_FACTOR, + RC_STATE_R300_TEXSCALE_FACTOR, RC_STATE_R300_VIEWPORT_SCALE, RC_STATE_R300_VIEWPORT_OFFSET }; @@ -158,7 +159,13 @@ struct r300_fragment_program_external_state { * If this field is \ref RC_WRAP_NONE (aka 0), no wrapping maths * will be performed on the coordinates. */ - unsigned wrap_mode : 2; + unsigned wrap_mode : 3; + + /** + * The coords are scaled after applying the wrap mode emulation + * and right before texture fetch. The scaling factor is given by + * RC_STATE_R300_TEXSCALE_FACTOR. */ + unsigned clamp_and_scale_before_fetch : 1; } unit[16]; }; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index de988b7c10c..530afa5e08e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -252,7 +252,8 @@ int radeonTransformTEX( /* Divide by W if needed. */ if (inst->U.I.Opcode == RC_OPCODE_TXP && - (wrapmode == RC_WRAP_REPEAT || wrapmode == RC_WRAP_MIRRORED_REPEAT)) { + (wrapmode == RC_WRAP_REPEAT || wrapmode == RC_WRAP_MIRRORED_REPEAT || + compiler->state.unit[inst->U.I.TexSrcUnit].clamp_and_scale_before_fetch)) { projective_divide(compiler, inst); } @@ -388,6 +389,35 @@ int radeonTransformTEX( inst->U.I.SrcReg[0].Index = temp; } + if (inst->U.I.Opcode != RC_OPCODE_KIL && + compiler->state.unit[inst->U.I.TexSrcUnit].clamp_and_scale_before_fetch) { + struct rc_instruction *inst_mov; + unsigned temp = rc_find_free_temporary(c); + + /* Saturate XYZ. */ + inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.SaturateMode = RC_SATURATE_ZERO_ONE; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + /* Copy W. */ + inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; + + scale_texcoords(compiler, inst, RC_STATE_R300_TEXSCALE_FACTOR); + } + /* Cannot write texture to output registers (all chips) or with masks (non-r500) */ if (inst->U.I.Opcode != RC_OPCODE_KIL && (inst->U.I.DstReg.File != RC_FILE_TEMPORARY || -- cgit v1.2.3 From e4fd65e9d752a021c8fcd23d36fbea53933761a6 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 28 Sep 2010 05:07:23 +0200 Subject: r300g: fix swizzling of texture border color NOTE: This is a candidate for the 7.9 branch. --- src/gallium/drivers/r300/r300_state_derived.c | 41 +++++---------------------- 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 7b7f59a9a62..904736ef06d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -581,46 +581,19 @@ static void r300_update_rs_block(struct r300_context *r300) } static uint32_t r300_get_border_color(enum pipe_format format, - const unsigned char swizzle_view[4], const float border[4]) { const struct util_format_description *desc; - unsigned char swizzle[4]; - unsigned i; - float border_swizzled[4]; + float border_swizzled[4] = { + border[2], + border[1], + border[0], + border[3] + }; uint32_t r; desc = util_format_description(format); - /* Combine the swizzles. */ - for (i = 0; i < 4; i++) { - swizzle[i] = swizzle_view[i] <= UTIL_FORMAT_SWIZZLE_W ? - desc->swizzle[swizzle_view[i]] : swizzle_view[i]; - } - - /* Apply swizzling. */ - for (i = 0; i < 4; i++) { - switch (swizzle[i]) { - case UTIL_FORMAT_SWIZZLE_X: - border_swizzled[i] = border[0]; - break; - case UTIL_FORMAT_SWIZZLE_Y: - border_swizzled[i] = border[1]; - break; - case UTIL_FORMAT_SWIZZLE_Z: - border_swizzled[i] = border[2]; - break; - case UTIL_FORMAT_SWIZZLE_W: - border_swizzled[i] = border[3]; - break; - case UTIL_FORMAT_SWIZZLE_0: - border_swizzled[i] = 0; - break; - default: /* 1, NONE */ - border_swizzled[i] = 1; - } - } - /* We don't use util_pack_format because it does not handle the formats * we want, e.g. R4G4B4A4 is non-existent in Gallium. */ switch (desc->channel[0].size) { @@ -695,7 +668,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) /* Set the border color. */ texstate->border_color = - r300_get_border_color(view->base.format, view->swizzle, + r300_get_border_color(view->base.format, sampler->state.border_color); /* determine min/max levels */ -- cgit v1.2.3 From 34dba5f05aa36baecdc655f7f94fed871006d590 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Sep 2010 14:27:22 +1000 Subject: r600g: fix db flush breaking config state --- src/gallium/drivers/r600/r600_state.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 791b39a001e..86f9825b526 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -662,17 +662,17 @@ static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush) surf = rctx->framebuffer->state.framebuffer.zsbuf; - if (!surf) - return 0; - radeon_state_init(flush, rscreen->rw, R600_STATE_DB_FLUSH, 0, 0); - rtex = (struct r600_resource_texture*)surf->texture; - rbuffer = &rtex->resource; - /* just need to the bo to the flush list */ - radeon_ws_bo_reference(rscreen->rw, &flush->bo[0], rbuffer->bo); - flush->placement[0] = RADEON_GEM_DOMAIN_VRAM; - flush->nbo = 1; + if (surf) { + rtex = (struct r600_resource_texture*)surf->texture; + rbuffer = &rtex->resource; + /* just need to the bo to the flush list */ + radeon_ws_bo_reference(rscreen->rw, &flush->bo[0], rbuffer->bo); + flush->placement[0] = RADEON_GEM_DOMAIN_VRAM; + + flush->nbo = 1; + } return radeon_state_pm4(flush); } -- cgit v1.2.3 From 798355d429f3cd6e76bb1d01549c203e443348b6 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 23 Sep 2010 21:15:06 -0700 Subject: r300/compiler: Add more helper functions for iterating through sources rc_for_all_reads_src() and rc_pair_for_all_reads_arg() pass references to instruction sources to the callback so they can be modified directly. --- .../drivers/dri/r300/compiler/radeon_dataflow.c | 125 +++++++++++++++------ .../drivers/dri/r300/compiler/radeon_dataflow.h | 12 ++ 2 files changed, 102 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c index e73700f84a2..a27d395587b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c @@ -29,49 +29,32 @@ #include "radeon_program.h" +struct read_write_mask_data { + void * UserData; + rc_read_write_mask_fn Cb; +}; + static void reads_normal_callback( - rc_read_write_chan_fn cb, + void * userdata, struct rc_instruction * fullinst, - struct rc_src_register src, - void * userdata) + struct rc_src_register * src) { + struct read_write_mask_data * cb_data = userdata; unsigned int refmask = 0; unsigned int chan; for(chan = 0; chan < 4; chan++) { - refmask |= 1 << GET_SWZ(src.Swizzle, chan); + refmask |= 1 << GET_SWZ(src->Swizzle, chan); } refmask &= RC_MASK_XYZW; - if (refmask) - cb(userdata, fullinst, src.File, src.Index, refmask); - - if (refmask && src.RelAddr) - cb(userdata, fullinst, RC_FILE_ADDRESS, 0, RC_MASK_X); -} - -static void reads_normal(struct rc_instruction * fullinst, rc_read_write_chan_fn cb, void * userdata) -{ - struct rc_sub_instruction * inst = &fullinst->U.I; - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); - - for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { - - if (inst->SrcReg[src].File == RC_FILE_NONE) - return; + if (refmask) { + cb_data->Cb(cb_data->UserData, fullinst, src->File, + src->Index, refmask); + } - if (inst->SrcReg[src].File == RC_FILE_PRESUB) { - unsigned int i; - unsigned int srcp_regs = rc_presubtract_src_reg_count( - inst->PreSub.Opcode); - for( i = 0; i < srcp_regs; i++) { - reads_normal_callback(cb, fullinst, - inst->PreSub.SrcReg[i], - userdata); - } - } else { - reads_normal_callback(cb, fullinst, - inst->SrcReg[src], userdata); - } + if (refmask && src->RelAddr) { + cb_data->Cb(cb_data->UserData, fullinst, RC_FILE_ADDRESS, 0, + RC_MASK_X); } } @@ -112,7 +95,7 @@ static void pair_get_src_refmasks(unsigned int * refmasks, } } -static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata) +static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata) { struct rc_pair_instruction * inst = &fullinst->U.P; unsigned int refmasks[3] = { 0, 0, 0 }; @@ -143,6 +126,74 @@ static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn } } +static void pair_sub_for_all_args( + struct rc_instruction * fullinst, + struct rc_pair_sub_instruction * sub, + rc_pair_read_arg_fn cb, + void * userdata) +{ + int i; + const struct rc_opcode_info * info = rc_get_opcode_info(sub->Opcode); + + for(i = 0; i < info->NumSrcRegs; i++) { + cb(userdata, fullinst, &sub->Arg[i]); + } +} + +/* This function calls the callback function (cb) for each source used by + * the instruction. + * */ +void rc_for_all_reads_src( + struct rc_instruction * inst, + rc_read_src_fn cb, + void * userdata) +{ + const struct rc_opcode_info * opcode = + rc_get_opcode_info(inst->U.I.Opcode); + + /* This function only works with normal instructions. */ + if (inst->Type != RC_INSTRUCTION_NORMAL) { + assert(0); + return; + } + + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + + if (inst->U.I.SrcReg[src].File == RC_FILE_NONE) + continue; + + if (inst->U.I.SrcReg[src].File == RC_FILE_PRESUB) { + unsigned int i; + unsigned int srcp_regs = rc_presubtract_src_reg_count( + inst->U.I.PreSub.Opcode); + for( i = 0; i < srcp_regs; i++) { + cb(userdata, inst, &inst->U.I.PreSub.SrcReg[i]); + } + } else { + cb(userdata, inst, &inst->U.I.SrcReg[src]); + } + } +} + +/** + * This function calls the callback function (cb) for each arg of the RGB and + * alpha components. + */ +void rc_pair_for_all_reads_arg( + struct rc_instruction * inst, + rc_pair_read_arg_fn cb, + void * userdata) +{ + /* This function only works with pair instructions. */ + if (inst->Type != RC_INSTRUCTION_PAIR) { + assert(0); + return; + } + + pair_sub_for_all_args(inst, &inst->U.P.RGB, cb, userdata); + pair_sub_for_all_args(inst, &inst->U.P.Alpha, cb, userdata); +} + /** * Calls a callback function for all register reads. * @@ -153,7 +204,11 @@ static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn void rc_for_all_reads_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata) { if (inst->Type == RC_INSTRUCTION_NORMAL) { - reads_normal(inst, cb, userdata); + struct read_write_mask_data cb_data; + cb_data.UserData = userdata; + cb_data.Cb = cb; + + rc_for_all_reads_src(inst, reads_normal_callback, &cb_data); } else { reads_pair(inst, cb, userdata); } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h index 795d9cc2b6d..d10ae3c7b7e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h @@ -33,6 +33,8 @@ struct radeon_compiler; struct rc_instruction; struct rc_swizzle_caps; +struct rc_src_register; +struct rc_pair_instruction_arg; /** @@ -49,6 +51,16 @@ typedef void (*rc_read_write_mask_fn)(void * userdata, struct rc_instruction * i void rc_for_all_reads_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata); void rc_for_all_writes_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata); +typedef void (*rc_read_src_fn)(void * userdata, struct rc_instruction * inst, + struct rc_src_register * src); +void rc_for_all_reads_src(struct rc_instruction * inst, rc_read_src_fn cb, + void * userdata); + +typedef void (*rc_pair_read_arg_fn)(void * userdata, + struct rc_instruction * inst, struct rc_pair_instruction_arg * arg); +void rc_pair_for_all_reads_arg(struct rc_instruction * inst, + rc_pair_read_arg_fn cb, void * userdata); + typedef void (*rc_remap_register_fn)(void * userdata, struct rc_instruction * inst, rc_register_file * pfile, unsigned int * pindex); void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, void * userdata); -- cgit v1.2.3 From a716952184a7dcd3d95ea6b0d7c130aa801f1cb6 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sun, 26 Sep 2010 22:16:19 -0700 Subject: r300/compiler: Print immediate values after "dead constants" pass --- src/mesa/drivers/dri/r300/compiler/radeon_code.c | 14 ++++++++++++++ src/mesa/drivers/dri/r300/compiler/radeon_code.h | 1 + .../drivers/dri/r300/compiler/radeon_remove_constants.c | 3 +++ 3 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.c b/src/mesa/drivers/dri/r300/compiler/radeon_code.c index 0eab18c344d..6842fb873bc 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.c @@ -28,6 +28,7 @@ #include "radeon_code.h" #include +#include #include #include "radeon_program.h" @@ -171,3 +172,16 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da return rc_constants_add(c, &constant); } + +void rc_constants_print(struct rc_constant_list * c) +{ + unsigned int i; + for(i = 0; i < c->Count; i++) { + if (c->Constants[i].Type == RC_CONSTANT_IMMEDIATE) { + float * values = c->Constants[i].u.Immediate; + fprintf(stderr, "CONST[%u] = " + "{ %10.4f %10.4f %10.4f %10.4f }\n", + i, values[0],values[1], values[2], values[3]); + } + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 2dd9c5e4bd3..cfb6df2cd79 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -90,6 +90,7 @@ unsigned rc_constants_add(struct rc_constant_list * c, struct rc_constant * cons unsigned rc_constants_add_state(struct rc_constant_list * c, unsigned state1, unsigned state2); unsigned rc_constants_add_immediate_vec4(struct rc_constant_list * c, const float * data); unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float data, unsigned * swizzle); +void rc_constants_print(struct rc_constant_list * c); /** * Compare functions. diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c index d111319d3d9..2e0e4ef898c 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -146,4 +146,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) free(const_used); free(inv_remap_table); + + if (c->Debug) + rc_constants_print(&c->Program.Constants); } -- cgit v1.2.3 From 40d256295cbd038653db15f53211a4946d01aeb8 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 27 Sep 2010 20:35:58 -0700 Subject: r300/compiler: radeon_remove_constants.c: fix indentation --- .../dri/r300/compiler/radeon_remove_constants.c | 150 ++++++++++----------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c index 2e0e4ef898c..7b3468a27ea 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -31,104 +31,104 @@ static void remap_regs(void * userdata, struct rc_instruction * inst, rc_register_file * pfile, unsigned int * pindex) { - unsigned *inv_remap_table = userdata; + unsigned *inv_remap_table = userdata; - if (*pfile == RC_FILE_CONSTANT) { - *pindex = inv_remap_table[*pindex]; - } + if (*pfile == RC_FILE_CONSTANT) { + *pindex = inv_remap_table[*pindex]; + } } void rc_remove_unused_constants(struct radeon_compiler *c, void *user) { unsigned **out_remap_table = (unsigned**)user; - unsigned char *const_used; - unsigned *remap_table; - unsigned *inv_remap_table; - unsigned has_rel_addr = 0; - unsigned is_identity = 1; + unsigned char *const_used; + unsigned *remap_table; + unsigned *inv_remap_table; + unsigned has_rel_addr = 0; + unsigned is_identity = 1; unsigned are_externals_remapped = 0; - struct rc_constant *constants = c->Program.Constants.Constants; + struct rc_constant *constants = c->Program.Constants.Constants; - if (!c->Program.Constants.Count) { - *out_remap_table = NULL; - return; - } + if (!c->Program.Constants.Count) { + *out_remap_table = NULL; + return; + } - const_used = malloc(c->Program.Constants.Count); - memset(const_used, 0, c->Program.Constants.Count); + const_used = malloc(c->Program.Constants.Count); + memset(const_used, 0, c->Program.Constants.Count); /* Pass 1: Mark used constants. */ - for (struct rc_instruction *inst = c->Program.Instructions.Next; - inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); - - /* XXX: This loop and the if statement after it should be - * replaced by a call to one of the rc_for_all_reads_* functions. - * The reason it does not use one of those functions now is - * because none of them have RelAddr as an argument. */ - for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { - if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) { - if (inst->U.I.SrcReg[i].RelAddr) { - has_rel_addr = 1; - } else { - const_used[inst->U.I.SrcReg[i].Index] = 1; - } - } - } - if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE) { + for (struct rc_instruction *inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); + + /* XXX: This loop and the if statement after it should be + * replaced by a call to one of the rc_for_all_reads_* functions. + * The reason it does not use one of those functions now is + * because none of them have RelAddr as an argument. */ + for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) { + if (inst->U.I.SrcReg[i].RelAddr) { + has_rel_addr = 1; + } else { + const_used[inst->U.I.SrcReg[i].Index] = 1; + } + } + } + if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE) { unsigned int i; unsigned int srcp_regs = rc_presubtract_src_reg_count( inst->U.I.PreSub.Opcode); for( i = 0; i < srcp_regs; i++) { - if (inst->U.I.PreSub.SrcReg[i].File == - RC_FILE_CONSTANT) { - const_used[ - inst->U.I.PreSub.SrcReg[i].Index] = 1; - } - } + if (inst->U.I.PreSub.SrcReg[i].File == + RC_FILE_CONSTANT) { + const_used[ + inst->U.I.PreSub.SrcReg[i].Index] = 1; + } + } } - } + } - /* Pass 2: If there is relative addressing, mark all externals as used. */ - if (has_rel_addr) { - for (unsigned i = 0; i < c->Program.Constants.Count; i++) - if (constants[i].Type == RC_CONSTANT_EXTERNAL) - const_used[i] = 1; - } + /* Pass 2: If there is relative addressing, mark all externals as used. */ + if (has_rel_addr) { + for (unsigned i = 0; i < c->Program.Constants.Count; i++) + if (constants[i].Type == RC_CONSTANT_EXTERNAL) + const_used[i] = 1; + } - /* Pass 3: Make the remapping table and remap constants. + /* Pass 3: Make the remapping table and remap constants. * This pass removes unused constants simply by overwriting them by other constants. */ - remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); - inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); - unsigned new_count = 0; + remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); + inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); + unsigned new_count = 0; - for (unsigned i = 0; i < c->Program.Constants.Count; i++) { - if (const_used[i]) { - remap_table[new_count] = i; - inv_remap_table[i] = new_count; + for (unsigned i = 0; i < c->Program.Constants.Count; i++) { + if (const_used[i]) { + remap_table[new_count] = i; + inv_remap_table[i] = new_count; - if (i != new_count) { + if (i != new_count) { if (constants[i].Type == RC_CONSTANT_EXTERNAL) are_externals_remapped = 1; constants[new_count] = constants[i]; - is_identity = 0; - } - new_count++; - } - } + is_identity = 0; + } + new_count++; + } + } /* is_identity ==> new_count == old_count * !is_identity ==> new_count < old_count */ assert( is_identity || new_count < c->Program.Constants.Count); assert(!(has_rel_addr && are_externals_remapped)); - /* Pass 4: Redirect reads of all constants to their new locations. */ - if (!is_identity) { - for (struct rc_instruction *inst = c->Program.Instructions.Next; - inst != &c->Program.Instructions; inst = inst->Next) { - rc_remap_registers(inst, remap_regs, inv_remap_table); - } + /* Pass 4: Redirect reads of all constants to their new locations. */ + if (!is_identity) { + for (struct rc_instruction *inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; inst = inst->Next) { + rc_remap_registers(inst, remap_regs, inv_remap_table); + } } @@ -138,14 +138,14 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) c->Program.Constants.Count = new_count; if (are_externals_remapped) { - *out_remap_table = remap_table; - } else { - *out_remap_table = NULL; - free(remap_table); - } - - free(const_used); - free(inv_remap_table); + *out_remap_table = remap_table; + } else { + *out_remap_table = NULL; + free(remap_table); + } + + free(const_used); + free(inv_remap_table); if (c->Debug) rc_constants_print(&c->Program.Constants); -- cgit v1.2.3 From b3e95dc45ce0cef5a1b17324a02f18f40a506ca8 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 27 Sep 2010 20:51:05 -0700 Subject: r300/compiler: Use rc_for_all_reads_src() in "dead constants" pass --- .../dri/r300/compiler/radeon_remove_constants.c | 51 ++++++++++------------ 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c index 7b3468a27ea..c59161640c3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -28,6 +28,11 @@ #include "radeon_remove_constants.h" #include "radeon_dataflow.h" +struct mark_used_data { + unsigned char * const_used; + unsigned * has_rel_addr; +}; + static void remap_regs(void * userdata, struct rc_instruction * inst, rc_register_file * pfile, unsigned int * pindex) { @@ -38,6 +43,20 @@ static void remap_regs(void * userdata, struct rc_instruction * inst, } } +static void mark_used(void * userdata, struct rc_instruction * inst, + struct rc_src_register * src) +{ + struct mark_used_data * d = userdata; + + if (src->File == RC_FILE_CONSTANT) { + if (src->RelAddr) { + *d->has_rel_addr = 1; + } else { + d->const_used[src->Index] = 1; + } + } +} + void rc_remove_unused_constants(struct radeon_compiler *c, void *user) { unsigned **out_remap_table = (unsigned**)user; @@ -48,6 +67,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) unsigned is_identity = 1; unsigned are_externals_remapped = 0; struct rc_constant *constants = c->Program.Constants.Constants; + struct mark_used_data d; if (!c->Program.Constants.Count) { *out_remap_table = NULL; @@ -57,36 +77,13 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) const_used = malloc(c->Program.Constants.Count); memset(const_used, 0, c->Program.Constants.Count); + d.const_used = const_used; + d.has_rel_addr = &has_rel_addr; + /* Pass 1: Mark used constants. */ for (struct rc_instruction *inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); - - /* XXX: This loop and the if statement after it should be - * replaced by a call to one of the rc_for_all_reads_* functions. - * The reason it does not use one of those functions now is - * because none of them have RelAddr as an argument. */ - for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { - if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) { - if (inst->U.I.SrcReg[i].RelAddr) { - has_rel_addr = 1; - } else { - const_used[inst->U.I.SrcReg[i].Index] = 1; - } - } - } - if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE) { - unsigned int i; - unsigned int srcp_regs = rc_presubtract_src_reg_count( - inst->U.I.PreSub.Opcode); - for( i = 0; i < srcp_regs; i++) { - if (inst->U.I.PreSub.SrcReg[i].File == - RC_FILE_CONSTANT) { - const_used[ - inst->U.I.PreSub.SrcReg[i].Index] = 1; - } - } - } + rc_for_all_reads_src(inst, mark_used, &d); } /* Pass 2: If there is relative addressing, mark all externals as used. */ -- cgit v1.2.3 From 79d56577700a4f4b8628b3b61098763d019f17d4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 28 Sep 2010 00:27:31 -0700 Subject: dri: Add GET_PROGRAM_NAME definition for Mac OS X. --- src/mesa/drivers/dri/common/xmlconfig.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index bde6b23c7cf..0312c072437 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -56,6 +56,9 @@ extern char *program_invocation_name, *program_invocation_short_name; #elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) # include # define GET_PROGRAM_NAME() getprogname() +#elif defined(__APPLE__) +# include +# define GET_PROGRAM_NAME() getprogname() #elif defined(__sun) /* Solaris has getexecname() which returns the full path - return just the basename to match BSD getprogname() */ -- cgit v1.2.3 From a66e9a4d86d227b65874c43fbf9e299c7a26389f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 26 Sep 2010 13:28:51 +0800 Subject: i965: Add support for attribute interpolation on Sandybridge. Things are simpler these days thanks to barycentric interpolation parameters being handed in in the payload. --- src/mesa/drivers/dri/i965/brw_wm.c | 51 +++++++++++++++++++++++++++---- src/mesa/drivers/dri/i965/brw_wm.h | 7 +++-- src/mesa/drivers/dri/i965/brw_wm_emit.c | 12 ++++++-- src/mesa/drivers/dri/i965/brw_wm_fp.c | 26 ++++++++++++++-- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 ++ src/mesa/drivers/dri/i965/gen6_wm_state.c | 2 ++ 6 files changed, 87 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 17ff3e2b2b3..9ca8e709f55 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -279,13 +279,52 @@ static void brw_wm_populate_key( struct brw_context *brw, } } } - - brw_wm_lookup_iz(intel, - line_aa, - lookup, - uses_depth, - key); + if (intel->gen >= 6) { + /* R0-1: masks, pixel X/Y coordinates. */ + key->nr_payload_regs = 2; + /* R2: only for 32-pixel dispatch.*/ + /* R3-4: perspective pixel location barycentric */ + key->nr_payload_regs += 2; + /* R5-6: perspective pixel location bary for dispatch width != 8 */ + if (!fp->isGLSL) { /* dispatch_width != 8 */ + key->nr_payload_regs += 2; + } + /* R7-10: perspective centroid barycentric */ + /* R11-14: perspective sample barycentric */ + /* R15-18: linear pixel location barycentric */ + /* R19-22: linear centroid barycentric */ + /* R23-26: linear sample barycentric */ + + /* R27: interpolated depth if uses source depth */ + if (uses_depth) { + key->source_depth_reg = key->nr_payload_regs; + key->nr_payload_regs++; + if (!fp->isGLSL) { /* dispatch_width != 8 */ + /* R28: interpolated depth if not 8-wide. */ + key->nr_payload_regs++; + } + } + /* R29: interpolated W set if GEN6_WM_USES_SOURCE_W. + */ + if (uses_depth) { + key->source_w_reg = key->nr_payload_regs; + key->nr_payload_regs++; + if (!fp->isGLSL) { /* dispatch_width != 8 */ + /* R30: interpolated W if not 8-wide. */ + key->nr_payload_regs++; + } + } + /* R31: MSAA position offsets. */ + /* R32-: bary for 32-pixel. */ + /* R58-59: interp W for 32-pixel. */ + } else { + brw_wm_lookup_iz(intel, + line_aa, + lookup, + uses_depth, + key); + } /* BRW_NEW_WM_INPUT_DIMENSIONS */ key->proj_attrib_mask = brw->wm.input_size_masks[4-1]; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index fed13729698..a38df1e111e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -59,6 +59,7 @@ struct brw_wm_prog_key { GLuint source_depth_reg:3; + GLuint source_w_reg:3; GLuint aa_dest_stencil_reg:3; GLuint dest_depth_reg:3; GLuint nr_payload_regs:4; @@ -182,6 +183,8 @@ struct brw_wm_instruction { #define PROGRAM_PAYLOAD (PROGRAM_FILE_MAX) #define PAYLOAD_DEPTH (FRAG_ATTRIB_MAX) +#define PAYLOAD_W (FRAG_ATTRIB_MAX + 1) +#define PAYLOAD_FP_REG_MAX (FRAG_ATTRIB_MAX + 2) struct brw_wm_compile { struct brw_compile func; @@ -224,7 +227,7 @@ struct brw_wm_compile { } payload; - const struct brw_wm_ref *pass0_fp_reg[PROGRAM_PAYLOAD+1][256][4]; + const struct brw_wm_ref *pass0_fp_reg[PAYLOAD_FP_REG_MAX][256][4]; struct brw_wm_ref undef_ref; struct brw_wm_value undef_value; @@ -252,7 +255,7 @@ struct brw_wm_compile { struct { GLboolean inited; struct brw_reg reg; - } wm_regs[PROGRAM_PAYLOAD+1][256][4]; + } wm_regs[PAYLOAD_FP_REG_MAX][256][4]; GLboolean used_grf[BRW_WM_MAX_GRF]; GLuint first_free_grf; diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index a4754ca8cf6..86ec96368c8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -254,6 +254,8 @@ void emit_pixel_w(struct brw_wm_compile *c, struct brw_compile *p = &c->func; struct intel_context *intel = &p->brw->intel; + assert(intel->gen < 6); + /* Don't need this if all you are doing is interpolating color, for * instance. */ @@ -288,7 +290,6 @@ void emit_pixel_w(struct brw_wm_compile *c, } } - void emit_linterp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, @@ -307,7 +308,9 @@ void emit_linterp(struct brw_compile *p, for (i = 0; i < 4; i++) { if (mask & (1<gen >= 6) { + brw_PLN(p, dst[i], interp[i], brw_vec8_grf(2, 0)); + } else if (can_do_pln(intel, deltas)) { brw_PLN(p, dst[i], interp[i], deltas[0]); } else { brw_LINE(p, brw_null_reg(), interp[i], deltas[0]); @@ -330,6 +333,11 @@ void emit_pinterp(struct brw_compile *p, GLuint nr = arg0[0].nr; GLuint i; + if (intel->gen >= 6) { + emit_linterp(p, dst, mask, arg0, interp); + return; + } + interp[0] = brw_vec1_grf(nr, 0); interp[1] = brw_vec1_grf(nr, 4); interp[2] = brw_vec1_grf(nr+1, 0); diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 3870bf10fcb..a88b7bdea85 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -336,7 +336,13 @@ static struct prog_src_register get_delta_xy( struct brw_wm_compile *c ) static struct prog_src_register get_pixel_w( struct brw_wm_compile *c ) { - if (src_is_undef(c->pixel_w)) { + /* This is only called for producing 1/w in pre-gen6 interp. for + * gen6, the interp opcodes don't use this argument. + */ + if (c->func.brw->intel.gen >= 6) + return src_undef(); + + if (!src_is_undef(c->pixel_w)) { struct prog_dst_register pixel_w = get_temp(c); struct prog_src_register deltas = get_delta_xy(c); struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS); @@ -363,7 +369,13 @@ static void emit_interp( struct brw_wm_compile *c, { struct prog_dst_register dst = dst_reg(PROGRAM_INPUT, idx); struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx); - struct prog_src_register deltas = get_delta_xy(c); + struct prog_src_register deltas; + + if (c->func.brw->intel.gen < 6) { + deltas = get_delta_xy(c); + } else { + deltas = src_undef(); + } /* Need to use PINTERP on attributes which have been * multiplied by 1/W in the SF program, and LINTERP on those @@ -1056,6 +1068,7 @@ static void print_insns( const struct prog_instruction *insn, */ void brw_wm_pass_fp( struct brw_wm_compile *c ) { + struct intel_context *intel = &c->func.brw->intel; struct brw_fragment_program *fp = c->fp; GLuint insn; @@ -1067,7 +1080,14 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) } c->pixel_xy = src_undef(); - c->delta_xy = src_undef(); + if (intel->gen >= 6) { + /* The interpolation deltas come in as the perspective pixel + * location barycentric params. + */ + c->delta_xy = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH); + } else { + c->delta_xy = src_undef(); + } c->pixel_w = src_undef(); c->nr_fp_insns = 0; c->fp->tex_units_used = 0x0; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 7c05e452ddd..a0f299195c4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -296,6 +296,8 @@ static void prealloc_reg(struct brw_wm_compile *c) reg = brw_vec8_grf(0, 0); set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg); } + set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_W, 0, + brw_vec8_grf(c->key.source_w_reg, 0)); reg_index += c->key.nr_payload_regs; /* constants */ diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 2cd640de175..afce1da6669 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -151,6 +151,8 @@ upload_wm_state(struct brw_context *brw) if (fp->program.UsesKill || ctx->Color.AlphaEnabled) dw5 |= GEN6_WM_KILL_ENABLE; + dw6 |= GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC; + /* This should probably be FS inputs read */ dw6 |= brw_count_bits(brw->vs.prog_data->outputs_written) << GEN6_WM_NUM_SF_OUTPUTS_SHIFT; -- cgit v1.2.3 From 2f914053bc8bba3e6d20334ec44feacc803f5d84 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Aug 2010 18:15:14 -0700 Subject: i965: Set up inputs to the fragment shader according to FP InputsRead. Sending down data that doesn't get read doesn't make any sense, and would make handling things like gl_FrontFacing and gl_PointCoord harder. --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 50 ++++++++++++++++++++----------- src/mesa/drivers/dri/i965/gen6_sf_state.c | 29 ++++++++++-------- src/mesa/drivers/dri/i965/gen6_wm_state.c | 3 +- 3 files changed, 51 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index a0f299195c4..f60245377e4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -347,26 +347,42 @@ static void prealloc_reg(struct brw_wm_compile *c) } } - /* fragment shader inputs */ - for (i = 0; i < VERT_RESULT_MAX; i++) { - int fp_input; - - if (i >= VERT_RESULT_VAR0) - fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0; - else if (i <= VERT_RESULT_TEX7) - fp_input = i; - else - fp_input = -1; - - if (fp_input >= 0 && inputs & (1 << fp_input)) { - urb_read_length = reg_index; + /* fragment shader inputs: One 2-reg pair of interpolation + * coefficients for each vec4 to be set up. + */ + if (intel->gen >= 6) { + for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (!(c->fp->program.Base.InputsRead & BITFIELD64_BIT(i))) + continue; + reg = brw_vec8_grf(reg_index, 0); - for (j = 0; j < 4; j++) - set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg); - } - if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { + for (j = 0; j < 4; j++) { + set_reg(c, PROGRAM_PAYLOAD, i, j, reg); + } reg_index += 2; } + urb_read_length = reg_index; + } else { + for (i = 0; i < VERT_RESULT_MAX; i++) { + int fp_input; + + if (i >= VERT_RESULT_VAR0) + fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0; + else if (i <= VERT_RESULT_TEX7) + fp_input = i; + else + fp_input = -1; + + if (fp_input >= 0 && inputs & (1 << fp_input)) { + urb_read_length = reg_index; + reg = brw_vec8_grf(reg_index, 0); + for (j = 0; j < 4; j++) + set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg); + } + if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { + reg_index += 2; + } + } } c->prog_data.first_curbe_grf = c->key.nr_payload_regs; diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 6820ca3abf4..b5984255afa 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -33,20 +33,29 @@ #include "intel_batchbuffer.h" static uint32_t -get_attr_override(struct brw_context *brw, int attr) +get_attr_override(struct brw_context *brw, int fs_attr) { - uint32_t attr_override; - int attr_index = 0, i; + int attr_index = 0, i, vs_attr; + + if (fs_attr <= FRAG_ATTRIB_TEX7) + vs_attr = fs_attr; + else if (fs_attr == FRAG_ATTRIB_FACE) + vs_attr = 0; /* XXX */ + else if (fs_attr == FRAG_ATTRIB_PNTC) + vs_attr = 0; /* XXX */ + else { + assert(fs_attr >= FRAG_ATTRIB_VAR0); + vs_attr = fs_attr - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0; + } /* Find the source index (0 = first attribute after the 4D position) * for this output attribute. attr is currently a VERT_RESULT_* but should * be FRAG_ATTRIB_*. */ - for (i = 0; i < attr; i++) { + for (i = 0; i < vs_attr; i++) { if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(i)) attr_index++; } - attr_override = attr_index; return attr_index; } @@ -58,8 +67,7 @@ upload_sf_state(struct brw_context *brw) GLcontext *ctx = &intel->ctx; /* CACHE_NEW_VS_PROG */ uint32_t num_inputs = brw_count_bits(brw->vs.prog_data->outputs_written); - /* This should probably be FS inputs read */ - uint32_t num_outputs = brw_count_bits(brw->vs.prog_data->outputs_written); + uint32_t num_outputs = brw_count_bits(brw->fragment_program->Base.InputsRead); uint32_t dw1, dw2, dw3, dw4; int i; /* _NEW_BUFFER */ @@ -144,11 +152,8 @@ upload_sf_state(struct brw_context *brw) for (i = 0; i < 8; i++) { uint32_t attr_overrides = 0; - /* These should be generating FS inputs read instead of VS - * outputs written - */ for (; attr < 64; attr++) { - if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) { + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)) { attr_overrides |= get_attr_override(brw, attr); attr++; break; @@ -156,7 +161,7 @@ upload_sf_state(struct brw_context *brw) } for (; attr < 64; attr++) { - if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) { + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)) { attr_overrides |= get_attr_override(brw, attr) << 16; attr++; break; diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index afce1da6669..d88c86a1b25 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -153,8 +153,7 @@ upload_wm_state(struct brw_context *brw) dw6 |= GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC; - /* This should probably be FS inputs read */ - dw6 |= brw_count_bits(brw->vs.prog_data->outputs_written) << + dw6 |= brw_count_bits(brw->fragment_program->Base.InputsRead) << GEN6_WM_NUM_SF_OUTPUTS_SHIFT; BEGIN_BATCH(9); -- cgit v1.2.3 From fe2d4a5ea02df38c9940a726aa04bcf550fab1da Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Aug 2010 01:33:57 -0700 Subject: i965: Add support for POW in gen6 FS. Fixes glsl-algebraic-pow-2 in brw_wm_glsl.c mode. --- src/mesa/drivers/dri/i965/brw_eu.h | 6 ++ src/mesa/drivers/dri/i965/brw_eu_emit.c | 23 +++++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 116 +++++++++++++++++++++++++------- 3 files changed, 120 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index c63db164609..c0deb238c2c 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -885,6 +885,12 @@ void brw_math( struct brw_compile *p, GLuint data_type, GLuint precision ); +void brw_math2(struct brw_compile *p, + struct brw_reg dest, + GLuint function, + struct brw_reg src0, + struct brw_reg src1); + void brw_dp_READ_16( struct brw_compile *p, struct brw_reg dest, GLuint scratch_offset ); diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index ddd3a94eb07..9c320c613f6 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1131,6 +1131,29 @@ void brw_math( struct brw_compile *p, } } +/** Extended math function, float[8]. + */ +void brw_math2(struct brw_compile *p, + struct brw_reg dest, + GLuint function, + struct brw_reg src0, + struct brw_reg src1) +{ + struct intel_context *intel = &p->brw->intel; + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_MATH); + + assert(intel->gen >= 6); + + /* Math is the same ISA format as other opcodes, except that CondModifier + * becomes FC[3:0] and ThreadCtrl becomes FC[5:4]. + */ + insn->header.destreg__conditionalmod = function; + + brw_set_dest(insn, dest); + brw_set_src0(insn, src0); + brw_set_src1(insn, src1); +} + /** * Extended math function, float[16]. * Use 2 send instructions. diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 86ec96368c8..9be3bfbbfe2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -918,10 +918,8 @@ void emit_math2(struct brw_wm_compile *c, const struct brw_reg *arg1) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - GLuint saturate = ((mask & SATURATE) ? - BRW_MATH_SATURATE_SATURATE : - BRW_MATH_SATURATE_NONE); if (!(mask & WRITEMASK_XYZW)) return; /* Do not emit dead code */ @@ -930,35 +928,103 @@ void emit_math2(struct brw_wm_compile *c, brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, brw_message_reg(3), arg1[0]); - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); - brw_MOV(p, brw_message_reg(5), sechalf(arg1[0])); - } + /* math can only operate on up to a vec8 at a time, so in + * dispatch_width==16 we have to do the second half manually. + */ + if (intel->gen >= 6) { + struct brw_reg src0 = arg0[0]; + struct brw_reg src1 = arg1[0]; + struct brw_reg temp_dst = dst[dst_chan]; + + if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + /* Both scalar arguments. Do scalar calc. */ + src0.hstride = BRW_HORIZONTAL_STRIDE_1; + src1.hstride = BRW_HORIZONTAL_STRIDE_1; + temp_dst.hstride = BRW_HORIZONTAL_STRIDE_1; + temp_dst.width = BRW_WIDTH_1; + + if (arg0[0].subnr != 0) { + brw_MOV(p, temp_dst, src0); + src0 = temp_dst; + + /* Ouch. We've used the temp as a dst, and we still + * need a temp to store arg1 in, because src and dst + * offsets have to be equal. Leaving this up to + * glsl2-965 to handle correctly. + */ + assert(arg1[0].subnr == 0); + } else if (arg1[0].subnr != 0) { + brw_MOV(p, temp_dst, src1); + src1 = temp_dst; + } + } else { + brw_MOV(p, temp_dst, src0); + src0 = temp_dst; + } + } else if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + brw_MOV(p, temp_dst, src1); + src1 = temp_dst; + } - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_math(p, - dst[dst_chan], - function, - saturate, - 2, - arg0[0], - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); + brw_set_saturate(p, (mask & SATURATE) ? 1 : 0); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_math2(p, + temp_dst, + function, + src0, + src1); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_math2(p, + sechalf(temp_dst), + function, + sechalf(src0), + sechalf(src1)); + } - /* Send two messages to perform all 16 operations: - */ - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + /* Splat a scalar result into all the channels. */ + if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0 && + arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + temp_dst.hstride = BRW_HORIZONTAL_STRIDE_0; + temp_dst.vstride = BRW_VERTICAL_STRIDE_0; + brw_MOV(p, dst[dst_chan], temp_dst); + } + } else { + GLuint saturate = ((mask & SATURATE) ? + BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE); + + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, brw_message_reg(3), arg1[0]); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_MOV(p, brw_message_reg(5), sechalf(arg1[0])); + } + + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_math(p, - offset(dst[dst_chan],1), + dst[dst_chan], function, saturate, - 4, - sechalf(arg0[0]), + 2, + arg0[0], BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); + + /* Send two messages to perform all 16 operations: + */ + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_math(p, + offset(dst[dst_chan],1), + function, + saturate, + 4, + sechalf(arg0[0]), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } } brw_pop_insn_state(p); } -- cgit v1.2.3 From bf60f3593452f6ab6340c7a8737cc74f223f2a62 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 11:13:26 +0800 Subject: i965: disasm quarter and write enable instruction control on sandybridge --- src/mesa/drivers/dri/i965/brw_disasm.c | 70 +++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index f74a236834b..90520824f60 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -164,6 +164,11 @@ char *accwr[2] = { [1] = "AccWrEnable" }; +char *wectrl[2] = { + [0] = "WEnormal", + [1] = "WEpredicted" +}; + char *exec_size[8] = { [0] = "1", [1] = "2", @@ -651,6 +656,7 @@ static int src_da16 (FILE *file, err |= control (file, "channel select", chan_sel, swz_z, NULL); err |= control (file, "channel select", chan_sel, swz_w, NULL); } + err |= control (file, "src da16 reg type", reg_encoding, _reg_type, NULL); return err; } @@ -804,6 +810,44 @@ static int src1 (FILE *file, struct brw_instruction *inst) } } +int esize[6] = { + [0] = 1, + [1] = 2, + [2] = 4, + [3] = 8, + [4] = 16, + [5] = 32, +}; + +static int qtr_ctrl(FILE *file, struct brw_instruction *inst) +{ + int qtr_ctl = inst->header.compression_control; + int exec_size = esize[inst->header.execution_size]; + + if (exec_size == 8) { + switch (qtr_ctl) { + case 0: + string (file, " 1Q"); + break; + case 1: + string (file, " 2Q"); + break; + case 2: + string (file, " 3Q"); + break; + case 3: + string (file, " 4Q"); + break; + } + } else if (exec_size == 16){ + if (qtr_ctl < 2) + string (file, " 1H"); + else + string (file, " 2H"); + } + return 0; +} + int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) { int err = 0; @@ -998,18 +1042,26 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) string (file, "{"); space = 1; err |= control(file, "access mode", access_mode, inst->header.access_mode, &space); - err |= control (file, "mask control", mask_ctrl, inst->header.mask_control, &space); + if (gen >= 6) + err |= control (file, "write enable control", wectrl, inst->header.mask_control, &space); + else + err |= control (file, "mask control", mask_ctrl, inst->header.mask_control, &space); err |= control (file, "dependency control", dep_ctrl, inst->header.dependency_control, &space); - if (inst->header.compression_control == BRW_COMPRESSION_COMPRESSED && - opcode[inst->header.opcode].ndst > 0 && - inst->bits1.da1.dest_reg_file == BRW_MESSAGE_REGISTER_FILE && - inst->bits1.da1.dest_reg_nr & (1 << 7)) { - format (file, " compr4"); - } else { - err |= control (file, "compression control", compr_ctrl, - inst->header.compression_control, &space); + if (gen >= 6) + err |= qtr_ctrl (file, inst); + else { + if (inst->header.compression_control == BRW_COMPRESSION_COMPRESSED && + opcode[inst->header.opcode].ndst > 0 && + inst->bits1.da1.dest_reg_file == BRW_MESSAGE_REGISTER_FILE && + inst->bits1.da1.dest_reg_nr & (1 << 7)) { + format (file, " compr4"); + } else { + err |= control (file, "compression control", compr_ctrl, + inst->header.compression_control, &space); + } } + err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space); if (gen >= 6) err |= control (file, "acc write control", accwr, inst->header.acc_wr_control, &space); -- cgit v1.2.3 From b016a78b983295c112421c01d378fbe2862412d4 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 11:17:26 +0800 Subject: i965: new state dump for sandybridge Dump new state object on sandybridge for cc viewport, clip viewport, depth stencil, cc and blend state. --- src/mesa/drivers/dri/i965/brw_state_dump.c | 140 +++++++++++++++++++++++++++-- 1 file changed, 135 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index d410861bdf6..b79b33c2e32 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -161,6 +161,123 @@ static void dump_sf_viewport_state(struct brw_context *brw) drm_intel_bo_unmap(brw->sf.vp_bo); } +static void dump_clip_viewport_state(struct brw_context *brw) +{ + const char *name = "CLIP VP"; + struct brw_clipper_viewport *vp; + uint32_t vp_off; + + if (brw->clip.vp_bo == NULL) + return; + + drm_intel_bo_map(brw->clip.vp_bo, GL_FALSE); + + vp = brw->clip.vp_bo->virtual; + vp_off = brw->clip.vp_bo->offset; + + state_out(name, vp, vp_off, 0, "xmin = %f\n", vp->xmin); + state_out(name, vp, vp_off, 1, "xmax = %f\n", vp->xmax); + state_out(name, vp, vp_off, 2, "ymin = %f\n", vp->ymin); + state_out(name, vp, vp_off, 3, "ymax = %f\n", vp->ymax); + drm_intel_bo_unmap(brw->clip.vp_bo); +} + +static void dump_cc_viewport_state(struct brw_context *brw) +{ + const char *name = "CC VP"; + struct brw_cc_viewport *vp; + uint32_t vp_off; + + if (brw->cc.vp_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.vp_bo, GL_FALSE); + + vp = brw->cc.vp_bo->virtual; + vp_off = brw->cc.vp_bo->offset; + + state_out(name, vp, vp_off, 0, "min_depth = %f\n", vp->min_depth); + state_out(name, vp, vp_off, 1, "max_depth = %f\n", vp->max_depth); + drm_intel_bo_unmap(brw->cc.vp_bo); +} + +static void dump_depth_stencil_state(struct brw_context *brw) +{ + const char *name = "DEPTH STENCIL"; + struct gen6_depth_stencil_state *ds; + uint32_t ds_off; + + if (brw->cc.depth_stencil_state_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.depth_stencil_state_bo, GL_FALSE); + + ds = brw->cc.depth_stencil_state_bo->virtual; + ds_off = brw->cc.depth_stencil_state_bo->offset; + + state_out(name, ds, ds_off, 0, "stencil %sable, func %d, write %sable\n", + ds->ds0.stencil_enable ? "en" : "dis", + ds->ds0.stencil_func, + ds->ds0.stencil_write_enable ? "en" : "dis"); + state_out(name, ds, ds_off, 1, "stencil test mask 0x%x, write mask 0x%x\n", + ds->ds1.stencil_test_mask, ds->ds1.stencil_write_mask); + state_out(name, ds, ds_off, 2, "depth test %sable, func %d, write %sable\n", + ds->ds2.depth_test_enable ? "en" : "dis", + ds->ds2.depth_test_func, + ds->ds2.depth_write_enable ? "en" : "dis"); + drm_intel_bo_unmap(brw->cc.depth_stencil_state_bo); +} + +static void dump_cc_state(struct brw_context *brw) +{ + const char *name = "CC"; + struct gen6_color_calc_state *cc; + uint32_t cc_off; + + if (brw->cc.state_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.state_bo, GL_FALSE); + cc = brw->cc.state_bo->virtual; + cc_off = brw->cc.state_bo->offset; + + state_out(name, cc, cc_off, 0, "alpha test format %s, round disable %d, stencil ref %d," + "bf stencil ref %d\n", + cc->cc0.alpha_test_format ? "FLOAT32" : "UNORM8", + cc->cc0.round_disable, + cc->cc0.stencil_ref, + cc->cc0.bf_stencil_ref); + state_out(name, cc, cc_off, 1, "\n"); + state_out(name, cc, cc_off, 2, "constant red %f\n", cc->constant_r); + state_out(name, cc, cc_off, 3, "constant green %f\n", cc->constant_g); + state_out(name, cc, cc_off, 4, "constant blue %f\n", cc->constant_b); + state_out(name, cc, cc_off, 5, "constant alpha %f\n", cc->constant_a); + + drm_intel_bo_unmap(brw->cc.state_bo); + +} + +static void dump_blend_state(struct brw_context *brw) +{ + const char *name = "BLEND"; + struct gen6_blend_state *blend; + uint32_t blend_off; + + if (brw->cc.blend_state_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.blend_state_bo, GL_FALSE); + + blend = brw->cc.blend_state_bo->virtual; + blend_off = brw->cc.blend_state_bo->offset; + + state_out(name, blend, blend_off, 0, "\n"); + state_out(name, blend, blend_off, 1, "\n"); + + drm_intel_bo_unmap(brw->cc.blend_state_bo); + +} + static void brw_debug_prog(const char *name, drm_intel_bo *prog) { unsigned int i; @@ -208,16 +325,29 @@ void brw_debug_batch(struct intel_context *intel) state_struct_out("WM bind", brw->wm.bind_bo, 4 * brw->wm.nr_surfaces); dump_wm_surface_state(brw); - state_struct_out("VS", brw->vs.state_bo, sizeof(struct brw_vs_unit_state)); + if (intel->gen < 6) + state_struct_out("VS", brw->vs.state_bo, sizeof(struct brw_vs_unit_state)); brw_debug_prog("VS prog", brw->vs.prog_bo); - state_struct_out("GS", brw->gs.state_bo, sizeof(struct brw_gs_unit_state)); + if (intel->gen < 6) + state_struct_out("GS", brw->gs.state_bo, sizeof(struct brw_gs_unit_state)); brw_debug_prog("GS prog", brw->gs.prog_bo); - state_struct_out("SF", brw->sf.state_bo, sizeof(struct brw_sf_unit_state)); + if (intel->gen < 6) { + state_struct_out("SF", brw->sf.state_bo, sizeof(struct brw_sf_unit_state)); + brw_debug_prog("SF prog", brw->sf.prog_bo); + } dump_sf_viewport_state(brw); - brw_debug_prog("SF prog", brw->sf.prog_bo); - state_struct_out("WM", brw->wm.state_bo, sizeof(struct brw_wm_unit_state)); + if (intel->gen < 6) + state_struct_out("WM", brw->wm.state_bo, sizeof(struct brw_wm_unit_state)); brw_debug_prog("WM prog", brw->wm.prog_bo); + + if (intel->gen >= 6) { + dump_cc_viewport_state(brw); + dump_clip_viewport_state(brw); + dump_depth_stencil_state(brw); + dump_cc_state(brw); + dump_blend_state(brw); + } } -- cgit v1.2.3 From 8c31a4c3cf6655fe4db6befb4a7b029ada62aaf6 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 12:45:01 +0800 Subject: i965: enable accumulator update in PS kernel too on sandybridge Accumulator update flag must be set for implicit update on sandybridge. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 3 +++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 9be3bfbbfe2..260a04c774e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1627,9 +1627,12 @@ static void spill_values( struct brw_wm_compile *c, void brw_wm_emit( struct brw_wm_compile *c ) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; GLuint insn; brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED); + if (intel->gen >= 6) + brw_set_acc_write_control(p, 1); /* Check if any of the payload regs need to be spilled: */ diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index f60245377e4..1cbd5d2b55a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -711,6 +711,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); + if (intel->gen >= 6) + brw_set_acc_write_control(p, 1); + for (i = 0; i < c->nr_fp_insns; i++) { const struct prog_instruction *inst = &c->prog_instructions[i]; int dst_flags; -- cgit v1.2.3 From 41c31c2ebd5ed2ca021ff9d89f79270562e6c368 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 12:57:35 +0800 Subject: i965: Fix color interpolation on sandybridge Don't double store position in vertex attribute. This makes color interpolation right by using barycentric coordinates. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ad0d00b87c4..ed2625e16f6 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -254,7 +254,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) c->first_overflow_output = 0; if (intel->gen >= 6) - mrf = 4; + mrf = 3; /* no more pos store in attribute */ else if (intel->gen == 5) mrf = 8; else @@ -1451,8 +1451,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) * position. */ brw_MOV(p, brw_message_reg(2), pos); - brw_MOV(p, brw_message_reg(3), pos); - len_vertex_header = 2; + len_vertex_header = 1; } else if (intel->gen == 5) { /* There are 20 DWs (D0-D19) in VUE header on Ironlake: * dword 0-3 (m1) of the header is indices, point width, clip flags. -- cgit v1.2.3 From 03218a00932e83f0ffd0c3077bbbe65a7765c572 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 13:03:32 +0800 Subject: i965: force zero in clipper to ignore RTAIndex on sandybridge --- src/mesa/drivers/dri/i965/brw_defines.h | 1 + src/mesa/drivers/dri/i965/gen6_clip_state.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 6b8e9e05d08..f9c12e15558 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -930,6 +930,7 @@ /* DW3 */ # define GEN6_CLIP_MIN_POINT_WIDTH_SHIFT 17 # define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT 6 +# define GEN6_CLIP_FORCE_ZERO_RTAINDEX (1 << 5) #define CMD_3D_SF_STATE 0x7813 /* GEN6+ */ /* DW1 */ diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c index acc4b7f1019..045d9c6f76e 100644 --- a/src/mesa/drivers/dri/i965/gen6_clip_state.c +++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c @@ -59,6 +59,7 @@ upload_clip_state(struct brw_context *brw) GEN6_CLIP_XY_TEST | depth_clamp | provoking); + OUT_BATCH(GEN6_CLIP_FORCE_ZERO_RTAINDEX); OUT_BATCH(0); ADVANCE_BATCH(); -- cgit v1.2.3 From fa589770e8829f02d2742c32d05eecde0b70fe80 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 13:08:22 +0800 Subject: i965: fix point size setting in header on sandybridge --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ed2625e16f6..162ddc93c8b 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1392,8 +1392,11 @@ static void emit_vertex_write( struct brw_vs_compile *c) if (c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) { struct brw_reg psiz = c->regs[PROGRAM_OUTPUT][VERT_RESULT_PSIZ]; - brw_MUL(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0), brw_imm_f(1<<11)); - brw_AND(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(0x7ff<<8)); + if (intel->gen < 6) { + brw_MUL(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0), brw_imm_f(1<<11)); + brw_AND(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(0x7ff<<8)); + } else + brw_MOV(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0)); } for (i = 0; i < c->key.nr_userclip; i++) { -- cgit v1.2.3 From 67dafa4b56422b44ca26b093d8feb6e743eb89e6 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 14:23:48 +0800 Subject: i965: ff sync message change for sandybridge --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 9c320c613f6..1d3f19759df 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1744,13 +1744,27 @@ void brw_ff_sync(struct brw_compile *p, GLuint response_length, GLboolean eot) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + struct intel_context *intel = &p->brw->intel; + struct brw_instruction *insn; + /* Sandybridge doesn't have the implied move for SENDs, + * and the first message register index comes from src0. + */ + if (intel->gen >= 6) { + brw_push_insn_state(p); + brw_set_mask_control( p, BRW_MASK_DISABLE ); + brw_MOV(p, brw_message_reg(msg_reg_nr), src0); + brw_pop_insn_state(p); + src0 = brw_message_reg(msg_reg_nr); + } + + insn = next_insn(p, BRW_OPCODE_SEND); brw_set_dest(insn, dest); brw_set_src0(insn, src0); brw_set_src1(insn, brw_imm_d(0)); - insn->header.destreg__conditionalmod = msg_reg_nr; + if (intel->gen < 6) + insn->header.destreg__conditionalmod = msg_reg_nr; brw_set_ff_sync_message(p->brw, insn, -- cgit v1.2.3 From a0b1d7b2b8d35f30793d811d7b5a693e9ea17596 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 14:25:43 +0800 Subject: i965: ignore quads for GS kernel on sandybridge Sandybridge's VF would convert quads to polygon which not required for GS then. Current GS state still would cause hang on lineloop. --- src/mesa/drivers/dri/i965/brw_gs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 5409e557880..8952c9e3463 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -60,7 +60,7 @@ static void compile_gs_prog( struct brw_context *brw, */ c.nr_attrs = brw_count_bits(c.key.attrs); - if (intel->gen == 5) + if (intel->gen >= 5) c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */ else c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ @@ -85,12 +85,19 @@ static void compile_gs_prog( struct brw_context *brw, */ switch (key->primitive) { case GL_QUADS: + /* Gen6: VF has already converted into polygon. */ + if (intel->gen == 6) + return; brw_gs_quads( &c, key ); break; case GL_QUAD_STRIP: + if (intel->gen == 6) + return; brw_gs_quad_strip( &c, key ); break; case GL_LINE_LOOP: + /* XXX fix GS hang issue */ + assert(intel->gen < 6); brw_gs_lines( &c ); break; case GL_LINES: -- cgit v1.2.3 From 7401a98e29eaaa80fc42e18b126988683b090543 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 14:40:16 +0800 Subject: i965: add sandybridge viewport state bo into validation list --- src/mesa/drivers/dri/i965/gen6_viewport_state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c index 301c68e7f9e..84bea323f8a 100644 --- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c @@ -107,7 +107,9 @@ const struct brw_tracked_state gen6_sf_vp = { static void prepare_viewport_state_pointers(struct brw_context *brw) { - brw_add_validated_bo(brw, brw->sf.state_bo); + brw_add_validated_bo(brw, brw->clip.vp_bo); + brw_add_validated_bo(brw, brw->sf.vp_bo); + brw_add_validated_bo(brw, brw->cc.vp_bo); } static void upload_viewport_state_pointers(struct brw_context *brw) -- cgit v1.2.3 From 9c39a9fcb2c76897e9b5aff68ce197a411c4e25c Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 14:47:05 +0800 Subject: i965: VS use SPF mode on sandybridge for now Until conditional instructions were fixed, use SPF mode instead for now. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 4 ++++ src/mesa/drivers/dri/i965/gen6_vs_state.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 162ddc93c8b..8ac979dceaa 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1635,6 +1635,10 @@ void brw_vs_emit(struct brw_vs_compile *c ) printf("\n"); } + /* FIXME Need to fix conditional instruction to remove this */ + if (intel->gen >= 6) + p->single_program_flow = GL_TRUE; + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_access_mode(p, BRW_ALIGN_16); if_depth_in_loop[loop_depth] = 0; diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index 4080a9dedfd..50047a33a87 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -93,7 +93,7 @@ upload_vs_state(struct brw_context *brw) BEGIN_BATCH(6); OUT_BATCH(CMD_3D_VS_STATE << 16 | (6 - 2)); OUT_RELOC(brw->vs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0); - OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | + OUT_BATCH(GEN6_VS_SPF_MODE | (0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT)); OUT_BATCH(0); /* scratch space base offset */ OUT_BATCH((1 << GEN6_VS_DISPATCH_START_GRF_SHIFT) | -- cgit v1.2.3 From c5a3b25bb954db49dcb5e7737018979782d2edba Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Tue, 28 Sep 2010 14:54:26 +0800 Subject: i965: fix jump count on sandybridge Jump count is for 64bit long each, so one instruction requires 2 like on Ironlake. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 1d3f19759df..38ac3be8df8 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -819,7 +819,9 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, struct brw_instruction *insn; GLuint br = 1; - if (intel->gen == 5) + /* jump count is for 64bit data chunk each, so one 128bit + instruction requires 2 chunks. */ + if (intel->gen >= 5) br = 2; if (p->single_program_flow) { @@ -861,7 +863,7 @@ void brw_ENDIF(struct brw_compile *p, struct intel_context *intel = &p->brw->intel; GLuint br = 1; - if (intel->gen == 5) + if (intel->gen >= 5) br = 2; if (p->single_program_flow) { @@ -978,7 +980,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *insn; GLuint br = 1; - if (intel->gen == 5) + if (intel->gen >= 5) br = 2; if (p->single_program_flow) @@ -1022,7 +1024,7 @@ void brw_land_fwd_jump(struct brw_compile *p, struct brw_instruction *landing = &p->store[p->nr_insn]; GLuint jmpi = 1; - if (intel->gen == 5) + if (intel->gen >= 5) jmpi = 2; assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI); -- cgit v1.2.3 From 956f866030f7bea5fc4a2de28c72e60bdc3a5b3d Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 14:17:06 +0800 Subject: i965: Fix sampler on sandybridge Sandybridge has not much change on texture sampler with Ironlake. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 29 ++++++++++++++++++++---- src/mesa/drivers/dri/i965/brw_structs.h | 14 +++++++----- src/mesa/drivers/dri/i965/brw_tex_layout.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_emit.c | 6 ++--- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 11 +++++++-- 5 files changed, 45 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 38ac3be8df8..09cc8b2bd5e 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -548,7 +548,7 @@ static void brw_set_sampler_message(struct brw_context *brw, assert(eot == 0); brw_set_src1(insn, brw_imm_d(0)); - if (intel->gen == 5) { + if (intel->gen >= 5) { insn->bits3.sampler_gen5.binding_table_index = binding_table_index; insn->bits3.sampler_gen5.sampler = sampler; insn->bits3.sampler_gen5.msg_type = msg_type; @@ -557,8 +557,12 @@ static void brw_set_sampler_message(struct brw_context *brw, insn->bits3.sampler_gen5.response_length = response_length; insn->bits3.sampler_gen5.msg_length = msg_length; insn->bits3.sampler_gen5.end_of_thread = eot; - insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER; - insn->bits2.send_gen5.end_of_thread = eot; + if (intel->gen >= 6) + insn->header.destreg__conditionalmod = BRW_MESSAGE_TARGET_SAMPLER; + else { + insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER; + insn->bits2.send_gen5.end_of_thread = eot; + } } else if (intel->is_g4x) { insn->bits3.sampler_g4x.binding_table_index = binding_table_index; insn->bits3.sampler_g4x.sampler = sampler; @@ -1581,6 +1585,7 @@ void brw_SAMPLE(struct brw_compile *p, GLuint header_present, GLuint simd_mode) { + struct intel_context *intel = &p->brw->intel; GLboolean need_stall = 0; if (writemask == 0) { @@ -1652,11 +1657,25 @@ void brw_SAMPLE(struct brw_compile *p, } { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + struct brw_instruction *insn; + /* Sandybridge doesn't have the implied move for SENDs, + * and the first message register index comes from src0. + */ + if (intel->gen >= 6) { + brw_push_insn_state(p); + brw_set_mask_control( p, BRW_MASK_DISABLE ); + /* m1 contains header? */ + brw_MOV(p, brw_message_reg(msg_reg_nr), src0); + brw_pop_insn_state(p); + src0 = brw_message_reg(msg_reg_nr); + } + + insn = next_insn(p, BRW_OPCODE_SEND); insn->header.predicate_control = 0; /* XXX */ insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.destreg__conditionalmod = msg_reg_nr; + if (intel->gen < 6) + insn->header.destreg__conditionalmod = msg_reg_nr; brw_set_dest(insn, dest); brw_set_src0(insn, src0); diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 2a118e01c53..8e8f418eb78 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -1073,7 +1073,7 @@ struct brw_sampler_state GLuint mag_filter:3; GLuint mip_filter:2; GLuint base_level:5; - GLuint pad:1; + GLuint min_mag_neq:1; GLuint lod_preclamp:1; GLuint default_color_mode:1; GLuint pad0:1; @@ -1085,7 +1085,8 @@ struct brw_sampler_state GLuint r_wrap_mode:3; GLuint t_wrap_mode:3; GLuint s_wrap_mode:3; - GLuint pad:3; + GLuint cube_control_mode:1; + GLuint pad:2; GLuint max_lod:10; GLuint min_lod:10; } ss1; @@ -1099,7 +1100,9 @@ struct brw_sampler_state struct { - GLuint pad:19; + GLuint non_normalized_coord:1; + GLuint pad:12; + GLuint address_round:6; GLuint max_aniso:3; GLuint chroma_key_mode:1; GLuint chroma_key_index:2; @@ -1210,10 +1213,9 @@ struct brw_surface_state struct { GLuint pad1:16; - GLuint llc_mapping:1; - GLuint mlc_mapping:1; + GLuint cache_control:2; GLuint gfdt:1; - GLuint gfdt_src:1; + GLuint encrypt:1; GLuint y_offset:4; GLuint pad0:1; GLuint x_offset:7; diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 768ccfd79c4..9ac0713a1d3 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -48,7 +48,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel, switch (mt->target) { case GL_TEXTURE_CUBE_MAP: - if (intel->gen == 5) { + if (intel->gen >= 5) { GLuint align_h = 2; GLuint level; GLuint qpitch = 0; diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 260a04c774e..a9ebc2689ce 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1102,7 +1102,7 @@ void emit_tex(struct brw_wm_compile *c, /* Fill in the shadow comparison reference value. */ if (shadow) { - if (intel->gen == 5) { + if (intel->gen >= 5) { /* Fill in the cube map array index value. */ brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0)); cur_mrf += mrf_per_channel; @@ -1115,7 +1115,7 @@ void emit_tex(struct brw_wm_compile *c, cur_mrf += mrf_per_channel; } - if (intel->gen == 5) { + if (intel->gen >= 5) { if (shadow) msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5; else @@ -1168,7 +1168,7 @@ void emit_txb(struct brw_wm_compile *c, * from mattering. */ if (c->dispatch_width == 16 || intel->gen < 5) { - if (intel->gen == 5) + if (intel->gen >= 5) msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5; else msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 1fc802cfa65..f9c48140fb6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -100,10 +100,13 @@ struct wm_sampler_key { * Sets the sampler state for a single unit based off of the sampler key * entry. */ -static void brw_update_sampler_state(struct wm_sampler_entry *key, +static void brw_update_sampler_state(struct brw_context *brw, + struct wm_sampler_entry *key, drm_intel_bo *sdc_bo, struct brw_sampler_state *sampler) { + struct intel_context *intel = &brw->intel; + memset(sampler, 0, sizeof(*sampler)); switch (key->minfilter) { @@ -163,6 +166,10 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s); sampler->ss1.t_wrap_mode = translate_wrap_mode(key->wrap_t); + if (intel->gen >= 6 && + sampler->ss0.min_filter != sampler->ss0.mag_filter) + sampler->ss0.min_mag_neq = 1; + /* Cube-maps on 965 and later must use the same wrap mode for all 3 * coordinate dimensions. Futher, only CUBE and CLAMP are valid. */ @@ -329,7 +336,7 @@ static void upload_wm_samplers( struct brw_context *brw ) if (brw->wm.sdc_bo[i] == NULL) continue; - brw_update_sampler_state(&key.sampler[i], brw->wm.sdc_bo[i], + brw_update_sampler_state(brw, &key.sampler[i], brw->wm.sdc_bo[i], &sampler[i]); } -- cgit v1.2.3 From 81aae67e58f7c3123724e629a81e2c937864e3be Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Sun, 26 Sep 2010 13:13:32 +0800 Subject: i965: fix const register count for sandybridge Sandybridge's PS constant buffer payload size is decided from push const buffer command, incorrect size would cause wrong data in payload for position and vertex attributes. This fixes coefficients for tex2d/tex3d. --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 1cbd5d2b55a..55aceea9b5c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -342,8 +342,8 @@ static void prealloc_reg(struct brw_wm_compile *c) } } /* number of constant regs used (each reg is float[8]) */ - c->nr_creg = 2 * ((4 * nr_params + 15) / 16); - reg_index += c->nr_creg; + c->nr_creg = ALIGN(nr_params, 2) / 2; + reg_index += c->nr_creg; } } -- cgit v1.2.3 From c8033f1b1ea118f3f47b7f3de557b7a8dcf11082 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Thu, 16 Sep 2010 09:50:02 +0800 Subject: i965: Add all device ids for sandybridge --- src/mesa/drivers/dri/intel/intel_chipset.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index b5f180bbc88..1e7ceed32a2 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -71,9 +71,13 @@ #define PCI_CHIP_ILD_G 0x0042 #define PCI_CHIP_ILM_G 0x0046 -#define PCI_CHIP_SANDYBRIDGE 0x0102 -#define PCI_CHIP_SANDYBRIDGE_M 0x0106 -#define PCI_CHIP_SANDYBRIDGE_M_D0 0x0126 +#define PCI_CHIP_SANDYBRIDGE_GT1 0x0102 /* Desktop */ +#define PCI_CHIP_SANDYBRIDGE_GT2 0x0112 +#define PCI_CHIP_SANDYBRIDGE_GT2_PLUS 0x0122 +#define PCI_CHIP_SANDYBRIDGE_M_GT1 0x0106 /* Mobile */ +#define PCI_CHIP_SANDYBRIDGE_M_GT2 0x0116 +#define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS 0x0126 +#define PCI_CHIP_SANDYBRIDGE_S 0x010A /* Server */ #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ @@ -119,9 +123,13 @@ /* Compat macro for intel_decode.c */ #define IS_IRONLAKE(devid) IS_GEN5(devid) -#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE || \ - devid == PCI_CHIP_SANDYBRIDGE_M || \ - devid == PCI_CHIP_SANDYBRIDGE_M_D0) +#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE_GT1 || \ + devid == PCI_CHIP_SANDYBRIDGE_GT2 || \ + devid == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \ + devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \ + devid == PCI_CHIP_SANDYBRIDGE_M_GT2 || \ + devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \ + devid == PCI_CHIP_SANDYBRIDGE_S) #define IS_965(devid) (IS_GEN4(devid) || \ IS_G4X(devid) || \ -- cgit v1.2.3 From 18c3b754f974751550dc9505d50535365beac8f3 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 15:08:09 +0800 Subject: i965: sandybridge pipe control workaround before write cache flush Must issue a pipe control with any non-zero post sync op before write cache flush = 1 pipe control. --- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 10 +++++++++- src/mesa/drivers/dri/intel/intel_reg.h | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index ff741fc39ab..9b398239172 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -264,10 +264,18 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch) struct intel_context *intel = batch->intel; if (intel->gen >= 6) { - BEGIN_BATCH(4); + BEGIN_BATCH(8); + + /* XXX workaround: issue any post sync != 0 before write cache flush = 1 */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH | PIPE_CONTROL_WRITE_FLUSH | + PIPE_CONTROL_DEPTH_CACHE_FLUSH | PIPE_CONTROL_NO_WRITE); OUT_BATCH(0); /* write address */ OUT_BATCH(0); /* write data */ diff --git a/src/mesa/drivers/dri/intel/intel_reg.h b/src/mesa/drivers/dri/intel/intel_reg.h index c1a281f261e..955b100b212 100644 --- a/src/mesa/drivers/dri/intel/intel_reg.h +++ b/src/mesa/drivers/dri/intel/intel_reg.h @@ -55,6 +55,11 @@ * additional flushing control. */ #define _3DSTATE_PIPE_CONTROL (CMD_3D | (3 << 27) | (2 << 24) | 2) +#define PIPE_CONTROL_CS_STALL (1 << 20) +#define PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET (1 << 19) +#define PIPE_CONTROL_TLB_INVALIDATE (1 << 18) +#define PIPE_CONTROL_SYNC_GFDT (1 << 17) +#define PIPE_CONTROL_MEDIA_STATE_CLEAR (1 << 16) #define PIPE_CONTROL_NO_WRITE (0 << 14) #define PIPE_CONTROL_WRITE_IMMEDIATE (1 << 14) #define PIPE_CONTROL_WRITE_DEPTH_COUNT (2 << 14) @@ -62,7 +67,14 @@ #define PIPE_CONTROL_DEPTH_STALL (1 << 13) #define PIPE_CONTROL_WRITE_FLUSH (1 << 12) #define PIPE_CONTROL_INSTRUCTION_FLUSH (1 << 11) +#define PIPE_CONTROL_TC_FLUSH (1 << 10) /* GM45+ only */ +#define PIPE_CONTROL_ISP_DIS (1 << 9) #define PIPE_CONTROL_INTERRUPT_ENABLE (1 << 8) +/* GT */ +#define PIPE_CONTROL_VF_CACHE_INVALIDATE (1 << 4) +#define PIPE_CONTROL_CONST_CACHE_INVALIDATE (1 << 3) +#define PIPE_CONTROL_STATE_CACHE_INVALIDATE (1 << 2) +#define PIPE_CONTROL_DEPTH_CACHE_FLUSH (1 << 0) #define PIPE_CONTROL_PPGTT_WRITE (0 << 2) #define PIPE_CONTROL_GLOBAL_GTT_WRITE (1 << 2) -- cgit v1.2.3 From c58bf2cee5b0f14a585089084fec7767f33887a7 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Sep 2010 16:26:27 +0800 Subject: i965: only allow SIMD8 kernel on sandybridge now Until we fixed SIMD16 kernel, force to SIMD8 on sandybridge now. --- src/mesa/drivers/dri/intel/intel_context.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 109c670c144..edcc9536da2 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -786,6 +786,11 @@ intelInitContext(struct intel_context *intel, if (INTEL_DEBUG & DEBUG_BUFMGR) dri_bufmgr_set_debug(intel->bufmgr, GL_TRUE); + /* XXX force SIMD8 kernel for Sandybridge before we fixed + SIMD16 interpolation. */ + if (intel->gen == 6) + INTEL_DEBUG |= DEBUG_GLSL_FORCE; + intel->batch = intel_batchbuffer_alloc(intel); intel_fbo_init(intel); -- cgit v1.2.3 From 85fa900b932243785e528e73fe119c27fa1988c4 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Sat, 25 Sep 2010 10:48:52 +0800 Subject: i965: don't do calculation for delta_xy on sandybridge Sandybridge doesn't have Xstart/Ystart in payload header. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index a9ebc2689ce..d5219a3d116 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -173,6 +173,7 @@ void emit_delta_xy(struct brw_compile *p, GLuint mask, const struct brw_reg *arg0) { + struct intel_context *intel = &p->brw->intel; struct brw_reg r1 = brw_vec1_grf(1, 0); if (mask == 0) @@ -180,6 +181,21 @@ void emit_delta_xy(struct brw_compile *p, assert(mask == WRITEMASK_XY); + if (intel->gen >= 6) { + /* XXX Gen6 WM doesn't have Xstart/Ystart in payload r1.0/r1.1. + Just add them with 0.0 for dst reg.. */ + r1 = brw_imm_v(0x00000000); + brw_ADD(p, + dst[0], + retype(arg0[0], BRW_REGISTER_TYPE_UW), + r1); + brw_ADD(p, + dst[1], + retype(arg0[1], BRW_REGISTER_TYPE_UW), + r1); + return; + } + /* Calc delta X,Y by subtracting origin in r1 from the pixel * centers produced by emit_pixel_xy(). */ -- cgit v1.2.3 From 15a8e7ec90433eea72416793c263febff078c888 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Sat, 25 Sep 2010 10:50:24 +0800 Subject: i965: fix pixel w interpolation on sandybridge --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index d5219a3d116..f52372ee46f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -269,6 +269,13 @@ void emit_pixel_w(struct brw_wm_compile *c, { struct brw_compile *p = &c->func; struct intel_context *intel = &p->brw->intel; + struct brw_reg src; + struct brw_reg temp_dst; + + if (intel->gen >= 6) + temp_dst = dst[3]; + else + temp_dst = brw_message_reg(2); assert(intel->gen < 6); @@ -282,24 +289,29 @@ void emit_pixel_w(struct brw_wm_compile *c, * result straight into a message reg. */ if (can_do_pln(intel, deltas)) { - brw_PLN(p, brw_message_reg(2), interp3, deltas[0]); + brw_PLN(p, temp_dst, interp3, deltas[0]); } else { brw_LINE(p, brw_null_reg(), interp3, deltas[0]); - brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), deltas[1]); + brw_MAC(p, temp_dst, suboffset(interp3, 1), deltas[1]); } /* Calc w */ + if (intel->gen >= 6) + src = temp_dst; + else + src = brw_null_reg(); + if (c->dispatch_width == 16) { brw_math_16(p, dst[3], BRW_MATH_FUNCTION_INV, BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), + 2, src, BRW_MATH_PRECISION_FULL); } else { brw_math(p, dst[3], BRW_MATH_FUNCTION_INV, BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), + 2, src, BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); } -- cgit v1.2.3 From 3f3059fcc0cfb797830eb5e0755b5b4ec3fd218b Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Sun, 26 Sep 2010 13:17:18 +0800 Subject: i965: enable polygon offset on sandybridge Depth offset function is moved to SF stage on sandybridge. --- src/mesa/drivers/dri/i965/gen6_sf_state.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index b5984255afa..a0322784685 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -87,6 +87,9 @@ upload_sf_state(struct brw_context *brw) if ((ctx->Polygon.FrontFace == GL_CCW) ^ render_to_fbo) dw2 |= GEN6_SF_WINDING_CCW; + if (ctx->Polygon.OffsetFill) + dw2 |= GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID; + /* _NEW_SCISSOR */ if (ctx->Scissor.Enabled) dw3 |= GEN6_SF_SCISSOR_ENABLE; -- cgit v1.2.3 From 4b6b0bf24a043035d7ada0c966e01df6327dc529 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Tue, 28 Sep 2010 15:35:22 +0800 Subject: i965: fix scissor state on sandybridge Fix incorrect scissor rect struct and missed scissor state pointer setting for sandybridge. --- src/mesa/drivers/dri/i965/brw_state.h | 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 1 + src/mesa/drivers/dri/i965/brw_structs.h | 8 +++++--- src/mesa/drivers/dri/i965/gen6_scissor_state.c | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index c5d296b1295..3beed16945b 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -102,6 +102,7 @@ extern const struct brw_tracked_state gen6_depth_stencil_state; extern const struct brw_tracked_state gen6_gs_state; extern const struct brw_tracked_state gen6_sampler_state; extern const struct brw_tracked_state gen6_scissor_state; +extern const struct brw_tracked_state gen6_scissor_state_pointers; extern const struct brw_tracked_state gen6_sf_state; extern const struct brw_tracked_state gen6_sf_vp; extern const struct brw_tracked_state gen6_urb; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index e4f36a7ec38..1aadd5ca61d 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -145,6 +145,7 @@ const struct brw_tracked_state *gen6_atoms[] = &gen6_wm_state, &gen6_scissor_state, + &gen6_scissor_state_pointers, &brw_state_base_address, diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 8e8f418eb78..7b919872c40 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -909,10 +909,12 @@ struct brw_sf_unit_state }; -struct gen6_scissor_state +struct gen6_scissor_rect { - GLuint ymin, xmin; - GLuint ymax, xmax; + GLuint xmin:16; + GLuint ymin:16; + GLuint xmax:16; + GLuint ymax:16; }; struct brw_gs_unit_state diff --git a/src/mesa/drivers/dri/i965/gen6_scissor_state.c b/src/mesa/drivers/dri/i965/gen6_scissor_state.c index 34a9dc234c2..3d483c710ce 100644 --- a/src/mesa/drivers/dri/i965/gen6_scissor_state.c +++ b/src/mesa/drivers/dri/i965/gen6_scissor_state.c @@ -35,7 +35,7 @@ prepare_scissor_state(struct brw_context *brw) { GLcontext *ctx = &brw->intel.ctx; const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0); - struct gen6_scissor_state scissor; + struct gen6_scissor_rect scissor; /* _NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT */ @@ -84,7 +84,6 @@ static void upload_scissor_state_pointers(struct brw_context *brw) OUT_RELOC(brw->sf.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0); ADVANCE_BATCH(); - intel_batchbuffer_emit_mi_flush(intel->batch); } -- cgit v1.2.3 From ec99833e928baf8dc8c958e3df6f3bbdce922794 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Sun, 26 Sep 2010 14:36:14 +0800 Subject: i965: fix point sprite on sandybridge Need to set point sprite function in fixed SF state now on sandybridge. --- src/mesa/drivers/dri/i965/gen6_sf_state.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index a0322784685..6c883381958 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -68,7 +68,7 @@ upload_sf_state(struct brw_context *brw) /* CACHE_NEW_VS_PROG */ uint32_t num_inputs = brw_count_bits(brw->vs.prog_data->outputs_written); uint32_t num_outputs = brw_count_bits(brw->fragment_program->Base.InputsRead); - uint32_t dw1, dw2, dw3, dw4; + uint32_t dw1, dw2, dw3, dw4, dw16; int i; /* _NEW_BUFFER */ GLboolean render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0; @@ -82,6 +82,7 @@ upload_sf_state(struct brw_context *brw) GEN6_SF_STATISTICS_ENABLE; dw3 = 0; dw4 = 0; + dw16 = 0; /* _NEW_POLYGON */ if ((ctx->Polygon.FrontFace == GL_CCW) ^ render_to_fbo) @@ -129,7 +130,7 @@ upload_sf_state(struct brw_context *brw) dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 225.875), 3) << GEN6_SF_POINT_WIDTH_SHIFT; - if (render_to_fbo) + if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT; /* _NEW_LIGHT */ @@ -143,6 +144,13 @@ upload_sf_state(struct brw_context *brw) (1 << GEN6_SF_TRIFAN_PROVOKE_SHIFT); } + if (ctx->Point.PointSprite) { + for (i = 0; i < 8; i++) { + if (ctx->Point.CoordReplace[i]) + dw16 |= (1 << i); + } + } + BEGIN_BATCH(20); OUT_BATCH(CMD_3D_SF_STATE << 16 | (20 - 2)); OUT_BATCH(dw1); @@ -172,7 +180,7 @@ upload_sf_state(struct brw_context *brw) } OUT_BATCH(attr_overrides); } - OUT_BATCH(0); /* point sprite texcoord bitmask */ + OUT_BATCH(dw16); /* point sprite texcoord bitmask */ OUT_BATCH(0); /* constant interp bitmask */ OUT_BATCH(0); /* wrapshortest enables 0-7 */ OUT_BATCH(0); /* wrapshortest enables 8-15 */ -- cgit v1.2.3 From 3074b61f64601be4620f1fb3c48c7c6024d3fd57 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Mon, 27 Sep 2010 09:58:09 +0800 Subject: i965: fix occlusion query on sandybridge Fix pipe control command for depth stall and PS_DEPTH_COUNT write. --- src/mesa/drivers/dri/i965/brw_queryobj.c | 161 ++++++++++++++++++++++--------- 1 file changed, 114 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index f6868c83ac7..1b183735d75 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -107,16 +107,29 @@ brw_begin_query(GLcontext *ctx, struct gl_query_object *q) query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query", 4096, 4096); - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_WRITE_TIMESTAMP); - OUT_RELOC(query->bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - 0); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 0); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 0); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } } else { /* Reset our driver's tracking of query state. */ drm_intel_bo_unreference(query->bo); @@ -140,16 +153,29 @@ brw_end_query(GLcontext *ctx, struct gl_query_object *q) struct brw_query_object *query = (struct brw_query_object *)q; if (query->Base.Target == GL_TIME_ELAPSED_EXT) { - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_WRITE_TIMESTAMP); - OUT_RELOC(query->bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - 8); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 8); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 8); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } intel_batchbuffer_flush(intel->batch); } else { @@ -223,22 +249,43 @@ brw_emit_query_begin(struct brw_context *brw) if (!query || brw->query.active) return; - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_DEPTH_STALL | - PIPE_CONTROL_WRITE_DEPTH_COUNT); - /* This object could be mapped cacheable, but we don't have an exposed - * mechanism to support that. Since it's going uncached, tell GEM that - * we're writing to it. The usual clflush should be all that's required - * to pick up the results. - */ - OUT_RELOC(brw->query.bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - ((brw->query.index * 2) * sizeof(uint64_t))); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(8); + + /* workaround: CS stall required before depth stall. */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_CS_STALL); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2) * sizeof(uint64_t))); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + /* This object could be mapped cacheable, but we don't have an exposed + * mechanism to support that. Since it's going uncached, tell GEM that + * we're writing to it. The usual clflush should be all that's required + * to pick up the results. + */ + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2) * sizeof(uint64_t))); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } if (query->bo != brw->query.bo) { if (query->bo != NULL) @@ -260,17 +307,37 @@ brw_emit_query_end(struct brw_context *brw) if (!brw->query.active) return; - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_DEPTH_STALL | - PIPE_CONTROL_WRITE_DEPTH_COUNT); - OUT_RELOC(brw->query.bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - ((brw->query.index * 2 + 1) * sizeof(uint64_t))); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(8); + /* workaround: CS stall required before depth stall. */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_CS_STALL); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2 + 1) * sizeof(uint64_t))); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2 + 1) * sizeof(uint64_t))); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } brw->query.active = GL_FALSE; brw->query.index++; -- cgit v1.2.3 From 45b37c4b12bb328e804a2b58c90e0099240879d3 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Tue, 28 Sep 2010 15:50:59 +0800 Subject: i965: fallback bitmap operation on sandybridge Need to bring back correct fb write with header to set pixel write mask. Fallback for now. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index c62e16f5878..23410f063c4 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -326,9 +326,15 @@ intelBitmap(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLubyte * pixels) { + struct intel_context *intel = intel_context(ctx); + if (do_blit_bitmap(ctx, x, y, width, height, unpack, pixels)) return; + /* FIXME */ + if (intel->gen == 6) + return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); + _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); } -- cgit v1.2.3 From 175261a1f1bfb1317d787c05f1ccde7f10629636 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Sep 2010 15:05:11 +1000 Subject: r600g: on evergreen the centroid isn't set in this register. --- src/gallium/drivers/r600/eg_hw_states.c | 1 - src/gallium/drivers/r600/evergreen_state.c | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 889eedadef5..ebbc9c3f375 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -942,7 +942,6 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)); - tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 71c4a4b9d85..de1b3b2b543 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1514,7 +1514,6 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader for (i = 0; i < rshader->ninput; i++) { tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); - tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || -- cgit v1.2.3 From e0b93c5bebab8ebd2e387d6031f97c6bc4328dbf Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Mon, 27 Sep 2010 19:35:50 +0200 Subject: nv50: fix GP state bind and validate --- src/gallium/drivers/nv50/nv50_shader_state.c | 4 ++++ src/gallium/drivers/nv50/nv50_state.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index 1a2fe758a85..6c41e8f4561 100644 --- a/src/gallium/drivers/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nv50/nv50_shader_state.c @@ -362,6 +362,10 @@ nv50_geomprog_validate(struct nv50_context *nv50) struct nv50_program *p = nv50->geomprog; struct nouveau_stateobj *so = NULL; + /* GP may be NULL, but VP and FP may not */ + if (!p) + return NULL; /* GP is deactivated in linkage validation */ + if (!p->translated) { if (nv50_program_validate(p)) nv50_gp_update_stateobj(nv50, p); diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 3afce06557a..f42fa2d4d2b 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -663,7 +663,7 @@ nv50_gp_state_bind(struct pipe_context *pipe, void *hwcso) { struct nv50_context *nv50 = nv50_context(pipe); - nv50->fragprog = hwcso; + nv50->geomprog = hwcso; nv50->dirty |= NV50_NEW_GEOMPROG; } -- cgit v1.2.3 From 5a38cec7c807db07a6e8f1f2557fa75778a19763 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 28 Sep 2010 08:59:47 -0400 Subject: r600g: use ptr for blit depth uncompress function Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_context.c | 1 + src/gallium/drivers/r600/r600_resource.h | 2 ++ src/gallium/drivers/r600/r600_state2.c | 42 ++++++++++++++++++++++++++++++++ src/gallium/drivers/r600/r600_texture.c | 4 ++- 4 files changed, 48 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index ec1f44639a3..091751e93a9 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -170,6 +170,7 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) rctx->ctx = radeon_ctx_init(rscreen->rw); radeon_draw_init(&rctx->draw, rscreen->rw); + r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth; return &rctx->context; out_free: FREE(rctx); diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index a24197c3c23..b0026e95789 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -104,4 +104,6 @@ static INLINE boolean r600_buffer_is_user_buffer(struct pipe_resource *buffer) int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture); + +extern int (*r600_blit_uncompress_depth_ptr)(struct pipe_context *ctx, struct r600_resource_texture *texture); #endif diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index a88426fc9a4..32a11d8522d 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -743,6 +743,46 @@ static void r600_blitter_save_states(struct pipe_context *ctx) /* TODO queries */ } +int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state fb = *rctx->pframebuffer; + struct pipe_surface *zsurf, *cbsurf; + int level = 0; + float depth = 1.0f; + + for (int i = 0; i < fb.nr_cbufs; i++) { + fb.cbufs[i] = NULL; + pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]); + } + fb.zsbuf = NULL; + pipe_surface_reference(&fb.zsbuf, rctx->pframebuffer->zsbuf); + + zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, + PIPE_BIND_DEPTH_STENCIL); + + cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0, + PIPE_BIND_RENDER_TARGET); + + r600_blitter_save_states(ctx); + util_blitter_save_framebuffer(rctx->blitter, &fb); + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + depth = 0.0f; + + util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); + + pipe_surface_reference(&zsurf, NULL); + pipe_surface_reference(&cbsurf, NULL); + for (int i = 0; i < fb.nr_cbufs; i++) { + pipe_surface_reference(&fb.cbufs[i], NULL); + } + pipe_surface_reference(&fb.zsbuf, NULL); + + return 0; +} + static void r600_clear(struct pipe_context *ctx, unsigned buffers, const float *rgba, double depth, unsigned stencil) { @@ -2270,6 +2310,8 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi LIST_INITHEAD(&rctx->query_list); rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); + r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth2; + return &rctx->context; } diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 16468c9b1a9..c24aaeefa77 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -234,6 +234,8 @@ static unsigned int r600_texture_is_referenced(struct pipe_context *context, return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } +int (*r600_blit_uncompress_depth_ptr)(struct pipe_context *ctx, struct r600_resource_texture *texture); + int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture) { @@ -263,7 +265,7 @@ int r600_texture_depth_flush(struct pipe_context *ctx, } out: - r600_blit_uncompress_depth(ctx, rtex); + r600_blit_uncompress_depth_ptr(ctx, rtex); return 0; } -- cgit v1.2.3 From b534eb16a298ce02e723c53c1d021f35a4a873a2 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 28 Sep 2010 11:07:20 -0400 Subject: r600g: fix remaining piglit issue in new design Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 20 ++++++++++++++++---- src/gallium/drivers/r600/r600_state2.c | 20 ++++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index de1b3b2b543..0803a5768c0 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -170,7 +170,7 @@ static void *evergreen_create_dsa_state(struct pipe_context *ctx, * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will * be set if shader use texkill instruction */ - db_shader_control = 0x210; + db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); stencil_ref_mask = 0; stencil_ref_mask_bf = 0; db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | @@ -243,7 +243,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); struct r600_pipe_state *rstate; unsigned tmp; - unsigned prov_vtx = 1; + unsigned prov_vtx = 1, polygon_dual_mode; if (rs == NULL) { return NULL; @@ -273,6 +273,8 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, } r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || + state->fill_back != PIPE_POLYGON_MODE_FILL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | @@ -280,7 +282,10 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, S_028814_FACE(!state->front_ccw) | S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri), 0xFFFFFFFF, NULL); + S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | + S_028814_POLY_MODE(polygon_dual_mode) | + S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | + S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); @@ -756,8 +761,9 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state color_info = S_028C70_FORMAT(format) | S_028C70_COMP_SWAP(swap) | S_028C70_BLEND_CLAMP(1) | - S_028C70_SOURCE_FORMAT(1) | S_028C70_NUMBER_TYPE(ntype); + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) + color_info |= S_028C70_SOURCE_FORMAT(1); /* FIXME handle enabling of CB beyond BASE8 which has different offset */ r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, @@ -1529,6 +1535,12 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader } r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } + for (i = 0; i < rshader->noutput; i++) { + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02880C_DB_SHADER_CONTROL, + S_02880C_Z_EXPORT_ENABLE(1), + S_02880C_Z_EXPORT_ENABLE(1), NULL); + } exports_ps = 0; num_cout = 0; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 32a11d8522d..153780594e5 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -147,6 +147,12 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade } r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } + for (i = 0; i < rshader->noutput; i++) { + r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + R_02880C_DB_SHADER_CONTROL, + S_02880C_Z_EXPORT_ENABLE(1), + S_02880C_Z_EXPORT_ENABLE(1), NULL); + } exports_ps = 0; num_cout = 0; @@ -981,7 +987,7 @@ static void *r600_create_dsa_state(struct pipe_context *ctx, * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will * be set if shader use texkill instruction */ - db_shader_control = 0x210; + db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); stencil_ref_mask = 0; stencil_ref_mask_bf = 0; db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | @@ -1055,7 +1061,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); struct r600_pipe_state *rstate; unsigned tmp; - unsigned prov_vtx = 1; + unsigned prov_vtx = 1, polygon_dual_mode; if (rs == NULL) { return NULL; @@ -1085,6 +1091,8 @@ static void *r600_create_rs_state(struct pipe_context *ctx, } r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || + state->fill_back != PIPE_POLYGON_MODE_FILL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | @@ -1092,7 +1100,10 @@ static void *r600_create_rs_state(struct pipe_context *ctx, S_028814_FACE(!state->front_ccw) | S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri), 0xFFFFFFFF, NULL); + S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | + S_028814_POLY_MODE(polygon_dual_mode) | + S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | + S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); @@ -1567,8 +1578,9 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta color_info = S_0280A0_FORMAT(format) | S_0280A0_COMP_SWAP(swap) | S_0280A0_BLEND_CLAMP(1) | - S_0280A0_SOURCE_FORMAT(1) | S_0280A0_NUMBER_TYPE(ntype); + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) + color_info |= S_0280A0_SOURCE_FORMAT(1); r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + cb * 4, -- cgit v1.2.3 From 7ee8fa0421fd3c6522120d8639c6b311674a9b10 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 28 Sep 2010 11:37:30 -0400 Subject: r600g: switch to new design New design seems to be on parity according to piglit, make it default to get more exposure and see if there is any show stopper in the coming days. Signed-off-by: Jerome Glisse --- src/gallium/targets/dri-r600/target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index eb268d5bc01..2c1b2f5be45 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -4,7 +4,7 @@ #include "r600/drm/r600_drm_public.h" #include "r600/r600_public.h" -#if 1 +#if 0 static struct pipe_screen * create_screen(int fd) { -- cgit v1.2.3 From fceb78e3cc67d035a69613826f46a18e62235f5c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 21:15:28 -0700 Subject: i965: Fix negation in the new FS backend. Fixes: glsl1-Negation glsl1-Negation2 --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 7f2bf84a140..d05aa29014f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -638,7 +638,7 @@ fs_visitor::visit(ir_expression *ir) emit(fs_inst(BRW_OPCODE_ADD, this->result, op[0], fs_reg(-1))); break; case ir_unop_neg: - op[0].negate = ~op[0].negate; + op[0].negate = !op[0].negate; this->result = op[0]; break; case ir_unop_abs: -- cgit v1.2.3 From e10508812aed4c41c62ea27ac540c8d079bece07 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 21:25:55 -0700 Subject: i965: Actually track the "if" depth in loop in the new FS backend. Fixes: glsl-fs-if-nested-loop. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d05aa29014f..c324be210a0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1789,6 +1789,7 @@ fs_visitor::generate_code() case BRW_OPCODE_IF: assert(if_stack_depth < 16); if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8); + if_depth_in_loop[loop_stack_depth]++; if_stack_depth++; break; case BRW_OPCODE_ELSE: @@ -1798,6 +1799,7 @@ fs_visitor::generate_code() case BRW_OPCODE_ENDIF: if_stack_depth--; brw_ENDIF(p , if_stack[if_stack_depth]); + if_depth_in_loop[loop_stack_depth]--; break; case BRW_OPCODE_DO: -- cgit v1.2.3 From 1723fdb3f0004a685351d005ba0f5bfc1c2a852e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 21:35:54 -0700 Subject: i965: Apply the same set of lowering passes to new FS as to Mesa IR. While much of this we will want to support natively, this should make the task of reaching the Mesa IR backend's quality easier. Fixes: glsl-fs-main-return. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c324be210a0..31f5bbf5871 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -141,7 +141,22 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) do { progress = false; + progress = do_lower_jumps(shader->ir, true, true, + true, /* main return */ + false, /* continue */ + false /* loops */ + ) || progress; + progress = do_common_optimization(shader->ir, true, 32) || progress; + + progress = lower_noise(shader->ir) || progress; + progress = + lower_variable_index_to_cond_assign(shader->ir, + GL_TRUE, /* input */ + GL_TRUE, /* output */ + GL_TRUE, /* temp */ + GL_TRUE /* uniform */ + ) || progress; } while (progress); validate_ir_tree(shader->ir); -- cgit v1.2.3 From 57edd7c5c116926325e3a86cef618bfd1b5881c1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 22:06:38 -0700 Subject: i965: Fix valgrind complaint about base_ir for new FS debugging. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 31f5bbf5871..27ea9121b40 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -405,6 +405,7 @@ public: this->current_annotation = NULL; this->annotation_string = NULL; this->annotation_ir = NULL; + this->base_ir = NULL; } ~fs_visitor() { -- cgit v1.2.3 From 719f84d9aba6b016e1069e0461cbfc4211f5a3b5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 22:15:36 -0700 Subject: i965: Fix up the FS backend for the variable array indexing pass. We need to re-run channel expressions afterwards as it generates new vector expressions, and we need to successfully support conditional assignment (brw_CMP takes 2 operands, not 1). --- src/mesa/drivers/dri/i965/brw_fs.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 27ea9121b40..78c1bc6ea6b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -135,12 +135,12 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) do_sub_to_add_neg(shader->ir); do_explog_to_explog2(shader->ir); - brw_do_channel_expressions(shader->ir); - brw_do_vector_splitting(shader->ir); - do { progress = false; + brw_do_channel_expressions(shader->ir); + brw_do_vector_splitting(shader->ir); + progress = do_lower_jumps(shader->ir, true, true, true, /* main return */ false, /* continue */ @@ -520,6 +520,14 @@ fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) case GLSL_TYPE_UINT: this->type = BRW_REGISTER_TYPE_UD; break; + case GLSL_TYPE_ARRAY: + case GLSL_TYPE_STRUCT: + /* These should be overridden with the type of the member when + * dereferenced into. BRW_REGISTER_TYPE_UD seems like a likely + * way to trip up if we don't. + */ + this->type = BRW_REGISTER_TYPE_UD; + break; default: assert(!"not reached"); this->type = BRW_REGISTER_TYPE_F; @@ -877,7 +885,7 @@ fs_visitor::visit(ir_assignment *ir) if (ir->condition) { /* Get the condition bool into the predicate. */ ir->condition->accept(this); - inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, fs_reg(0))); + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, this->result, fs_reg(0))); inst->conditional_mod = BRW_CONDITIONAL_NZ; } -- cgit v1.2.3 From 07fc8eed8f0398063d87acf3a7ee392da4184822 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 22:19:51 -0700 Subject: i965: Set the variable type when dereferencing an array. We don't set the type on the array virtual reg as a whole, so here's the right place. Fixes: glsl1-GLSL 1.20 arrays glsl1-temp array with constant indexing, fragment shader glsl1-temp array with swizzled variable indexing --- src/mesa/drivers/dri/i965/brw_fs.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 78c1bc6ea6b..3b56340343f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -613,6 +613,21 @@ fs_visitor::visit(ir_dereference_array *ir) element_size = ir->type->vector_elements; } else { element_size = type_size(ir->type); + switch (ir->type->base_type) { + case GLSL_TYPE_UINT: + this->result.type = BRW_REGISTER_TYPE_UD; + break; + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + this->result.type = BRW_REGISTER_TYPE_D; + break; + case GLSL_TYPE_FLOAT: + this->result.type = BRW_REGISTER_TYPE_F; + break; + default: + /* deref producing struct, no need to tweak type yet. */ + break; + } } if (index) { -- cgit v1.2.3 From ba481f2046e6427c8bd7fc5f8cb8ef3059a7881a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 22:26:22 -0700 Subject: i965: Add support for dereferencing structs to the new FS backend. Fixes: glsl1-struct(2) --- src/mesa/drivers/dri/i965/brw_fs.cpp | 67 +++++++++++++++++------------------- 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 3b56340343f..4f88ca10c19 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -499,42 +499,42 @@ fs_reg::fs_reg(enum register_file file, int hw_reg) this->type = BRW_REGISTER_TYPE_F; } -/** Automatic reg constructor. */ -fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) +int +brw_type_for_base_type(const struct glsl_type *type) { - init(); - - this->file = GRF; - this->reg = v->next_abstract_grf; - this->reg_offset = 0; - v->next_abstract_grf += type_size(type); - switch (type->base_type) { case GLSL_TYPE_FLOAT: - this->type = BRW_REGISTER_TYPE_F; - break; + return BRW_REGISTER_TYPE_F; case GLSL_TYPE_INT: case GLSL_TYPE_BOOL: - this->type = BRW_REGISTER_TYPE_D; - break; + return BRW_REGISTER_TYPE_D; case GLSL_TYPE_UINT: - this->type = BRW_REGISTER_TYPE_UD; - break; + return BRW_REGISTER_TYPE_UD; case GLSL_TYPE_ARRAY: case GLSL_TYPE_STRUCT: /* These should be overridden with the type of the member when * dereferenced into. BRW_REGISTER_TYPE_UD seems like a likely * way to trip up if we don't. */ - this->type = BRW_REGISTER_TYPE_UD; - break; + return BRW_REGISTER_TYPE_UD; default: assert(!"not reached"); - this->type = BRW_REGISTER_TYPE_F; - break; + return BRW_REGISTER_TYPE_F; } } +/** Automatic reg constructor. */ +fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) +{ + init(); + + this->file = GRF; + this->reg = v->next_abstract_grf; + this->reg_offset = 0; + v->next_abstract_grf += type_size(type); + this->type = brw_type_for_base_type(type); +} + fs_reg * fs_visitor::variable_storage(ir_variable *var) { @@ -597,7 +597,18 @@ fs_visitor::visit(ir_dereference_variable *ir) void fs_visitor::visit(ir_dereference_record *ir) { - assert(!"FINISHME"); + const glsl_type *struct_type = ir->record->type; + + ir->record->accept(this); + + unsigned int offset = 0; + for (unsigned int i = 0; i < struct_type->length; i++) { + if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0) + break; + offset += type_size(struct_type->fields.structure[i].type); + } + this->result.reg_offset += offset; + this->result.type = brw_type_for_base_type(ir->type); } void @@ -613,21 +624,7 @@ fs_visitor::visit(ir_dereference_array *ir) element_size = ir->type->vector_elements; } else { element_size = type_size(ir->type); - switch (ir->type->base_type) { - case GLSL_TYPE_UINT: - this->result.type = BRW_REGISTER_TYPE_UD; - break; - case GLSL_TYPE_INT: - case GLSL_TYPE_BOOL: - this->result.type = BRW_REGISTER_TYPE_D; - break; - case GLSL_TYPE_FLOAT: - this->result.type = BRW_REGISTER_TYPE_F; - break; - default: - /* deref producing struct, no need to tweak type yet. */ - break; - } + this->result.type = brw_type_for_base_type(ir->type); } if (index) { -- cgit v1.2.3 From 6bf12c8b7366a9db8c88b9cacaa06266b41a73b5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 09:31:56 -0700 Subject: i965: Add support for struct, array, and matrix uniforms to FS backend. Fixes 16 piglit cases. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 75 ++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4f88ca10c19..4a63fc61aaa 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -453,6 +453,7 @@ public: void emit_fb_writes(); struct brw_reg interp_reg(int location, int channel); + int setup_uniform_values(int loc, const glsl_type *type); struct brw_context *brw; struct intel_context *intel; @@ -541,6 +542,64 @@ fs_visitor::variable_storage(ir_variable *var) return (fs_reg *)hash_table_find(this->variable_ht, var); } +/* Our support for uniforms is piggy-backed on the struct + * gl_fragment_program, because that's where the values actually + * get stored, rather than in some global gl_shader_program uniform + * store. + */ +int +fs_visitor::setup_uniform_values(int loc, const glsl_type *type) +{ + const struct gl_program *fp = &this->brw->fragment_program->Base; + unsigned int offset = 0; + float *vec_values; + + if (type->is_matrix()) { + const glsl_type *column = glsl_type::get_instance(GLSL_TYPE_FLOAT, + type->vector_elements, + 1); + + for (unsigned int i = 0; i < type->matrix_columns; i++) { + offset += setup_uniform_values(loc + offset, column); + } + + return offset; + } + + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + vec_values = fp->Parameters->ParameterValues[loc]; + for (unsigned int i = 0; i < type->vector_elements; i++) { + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; + } + return 1; + + case GLSL_TYPE_STRUCT: + for (unsigned int i = 0; i < type->length; i++) { + offset += setup_uniform_values(loc + offset, + type->fields.structure[i].type); + } + return offset; + + case GLSL_TYPE_ARRAY: + for (unsigned int i = 0; i < type->length; i++) { + offset += setup_uniform_values(loc + offset, type->fields.array); + } + return offset; + + case GLSL_TYPE_SAMPLER: + /* The sampler takes up a slot, but we don't use any values from it. */ + return 1; + + default: + assert(!"not reached"); + return 0; + } +} + void fs_visitor::visit(ir_variable *ir) { @@ -560,23 +619,9 @@ fs_visitor::visit(ir_variable *ir) } if (ir->mode == ir_var_uniform) { - const float *vec_values; int param_index = c->prog_data.nr_params; - /* FINISHME: This is wildly incomplete. */ - assert(ir->type->is_scalar() || ir->type->is_vector() || - ir->type->is_sampler()); - - const struct gl_program *fp = &this->brw->fragment_program->Base; - /* Our support for uniforms is piggy-backed on the struct - * gl_fragment_program, because that's where the values actually - * get stored, rather than in some global gl_shader_program uniform - * store. - */ - vec_values = fp->Parameters->ParameterValues[ir->location]; - for (unsigned int i = 0; i < ir->type->vector_elements; i++) { - c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; - } + setup_uniform_values(ir->location, ir->type); reg = new(this->mem_ctx) fs_reg(UNIFORM, param_index); } -- cgit v1.2.3 From f1dba030564e66ca52f4ed44172681e7d2e90ad2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 10:07:56 -0700 Subject: i965: Fix all non-snb regression in the snb attribute interpolation commit. This apparently had never been tested elsewhere before being merged to master. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index a88b7bdea85..d4d75d63d8c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -342,7 +342,7 @@ static struct prog_src_register get_pixel_w( struct brw_wm_compile *c ) if (c->func.brw->intel.gen >= 6) return src_undef(); - if (!src_is_undef(c->pixel_w)) { + if (src_is_undef(c->pixel_w)) { struct prog_dst_register pixel_w = get_temp(c); struct prog_src_register deltas = get_delta_xy(c); struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS); -- cgit v1.2.3 From ef8e002c75a5def2c400638336dcd55d411d87be Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 10:05:10 -0700 Subject: i965: Fix up part of my Sandybridge attributes support patch. I confused the array sizing for number of files for the number of regs in a file. --- src/mesa/drivers/dri/i965/brw_wm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index a38df1e111e..ae6a1d56f7e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -182,6 +182,8 @@ struct brw_wm_instruction { #define MAX_WM_OPCODE (MAX_OPCODE + 9) #define PROGRAM_PAYLOAD (PROGRAM_FILE_MAX) +#define NUM_FILES (PROGRAM_PAYLOAD + 1) + #define PAYLOAD_DEPTH (FRAG_ATTRIB_MAX) #define PAYLOAD_W (FRAG_ATTRIB_MAX + 1) #define PAYLOAD_FP_REG_MAX (FRAG_ATTRIB_MAX + 2) @@ -227,7 +229,7 @@ struct brw_wm_compile { } payload; - const struct brw_wm_ref *pass0_fp_reg[PAYLOAD_FP_REG_MAX][256][4]; + const struct brw_wm_ref *pass0_fp_reg[NUM_FILES][256][4]; struct brw_wm_ref undef_ref; struct brw_wm_value undef_value; @@ -255,7 +257,7 @@ struct brw_wm_compile { struct { GLboolean inited; struct brw_reg reg; - } wm_regs[PAYLOAD_FP_REG_MAX][256][4]; + } wm_regs[NUM_FILES][256][4]; GLboolean used_grf[BRW_WM_MAX_GRF]; GLuint first_free_grf; -- cgit v1.2.3 From 5f7bd68149e59b6940e891928faa532bce0271f6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 09:47:37 -0700 Subject: i965: Add support for gl_FrontFacing to the new FS backend. Fixes: glsl1-gl_FrontFacing var (1) glsl1-gl_FrontFacing var (2) --- src/mesa/drivers/dri/i965/brw_fs.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4a63fc61aaa..0595488c9cc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -615,7 +615,21 @@ fs_visitor::visit(ir_variable *ir) } if (ir->mode == ir_var_in) { - reg = &this->interp_attrs[ir->location]; + if (strcmp(ir->name, "gl_FrontFacing") == 0) { + reg = new(this->mem_ctx) fs_reg(this, ir->type); + struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); + /* bit 31 is "primitive is back face", so checking < (1 << 31) gives + * us front face + */ + fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, + *reg, + fs_reg(r1_6ud), + fs_reg(1u << 31))); + inst->conditional_mod = BRW_CONDITIONAL_L; + emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); + } else { + reg = &this->interp_attrs[ir->location]; + } } if (ir->mode == ir_var_uniform) { @@ -1342,8 +1356,6 @@ fs_visitor::emit_interpolation() this->pixel_w = fs_reg(this, glsl_type::float_type); emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos)); - /* FINISHME: gl_FrontFacing */ - foreach_iter(exec_list_iterator, iter, *this->shader->ir) { ir_instruction *ir = (ir_instruction *)iter.get(); ir_variable *var = ir->as_variable(); -- cgit v1.2.3 From 9e96c737f8cb6faebf7c7339cfcf14f80ed8e73c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 10:18:31 -0700 Subject: i965: Subtract instead of adding when computing y delta in new FS backend. Fixes 7 piglit cases. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 0595488c9cc..723ebca61bb 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1335,7 +1335,7 @@ fs_visitor::emit_interpolation() emit(fs_inst(BRW_OPCODE_ADD, this->delta_y, this->pixel_y, - fs_reg(brw_vec1_grf(1, 1)))); + fs_reg(negate(brw_vec1_grf(1, 1))))); this->current_annotation = "compute pos.w and 1/pos.w"; /* Compute wpos. Unlike many other varying inputs, we usually need it -- cgit v1.2.3 From fe790a3c346b5edb8b64cfc937b0d5cd9e337412 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 28 Sep 2010 14:21:35 -0400 Subject: r600g: suspend/resume occlusion query around clear/copy Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 2 ++ src/gallium/drivers/r600/r600_state2.c | 8 ++++++++ src/gallium/winsys/r600/drm/r600_state2.c | 7 ++----- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index b8c74675e60..adc35afc025 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -278,6 +278,8 @@ boolean r600_context_query_result(struct r600_context *ctx, boolean wait, void *vresult); void r600_query_begin(struct r600_context *ctx, struct r600_query *query); void r600_query_end(struct r600_context *ctx, struct r600_query *query); +void r600_context_queries_suspend(struct r600_context *ctx); +void r600_context_queries_resume(struct r600_context *ctx); int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon); void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw); diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 153780594e5..72d04534e62 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -757,6 +757,7 @@ int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_t int level = 0; float depth = 1.0f; + r600_context_queries_suspend(&rctx->ctx); for (int i = 0; i < fb.nr_cbufs; i++) { fb.cbufs[i] = NULL; pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]); @@ -785,6 +786,7 @@ int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_t pipe_surface_reference(&fb.cbufs[i], NULL); } pipe_surface_reference(&fb.zsbuf, NULL); + r600_context_queries_resume(&rctx->ctx); return 0; } @@ -795,10 +797,12 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers, struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct pipe_framebuffer_state *fb = &rctx->framebuffer; + r600_context_queries_suspend(&rctx->ctx); r600_blitter_save_states(ctx); util_blitter_clear(rctx->blitter, fb->width, fb->height, fb->nr_cbufs, buffers, rgba, depth, stencil); + r600_context_queries_resume(&rctx->ctx); } static void r600_clear_render_target(struct pipe_context *ctx, @@ -810,9 +814,11 @@ static void r600_clear_render_target(struct pipe_context *ctx, struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct pipe_framebuffer_state *fb = &rctx->framebuffer; + r600_context_queries_suspend(&rctx->ctx); util_blitter_save_framebuffer(rctx->blitter, fb); util_blitter_clear_render_target(rctx->blitter, dst, rgba, dstx, dsty, width, height); + r600_context_queries_resume(&rctx->ctx); } static void r600_clear_depth_stencil(struct pipe_context *ctx, @@ -826,9 +832,11 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct pipe_framebuffer_state *fb = &rctx->framebuffer; + r600_context_queries_suspend(&rctx->ctx); util_blitter_save_framebuffer(rctx->blitter, fb); util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height); + r600_context_queries_resume(&rctx->ctx); } diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 97aecc7a42c..779138656a6 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -61,9 +61,6 @@ void radeon_bo_reference(struct radeon *radeon, unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); -/* queries */ -static void r600_context_queries_suspend(struct r600_context *ctx); -static void r600_context_queries_resume(struct r600_context *ctx); static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offset) { @@ -1292,7 +1289,7 @@ boolean r600_context_query_result(struct r600_context *ctx, return TRUE; } -static void r600_context_queries_suspend(struct r600_context *ctx) +void r600_context_queries_suspend(struct r600_context *ctx) { struct r600_query *query; @@ -1304,7 +1301,7 @@ static void r600_context_queries_suspend(struct r600_context *ctx) } } -static void r600_context_queries_resume(struct r600_context *ctx) +void r600_context_queries_resume(struct r600_context *ctx) { struct r600_query *query; -- cgit v1.2.3 From 723a655ed3f3092f6fa74a903fb774a3cec93b79 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 28 Sep 2010 14:34:25 -0400 Subject: r600g: avoid rebuilding the vertex shader if no change to input format Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_pipe.h | 14 ++++++++------ src/gallium/drivers/r600/r600_state2.c | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 5abf910c81c..e161dc5066a 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -69,12 +69,6 @@ struct r600_pipe_blend { unsigned cb_target_mask; }; -struct r600_pipe_shader { - struct r600_shader shader; - struct r600_pipe_state rstate; - struct radeon_ws_bo *bo; -}; - struct r600_vertex_element { unsigned count; @@ -82,6 +76,14 @@ struct r600_vertex_element struct pipe_vertex_element elements[32]; }; +struct r600_pipe_shader { + struct r600_shader shader; + struct r600_pipe_state rstate; + struct radeon_ws_bo *bo; + struct r600_vertex_element vertex_elements; +}; + + struct r600_pipe_context { struct pipe_context context; struct blitter_context *blitter; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 72d04534e62..796442f5a4b 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -257,6 +257,10 @@ static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader if (shader->processor_type != TGSI_PROCESSOR_VERTEX) return 0; + if (!memcmp(&rshader->vertex_elements, rctx->vertex_elements, sizeof(struct r600_vertex_element))) { + return 0; + } + rshader->vertex_elements = *rctx->vertex_elements; for (i = 0; i < rctx->vertex_elements->count; i++) { resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format; } -- cgit v1.2.3 From a32893221ce253da7bb465e0ec9d0df5f7208d8f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 10:43:56 -0700 Subject: mesa: Pull ir_to_mesa's sampler number fetcher out to shared code. --- src/mesa/program/ir_to_mesa.cpp | 90 ++------------------------ src/mesa/program/sampler.cpp | 140 ++++++++++++++++++++++++++++++++++++++++ src/mesa/program/sampler.h | 29 +++++++++ src/mesa/sources.mak | 3 +- 4 files changed, 175 insertions(+), 87 deletions(-) create mode 100644 src/mesa/program/sampler.cpp create mode 100644 src/mesa/program/sampler.h (limited to 'src') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 93b6c305f19..aa2add4174c 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -54,6 +54,7 @@ extern "C" { #include "program/program.h" #include "program/prog_uniform.h" #include "program/prog_parameter.h" +#include "program/sampler.h" } static int swizzle_for_size(int size); @@ -274,8 +275,6 @@ public: GLboolean try_emit_mad(ir_expression *ir, int mul_operand); - int get_sampler_uniform_value(ir_dereference *deref); - void *mem_ctx; }; @@ -1894,89 +1893,6 @@ ir_to_mesa_visitor::visit(ir_call *ir) this->result = entry->return_reg; } -class get_sampler_name : public ir_hierarchical_visitor -{ -public: - get_sampler_name(ir_to_mesa_visitor *mesa, ir_dereference *last) - { - this->mem_ctx = mesa->mem_ctx; - this->mesa = mesa; - this->name = NULL; - this->offset = 0; - this->last = last; - } - - virtual ir_visitor_status visit(ir_dereference_variable *ir) - { - this->name = ir->var->name; - return visit_continue; - } - - virtual ir_visitor_status visit_leave(ir_dereference_record *ir) - { - this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field); - return visit_continue; - } - - virtual ir_visitor_status visit_leave(ir_dereference_array *ir) - { - ir_constant *index = ir->array_index->as_constant(); - int i; - - if (index) { - i = index->value.i[0]; - } else { - /* GLSL 1.10 and 1.20 allowed variable sampler array indices, - * while GLSL 1.30 requires that the array indices be - * constant integer expressions. We don't expect any driver - * to actually work with a really variable array index, so - * all that would work would be an unrolled loop counter that ends - * up being constant above. - */ - mesa->shader_program->InfoLog = - talloc_asprintf_append(mesa->shader_program->InfoLog, - "warning: Variable sampler array index " - "unsupported.\nThis feature of the language " - "was removed in GLSL 1.20 and is unlikely " - "to be supported for 1.10 in Mesa.\n"); - i = 0; - } - if (ir != last) { - this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); - } else { - offset = i; - } - return visit_continue; - } - - ir_to_mesa_visitor *mesa; - const char *name; - void *mem_ctx; - int offset; - ir_dereference *last; -}; - -int -ir_to_mesa_visitor::get_sampler_uniform_value(ir_dereference *sampler) -{ - get_sampler_name getname(this, sampler); - - sampler->accept(&getname); - - GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, - getname.name); - - if (index < 0) { - fail_link(this->shader_program, - "failed to find sampler named %s.\n", getname.name); - return 0; - } - - index += getname.offset; - - return this->prog->Parameters->ParameterValues[index][0]; -} - void ir_to_mesa_visitor::visit(ir_texture *ir) { @@ -2076,7 +1992,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) if (ir->shadow_comparitor) inst->tex_shadow = GL_TRUE; - inst->sampler = get_sampler_uniform_value(ir->sampler); + inst->sampler = _mesa_get_sampler_uniform_value(ir->sampler, + this->shader_program, + this->prog); const glsl_type *sampler_type = ir->sampler->type; diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp new file mode 100644 index 00000000000..0e58aef9c95 --- /dev/null +++ b/src/mesa/program/sampler.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 VMware, Inc. All Rights Reserved. + * Copyright © 2010 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#include + +extern "C" { +#include "main/compiler.h" +#include "main/mtypes.h" +#include "program/prog_parameter.h" +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" +} + +static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3); + +static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args); + va_end(args); + + prog->LinkStatus = GL_FALSE; +} + +class get_sampler_name : public ir_hierarchical_visitor +{ +public: + get_sampler_name(ir_dereference *last, + struct gl_shader_program *shader_program) + { + this->mem_ctx = talloc_new(NULL); + this->shader_program = shader_program; + this->name = NULL; + this->offset = 0; + this->last = last; + } + + ~get_sampler_name() + { + talloc_free(this->mem_ctx); + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + this->name = ir->var->name; + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_dereference_record *ir) + { + this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field); + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_dereference_array *ir) + { + ir_constant *index = ir->array_index->as_constant(); + int i; + + if (index) { + i = index->value.i[0]; + } else { + /* GLSL 1.10 and 1.20 allowed variable sampler array indices, + * while GLSL 1.30 requires that the array indices be + * constant integer expressions. We don't expect any driver + * to actually work with a really variable array index, so + * all that would work would be an unrolled loop counter that ends + * up being constant above. + */ + shader_program->InfoLog = + talloc_asprintf_append(shader_program->InfoLog, + "warning: Variable sampler array index " + "unsupported.\nThis feature of the language " + "was removed in GLSL 1.20 and is unlikely " + "to be supported for 1.10 in Mesa.\n"); + i = 0; + } + if (ir != last) { + this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + } else { + offset = i; + } + return visit_continue; + } + + struct gl_shader_program *shader_program; + const char *name; + void *mem_ctx; + int offset; + ir_dereference *last; +}; + +extern "C" { +int +_mesa_get_sampler_uniform_value(class ir_dereference *sampler, + struct gl_shader_program *shader_program, + const struct gl_program *prog) +{ + get_sampler_name getname(sampler, shader_program); + + sampler->accept(&getname); + + GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, + getname.name); + + if (index < 0) { + fail_link(shader_program, + "failed to find sampler named %s.\n", getname.name); + return 0; + } + + index += getname.offset; + + return prog->Parameters->ParameterValues[index][0]; +} +} diff --git a/src/mesa/program/sampler.h b/src/mesa/program/sampler.h new file mode 100644 index 00000000000..22467e99020 --- /dev/null +++ b/src/mesa/program/sampler.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 VMware, Inc. All Rights Reserved. + * Copyright © 2010 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +int +_mesa_get_sampler_uniform_value(class ir_dereference *sampler, + struct gl_shader_program *shader_program, + const struct gl_program *prog); diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 6f6598db82b..b2be5ba07f2 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -250,7 +250,8 @@ PROGRAM_SOURCES = \ program/symbol_table.c SHADER_CXX_SOURCES = \ - program/ir_to_mesa.cpp + program/ir_to_mesa.cpp \ + program/sampler.cpp ASM_C_SOURCES = \ x86/common_x86.c \ -- cgit v1.2.3 From 2999a44968a045b5516ff23d70b711b01bd696a5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 10:53:47 -0700 Subject: i965: Set up sampler numbers in the FS backend. +10 piglits --- src/mesa/drivers/dri/i965/brw_fs.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 723ebca61bb..fd13349ae62 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -34,6 +34,7 @@ extern "C" { #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_optimize.h" +#include "program/sampler.h" #include "program/hash_table.h" #include "brw_context.h" #include "brw_eu.h" @@ -387,6 +388,7 @@ public: this->c = c; this->p = &c->func; this->brw = p->brw; + this->fp = brw->fragment_program; this->intel = &brw->intel; this->ctx = &intel->ctx; this->mem_ctx = talloc_new(NULL); @@ -456,6 +458,7 @@ public: int setup_uniform_values(int loc, const glsl_type *type); struct brw_context *brw; + const struct gl_fragment_program *fp; struct intel_context *intel; GLcontext *ctx; struct brw_wm_compile *c; @@ -550,7 +553,6 @@ fs_visitor::variable_storage(ir_variable *var) int fs_visitor::setup_uniform_values(int loc, const glsl_type *type) { - const struct gl_program *fp = &this->brw->fragment_program->Base; unsigned int offset = 0; float *vec_values; @@ -571,7 +573,7 @@ fs_visitor::setup_uniform_values(int loc, const glsl_type *type) case GLSL_TYPE_UINT: case GLSL_TYPE_INT: case GLSL_TYPE_BOOL: - vec_values = fp->Parameters->ParameterValues[loc]; + vec_values = fp->Base.Parameters->ParameterValues[loc]; for (unsigned int i = 0; i < type->vector_elements; i++) { c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; } @@ -1045,6 +1047,12 @@ fs_visitor::visit(ir_texture *ir) break; } + inst->sampler = + _mesa_get_sampler_uniform_value(ir->sampler, + ctx->Shader.CurrentProgram, + &brw->fragment_program->Base); + inst->sampler = c->fp->program.Base.SamplerUnits[inst->sampler]; + this->result = dst; if (ir->shadow_comparitor) -- cgit v1.2.3 From f46a61554f2cc8904a381d3e514403dca9754360 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 28 Sep 2010 12:03:45 -0700 Subject: scons: Add program/sampler.cpp to SCons build. This is a follow-up to commit a32893221ce253da7bb465e0ec9d0df5f7208d8f. Fixes MinGW SCons build. --- src/mesa/SConscript | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 28598f4a17c..c89e635aab0 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -224,6 +224,7 @@ if env['platform'] != 'winddk': 'program/prog_statevars.c', 'program/prog_uniform.c', 'program/programopt.c', + 'program/sampler.cpp', 'program/symbol_table.c', ] -- cgit v1.2.3 From 86fd11262cb5697e5c3563e876781b3587788737 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 12:07:30 -0700 Subject: i965: Add support for non-color render target write data to new FS backend. This is the first time these payload bits have made sense to me, outside of brw_wm_pass* structure. Fixes: glsl1-gl_FragDepth writing --- src/mesa/drivers/dri/i965/brw_fs.cpp | 43 ++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index fd13349ae62..e8aff6bab9f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -75,6 +75,7 @@ enum fs_opcodes { }; static int using_new_fs = -1; +static struct brw_reg brw_reg_from_fs_reg(class fs_reg *reg); struct gl_shader * brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) @@ -613,7 +614,6 @@ fs_visitor::visit(ir_variable *ir) this->frag_data = ir; } else if (strcmp(ir->name, "gl_FragDepth") == 0) { this->frag_depth = ir; - assert(!"FINISHME: this hangs currently."); } if (ir->mode == ir_var_in) { @@ -1418,17 +1418,45 @@ void fs_visitor::emit_fb_writes() { this->current_annotation = "FB write"; + int nr = 0; + + /* m0, m1 header */ + nr += 2; + + if (c->key.aa_dest_stencil_reg) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), + fs_reg(brw_vec8_grf(c->key.aa_dest_stencil_reg, 0)))); + } assert(this->frag_color || !"FINISHME: MRT"); fs_reg color = *(variable_storage(this->frag_color)); for (int i = 0; i < 4; i++) { emit(fs_inst(BRW_OPCODE_MOV, - fs_reg(MRF, 2 + i), + fs_reg(MRF, nr++), color)); color.reg_offset++; } + if (c->key.source_depth_to_render_target) { + if (c->key.computes_depth) { + /* Hand over gl_FragDepth. */ + assert(this->frag_depth); + fs_reg depth = *(variable_storage(this->frag_depth)); + + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), depth)); + } else { + /* Pass through the payload depth. */ + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), + fs_reg(brw_vec8_grf(c->key.source_depth_reg, 0)))); + } + } + + if (c->key.dest_depth_reg) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), + fs_reg(brw_vec8_grf(c->key.dest_depth_reg, 0)))); + } + emit(fs_inst(FS_OPCODE_FB_WRITE, fs_reg(0), fs_reg(0))); @@ -1440,7 +1468,6 @@ void fs_visitor::generate_fb_write(fs_inst *inst) { GLboolean eot = 1; /* FINISHME: MRT */ - /* FINISHME: AADS */ /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied * move, here's g1. @@ -1453,7 +1480,15 @@ fs_visitor::generate_fb_write(fs_inst *inst) brw_vec8_grf(1, 0)); brw_pop_insn_state(p); - int nr = 2 + 4; + int nr = 0; + nr += 2; /* header */ + if (c->key.aa_dest_stencil_reg) + nr++; + nr += 4; /* color */ + if (c->key.source_depth_to_render_target) + nr++; + if (c->key.dest_depth_reg) + nr++; brw_fb_WRITE(p, 8, /* dispatch_width */ -- cgit v1.2.3 From 89f6783d1769c61b835b49a5fb4405a3249031f4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 12:34:21 -0700 Subject: i965: Add support for MRT to the new FS backend. Fixes these tests using gl_FragData or just gl_FragDepth: glsl1-Preprocessor test (extension test 1) glsl1-Preprocessor test (extension test 2) glsl-bug-22603 --- src/mesa/drivers/dri/i965/brw_fs.cpp | 75 +++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index e8aff6bab9f..f351b75081c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -320,6 +320,8 @@ public: this->conditional_mod = BRW_CONDITIONAL_NONE; this->predicated = false; this->sampler = 0; + this->target = 0; + this->eot = false; this->shadow_compare = false; } @@ -368,8 +370,10 @@ public: bool predicated; int conditional_mod; /**< BRW_CONDITIONAL_* */ - int mlen; /** SEND message length */ + int mlen; /**< SEND message length */ int sampler; + int target; /**< MRT target. */ + bool eot; bool shadow_compare; /** @{ @@ -1417,7 +1421,7 @@ fs_visitor::emit_pinterp(int location) void fs_visitor::emit_fb_writes() { - this->current_annotation = "FB write"; + this->current_annotation = "FB write header"; int nr = 0; /* m0, m1 header */ @@ -1428,15 +1432,9 @@ fs_visitor::emit_fb_writes() fs_reg(brw_vec8_grf(c->key.aa_dest_stencil_reg, 0)))); } - assert(this->frag_color || !"FINISHME: MRT"); - fs_reg color = *(variable_storage(this->frag_color)); - - for (int i = 0; i < 4; i++) { - emit(fs_inst(BRW_OPCODE_MOV, - fs_reg(MRF, nr++), - color)); - color.reg_offset++; - } + /* Reserve space for color. It'll be filled in per MRT below. */ + int color_mrf = nr; + nr += 4; if (c->key.source_depth_to_render_target) { if (c->key.computes_depth) { @@ -1457,9 +1455,42 @@ fs_visitor::emit_fb_writes() fs_reg(brw_vec8_grf(c->key.dest_depth_reg, 0)))); } - emit(fs_inst(FS_OPCODE_FB_WRITE, - fs_reg(0), - fs_reg(0))); + fs_reg color = reg_undef; + if (this->frag_color) + color = *(variable_storage(this->frag_color)); + else if (this->frag_data) + color = *(variable_storage(this->frag_data)); + + for (int target = 0; target < c->key.nr_color_regions; target++) { + this->current_annotation = talloc_asprintf(this->mem_ctx, + "FB write target %d", + target); + if (this->frag_color || this->frag_data) { + for (int i = 0; i < 4; i++) { + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, color_mrf + i), + color)); + color.reg_offset++; + } + } + + if (this->frag_color) + color.reg_offset -= 4; + + fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE, + reg_undef, reg_undef)); + inst->target = target; + inst->mlen = nr; + if (target == c->key.nr_color_regions - 1) + inst->eot = true; + } + + if (c->key.nr_color_regions == 0) { + fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE, + reg_undef, reg_undef)); + inst->mlen = nr; + inst->eot = true; + } this->current_annotation = NULL; } @@ -1467,7 +1498,7 @@ fs_visitor::emit_fb_writes() void fs_visitor::generate_fb_write(fs_inst *inst) { - GLboolean eot = 1; /* FINISHME: MRT */ + GLboolean eot = inst->eot; /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied * move, here's g1. @@ -1480,23 +1511,13 @@ fs_visitor::generate_fb_write(fs_inst *inst) brw_vec8_grf(1, 0)); brw_pop_insn_state(p); - int nr = 0; - nr += 2; /* header */ - if (c->key.aa_dest_stencil_reg) - nr++; - nr += 4; /* color */ - if (c->key.source_depth_to_render_target) - nr++; - if (c->key.dest_depth_reg) - nr++; - brw_fb_WRITE(p, 8, /* dispatch_width */ retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), 0, /* base MRF */ retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), - 0, /* FINISHME: MRT target */ - nr, + inst->target, + inst->mlen, 0, eot); } -- cgit v1.2.3 From 35f94b1942d9b99463ef9e179ebf70809e3bea69 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 26 Sep 2010 19:26:24 +0200 Subject: r600g: Cleaned up index buffer reference handling in the draw module. This fixes a buffer leak. Signed-off-by: Tilman Sauerbeck --- src/gallium/drivers/r600/r600_buffer.c | 5 ++++- src/gallium/drivers/r600/r600_draw.c | 4 +++- src/gallium/drivers/r600/r600_state2.c | 9 +++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 1621b2ab63f..d734e2349fb 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -280,7 +280,10 @@ int r600_upload_index_buffer(struct r600_context *rctx, goto done; } draw->index_buffer_offset = index_offset; - draw->index_buffer = upload_buffer; + + /* Transfer ownership. */ + pipe_resource_reference(&draw->index_buffer, upload_buffer); + pipe_resource_reference(&upload_buffer, NULL); } done: diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index afc3b7bba16..c41156f15fd 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -168,7 +168,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) info->count); draw.index_size = rctx->index_buffer.index_size; - draw.index_buffer = rctx->index_buffer.buffer; + pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer); draw.index_buffer_offset = draw.start * draw.index_size; draw.start = 0; r600_upload_index_buffer(rctx, &draw); @@ -185,4 +185,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) r = r600_draw_common(&draw); if (r) fprintf(stderr,"draw common failed %d\n", r); + + pipe_resource_reference(&draw.index_buffer, NULL); } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 796442f5a4b..bbbf2790ccc 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -672,7 +672,7 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info info->count); draw.index_size = rctx->index_buffer.index_size; - draw.index_buffer = rctx->index_buffer.buffer; + pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer); draw.index_buffer_offset = draw.start * draw.index_size; draw.start = 0; r600_upload_index_buffer2(rctx, &draw); @@ -684,6 +684,8 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info draw.index_bias = info->start; } r600_draw_common(&draw); + + pipe_resource_reference(&draw.index_buffer, NULL); } static void r600_flush2(struct pipe_context *ctx, unsigned flags, @@ -2463,7 +2465,10 @@ int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl goto done; } draw->index_buffer_offset = index_offset; - draw->index_buffer = upload_buffer; + + /* Transfer ownership. */ + pipe_resource_reference(&draw->index_buffer, upload_buffer); + pipe_resource_reference(&upload_buffer, NULL); } done: -- cgit v1.2.3 From 701c5f11c9102047c8962f053843469ada3b3a1a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 13:00:46 -0700 Subject: i965: Add support for ir_loop counters to the new FS backend. Fixes: glsl1-discard statement in for loop glsl-fs-loop-two-counter-02 glsl-fs-loop-two-counter-04 --- src/mesa/drivers/dri/i965/brw_fs.cpp | 64 +++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index f351b75081c..c1e62062310 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -612,6 +612,9 @@ fs_visitor::visit(ir_variable *ir) { fs_reg *reg = NULL; + if (variable_storage(ir)) + return; + if (strcmp(ir->name, "gl_FragColor") == 0) { this->frag_color = ir; } else if (strcmp(ir->name, "gl_FragData") == 0) { @@ -1175,12 +1178,20 @@ fs_visitor::visit(ir_if *ir) void fs_visitor::visit(ir_loop *ir) { - assert(!ir->from); - assert(!ir->to); - assert(!ir->increment); - assert(!ir->counter); + fs_reg counter = reg_undef; - emit(fs_inst(BRW_OPCODE_DO)); + if (ir->counter) { + this->base_ir = ir->counter; + ir->counter->accept(this); + counter = *(variable_storage(ir->counter)); + + if (ir->from) { + this->base_ir = ir->from; + ir->from->accept(this); + + emit(fs_inst(BRW_OPCODE_MOV, counter, this->result)); + } + } /* Start a safety counter. If the user messed up their loop * counting, we don't want to hang the GPU. @@ -1188,6 +1199,43 @@ fs_visitor::visit(ir_loop *ir) fs_reg max_iter = fs_reg(this, glsl_type::int_type); emit(fs_inst(BRW_OPCODE_MOV, max_iter, fs_reg(10000))); + emit(fs_inst(BRW_OPCODE_DO)); + + if (ir->to) { + this->base_ir = ir->to; + ir->to->accept(this); + + fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, + counter, this->result)); + switch (ir->cmp) { + case ir_binop_equal: + inst->conditional_mod = BRW_CONDITIONAL_Z; + break; + case ir_binop_nequal: + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + case ir_binop_gequal: + inst->conditional_mod = BRW_CONDITIONAL_GE; + break; + case ir_binop_lequal: + inst->conditional_mod = BRW_CONDITIONAL_LE; + break; + case ir_binop_greater: + inst->conditional_mod = BRW_CONDITIONAL_G; + break; + case ir_binop_less: + inst->conditional_mod = BRW_CONDITIONAL_L; + break; + default: + assert(!"not reached: unknown loop condition"); + this->fail = true; + break; + } + + inst = emit(fs_inst(BRW_OPCODE_BREAK)); + inst->predicated = true; + } + foreach_iter(exec_list_iterator, iter, ir->body_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); fs_inst *inst; @@ -1203,6 +1251,12 @@ fs_visitor::visit(ir_loop *ir) inst->predicated = true; } + if (ir->increment) { + this->base_ir = ir->increment; + ir->increment->accept(this); + emit(fs_inst(BRW_OPCODE_ADD, counter, counter, this->result)); + } + emit(fs_inst(BRW_OPCODE_WHILE)); } -- cgit v1.2.3 From b9a59f0358f6f6afc7fafc1b417fa1b2c4cdaf37 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 13:29:45 -0700 Subject: i965: Add support for ARB_fragment_coord_conventions to the new FS backend. Fixes: glsl-arb-frag-coord-conventions glsl-fs-fragcoord --- src/mesa/drivers/dri/i965/brw_fs.cpp | 70 ++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c1e62062310..8f547fc8ba9 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -455,6 +455,7 @@ public: void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void emit_dummy_fs(); + void emit_fragcoord_interpolation(ir_variable *ir); void emit_interpolation(); void emit_pinterp(int location); void emit_fb_writes(); @@ -490,6 +491,7 @@ public: fs_reg pixel_x; fs_reg pixel_y; + fs_reg wpos_w; fs_reg pixel_w; fs_reg delta_x; fs_reg delta_y; @@ -607,6 +609,49 @@ fs_visitor::setup_uniform_values(int loc, const glsl_type *type) } } +void +fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) +{ + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + fs_reg wpos = *reg; + fs_reg neg_y = this->pixel_y; + neg_y.negate = true; + + /* gl_FragCoord.x */ + if (ir->pixel_center_integer) { + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x)); + } else { + emit(fs_inst(BRW_OPCODE_ADD, wpos, this->pixel_x, fs_reg(0.5f))); + } + wpos.reg_offset++; + + /* gl_FragCoord.y */ + if (ir->origin_upper_left && ir->pixel_center_integer) { + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); + } else { + fs_reg pixel_y = this->pixel_y; + float offset = (ir->pixel_center_integer ? 0.0 : 0.5); + + if (!ir->origin_upper_left) { + pixel_y.negate = true; + offset += c->key.drawable_height - 1.0; + } + + emit(fs_inst(BRW_OPCODE_ADD, wpos, pixel_y, fs_reg(offset))); + } + wpos.reg_offset++; + + /* gl_FragCoord.z */ + emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + interp_reg(FRAG_ATTRIB_WPOS, 2))); + wpos.reg_offset++; + + /* gl_FragCoord.w: Already set up in emit_interpolation */ + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->wpos_w)); + + hash_table_insert(this->variable_ht, reg, ir); +} + void fs_visitor::visit(ir_variable *ir) { @@ -624,7 +669,10 @@ fs_visitor::visit(ir_variable *ir) } if (ir->mode == ir_var_in) { - if (strcmp(ir->name, "gl_FrontFacing") == 0) { + if (!strcmp(ir->name, "gl_FragCoord")) { + emit_fragcoord_interpolation(ir); + return; + } else if (!strcmp(ir->name, "gl_FrontFacing")) { reg = new(this->mem_ctx) fs_reg(this, ir->type); struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); /* bit 31 is "primitive is back face", so checking < (1 << 31) gives @@ -1404,23 +1452,15 @@ fs_visitor::emit_interpolation() fs_reg(negate(brw_vec1_grf(1, 1))))); this->current_annotation = "compute pos.w and 1/pos.w"; - /* Compute wpos. Unlike many other varying inputs, we usually need it - * to produce 1/w, and the varying variable wouldn't show up. + /* Compute wpos.w. It's always in our setup, since it's needed to + * interpolate the other attributes. */ - fs_reg wpos = fs_reg(this, glsl_type::vec4_type); - this->interp_attrs[FRAG_ATTRIB_WPOS] = wpos; - emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x)); /* FINISHME: ARB_fcc */ - wpos.reg_offset++; - emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); /* FINISHME: ARB_fcc */ - wpos.reg_offset++; - emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, - interp_reg(FRAG_ATTRIB_WPOS, 2))); - wpos.reg_offset++; - emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + this->wpos_w = fs_reg(this, glsl_type::float_type); + emit(fs_inst(FS_OPCODE_LINTERP, wpos_w, this->delta_x, this->delta_y, interp_reg(FRAG_ATTRIB_WPOS, 3))); - /* Compute the pixel W value from wpos.w. */ + /* Compute the pixel 1/W value from wpos.w. */ this->pixel_w = fs_reg(this, glsl_type::float_type); - emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos)); + emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos_w)); foreach_iter(exec_list_iterator, iter, *this->shader->ir) { ir_instruction *ir = (ir_instruction *)iter.get(); -- cgit v1.2.3 From 586b4b500fed64fb724beb3753bc190cd1c676e0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 14:32:16 -0700 Subject: glsl: Also update implicit sizes of varyings at link time. Otherwise, we'll often end up with gl_TexCoord being 0 length, for example. With ir_to_mesa, things ended up working out anyway, as long as multiple implicitly-sized arrays weren't involved. --- src/glsl/linker.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 53e18a06d1b..4bb4e2a9945 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -857,13 +857,15 @@ struct uniform_node { */ static void -update_uniform_array_sizes(struct gl_shader_program *prog) +update_array_sizes(struct gl_shader_program *prog) { for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { foreach_list(node, prog->_LinkedShaders[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); - if ((var == NULL) || (var->mode != ir_var_uniform) || + if ((var == NULL) || (var->mode != ir_var_uniform && + var->mode != ir_var_in && + var->mode != ir_var_out) || !var->type->is_array()) continue; @@ -880,6 +882,7 @@ update_uniform_array_sizes(struct gl_shader_program *prog) } } } + if (size + 1 != var->type->fields.array->length) { var->type = glsl_type::get_array_instance(var->type->fields.array, size + 1); @@ -979,8 +982,6 @@ assign_uniform_locations(struct gl_shader_program *prog) hash_table_string_compare); void *mem_ctx = talloc_new(NULL); - update_uniform_array_sizes(prog); - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { unsigned next_position = 0; @@ -1475,6 +1476,8 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog) ; } + update_array_sizes(prog); + assign_uniform_locations(prog); if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) { -- cgit v1.2.3 From 5272c6a7a23ba74c696608fc2cb07fbfaf9e822a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 3 Sep 2010 13:22:38 -0700 Subject: i965: Do interpolation for varying matrices and arrays in the FS backend. Fixes: glsl-array-varying-01 glsl-vs-mat-add-1 glsl-vs-mat-div-1 glsl-vs-mat-div-2 glsl-vs-mat-mul-2 glsl-vs-mat-mul-3 --- src/mesa/drivers/dri/i965/brw_fs.cpp | 116 +++++++++++++++++------------------ 1 file changed, 57 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 8f547fc8ba9..fbd2464357d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -456,8 +456,8 @@ public: void emit_dummy_fs(); void emit_fragcoord_interpolation(ir_variable *ir); - void emit_interpolation(); - void emit_pinterp(int location); + void emit_general_interpolation(ir_variable *ir); + void emit_interpolation_setup(); void emit_fb_writes(); struct brw_reg interp_reg(int location, int channel); @@ -495,7 +495,6 @@ public: fs_reg pixel_w; fs_reg delta_x; fs_reg delta_y; - fs_reg interp_attrs[64]; int grf_used; @@ -652,6 +651,57 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) hash_table_insert(this->variable_ht, reg, ir); } + +void +fs_visitor::emit_general_interpolation(ir_variable *ir) +{ + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + /* Interpolation is always in floating point regs. */ + reg->type = BRW_REGISTER_TYPE_F; + fs_reg attr = *reg; + + unsigned int array_elements; + const glsl_type *type; + + if (ir->type->is_array()) { + array_elements = ir->type->length; + if (array_elements == 0) { + this->fail = true; + } + type = ir->type->fields.array; + } else { + array_elements = 1; + type = ir->type; + } + + int location = ir->location; + for (unsigned int i = 0; i < array_elements; i++) { + for (unsigned int j = 0; j < type->matrix_columns; j++) { + for (unsigned int c = 0; c < type->vector_elements; c++) { + struct brw_reg interp = interp_reg(location, c); + emit(fs_inst(FS_OPCODE_LINTERP, + attr, + this->delta_x, + this->delta_y, + fs_reg(interp))); + attr.reg_offset++; + } + attr.reg_offset -= type->vector_elements; + + for (unsigned int c = 0; c < type->vector_elements; c++) { + emit(fs_inst(BRW_OPCODE_MUL, + attr, + attr, + this->pixel_w)); + attr.reg_offset++; + } + location++; + } + } + + hash_table_insert(this->variable_ht, reg, ir); +} + void fs_visitor::visit(ir_variable *ir) { @@ -685,7 +735,8 @@ fs_visitor::visit(ir_variable *ir) inst->conditional_mod = BRW_CONDITIONAL_L; emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); } else { - reg = &this->interp_attrs[ir->location]; + emit_general_interpolation(ir); + return; } } @@ -1416,14 +1467,9 @@ fs_visitor::interp_reg(int location, int channel) /** Emits the interpolation for the varying inputs. */ void -fs_visitor::emit_interpolation() +fs_visitor::emit_interpolation_setup() { struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); - /* For now, the source regs for the setup URB data will be unset, - * since we don't know until codegen how many push constants we'll - * use, and therefore what the setup URB offset is. - */ - fs_reg src_reg = reg_undef; this->current_annotation = "compute pixel centers"; this->pixel_x = fs_reg(this, glsl_type::uint_type); @@ -1461,57 +1507,9 @@ fs_visitor::emit_interpolation() /* Compute the pixel 1/W value from wpos.w. */ this->pixel_w = fs_reg(this, glsl_type::float_type); emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos_w)); - - foreach_iter(exec_list_iterator, iter, *this->shader->ir) { - ir_instruction *ir = (ir_instruction *)iter.get(); - ir_variable *var = ir->as_variable(); - - if (!var) - continue; - - if (var->mode != ir_var_in) - continue; - - /* If it's already set up (WPOS), skip. */ - if (var->location == 0) - continue; - - this->current_annotation = talloc_asprintf(this->mem_ctx, - "interpolate %s " - "(FRAG_ATTRIB[%d])", - var->name, - var->location); - emit_pinterp(var->location); - } this->current_annotation = NULL; } -void -fs_visitor::emit_pinterp(int location) -{ - fs_reg interp_attr = fs_reg(this, glsl_type::vec4_type); - this->interp_attrs[location] = interp_attr; - - for (unsigned int i = 0; i < 4; i++) { - struct brw_reg interp = interp_reg(location, i); - emit(fs_inst(FS_OPCODE_LINTERP, - interp_attr, - this->delta_x, - this->delta_y, - fs_reg(interp))); - interp_attr.reg_offset++; - } - interp_attr.reg_offset -= 4; - - for (unsigned int i = 0; i < 4; i++) { - emit(fs_inst(BRW_OPCODE_MUL, - interp_attr, - interp_attr, - this->pixel_w)); - interp_attr.reg_offset++; - } -} - void fs_visitor::emit_fb_writes() { @@ -2200,7 +2198,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) if (0) { v.emit_dummy_fs(); } else { - v.emit_interpolation(); + v.emit_interpolation_setup(); /* Generate FS IR for main(). (the visitor only descends into * functions called "main"). -- cgit v1.2.3 From 17f3b8097d01a63917afaaefccd6eea070271652 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 14:53:36 -0700 Subject: i965: Don't try to emit interpolation for unused varying slots. Fixes: glsl-fs-varying-array glsl-texcoord-array glsl-texcoord-array-2 glsl-vs-varying-array --- src/mesa/drivers/dri/i965/brw_fs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index fbd2464357d..feb0cc156cb 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -677,6 +677,15 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) int location = ir->location; for (unsigned int i = 0; i < array_elements; i++) { for (unsigned int j = 0; j < type->matrix_columns; j++) { + if (!(fp->Base.InputsRead & BITFIELD64_BIT(location))) { + /* If there's no incoming setup data for this slot, don't + * emit interpolation for it (since it's not used, and + * we'd fall over later trying to find the setup data. + */ + attr.reg_offset += type->vector_elements; + continue; + } + for (unsigned int c = 0; c < type->vector_elements; c++) { struct brw_reg interp = interp_reg(location, c); emit(fs_inst(FS_OPCODE_LINTERP, -- cgit v1.2.3 From 23be883c9b7ca58d2626e665cd238744ae8639b0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 29 Sep 2010 08:31:51 +1000 Subject: r600g: add back evergreen name. --- src/gallium/drivers/r600/r600_state2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index bbbf2790ccc..9e37af8fec2 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -343,8 +343,10 @@ static const char* r600_get_name(struct pipe_screen* pscreen) if (family >= CHIP_R600 && family < CHIP_RV770) return "R600 (HD2XXX,HD3XXX)"; - else + else if (family < CHIP_CEDAR) return "R700 (HD4XXX)"; + else + return "EVERGREEN"; } static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) -- cgit v1.2.3 From 53b3933ce661e2552aa064bbc3a3ab317f32d148 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 29 Sep 2010 09:10:01 +1000 Subject: r600g: add evergreen texture border support to new path --- src/gallium/drivers/r600/evergreen_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 0803a5768c0..b9fadabd15e 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -367,7 +367,10 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, 0xFFFFFFFF, NULL); if (uc.ui) { - /* TODO border color */ + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A404_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); } return rstate; } -- cgit v1.2.3 From 301ab49605e6f3456f437fc2f1b2b141a83a46fc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 29 Sep 2010 09:17:59 +1000 Subject: r600g: move radeon.h members around to add back map flushing. --- src/gallium/winsys/r600/drm/r600_priv.h | 3 +++ src/gallium/winsys/r600/drm/r600_state2.c | 3 ++- src/gallium/winsys/r600/drm/radeon_priv.h | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 189644f31cd..710c66bcfd8 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -40,6 +40,9 @@ struct radeon { unsigned family; enum chip_class chip_class; boolean use_mem_constant; /* true for evergreen */ + struct pb_manager *mman; /* malloc manager */ + struct pb_manager *kman; /* kernel bo manager */ + struct pb_manager *cman; /* cached bo manager */ }; struct radeon *r600_new(int fd, unsigned device); diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 779138656a6..1241bca244f 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -60,7 +60,7 @@ void radeon_bo_reference(struct radeon *radeon, struct radeon_bo *src); unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); - +void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offset) { @@ -1056,6 +1056,7 @@ void r600_context_flush(struct r600_context *ctx) /* suspend queries */ r600_context_queries_suspend(ctx); + radeon_bo_pbmgr_flush_maps(ctx->radeon->kman); #if 1 /* emit cs */ drmib.num_chunks = 2; diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index e780cfd96ad..4cb3fc79d43 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -85,12 +85,12 @@ struct radeon { unsigned family; enum chip_class chip_class; boolean use_mem_constant; /* true for evergreen */ - unsigned nstype; - struct radeon_stype_info *stype; - unsigned max_states; struct pb_manager *mman; /* malloc manager */ struct pb_manager *kman; /* kernel bo manager */ struct pb_manager *cman; /* cached bo manager */ + unsigned nstype; + struct radeon_stype_info *stype; + unsigned max_states; }; struct radeon_ws_bo { -- cgit v1.2.3 From ff0eb45f47ebf2fcc1af06a8b6b934c79dff1d41 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 15:25:40 -0700 Subject: i965: Fix array indexing of arrays of matrices. The deleted code was meant to be handling indexing of a matrix, which would have been a noop if it had been correct. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index feb0cc156cb..2ed5f26ebd8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -796,12 +796,8 @@ fs_visitor::visit(ir_dereference_array *ir) ir->array->accept(this); index = ir->array_index->as_constant(); - if (ir->type->is_matrix()) { - element_size = ir->type->vector_elements; - } else { - element_size = type_size(ir->type); - this->result.type = brw_type_for_base_type(ir->type); - } + element_size = type_size(ir->type); + this->result.type = brw_type_for_base_type(ir->type); if (index) { assert(this->result.file == UNIFORM || @@ -809,7 +805,7 @@ fs_visitor::visit(ir_dereference_array *ir) this->result.reg != 0)); this->result.reg_offset += index->value.i[0] * element_size; } else { - assert(!"FINISHME: non-constant matrix column"); + assert(!"FINISHME: non-constant array element"); } } -- cgit v1.2.3 From 9ac910cfcddf1b6e7c520261371e78fc9bcbddcf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 15:28:06 -0700 Subject: i965: Clean up obsolete FINISHME comment. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 2ed5f26ebd8..4f5ca4e9fe6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -186,7 +186,6 @@ type_size(const struct glsl_type *type) case GLSL_TYPE_BOOL: return type->components(); case GLSL_TYPE_ARRAY: - /* FINISHME: uniform/varying arrays. */ return type_size(type->fields.array) * type->length; case GLSL_TYPE_STRUCT: size = 0; -- cgit v1.2.3 From daacaac3c8b91c87ab2cfc2d9f821474552b8181 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 16:06:35 -0700 Subject: mesa: Move the list of builtin uniform info from ir_to_mesa to shared code. I'm still not pleased with how builtin uniforms are handled, but as long as we're relying on the prog_statevar stuff this seems about as good as it'll get. --- src/mesa/main/uniforms.c | 231 ++++++++++++++++++++++++++++++++++++- src/mesa/main/uniforms.h | 15 +++ src/mesa/program/ir_to_mesa.cpp | 248 +--------------------------------------- 3 files changed, 251 insertions(+), 243 deletions(-) (limited to 'src') diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index a5d7da51f07..29a9be8c996 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -3,6 +3,7 @@ * * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved. + * Copyright © 2010 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -44,7 +45,7 @@ #include "program/prog_parameter.h" #include "program/prog_statevars.h" #include "program/prog_uniform.h" - +#include "program/prog_instruction.h" static GLenum @@ -79,6 +80,234 @@ base_uniform_type(GLenum type) } } +static struct gl_builtin_uniform_element gl_DepthRange_elements[] = { + {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, + {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, + {"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ}, +}; + +static struct gl_builtin_uniform_element gl_ClipPlane_elements[] = { + {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW} +}; + +static struct gl_builtin_uniform_element gl_Point_elements[] = { + {"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX}, + {"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY}, + {"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ}, + {"fadeThresholdSize", {STATE_POINT_SIZE}, SWIZZLE_WWWW}, + {"distanceConstantAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX}, + {"distanceLinearAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY}, + {"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ}, +}; + +static struct gl_builtin_uniform_element gl_FrontMaterial_elements[] = { + {"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW}, + {"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX}, +}; + +static struct gl_builtin_uniform_element gl_BackMaterial_elements[] = { + {"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW}, + {"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX}, +}; + +static struct gl_builtin_uniform_element gl_LightSource_elements[] = { + {"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW}, + {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW}, + {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW}, + {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW}, + {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX}, + {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW}, + {"constantAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX}, + {"linearAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY}, + {"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ}, +}; + +static struct gl_builtin_uniform_element gl_LightModel_elements[] = { + {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_FrontLightModelProduct_elements[] = { + {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_BackLightModelProduct_elements[] = { + {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_FrontLightProduct_elements[] = { + {"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_BackLightProduct_elements[] = { + {"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_TextureEnvColor_elements[] = { + {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_EyePlaneS_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_EyePlaneT_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_EyePlaneR_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_EyePlaneQ_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_ObjectPlaneS_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_ObjectPlaneT_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_ObjectPlaneR_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_ObjectPlaneQ_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW}, +}; + +static struct gl_builtin_uniform_element gl_Fog_elements[] = { + {"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW}, + {"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX}, + {"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY}, + {"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ}, + {"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW}, +}; + +static struct gl_builtin_uniform_element gl_NormalScale_elements[] = { + {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX}, +}; + +#define MATRIX(name, statevar, modifier) \ + static struct gl_builtin_uniform_element name ## _elements[] = { \ + { NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 3, 3, modifier}, SWIZZLE_XYZW }, \ + } + +MATRIX(gl_ModelViewMatrix, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ModelViewMatrixInverse, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ModelViewMatrixTranspose, + STATE_MODELVIEW_MATRIX, 0); +MATRIX(gl_ModelViewMatrixInverseTranspose, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_ProjectionMatrix, + STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ProjectionMatrixInverse, + STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ProjectionMatrixTranspose, + STATE_PROJECTION_MATRIX, 0); +MATRIX(gl_ProjectionMatrixInverseTranspose, + STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_ModelViewProjectionMatrix, + STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ModelViewProjectionMatrixInverse, + STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ModelViewProjectionMatrixTranspose, + STATE_MVP_MATRIX, 0); +MATRIX(gl_ModelViewProjectionMatrixInverseTranspose, + STATE_MVP_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_TextureMatrix, + STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_TextureMatrixInverse, + STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_TextureMatrixTranspose, + STATE_TEXTURE_MATRIX, 0); +MATRIX(gl_TextureMatrixInverseTranspose, + STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE); + +static struct gl_builtin_uniform_element gl_NormalMatrix_elements[] = { + { NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, + { NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, + { NULL, { STATE_MODELVIEW_MATRIX, 0, 2, 2, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, +}; + +#undef MATRIX + +#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)} + +const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[] = { + STATEVAR(gl_DepthRange), + STATEVAR(gl_ClipPlane), + STATEVAR(gl_Point), + STATEVAR(gl_FrontMaterial), + STATEVAR(gl_BackMaterial), + STATEVAR(gl_LightSource), + STATEVAR(gl_LightModel), + STATEVAR(gl_FrontLightModelProduct), + STATEVAR(gl_BackLightModelProduct), + STATEVAR(gl_FrontLightProduct), + STATEVAR(gl_BackLightProduct), + STATEVAR(gl_TextureEnvColor), + STATEVAR(gl_EyePlaneS), + STATEVAR(gl_EyePlaneT), + STATEVAR(gl_EyePlaneR), + STATEVAR(gl_EyePlaneQ), + STATEVAR(gl_ObjectPlaneS), + STATEVAR(gl_ObjectPlaneT), + STATEVAR(gl_ObjectPlaneR), + STATEVAR(gl_ObjectPlaneQ), + STATEVAR(gl_Fog), + + STATEVAR(gl_ModelViewMatrix), + STATEVAR(gl_ModelViewMatrixInverse), + STATEVAR(gl_ModelViewMatrixTranspose), + STATEVAR(gl_ModelViewMatrixInverseTranspose), + + STATEVAR(gl_ProjectionMatrix), + STATEVAR(gl_ProjectionMatrixInverse), + STATEVAR(gl_ProjectionMatrixTranspose), + STATEVAR(gl_ProjectionMatrixInverseTranspose), + + STATEVAR(gl_ModelViewProjectionMatrix), + STATEVAR(gl_ModelViewProjectionMatrixInverse), + STATEVAR(gl_ModelViewProjectionMatrixTranspose), + STATEVAR(gl_ModelViewProjectionMatrixInverseTranspose), + + STATEVAR(gl_TextureMatrix), + STATEVAR(gl_TextureMatrixInverse), + STATEVAR(gl_TextureMatrixTranspose), + STATEVAR(gl_TextureMatrixInverseTranspose), + + STATEVAR(gl_NormalMatrix), + STATEVAR(gl_NormalScale), + + {NULL, NULL, 0} +}; static GLboolean is_boolean_type(GLenum type) diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index f823c614447..ac2cf30d97e 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -26,6 +26,7 @@ #define UNIFORMS_H #include "glheader.h" +#include "program/prog_parameter.h" struct gl_program; struct _glapi_table; @@ -172,4 +173,18 @@ _mesa_update_shader_textures_used(struct gl_program *prog); extern void _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec); +struct gl_builtin_uniform_element { + const char *field; + int tokens[STATE_LENGTH]; + int swizzle; +}; + +struct gl_builtin_uniform_desc { + const char *name; + struct gl_builtin_uniform_element *elements; + unsigned int num_elements; +}; + +extern const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[]; + #endif /* UNIFORMS_H */ diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index aa2add4174c..5c92bc9865d 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -577,243 +577,6 @@ ir_to_mesa_visitor::find_variable_storage(ir_variable *var) return NULL; } -struct statevar_element { - const char *field; - int tokens[STATE_LENGTH]; - int swizzle; -}; - -static struct statevar_element gl_DepthRange_elements[] = { - {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, - {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, - {"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ}, -}; - -static struct statevar_element gl_ClipPlane_elements[] = { - {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW} -}; - -static struct statevar_element gl_Point_elements[] = { - {"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX}, - {"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY}, - {"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ}, - {"fadeThresholdSize", {STATE_POINT_SIZE}, SWIZZLE_WWWW}, - {"distanceConstantAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX}, - {"distanceLinearAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY}, - {"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ}, -}; - -static struct statevar_element gl_FrontMaterial_elements[] = { - {"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW}, - {"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, - {"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, - {"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, - {"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX}, -}; - -static struct statevar_element gl_BackMaterial_elements[] = { - {"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW}, - {"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, - {"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, - {"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, - {"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX}, -}; - -static struct statevar_element gl_LightSource_elements[] = { - {"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, - {"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, - {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, - {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW}, - {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW}, - {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW}, - {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW}, - {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX}, - {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW}, - {"constantAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX}, - {"linearAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY}, - {"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ}, -}; - -static struct statevar_element gl_LightModel_elements[] = { - {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_FrontLightModelProduct_elements[] = { - {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_BackLightModelProduct_elements[] = { - {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_FrontLightProduct_elements[] = { - {"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, - {"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, - {"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_BackLightProduct_elements[] = { - {"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, - {"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, - {"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_TextureEnvColor_elements[] = { - {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_EyePlaneS_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_EyePlaneT_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_EyePlaneR_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_EyePlaneQ_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_ObjectPlaneS_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_ObjectPlaneT_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_ObjectPlaneR_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_ObjectPlaneQ_elements[] = { - {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW}, -}; - -static struct statevar_element gl_Fog_elements[] = { - {"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW}, - {"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX}, - {"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY}, - {"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ}, - {"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW}, -}; - -static struct statevar_element gl_NormalScale_elements[] = { - {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX}, -}; - -#define MATRIX(name, statevar, modifier) \ - static struct statevar_element name ## _elements[] = { \ - { NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \ - { NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \ - { NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \ - { NULL, { statevar, 0, 3, 3, modifier}, SWIZZLE_XYZW }, \ - } - -MATRIX(gl_ModelViewMatrix, - STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE); -MATRIX(gl_ModelViewMatrixInverse, - STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS); -MATRIX(gl_ModelViewMatrixTranspose, - STATE_MODELVIEW_MATRIX, 0); -MATRIX(gl_ModelViewMatrixInverseTranspose, - STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE); - -MATRIX(gl_ProjectionMatrix, - STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE); -MATRIX(gl_ProjectionMatrixInverse, - STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS); -MATRIX(gl_ProjectionMatrixTranspose, - STATE_PROJECTION_MATRIX, 0); -MATRIX(gl_ProjectionMatrixInverseTranspose, - STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE); - -MATRIX(gl_ModelViewProjectionMatrix, - STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE); -MATRIX(gl_ModelViewProjectionMatrixInverse, - STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS); -MATRIX(gl_ModelViewProjectionMatrixTranspose, - STATE_MVP_MATRIX, 0); -MATRIX(gl_ModelViewProjectionMatrixInverseTranspose, - STATE_MVP_MATRIX, STATE_MATRIX_INVERSE); - -MATRIX(gl_TextureMatrix, - STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE); -MATRIX(gl_TextureMatrixInverse, - STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS); -MATRIX(gl_TextureMatrixTranspose, - STATE_TEXTURE_MATRIX, 0); -MATRIX(gl_TextureMatrixInverseTranspose, - STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE); - -static struct statevar_element gl_NormalMatrix_elements[] = { - { NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE}, - SWIZZLE_XYZW }, - { NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE}, - SWIZZLE_XYZW }, - { NULL, { STATE_MODELVIEW_MATRIX, 0, 2, 2, STATE_MATRIX_INVERSE}, - SWIZZLE_XYZW }, -}; - -#undef MATRIX - -#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)} - -static const struct statevar { - const char *name; - struct statevar_element *elements; - unsigned int num_elements; -} statevars[] = { - STATEVAR(gl_DepthRange), - STATEVAR(gl_ClipPlane), - STATEVAR(gl_Point), - STATEVAR(gl_FrontMaterial), - STATEVAR(gl_BackMaterial), - STATEVAR(gl_LightSource), - STATEVAR(gl_LightModel), - STATEVAR(gl_FrontLightModelProduct), - STATEVAR(gl_BackLightModelProduct), - STATEVAR(gl_FrontLightProduct), - STATEVAR(gl_BackLightProduct), - STATEVAR(gl_TextureEnvColor), - STATEVAR(gl_EyePlaneS), - STATEVAR(gl_EyePlaneT), - STATEVAR(gl_EyePlaneR), - STATEVAR(gl_EyePlaneQ), - STATEVAR(gl_ObjectPlaneS), - STATEVAR(gl_ObjectPlaneT), - STATEVAR(gl_ObjectPlaneR), - STATEVAR(gl_ObjectPlaneQ), - STATEVAR(gl_Fog), - - STATEVAR(gl_ModelViewMatrix), - STATEVAR(gl_ModelViewMatrixInverse), - STATEVAR(gl_ModelViewMatrixTranspose), - STATEVAR(gl_ModelViewMatrixInverseTranspose), - - STATEVAR(gl_ProjectionMatrix), - STATEVAR(gl_ProjectionMatrixInverse), - STATEVAR(gl_ProjectionMatrixTranspose), - STATEVAR(gl_ProjectionMatrixInverseTranspose), - - STATEVAR(gl_ModelViewProjectionMatrix), - STATEVAR(gl_ModelViewProjectionMatrixInverse), - STATEVAR(gl_ModelViewProjectionMatrixTranspose), - STATEVAR(gl_ModelViewProjectionMatrixInverseTranspose), - - STATEVAR(gl_TextureMatrix), - STATEVAR(gl_TextureMatrixInverse), - STATEVAR(gl_TextureMatrixTranspose), - STATEVAR(gl_TextureMatrixInverseTranspose), - - STATEVAR(gl_NormalMatrix), - STATEVAR(gl_NormalScale), -}; - void ir_to_mesa_visitor::visit(ir_variable *ir) { @@ -826,19 +589,20 @@ ir_to_mesa_visitor::visit(ir_variable *ir) if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { unsigned int i; + const struct gl_builtin_uniform_desc *statevar; - for (i = 0; i < Elements(statevars); i++) { - if (strcmp(ir->name, statevars[i].name) == 0) + for (i = 0; _mesa_builtin_uniform_desc[i].name; i++) { + if (strcmp(ir->name, _mesa_builtin_uniform_desc[i].name) == 0) break; } - if (i == Elements(statevars)) { + if (!_mesa_builtin_uniform_desc[i].name) { fail_link(this->shader_program, "Failed to find builtin uniform `%s'\n", ir->name); return; } - const struct statevar *statevar = &statevars[i]; + statevar = &_mesa_builtin_uniform_desc[i]; int array_count; if (ir->type->is_array()) { @@ -881,7 +645,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir) for (int a = 0; a < array_count; a++) { for (unsigned int i = 0; i < statevar->num_elements; i++) { - struct statevar_element *element = &statevar->elements[i]; + struct gl_builtin_uniform_element *element = &statevar->elements[i]; int tokens[STATE_LENGTH]; memcpy(tokens, element->tokens, sizeof(element->tokens)); -- cgit v1.2.3 From 1747aa6755088398108febb121a80d9572c1533e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Sep 2010 16:23:04 -0700 Subject: i965: Add support for builtin uniforms to the new FS backend. Fixes 8 piglit tests. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 71 +++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4f5ca4e9fe6..2ecacb56464 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -31,6 +31,7 @@ extern "C" { #include "main/macros.h" #include "main/shaderobj.h" +#include "main/uniforms.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_optimize.h" @@ -461,6 +462,7 @@ public: struct brw_reg interp_reg(int location, int channel); int setup_uniform_values(int loc, const glsl_type *type); + void setup_builtin_uniform_values(ir_variable *ir); struct brw_context *brw; const struct gl_fragment_program *fp; @@ -607,6 +609,69 @@ fs_visitor::setup_uniform_values(int loc, const glsl_type *type) } } + +/* Our support for builtin uniforms is even scarier than non-builtin. + * It sits on top of the PROG_STATE_VAR parameters that are + * automatically updated from GL context state. + */ +void +fs_visitor::setup_builtin_uniform_values(ir_variable *ir) +{ + const struct gl_builtin_uniform_desc *statevar = NULL; + + for (unsigned int i = 0; _mesa_builtin_uniform_desc[i].name; i++) { + statevar = &_mesa_builtin_uniform_desc[i]; + if (strcmp(ir->name, _mesa_builtin_uniform_desc[i].name) == 0) + break; + } + + if (!statevar->name) { + this->fail = true; + printf("Failed to find builtin uniform `%s'\n", ir->name); + return; + } + + int array_count; + if (ir->type->is_array()) { + array_count = ir->type->length; + } else { + array_count = 1; + } + + for (int a = 0; a < array_count; a++) { + for (unsigned int i = 0; i < statevar->num_elements; i++) { + struct gl_builtin_uniform_element *element = &statevar->elements[i]; + int tokens[STATE_LENGTH]; + + memcpy(tokens, element->tokens, sizeof(element->tokens)); + if (ir->type->is_array()) { + tokens[1] = a; + } + + /* This state reference has already been setup by ir_to_mesa, + * but we'll get the same index back here. + */ + int index = _mesa_add_state_reference(this->fp->Base.Parameters, + (gl_state_index *)tokens); + float *vec_values = this->fp->Base.Parameters->ParameterValues[index]; + + /* Add each of the unique swizzles of the element as a + * parameter. This'll end up matching the expected layout of + * the array/matrix/structure we're trying to fill in. + */ + int last_swiz = -1; + for (unsigned int i = 0; i < 4; i++) { + int this_swiz = GET_SWZ(element->swizzle, i); + if (this_swiz == last_swiz) + break; + last_swiz = this_swiz; + + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; + } + } + } +} + void fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) { @@ -751,7 +816,11 @@ fs_visitor::visit(ir_variable *ir) if (ir->mode == ir_var_uniform) { int param_index = c->prog_data.nr_params; - setup_uniform_values(ir->location, ir->type); + if (!strncmp(ir->name, "gl_", 3)) { + setup_builtin_uniform_values(ir); + } else { + setup_uniform_values(ir->location, ir->type); + } reg = new(this->mem_ctx) fs_reg(UNIFORM, param_index); } -- cgit v1.2.3 From 565ff676887fc40b4715b44d9407c638480485e6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 28 Sep 2010 21:13:41 -0700 Subject: glsl: "Copyright", not "Constantright" Clearly this started out as ir_copy_propagation.cpp, but the search and replace was a bit overzealous. --- src/glsl/ir_constant_propagation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp index 390f295d6e9..5d875b7be00 100644 --- a/src/glsl/ir_constant_propagation.cpp +++ b/src/glsl/ir_constant_propagation.cpp @@ -1,5 +1,5 @@ /* - * Constantright © 2010 Intel Corporation + * Copyright © 2010 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * constant of this software and associated documentation files (the "Software"), -- cgit v1.2.3 From 914b669b082258fc05d0fec047b69949d88585c4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 24 Sep 2010 13:11:17 +1000 Subject: r600g: add initial vertex translate support. --- src/gallium/drivers/r600/r600_context.c | 7 ++ src/gallium/drivers/r600/r600_context.h | 23 ++++- src/gallium/drivers/r600/r600_draw.c | 171 +++++++++++++++++++++++++++++++- src/gallium/drivers/r600/r600_state.c | 41 +++++++- 4 files changed, 239 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 091751e93a9..cff15c57d28 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -62,6 +62,9 @@ static void r600_destroy_context(struct pipe_context *context) u_upload_destroy(rctx->upload_vb); u_upload_destroy(rctx->upload_ib); + if (rctx->tran.translate_cache) + translate_cache_destroy(rctx->tran.translate_cache); + radeon_ctx_fini(rctx->ctx); FREE(rctx); } @@ -153,6 +156,10 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) goto out_free; } + rctx->tran.translate_cache = translate_cache_create(); + if (rctx->tran.translate_cache == NULL) + goto out_free; + rctx->vs_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state)); if (!rctx->vs_constant) { goto out_free; diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index d104531d365..ae32194318c 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -31,6 +31,7 @@ #include #include #include +#include "translate/translate_cache.h" #include "radeon.h" #include "r600_shader.h" @@ -115,7 +116,11 @@ struct r600_vertex_element { unsigned refcount; unsigned count; - struct pipe_vertex_element elements[32]; + struct pipe_vertex_element elements[PIPE_MAX_ATTRIBS]; + + enum pipe_format hw_format[PIPE_MAX_ATTRIBS]; + unsigned hw_format_size[PIPE_MAX_ATTRIBS]; + boolean incompatible_layout; }; struct r600_draw { @@ -132,6 +137,18 @@ struct r600_draw { unsigned index_bias; }; +struct r600_translate_context { + /* Translate cache for incompatible vertex offset/stride/format fallback. */ + struct translate_cache *translate_cache; + + /* The vertex buffer slot containing the translated buffer. */ + unsigned vb_slot; + + /* Saved and new vertex element state. */ + void *saved_velems, *new_velems; +}; + + struct r600_context_hw_states { struct radeon_state rasterizer; struct radeon_state scissor; @@ -247,6 +264,10 @@ struct r600_context { struct u_upload_mgr *upload_vb; struct u_upload_mgr *upload_ib; bool any_user_vbs; + unsigned vb_max_index; + + /* For translating vertex buffers having incompatible vertex layout. */ + struct r600_translate_context tran; }; /* Convenience cast wrapper. */ diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index c41156f15fd..ed1b20f7b9d 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -32,12 +32,173 @@ #include #include #include +#include "translate/translate_cache.h" +#include "translate/translate.h" #include "radeon.h" #include "r600_screen.h" #include "r600_context.h" #include "r600_resource.h" #include "r600_state_inlines.h" +static void r600_begin_vertex_translate(struct r600_context *rctx) +{ + struct pipe_context *pipe = &rctx->context; + struct translate_key key = {0}; + struct translate_element *te; + unsigned tr_elem_index[PIPE_MAX_ATTRIBS] = {0}; + struct translate *tr; + struct r600_vertex_element *ve = rctx->vertex_elements; + boolean vb_translated[PIPE_MAX_ATTRIBS] = {0}; + void *vb_map[PIPE_MAX_ATTRIBS] = {0}, *out_map; + struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0}, *out_transfer; + struct pipe_resource *out_buffer; + unsigned i, num_verts; + + /* Initialize the translate key, i.e. the recipe how vertices should be + * translated. */ + for (i = 0; i < ve->count; i++) { + struct pipe_vertex_buffer *vb = + &rctx->vertex_buffer[ve->elements[i].vertex_buffer_index]; + enum pipe_format output_format = ve->hw_format[i]; + unsigned output_format_size = ve->hw_format_size[i]; + + /* Check for support. */ + if (ve->elements[i].src_format == ve->hw_format[i] && + (vb->buffer_offset + ve->elements[i].src_offset) % 4 == 0 && + vb->stride % 4 == 0) { + continue; + } + + /* Workaround for translate: output floats instead of halfs. */ + switch (output_format) { + case PIPE_FORMAT_R16_FLOAT: + output_format = PIPE_FORMAT_R32_FLOAT; + output_format_size = 4; + break; + case PIPE_FORMAT_R16G16_FLOAT: + output_format = PIPE_FORMAT_R32G32_FLOAT; + output_format_size = 8; + break; + case PIPE_FORMAT_R16G16B16_FLOAT: + output_format = PIPE_FORMAT_R32G32B32_FLOAT; + output_format_size = 12; + break; + case PIPE_FORMAT_R16G16B16A16_FLOAT: + output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + output_format_size = 16; + break; + default:; + } + + /* Add this vertex element. */ + te = &key.element[key.nr_elements]; + /*te->type; + te->instance_divisor;*/ + te->input_buffer = ve->elements[i].vertex_buffer_index; + te->input_format = ve->elements[i].src_format; + te->input_offset = vb->buffer_offset + ve->elements[i].src_offset; + te->output_format = output_format; + te->output_offset = key.output_stride; + + key.output_stride += output_format_size; + vb_translated[ve->elements[i].vertex_buffer_index] = TRUE; + tr_elem_index[i] = key.nr_elements; + key.nr_elements++; + } + + /* Get a translate object. */ + tr = translate_cache_find(rctx->tran.translate_cache, &key); + + /* Map buffers we want to translate. */ + for (i = 0; i < rctx->nvertex_buffer; i++) { + if (vb_translated[i]) { + struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i]; + + vb_map[i] = pipe_buffer_map(pipe, vb->buffer, + PIPE_TRANSFER_READ, &vb_transfer[i]); + + tr->set_buffer(tr, i, vb_map[i], vb->stride, vb->max_index); + } + } + + /* Create and map the output buffer. */ + num_verts = rctx->vb_max_index + 1; + + out_buffer = pipe_buffer_create(&rctx->screen->screen, + PIPE_BIND_VERTEX_BUFFER, + key.output_stride * num_verts); + + out_map = pipe_buffer_map(pipe, out_buffer, PIPE_TRANSFER_WRITE, + &out_transfer); + + /* Translate. */ + tr->run(tr, 0, num_verts, 0, out_map); + + /* Unmap all buffers. */ + for (i = 0; i < rctx->nvertex_buffer; i++) { + if (vb_translated[i]) { + pipe_buffer_unmap(pipe, rctx->vertex_buffer[i].buffer, + vb_transfer[i]); + } + } + + pipe_buffer_unmap(pipe, out_buffer, out_transfer); + + /* Setup the new vertex buffer in the first free slot. */ + for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { + struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i]; + + if (!vb->buffer) { + pipe_resource_reference(&vb->buffer, out_buffer); + vb->buffer_offset = 0; + vb->max_index = num_verts - 1; + vb->stride = key.output_stride; + rctx->tran.vb_slot = i; + break; + } + } + + /* Save and replace vertex elements. */ + { + struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS]; + + rctx->tran.saved_velems = rctx->vertex_elements; + + for (i = 0; i < ve->count; i++) { + if (vb_translated[ve->elements[i].vertex_buffer_index]) { + te = &key.element[tr_elem_index[i]]; + new_velems[i].instance_divisor = ve->elements[i].instance_divisor; + new_velems[i].src_format = te->output_format; + new_velems[i].src_offset = te->output_offset; + new_velems[i].vertex_buffer_index = rctx->tran.vb_slot; + } else { + memcpy(&new_velems[i], &ve->elements[i], + sizeof(struct pipe_vertex_element)); + } + } + + rctx->tran.new_velems = + pipe->create_vertex_elements_state(pipe, ve->count, new_velems); + pipe->bind_vertex_elements_state(pipe, rctx->tran.new_velems); + } + + pipe_resource_reference(&out_buffer, NULL); +} + +static void r600_end_vertex_translate(struct r600_context *rctx) +{ + struct pipe_context *pipe = &rctx->context; + + /* Restore vertex elements. */ + pipe->bind_vertex_elements_state(pipe, rctx->tran.saved_velems); + pipe->delete_vertex_elements_state(pipe, rctx->tran.new_velems); + + /* Delete the now-unused VBO. */ + pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, + NULL); +} + + static void r600_translate_index_buffer(struct r600_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, @@ -117,7 +278,7 @@ static int r600_draw_common(struct r600_draw *draw) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->elements[i].src_format); + rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->hw_format[i]); radeon_draw_bind(&rctx->draw, vs_resource); } rctx->vs_nresource = rctx->vertex_elements->count; @@ -144,9 +305,14 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) struct r600_context *rctx = r600_context(ctx); struct r600_draw draw; int r; + boolean translate = FALSE; memset(&draw, 0, sizeof(draw)); + if (rctx->vertex_elements->incompatible_layout) { + r600_begin_vertex_translate(rctx); + translate = TRUE; + } if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); rctx->any_user_vbs = FALSE; @@ -186,5 +352,8 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) if (r) fprintf(stderr,"draw common failed %d\n", r); + if (translate) { + r600_end_vertex_translate(rctx); + } pipe_resource_reference(&draw.index_buffer, NULL); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 86f9825b526..1cadeea2fdd 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -204,15 +204,41 @@ static void *r600_create_shader_state(struct pipe_context *ctx, return rstate; } +#define FORMAT_REPLACE(what, withwhat) \ + case PIPE_FORMAT_##what: *format = PIPE_FORMAT_##withwhat; break + static void *r600_create_vertex_elements(struct pipe_context *ctx, unsigned count, const struct pipe_vertex_element *elements) { struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); + unsigned i; + enum pipe_format *format; assert(count < 32); v->count = count; memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element)); + + for (i = 0; i < count; i++) { + v->hw_format[i] = v->elements[i].src_format; + format = &v->hw_format[i]; + + switch (*format) { + FORMAT_REPLACE(R64_FLOAT, R32_FLOAT); + FORMAT_REPLACE(R64G64_FLOAT, R32G32_FLOAT); + FORMAT_REPLACE(R64G64B64_FLOAT, R32G32B32_FLOAT); + FORMAT_REPLACE(R64G64B64A64_FLOAT, R32G32B32A32_FLOAT); + default:; + } + v->incompatible_layout = + v->incompatible_layout || + v->elements[i].src_format != v->hw_format[i] || + v->elements[i].src_offset % 4 != 0; + + v->hw_format_size[i] = + align(util_format_get_blocksize(v->hw_format[i]), 4); + } + v->refcount = 1; return v; } @@ -455,19 +481,32 @@ static void r600_set_vertex_buffers(struct pipe_context *ctx, struct r600_context *rctx = r600_context(ctx); unsigned i; boolean any_user_buffers = FALSE; - + unsigned max_index, vbo_max_index; + const struct pipe_vertex_buffer *vbo; for (i = 0; i < rctx->nvertex_buffer; i++) { pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); } memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); + max_index = 0; for (i = 0; i < count; i++) { + vbo = &buffers[i]; rctx->vertex_buffer[i].buffer = NULL; if (r600_buffer_is_user_buffer(buffers[i].buffer)) any_user_buffers = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); + if (vbo->max_index == ~0) { + if (!vbo->stride) + vbo_max_index = 1; + else + vbo_max_index = (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; + } else + vbo_max_index = vbo->max_index; + + max_index = MIN2(vbo_max_index, max_index); } rctx->any_user_vbs = any_user_buffers; rctx->nvertex_buffer = count; + rctx->vb_max_index = max_index; } static void r600_set_index_buffer(struct pipe_context *ctx, -- cgit v1.2.3 From 28b57c56e21943055f8d3c08822c4f632468b0b1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 29 Sep 2010 14:52:39 +1000 Subject: r600g: remove old assert from new codepath this fixes draw-elements-base-vertex --- src/gallium/drivers/r600/r600_state2.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 9e37af8fec2..5bd38726e75 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -650,8 +650,6 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_drawl draw; - assert(info->index_bias == 0); - if (rctx->any_user_vbs) { r600_upload_user_buffers2(rctx); rctx->any_user_vbs = FALSE; -- cgit v1.2.3 From 0a1910c26760762eb8d67f68dfd87494ab479e38 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Wed, 29 Sep 2010 13:59:03 +0800 Subject: i965: Always set tiling for depth buffer on sandybridge Sandybridge only support tiling depth buffer, always set tiling bit. Fix 'fbo_firecube' demo. --- src/mesa/drivers/dri/i965/brw_misc_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 6eeaba77720..7a334126f2b 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -289,7 +289,7 @@ static void emit_depthbuffer(struct brw_context *brw) OUT_BATCH(((region->pitch * region->cpp) - 1) | (format << 18) | (BRW_TILEWALK_YMAJOR << 26) | - ((region->tiling != I915_TILING_NONE) << 27) | + (1 << 27) | (BRW_SURFACE_2D << 29)); OUT_RELOC(region->buffer, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, -- cgit v1.2.3 From 73dab75b4165f7d2214a68d4ba8e3cb7aab9b4ac Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Sun, 26 Sep 2010 13:15:39 +0800 Subject: i965: fallback lineloop on sandybridge for now Until we fixed GS hang issue. --- src/mesa/drivers/dri/i965/brw_draw.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 16331cc3ac0..6a4dda2a40f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -204,6 +204,13 @@ static GLboolean check_fallbacks( struct brw_context *brw, GLcontext *ctx = &brw->intel.ctx; GLuint i; + /* XXX FIXME */ + if (brw->intel.gen >= 6) { + for (i = 0; i < nr_prims; i++) + if (prim[i].mode == GL_LINE_LOOP) + return GL_TRUE; + } + /* If we don't require strict OpenGL conformance, never * use fallbacks. If we're forcing fallbacks, always * use fallfacks. -- cgit v1.2.3 From d40ff5510ce60c5bc9db238e2650fa79104d84e9 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 28 Sep 2010 09:21:05 -0700 Subject: r300/compiler: Fix segfault in error path https://bugs.freedesktop.org/show_bug.cgi?id=30415 NOTE: This is a candidate for the 7.9 branch. --- src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index bad16846964..407d92531a5 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -250,7 +250,7 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair if (inst->RGB.OutputWriteMask || inst->Alpha.OutputWriteMask || inst->Alpha.DepthWriteMask) { code->inst[ip].inst0 = R500_INST_TYPE_OUT; if (inst->WriteALUResult) { - error("%s: cannot write output and ALU result at the same time"); + error("Cannot write output and ALU result at the same time"); return; } } else { -- cgit v1.2.3 From 1b76dde0cd90509da0acc631f6599fb6f7fe676d Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 28 Sep 2010 09:57:18 -0700 Subject: r300/compiler: Don't use rc_error() unless the error is unrecoverable https://bugs.freedesktop.org/show_bug.cgi?id=30416 NOTE: This is a candidate for the 7.9 branch. --- src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c index cd4fcbabb93..02a52f92fc3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c @@ -386,8 +386,6 @@ static int build_loop_info(struct radeon_compiler * c, struct loop_info * loop, case RC_OPCODE_SNE: break; default: - rc_error(c, "%s: expected conditional", - __FUNCTION__); return 0; } loop->Cond = loop->If->Prev; @@ -431,8 +429,10 @@ static int transform_loop(struct emulate_loop_state * s, loop = &s->Loops[s->LoopCount++]; - if (!build_loop_info(s->C, loop, inst)) + if (!build_loop_info(s->C, loop, inst)) { + rc_error(s->C, "Failed to build loop info\n"); return 0; + } if(try_unroll_loop(s->C, loop)){ return 1; -- cgit v1.2.3 From b27a809266bd664cd101fcfdf20886cc2b7df787 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 28 Sep 2010 23:10:09 -0700 Subject: r300/compiler: Don't merge instructions that write output regs and ALU result https://bugs.freedesktop.org/show_bug.cgi?id=30415 NOTE: This is a candidate for the 7.9 branch. --- src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index a33b2fde7b5..38bae26f3c1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -475,6 +475,12 @@ static int merge_instructions(struct rc_pair_instruction * rgb, struct rc_pair_i { struct rc_pair_instruction backup; + /*Instructions can't write output registers and ALU result at the + * same time. */ + if ((rgb->WriteALUResult && alpha->Alpha.OutputWriteMask) + || (rgb->RGB.OutputWriteMask && alpha->WriteALUResult)) { + return 0; + } memcpy(&backup, rgb, sizeof(struct rc_pair_instruction)); if (destructive_merge_instructions(rgb, alpha)) -- cgit v1.2.3 From d4da253b298677c63def5f2f774608d660be31a1 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Wed, 29 Sep 2010 15:18:37 +0800 Subject: Revert "i965: Always set tiling for depth buffer on sandybridge" This reverts commit 0a1910c26760762eb8d67f68dfd87494ab479e38. oops, shouldn't apply tiling depth buffer for other chips as well. --- src/mesa/drivers/dri/i965/brw_misc_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 7a334126f2b..6eeaba77720 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -289,7 +289,7 @@ static void emit_depthbuffer(struct brw_context *brw) OUT_BATCH(((region->pitch * region->cpp) - 1) | (format << 18) | (BRW_TILEWALK_YMAJOR << 26) | - (1 << 27) | + ((region->tiling != I915_TILING_NONE) << 27) | (BRW_SURFACE_2D << 29)); OUT_RELOC(region->buffer, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, -- cgit v1.2.3 From 08839c4055e89a10e90df2f3a3a2bdc4e6ce0273 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 29 Sep 2010 20:03:06 +1000 Subject: Revert "r600g: add initial vertex translate support." This reverts commit 914b669b082258fc05d0fec047b69949d88585c4. I didn't mean to commit this yet, will redo in new state system once we clean it up. --- src/gallium/drivers/r600/r600_context.c | 7 -- src/gallium/drivers/r600/r600_context.h | 23 +---- src/gallium/drivers/r600/r600_draw.c | 171 +------------------------------- src/gallium/drivers/r600/r600_state.c | 41 +------- 4 files changed, 3 insertions(+), 239 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index cff15c57d28..091751e93a9 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -62,9 +62,6 @@ static void r600_destroy_context(struct pipe_context *context) u_upload_destroy(rctx->upload_vb); u_upload_destroy(rctx->upload_ib); - if (rctx->tran.translate_cache) - translate_cache_destroy(rctx->tran.translate_cache); - radeon_ctx_fini(rctx->ctx); FREE(rctx); } @@ -156,10 +153,6 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) goto out_free; } - rctx->tran.translate_cache = translate_cache_create(); - if (rctx->tran.translate_cache == NULL) - goto out_free; - rctx->vs_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state)); if (!rctx->vs_constant) { goto out_free; diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index ae32194318c..d104531d365 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -31,7 +31,6 @@ #include #include #include -#include "translate/translate_cache.h" #include "radeon.h" #include "r600_shader.h" @@ -116,11 +115,7 @@ struct r600_vertex_element { unsigned refcount; unsigned count; - struct pipe_vertex_element elements[PIPE_MAX_ATTRIBS]; - - enum pipe_format hw_format[PIPE_MAX_ATTRIBS]; - unsigned hw_format_size[PIPE_MAX_ATTRIBS]; - boolean incompatible_layout; + struct pipe_vertex_element elements[32]; }; struct r600_draw { @@ -137,18 +132,6 @@ struct r600_draw { unsigned index_bias; }; -struct r600_translate_context { - /* Translate cache for incompatible vertex offset/stride/format fallback. */ - struct translate_cache *translate_cache; - - /* The vertex buffer slot containing the translated buffer. */ - unsigned vb_slot; - - /* Saved and new vertex element state. */ - void *saved_velems, *new_velems; -}; - - struct r600_context_hw_states { struct radeon_state rasterizer; struct radeon_state scissor; @@ -264,10 +247,6 @@ struct r600_context { struct u_upload_mgr *upload_vb; struct u_upload_mgr *upload_ib; bool any_user_vbs; - unsigned vb_max_index; - - /* For translating vertex buffers having incompatible vertex layout. */ - struct r600_translate_context tran; }; /* Convenience cast wrapper. */ diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index ed1b20f7b9d..c41156f15fd 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -32,173 +32,12 @@ #include #include #include -#include "translate/translate_cache.h" -#include "translate/translate.h" #include "radeon.h" #include "r600_screen.h" #include "r600_context.h" #include "r600_resource.h" #include "r600_state_inlines.h" -static void r600_begin_vertex_translate(struct r600_context *rctx) -{ - struct pipe_context *pipe = &rctx->context; - struct translate_key key = {0}; - struct translate_element *te; - unsigned tr_elem_index[PIPE_MAX_ATTRIBS] = {0}; - struct translate *tr; - struct r600_vertex_element *ve = rctx->vertex_elements; - boolean vb_translated[PIPE_MAX_ATTRIBS] = {0}; - void *vb_map[PIPE_MAX_ATTRIBS] = {0}, *out_map; - struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0}, *out_transfer; - struct pipe_resource *out_buffer; - unsigned i, num_verts; - - /* Initialize the translate key, i.e. the recipe how vertices should be - * translated. */ - for (i = 0; i < ve->count; i++) { - struct pipe_vertex_buffer *vb = - &rctx->vertex_buffer[ve->elements[i].vertex_buffer_index]; - enum pipe_format output_format = ve->hw_format[i]; - unsigned output_format_size = ve->hw_format_size[i]; - - /* Check for support. */ - if (ve->elements[i].src_format == ve->hw_format[i] && - (vb->buffer_offset + ve->elements[i].src_offset) % 4 == 0 && - vb->stride % 4 == 0) { - continue; - } - - /* Workaround for translate: output floats instead of halfs. */ - switch (output_format) { - case PIPE_FORMAT_R16_FLOAT: - output_format = PIPE_FORMAT_R32_FLOAT; - output_format_size = 4; - break; - case PIPE_FORMAT_R16G16_FLOAT: - output_format = PIPE_FORMAT_R32G32_FLOAT; - output_format_size = 8; - break; - case PIPE_FORMAT_R16G16B16_FLOAT: - output_format = PIPE_FORMAT_R32G32B32_FLOAT; - output_format_size = 12; - break; - case PIPE_FORMAT_R16G16B16A16_FLOAT: - output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - output_format_size = 16; - break; - default:; - } - - /* Add this vertex element. */ - te = &key.element[key.nr_elements]; - /*te->type; - te->instance_divisor;*/ - te->input_buffer = ve->elements[i].vertex_buffer_index; - te->input_format = ve->elements[i].src_format; - te->input_offset = vb->buffer_offset + ve->elements[i].src_offset; - te->output_format = output_format; - te->output_offset = key.output_stride; - - key.output_stride += output_format_size; - vb_translated[ve->elements[i].vertex_buffer_index] = TRUE; - tr_elem_index[i] = key.nr_elements; - key.nr_elements++; - } - - /* Get a translate object. */ - tr = translate_cache_find(rctx->tran.translate_cache, &key); - - /* Map buffers we want to translate. */ - for (i = 0; i < rctx->nvertex_buffer; i++) { - if (vb_translated[i]) { - struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i]; - - vb_map[i] = pipe_buffer_map(pipe, vb->buffer, - PIPE_TRANSFER_READ, &vb_transfer[i]); - - tr->set_buffer(tr, i, vb_map[i], vb->stride, vb->max_index); - } - } - - /* Create and map the output buffer. */ - num_verts = rctx->vb_max_index + 1; - - out_buffer = pipe_buffer_create(&rctx->screen->screen, - PIPE_BIND_VERTEX_BUFFER, - key.output_stride * num_verts); - - out_map = pipe_buffer_map(pipe, out_buffer, PIPE_TRANSFER_WRITE, - &out_transfer); - - /* Translate. */ - tr->run(tr, 0, num_verts, 0, out_map); - - /* Unmap all buffers. */ - for (i = 0; i < rctx->nvertex_buffer; i++) { - if (vb_translated[i]) { - pipe_buffer_unmap(pipe, rctx->vertex_buffer[i].buffer, - vb_transfer[i]); - } - } - - pipe_buffer_unmap(pipe, out_buffer, out_transfer); - - /* Setup the new vertex buffer in the first free slot. */ - for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { - struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i]; - - if (!vb->buffer) { - pipe_resource_reference(&vb->buffer, out_buffer); - vb->buffer_offset = 0; - vb->max_index = num_verts - 1; - vb->stride = key.output_stride; - rctx->tran.vb_slot = i; - break; - } - } - - /* Save and replace vertex elements. */ - { - struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS]; - - rctx->tran.saved_velems = rctx->vertex_elements; - - for (i = 0; i < ve->count; i++) { - if (vb_translated[ve->elements[i].vertex_buffer_index]) { - te = &key.element[tr_elem_index[i]]; - new_velems[i].instance_divisor = ve->elements[i].instance_divisor; - new_velems[i].src_format = te->output_format; - new_velems[i].src_offset = te->output_offset; - new_velems[i].vertex_buffer_index = rctx->tran.vb_slot; - } else { - memcpy(&new_velems[i], &ve->elements[i], - sizeof(struct pipe_vertex_element)); - } - } - - rctx->tran.new_velems = - pipe->create_vertex_elements_state(pipe, ve->count, new_velems); - pipe->bind_vertex_elements_state(pipe, rctx->tran.new_velems); - } - - pipe_resource_reference(&out_buffer, NULL); -} - -static void r600_end_vertex_translate(struct r600_context *rctx) -{ - struct pipe_context *pipe = &rctx->context; - - /* Restore vertex elements. */ - pipe->bind_vertex_elements_state(pipe, rctx->tran.saved_velems); - pipe->delete_vertex_elements_state(pipe, rctx->tran.new_velems); - - /* Delete the now-unused VBO. */ - pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, - NULL); -} - - static void r600_translate_index_buffer(struct r600_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, @@ -278,7 +117,7 @@ static int r600_draw_common(struct r600_draw *draw) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->hw_format[i]); + rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->elements[i].src_format); radeon_draw_bind(&rctx->draw, vs_resource); } rctx->vs_nresource = rctx->vertex_elements->count; @@ -305,14 +144,9 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) struct r600_context *rctx = r600_context(ctx); struct r600_draw draw; int r; - boolean translate = FALSE; memset(&draw, 0, sizeof(draw)); - if (rctx->vertex_elements->incompatible_layout) { - r600_begin_vertex_translate(rctx); - translate = TRUE; - } if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); rctx->any_user_vbs = FALSE; @@ -352,8 +186,5 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) if (r) fprintf(stderr,"draw common failed %d\n", r); - if (translate) { - r600_end_vertex_translate(rctx); - } pipe_resource_reference(&draw.index_buffer, NULL); } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 1cadeea2fdd..86f9825b526 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -204,41 +204,15 @@ static void *r600_create_shader_state(struct pipe_context *ctx, return rstate; } -#define FORMAT_REPLACE(what, withwhat) \ - case PIPE_FORMAT_##what: *format = PIPE_FORMAT_##withwhat; break - static void *r600_create_vertex_elements(struct pipe_context *ctx, unsigned count, const struct pipe_vertex_element *elements) { struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); - unsigned i; - enum pipe_format *format; assert(count < 32); v->count = count; memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element)); - - for (i = 0; i < count; i++) { - v->hw_format[i] = v->elements[i].src_format; - format = &v->hw_format[i]; - - switch (*format) { - FORMAT_REPLACE(R64_FLOAT, R32_FLOAT); - FORMAT_REPLACE(R64G64_FLOAT, R32G32_FLOAT); - FORMAT_REPLACE(R64G64B64_FLOAT, R32G32B32_FLOAT); - FORMAT_REPLACE(R64G64B64A64_FLOAT, R32G32B32A32_FLOAT); - default:; - } - v->incompatible_layout = - v->incompatible_layout || - v->elements[i].src_format != v->hw_format[i] || - v->elements[i].src_offset % 4 != 0; - - v->hw_format_size[i] = - align(util_format_get_blocksize(v->hw_format[i]), 4); - } - v->refcount = 1; return v; } @@ -481,32 +455,19 @@ static void r600_set_vertex_buffers(struct pipe_context *ctx, struct r600_context *rctx = r600_context(ctx); unsigned i; boolean any_user_buffers = FALSE; - unsigned max_index, vbo_max_index; - const struct pipe_vertex_buffer *vbo; + for (i = 0; i < rctx->nvertex_buffer; i++) { pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); } memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); - max_index = 0; for (i = 0; i < count; i++) { - vbo = &buffers[i]; rctx->vertex_buffer[i].buffer = NULL; if (r600_buffer_is_user_buffer(buffers[i].buffer)) any_user_buffers = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); - if (vbo->max_index == ~0) { - if (!vbo->stride) - vbo_max_index = 1; - else - vbo_max_index = (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; - } else - vbo_max_index = vbo->max_index; - - max_index = MIN2(vbo_max_index, max_index); } rctx->any_user_vbs = any_user_buffers; rctx->nvertex_buffer = count; - rctx->vb_max_index = max_index; } static void r600_set_index_buffer(struct pipe_context *ctx, -- cgit v1.2.3 From 4b70fe8421f5132c585ff1dfb8d90229be26e71f Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 29 Sep 2010 08:32:12 -0400 Subject: glx: Only remove drawables from the hash when we actually delete them https://bugs.freedesktop.org/show_bug.cgi?id=30457 --- src/glx/dri_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 5fb5255416b..83d6e3c3108 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -391,17 +391,19 @@ driReleaseDrawables(struct glx_context *gc) if (__glxHashLookup(priv->drawHash, gc->currentDrawable, (void *) &pdraw) == 0) { - if (pdraw->drawable == pdraw->xDrawable) + if (pdraw->drawable == pdraw->xDrawable) { (*pdraw->destroyDrawable)(pdraw); - __glxHashDelete(priv->drawHash, gc->currentDrawable); + __glxHashDelete(priv->drawHash, gc->currentDrawable); + } } if (gc->currentDrawable != gc->currentReadable && __glxHashLookup(priv->drawHash, gc->currentReadable, (void *) &pdraw) == 0) { - if (pdraw->drawable == pdraw->xDrawable) + if (pdraw->drawable == pdraw->xDrawable) { (*pdraw->destroyDrawable)(pdraw); - __glxHashDelete(priv->drawHash, gc->currentReadable); + __glxHashDelete(priv->drawHash, gc->currentReadable); + } } } -- cgit v1.2.3 From fdcc168a16d59bf2b7fd291383f214834c2546f6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 29 Sep 2010 12:05:19 +0100 Subject: llvmpipe: Decouple sampler view and sampler state updates. Fixes glean pbo crash. It would be possible to avoid crashing without decoupling, but given that state trackers give no guarantee that number of views is consistent, that would likely cause too many state updates (or miss some). --- src/gallium/drivers/llvmpipe/lp_setup.c | 43 +++++++++++++++++++------ src/gallium/drivers/llvmpipe/lp_setup.h | 6 +++- src/gallium/drivers/llvmpipe/lp_state_derived.c | 9 ++++-- 3 files changed, 45 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index eade4000873..5ff11a33632 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -617,8 +617,7 @@ lp_setup_set_vertex_info( struct lp_setup_context *setup, void lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, unsigned num, - struct pipe_sampler_view **views, - const struct pipe_sampler_state **samplers) + struct pipe_sampler_view **views) { unsigned i; @@ -629,7 +628,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; - if(view) { + if (view) { struct pipe_resource *tex = view->texture; struct llvmpipe_resource *lp_tex = llvmpipe_resource(tex); struct lp_jit_texture *jit_tex; @@ -639,12 +638,6 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->depth = tex->depth0; jit_tex->last_level = tex->last_level; - /* sampler state */ - jit_tex->min_lod = samplers[i]->min_lod; - jit_tex->max_lod = samplers[i]->max_lod; - jit_tex->lod_bias = samplers[i]->lod_bias; - COPY_4V(jit_tex->border_color, samplers[i]->border_color); - /* We're referencing the texture's internal data, so save a * reference to it. */ @@ -693,6 +686,38 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, } +/** + * Called during state validation when LP_NEW_SAMPLER is set. + */ +void +lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, + unsigned num, + const struct pipe_sampler_state **samplers) +{ + unsigned i; + + LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + + assert(num <= PIPE_MAX_SAMPLERS); + + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + const struct pipe_sampler_state *sampler = i < num ? samplers[i] : NULL; + + if (sampler) { + struct lp_jit_texture *jit_tex; + jit_tex = &setup->fs.current.jit_context.textures[i]; + + jit_tex->min_lod = sampler->min_lod; + jit_tex->max_lod = sampler->max_lod; + jit_tex->lod_bias = sampler->lod_bias; + COPY_4V(jit_tex->border_color, sampler->border_color); + } + } + + setup->dirty |= LP_SETUP_NEW_FS; +} + + /** * Is the given texture referenced by any scene? * Note: we have to check all scenes including any scenes currently diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 868bd3ad2f1..25dab78f64f 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -143,7 +143,11 @@ lp_setup_set_scissor( struct lp_setup_context *setup, void lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, unsigned num, - struct pipe_sampler_view **views, + struct pipe_sampler_view **views); + +void +lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, + unsigned num, const struct pipe_sampler_state **samplers); unsigned diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index d2be22d7fc5..bb059d04599 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -208,11 +208,14 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe ) lp_setup_set_fs_constants(llvmpipe->setup, llvmpipe->constants[PIPE_SHADER_FRAGMENT][0]); - if (llvmpipe->dirty & (LP_NEW_SAMPLER_VIEW | - LP_NEW_SAMPLER)) + if (llvmpipe->dirty & (LP_NEW_SAMPLER_VIEW)) lp_setup_set_fragment_sampler_views(llvmpipe->setup, llvmpipe->num_fragment_sampler_views, - llvmpipe->fragment_sampler_views, + llvmpipe->fragment_sampler_views); + + if (llvmpipe->dirty & (LP_NEW_SAMPLER)) + lp_setup_set_fragment_sampler_state(llvmpipe->setup, + llvmpipe->num_samplers, llvmpipe->sampler); llvmpipe->dirty = 0; -- cgit v1.2.3 From 0cb545a7f2e823c85309013c4c41e9461f297d06 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 29 Sep 2010 10:34:41 -0600 Subject: draw: pass sampler state down to llvm jit state Fixes a regression caused from the change to make min/max lod dynamic state. https://bugs.freedesktop.org/show_bug.cgi?id=30437 --- src/gallium/auxiliary/draw/draw_context.c | 5 +++++ src/gallium/auxiliary/draw/draw_llvm.c | 18 ++++++++++++++++++ src/gallium/auxiliary/draw/draw_llvm.h | 3 +++ 3 files changed, 26 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index b07de76a498..032fcbbc70a 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -709,6 +709,11 @@ draw_set_samplers(struct draw_context *draw, draw->samplers[i] = NULL; draw->num_samplers = num; + +#ifdef HAVE_LLVM + if (draw->llvm) + draw_llvm_set_sampler_state(draw); +#endif } void diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 5154c1f3c5f..4749bb57a53 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -44,6 +44,7 @@ #include "tgsi/tgsi_dump.h" #include "util/u_cpu_detect.h" +#include "util/u_math.h" #include "util/u_pointer.h" #include "util/u_string.h" @@ -1089,6 +1090,23 @@ draw_llvm_set_mapped_texture(struct draw_context *draw, } } + +void +draw_llvm_set_sampler_state(struct draw_context *draw) +{ + unsigned i; + + for (i = 0; i < draw->num_samplers; i++) { + struct draw_jit_texture *jit_tex = &draw->llvm->jit_context.textures[i]; + + jit_tex->min_lod = draw->samplers[i]->min_lod; + jit_tex->max_lod = draw->samplers[i]->max_lod; + jit_tex->lod_bias = draw->samplers[i]->lod_bias; + COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color); + } +} + + void draw_llvm_destroy_variant(struct draw_llvm_variant *variant) { diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index b881ef6113b..d0a68ae412d 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -282,6 +282,9 @@ struct lp_build_sampler_soa * draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, LLVMValueRef context_ptr); +void +draw_llvm_set_sampler_state(struct draw_context *draw); + void draw_llvm_set_mapped_texture(struct draw_context *draw, unsigned sampler_idx, -- cgit v1.2.3 From 5646964b1360883b6254e2ebacc198f43869d36f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 28 Sep 2010 17:37:56 -0400 Subject: r600g: use a hash table instead of group Instead of creating group of register use a hash table to lookup into which block each register belongs. This simplify code a bit. Signed-off-by: Jerome Glisse id = R600_PIPE_STATE_BLEND_COLOR; - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; @@ -104,9 +104,9 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx, } } blend->cb_target_mask = target_mask; - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL, + r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL, color_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C3C_PA_SC_AA_MASK, 0xFFFFFFFF, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C3C_PA_SC_AA_MASK, 0xFFFFFFFF, 0xFFFFFFFF, NULL); for (int i = 0; i < 8; i++) { unsigned eqRGB = state->rt[i].rgb_func; @@ -133,7 +133,7 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx, } } for (int i = 0; i < 8; i++) { - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028780_CB_BLEND0_CONTROL + i * 4, blend_cntl[i], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028780_CB_BLEND0_CONTROL + i * 4, blend_cntl[i], 0xFFFFFFFF, NULL); } return rstate; @@ -214,25 +214,25 @@ static void *evergreen_create_dsa_state(struct pipe_context *ctx, S_02800C_FORCE_HIS_ENABLE0(V_02800C_FORCE_DISABLE) | S_02800C_FORCE_HIS_ENABLE1(V_02800C_FORCE_DISABLE); /* TODO db_render_override depends on query */ - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028430_DB_STENCILREFMASK, stencil_ref_mask, 0xFFFFFFFF & C_028430_STENCILREF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf, 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028000_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02800C_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC8_DB_PRELOAD_CONTROL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B70_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); + r600_pipe_state_add_reg(rstate, R_028000_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02800C_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AC8_DB_PRELOAD_CONTROL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028B70_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); return rstate; } @@ -271,11 +271,11 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, tmp |= S_0286D4_PNT_SPRITE_TOP_1(1); } } - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || state->fill_back != PIPE_POLYGON_MODE_FILL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, + r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL, S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | @@ -286,22 +286,22 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, S_028814_POLY_MODE(polygon_dual_mode) | S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, + r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); /* point size 12.4 fixed point */ tmp = (unsigned)(state->point_size * 8.0); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C08_PA_SU_VTX_CNTL, 0x00000005, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL, 0x00000005, 0xFFFFFFFF, NULL); return rstate; } @@ -347,7 +347,7 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_SAMPLER; util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0, + r600_pipe_state_add_reg(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0, S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | @@ -357,20 +357,20 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL); /* FIXME LOD it depends on texture base level ... */ - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0, + r600_pipe_state_add_reg(rstate, R_03C004_SQ_TEX_SAMPLER_WORD1_0, S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0, + r600_pipe_state_add_reg(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) | S_03C008_TYPE(1), 0xFFFFFFFF, NULL); if (uc.ui) { - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A404_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER_BORDER, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); } return rstate; } @@ -455,29 +455,29 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte pitch = align(tmp->pitch[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, + r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, S_030000_DIM(r600_tex_dim(texture->target)) | S_030000_PITCH((pitch / 8) - 1) | S_030000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, + r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1, S_030004_TEX_HEIGHT(texture->height0 - 1) | S_030004_TEX_DEPTH(texture->depth0 - 1), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030008_RESOURCE0_WORD2, + r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03000C_RESOURCE0_WORD3, + r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, + r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, word4 | S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) | S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) | S_030010_REQUEST_SIZE(1) | S_030010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, + r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5, S_030014_LAST_LEVEL(state->last_level) | S_030014_BASE_ARRAY(0) | S_030014_LAST_ARRAY(0), 0xffffffff, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, + r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7, S_03001C_DATA_FORMAT(format) | S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL); @@ -573,20 +573,20 @@ static void evergreen_set_clip_state(struct pipe_context *ctx, rctx->clip = *state; rstate->id = R600_PIPE_STATE_CLIP; for (int i = 0; i < state->nr; i++) { - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0285BC_PA_CL_UCP0_X + i * 4, fui(state->ucp[i][0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0285C0_PA_CL_UCP0_Y + i * 4, fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0285C4_PA_CL_UCP0_Z + i * 4, fui(state->ucp[i][2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0285C8_PA_CL_UCP0_W + i * 4, fui(state->ucp[i][3]), 0xFFFFFFFF, NULL); } - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, + r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) | S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) | S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL); @@ -631,49 +631,49 @@ static void evergreen_set_scissor_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_SCISSOR; tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny); br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028030_PA_SC_SCREEN_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028034_PA_SC_SCREEN_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028204_PA_SC_WINDOW_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028208_PA_SC_WINDOW_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028210_PA_SC_CLIPRECT_0_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028214_PA_SC_CLIPRECT_0_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028218_PA_SC_CLIPRECT_1_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02821C_PA_SC_CLIPRECT_1_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028220_PA_SC_CLIPRECT_2_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028224_PA_SC_CLIPRECT_2_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028228_PA_SC_CLIPRECT_3_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02822C_PA_SC_CLIPRECT_3_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028200_PA_SC_WINDOW_OFFSET, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, 0xFFFFFFFF, NULL); @@ -695,11 +695,11 @@ static void evergreen_set_stencil_ref(struct pipe_context *ctx, rctx->stencil_ref = *state; rstate->id = R600_PIPE_STATE_STENCIL_REF; tmp = S_028430_STENCILREF(state->ref_value[0]); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028430_DB_STENCILREFMASK, tmp, ~C_028430_STENCILREF, NULL); tmp = S_028434_STENCILREF_BF(state->ref_value[1]); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028434_DB_STENCILREFMASK_BF, tmp, ~C_028434_STENCILREF_BF, NULL); @@ -719,15 +719,15 @@ static void evergreen_set_viewport_state(struct pipe_context *ctx, rctx->viewport = *state; rstate->id = R600_PIPE_STATE_VIEWPORT; - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_VIEWPORT]); rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; @@ -769,27 +769,27 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state color_info |= S_028C70_SOURCE_FORMAT(1); /* FIXME handle enabling of CB beyond BASE8 which has different offset */ - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C60_CB_COLOR0_BASE + cb * 0x3C, state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C78_CB_COLOR0_DIM + cb * 0x3C, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C70_CB_COLOR0_INFO + cb * 0x3C, color_info, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C64_CB_COLOR0_PITCH + cb * 0x3C, S_028C64_PITCH_TILE_MAX(pitch), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C68_CB_COLOR0_SLICE + cb * 0x3C, S_028C68_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C6C_CB_COLOR0_VIEW + cb * 0x3C, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028C74_CB_COLOR0_ATTRIB + cb * 0x3C, S_028C74_NON_DISP_TILING_ORDER(1), 0xFFFFFFFF, NULL); @@ -818,19 +818,19 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028048_DB_Z_READ_BASE, + r600_pipe_state_add_reg(rstate, R_028048_DB_Z_READ_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028050_DB_Z_WRITE_BASE, + r600_pipe_state_add_reg(rstate, R_028050_DB_Z_WRITE_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); -// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028040_DB_Z_INFO, +// r600_pipe_state_add_reg(rstate, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028040_DB_Z_INFO, S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format), 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028058_DB_DEPTH_SIZE, + r600_pipe_state_add_reg(rstate, R_028058_DB_DEPTH_SIZE, S_028058_PITCH_TILE_MAX(pitch), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02805C_DB_DEPTH_SLICE, + r600_pipe_state_add_reg(rstate, R_02805C_DB_DEPTH_SLICE, S_02805C_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); } @@ -874,26 +874,26 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, tl = S_028240_TL_X(0) | S_028240_TL_Y(0); br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028240_PA_SC_GENERIC_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028244_PA_SC_GENERIC_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, + r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK, 0x00000000, target_mask, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK, + r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK, shader_mask, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG, + r600_pipe_state_add_reg(rstate, R_028C04_PA_SC_AA_CONFIG, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, + r600_pipe_state_add_reg(rstate, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0x00000000, 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); @@ -944,22 +944,22 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader, switch (shader) { case PIPE_SHADER_VERTEX: rctx->vs_const_buffer.nregs = 0; - r600_pipe_state_add_reg(&rctx->vs_const_buffer, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&rctx->vs_const_buffer, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, ALIGN_DIVUP(buffer->width0 >> 4, 16), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rctx->vs_const_buffer, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&rctx->vs_const_buffer, R_028980_ALU_CONST_CACHE_VS_0, 0, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); break; case PIPE_SHADER_FRAGMENT: rctx->ps_const_buffer.nregs = 0; - r600_pipe_state_add_reg(&rctx->ps_const_buffer, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&rctx->ps_const_buffer, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, ALIGN_DIVUP(buffer->width0 >> 4, 16), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rctx->ps_const_buffer, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&rctx->ps_const_buffer, R_028940_ALU_CONST_CACHE_PS_0, 0, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); @@ -1209,125 +1209,125 @@ void evergreen_init_config2(struct r600_pipe_context *rctx) tmp |= S_008C00_VS_PRIO(vs_prio); tmp |= S_008C00_GS_PRIO(gs_prio); tmp |= S_008C00_ES_PRIO(es_prio); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); tmp |= S_008C08_NUM_ES_GPRS(num_es_gprs); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C0C_NUM_HS_GPRS(num_hs_gprs); tmp |= S_008C0C_NUM_LS_GPRS(num_ls_gprs); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C18_NUM_PS_THREADS(num_ps_threads); tmp |= S_008C18_NUM_VS_THREADS(num_vs_threads); tmp |= S_008C18_NUM_GS_THREADS(num_gs_threads); tmp |= S_008C18_NUM_ES_THREADS(num_es_threads); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C1C_NUM_HS_THREADS(num_hs_threads); tmp |= S_008C1C_NUM_LS_THREADS(num_ls_threads); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); tmp |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); tmp |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); tmp = 0; tmp |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries); tmp |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL); - -// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); - -// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AB4_VGT_REUSE_OFF, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028380_SQ_VTX_SEMANTIC_0, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028384_SQ_VTX_SEMANTIC_1, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028388_SQ_VTX_SEMANTIC_2, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02838C_SQ_VTX_SEMANTIC_3, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028390_SQ_VTX_SEMANTIC_4, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028394_SQ_VTX_SEMANTIC_5, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028398_SQ_VTX_SEMANTIC_6, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02839C_SQ_VTX_SEMANTIC_7, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A0_SQ_VTX_SEMANTIC_8, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A4_SQ_VTX_SEMANTIC_9, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A8_SQ_VTX_SEMANTIC_10, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283AC_SQ_VTX_SEMANTIC_11, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B0_SQ_VTX_SEMANTIC_12, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B4_SQ_VTX_SEMANTIC_13, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B8_SQ_VTX_SEMANTIC_14, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283BC_SQ_VTX_SEMANTIC_15, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C0_SQ_VTX_SEMANTIC_16, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C4_SQ_VTX_SEMANTIC_17, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C8_SQ_VTX_SEMANTIC_18, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283CC_SQ_VTX_SEMANTIC_19, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D0_SQ_VTX_SEMANTIC_20, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D4_SQ_VTX_SEMANTIC_21, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D8_SQ_VTX_SEMANTIC_22, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283DC_SQ_VTX_SEMANTIC_23, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E0_SQ_VTX_SEMANTIC_24, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E4_SQ_VTX_SEMANTIC_25, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E8_SQ_VTX_SEMANTIC_26, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283EC_SQ_VTX_SEMANTIC_27, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F0_SQ_VTX_SEMANTIC_28, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F4_SQ_VTX_SEMANTIC_29, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F8_SQ_VTX_SEMANTIC_30, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283FC_SQ_VTX_SEMANTIC_31, 0x0, 0xFFFFFFFF, NULL); - -r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, + r600_pipe_state_add_reg(rstate, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL); + +// r600_pipe_state_add_reg(rstate, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL); + +// r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB4_VGT_REUSE_OFF, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_028380_SQ_VTX_SEMANTIC_0, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028384_SQ_VTX_SEMANTIC_1, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028388_SQ_VTX_SEMANTIC_2, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02838C_SQ_VTX_SEMANTIC_3, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028390_SQ_VTX_SEMANTIC_4, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028394_SQ_VTX_SEMANTIC_5, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028398_SQ_VTX_SEMANTIC_6, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02839C_SQ_VTX_SEMANTIC_7, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283A0_SQ_VTX_SEMANTIC_8, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283A4_SQ_VTX_SEMANTIC_9, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283A8_SQ_VTX_SEMANTIC_10, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283AC_SQ_VTX_SEMANTIC_11, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283B0_SQ_VTX_SEMANTIC_12, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283B4_SQ_VTX_SEMANTIC_13, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283B8_SQ_VTX_SEMANTIC_14, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283BC_SQ_VTX_SEMANTIC_15, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283C0_SQ_VTX_SEMANTIC_16, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283C4_SQ_VTX_SEMANTIC_17, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283C8_SQ_VTX_SEMANTIC_18, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283CC_SQ_VTX_SEMANTIC_19, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283D0_SQ_VTX_SEMANTIC_20, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283D4_SQ_VTX_SEMANTIC_21, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283D8_SQ_VTX_SEMANTIC_22, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283DC_SQ_VTX_SEMANTIC_23, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283E0_SQ_VTX_SEMANTIC_24, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283E4_SQ_VTX_SEMANTIC_25, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283E8_SQ_VTX_SEMANTIC_26, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283EC_SQ_VTX_SEMANTIC_27, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283F0_SQ_VTX_SEMANTIC_28, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283F4_SQ_VTX_SEMANTIC_29, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283F8_SQ_VTX_SEMANTIC_30, 0x0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0283FC_SQ_VTX_SEMANTIC_31, 0x0, 0xFFFFFFFF, NULL); + +r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, 0x0, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, rstate); @@ -1420,26 +1420,26 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) rstate->nregs = 0; r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, + r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, S_030008_STRIDE(vertex_buffer->stride) | S_030008_DATA_FORMAT(format) | S_030008_NUM_FORMAT_ALL(num_format) | S_030008_FORMAT_COMP_ALL(format_comp), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, + r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) | S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) | S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) | S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL); evergreen_vs_resource_set(&rctx->ctx, rstate, i); } @@ -1450,11 +1450,11 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) vgt.id = R600_PIPE_STATE_VGT; vgt.nregs = 0; - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.index_bias, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028408_VGT_INDX_OFFSET, draw.index_bias, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL); if (rctx->rasterizer && rctx->framebuffer.zsbuf) { float offset_units = rctx->rasterizer->offset_units; @@ -1479,19 +1479,19 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) return; } offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); } @@ -1536,10 +1536,10 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) { tmp |= S_028644_PT_SPRITE_TEX(1); } - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } for (i = 0; i < rshader->noutput; i++) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, S_02880C_Z_EXPORT_ENABLE(1), S_02880C_Z_EXPORT_ENABLE(1), NULL); @@ -1567,27 +1567,27 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1); spi_input_z |= 1; } - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, + r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, + r600_pipe_state_add_reg(rstate, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028840_SQ_PGM_START_PS, 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028844_SQ_PGM_RESOURCES_PS, S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) | S_028844_STACK_SIZE(rshader->bc.nstack), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028848_SQ_PGM_RESOURCES_2_PS, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02884C_SQ_PGM_EXPORTS_PS, exports_ps, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0286E0_SPI_BARYC_CNTL, S_0286E0_PERSP_CENTROID_ENA(1) | S_0286E0_LINEAR_CENTROID_ENA(1), @@ -1595,7 +1595,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader if (rshader->uses_kill) { /* only set some bits here, the other bits are set in the dsa state */ - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, S_02880C_KILL_ENABLE(1), S_02880C_KILL_ENABLE(1), NULL); @@ -1621,30 +1621,30 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader spi_vs_out_id[i / 4] |= tmp; } for (i = 0; i < 10; i++) { - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02861C_SPI_VS_OUT_ID_0 + i * 4, spi_vs_out_id[i], 0xFFFFFFFF, NULL); } - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0286C4_SPI_VS_OUT_CONFIG, S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028860_SQ_PGM_RESOURCES_VS, S_028860_NUM_GPRS(rshader->bc.ngpr) | S_028860_STACK_SIZE(rshader->bc.nstack), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028864_SQ_PGM_RESOURCES_2_VS, 0x0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0288A8_SQ_PGM_RESOURCES_FS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02885C_SQ_PGM_START_VS, 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); } diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index adc35afc025..58d753ef5e2 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -117,32 +117,7 @@ void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, #define R600_BLOCK_MAX_BO 32 #define R600_BLOCK_MAX_REG 128 -enum r600_group_id { - R600_GROUP_CONFIG = 0, - R600_GROUP_CONTEXT, - R600_GROUP_ALU_CONST, - R600_GROUP_RESOURCE, - R600_GROUP_SAMPLER, - R600_GROUP_CTL_CONST, - R600_GROUP_LOOP_CONST, - R600_GROUP_BOOL_CONST, - R600_NGROUPS -}; - -enum evergreen_group_id { - EVERGREEN_GROUP_CONFIG = 0, - EVERGREEN_GROUP_CONTEXT, - EVERGREEN_GROUP_RESOURCE, - EVERGREEN_GROUP_SAMPLER, - EVERGREEN_GROUP_CTL_CONST, - EVERGREEN_GROUP_LOOP_CONST, - EVERGREEN_GROUP_BOOL_CONST, - EVERGREEN_GROUP_SAMPLER_BORDER, - EVERGREEN_NGROUPS -}; - struct r600_pipe_reg { - unsigned group_id; u32 offset; u32 mask; u32 value; @@ -156,11 +131,9 @@ struct r600_pipe_state { }; static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state, - unsigned group_id, u32 offset, - u32 value, u32 mask, + u32 offset, u32 value, u32 mask, struct radeon_ws_bo *bo) { - state->regs[state->nregs].group_id = group_id; state->regs[state->nregs].offset = offset; state->regs[state->nregs].value = value; state->regs[state->nregs].mask = mask; @@ -178,7 +151,7 @@ struct r600_block_reloc { unsigned bo_pm4_index[R600_BLOCK_MAX_BO]; }; -struct r600_group_block { +struct r600_block { unsigned status; unsigned start_offset; unsigned pm4_ndwords; @@ -190,12 +163,10 @@ struct r600_group_block { struct r600_block_reloc reloc[R600_BLOCK_MAX_BO]; }; -struct r600_group { +struct r600_range { unsigned start_offset; unsigned end_offset; - unsigned nblocks; - struct r600_group_block *blocks; - unsigned *offset_block_id; + struct r600_block **blocks; }; /* @@ -236,8 +207,11 @@ struct r600_query { struct r600_context { struct radeon *radeon; - unsigned ngroups; - struct r600_group groups[R600_GROUP_MAX]; + unsigned hash_size; + unsigned hash_shift; + struct r600_range range[256]; + unsigned nblocks; + struct r600_block **blocks; unsigned pm4_ndwords; unsigned pm4_cdwords; unsigned pm4_dirty_cdwords; diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 5bd38726e75..38cd9acf450 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -73,33 +73,33 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade spi_vs_out_id[i / 4] |= tmp; } for (i = 0; i < 10; i++) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028614_SPI_VS_OUT_ID_0 + i * 4, spi_vs_out_id[i], 0xFFFFFFFF, NULL); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0286C4_SPI_VS_OUT_CONFIG, S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028868_SQ_PGM_RESOURCES_VS, S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_RESOURCES_FS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028858_SQ_PGM_START_VS, 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028894_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); } @@ -145,10 +145,10 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) { tmp |= S_028644_PT_SPRITE_TEX(1); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } for (i = 0; i < rshader->noutput; i++) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, S_02880C_Z_EXPORT_ENABLE(1), S_02880C_Z_EXPORT_ENABLE(1), NULL); @@ -177,27 +177,27 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade S_0286CC_BARYC_SAMPLE_CNTL(1); spi_input_z |= 1; } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028840_SQ_PGM_START_PS, 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028850_SQ_PGM_RESOURCES_PS, S_028868_NUM_GPRS(rshader->bc.ngpr) | S_028868_STACK_SIZE(rshader->bc.nstack), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028854_SQ_PGM_EXPORTS_PS, exports_ps, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0x00000000, 0xFFFFFFFF, NULL); if (rshader->uses_kill) { /* only set some bits here, the other bits are set in the dsa state */ - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, S_02880C_KILL_ENABLE(1), S_02880C_KILL_ENABLE(1), NULL); @@ -538,19 +538,19 @@ static void r600_draw_common(struct r600_drawl *draw) rstate->nregs = 0; r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, + r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, S_038008_STRIDE(vertex_buffer->stride) | S_038008_DATA_FORMAT(format) | S_038008_NUM_FORMAT_ALL(num_format) | S_038008_FORMAT_COMP_ALL(format_comp), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL); r600_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, i); } @@ -561,11 +561,11 @@ static void r600_draw_common(struct r600_drawl *draw) vgt.id = R600_PIPE_STATE_VGT; vgt.nregs = 0; - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); /* build late state */ if (rctx->rasterizer && rctx->framebuffer.zsbuf) { float offset_units = rctx->rasterizer->offset_units; @@ -590,19 +590,19 @@ static void r600_draw_common(struct r600_drawl *draw) return; } offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(&vgt, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, 0xFFFFFFFF, NULL); } @@ -888,10 +888,10 @@ static void r600_set_blend_color(struct pipe_context *ctx, return; rstate->id = R600_PIPE_STATE_BLEND_COLOR; - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; r600_context_pipe_state_set(&rctx->ctx, rstate); @@ -935,7 +935,7 @@ static void *r600_create_blend_state(struct pipe_context *ctx, } } blend->cb_target_mask = target_mask; - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL, + r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL, color_control, 0xFFFFFFFF, NULL); for (int i = 0; i < 8; i++) { @@ -962,9 +962,9 @@ static void *r600_create_blend_state(struct pipe_context *ctx, bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA)); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028780_CB_BLEND0_CONTROL + i * 4, bc, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028780_CB_BLEND0_CONTROL + i * 4, bc, 0xFFFFFFFF, NULL); if (i == 0) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028804_CB_BLEND_CONTROL, bc, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028804_CB_BLEND_CONTROL, bc, 0xFFFFFFFF, NULL); } } return rstate; @@ -1045,26 +1045,26 @@ static void *r600_create_dsa_state(struct pipe_context *ctx, S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); /* TODO db_render_override depends on query */ - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028430_DB_STENCILREFMASK, stencil_ref_mask, 0xFFFFFFFF & C_028430_STENCILREF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf, 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286E0_SPI_FOG_FUNC_SCALE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286E4_SPI_FOG_FUNC_BIAS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D30_DB_PRELOAD_CONTROL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D44_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286E0_SPI_FOG_FUNC_SCALE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286E4_SPI_FOG_FUNC_BIAS, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); + r600_pipe_state_add_reg(rstate, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D30_DB_PRELOAD_CONTROL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D44_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); return rstate; } @@ -1103,11 +1103,11 @@ static void *r600_create_rs_state(struct pipe_context *ctx, tmp |= S_0286D4_PNT_SPRITE_TOP_1(1); } } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || state->fill_back != PIPE_POLYGON_MODE_FILL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL, + r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL, S_028814_PROVOKING_VTX_LAST(prov_vtx) | S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | @@ -1118,23 +1118,23 @@ static void *r600_create_rs_state(struct pipe_context *ctx, S_028814_POLY_MODE(polygon_dual_mode) | S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL, + r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); /* point size 12.4 fixed point */ tmp = (unsigned)(state->point_size * 8.0); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A0C_PA_SC_LINE_STIPPLE, 0x00000005, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A48_PA_SC_MPASS_PS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A0C_PA_SC_LINE_STIPPLE, 0x00000005, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MPASS_PS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL); return rstate; } @@ -1180,7 +1180,7 @@ static void *r600_create_sampler_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_SAMPLER; util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0, + r600_pipe_state_add_reg(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0, S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | @@ -1190,16 +1190,16 @@ static void *r600_create_sampler_state(struct pipe_context *ctx, S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL); /* FIXME LOD it depends on texture base level ... */ - r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0, + r600_pipe_state_add_reg(rstate, R_03C004_SQ_TEX_SAMPLER_WORD1_0, S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) | S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL); if (uc.ui) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); } return rstate; } @@ -1281,30 +1281,30 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c pitch = align(tmp->pitch[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0, + r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, S_038000_DIM(r600_tex_dim(texture->target)) | S_038000_TILE_MODE(array_mode) | S_038000_TILE_TYPE(tile_type) | S_038000_PITCH((pitch / 8) - 1) | S_038000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038004_RESOURCE0_WORD1, + r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, S_038004_TEX_HEIGHT(texture->height0 - 1) | S_038004_TEX_DEPTH(texture->depth0 - 1) | S_038004_DATA_FORMAT(format), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038008_RESOURCE0_WORD2, + r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03800C_RESOURCE0_WORD3, + r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038010_RESOURCE0_WORD4, + r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | S_038010_REQUEST_SIZE(1) | S_038010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038014_RESOURCE0_WORD5, + r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, S_038014_LAST_LEVEL(state->last_level) | S_038014_BASE_ARRAY(0) | S_038014_LAST_ARRAY(0), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038018_RESOURCE0_WORD6, + r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL); return &resource->base; @@ -1399,20 +1399,20 @@ static void r600_set_clip_state(struct pipe_context *ctx, rctx->clip = *state; rstate->id = R600_PIPE_STATE_CLIP; for (int i = 0; i < state->nr; i++) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028E20_PA_CL_UCP0_X + i * 4, fui(state->ucp[i][0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028E24_PA_CL_UCP0_Y + i * 4, fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028E28_PA_CL_UCP0_Z + i * 4, fui(state->ucp[i][2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028E2C_PA_CL_UCP0_W + i * 4, fui(state->ucp[i][3]), 0xFFFFFFFF, NULL); } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL, + r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) | S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) | S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL); @@ -1457,50 +1457,50 @@ static void r600_set_scissor_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_SCISSOR; tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1); br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028030_PA_SC_SCREEN_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028034_PA_SC_SCREEN_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028204_PA_SC_WINDOW_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028208_PA_SC_WINDOW_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028210_PA_SC_CLIPRECT_0_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028214_PA_SC_CLIPRECT_0_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028218_PA_SC_CLIPRECT_1_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02821C_PA_SC_CLIPRECT_1_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028220_PA_SC_CLIPRECT_2_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028224_PA_SC_CLIPRECT_2_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028228_PA_SC_CLIPRECT_3_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02822C_PA_SC_CLIPRECT_3_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028200_PA_SC_WINDOW_OFFSET, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, 0xFFFFFFFF, NULL); if (rctx->family >= CHIP_RV770) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, 0xFFFFFFFF, NULL); } @@ -1523,11 +1523,11 @@ static void r600_set_stencil_ref(struct pipe_context *ctx, rctx->stencil_ref = *state; rstate->id = R600_PIPE_STATE_STENCIL_REF; tmp = S_028430_STENCILREF(state->ref_value[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028430_DB_STENCILREFMASK, tmp, ~C_028430_STENCILREF, NULL); tmp = S_028434_STENCILREF_BF(state->ref_value[1]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028434_DB_STENCILREFMASK_BF, tmp, ~C_028434_STENCILREF_BF, NULL); @@ -1547,15 +1547,15 @@ static void r600_set_viewport_state(struct pipe_context *ctx, rctx->viewport = *state; rstate->id = R600_PIPE_STATE_VIEWPORT; - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_VIEWPORT]); rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; @@ -1596,27 +1596,27 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) color_info |= S_0280A0_SOURCE_FORMAT(1); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028040_CB_COLOR0_BASE + cb * 4, state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0280A0_CB_COLOR0_INFO + cb * 4, color_info, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028060_CB_COLOR0_SIZE + cb * 4, S_028060_PITCH_TILE_MAX(pitch) | S_028060_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028080_CB_COLOR0_VIEW + cb * 4, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0280E0_CB_COLOR0_FRAG + cb * 4, 0x00000000, 0xFFFFFFFF, bo[1]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_0280C0_CB_COLOR0_TILE + cb * 4, 0x00000000, 0xFFFFFFFF, bo[2]); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028100_CB_COLOR0_MASK + cb * 4, 0x00000000, 0xFFFFFFFF, NULL); } @@ -1644,16 +1644,16 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02800C_DB_DEPTH_BASE, + r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028000_DB_DEPTH_SIZE, + r600_pipe_state_add_reg(rstate, R_028000_DB_DEPTH_SIZE, S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028010_DB_DEPTH_INFO, + r600_pipe_state_add_reg(rstate, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028010_DB_DEPTH_INFO, S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format), 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D34_DB_PREFETCH_LIMIT, + r600_pipe_state_add_reg(rstate, R_028D34_DB_PREFETCH_LIMIT, (state->zsbuf->height / 8) - 1, 0xFFFFFFFF, NULL); } @@ -1699,40 +1699,40 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1); br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028240_PA_SC_GENERIC_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028244_PA_SC_GENERIC_SCISSOR_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0287A0_CB_SHADER_CONTROL, + r600_pipe_state_add_reg(rstate, R_0287A0_CB_SHADER_CONTROL, shader_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, + r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK, 0x00000000, target_mask, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK, + r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK, shader_mask, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG, + r600_pipe_state_add_reg(rstate, R_028C04_PA_SC_AA_CONFIG, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, + r600_pipe_state_add_reg(rstate, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, + r600_pipe_state_add_reg(rstate, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C30_CB_CLRCMP_CONTROL, + r600_pipe_state_add_reg(rstate, R_028C30_CB_CLRCMP_CONTROL, 0x01000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C34_CB_CLRCMP_SRC, + r600_pipe_state_add_reg(rstate, R_028C34_CB_CLRCMP_SRC, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C38_CB_CLRCMP_DST, + r600_pipe_state_add_reg(rstate, R_028C38_CB_CLRCMP_DST, 0x000000FF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C3C_CB_CLRCMP_MSK, + r600_pipe_state_add_reg(rstate, R_028C3C_CB_CLRCMP_MSK, 0xFFFFFFFF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C48_PA_SC_AA_MASK, + r600_pipe_state_add_reg(rstate, R_028C48_PA_SC_AA_MASK, 0xFFFFFFFF, 0xFFFFFFFF, NULL); free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); @@ -1805,10 +1805,10 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint return; for (int i = 0; i < *nconst; i++, offset += 0x10) { rstate[i].nregs = 0; - r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0x0, ptr[i * 4 + 0], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0x4, ptr[i * 4 + 1], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0x8, ptr[i * 4 + 2], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0xC, ptr[i * 4 + 3], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0x0, ptr[i * 4 + 0], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0x4, ptr[i * 4 + 1], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0x8, ptr[i * 4 + 2], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0xC, ptr[i * 4 + 3], 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, &rstate[i]); } pipe_buffer_unmap(ctx, buffer, transfer); @@ -2072,20 +2072,20 @@ static void r600_init_config2(struct r600_pipe_context *rctx) tmp |= S_008C00_VS_PRIO(vs_prio); tmp |= S_008C00_GS_PRIO(gs_prio); tmp |= S_008C00_ES_PRIO(es_prio); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); /* SQ_GPR_RESOURCE_MGMT_1 */ tmp = 0; tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); /* SQ_GPR_RESOURCE_MGMT_2 */ tmp = 0; tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); tmp |= S_008C08_NUM_GS_GPRS(num_es_gprs); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); /* SQ_THREAD_RESOURCE_MGMT */ tmp = 0; @@ -2093,70 +2093,70 @@ static void r600_init_config2(struct r600_pipe_context *rctx) tmp |= S_008C0C_NUM_VS_THREADS(num_vs_threads); tmp |= S_008C0C_NUM_GS_THREADS(num_gs_threads); tmp |= S_008C0C_NUM_ES_THREADS(num_es_threads); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C0C_SQ_THREAD_RESOURCE_MGMT, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C0C_SQ_THREAD_RESOURCE_MGMT, tmp, 0xFFFFFFFF, NULL); /* SQ_STACK_RESOURCE_MGMT_1 */ tmp = 0; tmp |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); tmp |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C10_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C10_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); /* SQ_STACK_RESOURCE_MGMT_2 */ tmp = 0; tmp |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); tmp |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C14_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008C14_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009714_VC_ENHANCE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028350_SX_MISC, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009714_VC_ENHANCE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028350_SX_MISC, 0x00000000, 0xFFFFFFFF, NULL); if (family >= CHIP_RV770) { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00004000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009508_TA_CNTL_AUX, 0x07000002, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009830_DB_DEBUG, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009838_DB_WATERMARKS, 0x00420204, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286C8_SPI_THREAD_GROUPING, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL, 0x00514000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00004000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000002, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x00420204, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00514000, 0xFFFFFFFF, NULL); } else { - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009508_TA_CNTL_AUX, 0x07000003, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009830_DB_DEBUG, 0x82000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009838_DB_WATERMARKS, 0x01020204, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286C8_SPI_THREAD_GROUPING, 0x00000001, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL, 0x00004010, 0xFFFFFFFF, NULL); - } - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A14_VGT_HOS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A20_VGT_HOS_REUSE_DEPTH, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A24_VGT_GROUP_PRIM_TYPE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A28_VGT_GROUP_FIRST_DECR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A2C_VGT_GROUP_DECR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A40_VGT_GS_MODE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB0_VGT_STRMOUT_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000003, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x82000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x01020204, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000001, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00004010, 0xFFFFFFFF, NULL); + } + r600_pipe_state_add_reg(rstate, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A14_VGT_HOS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A20_VGT_HOS_REUSE_DEPTH, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A24_VGT_GROUP_PRIM_TYPE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A28_VGT_GROUP_FIRST_DECR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A2C_VGT_GROUP_DECR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A40_VGT_GS_MODE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB0_VGT_STRMOUT_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, rstate); } @@ -2236,11 +2236,11 @@ static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) } rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, 0x0, S_02880C_DUAL_EXPORT_ENABLE(1), NULL); - r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, + r600_pipe_state_add_reg(rstate, R_028D0C_DB_RENDER_CONTROL, S_028D0C_DEPTH_COPY_ENABLE(1) | S_028D0C_STENCIL_COPY_ENABLE(1) | diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index 1cc22a98fd1..3165bcd6781 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -31,12 +31,12 @@ #include "xf86drm.h" #include "r600.h" #include "evergreend.h" -#include "r600_priv.h" #include "radeon_drm.h" #include "bof.h" #include "pipe/p_compiler.h" #include "util/u_inlines.h" #include +#include "r600_priv.h" struct radeon_bo { struct pipe_reference reference; @@ -46,460 +46,454 @@ struct radeon_bo { unsigned map_count; void *data; }; -struct radeon_ws_bo { - struct pipe_reference reference; - struct pb_buffer *pb; -}; + struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); -struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset); -void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group); -void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg, unsigned opcode); -int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset); +struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); #define GROUP_FORCE_NEW_BLOCK 0 + static const struct r600_reg evergreen_config_reg_list[] = { - {0, 0, R_008958_VGT_PRIMITIVE_TYPE}, - {0, 0, R_008A14_PA_CL_ENHANCE}, - {0, 0, R_008C00_SQ_CONFIG}, - {0, 0, R_008C04_SQ_GPR_RESOURCE_MGMT_1}, - {0, 0, R_008C08_SQ_GPR_RESOURCE_MGMT_2}, - {0, 0, R_008C0C_SQ_THREAD_RESOURCE_MGMT}, - {0, 0, R_008C18_SQ_THREAD_RESOURCE_MGMT_1}, - {0, 0, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2}, - {0, 0, R_008C20_SQ_STACK_RESOURCE_MGMT_1}, - {0, 0, R_008C24_SQ_STACK_RESOURCE_MGMT_2}, - {0, 0, R_008C28_SQ_STACK_RESOURCE_MGMT_3}, - {0, 0, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ}, - {0, 0, R_009100_SPI_CONFIG_CNTL}, - {0, 0, R_00913C_SPI_CONFIG_CNTL_1}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008A14_PA_CL_ENHANCE, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C20_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C24_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C28_SQ_STACK_RESOURCE_MGMT_3, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_009100_SPI_CONFIG_CNTL, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0}, }; static const struct r600_reg evergreen_context_reg_list[] = { - {0, 0, R_028000_DB_RENDER_CONTROL}, - {0, 0, R_028004_DB_COUNT_CONTROL}, - {0, 0, R_028008_DB_DEPTH_VIEW}, - {0, 0, R_02800C_DB_RENDER_OVERRIDE}, - {0, 0, R_028010_DB_RENDER_OVERRIDE2}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028014_DB_HTILE_DATA_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {0, 0, R_028028_DB_STENCIL_CLEAR}, - {0, 0, R_02802C_DB_DEPTH_CLEAR}, - {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL}, - {0, 0, R_028034_PA_SC_SCREEN_SCISSOR_BR}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028040_DB_Z_INFO}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {0, 0, R_028044_DB_STENCIL_INFO}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028048_DB_Z_READ_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_02804C_DB_STENCIL_READ_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028050_DB_Z_WRITE_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028054_DB_STENCIL_WRITE_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {0, 0, R_028058_DB_DEPTH_SIZE}, - {0, 0, R_02805C_DB_DEPTH_SLICE}, - {0, 0, R_028140_ALU_CONST_BUFFER_SIZE_PS_0}, - {0, 0, R_028180_ALU_CONST_BUFFER_SIZE_VS_0}, - {0, 0, R_028200_PA_SC_WINDOW_OFFSET}, - {0, 0, R_028204_PA_SC_WINDOW_SCISSOR_TL}, - {0, 0, R_028208_PA_SC_WINDOW_SCISSOR_BR}, - {0, 0, R_02820C_PA_SC_CLIPRECT_RULE}, - {0, 0, R_028210_PA_SC_CLIPRECT_0_TL}, - {0, 0, R_028214_PA_SC_CLIPRECT_0_BR}, - {0, 0, R_028218_PA_SC_CLIPRECT_1_TL}, - {0, 0, R_02821C_PA_SC_CLIPRECT_1_BR}, - {0, 0, R_028220_PA_SC_CLIPRECT_2_TL}, - {0, 0, R_028224_PA_SC_CLIPRECT_2_BR}, - {0, 0, R_028228_PA_SC_CLIPRECT_3_TL}, - {0, 0, R_02822C_PA_SC_CLIPRECT_3_BR}, - {0, 0, R_028230_PA_SC_EDGERULE}, - {0, 0, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET}, - {0, 0, R_028238_CB_TARGET_MASK}, - {0, 0, R_02823C_CB_SHADER_MASK}, - {0, 0, R_028240_PA_SC_GENERIC_SCISSOR_TL}, - {0, 0, R_028244_PA_SC_GENERIC_SCISSOR_BR}, - {0, 0, R_028250_PA_SC_VPORT_SCISSOR_0_TL}, - {0, 0, R_028254_PA_SC_VPORT_SCISSOR_0_BR}, - {0, 0, R_028350_SX_MISC}, - {0, 0, R_028380_SQ_VTX_SEMANTIC_0}, - {0, 0, R_028384_SQ_VTX_SEMANTIC_1}, - {0, 0, R_028388_SQ_VTX_SEMANTIC_2}, - {0, 0, R_02838C_SQ_VTX_SEMANTIC_3}, - {0, 0, R_028390_SQ_VTX_SEMANTIC_4}, - {0, 0, R_028394_SQ_VTX_SEMANTIC_5}, - {0, 0, R_028398_SQ_VTX_SEMANTIC_6}, - {0, 0, R_02839C_SQ_VTX_SEMANTIC_7}, - {0, 0, R_0283A0_SQ_VTX_SEMANTIC_8}, - {0, 0, R_0283A4_SQ_VTX_SEMANTIC_9}, - {0, 0, R_0283A8_SQ_VTX_SEMANTIC_10}, - {0, 0, R_0283AC_SQ_VTX_SEMANTIC_11}, - {0, 0, R_0283B0_SQ_VTX_SEMANTIC_12}, - {0, 0, R_0283B4_SQ_VTX_SEMANTIC_13}, - {0, 0, R_0283B8_SQ_VTX_SEMANTIC_14}, - {0, 0, R_0283BC_SQ_VTX_SEMANTIC_15}, - {0, 0, R_0283C0_SQ_VTX_SEMANTIC_16}, - {0, 0, R_0283C4_SQ_VTX_SEMANTIC_17}, - {0, 0, R_0283C8_SQ_VTX_SEMANTIC_18}, - {0, 0, R_0283CC_SQ_VTX_SEMANTIC_19}, - {0, 0, R_0283D0_SQ_VTX_SEMANTIC_20}, - {0, 0, R_0283D4_SQ_VTX_SEMANTIC_21}, - {0, 0, R_0283D8_SQ_VTX_SEMANTIC_22}, - {0, 0, R_0283DC_SQ_VTX_SEMANTIC_23}, - {0, 0, R_0283E0_SQ_VTX_SEMANTIC_24}, - {0, 0, R_0283E4_SQ_VTX_SEMANTIC_25}, - {0, 0, R_0283E8_SQ_VTX_SEMANTIC_26}, - {0, 0, R_0283EC_SQ_VTX_SEMANTIC_27}, - {0, 0, R_0283F0_SQ_VTX_SEMANTIC_28}, - {0, 0, R_0283F4_SQ_VTX_SEMANTIC_29}, - {0, 0, R_0283F8_SQ_VTX_SEMANTIC_30}, - {0, 0, R_0283FC_SQ_VTX_SEMANTIC_31}, - {0, 0, R_0282D0_PA_SC_VPORT_ZMIN_0}, - {0, 0, R_0282D4_PA_SC_VPORT_ZMAX_0}, - {0, 0, R_028400_VGT_MAX_VTX_INDX}, - {0, 0, R_028404_VGT_MIN_VTX_INDX}, - {0, 0, R_028408_VGT_INDX_OFFSET}, - {0, 0, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX}, - {0, 0, R_028410_SX_ALPHA_TEST_CONTROL}, - {0, 0, R_028414_CB_BLEND_RED}, - {0, 0, R_028418_CB_BLEND_GREEN}, - {0, 0, R_02841C_CB_BLEND_BLUE}, - {0, 0, R_028420_CB_BLEND_ALPHA}, - {0, 0, R_028430_DB_STENCILREFMASK}, - {0, 0, R_028434_DB_STENCILREFMASK_BF}, - {0, 0, R_028438_SX_ALPHA_REF}, - {0, 0, R_02843C_PA_CL_VPORT_XSCALE_0}, - {0, 0, R_028440_PA_CL_VPORT_XOFFSET_0}, - {0, 0, R_028444_PA_CL_VPORT_YSCALE_0}, - {0, 0, R_028448_PA_CL_VPORT_YOFFSET_0}, - {0, 0, R_02844C_PA_CL_VPORT_ZSCALE_0}, - {0, 0, R_028450_PA_CL_VPORT_ZOFFSET_0}, - {0, 0, R_0285BC_PA_CL_UCP0_X}, - {0, 0, R_0285C0_PA_CL_UCP0_Y}, - {0, 0, R_0285C4_PA_CL_UCP0_Z}, - {0, 0, R_0285C8_PA_CL_UCP0_W}, - {0, 0, R_0285CC_PA_CL_UCP1_X}, - {0, 0, R_0285D0_PA_CL_UCP1_Y}, - {0, 0, R_0285D4_PA_CL_UCP1_Z}, - {0, 0, R_0285D8_PA_CL_UCP1_W}, - {0, 0, R_0285DC_PA_CL_UCP2_X}, - {0, 0, R_0285E0_PA_CL_UCP2_Y}, - {0, 0, R_0285E4_PA_CL_UCP2_Z}, - {0, 0, R_0285E8_PA_CL_UCP2_W}, - {0, 0, R_0285EC_PA_CL_UCP3_X}, - {0, 0, R_0285F0_PA_CL_UCP3_Y}, - {0, 0, R_0285F4_PA_CL_UCP3_Z}, - {0, 0, R_0285F8_PA_CL_UCP3_W}, - {0, 0, R_0285FC_PA_CL_UCP4_X}, - {0, 0, R_028600_PA_CL_UCP4_Y}, - {0, 0, R_028604_PA_CL_UCP4_Z}, - {0, 0, R_028608_PA_CL_UCP4_W}, - {0, 0, R_02860C_PA_CL_UCP5_X}, - {0, 0, R_028610_PA_CL_UCP5_Y}, - {0, 0, R_028614_PA_CL_UCP5_Z}, - {0, 0, R_028618_PA_CL_UCP5_W}, - {0, 0, R_02861C_SPI_VS_OUT_ID_0}, - {0, 0, R_028620_SPI_VS_OUT_ID_1}, - {0, 0, R_028624_SPI_VS_OUT_ID_2}, - {0, 0, R_028628_SPI_VS_OUT_ID_3}, - {0, 0, R_02862C_SPI_VS_OUT_ID_4}, - {0, 0, R_028630_SPI_VS_OUT_ID_5}, - {0, 0, R_028634_SPI_VS_OUT_ID_6}, - {0, 0, R_028638_SPI_VS_OUT_ID_7}, - {0, 0, R_02863C_SPI_VS_OUT_ID_8}, - {0, 0, R_028640_SPI_VS_OUT_ID_9}, - {0, 0, R_028644_SPI_PS_INPUT_CNTL_0}, - {0, 0, R_028648_SPI_PS_INPUT_CNTL_1}, - {0, 0, R_02864C_SPI_PS_INPUT_CNTL_2}, - {0, 0, R_028650_SPI_PS_INPUT_CNTL_3}, - {0, 0, R_028654_SPI_PS_INPUT_CNTL_4}, - {0, 0, R_028658_SPI_PS_INPUT_CNTL_5}, - {0, 0, R_02865C_SPI_PS_INPUT_CNTL_6}, - {0, 0, R_028660_SPI_PS_INPUT_CNTL_7}, - {0, 0, R_028664_SPI_PS_INPUT_CNTL_8}, - {0, 0, R_028668_SPI_PS_INPUT_CNTL_9}, - {0, 0, R_02866C_SPI_PS_INPUT_CNTL_10}, - {0, 0, R_028670_SPI_PS_INPUT_CNTL_11}, - {0, 0, R_028674_SPI_PS_INPUT_CNTL_12}, - {0, 0, R_028678_SPI_PS_INPUT_CNTL_13}, - {0, 0, R_02867C_SPI_PS_INPUT_CNTL_14}, - {0, 0, R_028680_SPI_PS_INPUT_CNTL_15}, - {0, 0, R_028684_SPI_PS_INPUT_CNTL_16}, - {0, 0, R_028688_SPI_PS_INPUT_CNTL_17}, - {0, 0, R_02868C_SPI_PS_INPUT_CNTL_18}, - {0, 0, R_028690_SPI_PS_INPUT_CNTL_19}, - {0, 0, R_028694_SPI_PS_INPUT_CNTL_20}, - {0, 0, R_028698_SPI_PS_INPUT_CNTL_21}, - {0, 0, R_02869C_SPI_PS_INPUT_CNTL_22}, - {0, 0, R_0286A0_SPI_PS_INPUT_CNTL_23}, - {0, 0, R_0286A4_SPI_PS_INPUT_CNTL_24}, - {0, 0, R_0286A8_SPI_PS_INPUT_CNTL_25}, - {0, 0, R_0286AC_SPI_PS_INPUT_CNTL_26}, - {0, 0, R_0286B0_SPI_PS_INPUT_CNTL_27}, - {0, 0, R_0286B4_SPI_PS_INPUT_CNTL_28}, - {0, 0, R_0286B8_SPI_PS_INPUT_CNTL_29}, - {0, 0, R_0286BC_SPI_PS_INPUT_CNTL_30}, - {0, 0, R_0286C0_SPI_PS_INPUT_CNTL_31}, - {0, 0, R_0286C4_SPI_VS_OUT_CONFIG}, - {0, 0, R_0286C8_SPI_THREAD_GROUPING}, - {0, 0, R_0286CC_SPI_PS_IN_CONTROL_0}, - {0, 0, R_0286D0_SPI_PS_IN_CONTROL_1}, - {0, 0, R_0286D4_SPI_INTERP_CONTROL_0}, - {0, 0, R_0286D8_SPI_INPUT_Z}, - {0, 0, R_0286DC_SPI_FOG_CNTL}, - {0, 0, R_0286E0_SPI_BARYC_CNTL}, - {0, 0, R_0286E4_SPI_PS_IN_CONTROL_2}, - {0, 0, R_0286E8_SPI_COMPUTE_INPUT_CNTL}, - {0, 0, R_028780_CB_BLEND0_CONTROL}, - {0, 0, R_028784_CB_BLEND1_CONTROL}, - {0, 0, R_028788_CB_BLEND2_CONTROL}, - {0, 0, R_02878C_CB_BLEND3_CONTROL}, - {0, 0, R_028790_CB_BLEND4_CONTROL}, - {0, 0, R_028794_CB_BLEND5_CONTROL}, - {0, 0, R_028798_CB_BLEND6_CONTROL}, - {0, 0, R_02879C_CB_BLEND7_CONTROL}, - {0, 0, R_028800_DB_DEPTH_CONTROL}, - {0, 0, R_02880C_DB_SHADER_CONTROL}, - {0, 0, R_028808_CB_COLOR_CONTROL}, - {0, 0, R_028810_PA_CL_CLIP_CNTL}, - {0, 0, R_028814_PA_SU_SC_MODE_CNTL}, - {0, 0, R_028818_PA_CL_VTE_CNTL}, - {0, 0, R_02881C_PA_CL_VS_OUT_CNTL}, - {0, 0, R_028820_PA_CL_NANINF_CNTL}, - {0, 0, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1}, - {1, S_0085F0_SH_ACTION_ENA(1), R_028840_SQ_PGM_START_PS}, - {0, 0, R_028844_SQ_PGM_RESOURCES_PS}, - {0, 0, R_028848_SQ_PGM_RESOURCES_2_PS}, - {0, 0, R_02884C_SQ_PGM_EXPORTS_PS}, - {1, S_0085F0_SH_ACTION_ENA(1), R_02885C_SQ_PGM_START_VS}, - {0, 0, R_028860_SQ_PGM_RESOURCES_VS}, - {0, 0, R_028864_SQ_PGM_RESOURCES_2_VS}, - {1, S_0085F0_SH_ACTION_ENA(1), R_0288A4_SQ_PGM_START_FS}, - {0, 0, R_0288A8_SQ_PGM_RESOURCES_FS}, - {0, 0, R_0288EC_SQ_LDS_ALLOC_PS}, - {0, 0, R_028900_SQ_ESGS_RING_ITEMSIZE}, - {0, 0, R_028904_SQ_GSVS_RING_ITEMSIZE}, - {0, 0, R_028908_SQ_ESTMP_RING_ITEMSIZE}, - {0, 0, R_02890C_SQ_GSTMP_RING_ITEMSIZE}, - {0, 0, R_028910_SQ_VSTMP_RING_ITEMSIZE}, - {0, 0, R_028914_SQ_PSTMP_RING_ITEMSIZE}, - {0, 0, R_02891C_SQ_GS_VERT_ITEMSIZE}, - {0, 0, R_028920_SQ_GS_VERT_ITEMSIZE_1}, - {0, 0, R_028924_SQ_GS_VERT_ITEMSIZE_2}, - {0, 0, R_028928_SQ_GS_VERT_ITEMSIZE_3}, - {1, 0, R_028940_ALU_CONST_CACHE_PS_0}, - {1, 0, R_028980_ALU_CONST_CACHE_VS_0}, - {0, 0, R_028A00_PA_SU_POINT_SIZE}, - {0, 0, R_028A04_PA_SU_POINT_MINMAX}, - {0, 0, R_028A08_PA_SU_LINE_CNTL}, - {0, 0, R_028A10_VGT_OUTPUT_PATH_CNTL}, - {0, 0, R_028A14_VGT_HOS_CNTL}, - {0, 0, R_028A18_VGT_HOS_MAX_TESS_LEVEL}, - {0, 0, R_028A1C_VGT_HOS_MIN_TESS_LEVEL}, - {0, 0, R_028A20_VGT_HOS_REUSE_DEPTH}, - {0, 0, R_028A24_VGT_GROUP_PRIM_TYPE}, - {0, 0, R_028A28_VGT_GROUP_FIRST_DECR}, - {0, 0, R_028A2C_VGT_GROUP_DECR}, - {0, 0, R_028A30_VGT_GROUP_VECT_0_CNTL}, - {0, 0, R_028A34_VGT_GROUP_VECT_1_CNTL}, - {0, 0, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL}, - {0, 0, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL}, - {0, 0, R_028A40_VGT_GS_MODE}, - {0, 0, R_028A48_PA_SC_MODE_CNTL_0}, - {0, 0, R_028A4C_PA_SC_MODE_CNTL_1}, - {0, 0, R_028AB4_VGT_REUSE_OFF}, - {0, 0, R_028AB8_VGT_VTX_CNT_EN}, - {0, 0, R_028ABC_DB_HTILE_SURFACE}, - {0, 0, R_028AC0_DB_SRESULTS_COMPARE_STATE0}, - {0, 0, R_028AC4_DB_SRESULTS_COMPARE_STATE1}, - {0, 0, R_028AC8_DB_PRELOAD_CONTROL}, - {0, 0, R_028B54_VGT_SHADER_STAGES_EN}, - {0, 0, R_028B70_DB_ALPHA_TO_MASK}, - {0, 0, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL}, - {0, 0, R_028B7C_PA_SU_POLY_OFFSET_CLAMP}, - {0, 0, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE}, - {0, 0, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET}, - {0, 0, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE}, - {0, 0, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET}, - {0, 0, R_028B94_VGT_STRMOUT_CONFIG}, - {0, 0, R_028B98_VGT_STRMOUT_BUFFER_CONFIG}, - {0, 0, R_028C00_PA_SC_LINE_CNTL}, - {0, 0, R_028C04_PA_SC_AA_CONFIG}, - {0, 0, R_028C08_PA_SU_VTX_CNTL}, - {0, 0, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ}, - {0, 0, R_028C10_PA_CL_GB_VERT_DISC_ADJ}, - {0, 0, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ}, - {0, 0, R_028C18_PA_CL_GB_HORZ_DISC_ADJ}, - {0, 0, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX}, - {0, 0, R_028C3C_PA_SC_AA_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028C60_CB_COLOR0_BASE}, - {0, 0, R_028C64_CB_COLOR0_PITCH}, - {0, 0, R_028C68_CB_COLOR0_SLICE}, - {0, 0, R_028C6C_CB_COLOR0_VIEW}, - {1, 0, R_028C70_CB_COLOR0_INFO}, - {0, 0, R_028C74_CB_COLOR0_ATTRIB}, - {0, 0, R_028C78_CB_COLOR0_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028C9C_CB_COLOR1_BASE}, - {0, 0, R_028CA0_CB_COLOR1_PITCH}, - {0, 0, R_028CA4_CB_COLOR1_SLICE}, - {0, 0, R_028CA8_CB_COLOR1_VIEW}, - {1, 0, R_028CAC_CB_COLOR1_INFO}, - {0, 0, R_028CB0_CB_COLOR1_ATTRIB}, - {0, 0, R_028CB8_CB_COLOR1_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028CD8_CB_COLOR2_BASE}, - {0, 0, R_028CDC_CB_COLOR2_PITCH}, - {0, 0, R_028CE0_CB_COLOR2_SLICE}, - {0, 0, R_028CE4_CB_COLOR2_VIEW}, - {1, 0, R_028CE8_CB_COLOR2_INFO}, - {0, 0, R_028CEC_CB_COLOR2_ATTRIB}, - {0, 0, R_028CF0_CB_COLOR2_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028D14_CB_COLOR3_BASE}, - {0, 0, R_028D18_CB_COLOR3_PITCH}, - {0, 0, R_028D1C_CB_COLOR3_SLICE}, - {0, 0, R_028D20_CB_COLOR3_VIEW}, - {1, 0, R_028D24_CB_COLOR3_INFO}, - {0, 0, R_028D28_CB_COLOR3_ATTRIB}, - {0, 0, R_028D2C_CB_COLOR3_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028D50_CB_COLOR4_BASE}, - {0, 0, R_028D54_CB_COLOR4_PITCH}, - {0, 0, R_028D58_CB_COLOR4_SLICE}, - {0, 0, R_028D5C_CB_COLOR4_VIEW}, - {1, 0, R_028D60_CB_COLOR4_INFO}, - {0, 0, R_028D64_CB_COLOR4_ATTRIB}, - {0, 0, R_028D68_CB_COLOR4_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028D8C_CB_COLOR5_BASE}, - {0, 0, R_028D90_CB_COLOR5_PITCH}, - {0, 0, R_028D94_CB_COLOR5_SLICE}, - {0, 0, R_028D98_CB_COLOR5_VIEW}, - {1, 0, R_028D9C_CB_COLOR5_INFO}, - {0, 0, R_028DA0_CB_COLOR5_ATTRIB}, - {0, 0, R_028DA4_CB_COLOR5_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028DC8_CB_COLOR6_BASE}, - {0, 0, R_028DCC_CB_COLOR6_PITCH}, - {0, 0, R_028DD0_CB_COLOR6_SLICE}, - {0, 0, R_028DD4_CB_COLOR6_VIEW}, - {1, 0, R_028DD8_CB_COLOR6_INFO}, - {0, 0, R_028DDC_CB_COLOR6_ATTRIB}, - {0, 0, R_028DE0_CB_COLOR6_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028E04_CB_COLOR7_BASE}, - {0, 0, R_028E08_CB_COLOR7_PITCH}, - {0, 0, R_028E0C_CB_COLOR7_SLICE}, - {0, 0, R_028E10_CB_COLOR7_VIEW}, - {1, 0, R_028E14_CB_COLOR7_INFO}, - {0, 0, R_028E18_CB_COLOR7_ATTRIB}, - {0, 0, R_028E1C_CB_COLOR7_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028E40_CB_COLOR8_BASE}, - {0, 0, R_028E44_CB_COLOR8_PITCH}, - {0, 0, R_028E48_CB_COLOR8_SLICE}, - {0, 0, R_028E4C_CB_COLOR8_VIEW}, - {1, 0, R_028E50_CB_COLOR8_INFO}, - {0, 0, R_028E54_CB_COLOR8_ATTRIB}, - {0, 0, R_028E58_CB_COLOR8_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028E5C_CB_COLOR9_BASE}, - {0, 0, R_028E60_CB_COLOR9_PITCH}, - {0, 0, R_028E64_CB_COLOR9_SLICE}, - {0, 0, R_028E68_CB_COLOR9_VIEW}, - {1, 0, R_028E6C_CB_COLOR9_INFO}, - {0, 0, R_028E70_CB_COLOR9_ATTRIB}, - {0, 0, R_028E74_CB_COLOR9_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028E78_CB_COLOR10_BASE}, - {0, 0, R_028E7C_CB_COLOR10_PITCH}, - {0, 0, R_028E80_CB_COLOR10_SLICE}, - {0, 0, R_028E84_CB_COLOR10_VIEW}, - {1, 0, R_028E88_CB_COLOR10_INFO}, - {0, 0, R_028E8C_CB_COLOR10_ATTRIB}, - {0, 0, R_028E90_CB_COLOR10_DIM}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028E94_CB_COLOR11_BASE}, - {0, 0, R_028E98_CB_COLOR11_PITCH}, - {0, 0, R_028E9C_CB_COLOR11_SLICE}, - {0, 0, R_028EA0_CB_COLOR11_VIEW}, - {1, 0, R_028EA4_CB_COLOR11_INFO}, - {0, 0, R_028EA8_CB_COLOR11_ATTRIB}, - {0, 0, R_028EAC_CB_COLOR11_DIM}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028008_DB_DEPTH_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02800C_DB_RENDER_OVERRIDE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028010_DB_RENDER_OVERRIDE2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028014_DB_HTILE_DATA_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028040_DB_Z_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028044_DB_STENCIL_INFO, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028048_DB_Z_READ_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02804C_DB_STENCIL_READ_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028050_DB_Z_WRITE_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028054_DB_STENCIL_WRITE_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028058_DB_DEPTH_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02805C_DB_DEPTH_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285BC_PA_CL_UCP0_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C0_PA_CL_UCP0_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C4_PA_CL_UCP0_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C8_PA_CL_UCP0_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285CC_PA_CL_UCP1_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D0_PA_CL_UCP1_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D4_PA_CL_UCP1_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D8_PA_CL_UCP1_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285DC_PA_CL_UCP2_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E0_PA_CL_UCP2_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E4_PA_CL_UCP2_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E8_PA_CL_UCP2_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285EC_PA_CL_UCP3_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F0_PA_CL_UCP3_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F4_PA_CL_UCP3_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F8_PA_CL_UCP3_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285FC_PA_CL_UCP4_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028600_PA_CL_UCP4_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028604_PA_CL_UCP4_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028608_PA_CL_UCP4_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02860C_PA_CL_UCP5_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028610_PA_CL_UCP5_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028614_PA_CL_UCP5_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028618_PA_CL_UCP5_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02863C_SPI_VS_OUT_ID_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028640_SPI_VS_OUT_ID_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E0_SPI_BARYC_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E4_SPI_PS_IN_CONTROL_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E8_SPI_COMPUTE_INPUT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028844_SQ_PGM_RESOURCES_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028848_SQ_PGM_RESOURCES_2_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02884C_SQ_PGM_EXPORTS_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02885C_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028860_SQ_PGM_RESOURCES_VS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028864_SQ_PGM_RESOURCES_2_VS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A8_SQ_PGM_RESOURCES_FS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288EC_SQ_LDS_ALLOC_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028900_SQ_ESGS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028904_SQ_GSVS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02891C_SQ_GS_VERT_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MODE_CNTL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028ABC_DB_HTILE_SURFACE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC8_DB_PRELOAD_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B54_VGT_SHADER_STAGES_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B70_DB_ALPHA_TO_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B94_VGT_STRMOUT_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C08_PA_SU_VTX_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C3C_PA_SC_AA_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C60_CB_COLOR0_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C64_CB_COLOR0_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA0_CB_COLOR1_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB8_CB_COLOR1_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D18_CB_COLOR3_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D54_CB_COLOR4_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D90_CB_COLOR5_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DCC_CB_COLOR6_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E08_CB_COLOR7_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E44_CB_COLOR8_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E60_CB_COLOR9_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E7C_CB_COLOR10_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E98_CB_COLOR11_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0}, }; /* SHADER RESOURCE R600/R700 */ static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_resource[] = { - {0, 0, R_030000_RESOURCE0_WORD0}, - {0, 0, R_030004_RESOURCE0_WORD1}, - {1, 0, R_030008_RESOURCE0_WORD2}, - {1, 0, R_03000C_RESOURCE0_WORD3}, - {0, 0, R_030010_RESOURCE0_WORD4}, - {0, 0, R_030014_RESOURCE0_WORD5}, - {0, 0, R_030018_RESOURCE0_WORD6}, - {0, 0, R_03001C_RESOURCE0_WORD7}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0}, }; unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); for (int i = 0; i < nreg; i++) { r600_shader_resource[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_resource, nreg, PKT3_SET_RESOURCE); + return r600_context_add_block(ctx, r600_shader_resource, nreg); } /* SHADER SAMPLER R600/R700 */ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_sampler[] = { - {0, 0, R_03C000_SQ_TEX_SAMPLER_WORD0_0}, - {0, 0, R_03C004_SQ_TEX_SAMPLER_WORD1_0}, - {0, 0, R_03C008_SQ_TEX_SAMPLER_WORD2_0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, }; unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); for (int i = 0; i < nreg; i++) { r600_shader_sampler[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_sampler, nreg, PKT3_SET_SAMPLER); + return r600_context_add_block(ctx, r600_shader_sampler, nreg); } /* SHADER SAMPLER BORDER R600/R700 */ static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id) { struct r600_reg r600_shader_sampler_border[] = { - {0, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX}, - {0, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED}, - {0, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN}, - {0, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE}, - {0, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA}, + {PKT3_SET_CONFIG_REG, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, }; unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; - struct r600_group_block *block; - struct r600_group *group; + struct r600_range *range; + struct r600_block *block; int r; for (int i = 0; i < nreg; i++) { r600_shader_sampler_border[i].offset -= R_00A400_TD_PS_SAMPLER0_BORDER_INDEX; r600_shader_sampler_border[i].offset += fake_offset; } - r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg, PKT3_SET_CONFIG_REG); + r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg); if (r) { return r; } /* set proper offset */ - group = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER]; - id = group->offset_block_id[((fake_offset - group->start_offset) >> 2)]; - block = &group->blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, r600_shader_sampler_border[0].offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, r600_shader_sampler_border[0].offset)]; block->pm4[1] = (offset - EVERGREEN_CONFIG_REG_OFFSET) >> 2; return 0; } @@ -512,47 +506,26 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) radeon->use_mem_constant = TRUE; ctx->radeon = radeon; LIST_INITHEAD(&ctx->query_list); - /* initialize groups */ - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_CONFIG], EVERGREEN_CONFIG_REG_OFFSET, EVERGREEN_CONFIG_REG_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_LOOP_CONST], EVERGREEN_LOOP_CONST_OFFSET, EVERGREEN_LOOP_CONST_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_BOOL_CONST], EVERGREEN_BOOL_CONST_OFFSET, EVERGREEN_BOOL_CONST_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_SAMPLER], EVERGREEN_SAMPLER_OFFSET, EVERGREEN_SAMPLER_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_RESOURCE], EVERGREEN_RESOURCE_OFFSET, EVERGREEN_RESOURCE_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_CONTEXT], EVERGREEN_CONTEXT_REG_OFFSET, EVERGREEN_CONTEXT_REG_END); - if (r) { - goto out_err; - } - /* we use unassigned range of GPU reg to fake border color register */ - r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER], 0x40000, 0x41000); - if (r) { - goto out_err; + + /* initialize hash */ + ctx->hash_size = 19; + ctx->hash_shift = 11; + for (int i = 0; i < 256; i++) { + ctx->range[i].start_offset = i << ctx->hash_shift; + ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1; + ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*)); + if (ctx->range[i].blocks == NULL) { + return -ENOMEM; + } } - ctx->ngroups = EVERGREEN_NGROUPS; /* add blocks */ r = r600_context_add_block(ctx, evergreen_config_reg_list, - sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg), - PKT3_SET_CONFIG_REG); + sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg)); if (r) goto out_err; r = r600_context_add_block(ctx, evergreen_context_reg_list, - sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg), - PKT3_SET_CONTEXT_REG); + sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg)); if (r) goto out_err; @@ -593,6 +566,18 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } + /* setup block table */ + ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); + for (int i = 0, c = 0; i < 256; i++) { + for (int j = 0; j < (1 << ctx->hash_shift); j++) { + if (ctx->range[i].blocks[j]) { + assert(c < ctx->nblocks); + ctx->blocks[c++] = ctx->range[i].blocks[j]; + j += (ctx->range[i].blocks[j]->nreg << 2) - 1; + } + } + } + /* allocate cs variables */ ctx->nreloc = RADEON_CTX_MAX_PM4; ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); @@ -619,12 +604,11 @@ out_err: static inline void evergreen_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { - struct r600_group_block *block; - unsigned id; + struct r600_range *range; + struct r600_block *block; - offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; - id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; - block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); @@ -673,12 +657,11 @@ void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, stru static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { - struct r600_group_block *block; - unsigned id; + struct r600_range *range; + struct r600_block *block; - offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER].start_offset; - id = ctx->groups[EVERGREEN_GROUP_SAMPLER].offset_block_id[offset >> 2]; - block = &ctx->groups[EVERGREEN_GROUP_SAMPLER].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); return; @@ -693,12 +676,12 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) { - struct r600_group_block *block; unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + struct r600_range *range; + struct r600_block *block; - fake_offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].start_offset; - id = ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].offset_block_id[fake_offset >> 2]; - block = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, fake_offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); return; @@ -710,6 +693,7 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c block->reg[1] = state->regs[3].value; block->reg[2] = state->regs[4].value; block->reg[3] = state->regs[5].value; + block->reg[4] = state->regs[6].value; block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords; @@ -748,18 +732,18 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } /* find number of color buffer */ - cb[0] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028C60_CB_COLOR0_BASE); - cb[1] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028C9C_CB_COLOR1_BASE); - cb[2] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028CD8_CB_COLOR2_BASE); - cb[3] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D14_CB_COLOR3_BASE); - cb[4] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D50_CB_COLOR4_BASE); - cb[5] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D8C_CB_COLOR5_BASE); - cb[6] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028DC8_CB_COLOR6_BASE); - cb[7] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E04_CB_COLOR7_BASE); - cb[8] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E40_CB_COLOR8_BASE); - cb[9] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E5C_CB_COLOR9_BASE); - cb[10] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E78_CB_COLOR10_BASE); - cb[11] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E94_CB_COLOR11_BASE); + cb[0] = r600_context_reg_bo(ctx, R_028C60_CB_COLOR0_BASE); + cb[1] = r600_context_reg_bo(ctx, R_028C9C_CB_COLOR1_BASE); + cb[2] = r600_context_reg_bo(ctx, R_028CD8_CB_COLOR2_BASE); + cb[3] = r600_context_reg_bo(ctx, R_028D14_CB_COLOR3_BASE); + cb[4] = r600_context_reg_bo(ctx, R_028D50_CB_COLOR4_BASE); + cb[5] = r600_context_reg_bo(ctx, R_028D8C_CB_COLOR5_BASE); + cb[6] = r600_context_reg_bo(ctx, R_028DC8_CB_COLOR6_BASE); + cb[7] = r600_context_reg_bo(ctx, R_028E04_CB_COLOR7_BASE); + cb[8] = r600_context_reg_bo(ctx, R_028E40_CB_COLOR8_BASE); + cb[9] = r600_context_reg_bo(ctx, R_028E5C_CB_COLOR9_BASE); + cb[10] = r600_context_reg_bo(ctx, R_028E78_CB_COLOR10_BASE); + cb[11] = r600_context_reg_bo(ctx, R_028E94_CB_COLOR11_BASE); for (int i = 0; i < 12; i++) { if (cb[i]) { ndwords += 7; @@ -768,11 +752,11 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr /* queries need some special values */ if (ctx->num_query_running) { - r600_context_reg(ctx, EVERGREEN_GROUP_CONTEXT, + r600_context_reg(ctx, R_028004_DB_COUNT_CONTROL, S_028004_PERFECT_ZPASS_COUNTS(1), S_028004_PERFECT_ZPASS_COUNTS(1)); - r600_context_reg(ctx, EVERGREEN_GROUP_CONTEXT, + r600_context_reg(ctx, R_02800C_DB_RENDER_OVERRIDE, S_02800C_NOOP_CULL_DISABLE(1), S_02800C_NOOP_CULL_DISABLE(1)); @@ -789,11 +773,11 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } /* enough room to copy packet */ - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONFIG]); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONTEXT]); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_RESOURCE]); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER]); - r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER]); + for (int i = 0; i < ctx->nblocks; i++) { + if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { + r600_context_block_emit_dirty(ctx, ctx->blocks[i]); + } + } /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -838,12 +822,11 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { - struct r600_group_block *block; - unsigned id; + struct r600_range *range; + struct r600_block *block; - offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset; - id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2]; - block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c index fdcadffc532..496547ca994 100644 --- a/src/gallium/winsys/r600/drm/r600.c +++ b/src/gallium/winsys/r600/drm/r600.c @@ -25,6 +25,9 @@ */ #include "xf86drm.h" #include "radeon_drm.h" +#include "pipe/p_compiler.h" +#include "util/u_inlines.h" +#include #include "r600_priv.h" enum radeon_family r600_get_family(struct radeon *r600) diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 710c66bcfd8..92dadf8d1c6 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -49,25 +49,30 @@ struct radeon *r600_new(int fd, unsigned device); void r600_delete(struct radeon *r600); struct r600_reg { + unsigned opcode; + unsigned offset_base; + unsigned offset; unsigned need_bo; unsigned flush_flags; - unsigned offset; }; /* radeon_pciid.c */ unsigned radeon_family_from_device(unsigned device); +#define CTX_RANGE_ID(ctx, offset) (((offset) >> (ctx)->hash_shift) & 255) +#define CTX_BLOCK_ID(ctx, offset) ((offset) & ((1 << (ctx)->hash_shift) - 1)) + -static void inline r600_context_reg(struct r600_context *ctx, unsigned group_id, +static void inline r600_context_reg(struct r600_context *ctx, unsigned offset, unsigned value, unsigned mask) { - struct r600_group *group = &ctx->groups[group_id]; - struct r600_group_block *block; + struct r600_range *range; + struct r600_block *block; unsigned id; - id = group->offset_block_id[(offset - group->start_offset) >> 2]; - block = &group->blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; id = (offset - block->start_offset) >> 2; block->reg[id] &= ~mask; block->reg[id] |= value; @@ -78,4 +83,34 @@ static void inline r600_context_reg(struct r600_context *ctx, unsigned group_id, block->status |= R600_BLOCK_STATUS_DIRTY; } +struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); + +struct radeon_ws_bo { + struct pipe_reference reference; + struct pb_buffer *pb; +}; + +static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block) +{ + struct radeon_bo *bo; + int id; + + for (int j = 0; j < block->nreg; j++) { + if (block->pm4_bo_index[j]) { + /* find relocation */ + id = block->pm4_bo_index[j]; + bo = radeon_bo_pb_get_bo(block->reloc[id].bo->pb); + for (int k = 0; k < block->reloc[id].nreloc; k++) { + r600_context_bo_reloc(ctx, + &block->pm4[block->reloc[id].bo_pm4_index[k]], + bo); + } + } + } + memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); + ctx->pm4_cdwords += block->pm4_ndwords; + block->status ^= R600_BLOCK_STATUS_DIRTY; +} + #endif diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 1241bca244f..87f33e05264 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -31,18 +31,14 @@ #include "xf86drm.h" #include "r600.h" #include "r600d.h" -#include "r600_priv.h" #include "radeon_drm.h" #include "bof.h" #include "pipe/p_compiler.h" #include "util/u_inlines.h" #include +#include "r600_priv.h" #define GROUP_FORCE_NEW_BLOCK 0 -struct radeon_ws_bo { - struct pipe_reference reference; - struct pb_buffer *pb; -}; struct radeon_bo { struct pipe_reference reference; @@ -52,7 +48,6 @@ struct radeon_bo { unsigned map_count; void *data; }; -struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); void radeon_bo_reference(struct radeon *radeon, @@ -62,67 +57,49 @@ void radeon_bo_reference(struct radeon *radeon, unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); -static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offset) -{ - for (int i = 0; i < ctx->ngroups; i++) { - if (offset >= ctx->groups[i].start_offset && offset < ctx->groups[i].end_offset) { - return i; - } - } - return -1; -} - -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg, unsigned opcode) +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) { - struct r600_group_block *block, *tmp; - struct r600_group *group; - int group_id, id; + struct r600_block *block; + struct r600_range *range; + int offset; for (unsigned i = 0, n = 0; i < nreg; i += n) { - u32 j, r; - - /* register that need relocation are in their own group */ - n = 1; - if (!reg[i].need_bo) { - /* find number of consecutive registers */ - for (j = i + 1, r = reg[i].offset + 4, n = 1; j < (nreg - i); j++, n++, r+=4) { - if (reg[i].need_bo || r != reg[j].offset) { - break; - } - } - } + u32 j; /* ignore new block balise */ - if (reg[i].offset == GROUP_FORCE_NEW_BLOCK) + if (reg[i].offset == GROUP_FORCE_NEW_BLOCK) { + n = 1; continue; + } - /* find into which group this block is */ - group_id = r600_group_id_register_offset(ctx, reg[i].offset); - assert(group_id >= 0); - group = &ctx->groups[group_id]; + /* register that need relocation are in their own group */ + /* find number of consecutive registers */ + n = 0; + offset = reg[i].offset; + while (reg[i + n].offset == offset) { + n++; + offset += 4; + if ((n + i) >= nreg) + break; + if (n >= (R600_BLOCK_MAX_REG - 2)) + break; + } /* allocate new block */ - tmp = realloc(group->blocks, (group->nblocks + 1) * sizeof(struct r600_group_block)); - if (tmp == NULL) { + block = calloc(1, sizeof(struct r600_block)); + if (block == NULL) { return -ENOMEM; } - /* update reg pointer */ - if (tmp != group->blocks) { - for (int j = 0; j < group->nblocks; j++) { - tmp[j].reg = &tmp[j].pm4[2]; - } - } - group->blocks = tmp; - block = &group->blocks[group->nblocks++]; + ctx->nblocks++; for (int j = 0; j < n; j++) { - group->offset_block_id[((reg[i].offset - group->start_offset) >> 2) + j] = group->nblocks - 1; + range = &ctx->range[CTX_RANGE_ID(ctx, reg[i + j].offset)]; + range->blocks[CTX_BLOCK_ID(ctx, reg[i + j].offset)] = block; } /* initialize block */ - memset(block, 0, sizeof(struct r600_group_block)); block->start_offset = reg[i].offset; - block->pm4[block->pm4_ndwords++] = PKT3(opcode, n); - block->pm4[block->pm4_ndwords++] = (block->start_offset - group->start_offset) >> 2; + block->pm4[block->pm4_ndwords++] = PKT3(reg[i].opcode, n); + block->pm4[block->pm4_ndwords++] = (block->start_offset - reg[i].offset_base) >> 2; block->reg = &block->pm4[block->pm4_ndwords]; block->pm4_ndwords += n; block->nreg = n; @@ -138,6 +115,8 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, } for (j = 0; j < n; j++) { if (reg[i+j].flush_flags) { + unsigned id; + block->pm4[block->pm4_ndwords++] = PKT3(PKT3_SURFACE_SYNC, 3); block->pm4[block->pm4_ndwords++] = reg[i+j].flush_flags; block->pm4[block->pm4_ndwords++] = 0xFFFFFFFF; @@ -155,455 +134,456 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, return 0; } -int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset) -{ - group->start_offset = start_offset; - group->end_offset = end_offset; - group->nblocks = 0; - group->blocks = NULL; - group->offset_block_id = calloc((end_offset - start_offset) >> 2, sizeof(unsigned)); - if (group->offset_block_id == NULL) - return -ENOMEM; - return 0; -} - -static void r600_group_fini(struct r600_group *group) -{ - free(group->offset_block_id); - free(group->blocks); -} - /* R600/R700 configuration */ static const struct r600_reg r600_config_reg_list[] = { - {0, 0, R_008958_VGT_PRIMITIVE_TYPE}, - {0, 0, R_008C00_SQ_CONFIG}, - {0, 0, R_008C04_SQ_GPR_RESOURCE_MGMT_1}, - {0, 0, R_008C08_SQ_GPR_RESOURCE_MGMT_2}, - {0, 0, R_008C0C_SQ_THREAD_RESOURCE_MGMT}, - {0, 0, R_008C10_SQ_STACK_RESOURCE_MGMT_1}, - {0, 0, R_008C14_SQ_STACK_RESOURCE_MGMT_2}, - {0, 0, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ}, - {0, 0, R_009508_TA_CNTL_AUX}, - {0, 0, R_009714_VC_ENHANCE}, - {0, 0, R_009830_DB_DEBUG}, - {0, 0, R_009838_DB_WATERMARKS}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C10_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C14_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009508_TA_CNTL_AUX, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009714_VC_ENHANCE, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009830_DB_DEBUG, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0}, }; static const struct r600_reg r600_context_reg_list[] = { - {0, 0, R_028350_SX_MISC}, - {0, 0, R_0286C8_SPI_THREAD_GROUPING}, - {0, 0, R_0288A8_SQ_ESGS_RING_ITEMSIZE}, - {0, 0, R_0288AC_SQ_GSVS_RING_ITEMSIZE}, - {0, 0, R_0288B0_SQ_ESTMP_RING_ITEMSIZE}, - {0, 0, R_0288B4_SQ_GSTMP_RING_ITEMSIZE}, - {0, 0, R_0288B8_SQ_VSTMP_RING_ITEMSIZE}, - {0, 0, R_0288BC_SQ_PSTMP_RING_ITEMSIZE}, - {0, 0, R_0288C0_SQ_FBUF_RING_ITEMSIZE}, - {0, 0, R_0288C4_SQ_REDUC_RING_ITEMSIZE}, - {0, 0, R_0288C8_SQ_GS_VERT_ITEMSIZE}, - {0, 0, R_028A10_VGT_OUTPUT_PATH_CNTL}, - {0, 0, R_028A14_VGT_HOS_CNTL}, - {0, 0, R_028A18_VGT_HOS_MAX_TESS_LEVEL}, - {0, 0, R_028A1C_VGT_HOS_MIN_TESS_LEVEL}, - {0, 0, R_028A20_VGT_HOS_REUSE_DEPTH}, - {0, 0, R_028A24_VGT_GROUP_PRIM_TYPE}, - {0, 0, R_028A28_VGT_GROUP_FIRST_DECR}, - {0, 0, R_028A2C_VGT_GROUP_DECR}, - {0, 0, R_028A30_VGT_GROUP_VECT_0_CNTL}, - {0, 0, R_028A34_VGT_GROUP_VECT_1_CNTL}, - {0, 0, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL}, - {0, 0, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL}, - {0, 0, R_028A40_VGT_GS_MODE}, - {0, 0, R_028A4C_PA_SC_MODE_CNTL}, - {0, 0, R_028AB0_VGT_STRMOUT_EN}, - {0, 0, R_028AB4_VGT_REUSE_OFF}, - {0, 0, R_028AB8_VGT_VTX_CNT_EN}, - {0, 0, R_028B20_VGT_STRMOUT_BUFFER_EN}, - {0, 0, R_028028_DB_STENCIL_CLEAR}, - {0, 0, R_02802C_DB_DEPTH_CLEAR}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028040_CB_COLOR0_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280A0_CB_COLOR0_INFO}, - {0, 0, R_028060_CB_COLOR0_SIZE}, - {0, 0, R_028080_CB_COLOR0_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280E0_CB_COLOR0_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280C0_CB_COLOR0_TILE}, - {0, 0, R_028100_CB_COLOR0_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028044_CB_COLOR1_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280A4_CB_COLOR1_INFO}, - {0, 0, R_028064_CB_COLOR1_SIZE}, - {0, 0, R_028084_CB_COLOR1_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280E4_CB_COLOR1_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280C4_CB_COLOR1_TILE}, - {0, 0, R_028104_CB_COLOR1_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028048_CB_COLOR2_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280A8_CB_COLOR2_INFO}, - {0, 0, R_028068_CB_COLOR2_SIZE}, - {0, 0, R_028088_CB_COLOR2_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280E8_CB_COLOR2_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280C8_CB_COLOR2_TILE}, - {0, 0, R_028108_CB_COLOR2_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_02804C_CB_COLOR3_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280AC_CB_COLOR3_INFO}, - {0, 0, R_02806C_CB_COLOR3_SIZE}, - {0, 0, R_02808C_CB_COLOR3_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280EC_CB_COLOR3_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280CC_CB_COLOR3_TILE}, - {0, 0, R_02810C_CB_COLOR3_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028050_CB_COLOR4_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280B0_CB_COLOR4_INFO}, - {0, 0, R_028070_CB_COLOR4_SIZE}, - {0, 0, R_028090_CB_COLOR4_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280F0_CB_COLOR4_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280D0_CB_COLOR4_TILE}, - {0, 0, R_028110_CB_COLOR4_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028054_CB_COLOR5_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280B4_CB_COLOR5_INFO}, - {0, 0, R_028074_CB_COLOR5_SIZE}, - {0, 0, R_028094_CB_COLOR5_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280F4_CB_COLOR5_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280D4_CB_COLOR5_TILE}, - {0, 0, R_028114_CB_COLOR5_MASK}, - {1, 0, R_028058_CB_COLOR6_BASE}, - {1, 0, R_0280B8_CB_COLOR6_INFO}, - {0, 0, R_028078_CB_COLOR6_SIZE}, - {0, 0, R_028098_CB_COLOR6_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280F8_CB_COLOR6_FRAG}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280D8_CB_COLOR6_TILE}, - {0, 0, R_028118_CB_COLOR6_MASK}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_02805C_CB_COLOR7_BASE}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_0280BC_CB_COLOR7_INFO}, - {0, 0, R_02807C_CB_COLOR7_SIZE}, - {0, 0, R_02809C_CB_COLOR7_VIEW}, - {1, 0, R_0280FC_CB_COLOR7_FRAG}, - {1, 0, R_0280DC_CB_COLOR7_TILE}, - {0, 0, R_02811C_CB_COLOR7_MASK}, - {0, 0, R_028120_CB_CLEAR_RED}, - {0, 0, R_028124_CB_CLEAR_GREEN}, - {0, 0, R_028128_CB_CLEAR_BLUE}, - {0, 0, R_02812C_CB_CLEAR_ALPHA}, - {0, 0, R_02823C_CB_SHADER_MASK}, - {0, 0, R_028238_CB_TARGET_MASK}, - {0, 0, R_028410_SX_ALPHA_TEST_CONTROL}, - {0, 0, R_028414_CB_BLEND_RED}, - {0, 0, R_028418_CB_BLEND_GREEN}, - {0, 0, R_02841C_CB_BLEND_BLUE}, - {0, 0, R_028420_CB_BLEND_ALPHA}, - {0, 0, R_028424_CB_FOG_RED}, - {0, 0, R_028428_CB_FOG_GREEN}, - {0, 0, R_02842C_CB_FOG_BLUE}, - {0, 0, R_028430_DB_STENCILREFMASK}, - {0, 0, R_028434_DB_STENCILREFMASK_BF}, - {0, 0, R_028438_SX_ALPHA_REF}, - {0, 0, R_0286DC_SPI_FOG_CNTL}, - {0, 0, R_0286E0_SPI_FOG_FUNC_SCALE}, - {0, 0, R_0286E4_SPI_FOG_FUNC_BIAS}, - {0, 0, R_028780_CB_BLEND0_CONTROL}, - {0, 0, R_028784_CB_BLEND1_CONTROL}, - {0, 0, R_028788_CB_BLEND2_CONTROL}, - {0, 0, R_02878C_CB_BLEND3_CONTROL}, - {0, 0, R_028790_CB_BLEND4_CONTROL}, - {0, 0, R_028794_CB_BLEND5_CONTROL}, - {0, 0, R_028798_CB_BLEND6_CONTROL}, - {0, 0, R_02879C_CB_BLEND7_CONTROL}, - {0, 0, R_0287A0_CB_SHADER_CONTROL}, - {0, 0, R_028800_DB_DEPTH_CONTROL}, - {0, 0, R_028804_CB_BLEND_CONTROL}, - {0, 0, R_028808_CB_COLOR_CONTROL}, - {0, 0, R_02880C_DB_SHADER_CONTROL}, - {0, 0, R_028C04_PA_SC_AA_CONFIG}, - {0, 0, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX}, - {0, 0, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX}, - {0, 0, R_028C30_CB_CLRCMP_CONTROL}, - {0, 0, R_028C34_CB_CLRCMP_SRC}, - {0, 0, R_028C38_CB_CLRCMP_DST}, - {0, 0, R_028C3C_CB_CLRCMP_MSK}, - {0, 0, R_028C48_PA_SC_AA_MASK}, - {0, 0, R_028D2C_DB_SRESULTS_COMPARE_STATE1}, - {0, 0, R_028D44_DB_ALPHA_TO_MASK}, - {1, 0, R_02800C_DB_DEPTH_BASE}, - {0, 0, R_028000_DB_DEPTH_SIZE}, - {0, 0, R_028004_DB_DEPTH_VIEW}, - {0, 0, GROUP_FORCE_NEW_BLOCK}, - {1, 0, R_028010_DB_DEPTH_INFO}, - {0, 0, R_028D0C_DB_RENDER_CONTROL}, - {0, 0, R_028D10_DB_RENDER_OVERRIDE}, - {0, 0, R_028D24_DB_HTILE_SURFACE}, - {0, 0, R_028D30_DB_PRELOAD_CONTROL}, - {0, 0, R_028D34_DB_PREFETCH_LIMIT}, - {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL}, - {0, 0, R_028034_PA_SC_SCREEN_SCISSOR_BR}, - {0, 0, R_028200_PA_SC_WINDOW_OFFSET}, - {0, 0, R_028204_PA_SC_WINDOW_SCISSOR_TL}, - {0, 0, R_028208_PA_SC_WINDOW_SCISSOR_BR}, - {0, 0, R_02820C_PA_SC_CLIPRECT_RULE}, - {0, 0, R_028210_PA_SC_CLIPRECT_0_TL}, - {0, 0, R_028214_PA_SC_CLIPRECT_0_BR}, - {0, 0, R_028218_PA_SC_CLIPRECT_1_TL}, - {0, 0, R_02821C_PA_SC_CLIPRECT_1_BR}, - {0, 0, R_028220_PA_SC_CLIPRECT_2_TL}, - {0, 0, R_028224_PA_SC_CLIPRECT_2_BR}, - {0, 0, R_028228_PA_SC_CLIPRECT_3_TL}, - {0, 0, R_02822C_PA_SC_CLIPRECT_3_BR}, - {0, 0, R_028230_PA_SC_EDGERULE}, - {0, 0, R_028240_PA_SC_GENERIC_SCISSOR_TL}, - {0, 0, R_028244_PA_SC_GENERIC_SCISSOR_BR}, - {0, 0, R_028250_PA_SC_VPORT_SCISSOR_0_TL}, - {0, 0, R_028254_PA_SC_VPORT_SCISSOR_0_BR}, - {0, 0, R_0282D0_PA_SC_VPORT_ZMIN_0}, - {0, 0, R_0282D4_PA_SC_VPORT_ZMAX_0}, - {0, 0, R_02843C_PA_CL_VPORT_XSCALE_0}, - {0, 0, R_028440_PA_CL_VPORT_XOFFSET_0}, - {0, 0, R_028444_PA_CL_VPORT_YSCALE_0}, - {0, 0, R_028448_PA_CL_VPORT_YOFFSET_0}, - {0, 0, R_02844C_PA_CL_VPORT_ZSCALE_0}, - {0, 0, R_028450_PA_CL_VPORT_ZOFFSET_0}, - {0, 0, R_0286D4_SPI_INTERP_CONTROL_0}, - {0, 0, R_028810_PA_CL_CLIP_CNTL}, - {0, 0, R_028814_PA_SU_SC_MODE_CNTL}, - {0, 0, R_028818_PA_CL_VTE_CNTL}, - {0, 0, R_02881C_PA_CL_VS_OUT_CNTL}, - {0, 0, R_028820_PA_CL_NANINF_CNTL}, - {0, 0, R_028A00_PA_SU_POINT_SIZE}, - {0, 0, R_028A04_PA_SU_POINT_MINMAX}, - {0, 0, R_028A08_PA_SU_LINE_CNTL}, - {0, 0, R_028A0C_PA_SC_LINE_STIPPLE}, - {0, 0, R_028A48_PA_SC_MPASS_PS_CNTL}, - {0, 0, R_028C00_PA_SC_LINE_CNTL}, - {0, 0, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ}, - {0, 0, R_028C10_PA_CL_GB_VERT_DISC_ADJ}, - {0, 0, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ}, - {0, 0, R_028C18_PA_CL_GB_HORZ_DISC_ADJ}, - {0, 0, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL}, - {0, 0, R_028DFC_PA_SU_POLY_OFFSET_CLAMP}, - {0, 0, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE}, - {0, 0, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET}, - {0, 0, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE}, - {0, 0, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET}, - {0, 0, R_028E20_PA_CL_UCP0_X}, - {0, 0, R_028E24_PA_CL_UCP0_Y}, - {0, 0, R_028E28_PA_CL_UCP0_Z}, - {0, 0, R_028E2C_PA_CL_UCP0_W}, - {0, 0, R_028E30_PA_CL_UCP1_X}, - {0, 0, R_028E34_PA_CL_UCP1_Y}, - {0, 0, R_028E38_PA_CL_UCP1_Z}, - {0, 0, R_028E3C_PA_CL_UCP1_W}, - {0, 0, R_028E40_PA_CL_UCP2_X}, - {0, 0, R_028E44_PA_CL_UCP2_Y}, - {0, 0, R_028E48_PA_CL_UCP2_Z}, - {0, 0, R_028E4C_PA_CL_UCP2_W}, - {0, 0, R_028E50_PA_CL_UCP3_X}, - {0, 0, R_028E54_PA_CL_UCP3_Y}, - {0, 0, R_028E58_PA_CL_UCP3_Z}, - {0, 0, R_028E5C_PA_CL_UCP3_W}, - {0, 0, R_028E60_PA_CL_UCP4_X}, - {0, 0, R_028E64_PA_CL_UCP4_Y}, - {0, 0, R_028E68_PA_CL_UCP4_Z}, - {0, 0, R_028E6C_PA_CL_UCP4_W}, - {0, 0, R_028E70_PA_CL_UCP5_X}, - {0, 0, R_028E74_PA_CL_UCP5_Y}, - {0, 0, R_028E78_PA_CL_UCP5_Z}, - {0, 0, R_028E7C_PA_CL_UCP5_W}, - {0, 0, R_028380_SQ_VTX_SEMANTIC_0}, - {0, 0, R_028384_SQ_VTX_SEMANTIC_1}, - {0, 0, R_028388_SQ_VTX_SEMANTIC_2}, - {0, 0, R_02838C_SQ_VTX_SEMANTIC_3}, - {0, 0, R_028390_SQ_VTX_SEMANTIC_4}, - {0, 0, R_028394_SQ_VTX_SEMANTIC_5}, - {0, 0, R_028398_SQ_VTX_SEMANTIC_6}, - {0, 0, R_02839C_SQ_VTX_SEMANTIC_7}, - {0, 0, R_0283A0_SQ_VTX_SEMANTIC_8}, - {0, 0, R_0283A4_SQ_VTX_SEMANTIC_9}, - {0, 0, R_0283A8_SQ_VTX_SEMANTIC_10}, - {0, 0, R_0283AC_SQ_VTX_SEMANTIC_11}, - {0, 0, R_0283B0_SQ_VTX_SEMANTIC_12}, - {0, 0, R_0283B4_SQ_VTX_SEMANTIC_13}, - {0, 0, R_0283B8_SQ_VTX_SEMANTIC_14}, - {0, 0, R_0283BC_SQ_VTX_SEMANTIC_15}, - {0, 0, R_0283C0_SQ_VTX_SEMANTIC_16}, - {0, 0, R_0283C4_SQ_VTX_SEMANTIC_17}, - {0, 0, R_0283C8_SQ_VTX_SEMANTIC_18}, - {0, 0, R_0283CC_SQ_VTX_SEMANTIC_19}, - {0, 0, R_0283D0_SQ_VTX_SEMANTIC_20}, - {0, 0, R_0283D4_SQ_VTX_SEMANTIC_21}, - {0, 0, R_0283D8_SQ_VTX_SEMANTIC_22}, - {0, 0, R_0283DC_SQ_VTX_SEMANTIC_23}, - {0, 0, R_0283E0_SQ_VTX_SEMANTIC_24}, - {0, 0, R_0283E4_SQ_VTX_SEMANTIC_25}, - {0, 0, R_0283E8_SQ_VTX_SEMANTIC_26}, - {0, 0, R_0283EC_SQ_VTX_SEMANTIC_27}, - {0, 0, R_0283F0_SQ_VTX_SEMANTIC_28}, - {0, 0, R_0283F4_SQ_VTX_SEMANTIC_29}, - {0, 0, R_0283F8_SQ_VTX_SEMANTIC_30}, - {0, 0, R_0283FC_SQ_VTX_SEMANTIC_31}, - {0, 0, R_028614_SPI_VS_OUT_ID_0}, - {0, 0, R_028618_SPI_VS_OUT_ID_1}, - {0, 0, R_02861C_SPI_VS_OUT_ID_2}, - {0, 0, R_028620_SPI_VS_OUT_ID_3}, - {0, 0, R_028624_SPI_VS_OUT_ID_4}, - {0, 0, R_028628_SPI_VS_OUT_ID_5}, - {0, 0, R_02862C_SPI_VS_OUT_ID_6}, - {0, 0, R_028630_SPI_VS_OUT_ID_7}, - {0, 0, R_028634_SPI_VS_OUT_ID_8}, - {0, 0, R_028638_SPI_VS_OUT_ID_9}, - {0, 0, R_0286C4_SPI_VS_OUT_CONFIG}, - {1, 0, R_028858_SQ_PGM_START_VS}, - {0, S_0085F0_SH_ACTION_ENA(1), R_028868_SQ_PGM_RESOURCES_VS}, - {1, 0, R_028894_SQ_PGM_START_FS}, - {0, S_0085F0_SH_ACTION_ENA(1), R_0288A4_SQ_PGM_RESOURCES_FS}, - {0, 0, R_0288D0_SQ_PGM_CF_OFFSET_VS}, - {0, 0, R_0288DC_SQ_PGM_CF_OFFSET_FS}, - {0, 0, R_028644_SPI_PS_INPUT_CNTL_0}, - {0, 0, R_028648_SPI_PS_INPUT_CNTL_1}, - {0, 0, R_02864C_SPI_PS_INPUT_CNTL_2}, - {0, 0, R_028650_SPI_PS_INPUT_CNTL_3}, - {0, 0, R_028654_SPI_PS_INPUT_CNTL_4}, - {0, 0, R_028658_SPI_PS_INPUT_CNTL_5}, - {0, 0, R_02865C_SPI_PS_INPUT_CNTL_6}, - {0, 0, R_028660_SPI_PS_INPUT_CNTL_7}, - {0, 0, R_028664_SPI_PS_INPUT_CNTL_8}, - {0, 0, R_028668_SPI_PS_INPUT_CNTL_9}, - {0, 0, R_02866C_SPI_PS_INPUT_CNTL_10}, - {0, 0, R_028670_SPI_PS_INPUT_CNTL_11}, - {0, 0, R_028674_SPI_PS_INPUT_CNTL_12}, - {0, 0, R_028678_SPI_PS_INPUT_CNTL_13}, - {0, 0, R_02867C_SPI_PS_INPUT_CNTL_14}, - {0, 0, R_028680_SPI_PS_INPUT_CNTL_15}, - {0, 0, R_028684_SPI_PS_INPUT_CNTL_16}, - {0, 0, R_028688_SPI_PS_INPUT_CNTL_17}, - {0, 0, R_02868C_SPI_PS_INPUT_CNTL_18}, - {0, 0, R_028690_SPI_PS_INPUT_CNTL_19}, - {0, 0, R_028694_SPI_PS_INPUT_CNTL_20}, - {0, 0, R_028698_SPI_PS_INPUT_CNTL_21}, - {0, 0, R_02869C_SPI_PS_INPUT_CNTL_22}, - {0, 0, R_0286A0_SPI_PS_INPUT_CNTL_23}, - {0, 0, R_0286A4_SPI_PS_INPUT_CNTL_24}, - {0, 0, R_0286A8_SPI_PS_INPUT_CNTL_25}, - {0, 0, R_0286AC_SPI_PS_INPUT_CNTL_26}, - {0, 0, R_0286B0_SPI_PS_INPUT_CNTL_27}, - {0, 0, R_0286B4_SPI_PS_INPUT_CNTL_28}, - {0, 0, R_0286B8_SPI_PS_INPUT_CNTL_29}, - {0, 0, R_0286BC_SPI_PS_INPUT_CNTL_30}, - {0, 0, R_0286C0_SPI_PS_INPUT_CNTL_31}, - {0, 0, R_0286CC_SPI_PS_IN_CONTROL_0}, - {0, 0, R_0286D0_SPI_PS_IN_CONTROL_1}, - {0, 0, R_0286D8_SPI_INPUT_Z}, - {1, S_0085F0_SH_ACTION_ENA(1), R_028840_SQ_PGM_START_PS}, - {0, 0, R_028850_SQ_PGM_RESOURCES_PS}, - {0, 0, R_028854_SQ_PGM_EXPORTS_PS}, - {0, 0, R_0288CC_SQ_PGM_CF_OFFSET_PS}, - {0, 0, R_028400_VGT_MAX_VTX_INDX}, - {0, 0, R_028404_VGT_MIN_VTX_INDX}, - {0, 0, R_028408_VGT_INDX_OFFSET}, - {0, 0, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX}, - {0, 0, R_028A84_VGT_PRIMITIVEID_EN}, - {0, 0, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN}, - {0, 0, R_028AA0_VGT_INSTANCE_STEP_RATE_0}, - {0, 0, R_028AA4_VGT_INSTANCE_STEP_RATE_1}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB0_VGT_STRMOUT_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028B20_VGT_STRMOUT_BUFFER_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E0_CB_COLOR0_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C0_CB_COLOR0_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028100_CB_COLOR0_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E4_CB_COLOR1_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C4_CB_COLOR1_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028104_CB_COLOR1_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E8_CB_COLOR2_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C8_CB_COLOR2_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028108_CB_COLOR2_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280EC_CB_COLOR3_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280CC_CB_COLOR3_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02810C_CB_COLOR3_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F0_CB_COLOR4_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D0_CB_COLOR4_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028110_CB_COLOR4_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F4_CB_COLOR5_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F8_CB_COLOR6_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D8_CB_COLOR6_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028118_CB_COLOR6_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280DC_CB_COLOR7_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02811C_CB_COLOR7_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028120_CB_CLEAR_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028424_CB_FOG_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028428_CB_FOG_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02842C_CB_FOG_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E0_SPI_FOG_FUNC_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E4_SPI_FOG_FUNC_BIAS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0287A0_CB_SHADER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028804_CB_BLEND_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C30_CB_CLRCMP_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C34_CB_CLRCMP_SRC, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C38_CB_CLRCMP_DST, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C3C_CB_CLRCMP_MSK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C48_PA_SC_AA_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D44_DB_ALPHA_TO_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02800C_DB_DEPTH_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028000_DB_DEPTH_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028004_DB_DEPTH_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028010_DB_DEPTH_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D0C_DB_RENDER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D10_DB_RENDER_OVERRIDE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D24_DB_HTILE_SURFACE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D30_DB_PRELOAD_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D34_DB_PREFETCH_LIMIT, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A0C_PA_SC_LINE_STIPPLE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MPASS_PS_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E20_PA_CL_UCP0_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E24_PA_CL_UCP0_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E28_PA_CL_UCP0_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E2C_PA_CL_UCP0_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E30_PA_CL_UCP1_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E34_PA_CL_UCP1_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E38_PA_CL_UCP1_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E3C_PA_CL_UCP1_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E40_PA_CL_UCP2_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E44_PA_CL_UCP2_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E48_PA_CL_UCP2_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E4C_PA_CL_UCP2_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E50_PA_CL_UCP3_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E54_PA_CL_UCP3_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E58_PA_CL_UCP3_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E5C_PA_CL_UCP3_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E60_PA_CL_UCP4_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E64_PA_CL_UCP4_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E68_PA_CL_UCP4_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E6C_PA_CL_UCP4_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E70_PA_CL_UCP5_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E74_PA_CL_UCP5_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E78_PA_CL_UCP5_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E7C_PA_CL_UCP5_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028614_SPI_VS_OUT_ID_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028618_SPI_VS_OUT_ID_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028858_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028868_SQ_PGM_RESOURCES_VS, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028894_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_RESOURCES_FS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028850_SQ_PGM_RESOURCES_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028854_SQ_PGM_EXPORTS_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A84_VGT_PRIMITIVEID_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0}, }; /* SHADER CONSTANT R600/R700 */ static int r600_state_constant_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_constant[] = { - {0, 0, R_030000_SQ_ALU_CONSTANT0_0}, - {0, 0, R_030004_SQ_ALU_CONSTANT1_0}, - {0, 0, R_030008_SQ_ALU_CONSTANT2_0}, - {0, 0, R_03000C_SQ_ALU_CONSTANT3_0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030000_SQ_ALU_CONSTANT0_0, 0, 0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030004_SQ_ALU_CONSTANT1_0, 0, 0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030008_SQ_ALU_CONSTANT2_0, 0, 0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_03000C_SQ_ALU_CONSTANT3_0, 0, 0}, }; unsigned nreg = sizeof(r600_shader_constant)/sizeof(struct r600_reg); for (int i = 0; i < nreg; i++) { r600_shader_constant[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_constant, nreg, PKT3_SET_ALU_CONST); + return r600_context_add_block(ctx, r600_shader_constant, nreg); } /* SHADER RESOURCE R600/R700 */ static int r600_state_resource_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_resource[] = { - {0, 0, R_038000_RESOURCE0_WORD0}, - {0, 0, R_038004_RESOURCE0_WORD1}, - {1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), R_038008_RESOURCE0_WORD2}, - {1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), R_03800C_RESOURCE0_WORD3}, - {0, 0, R_038010_RESOURCE0_WORD4}, - {0, 0, R_038014_RESOURCE0_WORD5}, - {0, 0, R_038018_RESOURCE0_WORD6}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038000_RESOURCE0_WORD0, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038004_RESOURCE0_WORD1, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_03800C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038010_RESOURCE0_WORD4, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0}, }; unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); for (int i = 0; i < nreg; i++) { r600_shader_resource[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_resource, nreg, PKT3_SET_RESOURCE); + return r600_context_add_block(ctx, r600_shader_resource, nreg); } /* SHADER SAMPLER R600/R700 */ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_sampler[] = { - {0, 0, R_03C000_SQ_TEX_SAMPLER_WORD0_0}, - {0, 0, R_03C004_SQ_TEX_SAMPLER_WORD1_0}, - {0, 0, R_03C008_SQ_TEX_SAMPLER_WORD2_0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, }; unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); for (int i = 0; i < nreg; i++) { r600_shader_sampler[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_sampler, nreg, PKT3_SET_SAMPLER); + return r600_context_add_block(ctx, r600_shader_sampler, nreg); } /* SHADER SAMPLER BORDER R600/R700 */ static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_sampler_border[] = { - {0, 0, R_00A400_TD_PS_SAMPLER0_BORDER_RED}, - {0, 0, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN}, - {0, 0, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE}, - {0, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A400_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, }; unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); for (int i = 0; i < nreg; i++) { r600_shader_sampler_border[i].offset += offset; } - return r600_context_add_block(ctx, r600_shader_sampler_border, nreg, PKT3_SET_CONFIG_REG); + return r600_context_add_block(ctx, r600_shader_sampler_border, nreg); } /* initialize */ void r600_context_fini(struct r600_context *ctx) { - for (int i = 0; i < ctx->ngroups; i++) { - r600_group_fini(&ctx->groups[i]); + struct r600_block *block; + struct r600_range *range; + + for (int i = 0; i < 256; i++) { + for (int j = 0; j < (1 << ctx->hash_shift); j++) { + block = ctx->range[i].blocks[j]; + if (block) { + for (int k = 0, offset = block->start_offset; k < block->nreg; k++, offset += 4) { + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + range->blocks[CTX_BLOCK_ID(ctx, offset)] = NULL; + } + free(block); + } + } + free(ctx->range[i].blocks); } free(ctx->reloc); free(ctx->pm4); @@ -617,50 +597,26 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) memset(ctx, 0, sizeof(struct r600_context)); ctx->radeon = radeon; LIST_INITHEAD(&ctx->query_list); - /* initialize groups */ - r = r600_group_init(&ctx->groups[R600_GROUP_CONFIG], R600_CONFIG_REG_OFFSET, R600_CONFIG_REG_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_CTL_CONST], R600_CTL_CONST_OFFSET, R600_CTL_CONST_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_LOOP_CONST], R600_LOOP_CONST_OFFSET, R600_LOOP_CONST_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_BOOL_CONST], R600_BOOL_CONST_OFFSET, R600_BOOL_CONST_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_SAMPLER], R600_SAMPLER_OFFSET, R600_SAMPLER_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_RESOURCE], R600_RESOURCE_OFFSET, R600_RESOURCE_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_ALU_CONST], R600_ALU_CONST_OFFSET, R600_ALU_CONST_END); - if (r) { - goto out_err; - } - r = r600_group_init(&ctx->groups[R600_GROUP_CONTEXT], R600_CONTEXT_REG_OFFSET, R600_CONTEXT_REG_END); - if (r) { - goto out_err; + + /* initialize hash */ + ctx->hash_size = 19; + ctx->hash_shift = 11; + for (int i = 0; i < 256; i++) { + ctx->range[i].start_offset = i << ctx->hash_shift; + ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1; + ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*)); + if (ctx->range[i].blocks == NULL) { + return -ENOMEM; + } } - ctx->ngroups = R600_NGROUPS; /* add blocks */ r = r600_context_add_block(ctx, r600_config_reg_list, - sizeof(r600_config_reg_list)/sizeof(struct r600_reg), - PKT3_SET_CONFIG_REG); + sizeof(r600_config_reg_list)/sizeof(struct r600_reg)); if (r) goto out_err; r = r600_context_add_block(ctx, r600_context_reg_list, - sizeof(r600_context_reg_list)/sizeof(struct r600_reg), - PKT3_SET_CONTEXT_REG); + sizeof(r600_context_reg_list)/sizeof(struct r600_reg)); if (r) goto out_err; @@ -714,6 +670,27 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } + /* setup block table */ + ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); + for (int i = 0, c = 0; i < 256; i++) { + for (int j = 0, add; j < (1 << ctx->hash_shift); j++) { + if (ctx->range[i].blocks[j]) { + add = 1; + for (int k = 0; k < c; k++) { + if (ctx->blocks[k] == ctx->range[i].blocks[j]) { + add = 0; + break; + } + } + if (add) { + assert(c < ctx->nblocks); + ctx->blocks[c++] = ctx->range[i].blocks[j]; + j += (ctx->range[i].blocks[j]->nreg << 2) - 1; + } + } + } + } + /* allocate cs variables */ ctx->nreloc = RADEON_CTX_MAX_PM4; ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); @@ -769,14 +746,14 @@ void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state) { - struct r600_group *group; - struct r600_group_block *block; + struct r600_range *range; + struct r600_block *block; for (int i = 0; i < state->nregs; i++) { unsigned id; - group = &ctx->groups[state->regs[i].group_id]; - id = group->offset_block_id[(state->regs[i].offset - group->start_offset) >> 2]; - block = &group->blocks[id]; + + range = &ctx->range[CTX_RANGE_ID(ctx, state->regs[i].offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, state->regs[i].offset)]; id = (state->regs[i].offset - block->start_offset) >> 2; block->reg[id] &= ~state->regs[i].mask; block->reg[id] |= state->regs[i].value; @@ -793,12 +770,11 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { - struct r600_group_block *block; - unsigned id; + struct r600_range *range; + struct r600_block *block; - offset -= ctx->groups[R600_GROUP_RESOURCE].start_offset; - id = ctx->groups[R600_GROUP_RESOURCE].offset_block_id[offset >> 2]; - block = &ctx->groups[R600_GROUP_RESOURCE].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); @@ -846,12 +822,11 @@ void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r6 static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { - struct r600_group_block *block; - unsigned id; + struct r600_range *range; + struct r600_block *block; - offset -= ctx->groups[R600_GROUP_SAMPLER].start_offset; - id = ctx->groups[R600_GROUP_SAMPLER].offset_block_id[offset >> 2]; - block = &ctx->groups[R600_GROUP_SAMPLER].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); return; @@ -866,12 +841,11 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { - struct r600_group_block *block; - unsigned id; + struct r600_range *range; + struct r600_block *block; - offset -= ctx->groups[R600_GROUP_CONFIG].start_offset; - id = ctx->groups[R600_GROUP_CONFIG].offset_block_id[offset >> 2]; - block = &ctx->groups[R600_GROUP_CONFIG].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); return; @@ -908,39 +882,14 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 r600_context_pipe_state_set_sampler_border(ctx, state, offset); } -void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group) +struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) { - struct radeon_bo *bo; - int id; - - for (int i = 0; i < group->nblocks; i++) { - struct r600_group_block *block = &group->blocks[i]; - if (block->status & R600_BLOCK_STATUS_DIRTY) { - for (int j = 0; j < block->nreg; j++) { - if (block->pm4_bo_index[j]) { - /* find relocation */ - id = block->pm4_bo_index[j]; - bo = radeon_bo_pb_get_bo(block->reloc[id].bo->pb); - for (int k = 0; k < block->reloc[id].nreloc; k++) { - r600_context_bo_reloc(ctx, &block->pm4[block->reloc[id].bo_pm4_index[k]], bo); - } - } - } - - memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); - ctx->pm4_cdwords += block->pm4_ndwords; - block->status ^= R600_BLOCK_STATUS_DIRTY; - } - } -} - -struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset) -{ - struct r600_group_block *block; + struct r600_range *range; + struct r600_block *block; unsigned id; - id = ctx->groups[group_id].offset_block_id[(offset - ctx->groups[group_id].start_offset) >> 2]; - block = &ctx->groups[group_id].blocks[id]; + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; offset -= block->start_offset; id = block->pm4_bo_index[offset >> 2]; if (block->reloc[id].bo) { @@ -963,8 +912,15 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } /* find number of color buffer */ + cb[0] = r600_context_reg_bo(ctx, R_028040_CB_COLOR0_BASE); + cb[1] = r600_context_reg_bo(ctx, R_028044_CB_COLOR1_BASE); + cb[2] = r600_context_reg_bo(ctx, R_028048_CB_COLOR2_BASE); + cb[3] = r600_context_reg_bo(ctx, R_02804C_CB_COLOR3_BASE); + cb[4] = r600_context_reg_bo(ctx, R_028050_CB_COLOR4_BASE); + cb[5] = r600_context_reg_bo(ctx, R_028054_CB_COLOR5_BASE); + cb[6] = r600_context_reg_bo(ctx, R_028058_CB_COLOR6_BASE); + cb[7] = r600_context_reg_bo(ctx, R_02805C_CB_COLOR7_BASE); for (int i = 0; i < 8; i++) { - cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2)); if (cb[i]) { ndwords += 7; } @@ -973,12 +929,12 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) /* queries need some special values */ if (ctx->num_query_running) { if (ctx->radeon->family >= CHIP_RV770) { - r600_context_reg(ctx, R600_GROUP_CONTEXT, + r600_context_reg(ctx, R_028D0C_DB_RENDER_CONTROL, S_028D0C_R700_PERFECT_ZPASS_COUNTS(1), S_028D0C_R700_PERFECT_ZPASS_COUNTS(1)); } - r600_context_reg(ctx, R600_GROUP_CONTEXT, + r600_context_reg(ctx, R_028D10_DB_RENDER_OVERRIDE, S_028D10_NOOP_CULL_DISABLE(1), S_028D10_NOOP_CULL_DISABLE(1)); @@ -995,11 +951,11 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } /* enough room to copy packet */ - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONFIG]); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONTEXT]); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_ALU_CONST]); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_RESOURCE]); - r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_SAMPLER]); + for (int i = 0; i < ctx->nblocks; i++) { + if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { + r600_context_block_emit_dirty(ctx, ctx->blocks[i]); + } + } /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -1047,7 +1003,7 @@ void r600_context_flush(struct r600_context *ctx) struct drm_radeon_cs drmib; struct drm_radeon_cs_chunk chunks[2]; uint64_t chunk_array[2]; - struct r600_group_block *block; + struct r600_block *block; int r; if (!ctx->pm4_cdwords) @@ -1086,14 +1042,10 @@ void r600_context_flush(struct r600_context *ctx) /* set all valid group as dirty so they get reemited on * next draw command */ - for (int i = 0; i < ctx->ngroups; i++) { - for (int j = 0; j < ctx->groups[i].nblocks; j++) { - /* mark enabled block as dirty */ - block = &ctx->groups[i].blocks[j]; - if (block->status & R600_BLOCK_STATUS_ENABLED) { - ctx->pm4_dirty_cdwords += block->pm4_ndwords; - block->status |= R600_BLOCK_STATUS_DIRTY; - } + for (int i = 0; i < ctx->nblocks; i++) { + if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) { + ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords; + ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY; } } } -- cgit v1.2.3 From ae0cd811892d55bee12afed88fd12bb2611517d3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 10:30:04 -0700 Subject: mesa: Fix printf format warning. Fixes this GCC warning. math/m_debug_clip.c: In function '_math_test_all_cliptest_functions': math/m_debug_clip.c:363: warning: format not a string literal and no format arguments --- src/mesa/math/m_debug_clip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/math/m_debug_clip.c b/src/mesa/math/m_debug_clip.c index 7ea5428aa26..e97afafac3c 100644 --- a/src/mesa/math/m_debug_clip.c +++ b/src/mesa/math/m_debug_clip.c @@ -360,7 +360,7 @@ void _math_test_all_cliptest_functions( char *description ) char buf[100]; sprintf( buf, "%s[%d] failed test (%s)", cnames[np], psize, description ); - _mesa_problem( NULL, buf ); + _mesa_problem( NULL, "%s", buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) -- cgit v1.2.3 From 9c841abebc809be232032066c314d37231e595e2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 10:44:17 -0700 Subject: mesa: Fix printf format warning. Fixes this GCC warning. math/m_debug_norm.c: In function '_math_test_all_normal_transform_functions': math/m_debug_norm.c:365: warning: format not a string literal and no format arguments --- src/mesa/math/m_debug_norm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c index 710bad14dd1..02eb1f989f6 100644 --- a/src/mesa/math/m_debug_norm.c +++ b/src/mesa/math/m_debug_norm.c @@ -362,7 +362,7 @@ void _math_test_all_normal_transform_functions( char *description ) char buf[100]; sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", norm_strings[mtype], description ); - _mesa_problem( NULL, buf ); + _mesa_problem( NULL, "%s", buf ); } #ifdef RUN_DEBUG_BENCHMARK -- cgit v1.2.3 From aa62416ae17b707ce059e92197f719a6896d109c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 10:46:46 -0700 Subject: mesa: Fix printf format warning. Fixes this GCC warning. math/m_debug_xform.c: In function '_math_test_all_transform_functions': math/m_debug_xform.c:320: warning: format not a string literal and no format arguments --- src/mesa/math/m_debug_xform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index 46bd4545170..7d815664a14 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -317,7 +317,7 @@ void _math_test_all_transform_functions( char *description ) char buf[100]; sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", psize, mstrings[mtype], description ); - _mesa_problem( NULL, buf ); + _mesa_problem( NULL, "%s", buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) -- cgit v1.2.3 From 760d7c5d7d8e2c77866917853cab6b3c033815f6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 11:10:08 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings with linux-x86 build. radeon_emulate_branches.c: In function ‘handle_if’: radeon_emulate_branches.c:65: warning: ISO C90 forbids mixed declarations and code radeon_emulate_branches.c:71: warning: ISO C90 forbids mixed declarations and code radeon_emulate_branches.c: In function ‘handle_else’: radeon_emulate_branches.c:94: warning: ISO C90 forbids mixed declarations and code radeon_emulate_branches.c: In function ‘handle_endif’: radeon_emulate_branches.c:201: warning: ISO C90 forbids mixed declarations and code radeon_emulate_branches.c: In function ‘fix_output_writes’: radeon_emulate_branches.c:267: warning: ISO C90 forbids mixed declarations and code radeon_emulate_branches.c:284: warning: ISO C90 forbids mixed declarations and code radeon_emulate_branches.c: In function ‘rc_emulate_branches’: radeon_emulate_branches.c:307: warning: ISO C90 forbids mixed declarations and code --- .../dri/r300/compiler/radeon_emulate_branches.c | 29 +++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c index 222e5b7e02b..7bede344f30 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c @@ -57,18 +57,21 @@ struct emulate_branch_state { static void handle_if(struct emulate_branch_state * s, struct rc_instruction * inst) { + struct branch_info * branch; + struct rc_instruction * inst_mov; + memory_pool_array_reserve(&s->C->Pool, struct branch_info, s->Branches, s->BranchCount, s->BranchReserved, 1); DBG("%s\n", __FUNCTION__); - struct branch_info * branch = &s->Branches[s->BranchCount++]; + branch = &s->Branches[s->BranchCount++]; memset(branch, 0, sizeof(struct branch_info)); branch->If = inst; /* Make a safety copy of the decision register, because we will need * it at ENDIF time and it might be overwritten in both branches. */ - struct rc_instruction * inst_mov = rc_insert_new_instruction(s->C, inst->Prev); + inst_mov = rc_insert_new_instruction(s->C, inst->Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->U.I.DstReg.Index = rc_find_free_temporary(s->C); @@ -84,6 +87,8 @@ static void handle_if(struct emulate_branch_state * s, struct rc_instruction * i static void handle_else(struct emulate_branch_state * s, struct rc_instruction * inst) { + struct branch_info * branch; + if (!s->BranchCount) { rc_error(s->C, "Encountered ELSE outside of branches"); return; @@ -91,7 +96,7 @@ static void handle_else(struct emulate_branch_state * s, struct rc_instruction * DBG("%s\n", __FUNCTION__); - struct branch_info * branch = &s->Branches[s->BranchCount - 1]; + branch = &s->Branches[s->BranchCount - 1]; branch->Else = inst; } @@ -191,6 +196,10 @@ static void inject_cmp(struct emulate_branch_state * s, static void handle_endif(struct emulate_branch_state * s, struct rc_instruction * inst) { + struct branch_info * branch; + struct register_proxies IfProxies; + struct register_proxies ElseProxies; + if (!s->BranchCount) { rc_error(s->C, "Encountered ENDIF outside of branches"); return; @@ -198,9 +207,7 @@ static void handle_endif(struct emulate_branch_state * s, struct rc_instruction DBG("%s\n", __FUNCTION__); - struct branch_info * branch = &s->Branches[s->BranchCount - 1]; - struct register_proxies IfProxies; - struct register_proxies ElseProxies; + branch = &s->Branches[s->BranchCount - 1]; memset(&IfProxies, 0, sizeof(IfProxies)); memset(&ElseProxies, 0, sizeof(ElseProxies)); @@ -261,16 +268,19 @@ static void remap_output_function(void * userdata, struct rc_instruction * inst, */ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruction * inst) { + const struct rc_opcode_info * opcode; + if (!s->BranchCount) return; - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + opcode = rc_get_opcode_info(inst->U.I.Opcode); if (!opcode->HasDstReg) return; if (inst->U.I.DstReg.File == RC_FILE_OUTPUT) { struct remap_output_data remap; + struct rc_instruction * inst_mov; remap.Output = inst->U.I.DstReg.Index; remap.Temporary = rc_find_free_temporary(s->C); @@ -281,7 +291,7 @@ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruc rc_remap_registers(inst, &remap_output_function, &remap); } - struct rc_instruction * inst_mov = rc_insert_new_instruction(s->C, s->C->Program.Instructions.Prev); + inst_mov = rc_insert_new_instruction(s->C, s->C->Program.Instructions.Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.File = RC_FILE_OUTPUT; inst_mov->U.I.DstReg.Index = remap.Output; @@ -299,12 +309,13 @@ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruc void rc_emulate_branches(struct radeon_compiler *c, void *user) { struct emulate_branch_state s; + struct rc_instruction * ptr; memset(&s, 0, sizeof(s)); s.C = c; /* Untypical loop because we may remove the current instruction */ - struct rc_instruction * ptr = c->Program.Instructions.Next; + ptr = c->Program.Instructions.Next; while(ptr != &c->Program.Instructions) { struct rc_instruction * inst = ptr; ptr = ptr->Next; -- cgit v1.2.3 From 483971e649946bd8d3399240de5b483be9bd3402 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 11:19:55 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this GCC warning on linux-x86 build. radeon_emulate_loops.c: In function ‘rc_emulate_loops’: radeon_emulate_loops.c:517: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c index 02a52f92fc3..205eecd1129 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c @@ -511,11 +511,12 @@ void rc_emulate_loops(struct radeon_compiler *c, void *user) * loops are unrolled first. */ for( i = s->LoopCount - 1; i >= 0; i-- ){ + unsigned int iterations; + if(!s->Loops[i].EndLoop){ continue; } - unsigned int iterations = loop_max_possible_iterations( - s->C, &s->Loops[i]); + iterations = loop_max_possible_iterations(s->C, &s->Loops[i]); unroll_loop(s->C, &s->Loops[i], iterations); } } -- cgit v1.2.3 From 9c284b5cae916a083d17d1039d2f2da128b47882 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 29 Sep 2010 14:26:29 -0400 Subject: r600g: delete old path Lot of clean can now happen. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/Makefile | 10 +- src/gallium/drivers/r600/eg_asm.c | 9 +- src/gallium/drivers/r600/eg_hw_states.c | 1088 --------------------- src/gallium/drivers/r600/r600.h | 1 + src/gallium/drivers/r600/r600_asm.c | 7 +- src/gallium/drivers/r600/r600_blit.c | 209 ---- src/gallium/drivers/r600/r600_buffer.c | 82 +- src/gallium/drivers/r600/r600_context.c | 178 ---- src/gallium/drivers/r600/r600_context.h | 312 ------ src/gallium/drivers/r600/r600_draw.c | 190 ---- src/gallium/drivers/r600/r600_helper.c | 3 +- src/gallium/drivers/r600/r600_hw_states.c | 1215 ------------------------ src/gallium/drivers/r600/r600_pipe.h | 20 + src/gallium/drivers/r600/r600_query.c | 251 ----- src/gallium/drivers/r600/r600_resource.c | 15 +- src/gallium/drivers/r600/r600_resource.h | 26 +- src/gallium/drivers/r600/r600_screen.c | 265 ------ src/gallium/drivers/r600/r600_screen.h | 90 -- src/gallium/drivers/r600/r600_shader.c | 161 +--- src/gallium/drivers/r600/r600_state.c | 721 -------------- src/gallium/drivers/r600/r600_texture.c | 5 +- src/gallium/drivers/r600/r700_asm.c | 7 +- src/gallium/winsys/r600/drm/Makefile | 7 +- src/gallium/winsys/r600/drm/eg_states.h | 453 --------- src/gallium/winsys/r600/drm/gen_eg_states.py | 39 - src/gallium/winsys/r600/drm/gen_r600_states.py | 39 - src/gallium/winsys/r600/drm/r600_drm.c | 152 +++ src/gallium/winsys/r600/drm/r600_state.c | 662 ------------- src/gallium/winsys/r600/drm/r600_states.h | 522 ---------- src/gallium/winsys/r600/drm/radeon.c | 200 ---- src/gallium/winsys/r600/drm/radeon_ctx.c | 376 -------- src/gallium/winsys/r600/drm/radeon_draw.c | 57 -- src/gallium/winsys/r600/drm/radeon_state.c | 203 ---- 33 files changed, 223 insertions(+), 7352 deletions(-) delete mode 100644 src/gallium/drivers/r600/eg_hw_states.c delete mode 100644 src/gallium/drivers/r600/r600_blit.c delete mode 100644 src/gallium/drivers/r600/r600_context.c delete mode 100644 src/gallium/drivers/r600/r600_context.h delete mode 100644 src/gallium/drivers/r600/r600_draw.c delete mode 100644 src/gallium/drivers/r600/r600_hw_states.c delete mode 100644 src/gallium/drivers/r600/r600_query.c delete mode 100644 src/gallium/drivers/r600/r600_screen.c delete mode 100644 src/gallium/drivers/r600/r600_screen.h delete mode 100644 src/gallium/drivers/r600/r600_state.c delete mode 100644 src/gallium/winsys/r600/drm/eg_states.h delete mode 100644 src/gallium/winsys/r600/drm/gen_eg_states.py delete mode 100644 src/gallium/winsys/r600/drm/gen_r600_states.py delete mode 100644 src/gallium/winsys/r600/drm/r600_state.c delete mode 100644 src/gallium/winsys/r600/drm/r600_states.h delete mode 100644 src/gallium/winsys/r600/drm/radeon.c delete mode 100644 src/gallium/winsys/r600/drm/radeon_ctx.c delete mode 100644 src/gallium/winsys/r600/drm/radeon_draw.c delete mode 100644 src/gallium/winsys/r600/drm/radeon_state.c (limited to 'src') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 433b7044e5e..83be2935793 100644 --- a/src/gallium/drivers/r600/Makefile +++ b/src/gallium/drivers/r600/Makefile @@ -10,20 +10,12 @@ C_SOURCES = \ r600_buffer.c \ r600_state2.c \ evergreen_state.c \ - r600_context.c \ r600_shader.c \ - r600_draw.c \ - r600_blit.c \ r600_helper.c \ - r600_query.c \ r600_resource.c \ - r600_screen.c \ - r600_state.c \ r600_texture.c \ r600_asm.c \ r700_asm.c \ - r600_hw_states.c \ - eg_asm.c \ - eg_hw_states.c + eg_asm.c include ../../Makefile.template diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c index 769f5508744..dd9eda18d1f 100644 --- a/src/gallium/drivers/r600/eg_asm.c +++ b/src/gallium/drivers/r600/eg_asm.c @@ -20,14 +20,13 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "radeon.h" -#include "r600_asm.h" -#include "r600_context.h" +#include +#include #include "util/u_memory.h" +#include "r600_pipe.h" +#include "r600_asm.h" #include "eg_sq.h" #include "r600_opcodes.h" -#include -#include int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) { diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c deleted file mode 100644 index ebbc9c3f375..00000000000 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ /dev/null @@ -1,1088 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * 2010 Red Hat Inc. - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Dave Airlie - */ -#include -#include -#include -#include -#include "util/u_pack_color.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_resource.h" -#include "eg_state_inlines.h" -#include "evergreend.h" - -#include "eg_states_inc.h" - -static void eg_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - int i; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0); - rstate->states[EG_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]); - rstate->states[EG_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]); - rstate->states[EG_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]); - rstate->states[EG_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]); - rstate->states[EG_BLEND__CB_BLEND0_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND1_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND2_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND3_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND4_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND5_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND6_CONTROL] = 0x00000000; - rstate->states[EG_BLEND__CB_BLEND7_CONTROL] = 0x00000000; - - for (i = 0; i < 8; i++) { - unsigned eqRGB = state->rt[i].rgb_func; - unsigned srcRGB = state->rt[i].rgb_src_factor; - unsigned dstRGB = state->rt[i].rgb_dst_factor; - - unsigned eqA = state->rt[i].alpha_func; - unsigned srcA = state->rt[i].alpha_src_factor; - unsigned dstA = state->rt[i].alpha_dst_factor; - uint32_t bc = 0; - - if (!state->rt[i].blend_enable) - continue; - - bc |= S_028780_BLEND_CONTROL_ENABLE(1); - - bc |= S_028780_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB)); - bc |= S_028780_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB)); - bc |= S_028780_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB)); - - if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) { - bc |= S_028780_SEPARATE_ALPHA_BLEND(1); - bc |= S_028780_ALPHA_COMB_FCN(r600_translate_blend_function(eqA)); - bc |= S_028780_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA)); - bc |= S_028780_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA)); - } - - rstate->states[EG_BLEND__CB_BLEND0_CONTROL + i] = bc; - } - - radeon_state_pm4(rstate); -} - -static void eg_ucp(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_clip_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0); - - for (int i = 0; i < state->nr; i++) { - rstate->states[i * 4 + 0] = fui(state->ucp[i][0]); - rstate->states[i * 4 + 1] = fui(state->ucp[i][1]); - rstate->states[i * 4 + 2] = fui(state->ucp[i][2]); - rstate->states[i * 4 + 3] = fui(state->ucp[i][3]); - } - radeon_state_pm4(rstate); -} - -static void eg_cb(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_framebuffer_state *state, int cb) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - unsigned level = state->cbufs[cb]->level; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype; - const struct util_format_description *desc; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0, cb, 0); - rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; - rbuffer = &rtex->resource; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - rstate->nbo = 1; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; - - ntype = 0; - desc = util_format_description(rtex->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_028C70_NUMBER_SRGB; - - format = r600_translate_colorformat(rtex->resource.base.b.format); - swap = r600_translate_colorswap(rtex->resource.base.b.format); - - color_info = S_028C70_FORMAT(format) | - S_028C70_COMP_SWAP(swap) | - S_028C70_BLEND_CLAMP(1) | - S_028C70_SOURCE_FORMAT(1) | - S_028C70_NUMBER_TYPE(ntype); - - rstate->states[EG_CB__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8; - rstate->states[EG_CB__CB_COLOR0_INFO] = color_info; - rstate->states[EG_CB__CB_COLOR0_PITCH] = S_028C64_PITCH_TILE_MAX(pitch); - rstate->states[EG_CB__CB_COLOR0_SLICE] = S_028C68_SLICE_TILE_MAX(slice); - rstate->states[EG_CB__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[EG_CB__CB_COLOR0_ATTRIB] = S_028C74_NON_DISP_TILING_ORDER(1); - - radeon_state_pm4(rstate); -} - -static void eg_db(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_framebuffer_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - unsigned level; - unsigned pitch, slice, format; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); - if (state->zsbuf == NULL) - return; - - rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tiled = 1; - rtex->array_mode = 2; - rtex->tile_type = 1; - rtex->depth = 1; - rbuffer = &rtex->resource; - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - level = state->zsbuf->level; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; - format = r600_translate_dbformat(state->zsbuf->texture->format); - rstate->states[EG_DB__DB_HTILE_DATA_BASE] = state->zsbuf->offset >> 8; - rstate->states[EG_DB__DB_Z_READ_BASE] = state->zsbuf->offset >> 8; - rstate->states[EG_DB__DB_Z_WRITE_BASE] = state->zsbuf->offset >> 8; - rstate->states[EG_DB__DB_STENCIL_READ_BASE] = state->zsbuf->offset >> 8; - rstate->states[EG_DB__DB_STENCIL_WRITE_BASE] = state->zsbuf->offset >> 8; - rstate->states[EG_DB__DB_Z_INFO] = S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format); - rstate->states[EG_DB__DB_DEPTH_VIEW] = 0x00000000; - rstate->states[EG_DB__DB_DEPTH_SIZE] = S_028058_PITCH_TILE_MAX(pitch); - rstate->states[EG_DB__DB_DEPTH_SLICE] = S_02805C_SLICE_TILE_MAX(slice); - radeon_state_pm4(rstate); -} - -static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate) -{ - const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer; - const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - const struct pipe_clip_state *clip = NULL; - struct r600_screen *rscreen = rctx->screen; - float offset_units = 0, offset_scale = 0; - char depth = 0; - unsigned offset_db_fmt_cntl = 0; - unsigned tmp; - unsigned prov_vtx = 1; - unsigned polygon_dual_mode; - - if (rctx->clip) - clip = &rctx->clip->state.clip; - if (fb->zsbuf) { - offset_units = state->offset_units; - offset_scale = state->offset_scale * 12.0f; - switch (fb->zsbuf->texture->format) { - case PIPE_FORMAT_Z24X8_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - depth = -24; - offset_units *= 2.0f; - break; - case PIPE_FORMAT_Z32_FLOAT: - depth = -23; - offset_units *= 1.0f; - offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1); - break; - case PIPE_FORMAT_Z16_UNORM: - depth = -16; - offset_units *= 4.0f; - break; - default: - R600_ERR("unsupported %d\n", fb->zsbuf->texture->format); - return; - } - } - offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth); - - if (state->flatshade_first) - prov_vtx = 0; - - rctx->flat_shade = state->flatshade; - radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0); - rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000000; - if (rctx->flat_shade) - rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |= S_0286D4_FLAT_SHADE_ENA(1); - if (state->sprite_coord_enable) { - rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |= - S_0286D4_PNT_SPRITE_ENA(1) | - S_0286D4_PNT_SPRITE_OVRD_X(2) | - S_0286D4_PNT_SPRITE_OVRD_Y(3) | - S_0286D4_PNT_SPRITE_OVRD_Z(0) | - S_0286D4_PNT_SPRITE_OVRD_W(1); - if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) { - rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |= - S_0286D4_PNT_SPRITE_TOP_1(1); - } - } - rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] = 0; - if (clip) { - rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1); - rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp); - rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); - } - polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || - state->fill_back != PIPE_POLYGON_MODE_FILL); - - rstate->states[EG_RASTERIZER__PA_SU_SC_MODE_CNTL] = - S_028814_PROVOKING_VTX_LAST(prov_vtx) | - S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | - S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | - S_028814_FACE(!state->front_ccw) | - S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | - S_028814_POLY_MODE(polygon_dual_mode) | - S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | - S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)); - rstate->states[EG_RASTERIZER__PA_CL_VS_OUT_CNTL] = - S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | - S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex); - rstate->states[EG_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000; - /* point size 12.4 fixed point */ - tmp = (unsigned)(state->point_size * 8.0); - rstate->states[EG_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp); - rstate->states[EG_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000; - rstate->states[EG_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008; - rstate->states[EG_RASTERIZER__PA_SU_VTX_CNTL] = 0x00000005; - - rstate->states[EG_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000; - rstate->states[EG_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400; - rstate->states[EG_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000; - rstate->states[EG_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000; - rstate->states[EG_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000; - rstate->states[EG_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000; - rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl; - rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000; - rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale); - rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units); - rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale); - rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units); - radeon_state_pm4(rstate); -} - -static void eg_scissor(struct r600_context *rctx, struct radeon_state *rstate) -{ - const struct pipe_scissor_state *state = &rctx->scissor->state.scissor; - const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - struct r600_screen *rscreen = rctx->screen; - unsigned minx, maxx, miny, maxy; - u32 tl, br; - - if (state == NULL) { - minx = 0; - miny = 0; - maxx = fb->cbufs[0]->width; - maxy = fb->cbufs[0]->height; - } else { - minx = state->minx; - miny = state->miny; - maxx = state->maxx; - maxy = state->maxy; - } - tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny); - br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy); - radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0); - /* screen scissor has no WINDOW OFFSET */ - rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl; - rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000; - rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl | S_028204_WINDOW_OFFSET_DISABLE(1); - rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl; - rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA; - rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl | S_028240_WINDOW_OFFSET_DISABLE(1); - rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br; - rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl | S_028240_WINDOW_OFFSET_DISABLE(1); - rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br; - radeon_state_pm4(rstate); -} - -static void eg_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); - rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000; - rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000; - rstate->states[EG_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]); - rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]); - rstate->states[EG_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F; - radeon_state_pm4(rstate); -} - -static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate) -{ - const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa; - const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref; - struct r600_screen *rscreen = rctx->screen; - unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; - unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control; - unsigned db_count_control = 0; - struct r600_shader *rshader; - struct r600_query *rquery = NULL; - boolean query_running; - int i; - - if (rctx->ps_shader == NULL) { - return; - } - radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); - - db_shader_control = 0; - db_shader_control |= S_02880C_DUAL_EXPORT_ENABLE(1); - db_shader_control |= S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); - - rshader = &rctx->ps_shader->shader; - if (rshader->uses_kill) - db_shader_control |= S_02880C_KILL_ENABLE(1); - for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) - db_shader_control |= S_02880C_Z_EXPORT_ENABLE(1); - } - stencil_ref_mask = 0; - stencil_ref_mask_bf = 0; - db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | - S_028800_Z_WRITE_ENABLE(state->depth.writemask) | - S_028800_ZFUNC(state->depth.func); - /* set stencil enable */ - - if (state->stencil[0].enabled) { - db_depth_control |= S_028800_STENCIL_ENABLE(1); - db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)); - db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)); - db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)); - db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); - - stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) | - S_028430_STENCILWRITEMASK(state->stencil[0].writemask); - stencil_ref_mask |= S_028430_STENCILREF(stencil_ref->ref_value[0]); - if (state->stencil[1].enabled) { - db_depth_control |= S_028800_BACKFACE_ENABLE(1); - db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)); - db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)); - db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)); - db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); - stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | - S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask); - stencil_ref_mask_bf |= S_028430_STENCILREF(stencil_ref->ref_value[1]); - } - } - - alpha_test_control = 0; - alpha_ref = 0; - if (state->alpha.enabled) { - alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func); - alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1); - alpha_ref = fui(state->alpha.ref_value); - } - - db_render_control = 0; -/// db_render_control = S_028D0C_STENCIL_COMPRESS_DISABLE(1) | -/// S_028D0C_DEPTH_COMPRESS_DISABLE(1); - db_render_override = S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_DISABLE) | - S_02800C_FORCE_HIS_ENABLE0(V_02800C_FORCE_DISABLE) | - S_02800C_FORCE_HIS_ENABLE1(V_02800C_FORCE_DISABLE); - - query_running = FALSE; - - LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { - if (rquery->state & R600_QUERY_STATE_STARTED) { - query_running = TRUE; - } - } - - if (query_running) { - db_render_override |= S_02800C_NOOP_CULL_DISABLE(1); - db_count_control |= S_028004_PERFECT_ZPASS_COUNTS(1); - } - - rstate->states[EG_DSA__DB_STENCIL_CLEAR] = 0x00000000; - rstate->states[EG_DSA__DB_DEPTH_CLEAR] = 0x3F800000; - rstate->states[EG_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control; - rstate->states[EG_DSA__DB_STENCILREFMASK] = stencil_ref_mask; - rstate->states[EG_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf; - rstate->states[EG_DSA__SX_ALPHA_REF] = alpha_ref; - // rstate->states[EG_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000; - // rstate->states[EG_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000; - rstate->states[EG_DSA__SPI_FOG_CNTL] = 0x00000000; - rstate->states[EG_DSA__DB_DEPTH_CONTROL] = db_depth_control; - rstate->states[EG_DSA__DB_SHADER_CONTROL] = db_shader_control; - rstate->states[EG_DSA__DB_RENDER_CONTROL] = db_render_control; - rstate->states[EG_DSA__DB_RENDER_OVERRIDE] = db_render_override; - rstate->states[EG_DSA__DB_COUNT_CONTROL] = db_count_control; - rstate->states[EG_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000; - rstate->states[EG_DSA__DB_PRELOAD_CONTROL] = 0x00000000; - rstate->states[EG_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; - radeon_state_pm4(rstate); -} - - -static INLINE u32 S_FIXED(float value, u32 frac_bits) -{ - return value * (1 << frac_bits); -} - -static void eg_sampler_border(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_sampler_state *state, unsigned id) -{ - struct r600_screen *rscreen = rctx->screen; - union util_color uc; - - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS); - if (uc.ui) { - rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_INDEX] = id; - rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]); - rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]); - rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]); - rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA] = fui(state->border_color[3]); - } - radeon_state_pm4(rstate); -} - -static void eg_sampler(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_sampler_state *state, unsigned id) -{ - struct r600_screen *rscreen = rctx->screen; - union util_color uc; - - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS); - rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] = - S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | - S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | - S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | - S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) | - S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) | - S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) | - S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | - S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0); - /* FIXME LOD it depends on texture base level ... */ - rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] = - S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | - S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)); - - rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] = - S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) | -S_03C008_TYPE(1); - radeon_state_pm4(rstate); - -} - - -static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate, - const struct pipe_sampler_view *view, unsigned id) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_screen *rscreen = rctx->screen; - const struct util_format_description *desc; - struct r600_resource_texture *tmp; - struct r600_resource *rbuffer; - unsigned format; - uint32_t word4 = 0, yuv_format = 0, pitch = 0; - unsigned char swizzle[4]; - - rstate->cpm4 = 0; - swizzle[0] = view->swizzle_r; - swizzle[1] = view->swizzle_g; - swizzle[2] = view->swizzle_b; - swizzle[3] = view->swizzle_a; - format = r600_translate_texformat(view->texture->format, - swizzle, - &word4, &yuv_format); - if (format == ~0) { - return; - } - desc = util_format_description(view->texture->format); - if (desc == NULL) { - R600_ERR("unknow format %d\n", view->texture->format); - return; - } - radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); - tmp = (struct r600_resource_texture*)view->texture; - rbuffer = &tmp->resource; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); - - rstate->nbo = 2; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; - - pitch = align(tmp->pitch[0] / tmp->bpt, 8); - - /* FIXME properly handle first level != 0 */ - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD0] = - S_030000_DIM(r600_tex_dim(view->texture->target)) | - S_030000_PITCH((pitch / 8) - 1) | - S_030000_TEX_WIDTH(view->texture->width0 - 1); - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD1] = - S_030004_TEX_HEIGHT(view->texture->height0 - 1) | - S_030004_TEX_DEPTH(view->texture->depth0 - 1); - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8; - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8; - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD4] = - word4 | - S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) | - S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) | - S_030010_REQUEST_SIZE(1) | - S_030010_BASE_LEVEL(view->first_level); - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD5] = - S_030014_LAST_LEVEL(view->last_level) | - S_030014_BASE_ARRAY(0) | - S_030014_LAST_ARRAY(0); - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD6] = 0; - rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD7] = - S_03001C_DATA_FORMAT(format) | - S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE); - radeon_state_pm4(rstate); -} - -static void eg_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) -{ - struct r600_screen *rscreen = rctx->screen; - const struct pipe_blend_state *pbs = &rctx->blend->state.blend; - int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; - uint32_t color_control, target_mask, shader_mask; - int i; - - target_mask = 0; - shader_mask = 0; - color_control = S_028808_MODE(1); - - for (i = 0; i < nr_cbufs; i++) { - shader_mask |= 0xf << (i * 4); - } - - if (pbs->logicop_enable) { - color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20); - } else { - color_control |= (0xcc << 16); - } - - if (pbs->independent_blend_enable) { - for (i = 0; i < nr_cbufs; i++) { - target_mask |= (pbs->rt[i].colormask << (4 * i)); - } - } else { - for (i = 0; i < nr_cbufs; i++) { - target_mask |= (pbs->rt[0].colormask << (4 * i)); - } - } - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0); - rstate->states[EG_CB_CNTL__CB_SHADER_MASK] = shader_mask; - rstate->states[EG_CB_CNTL__CB_TARGET_MASK] = target_mask; - rstate->states[EG_CB_CNTL__CB_COLOR_CONTROL] = color_control; - rstate->states[EG_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000; - rstate->states[EG_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000; - rstate->states[EG_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; - radeon_state_pm4(rstate); -} - - -static void eg_init_config(struct r600_context *rctx) -{ - int ps_prio; - int vs_prio; - int gs_prio; - int es_prio; - int hs_prio, cs_prio, ls_prio; - int num_ps_gprs; - int num_vs_gprs; - int num_gs_gprs; - int num_es_gprs; - int num_hs_gprs; - int num_ls_gprs; - int num_temp_gprs; - int num_ps_threads; - int num_vs_threads; - int num_gs_threads; - int num_es_threads; - int num_hs_threads; - int num_ls_threads; - int num_ps_stack_entries; - int num_vs_stack_entries; - int num_gs_stack_entries; - int num_es_stack_entries; - int num_hs_stack_entries; - int num_ls_stack_entries; - enum radeon_family family; - - family = radeon_get_family(rctx->rw); - ps_prio = 0; - vs_prio = 1; - gs_prio = 2; - es_prio = 3; - hs_prio = 0; - ls_prio = 0; - cs_prio = 0; - - switch (family) { - case CHIP_CEDAR: - default: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 96; - num_vs_threads = 16; - num_gs_threads = 16; - num_es_threads = 16; - num_hs_threads = 16; - num_ls_threads = 16; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_REDWOOD: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 42; - num_vs_stack_entries = 42; - num_gs_stack_entries = 42; - num_es_stack_entries = 42; - num_hs_stack_entries = 42; - num_ls_stack_entries = 42; - break; - case CHIP_JUNIPER: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 85; - num_vs_stack_entries = 85; - num_gs_stack_entries = 85; - num_es_stack_entries = 85; - num_hs_stack_entries = 85; - num_ls_stack_entries = 85; - break; - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - num_ps_gprs = 93; - num_vs_gprs = 46; - num_temp_gprs = 4; - num_gs_gprs = 31; - num_es_gprs = 31; - num_hs_gprs = 23; - num_ls_gprs = 23; - num_ps_threads = 128; - num_vs_threads = 20; - num_gs_threads = 20; - num_es_threads = 20; - num_hs_threads = 20; - num_ls_threads = 20; - num_ps_stack_entries = 85; - num_vs_stack_entries = 85; - num_gs_stack_entries = 85; - num_es_stack_entries = 85; - num_hs_stack_entries = 85; - num_ls_stack_entries = 85; - break; - } - - radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0); - - rctx->config.states[EG_CONFIG__SQ_CONFIG] = 0x00000000; - switch (family) { - case CHIP_CEDAR: - break; - default: - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1); - break; - } - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_EXPORT_SRC_C(1); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_CS_PRIO(cs_prio); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_LS_PRIO(ls_prio); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_HS_PRIO(hs_prio); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio); - rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio); - - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0; - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs); - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs); - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0; - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs); - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_ES_GPRS(num_es_gprs); - - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] = 0; - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] |= S_008C0C_NUM_HS_GPRS(num_hs_gprs); - rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] |= S_008C0C_NUM_LS_GPRS(num_ls_gprs); - - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] = 0; - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_PS_THREADS(num_ps_threads); - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_VS_THREADS(num_vs_threads); - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_GS_THREADS(num_gs_threads); - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_ES_THREADS(num_es_threads); - - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] = 0; - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] |= S_008C1C_NUM_HS_THREADS(num_hs_threads); - rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] |= S_008C1C_NUM_LS_THREADS(num_ls_threads); - - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0; - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0; - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] = 0; - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries); - rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries); - - rctx->config.states[EG_CONFIG__SPI_CONFIG_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__SPI_CONFIG_CNTL_1] = S_00913C_VTX_DONE_DELAY(4); - - rctx->config.states[EG_CONFIG__SX_MISC] = 0x00000000; - - rctx->config.states[EG_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000; - rctx->config.states[EG_CONFIG__PA_SC_MODE_CNTL_0] = 0x0; - rctx->config.states[EG_CONFIG__PA_SC_MODE_CNTL_1] = 0x0; - - rctx->config.states[EG_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000; - - rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_1] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_2] = 0x00000000; - rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_3] = 0x00000000; - - rctx->config.states[EG_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_HOS_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_DECR] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_GS_MODE] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_STRMOUT_CONFIG] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_STRMOUT_BUFFER_CONFIG] = 0x00000000; - rctx->config.states[EG_CONFIG__VGT_REUSE_OFF] = 0x00000001; - rctx->config.states[EG_CONFIG__VGT_VTX_CNT_EN] = 0x00000000; -// rctx->config.states[EG_CONFIG__VGT_CACHE_INVALIDATION] = 0x2; -// rctx->config.states[EG_CONFIG__VGT_GS_VERTEX_REUSE] = 0x16; - rctx->config.states[EG_CONFIG__PA_CL_ENHANCE] = (3 << 1) | 1; - - radeon_state_pm4(&rctx->config); -} - -static int eg_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset, - uint32_t stride, uint32_t src_format) -{ - struct radeon_state *vs_resource = &rctx->vs_resource[id]; - struct r600_screen *rscreen = rctx->screen; - unsigned format, num_format = 0, format_comp = 0; - - format = r600_translate_colorformat(src_format); - - r600_translate_vertex_num_format(src_format, &num_format, &format_comp); - format = S_030008_DATA_FORMAT(format) | S_030008_NUM_FORMAT_ALL(num_format) | - S_030008_FORMAT_COMP_ALL(format_comp); - - radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS); - - radeon_ws_bo_reference(rscreen->rw, &vs_resource->bo[0], rbuffer->bo); - vs_resource->nbo = 1; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD0] = offset; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->size - offset - 1; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = S_030008_STRIDE(stride) | format; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) | - S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) | - S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) | - S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W); - - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD6] = 0x00000000; - vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD7] = 0xC0000000; - vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT; - vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT; - return radeon_state_pm4(vs_resource); -} - -static int eg_draw_vgt_init(struct r600_draw *draw, - int vgt_draw_initiator) -{ - struct r600_context *rctx = r600_context(draw->ctx); - struct r600_screen *rscreen = rctx->screen; - struct r600_resource *rbuffer = (struct r600_resource *)draw->index_buffer; - radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0); - draw->draw.states[EG_DRAW__VGT_NUM_INDICES] = draw->count; - draw->draw.states[EG_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; - draw->draw.states[EG_DRAW__VGT_DMA_BASE] = draw->index_buffer_offset; - if (rbuffer) { - radeon_ws_bo_reference(rscreen->rw, &draw->draw.bo[0], rbuffer->bo); - draw->draw.placement[0] = RADEON_GEM_DOMAIN_GTT; - draw->draw.placement[1] = RADEON_GEM_DOMAIN_GTT; - draw->draw.nbo = 1; - } - return radeon_state_pm4(&draw->draw); -} - -static int eg_draw_vgt_prim(struct r600_draw *draw, - uint32_t prim, uint32_t vgt_dma_index_type) -{ - struct r600_context *rctx = r600_context(draw->ctx); - struct r600_screen *rscreen = rctx->screen; - radeon_state_init(&draw->vgt, rscreen->rw, R600_STATE_VGT, 0, 0); - draw->vgt.states[EG_VGT__VGT_PRIMITIVE_TYPE] = prim; - draw->vgt.states[EG_VGT__VGT_MAX_VTX_INDX] = draw->max_index; - draw->vgt.states[EG_VGT__VGT_MIN_VTX_INDX] = draw->min_index; - draw->vgt.states[EG_VGT__VGT_INDX_OFFSET] = draw->index_bias; - draw->vgt.states[EG_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; - draw->vgt.states[EG_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; - draw->vgt.states[EG_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; - draw->vgt.states[EG_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000; - draw->vgt.states[EG_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000; - draw->vgt.states[EG_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000; - return radeon_state_pm4(&draw->vgt); -} - - -static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rpshader, - struct radeon_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - const struct pipe_rasterizer_state *rasterizer; - struct r600_shader *rshader = &rpshader->shader; - unsigned i, tmp, exports_ps, num_cout; - boolean have_pos = FALSE, have_face = FALSE; - - rasterizer = &rctx->rasterizer->state.rasterizer; - - radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); - for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)); - if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) - have_pos = TRUE; - if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || - rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || - rshader->input[i].name == TGSI_SEMANTIC_POSITION) { - tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); - } - - if (rshader->input[i].name == TGSI_SEMANTIC_FACE) - have_face = TRUE; - - if (rasterizer->sprite_coord_enable & (1 << i)) { - tmp |= S_028644_PT_SPRITE_TEX(1); - } - state->states[EG_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp; - } - - exports_ps = 0; - num_cout = 0; - for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) - exports_ps |= 1; - else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { - num_cout++; - } - } - exports_ps |= (1 << num_cout); - if (!exports_ps) { - /* always at least export 1 component per pixel */ - exports_ps = 2; - } - state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) | - S_0286CC_PERSP_GRADIENT_ENA(1); - if (have_pos) { - state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1); - state->states[EG_PS_SHADER__SPI_INPUT_Z] |= 1; - } - - state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000; - state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face); - - state->states[EG_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) | - S_028844_STACK_SIZE(rshader->bc.nstack); - state->states[EG_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; - state->states[EG_PS_SHADER__SPI_BARYC_CNTL] = S_0286E0_PERSP_CENTROID_ENA(1) | - S_0286E0_LINEAR_CENTROID_ENA(1); - radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo); - state->nbo = 1; - state->placement[0] = RADEON_GEM_DOMAIN_GTT; - return radeon_state_pm4(state); -} - -static int eg_vs_shader(struct r600_context *rctx, struct r600_context_state *rpshader, - struct radeon_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_shader *rshader = &rpshader->shader; - unsigned i, tmp; - - radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); - for (i = 0; i < 10; i++) { - state->states[EG_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0; - } - /* so far never got proper semantic id from tgsi */ - for (i = 0; i < 32; i++) { - tmp = i << ((i & 3) * 8); - state->states[EG_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp; - } - state->states[EG_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2); - state->states[EG_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028860_NUM_GPRS(rshader->bc.ngpr) | - S_028860_STACK_SIZE(rshader->bc.nstack); - radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo); - radeon_ws_bo_reference(rscreen->rw, &state->bo[1], rpshader->bo); - state->nbo = 2; - state->placement[0] = RADEON_GEM_DOMAIN_GTT; - state->placement[2] = RADEON_GEM_DOMAIN_GTT; - return radeon_state_pm4(state); - -} - -struct r600_context_hw_state_vtbl eg_hw_state_vtbl = { - .blend = eg_blend, - .ucp = eg_ucp, - .cb = eg_cb, - .db = eg_db, - .rasterizer = eg_rasterizer, - .scissor = eg_scissor, - .viewport = eg_viewport, - .dsa = eg_dsa, - .sampler_border = eg_sampler_border, - .sampler = eg_sampler, - .resource = eg_resource, - .cb_cntl = eg_cb_cntl, - .vs_resource = eg_vs_resource, - .vgt_init = eg_draw_vgt_init, - .vgt_prim = eg_draw_vgt_prim, - .vs_shader = eg_vs_shader, - .ps_shader = eg_ps_shader, - .init_config = eg_init_config, -}; - -void eg_set_constant_buffer(struct pipe_context *ctx, - uint shader, uint index, - struct pipe_resource *buffer) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, type, shader_class, size; - struct radeon_state *rstate, *rstates; - struct r600_resource *rbuffer = (struct r600_resource*)buffer; - - type = R600_STATE_CBUF; - - switch (shader) { - case PIPE_SHADER_VERTEX: - shader_class = R600_SHADER_VS; - rstates = rctx->vs_constant; - break; - case PIPE_SHADER_FRAGMENT: - shader_class = R600_SHADER_PS; - rstates = rctx->ps_constant; - break; - default: - R600_ERR("unsupported %d\n", shader); - return; - } - - rstate = &rstates[0]; - -#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) - nconstant = buffer->width0 / 16; - size = ALIGN_DIVUP(nconstant, 16); - - radeon_state_init(rstate, rscreen->rw, type, 0, shader_class); - rstate->states[EG_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size; - rstate->states[EG_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0; - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - if (radeon_state_pm4(rstate)) - return; - radeon_draw_bind(&rctx->draw, rstate); -} diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 58d753ef5e2..f0b74ad8740 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -26,6 +26,7 @@ #ifndef R600_H #define R600_H +#include #include #include #include diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index fcdcad3edf8..dc8dc9fe436 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -20,14 +20,13 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "radeon.h" -#include "r600_context.h" +#include +#include #include "util/u_memory.h" +#include "r600_pipe.h" #include "r600_sq.h" #include "r600_opcodes.h" #include "r600_asm.h" -#include -#include static inline unsigned int r600_bc_get_num_operands(struct r600_bc_alu *alu) { diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c deleted file mode 100644 index 357776c55ef..00000000000 --- a/src/gallium/drivers/r600/r600_blit.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright 2009 Marek Olšák - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Marek Olšák - */ -#include -#include -#include -#include -#include -#include "util/u_surface.h" -#include "r600_screen.h" -#include "r600_context.h" - -static void r600_blitter_save_states(struct pipe_context *ctx) -{ - struct r600_context *rctx = r600_context(ctx); - - util_blitter_save_blend(rctx->blitter, rctx->blend); - util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->dsa); - if (rctx->stencil_ref) { - util_blitter_save_stencil_ref(rctx->blitter, - &rctx->stencil_ref->state.stencil_ref); - } - util_blitter_save_rasterizer(rctx->blitter, rctx->rasterizer); - util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader); - util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader); - util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements); - if (rctx->viewport) { - util_blitter_save_viewport(rctx->blitter, &rctx->viewport->state.viewport); - } - if (rctx->clip) { - util_blitter_save_clip(rctx->blitter, &rctx->clip->state.clip); - } - util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, - rctx->vertex_buffer); - - /* remove ptr so they don't get deleted */ - rctx->blend = NULL; - rctx->clip = NULL; - rctx->vs_shader = NULL; - rctx->ps_shader = NULL; - rctx->rasterizer = NULL; - rctx->dsa = NULL; - rctx->vertex_elements = NULL; - - /* suspend queries */ - r600_queries_suspend(ctx); -} - -static void r600_clear(struct pipe_context *ctx, unsigned buffers, - const float *rgba, double depth, unsigned stencil) -{ - struct r600_context *rctx = r600_context(ctx); - struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - - r600_blitter_save_states(ctx); - util_blitter_clear(rctx->blitter, fb->width, fb->height, - fb->nr_cbufs, buffers, rgba, depth, - stencil); - /* resume queries */ - r600_queries_resume(ctx); -} - -static void r600_clear_render_target(struct pipe_context *ctx, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) -{ - struct r600_context *rctx = r600_context(ctx); - struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - - r600_blitter_save_states(ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - - util_blitter_clear_render_target(rctx->blitter, dst, rgba, - dstx, dsty, width, height); - /* resume queries */ - r600_queries_resume(ctx); -} - -static void r600_clear_depth_stencil(struct pipe_context *ctx, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) -{ - struct r600_context *rctx = r600_context(ctx); - struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - - r600_blitter_save_states(ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - - util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, - dstx, dsty, width, height); - /* resume queries */ - r600_queries_resume(ctx); -} - - -static void r600_resource_copy_region(struct pipe_context *ctx, - struct pipe_resource *dst, - struct pipe_subresource subdst, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - struct pipe_subresource subsrc, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height) -{ - util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, - src, subsrc, srcx, srcy, srcz, width, height); -} - -static void *r600_create_db_flush_dsa(struct r600_context *rctx) -{ - struct r600_screen *rscreen = rctx->screen; - struct pipe_depth_stencil_alpha_state dsa; - struct r600_context_state *state; - boolean quirk = false; - enum radeon_family family; - - family = radeon_get_family(rscreen->rw); - if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 || - family == CHIP_RV635) - quirk = true; - - memset(&dsa, 0, sizeof(dsa)); - - if (quirk) { - dsa.depth.enabled = 1; - dsa.depth.func = PIPE_FUNC_LEQUAL; - dsa.stencil[0].enabled = 1; - dsa.stencil[0].func = PIPE_FUNC_ALWAYS; - dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; - dsa.stencil[0].writemask = 0xff; - } - - state = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); - state->flags |= R600_STATE_FLAG_DSA_FLUSH; - return state; - -} - -void r600_init_blit_functions(struct r600_context *rctx) -{ - rctx->context.clear = r600_clear; - rctx->context.clear_render_target = r600_clear_render_target; - rctx->context.clear_depth_stencil = r600_clear_depth_stencil; - rctx->context.resource_copy_region = r600_resource_copy_region; - - /* create a custom depth stencil for DB flush */ - rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); -} - -int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) -{ - struct r600_context *rctx = r600_context(ctx); - struct pipe_framebuffer_state *fb = rctx->pframebuffer; - struct pipe_surface *zsurf, *cbsurf; - int level = 0; - float depth = 1.0f; - - zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, - PIPE_BIND_DEPTH_STENCIL); - - cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0, - PIPE_BIND_RENDER_TARGET); - - r600_blitter_save_states(ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - - if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || - rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) - depth = 0.0f; - - util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); - - pipe_surface_reference(&zsurf, NULL); - pipe_surface_reference(&cbsurf, NULL); - - /* resume queries */ - r600_queries_resume(ctx); - return 0; -} diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index d734e2349fb..69caba2fbc4 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -31,9 +31,10 @@ #include #include #include "state_tracker/drm_driver.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_resource.h" +#include +#include "radeon_drm.h" +#include "r600.h" +#include "r600_pipe.h" extern struct u_resource_vtbl r600_buffer_vtbl; @@ -67,7 +68,6 @@ u32 r600_domain_from_usage(unsigned usage) struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ) { - struct r600_screen *rscreen = r600_screen(screen); struct r600_resource_buffer *rbuffer; struct radeon_ws_bo *bo; /* XXX We probably want a different alignment for buffers and textures. */ @@ -86,7 +86,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, rbuffer->r.base.vtbl = &r600_buffer_vtbl; rbuffer->r.size = rbuffer->r.base.b.width0; rbuffer->r.domain = r600_domain_from_usage(rbuffer->r.base.b.bind); - bo = radeon_ws_bo(rscreen->rw, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind); + bo = radeon_ws_bo((struct radeon*)screen->winsys, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind); if (bo == NULL) { FREE(rbuffer); return NULL; @@ -127,10 +127,9 @@ static void r600_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *buf) { struct r600_resource_buffer *rbuffer = r600_buffer(buf); - struct r600_screen *rscreen = r600_screen(screen); if (rbuffer->r.bo) { - radeon_ws_bo_reference(rscreen->rw, &rbuffer->r.bo, NULL); + radeon_ws_bo_reference((struct radeon*)screen->winsys, &rbuffer->r.bo, NULL); } FREE(rbuffer); } @@ -139,7 +138,6 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource); - struct r600_screen *rscreen = r600_screen(pipe->screen); int write = 0; uint8_t *data; int i; @@ -155,9 +153,9 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, flush = TRUE; if (flush) { - radeon_ws_bo_reference(rscreen->rw, &rbuffer->r.bo, NULL); + radeon_ws_bo_reference((struct radeon*)pipe->winsys, &rbuffer->r.bo, NULL); rbuffer->num_ranges = 0; - rbuffer->r.bo = radeon_ws_bo(rscreen->rw, + rbuffer->r.bo = radeon_ws_bo((struct radeon*)pipe->winsys, rbuffer->r.base.b.width0, 0, rbuffer->r.base.b.bind); break; @@ -170,7 +168,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, if (transfer->usage & PIPE_TRANSFER_WRITE) { write = 1; } - data = radeon_ws_bo_map(rscreen->rw, rbuffer->r.bo, transfer->usage, pipe); + data = radeon_ws_bo_map((struct radeon*)pipe->winsys, rbuffer->r.bo, transfer->usage, pipe); if (!data) return NULL; @@ -181,10 +179,9 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource); - struct r600_screen *rscreen = r600_screen(pipe->screen); if (rbuffer->r.bo) - radeon_ws_bo_unmap(rscreen->rw, rbuffer->r.bo); + radeon_ws_bo_unmap((struct radeon*)pipe->winsys, rbuffer->r.bo); } static void r600_buffer_transfer_flush_region(struct pipe_context *pipe, @@ -261,62 +258,3 @@ struct u_resource_vtbl r600_buffer_vtbl = r600_buffer_transfer_unmap, /* transfer_unmap */ u_default_transfer_inline_write /* transfer_inline_write */ }; - -int r600_upload_index_buffer(struct r600_context *rctx, - struct r600_draw *draw) -{ - struct pipe_resource *upload_buffer = NULL; - unsigned index_offset = draw->index_buffer_offset; - int ret = 0; - - if (r600_buffer_is_user_buffer(draw->index_buffer)) { - ret = u_upload_buffer(rctx->upload_ib, - index_offset, - draw->count * draw->index_size, - draw->index_buffer, - &index_offset, - &upload_buffer); - if (ret) { - goto done; - } - draw->index_buffer_offset = index_offset; - - /* Transfer ownership. */ - pipe_resource_reference(&draw->index_buffer, upload_buffer); - pipe_resource_reference(&upload_buffer, NULL); - } - -done: - return ret; -} - -int r600_upload_user_buffers(struct r600_context *rctx) -{ - enum pipe_error ret = PIPE_OK; - int i, nr; - - nr = rctx->vertex_elements->count; - - for (i = 0; i < nr; i++) { - struct pipe_vertex_buffer *vb = - &rctx->vertex_buffer[rctx->vertex_elements->elements[i].vertex_buffer_index]; - - if (r600_buffer_is_user_buffer(vb->buffer)) { - struct pipe_resource *upload_buffer = NULL; - unsigned offset = 0; /*vb->buffer_offset * 4;*/ - unsigned size = vb->buffer->width0; - unsigned upload_offset; - ret = u_upload_buffer(rctx->upload_vb, - offset, size, - vb->buffer, - &upload_offset, &upload_buffer); - if (ret) - return ret; - - pipe_resource_reference(&vb->buffer, NULL); - vb->buffer = upload_buffer; - vb->buffer_offset = upload_offset; - } - } - return ret; -} diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c deleted file mode 100644 index 091751e93a9..00000000000 --- a/src/gallium/drivers/r600/r600_context.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Corbin Simpson - */ -#include -#include -#include -#include -#include -#include -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_resource.h" - -static void r600_destroy_context(struct pipe_context *context) -{ - struct r600_context *rctx = r600_context(context); - - rctx->rasterizer = r600_context_state_decref(rctx->rasterizer); - rctx->poly_stipple = r600_context_state_decref(rctx->poly_stipple); - rctx->scissor = r600_context_state_decref(rctx->scissor); - rctx->clip = r600_context_state_decref(rctx->clip); - rctx->ps_shader = r600_context_state_decref(rctx->ps_shader); - rctx->vs_shader = r600_context_state_decref(rctx->vs_shader); - rctx->depth = r600_context_state_decref(rctx->depth); - rctx->stencil = r600_context_state_decref(rctx->stencil); - rctx->alpha = r600_context_state_decref(rctx->alpha); - rctx->dsa = r600_context_state_decref(rctx->dsa); - rctx->blend = r600_context_state_decref(rctx->blend); - rctx->stencil_ref = r600_context_state_decref(rctx->stencil_ref); - rctx->viewport = r600_context_state_decref(rctx->viewport); - rctx->framebuffer = r600_context_state_decref(rctx->framebuffer); - - free(rctx->ps_constant); - free(rctx->vs_constant); - free(rctx->vs_resource); - - util_blitter_destroy(rctx->blitter); - - u_upload_destroy(rctx->upload_vb); - u_upload_destroy(rctx->upload_ib); - - radeon_ctx_fini(rctx->ctx); - FREE(rctx); -} - -void r600_flush(struct pipe_context *ctx, unsigned flags, - struct pipe_fence_handle **fence) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_query *rquery = NULL; -#if 0 - static int dc = 0; - char dname[256]; -#endif - - /* flush upload buffers */ - u_upload_flush(rctx->upload_vb); - u_upload_flush(rctx->upload_ib); - - /* suspend queries */ - r600_queries_suspend(ctx); - - -#if 0 - sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 20) { - radeon_ctx_dump_bof(rctx->ctx, dname); - R600_ERR("dumped %s\n", dname); - } - dc++; -#endif - - radeon_ctx_submit(rctx->ctx); - - LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { - rquery->flushed = TRUE; - } - - radeon_ctx_clear(rctx->ctx); - /* resume queries */ - r600_queries_resume(ctx); -} - -struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) -{ - struct r600_context *rctx = CALLOC_STRUCT(r600_context); - struct r600_screen* rscreen = r600_screen(screen); - - if (rctx == NULL) - return NULL; - rctx->context.winsys = rscreen->screen.winsys; - rctx->context.screen = screen; - rctx->context.priv = priv; - rctx->context.destroy = r600_destroy_context; - rctx->context.draw_vbo = r600_draw_vbo; - rctx->context.flush = r600_flush; - - /* Easy accessing of screen/winsys. */ - rctx->screen = rscreen; - rctx->rw = rscreen->rw; - - if (radeon_get_family_class(rscreen->rw) == EVERGREEN) - rctx->vtbl = &eg_hw_state_vtbl; - else - rctx->vtbl = &r600_hw_state_vtbl; - - r600_init_query_functions(rctx); - r600_init_state_functions(rctx); - r600_init_context_resource_functions(rctx); - - r600_init_blit_functions(rctx); - - rctx->blitter = util_blitter_create(&rctx->context); - if (rctx->blitter == NULL) { - FREE(rctx); - return NULL; - } - - rctx->vtbl->init_config(rctx); - - rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16, - PIPE_BIND_INDEX_BUFFER); - if (rctx->upload_ib == NULL) { - goto out_free; - } - - rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16, - PIPE_BIND_VERTEX_BUFFER); - if (rctx->upload_vb == NULL) { - goto out_free; - } - - rctx->vs_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state)); - if (!rctx->vs_constant) { - goto out_free; - } - - rctx->ps_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state)); - if (!rctx->ps_constant) { - goto out_free; - } - - rctx->vs_resource = (struct radeon_state *)calloc(R600_MAX_RESOURCE, sizeof(struct radeon_state)); - if (!rctx->vs_resource) { - goto out_free; - } - - rctx->ctx = radeon_ctx_init(rscreen->rw); - radeon_draw_init(&rctx->draw, rscreen->rw); - r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth; - return &rctx->context; - out_free: - FREE(rctx); - return NULL; -} diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h deleted file mode 100644 index d104531d365..00000000000 --- a/src/gallium/drivers/r600/r600_context.h +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - */ -#ifndef R600_CONTEXT_H -#define R600_CONTEXT_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include "radeon.h" -#include "r600_shader.h" - -struct u_upload_mgr; - -#define R600_QUERY_STATE_STARTED (1 << 0) -#define R600_QUERY_STATE_ENDED (1 << 1) -#define R600_QUERY_STATE_SUSPENDED (1 << 2) - -struct r600_query { - u64 result; - /* The kind of query. Currently only OQ is supported. */ - unsigned type; - /* How many results have been written, in dwords. It's incremented - * after end_query and flush. */ - unsigned num_results; - /* if we've flushed the query */ - boolean flushed; - unsigned state; - /* The buffer where query results are stored. */ - struct radeon_ws_bo *buffer; - unsigned buffer_size; - /* linked list of queries */ - struct list_head list; - struct radeon_state rstate; -}; - -/* XXX move this to a more appropriate place */ -union pipe_states { - struct pipe_rasterizer_state rasterizer; - struct pipe_poly_stipple poly_stipple; - struct pipe_scissor_state scissor; - struct pipe_clip_state clip; - struct pipe_shader_state shader; - struct pipe_depth_state depth; - struct pipe_stencil_state stencil; - struct pipe_alpha_state alpha; - struct pipe_depth_stencil_alpha_state dsa; - struct pipe_blend_state blend; - struct pipe_blend_color blend_color; - struct pipe_stencil_ref stencil_ref; - struct pipe_framebuffer_state framebuffer; - struct pipe_sampler_state sampler; - struct pipe_sampler_view sampler_view; - struct pipe_viewport_state viewport; -}; - -enum pipe_state_type { - pipe_rasterizer_type = 1, - pipe_poly_stipple_type, - pipe_scissor_type, - pipe_clip_type, - pipe_shader_type, - pipe_depth_type, - pipe_stencil_type, - pipe_alpha_type, - pipe_dsa_type, - pipe_blend_type, - pipe_stencil_ref_type, - pipe_framebuffer_type, - pipe_sampler_type, - pipe_sampler_view_type, - pipe_viewport_type, - pipe_type_count -}; - -#define R600_MAX_RSTATE 16 -#define R600_STATE_FLAG_DSA_FLUSH 1 - -struct r600_context_state { - union pipe_states state; - unsigned refcount; - unsigned type; - struct radeon_state rstate[R600_MAX_RSTATE]; - struct r600_shader shader; - struct radeon_ws_bo *bo; - unsigned nrstate; - unsigned flags; -}; - -struct r600_vertex_element -{ - unsigned refcount; - unsigned count; - struct pipe_vertex_element elements[32]; -}; - -struct r600_draw { - struct pipe_context *ctx; - struct radeon_state draw; - struct radeon_state vgt; - unsigned mode; - unsigned start; - unsigned count; - unsigned index_size; - struct pipe_resource *index_buffer; - unsigned index_buffer_offset; - unsigned min_index, max_index; - unsigned index_bias; -}; - -struct r600_context_hw_states { - struct radeon_state rasterizer; - struct radeon_state scissor; - struct radeon_state dsa; - struct radeon_state cb_cntl; - - struct radeon_state db_flush; - struct radeon_state cb_flush; -}; - -#define R600_MAX_CONSTANT 256 /* magic */ -#define R600_MAX_RESOURCE 160 /* magic */ - -struct r600_shader_sampler_states { - unsigned nsampler; - unsigned nview; - unsigned nborder; - struct radeon_state *sampler[PIPE_MAX_ATTRIBS]; - struct radeon_state *view[PIPE_MAX_ATTRIBS]; - struct radeon_state *border[PIPE_MAX_ATTRIBS]; -}; - -struct r600_context; -struct r600_screen; -struct r600_resource; -struct r600_resource_texture; - -struct r600_context_hw_state_vtbl { - void (*blend)(struct r600_context *rctx, - struct radeon_state *rstate, - const struct pipe_blend_state *state); - void (*ucp)(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_clip_state *state); - void (*cb)(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_framebuffer_state *state, int cb); - void (*db)(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_framebuffer_state *state); - void (*rasterizer)(struct r600_context *rctx, struct radeon_state *rstate); - void (*scissor)(struct r600_context *rctx, struct radeon_state *rstate); - void (*viewport)(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state); - void (*dsa)(struct r600_context *rctx, struct radeon_state *rstate); - void (*sampler_border)(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_sampler_state *state, unsigned id); - void (*sampler)(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_sampler_state *state, unsigned id); - void (*resource)(struct pipe_context *ctx, struct radeon_state *rstate, - const struct pipe_sampler_view *view, unsigned id); - void (*cb_cntl)(struct r600_context *rctx, struct radeon_state *rstate); - int (*vs_resource)(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset, - uint32_t stride, uint32_t format); - int (*vgt_init)(struct r600_draw *draw, - int vgt_draw_initiator); - int (*vgt_prim)(struct r600_draw *draw, - uint32_t prim, uint32_t vgt_dma_index_type); - - int (*ps_shader)(struct r600_context *rctx, struct r600_context_state *rshader, - struct radeon_state *state); - int (*vs_shader)(struct r600_context *rctx, struct r600_context_state *rpshader, - struct radeon_state *state); - void (*init_config)(struct r600_context *rctx); -}; -extern struct r600_context_hw_state_vtbl r600_hw_state_vtbl; -extern struct r600_context_hw_state_vtbl eg_hw_state_vtbl; - -struct r600_context { - struct pipe_context context; - struct blitter_context *blitter; - struct pipe_framebuffer_state *pframebuffer; - unsigned family; - void *custom_dsa_flush; - struct list_head query_list; - struct r600_screen *screen; - struct radeon *rw; - struct radeon_ctx *ctx; - struct radeon_draw draw; - struct r600_context_hw_state_vtbl *vtbl; - struct radeon_state config; - boolean use_mem_constant; - /* FIXME get rid of those vs_resource,vs/ps_constant */ - struct radeon_state *vs_resource; - unsigned vs_nresource; - struct radeon_state *vs_constant; - struct radeon_state *ps_constant; - /* hw states */ - struct r600_context_hw_states hw_states; - /* pipe states */ - unsigned flat_shade; - - unsigned nvertex_buffer; - struct r600_context_state *rasterizer; - struct r600_context_state *poly_stipple; - struct r600_context_state *scissor; - struct r600_context_state *clip; - struct r600_context_state *ps_shader; - struct r600_context_state *vs_shader; - struct r600_context_state *depth; - struct r600_context_state *stencil; - struct r600_context_state *alpha; - struct r600_context_state *dsa; - struct r600_context_state *blend; - struct r600_context_state *stencil_ref; - struct r600_context_state *viewport; - struct r600_context_state *framebuffer; - struct r600_shader_sampler_states vs_sampler; - struct r600_shader_sampler_states ps_sampler; - /* can add gs later */ - struct r600_vertex_element *vertex_elements; - struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - struct pipe_index_buffer index_buffer; - struct pipe_blend_color blend_color; - - /* upload managers */ - struct u_upload_mgr *upload_vb; - struct u_upload_mgr *upload_ib; - bool any_user_vbs; -}; - -/* Convenience cast wrapper. */ -static INLINE struct r600_context *r600_context(struct pipe_context *pipe) -{ - return (struct r600_context*)pipe; -} - -static INLINE struct r600_query* r600_query(struct pipe_query* q) -{ - return (struct r600_query*)q; -} - -struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate); -struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate); -void r600_flush(struct pipe_context *ctx, unsigned flags, - struct pipe_fence_handle **fence); - -int r600_context_hw_states(struct pipe_context *ctx); - -void r600_draw_vbo(struct pipe_context *ctx, - const struct pipe_draw_info *info); - -void r600_init_blit_functions(struct r600_context *rctx); -void r600_init_state_functions(struct r600_context *rctx); -void r600_init_query_functions(struct r600_context* rctx); -struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv); - -extern int r600_pipe_shader_create(struct pipe_context *ctx, - struct r600_context_state *rstate, - const struct tgsi_token *tokens); -extern int r600_pipe_shader_update(struct pipe_context *ctx, - struct r600_context_state *rstate); -extern int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id); - -#define R600_ERR(fmt, args...) \ - fprintf(stderr, "EE %s/%s:%d - "fmt, __FILE__, __func__, __LINE__, ##args) - -uint32_t r600_translate_texformat(enum pipe_format format, - const unsigned char *swizzle_view, - uint32_t *word4_p, uint32_t *yuv_format_p); - -/* query */ -extern void r600_queries_resume(struct pipe_context *ctx); -extern void r600_queries_suspend(struct pipe_context *ctx); - -int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf); - -void r600_set_constant_buffer_file(struct pipe_context *ctx, - uint shader, uint index, - struct pipe_resource *buffer); -void r600_set_constant_buffer_mem(struct pipe_context *ctx, - uint shader, uint index, - struct pipe_resource *buffer); -void eg_set_constant_buffer(struct pipe_context *ctx, - uint shader, uint index, - struct pipe_resource *buffer); - -int r600_upload_index_buffer(struct r600_context *rctx, - struct r600_draw *draw); -int r600_upload_user_buffers(struct r600_context *rctx); - -#endif diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c deleted file mode 100644 index c41156f15fd..00000000000 --- a/src/gallium/drivers/r600/r600_draw.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Corbin Simpson - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "radeon.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_resource.h" -#include "r600_state_inlines.h" - -static void r600_translate_index_buffer(struct r600_context *r600, - struct pipe_resource **index_buffer, - unsigned *index_size, - unsigned *start, unsigned count) -{ - switch (*index_size) { - case 1: - util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count); - *index_size = 2; - *start = 0; - break; - - case 2: - if (*start % 2 != 0) { - util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count); - *start = 0; - } - break; - - case 4: - break; - } -} - -static int r600_draw_common(struct r600_draw *draw) -{ - struct r600_context *rctx = r600_context(draw->ctx); - /* FIXME vs_resource */ - struct radeon_state *vs_resource; - struct r600_resource *rbuffer; - unsigned i, j, offset, prim; - u32 vgt_dma_index_type, vgt_draw_initiator; - struct pipe_vertex_buffer *vertex_buffer; - int r; - - r = r600_context_hw_states(draw->ctx); - if (r) - return r; - switch (draw->index_size) { - case 2: - vgt_draw_initiator = S_0287F0_SOURCE_SELECT(V_0287F0_DI_SRC_SEL_DMA); - vgt_dma_index_type = 0; - break; - case 4: - vgt_draw_initiator = S_0287F0_SOURCE_SELECT(V_0287F0_DI_SRC_SEL_DMA); - vgt_dma_index_type = 1; - break; - case 0: - vgt_draw_initiator = S_0287F0_SOURCE_SELECT(V_0287F0_DI_SRC_SEL_AUTO_INDEX); - vgt_dma_index_type = 0; - break; - default: - fprintf(stderr, "%s %d unsupported index size %d\n", __func__, __LINE__, draw->index_size); - return -EINVAL; - } - r = r600_conv_pipe_prim(draw->mode, &prim); - if (r) - return r; - - /* rebuild vertex shader if input format changed */ - r = r600_pipe_shader_update(draw->ctx, rctx->vs_shader); - if (r) - return r; - r = r600_pipe_shader_update(draw->ctx, rctx->ps_shader); - if (r) - return r; - radeon_draw_bind(&rctx->draw, &rctx->vs_shader->rstate[0]); - radeon_draw_bind(&rctx->draw, &rctx->ps_shader->rstate[0]); - - for (i = 0 ; i < rctx->vs_nresource; i++) { - radeon_state_fini(&rctx->vs_resource[i]); - } - for (i = 0 ; i < rctx->vertex_elements->count; i++) { - vs_resource = &rctx->vs_resource[i]; - j = rctx->vertex_elements->elements[i].vertex_buffer_index; - vertex_buffer = &rctx->vertex_buffer[j]; - rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - - rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->elements[i].src_format); - radeon_draw_bind(&rctx->draw, vs_resource); - } - rctx->vs_nresource = rctx->vertex_elements->count; - /* FIXME start need to change winsys */ - rctx->vtbl->vgt_init(draw, vgt_draw_initiator); - radeon_draw_bind(&rctx->draw, &draw->draw); - - rctx->vtbl->vgt_prim(draw, prim, vgt_dma_index_type); - radeon_draw_bind(&rctx->draw, &draw->vgt); - - r = radeon_ctx_set_draw(rctx->ctx, &rctx->draw); - if (r == -EBUSY) { - r600_flush(draw->ctx, 0, NULL); - r = radeon_ctx_set_draw(rctx->ctx, &rctx->draw); - } - - radeon_state_fini(&draw->draw); - - return r; -} - -void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_draw draw; - int r; - - memset(&draw, 0, sizeof(draw)); - - if (rctx->any_user_vbs) { - r600_upload_user_buffers(rctx); - rctx->any_user_vbs = FALSE; - } - - draw.ctx = ctx; - draw.mode = info->mode; - draw.start = info->start; - draw.count = info->count; - if (info->indexed && rctx->index_buffer.buffer) { - draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; - draw.min_index = info->min_index; - draw.max_index = info->max_index; - draw.index_bias = info->index_bias; - - r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer, - &rctx->index_buffer.index_size, - &draw.start, - info->count); - - draw.index_size = rctx->index_buffer.index_size; - pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer); - draw.index_buffer_offset = draw.start * draw.index_size; - draw.start = 0; - r600_upload_index_buffer(rctx, &draw); - } - else { - draw.index_size = 0; - draw.index_buffer = NULL; - draw.min_index = 0; - draw.max_index = 0xffffff; - draw.index_buffer_offset = 0; - draw.index_bias = draw.start; - } - - r = r600_draw_common(&draw); - if (r) - fprintf(stderr,"draw common failed %d\n", r); - - pipe_resource_reference(&draw.index_buffer, NULL); -} diff --git a/src/gallium/drivers/r600/r600_helper.c b/src/gallium/drivers/r600/r600_helper.c index 5e0e0aab570..7e131093060 100644 --- a/src/gallium/drivers/r600/r600_helper.c +++ b/src/gallium/drivers/r600/r600_helper.c @@ -26,8 +26,7 @@ #include #include #include -#include "r600_screen.h" -#include "r600_context.h" +#include "r600_pipe.h" #include "r600d.h" int r600_conv_pipe_prim(unsigned pprim, unsigned *prim) diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c deleted file mode 100644 index b4d73a0fb10..00000000000 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ /dev/null @@ -1,1215 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * 2010 Red Hat Inc. - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Dave Airlie - */ - -#include -#include -#include -#include -#include "util/u_pack_color.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_resource.h" -#include "r600_state_inlines.h" -#include "r600d.h" - -static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - int i; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0); - rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]); - rstate->states[R600_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]); - rstate->states[R600_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]); - rstate->states[R600_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]); - rstate->states[R600_BLEND__CB_BLEND0_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND1_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND2_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND3_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND4_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND5_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND6_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND7_CONTROL] = 0x00000000; - rstate->states[R600_BLEND__CB_BLEND_CONTROL] = 0x00000000; - - for (i = 0; i < 8; i++) { - unsigned eqRGB = state->rt[i].rgb_func; - unsigned srcRGB = state->rt[i].rgb_src_factor; - unsigned dstRGB = state->rt[i].rgb_dst_factor; - - unsigned eqA = state->rt[i].alpha_func; - unsigned srcA = state->rt[i].alpha_src_factor; - unsigned dstA = state->rt[i].alpha_dst_factor; - uint32_t bc = 0; - - if (!state->rt[i].blend_enable) - continue; - - bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB)); - bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB)); - bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB)); - - if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) { - bc |= S_028804_SEPARATE_ALPHA_BLEND(1); - bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA)); - bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA)); - bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA)); - } - - rstate->states[R600_BLEND__CB_BLEND0_CONTROL + i] = bc; - if (i == 0) - rstate->states[R600_BLEND__CB_BLEND_CONTROL] = bc; - } - - radeon_state_pm4(rstate); -} - -static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_clip_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0); - - for (int i = 0; i < state->nr; i++) { - rstate->states[i * 4 + 0] = fui(state->ucp[i][0]); - rstate->states[i * 4 + 1] = fui(state->ucp[i][1]); - rstate->states[i * 4 + 2] = fui(state->ucp[i][2]); - rstate->states[i * 4 + 3] = fui(state->ucp[i][3]); - } - radeon_state_pm4(rstate); -} - -static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_framebuffer_state *state, int cb) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - unsigned level = state->cbufs[cb]->level; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype; - const struct util_format_description *desc; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0); - rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; - rbuffer = &rtex->resource; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->nbo = 1; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; - - ntype = 0; - desc = util_format_description(rtex->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_0280A0_NUMBER_SRGB; - - format = r600_translate_colorformat(rtex->resource.base.b.format); - swap = r600_translate_colorswap(rtex->resource.base.b.format); - - - color_info = S_0280A0_FORMAT(format) | - S_0280A0_COMP_SWAP(swap) | - S_0280A0_BLEND_CLAMP(1) | - S_0280A0_NUMBER_TYPE(ntype); - - if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) - color_info |= S_0280A0_SOURCE_FORMAT(1); - rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8; - rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info; - rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) | - S_028060_SLICE_TILE_MAX(slice); - rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000; - rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000; - radeon_state_pm4(rstate); -} - -static void r600_db(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_framebuffer_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - unsigned level; - unsigned pitch, slice, format; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0); - if (state->zsbuf == NULL) - return; - - rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tiled = 1; - rtex->array_mode = 2; - rtex->tile_type = 1; - rtex->depth = 1; - rbuffer = &rtex->resource; - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - level = state->zsbuf->level; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; - format = r600_translate_dbformat(state->zsbuf->texture->format); - rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8; - rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) | - S_028010_FORMAT(format); - rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000; - rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1; - rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) | - S_028000_SLICE_TILE_MAX(slice); - radeon_state_pm4(rstate); -} - -static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rstate) -{ - const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer; - const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - const struct pipe_clip_state *clip = NULL; - struct r600_screen *rscreen = rctx->screen; - float offset_units = 0, offset_scale = 0; - char depth = 0; - unsigned offset_db_fmt_cntl = 0; - unsigned point_size; - unsigned prov_vtx = 1; - unsigned polygon_dual_mode; - - if (rctx->clip) - clip = &rctx->clip->state.clip; - if (fb->zsbuf) { - offset_units = state->offset_units; - offset_scale = state->offset_scale * 12.0f; - switch (fb->zsbuf->texture->format) { - case PIPE_FORMAT_Z24X8_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - depth = -24; - offset_units *= 2.0f; - break; - case PIPE_FORMAT_Z32_FLOAT: - depth = -23; - offset_units *= 1.0f; - offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); - break; - case PIPE_FORMAT_Z16_UNORM: - depth = -16; - offset_units *= 4.0f; - break; - default: - R600_ERR("unsupported %d\n", fb->zsbuf->texture->format); - return; - } - } - offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); - - if (state->flatshade_first) - prov_vtx = 0; - - rctx->flat_shade = state->flatshade; - radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0); - rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = - S_0286D4_FLAT_SHADE_ENA(1); - if (state->sprite_coord_enable) { - rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |= - S_0286D4_PNT_SPRITE_ENA(1) | - S_0286D4_PNT_SPRITE_OVRD_X(2) | - S_0286D4_PNT_SPRITE_OVRD_Y(3) | - S_0286D4_PNT_SPRITE_OVRD_Z(0) | - S_0286D4_PNT_SPRITE_OVRD_W(1); - if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) { - rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |= - S_0286D4_PNT_SPRITE_TOP_1(1); - } - } - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0; - if (clip) { - /* Clip plane enable bits are stashed in the lower six bits of - * PA_CL_CLIP_CNTL, so just set all of the corresponding bits with a - * pinch of bit twiddling. - * - * PS_UCP_MODE 3 is "expand and clip as trifan," which is the same - * setting that we use on r300-r500. I believe that fglrx always uses - * this mode as well. */ - rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = - ((1 << clip->nr) - 1) | - S_028810_PS_UCP_MODE(3) | - S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp) | - S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp); - } - polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || - state->fill_back != PIPE_POLYGON_MODE_FILL); - - rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] = - S_028814_PROVOKING_VTX_LAST(prov_vtx) | - S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | - S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | - S_028814_FACE(!state->front_ccw) | - S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | - S_028814_POLY_MODE(polygon_dual_mode) | - S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | - S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)); - rstate->states[R600_RASTERIZER__PA_CL_VS_OUT_CNTL] = - S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | - S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex); - rstate->states[R600_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000; - /* Point size for PA_SU_POINT_SIZE and PA_SU_POINT_MINMAX is fixed-point, - * 12.4. - * - * For some reason, maximum point size is set to 0x8000 (2048.0) instead - * of the maximum value 0xFFF0 (4095.0). */ - point_size = (unsigned)(state->point_size * 8.0); - rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] = - S_028A00_HEIGHT(point_size) | S_028A00_WIDTH(point_size); - rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = - S_028A04_MIN_SIZE(0) | S_028A04_MAX_SIZE(0x8000); - rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = S_028A08_WIDTH(8); - rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005; - rstate->states[R600_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000; - rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = S_028C00_LAST_PIXEL(1); - rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = fui(1); - rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = fui(1); - rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = fui(1); - rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = fui(1); - rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl; - rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000; - rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale); - rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units); - rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale); - rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units); - radeon_state_pm4(rstate); -} - -static void r600_scissor(struct r600_context *rctx, struct radeon_state *rstate) -{ - const struct pipe_scissor_state *state = &rctx->scissor->state.scissor; - const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer; - struct r600_screen *rscreen = rctx->screen; - enum radeon_family family; - unsigned minx, maxx, miny, maxy; - u32 tl, br; - - family = radeon_get_family(rctx->rw); - - if (state == NULL) { - minx = 0; - miny = 0; - maxx = fb->cbufs[0]->width; - maxy = fb->cbufs[0]->height; - } else { - minx = state->minx; - miny = state->miny; - maxx = state->maxx; - maxy = state->maxy; - } - tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1); - br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy); - radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0); - rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000; - rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = - S_02820C_CLIP_RULE(0xFFFF); - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_BR] = br; - - if (family >= CHIP_RV770) - rstate->states[R600_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA; - - rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br; - rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl; - rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br; - radeon_state_pm4(rstate); -} - -static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0); - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = fui(0); - rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = fui(1); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]); - rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]); - rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = - S_028818_VPORT_X_SCALE_ENA(1) | - S_028818_VPORT_X_OFFSET_ENA(1) | - S_028818_VPORT_Y_SCALE_ENA(1) | - S_028818_VPORT_Y_OFFSET_ENA(1) | - S_028818_VPORT_Z_SCALE_ENA(1) | - S_028818_VPORT_Z_OFFSET_ENA(1) | - S_028818_VTX_W0_FMT(1); - radeon_state_pm4(rstate); -} - -static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate) -{ - const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa; - const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref; - struct r600_screen *rscreen = rctx->screen; - unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; - unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control; - struct r600_shader *rshader; - struct r600_query *rquery = NULL; - boolean query_running; - int i; - bool flush_db = FALSE; - - if (rctx->ps_shader == NULL) { - return; - } - if (rctx->dsa->flags & R600_STATE_FLAG_DSA_FLUSH) - flush_db = TRUE; - - radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0); - - db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); - - if (!flush_db) - db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(1); - - rshader = &rctx->ps_shader->shader; - if (rshader->uses_kill) - db_shader_control |= S_02880C_KILL_ENABLE(1); - for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) - db_shader_control |= S_02880C_Z_EXPORT_ENABLE(1); - } - stencil_ref_mask = 0; - stencil_ref_mask_bf = 0; - db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | - S_028800_Z_WRITE_ENABLE(state->depth.writemask) | - S_028800_ZFUNC(state->depth.func); - - /* set stencil enable */ - if (state->stencil[0].enabled) { - db_depth_control |= S_028800_STENCIL_ENABLE(1) | - S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)) | - S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)) | - S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)) | - S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); - - stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) | - S_028430_STENCILWRITEMASK(state->stencil[0].writemask) | - S_028430_STENCILREF(stencil_ref->ref_value[0]); - - if (state->stencil[1].enabled) { - db_depth_control |= S_028800_BACKFACE_ENABLE(1) | - S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)) | - S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)) | - S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)) | - S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); - stencil_ref_mask_bf = - S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | - S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask) | - S_028430_STENCILREF(stencil_ref->ref_value[1]); - } - } - - alpha_test_control = 0; - alpha_ref = 0; - if (state->alpha.enabled) { - alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func) | - S_028410_ALPHA_TEST_ENABLE(1); - alpha_ref = fui(state->alpha.ref_value); - } - - db_render_control = 0; - - if (flush_db) - db_render_control = S_028D0C_DEPTH_COPY_ENABLE(1) | - S_028D0C_STENCIL_COPY_ENABLE(1) | - S_028D0C_COPY_CENTROID(1); - - db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); - - query_running = FALSE; - - LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { - if (rquery->state & R600_QUERY_STATE_STARTED) { - query_running = TRUE; - } - } - - if (query_running) { - db_render_override |= S_028D10_NOOP_CULL_DISABLE(1); - if (radeon_get_family_class(rscreen->rw) == R700) - db_render_control |= S_028D0C_R700_PERFECT_ZPASS_COUNTS(1); - } - - rstate->states[R600_DSA__DB_STENCIL_CLEAR] = 0x00000000; - rstate->states[R600_DSA__DB_DEPTH_CLEAR] = fui(1); - rstate->states[R600_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control; - rstate->states[R600_DSA__DB_STENCILREFMASK] = stencil_ref_mask; - rstate->states[R600_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf; - rstate->states[R600_DSA__SX_ALPHA_REF] = alpha_ref; - rstate->states[R600_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000; - rstate->states[R600_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000; - rstate->states[R600_DSA__SPI_FOG_CNTL] = 0x00000000; - rstate->states[R600_DSA__DB_DEPTH_CONTROL] = db_depth_control; - rstate->states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control; - rstate->states[R600_DSA__DB_RENDER_CONTROL] = db_render_control; - rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = db_render_override; - - rstate->states[R600_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000; - rstate->states[R600_DSA__DB_PRELOAD_CONTROL] = 0x00000000; - rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00; - radeon_state_pm4(rstate); -} - - -static INLINE u32 S_FIXED(float value, u32 frac_bits) -{ - return value * (1 << frac_bits); -} - -static void r600_sampler_border(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_sampler_state *state, unsigned id) -{ - struct r600_screen *rscreen = rctx->screen; - union util_color uc; - - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS); - if (uc.ui) { - rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]); - rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]); - rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]); - rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA] = fui(state->border_color[3]); - } - radeon_state_pm4(rstate); -} - -static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate, - const struct pipe_sampler_state *state, unsigned id) -{ - struct r600_screen *rscreen = rctx->screen; - union util_color uc; - - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - - radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS); - rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] = - S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | - S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | - S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | - S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) | - S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) | - S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) | - S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | - S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0); - /* FIXME LOD it depends on texture base level ... */ - rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] = - S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | - S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) | - S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)); - rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] = S_03C008_TYPE(1); - radeon_state_pm4(rstate); - -} - - -static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, - const struct pipe_sampler_view *view, unsigned id) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_screen *rscreen = rctx->screen; - const struct util_format_description *desc; - struct r600_resource_texture *texture; - struct r600_resource *rbuffer; - unsigned format; - uint32_t word4 = 0, yuv_format = 0, pitch = 0; - unsigned char swizzle[4], array_mode = 0, tile_type = 0; - - rstate->cpm4 = 0; - swizzle[0] = view->swizzle_r; - swizzle[1] = view->swizzle_g; - swizzle[2] = view->swizzle_b; - swizzle[3] = view->swizzle_a; - format = r600_translate_texformat(view->texture->format, - swizzle, - &word4, &yuv_format); - if (format == ~0) { - return; - } - desc = util_format_description(view->texture->format); - if (desc == NULL) { - R600_ERR("unknow format %d\n", view->texture->format); - return; - } - radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS); - texture = (struct r600_resource_texture*)view->texture; - rbuffer = &texture->resource; - - if (texture->depth) { - r600_texture_depth_flush(ctx, view->texture); - rbuffer = &texture->flushed_depth_texture->resource; - } - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo); - - rstate->nbo = 2; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[1] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate->placement[3] = RADEON_GEM_DOMAIN_GTT; - - pitch = align(texture->pitch[0] / texture->bpt, 8); - - /* FIXME properly handle first level != 0 */ - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = - S_038000_DIM(r600_tex_dim(view->texture->target)) | - S_038000_TILE_MODE(array_mode) | - S_038000_TILE_TYPE(tile_type) | - S_038000_PITCH((pitch / 8) - 1) | - S_038000_TEX_WIDTH(view->texture->width0 - 1); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = - S_038004_TEX_HEIGHT(view->texture->height0 - 1) | - S_038004_TEX_DEPTH(view->texture->depth0 - 1) | - S_038004_DATA_FORMAT(format); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = texture->offset[0] >> 8; - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = texture->offset[1] >> 8; - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = - word4 | - S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | - S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | - S_038010_REQUEST_SIZE(1) | - S_038010_BASE_LEVEL(view->first_level); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = - S_038014_LAST_LEVEL(view->last_level) | - S_038014_BASE_ARRAY(0) | - S_038014_LAST_ARRAY(0); - rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = - S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE); - radeon_state_pm4(rstate); -} - -static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate) -{ - struct r600_screen *rscreen = rctx->screen; - const struct pipe_blend_state *pbs = &rctx->blend->state.blend; - int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs; - uint32_t color_control, target_mask, shader_mask, shader_control; - int i; - - target_mask = 0; - shader_mask = 0; - shader_control = 0; - color_control = S_028808_PER_MRT_BLEND(1); - - for (i = 0; i < nr_cbufs; i++) { - shader_mask |= 0xf << (i * 4); - shader_control |= (1 << i); - } - - if (pbs->logicop_enable) { - color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20); - } else { - color_control |= (0xcc << 16); - } - - if (pbs->independent_blend_enable) { - for (i = 0; i < nr_cbufs; i++) { - if (pbs->rt[i].blend_enable) { - color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i); - } - target_mask |= (pbs->rt[i].colormask << (4 * i)); - } - } else { - for (i = 0; i < nr_cbufs; i++) { - if (pbs->rt[0].blend_enable) { - color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i); - } - target_mask |= (pbs->rt[0].colormask << (4 * i)); - } - } - radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0); - rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask; - rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask; - rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control; - if (radeon_get_family_class(rscreen->rw) == R700) - rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = shader_control; - rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000; - rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000; - rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX] = 0x00000000; - rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000; - rstate->states[R600_CB_CNTL__CB_CLRCMP_SRC] = 0x00000000; - rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF; - rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF; - rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF; - radeon_state_pm4(rstate); -} - -static void r600_init_config(struct r600_context *rctx) -{ - int ps_prio; - int vs_prio; - int gs_prio; - int es_prio; - int num_ps_gprs; - int num_vs_gprs; - int num_gs_gprs; - int num_es_gprs; - int num_temp_gprs; - int num_ps_threads; - int num_vs_threads; - int num_gs_threads; - int num_es_threads; - int num_ps_stack_entries; - int num_vs_stack_entries; - int num_gs_stack_entries; - int num_es_stack_entries; - enum radeon_family family; - - family = radeon_get_family(rctx->rw); - ps_prio = 0; - vs_prio = 1; - gs_prio = 2; - es_prio = 3; - switch (family) { - case CHIP_R600: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_RV630: - case CHIP_RV635: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 40; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_RV610: - case CHIP_RV620: - case CHIP_RS780: - case CHIP_RS880: - default: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_RV670: - num_ps_gprs = 144; - num_vs_gprs = 40; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_RV770: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 256; - num_vs_stack_entries = 256; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_RV730: - case CHIP_RV740: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_RV710: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 48; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - } - radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0); - - rctx->config.states[R600_CONFIG__SQ_CONFIG] = 0x00000000; - switch (family) { - case CHIP_RV610: - case CHIP_RV620: - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV710: - break; - default: - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1); - break; - } - - if (!rctx->screen->use_mem_constant) - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_DX9_CONSTS(1); - - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ALU_INST_PREFER_VECTOR(1); - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio); - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio); - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio); - rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio); - - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0; - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs); - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs); - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0; - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs); - rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_es_gprs); - - rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] = 0; - rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_PS_THREADS(num_ps_threads); - rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_VS_THREADS(num_vs_threads); - rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_GS_THREADS(num_gs_threads); - rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_ES_THREADS(num_es_threads); - - rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0; - rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); - rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - - rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0; - rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); - rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - - rctx->config.states[R600_CONFIG__VC_ENHANCE] = 0x00000000; - rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000; - - if (family >= CHIP_RV770) { - rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = - S_008D8C_VS_PC_LIMIT_ENABLE(1); - rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002; - rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000; - rctx->config.states[R600_CONFIG__DB_WATERMARKS] = - S_009838_DEPTH_FREE(4) | - S_009838_DEPTH_FLUSH(16) | - S_009838_DEPTH_PENDING_FREE(4) | - S_009838_DEPTH_CACHELINE_FREE(4); - rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000000; - rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00500000 | - S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1) | - S_028A4C_FORCE_EOV_REZ_ENABLE(1); - } else { - rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000; - rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002 | - S_009508_DISABLE_CUBE_WRAP(1); - rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x82000000; - rctx->config.states[R600_CONFIG__DB_WATERMARKS] = - S_009838_DEPTH_FREE(4) | - S_009838_DEPTH_FLUSH(16) | - S_009838_DEPTH_PENDING_FREE(4) | - S_009838_DEPTH_CACHELINE_FREE(16); - rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = - S_0286C8_PS_GROUPING(1); - rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = - S_028A4C_WALK_ORDER_ENABLE(1) | - S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1); - } - rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_FBUF_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_REDUC_RING_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_HOS_CNTL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_DECR] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = S_028AB4_REUSE_OFF(1); - rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000; - rctx->config.states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000; - radeon_state_pm4(&rctx->config); -} - -static int r600_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset, - uint32_t stride, uint32_t src_format) -{ - struct radeon_state *vs_resource = &rctx->vs_resource[id]; - struct r600_screen *rscreen = rctx->screen; - unsigned format, num_format = 0, format_comp = 0; - - format = r600_translate_colorformat(src_format); - - r600_translate_vertex_num_format(src_format, &num_format, &format_comp); - - format = S_038008_DATA_FORMAT(format) | S_038008_NUM_FORMAT_ALL(num_format) | S_038008_FORMAT_COMP_ALL(format_comp); - - radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS); - radeon_ws_bo_reference(rscreen->rw, &vs_resource->bo[0], rbuffer->bo); - vs_resource->nbo = 1; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->size - offset - 1; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(stride) | format; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000; - vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000; - vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT; - vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT; - return radeon_state_pm4(vs_resource); -} - -static int r600_draw_vgt_init(struct r600_draw *draw, - int vgt_draw_initiator) -{ - struct r600_context *rctx = r600_context(draw->ctx); - struct r600_screen *rscreen = rctx->screen; - struct r600_resource *rbuffer = (struct r600_resource *)draw->index_buffer; - radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0); - draw->draw.states[R600_DRAW__VGT_NUM_INDICES] = draw->count; - draw->draw.states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator; - draw->draw.states[R600_DRAW__VGT_DMA_BASE] = draw->index_buffer_offset; - if (rbuffer) { - radeon_ws_bo_reference(rscreen->rw, &draw->draw.bo[0], rbuffer->bo); - draw->draw.placement[0] = RADEON_GEM_DOMAIN_GTT; - draw->draw.placement[1] = RADEON_GEM_DOMAIN_GTT; - draw->draw.nbo = 1; - } - return radeon_state_pm4(&draw->draw); -} - -static int r600_draw_vgt_prim(struct r600_draw *draw, - uint32_t prim, uint32_t vgt_dma_index_type) -{ - struct r600_context *rctx = r600_context(draw->ctx); - struct r600_screen *rscreen = rctx->screen; - radeon_state_init(&draw->vgt, rscreen->rw, R600_STATE_VGT, 0, 0); - draw->vgt.states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim; - draw->vgt.states[R600_VGT__VGT_MAX_VTX_INDX] = draw->max_index; - draw->vgt.states[R600_VGT__VGT_MIN_VTX_INDX] = draw->min_index; - draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->index_bias; - draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000; - draw->vgt.states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type; - draw->vgt.states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000; - draw->vgt.states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001; - draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000; - draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000; - draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000; - return radeon_state_pm4(&draw->vgt); -} - -static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state *rpshader, - struct radeon_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - const struct pipe_rasterizer_state *rasterizer; - struct r600_shader *rshader = &rpshader->shader; - unsigned i, tmp, exports_ps, num_cout; - boolean have_pos = FALSE, have_face = FALSE; - - rasterizer = &rctx->rasterizer->state.rasterizer; - - radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); - for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)) | S_028644_SEL_CENTROID(1); - if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) - have_pos = TRUE; - if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || - rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || - rshader->input[i].name == TGSI_SEMANTIC_POSITION) { - tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); - } - - if (rshader->input[i].name == TGSI_SEMANTIC_FACE) - have_face = TRUE; - - if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && - rasterizer->sprite_coord_enable & (1 << rshader->input[i].sid)) { - tmp |= S_028644_PT_SPRITE_TEX(1); - } - state->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp; - } - - exports_ps = 0; - num_cout = 0; - for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) - exports_ps |= S_028854_EXPORT_Z(1); - else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { - num_cout++; - } - } - exports_ps |= S_028854_EXPORT_COLORS(num_cout); - if (exports_ps == 0) { - /* Always at least export 1 color component per pixel. */ - exports_ps = S_028854_EXPORT_COLORS(1); - } - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = - S_0286CC_NUM_INTERP(rshader->ninput) | - S_0286CC_PERSP_GRADIENT_ENA(1); - - if (have_pos) { - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= - S_0286CC_POSITION_ENA(1) | - S_0286CC_BARYC_SAMPLE_CNTL(1); - state->states[R600_PS_SHADER__SPI_INPUT_Z] |= - S_0286D8_PROVIDE_Z_TO_SPI(1); - } - - state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = - S_0286D0_FRONT_FACE_ENA(have_face); - - state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = - S_028868_NUM_GPRS(rshader->bc.ngpr) | - S_028868_STACK_SIZE(rshader->bc.nstack); - state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps; - radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo); - state->nbo = 1; - state->placement[0] = RADEON_GEM_DOMAIN_GTT; - return radeon_state_pm4(state); -} - -static int r600_vs_shader(struct r600_context *rctx, struct r600_context_state *rpshader, - struct radeon_state *state) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_shader *rshader = &rpshader->shader; - unsigned i, tmp; - - radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS); - for (i = 0; i < 10; i++) { - state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0; - } - /* so far never got proper semantic id from tgsi */ - for (i = 0; i < 32; i++) { - tmp = i << ((i & 3) * 8); - state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp; - } - state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = - S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2); - state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = - S_028868_NUM_GPRS(rshader->bc.ngpr) | - S_028868_STACK_SIZE(rshader->bc.nstack); - radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo); - radeon_ws_bo_reference(rscreen->rw, &state->bo[1], rpshader->bo); - state->nbo = 2; - state->placement[0] = RADEON_GEM_DOMAIN_GTT; - state->placement[2] = RADEON_GEM_DOMAIN_GTT; - return radeon_state_pm4(state); -} - -struct r600_context_hw_state_vtbl r600_hw_state_vtbl = { - .blend = r600_blend, - .ucp = r600_ucp, - .cb = r600_cb, - .db = r600_db, - .rasterizer = r600_rasterizer, - .scissor = r600_scissor, - .viewport = r600_viewport, - .dsa = r600_dsa, - .sampler_border = r600_sampler_border, - .sampler = r600_sampler, - .resource = r600_resource, - .cb_cntl = r600_cb_cntl, - .vs_resource = r600_vs_resource, - .vgt_init = r600_draw_vgt_init, - .vgt_prim = r600_draw_vgt_prim, - .vs_shader = r600_vs_shader, - .ps_shader = r600_ps_shader, - .init_config = r600_init_config, -}; - -void r600_set_constant_buffer_file(struct pipe_context *ctx, - uint shader, uint index, - struct pipe_resource *buffer) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, i, type, shader_class; - struct radeon_state *rstate, *rstates; - struct pipe_transfer *transfer; - u32 *ptr; - - type = R600_STATE_CONSTANT; - - switch (shader) { - case PIPE_SHADER_VERTEX: - shader_class = R600_SHADER_VS; - rstates = rctx->vs_constant; - break; - case PIPE_SHADER_FRAGMENT: - shader_class = R600_SHADER_PS; - rstates = rctx->ps_constant; - break; - default: - R600_ERR("unsupported %d\n", shader); - return; - } - if (buffer && buffer->width0 > 0) { - nconstant = buffer->width0 / 16; - ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer); - if (ptr == NULL) - return; - for (i = 0; i < nconstant; i++) { - rstate = &rstates[i]; - radeon_state_init(rstate, rscreen->rw, type, i, shader_class); - rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0]; - rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0] = ptr[i * 4 + 1]; - rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0] = ptr[i * 4 + 2]; - rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0] = ptr[i * 4 + 3]; - if (radeon_state_pm4(rstate)) - return; - radeon_draw_bind(&rctx->draw, rstate); - } - pipe_buffer_unmap(ctx, buffer, transfer); - } -} - -void r600_set_constant_buffer_mem(struct pipe_context *ctx, - uint shader, uint index, - struct pipe_resource *buffer) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, type, shader_class, size; - struct radeon_state *rstate, *rstates; - struct r600_resource *rbuffer = (struct r600_resource*)buffer; - - type = R600_STATE_CBUF; - - switch (shader) { - case PIPE_SHADER_VERTEX: - shader_class = R600_SHADER_VS; - rstates = rctx->vs_constant; - break; - case PIPE_SHADER_FRAGMENT: - shader_class = R600_SHADER_PS; - rstates = rctx->ps_constant; - break; - default: - R600_ERR("unsupported %d\n", shader); - return; - } - - rstate = &rstates[0]; - -#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) - - nconstant = buffer->width0 / 16; - size = ALIGN_DIVUP(nconstant, 16); - - radeon_state_init(rstate, rscreen->rw, type, 0, shader_class); - rstate->states[R600_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size; - rstate->states[R600_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0; - - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM; - if (radeon_state_pm4(rstate)) - return; - radeon_draw_bind(&rctx->draw, rstate); -} - diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index e161dc5066a..b1e76b692c7 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -26,6 +26,14 @@ #ifndef R600_PIPE_H #define R600_PIPE_H +#include +#include +#include +#include +#include "r600.h" +#include "r600_shader.h" +#include "r600_resource.h" + enum r600_pipe_state_id { R600_PIPE_STATE_BLEND = 0, R600_PIPE_STATE_BLEND_COLOR, @@ -167,4 +175,16 @@ static INLINE u32 S_FIXED(float value, u32 frac_bits) } #define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) +/* r600_buffer.c */ +struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, + const struct pipe_resource *templ); +struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, + void *ptr, unsigned bytes, + unsigned bind); +unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context, + struct pipe_resource *buf, + unsigned face, unsigned level); +struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen, + struct winsys_handle *whandle); + #endif diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c deleted file mode 100644 index 6e50701de66..00000000000 --- a/src/gallium/drivers/r600/r600_query.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Corbin Simpson - */ -#include -#include -#include -#include -#include "r600_screen.h" -#include "r600_context.h" - -static void r600_query_begin(struct r600_context *rctx, struct r600_query *rquery) -{ - struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate = &rquery->rstate; - - radeon_state_fini(rstate); - radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_BEGIN, 0, 0); - rstate->states[R600_QUERY__OFFSET] = rquery->num_results; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rquery->buffer); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - if (radeon_state_pm4(rstate)) { - radeon_state_fini(rstate); - } -} - -static void r600_query_end(struct r600_context *rctx, struct r600_query *rquery) -{ - struct r600_screen *rscreen = rctx->screen; - struct radeon_state *rstate = &rquery->rstate; - - radeon_state_fini(rstate); - radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_END, 0, 0); - rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8; - radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rquery->buffer); - rstate->nbo = 1; - rstate->placement[0] = RADEON_GEM_DOMAIN_GTT; - if (radeon_state_pm4(rstate)) { - radeon_state_fini(rstate); - } -} - -static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - struct r600_query *q; - - if (query_type != PIPE_QUERY_OCCLUSION_COUNTER) - return NULL; - - q = CALLOC_STRUCT(r600_query); - if (!q) - return NULL; - - q->type = query_type; - q->buffer_size = 4096; - - q->buffer = radeon_ws_bo(rscreen->rw, q->buffer_size, 1, 0); - if (!q->buffer) { - FREE(q); - return NULL; - } - - LIST_ADDTAIL(&q->list, &rctx->query_list); - - return (struct pipe_query *)q; -} - -static void r600_destroy_query(struct pipe_context *ctx, - struct pipe_query *query) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_query *q = r600_query(query); - - radeon_ws_bo_reference(rscreen->rw, &q->buffer, NULL); - LIST_DEL(&q->list); - FREE(query); -} - -static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquery) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - u64 start, end; - u32 *results; - int i; - - results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, ctx); - for (i = 0; i < rquery->num_results; i += 4) { - start = (u64)results[i] | (u64)results[i + 1] << 32; - end = (u64)results[i + 2] | (u64)results[i + 3] << 32; - if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) { - rquery->result += end - start; - } - } - radeon_ws_bo_unmap(rscreen->rw, rquery->buffer); - rquery->num_results = 0; -} - -static void r600_query_resume(struct pipe_context *ctx, struct r600_query *rquery) -{ - struct r600_context *rctx = r600_context(ctx); - - if (rquery->num_results >= ((rquery->buffer_size >> 2) - 2)) { - /* running out of space */ - if (!rquery->flushed) { - ctx->flush(ctx, 0, NULL); - } - r600_query_result(ctx, rquery); - } - r600_query_begin(rctx, rquery); - rquery->flushed = FALSE; -} - -static void r600_query_suspend(struct pipe_context *ctx, struct r600_query *rquery) -{ - struct r600_context *rctx = r600_context(ctx); - - r600_query_end(rctx, rquery); - rquery->num_results += 16; -} - -static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_query *rquery = r600_query(query); - int r; - - rquery->state = R600_QUERY_STATE_STARTED; - rquery->num_results = 0; - rquery->flushed = FALSE; - r600_query_resume(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - if (r == -EBUSY) { - /* this shouldn't happen */ - R600_ERR("had to flush while emitting end query\n"); - ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - } -} - -static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_query *rquery = r600_query(query); - int r; - - rquery->state &= ~R600_QUERY_STATE_STARTED; - rquery->state |= R600_QUERY_STATE_ENDED; - r600_query_suspend(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - if (r == -EBUSY) { - /* this shouldn't happen */ - R600_ERR("had to flush while emitting end query\n"); - ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - } -} - -void r600_queries_suspend(struct pipe_context *ctx) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_query *rquery; - int r; - - LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { - if (rquery->state & R600_QUERY_STATE_STARTED) { - r600_query_suspend(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - if (r == -EBUSY) { - /* this shouldn't happen */ - R600_ERR("had to flush while emitting end query\n"); - ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - } - } - rquery->state |= R600_QUERY_STATE_SUSPENDED; - } -} - -void r600_queries_resume(struct pipe_context *ctx) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_query *rquery; - int r; - - LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) { - if (rquery->state & R600_QUERY_STATE_STARTED) { - r600_query_resume(ctx, rquery); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - if (r == -EBUSY) { - /* this shouldn't happen */ - R600_ERR("had to flush while emitting end query\n"); - ctx->flush(ctx, 0, NULL); - r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate); - } - } - rquery->state &= ~R600_QUERY_STATE_SUSPENDED; - } -} - -static boolean r600_get_query_result(struct pipe_context *ctx, - struct pipe_query *query, - boolean wait, void *vresult) -{ - struct r600_query *rquery = r600_query(query); - uint64_t *result = (uint64_t*)vresult; - - if (!rquery->flushed) { - ctx->flush(ctx, 0, NULL); - rquery->flushed = TRUE; - } - r600_query_result(ctx, rquery); - *result = rquery->result; - rquery->result = 0; - return TRUE; -} - -void r600_init_query_functions(struct r600_context* rctx) -{ - LIST_INITHEAD(&rctx->query_list); - - rctx->context.create_query = r600_create_query; - rctx->context.destroy_query = r600_destroy_query; - rctx->context.begin_query = r600_begin_query; - rctx->context.end_query = r600_end_query; - rctx->context.get_query_result = r600_get_query_result; -} diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index 05707740da5..ee6013e865e 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -21,9 +21,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r600_context.h" -#include "r600_resource.h" -#include "r600_screen.h" +#include "r600_pipe.h" static struct pipe_resource *r600_resource_create(struct pipe_screen *screen, const struct pipe_resource *templ) @@ -46,17 +44,6 @@ static struct pipe_resource *r600_resource_from_handle(struct pipe_screen * scre } } -void r600_init_context_resource_functions(struct r600_context *r600) -{ - r600->context.get_transfer = u_get_transfer_vtbl; - r600->context.transfer_map = u_transfer_map_vtbl; - r600->context.transfer_flush_region = u_transfer_flush_region_vtbl; - r600->context.transfer_unmap = u_transfer_unmap_vtbl; - r600->context.transfer_destroy = u_transfer_destroy_vtbl; - r600->context.transfer_inline_write = u_transfer_inline_write_vtbl; - r600->context.is_resource_referenced = u_is_resource_referenced_vtbl; -} - void r600_init_screen_resource_functions(struct pipe_screen *screen) { screen->resource_create = r600_resource_create; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index b0026e95789..ae1ad24bfd5 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -25,8 +25,15 @@ #include "util/u_transfer.h" -struct r600_context; -struct r600_screen; +/* Texture transfer. */ +struct r600_transfer { + /* Base class. */ + struct pipe_transfer transfer; + /* Buffer transfer. */ + struct pipe_transfer *buffer_transfer; + unsigned offset; + struct pipe_resource *linear_texture; +}; /* This gets further specialized into either buffer or texture * structures. Use the vtbl struct to choose between the two @@ -58,7 +65,6 @@ struct r600_resource_texture { struct r600_resource_texture *flushed_depth_texture; }; -void r600_init_context_resource_functions(struct r600_context *r600); void r600_init_screen_resource_functions(struct pipe_screen *screen); /* r600_buffer */ @@ -106,4 +112,18 @@ int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture); extern int (*r600_blit_uncompress_depth_ptr)(struct pipe_context *ctx, struct r600_resource_texture *texture); + +/* r600_texture.c texture transfer functions. */ +struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, + struct pipe_resource *texture, + struct pipe_subresource sr, + unsigned usage, + const struct pipe_box *box); +void r600_texture_transfer_destroy(struct pipe_context *ctx, + struct pipe_transfer *trans); +void* r600_texture_transfer_map(struct pipe_context *ctx, + struct pipe_transfer* transfer); +void r600_texture_transfer_unmap(struct pipe_context *ctx, + struct pipe_transfer* transfer); + #endif diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c deleted file mode 100644 index be8a78ca3d0..00000000000 --- a/src/gallium/drivers/r600/r600_screen.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - * Corbin Simpson - */ -#include -#include "util/u_inlines.h" -#include "util/u_format.h" -#include "util/u_memory.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_public.h" -#include "r600_resource.h" -#include "r600_state_inlines.h" - -static const char* r600_get_vendor(struct pipe_screen* pscreen) -{ - return "X.Org"; -} - -static const char* r600_get_name(struct pipe_screen* pscreen) -{ - struct r600_screen *screen = r600_screen(pscreen); - enum radeon_family family = radeon_get_family(screen->rw); - - if (family >= CHIP_R600 && family < CHIP_RV770) - return "R600 (HD2XXX,HD3XXX)"; - else if (family < CHIP_CEDAR) - return "R700 (HD4XXX)"; - else - return "EVERGREEN"; -} - -static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) -{ - switch (param) { - /* Supported features (boolean caps). */ - case PIPE_CAP_NPOT_TEXTURES: - case PIPE_CAP_TWO_SIDED_STENCIL: - case PIPE_CAP_GLSL: - case PIPE_CAP_DUAL_SOURCE_BLEND: - case PIPE_CAP_ANISOTROPIC_FILTER: - case PIPE_CAP_POINT_SPRITE: - case PIPE_CAP_OCCLUSION_QUERY: - case PIPE_CAP_TEXTURE_SHADOW_MAP: - case PIPE_CAP_TEXTURE_MIRROR_CLAMP: - case PIPE_CAP_TEXTURE_MIRROR_REPEAT: - case PIPE_CAP_BLEND_EQUATION_SEPARATE: - case PIPE_CAP_SM3: - case PIPE_CAP_TEXTURE_SWIZZLE: - case PIPE_CAP_INDEP_BLEND_ENABLE: - case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: - case PIPE_CAP_DEPTH_CLAMP: - return 1; - - /* Unsupported features (boolean caps). */ - case PIPE_CAP_TIMER_QUERY: - case PIPE_CAP_STREAM_OUTPUT: - case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */ - return 0; - - /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 14; - case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - /* FIXME allow this once infrastructure is there */ - return 0; - case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: - case PIPE_CAP_MAX_COMBINED_SAMPLERS: - return 16; - - /* Render targets. */ - case PIPE_CAP_MAX_RENDER_TARGETS: - /* FIXME some r6xx are buggy and can only do 4 */ - return 8; - - /* Fragment coordinate conventions. */ - case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: - case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: - return 1; - case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: - case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: - return 0; - default: - R600_ERR("r600: unknown param %d\n", param); - return 0; - } -} - -static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) -{ - switch(shader) { - case PIPE_SHADER_FRAGMENT: - case PIPE_SHADER_VERTEX: - break; - case PIPE_SHADER_GEOMETRY: - /* TODO: support and enable geometry programs */ - return 0; - default: - /* TODO: support tessellation on Evergreen */ - return 0; - } - - /* TODO: all these should be fixed, since r600 surely supports much more! */ - switch (param) { - case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: - case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: - case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: - case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: - return 16384; - case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: - return 8; /* FIXME */ - case PIPE_SHADER_CAP_MAX_INPUTS: - if(shader == PIPE_SHADER_FRAGMENT) - return 10; - else - return 16; - case PIPE_SHADER_CAP_MAX_TEMPS: - return 256; //max native temporaries - case PIPE_SHADER_CAP_MAX_ADDRS: - return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */ - case PIPE_SHADER_CAP_MAX_CONSTS: - return 256; //max native parameters - case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: - return 1; - case PIPE_SHADER_CAP_MAX_PREDS: - return 0; /* FIXME */ - case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: - return 1; - default: - return 0; - } -} - -static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param) -{ - switch (param) { - case PIPE_CAP_MAX_LINE_WIDTH: - case PIPE_CAP_MAX_LINE_WIDTH_AA: - case PIPE_CAP_MAX_POINT_WIDTH: - case PIPE_CAP_MAX_POINT_WIDTH_AA: - return 8192.0f; - case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: - return 16.0f; - case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: - return 16.0f; - default: - R600_ERR("r600: unsupported paramf %d\n", param); - return 0.0f; - } -} - -static boolean r600_is_format_supported(struct pipe_screen* screen, - enum pipe_format format, - enum pipe_texture_target target, - unsigned sample_count, - unsigned usage, - unsigned geom_flags) -{ - unsigned retval = 0; - if (target >= PIPE_MAX_TEXTURE_TYPES) { - R600_ERR("r600: unsupported texture type %d\n", target); - return FALSE; - } - - /* Multisample */ - if (sample_count > 1) - return FALSE; - - if ((usage & PIPE_BIND_SAMPLER_VIEW) && - r600_is_sampler_format_supported(format)) { - retval |= PIPE_BIND_SAMPLER_VIEW; - } - - if ((usage & (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT | - PIPE_BIND_SHARED)) && - r600_is_colorbuffer_format_supported(format)) { - retval |= usage & - (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT | - PIPE_BIND_SHARED); - } - - if ((usage & PIPE_BIND_DEPTH_STENCIL) && - r600_is_zs_format_supported(format)) { - retval |= PIPE_BIND_DEPTH_STENCIL; - } - - if ((usage & PIPE_BIND_VERTEX_BUFFER) && - r600_is_vertex_format_supported(format)) - retval |= PIPE_BIND_VERTEX_BUFFER; - - if (usage & PIPE_BIND_TRANSFER_READ) - retval |= PIPE_BIND_TRANSFER_READ; - if (usage & PIPE_BIND_TRANSFER_WRITE) - retval |= PIPE_BIND_TRANSFER_WRITE; - - return retval == usage; -} - -static void r600_destroy_screen(struct pipe_screen* pscreen) -{ - struct r600_screen* rscreen = r600_screen(pscreen); - - if (rscreen == NULL) - return; - FREE(rscreen); -} - -struct pipe_screen *r600_screen_create(struct radeon *rw) -{ - struct r600_screen* rscreen; - - rscreen = CALLOC_STRUCT(r600_screen); - if (rscreen == NULL) { - return NULL; - } - - /* don't enable mem constant for r600 yet */ - rscreen->use_mem_constant = FALSE; - if (radeon_get_family_class(rw) == EVERGREEN) { - rscreen->use_mem_constant = TRUE; - } - - radeon_set_mem_constant(rw, rscreen->use_mem_constant); - rscreen->rw = rw; - rscreen->screen.winsys = (struct pipe_winsys*)rw; - rscreen->screen.destroy = r600_destroy_screen; - rscreen->screen.get_name = r600_get_name; - rscreen->screen.get_vendor = r600_get_vendor; - rscreen->screen.get_param = r600_get_param; - rscreen->screen.get_shader_param = r600_get_shader_param; - rscreen->screen.get_paramf = r600_get_paramf; - rscreen->screen.is_format_supported = r600_is_format_supported; - rscreen->screen.context_create = r600_create_context; - r600_init_screen_texture_functions(&rscreen->screen); - r600_init_screen_resource_functions(&rscreen->screen); - return &rscreen->screen; -} diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h deleted file mode 100644 index 4105bb7cf61..00000000000 --- a/src/gallium/drivers/r600/r600_screen.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - */ -#ifndef R600_SCREEN_H -#define R600_SCREEN_H - -#include -#include -#include -#include -#include -#include "radeon.h" -#include "util/u_transfer.h" -#include "r600_resource.h" - -/* Texture transfer. */ -struct r600_transfer { - /* Base class. */ - struct pipe_transfer transfer; - /* Buffer transfer. */ - struct pipe_transfer *buffer_transfer; - unsigned offset; - struct pipe_resource *linear_texture; -}; - -struct r600_screen { - struct pipe_screen screen; - struct radeon *rw; - boolean use_mem_constant; -}; - -static INLINE struct r600_screen *r600_screen(struct pipe_screen *screen) -{ - return (struct r600_screen*)screen; -} - -/* Buffer functions. */ -struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, - const struct pipe_resource *templ); -struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind); -unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context, - struct pipe_resource *buf, - unsigned face, unsigned level); -struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen, - struct winsys_handle *whandle); - -/* r600_texture.c texture transfer functions. */ -struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, - struct pipe_resource *texture, - struct pipe_subresource sr, - unsigned usage, - const struct pipe_box *box); -void r600_texture_transfer_destroy(struct pipe_context *ctx, - struct pipe_transfer *trans); -void* r600_texture_transfer_map(struct pipe_context *ctx, - struct pipe_transfer* transfer); -void r600_texture_transfer_unmap(struct pipe_context *ctx, - struct pipe_transfer* transfer); - -/* r600_blit.c */ -int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture); - -/* helpers */ -int r600_conv_pipe_format(unsigned pformat, unsigned *format); -int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); - -void r600_init_screen_texture_functions(struct pipe_screen *screen); - -#endif diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 0c27bb7d879..97e1d5ee121 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -25,9 +25,7 @@ #include "tgsi/tgsi_scan.h" #include "tgsi/tgsi_dump.h" #include "util/u_format.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_shader.h" +#include "r600_pipe.h" #include "r600_asm.h" #include "r600_sq.h" #include "r600_opcodes.h" @@ -64,163 +62,6 @@ struct r600_shader_tgsi_instruction { static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[]; static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx); -/* called from hw states files to find VS->FS mapping */ -int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id) -{ - int i; - struct r600_shader *vs = &rctx->vs_shader->shader; - struct r600_shader_io *input = &rshader->input[id]; - - for (i = 0; i < vs->noutput; i++) { - if (input->name == vs->output[i].name && - input->sid == vs->output[i].sid) { - return i - 1; - } - } - return 0; -} - -static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader) -{ - struct r600_context *rctx = r600_context(ctx); - const struct util_format_description *desc; - enum pipe_format resource_format[160]; - unsigned i, nresources = 0; - struct r600_bc *bc = &shader->bc; - struct r600_bc_cf *cf; - struct r600_bc_vtx *vtx; - - if (shader->processor_type != TGSI_PROCESSOR_VERTEX) - return 0; - for (i = 0; i < rctx->vertex_elements->count; i++) { - resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format; - } - LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) { - switch (cf->inst) { - case V_SQ_CF_WORD1_SQ_CF_INST_VTX: - case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC: - LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) { - desc = util_format_description(resource_format[vtx->buffer_id]); - if (desc == NULL) { - R600_ERR("unknown format %d\n", resource_format[vtx->buffer_id]); - return -EINVAL; - } - vtx->dst_sel_x = desc->swizzle[0]; - vtx->dst_sel_y = desc->swizzle[1]; - vtx->dst_sel_z = desc->swizzle[2]; - vtx->dst_sel_w = desc->swizzle[3]; - } - break; - default: - break; - } - } - return r600_bc_build(&shader->bc); -} - -int r600_pipe_shader_create(struct pipe_context *ctx, - struct r600_context_state *rpshader, - const struct tgsi_token *tokens) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - int r; - -//fprintf(stderr, "--------------------------------------------------------------\n"); -//tgsi_dump(tokens, 0); - if (rpshader == NULL) - return -ENOMEM; - rpshader->shader.family = radeon_get_family(rscreen->rw); - rpshader->shader.use_mem_constant = rscreen->use_mem_constant; - r = r600_shader_from_tgsi(tokens, &rpshader->shader); - if (r) { - R600_ERR("translation from TGSI failed !\n"); - return r; - } - r = r600_bc_build(&rpshader->shader.bc); - if (r) { - R600_ERR("building bytecode failed !\n"); - return r; - } -//fprintf(stderr, "______________________________________________________________\n"); - return 0; -} - -static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_state *rpshader) -{ - struct r600_context *rctx = r600_context(ctx); - struct radeon_state *state; - - state = &rpshader->rstate[0]; - radeon_state_fini(&rpshader->rstate[0]); - - return rctx->vtbl->vs_shader(rctx, rpshader, state); -} - -static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_state *rpshader) -{ - struct r600_context *rctx = r600_context(ctx); - struct radeon_state *state; - - state = &rpshader->rstate[0]; - radeon_state_fini(state); - - return rctx->vtbl->ps_shader(rctx, rpshader, state); -} - -static int r600_pipe_shader(struct pipe_context *ctx, struct r600_context_state *rpshader) -{ - struct r600_screen *rscreen = r600_screen(ctx->screen); - struct r600_context *rctx = r600_context(ctx); - struct r600_shader *rshader = &rpshader->shader; - int r; - void *data; - - /* copy new shader */ - radeon_ws_bo_reference(rscreen->rw, &rpshader->bo, NULL); - rpshader->bo = NULL; - rpshader->bo = radeon_ws_bo(rscreen->rw, rshader->bc.ndw * 4, - 4096, 0); - if (rpshader->bo == NULL) { - return -ENOMEM; - } - data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, ctx); - memcpy(data, rshader->bc.bytecode, rshader->bc.ndw * 4); - radeon_ws_bo_unmap(rscreen->rw, rpshader->bo); - /* build state */ - rshader->flat_shade = rctx->flat_shade; - switch (rshader->processor_type) { - case TGSI_PROCESSOR_VERTEX: - r = r600_pipe_shader_vs(ctx, rpshader); - break; - case TGSI_PROCESSOR_FRAGMENT: - r = r600_pipe_shader_ps(ctx, rpshader); - break; - default: - r = -EINVAL; - break; - } - return r; -} - -int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_context_state *rpshader) -{ - struct r600_context *rctx = r600_context(ctx); - int r; - - if (rpshader == NULL) - return -EINVAL; - /* there should be enough input */ - if (rctx->vertex_elements->count < rpshader->shader.bc.nresource) { - R600_ERR("%d resources provided, expecting %d\n", - rctx->vertex_elements->count, rpshader->shader.bc.nresource); - return -EINVAL; - } - r = r600_shader_update(ctx, &rpshader->shader); - if (r) - return r; - return r600_pipe_shader(ctx, rpshader); -} - static int tgsi_is_supported(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *i = &ctx->parse.FullToken.FullInstruction; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c deleted file mode 100644 index 86f9825b526..00000000000 --- a/src/gallium/drivers/r600/r600_state.c +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include "util/u_inlines.h" -#include "util/u_format.h" -#include "util/u_memory.h" -#include "util/u_pack_color.h" -#include "r600_screen.h" -#include "r600_context.h" -#include "r600_resource.h" - -static void clean_flush(struct r600_context *rctx, struct radeon_state *flush); -static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush); -static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush); - -static struct r600_context_state *r600_new_context_state(unsigned type) -{ - struct r600_context_state *rstate = CALLOC_STRUCT(r600_context_state); - if (rstate == NULL) - return NULL; - rstate->type = type; - rstate->refcount = 1; - return rstate; -} - -static void *r600_create_blend_state(struct pipe_context *ctx, - const struct pipe_blend_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - - rstate = r600_new_context_state(pipe_blend_type); - rstate->state.blend = *state; - rctx->vtbl->blend(rctx, &rstate->rstate[0], &rstate->state.blend); - - return rstate; -} - -static void *r600_create_dsa_state(struct pipe_context *ctx, - const struct pipe_depth_stencil_alpha_state *state) -{ - struct r600_context_state *rstate; - - rstate = r600_new_context_state(pipe_dsa_type); - rstate->state.dsa = *state; - return rstate; -} - -static void *r600_create_rs_state(struct pipe_context *ctx, - const struct pipe_rasterizer_state *state) -{ - struct r600_context_state *rstate; - - rstate = r600_new_context_state(pipe_rasterizer_type); - rstate->state.rasterizer = *state; - return rstate; -} - -static void *r600_create_sampler_state(struct pipe_context *ctx, - const struct pipe_sampler_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - - rstate = r600_new_context_state(pipe_sampler_type); - rstate->state.sampler = *state; - rctx->vtbl->sampler(rctx, &rstate->rstate[0], &rstate->state.sampler, 0); - rctx->vtbl->sampler_border(rctx, &rstate->rstate[1], &rstate->state.sampler, 0); - return rstate; -} - -static void r600_remove_sampler_view(struct r600_shader_sampler_states *sampler, - struct r600_context_state *rstate) -{ - int i, j; - - for (i = 0; i < sampler->nview; i++) { - for (j = 0; j < rstate->nrstate; j++) { - if (sampler->view[i] == &rstate->rstate[j]) - sampler->view[i] = NULL; - } - } -} -static void r600_sampler_view_destroy(struct pipe_context *ctx, - struct pipe_sampler_view *state) -{ - struct r600_context_state *rstate = (struct r600_context_state *)state; - struct r600_context *rctx = r600_context(ctx); - - /* need to search list of vs/ps sampler views and remove it from any - uggh */ - r600_remove_sampler_view(&rctx->ps_sampler, rstate); - r600_remove_sampler_view(&rctx->vs_sampler, rstate); - r600_context_state_decref(rstate); -} - -static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *ctx, - struct pipe_resource *texture, - const struct pipe_sampler_view *state) -{ - struct r600_context_state *rstate; - struct r600_context *rctx = r600_context(ctx); - - rstate = r600_new_context_state(pipe_sampler_view_type); - rstate->state.sampler_view = *state; - rstate->state.sampler_view.texture = NULL; - pipe_reference(NULL, &texture->reference); - rstate->state.sampler_view.texture = texture; - rstate->state.sampler_view.reference.count = 1; - rstate->state.sampler_view.context = ctx; - rctx->vtbl->resource(ctx, &rstate->rstate[0], &rstate->state.sampler_view, 0); - return &rstate->state.sampler_view; -} - -static void r600_set_sampler_view(struct pipe_context *ctx, - unsigned count, - struct pipe_sampler_view **views, - struct r600_shader_sampler_states *sampler, - unsigned shader_id) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - unsigned i; - - for (i = 0; i < sampler->nview; i++) { - radeon_draw_unbind(&rctx->draw, sampler->view[i]); - } - - for (i = 0; i < count; i++) { - rstate = (struct r600_context_state *)views[i]; - if (rstate) { - rstate->nrstate = 0; - } - } - for (i = 0; i < count; i++) { - rstate = (struct r600_context_state *)views[i]; - if (rstate) { - if (rstate->nrstate >= R600_MAX_RSTATE) - continue; - if (rstate->nrstate) { - memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state)); - } - radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, shader_id); - sampler->view[i] = &rstate->rstate[rstate->nrstate]; - rstate->nrstate++; - } - } - sampler->nview = count; -} - -static void r600_set_ps_sampler_view(struct pipe_context *ctx, - unsigned count, - struct pipe_sampler_view **views) -{ - struct r600_context *rctx = r600_context(ctx); - r600_set_sampler_view(ctx, count, views, &rctx->ps_sampler, R600_SHADER_PS); -} - -static void r600_set_vs_sampler_view(struct pipe_context *ctx, - unsigned count, - struct pipe_sampler_view **views) -{ - struct r600_context *rctx = r600_context(ctx); - r600_set_sampler_view(ctx, count, views, &rctx->vs_sampler, R600_SHADER_VS); -} - -static void *r600_create_shader_state(struct pipe_context *ctx, - const struct pipe_shader_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - int r; - - rstate = r600_new_context_state(pipe_shader_type); - rstate->state.shader = *state; - r = r600_pipe_shader_create(&rctx->context, rstate, rstate->state.shader.tokens); - if (r) { - r600_context_state_decref(rstate); - return NULL; - } - return rstate; -} - -static void *r600_create_vertex_elements(struct pipe_context *ctx, - unsigned count, - const struct pipe_vertex_element *elements) -{ - struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); - - assert(count < 32); - v->count = count; - memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element)); - v->refcount = 1; - return v; -} - -static void r600_delete_vertex_element(struct pipe_context *ctx, void *state) -{ - struct r600_vertex_element *v = (struct r600_vertex_element*)state; - - if (v == NULL) - return; - if (--v->refcount) - return; - free(v); -} - -static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_vertex_element *v = (struct r600_vertex_element*)state; - - r600_delete_vertex_element(ctx, rctx->vertex_elements); - rctx->vertex_elements = v; - if (v) { - v->refcount++; - } -} - -static void r600_bind_rasterizer_state(struct pipe_context *ctx, void *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate = (struct r600_context_state *)state; - - if (state == NULL) - return; - rctx->rasterizer = r600_context_state_decref(rctx->rasterizer); - rctx->rasterizer = r600_context_state_incref(rstate); -} - -static void r600_bind_blend_state(struct pipe_context *ctx, void *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate = (struct r600_context_state *)state; - - if (state == NULL) - return; - rctx->blend = r600_context_state_decref(rctx->blend); - rctx->blend = r600_context_state_incref(rstate); - -} - -static void r600_bind_dsa_state(struct pipe_context *ctx, void *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate = (struct r600_context_state *)state; - - if (state == NULL) - return; - rctx->dsa = r600_context_state_decref(rctx->dsa); - rctx->dsa = r600_context_state_incref(rstate); -} - -static void r600_bind_ps_shader(struct pipe_context *ctx, void *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate = (struct r600_context_state *)state; - - rctx->ps_shader = r600_context_state_decref(rctx->ps_shader); - rctx->ps_shader = r600_context_state_incref(rstate); -} - -static void r600_bind_vs_shader(struct pipe_context *ctx, void *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate = (struct r600_context_state *)state; - - rctx->vs_shader = r600_context_state_decref(rctx->vs_shader); - rctx->vs_shader = r600_context_state_incref(rstate); -} - -static void r600_bind_sampler_shader(struct pipe_context *ctx, - unsigned count, void **states, - struct r600_shader_sampler_states *sampler, unsigned shader_id) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - unsigned i; - - for (i = 0; i < sampler->nsampler; i++) { - radeon_draw_unbind(&rctx->draw, sampler->sampler[i]); - } - for (i = 0; i < sampler->nborder; i++) { - radeon_draw_unbind(&rctx->draw, sampler->border[i]); - } - for (i = 0; i < count; i++) { - rstate = (struct r600_context_state *)states[i]; - if (rstate) { - rstate->nrstate = 0; - } - } - for (i = 0; i < count; i++) { - rstate = (struct r600_context_state *)states[i]; - if (rstate) { - if (rstate->nrstate >= R600_MAX_RSTATE) - continue; - if (rstate->nrstate) { - memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state)); - memcpy(&rstate->rstate[rstate->nrstate+1], &rstate->rstate[1], sizeof(struct radeon_state)); - } - radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, shader_id); - radeon_state_convert(&rstate->rstate[rstate->nrstate + 1], R600_STATE_SAMPLER_BORDER, i, shader_id); - sampler->sampler[i] = &rstate->rstate[rstate->nrstate]; - sampler->border[i] = &rstate->rstate[rstate->nrstate + 1]; - rstate->nrstate += 2; - } - } - sampler->nsampler = count; - sampler->nborder = count; -} - -static void r600_bind_ps_sampler(struct pipe_context *ctx, - unsigned count, void **states) -{ - struct r600_context *rctx = r600_context(ctx); - r600_bind_sampler_shader(ctx, count, states, &rctx->ps_sampler, R600_SHADER_PS); -} - -static void r600_bind_vs_sampler(struct pipe_context *ctx, - unsigned count, void **states) -{ - struct r600_context *rctx = r600_context(ctx); - r600_bind_sampler_shader(ctx, count, states, &rctx->vs_sampler, R600_SHADER_VS); -} - -static void r600_delete_state(struct pipe_context *ctx, void *state) -{ - struct r600_context_state *rstate = (struct r600_context_state *)state; - - r600_context_state_decref(rstate); -} - -static void r600_set_blend_color(struct pipe_context *ctx, - const struct pipe_blend_color *color) -{ - struct r600_context *rctx = r600_context(ctx); - - rctx->blend_color = *color; -} - -static void r600_set_clip_state(struct pipe_context *ctx, - const struct pipe_clip_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - - r600_context_state_decref(rctx->clip); - - rstate = r600_new_context_state(pipe_clip_type); - rstate->state.clip = *state; - rctx->vtbl->ucp(rctx, &rstate->rstate[0], &rstate->state.clip); - rctx->clip = rstate; -} - -static void r600_set_framebuffer_state(struct pipe_context *ctx, - const struct pipe_framebuffer_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - int i; - - if (rctx->framebuffer) { - for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) - radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[i+1]); - radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[0]); - } - clean_flush(rctx, &rctx->hw_states.cb_flush); - clean_flush(rctx, &rctx->hw_states.db_flush); - rctx->pframebuffer = NULL; - r600_context_state_decref(rctx->framebuffer); - - rstate = r600_new_context_state(pipe_framebuffer_type); - rstate->state.framebuffer = *state; - for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) { - pipe_reference(NULL, &state->cbufs[i]->reference); - } - pipe_reference(NULL, &state->zsbuf->reference); - rctx->framebuffer = rstate; - rctx->pframebuffer = &rstate->state.framebuffer; - for (i = 0; i < state->nr_cbufs; i++) { - rctx->vtbl->cb(rctx, &rstate->rstate[i+1], state, i); - } - if (state->zsbuf) { - rctx->vtbl->db(rctx, &rstate->rstate[0], state); - } - /* setup flush states */ - setup_cb_flush(rctx, &rctx->hw_states.cb_flush); - setup_db_flush(rctx, &rctx->hw_states.db_flush); - - return; -} - -static void r600_set_polygon_stipple(struct pipe_context *ctx, - const struct pipe_poly_stipple *state) -{ -} - -static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask) -{ -} - -static void r600_set_scissor_state(struct pipe_context *ctx, - const struct pipe_scissor_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - - r600_context_state_decref(rctx->scissor); - - rstate = r600_new_context_state(pipe_scissor_type); - rstate->state.scissor = *state; - rctx->scissor = rstate; -} - -static void r600_set_stencil_ref(struct pipe_context *ctx, - const struct pipe_stencil_ref *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - - r600_context_state_decref(rctx->stencil_ref); - - rstate = r600_new_context_state(pipe_stencil_ref_type); - rstate->state.stencil_ref = *state; - rctx->stencil_ref = rstate; -} - -static void r600_set_vertex_buffers(struct pipe_context *ctx, - unsigned count, - const struct pipe_vertex_buffer *buffers) -{ - struct r600_context *rctx = r600_context(ctx); - unsigned i; - boolean any_user_buffers = FALSE; - - for (i = 0; i < rctx->nvertex_buffer; i++) { - pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); - } - memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); - for (i = 0; i < count; i++) { - rctx->vertex_buffer[i].buffer = NULL; - if (r600_buffer_is_user_buffer(buffers[i].buffer)) - any_user_buffers = TRUE; - pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); - } - rctx->any_user_vbs = any_user_buffers; - rctx->nvertex_buffer = count; -} - -static void r600_set_index_buffer(struct pipe_context *ctx, - const struct pipe_index_buffer *ib) -{ - struct r600_context *rctx = r600_context(ctx); - - if (ib) { - pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer); - memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer)); - } else { - pipe_resource_reference(&rctx->index_buffer.buffer, NULL); - memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer)); - } - - /* TODO make this more like a state */ -} - -static void r600_set_viewport_state(struct pipe_context *ctx, - const struct pipe_viewport_state *state) -{ - struct r600_context *rctx = r600_context(ctx); - struct r600_context_state *rstate; - - r600_context_state_decref(rctx->viewport); - - rstate = r600_new_context_state(pipe_viewport_type); - rstate->state.viewport = *state; - rctx->vtbl->viewport(rctx, &rstate->rstate[0], &rstate->state.viewport); - rctx->viewport = rstate; -} - -void r600_init_state_functions(struct r600_context *rctx) -{ - rctx->context.create_blend_state = r600_create_blend_state; - rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state; - rctx->context.create_fs_state = r600_create_shader_state; - rctx->context.create_rasterizer_state = r600_create_rs_state; - rctx->context.create_sampler_state = r600_create_sampler_state; - rctx->context.create_sampler_view = r600_create_sampler_view; - rctx->context.create_vertex_elements_state = r600_create_vertex_elements; - rctx->context.create_vs_state = r600_create_shader_state; - rctx->context.bind_blend_state = r600_bind_blend_state; - rctx->context.bind_depth_stencil_alpha_state = r600_bind_dsa_state; - rctx->context.bind_fragment_sampler_states = r600_bind_ps_sampler; - rctx->context.bind_fs_state = r600_bind_ps_shader; - rctx->context.bind_rasterizer_state = r600_bind_rasterizer_state; - rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements; - rctx->context.bind_vertex_sampler_states = r600_bind_vs_sampler; - rctx->context.bind_vs_state = r600_bind_vs_shader; - rctx->context.delete_blend_state = r600_delete_state; - rctx->context.delete_depth_stencil_alpha_state = r600_delete_state; - rctx->context.delete_fs_state = r600_delete_state; - rctx->context.delete_rasterizer_state = r600_delete_state; - rctx->context.delete_sampler_state = r600_delete_state; - rctx->context.delete_vertex_elements_state = r600_delete_vertex_element; - rctx->context.delete_vs_state = r600_delete_state; - rctx->context.set_blend_color = r600_set_blend_color; - rctx->context.set_clip_state = r600_set_clip_state; - - if (radeon_get_family_class(rctx->rw) == EVERGREEN) - rctx->context.set_constant_buffer = eg_set_constant_buffer; - else if (rctx->screen->use_mem_constant) - rctx->context.set_constant_buffer = r600_set_constant_buffer_mem; - else - rctx->context.set_constant_buffer = r600_set_constant_buffer_file; - - rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_view; - rctx->context.set_framebuffer_state = r600_set_framebuffer_state; - rctx->context.set_polygon_stipple = r600_set_polygon_stipple; - rctx->context.set_sample_mask = r600_set_sample_mask; - rctx->context.set_scissor_state = r600_set_scissor_state; - rctx->context.set_stencil_ref = r600_set_stencil_ref; - rctx->context.set_vertex_buffers = r600_set_vertex_buffers; - rctx->context.set_index_buffer = r600_set_index_buffer; - rctx->context.set_vertex_sampler_views = r600_set_vs_sampler_view; - rctx->context.set_viewport_state = r600_set_viewport_state; - rctx->context.sampler_view_destroy = r600_sampler_view_destroy; -} - -struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate) -{ - if (rstate == NULL) - return NULL; - rstate->refcount++; - return rstate; -} - -struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate) -{ - unsigned i; - - if (rstate == NULL) - return NULL; - if (--rstate->refcount) - return NULL; - switch (rstate->type) { - case pipe_sampler_view_type: - pipe_resource_reference(&rstate->state.sampler_view.texture, NULL); - break; - case pipe_framebuffer_type: - for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) { - pipe_surface_reference(&rstate->state.framebuffer.cbufs[i], NULL); - radeon_state_fini(&rstate->rstate[i+1]); - } - pipe_surface_reference(&rstate->state.framebuffer.zsbuf, NULL); - break; - case pipe_viewport_type: - case pipe_depth_type: - case pipe_rasterizer_type: - case pipe_poly_stipple_type: - case pipe_scissor_type: - case pipe_clip_type: - case pipe_stencil_type: - case pipe_alpha_type: - case pipe_dsa_type: - case pipe_blend_type: - case pipe_stencil_ref_type: - case pipe_shader_type: - case pipe_sampler_type: - break; - default: - R600_ERR("invalid type %d\n", rstate->type); - return NULL; - } - radeon_state_fini(&rstate->rstate[0]); - FREE(rstate); - return NULL; -} - -static void r600_bind_shader_sampler(struct r600_context *rctx, struct r600_shader_sampler_states *sampler) -{ - int i; - - for (i = 0; i < sampler->nsampler; i++) { - if (sampler->sampler[i]) - radeon_draw_bind(&rctx->draw, sampler->sampler[i]); - } - - for (i = 0; i < sampler->nborder; i++) { - if (sampler->border[i]) - radeon_draw_bind(&rctx->draw, sampler->border[i]); - } - - for (i = 0; i < sampler->nview; i++) { - if (sampler->view[i]) - radeon_draw_bind(&rctx->draw, sampler->view[i]); - } -} - -static void clean_flush(struct r600_context *rctx, struct radeon_state *flush) -{ - struct r600_screen *rscreen = rctx->screen; - int i; - - for (i = 0 ; i < flush->nbo; i++) { - radeon_ws_bo_reference(rscreen->rw, &flush->bo[i], NULL); - } - flush->nbo = 0; - radeon_state_fini(flush); -} - -static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - struct pipe_surface *surf; - int i; - - radeon_state_init(flush, rscreen->rw, R600_STATE_CB_FLUSH, 0, 0); - - for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { - surf = rctx->framebuffer->state.framebuffer.cbufs[i]; - - rtex = (struct r600_resource_texture*)surf->texture; - rbuffer = &rtex->resource; - /* just need to the bo to the flush list */ - radeon_ws_bo_reference(rscreen->rw, &flush->bo[i], rbuffer->bo); - flush->placement[i] = RADEON_GEM_DOMAIN_VRAM; - } - flush->nbo = rctx->framebuffer->state.framebuffer.nr_cbufs; - return radeon_state_pm4(flush); -} - -static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush) -{ - struct r600_screen *rscreen = rctx->screen; - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - struct pipe_surface *surf; - - surf = rctx->framebuffer->state.framebuffer.zsbuf; - - radeon_state_init(flush, rscreen->rw, R600_STATE_DB_FLUSH, 0, 0); - - if (surf) { - rtex = (struct r600_resource_texture*)surf->texture; - rbuffer = &rtex->resource; - /* just need to the bo to the flush list */ - radeon_ws_bo_reference(rscreen->rw, &flush->bo[0], rbuffer->bo); - flush->placement[0] = RADEON_GEM_DOMAIN_VRAM; - - flush->nbo = 1; - } - return radeon_state_pm4(flush); -} - -int r600_context_hw_states(struct pipe_context *ctx) -{ - struct r600_context *rctx = r600_context(ctx); - unsigned i; - - /* build new states */ - rctx->vtbl->rasterizer(rctx, &rctx->hw_states.rasterizer); - rctx->vtbl->scissor(rctx, &rctx->hw_states.scissor); - rctx->vtbl->dsa(rctx, &rctx->hw_states.dsa); - rctx->vtbl->cb_cntl(rctx, &rctx->hw_states.cb_cntl); - - /* bind states */ - radeon_draw_bind(&rctx->draw, &rctx->config); - - radeon_draw_bind(&rctx->draw, &rctx->hw_states.rasterizer); - radeon_draw_bind(&rctx->draw, &rctx->hw_states.scissor); - radeon_draw_bind(&rctx->draw, &rctx->hw_states.dsa); - radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_cntl); - - radeon_draw_bind(&rctx->draw, &rctx->hw_states.db_flush); - radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_flush); - - if (rctx->viewport) { - radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate[0]); - } - if (rctx->blend) { - radeon_draw_bind(&rctx->draw, &rctx->blend->rstate[0]); - } - if (rctx->clip) { - radeon_draw_bind(&rctx->draw, &rctx->clip->rstate[0]); - } - for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) { - radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[i+1]); - } - if (rctx->framebuffer->state.framebuffer.zsbuf) { - radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[0]); - } - - r600_bind_shader_sampler(rctx, &rctx->vs_sampler); - r600_bind_shader_sampler(rctx, &rctx->ps_sampler); - - return 0; -} diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index c24aaeefa77..7979f856032 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -31,8 +31,7 @@ #include #include #include "state_tracker/drm_driver.h" -#include "r600_screen.h" -#include "r600_context.h" +#include "r600_pipe.h" #include "r600_resource.h" #include "r600_state_inlines.h" #include "r600d.h" @@ -123,7 +122,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, resource->base.vtbl = &r600_texture_vtbl; pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; - r600_setup_miptree(rtex, radeon_get_family_class(radeon)); + r600_setup_miptree(rtex, r600_get_family_class(radeon)); /* FIXME alignment 4096 enought ? too much ? */ resource->domain = r600_domain_from_usage(resource->base.b.bind); diff --git a/src/gallium/drivers/r600/r700_asm.c b/src/gallium/drivers/r600/r700_asm.c index 9c731f2dbb9..892dee86baf 100644 --- a/src/gallium/drivers/r600/r700_asm.c +++ b/src/gallium/drivers/r600/r700_asm.c @@ -20,12 +20,11 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "radeon.h" -#include "r600_context.h" -#include "r600_asm.h" +#include #include "util/u_memory.h" +#include "r600_pipe.h" +#include "r600_asm.h" #include "r700_sq.h" -#include int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id) diff --git a/src/gallium/winsys/r600/drm/Makefile b/src/gallium/winsys/r600/drm/Makefile index 8a84ceec698..41e736c9cde 100644 --- a/src/gallium/winsys/r600/drm/Makefile +++ b/src/gallium/winsys/r600/drm/Makefile @@ -6,17 +6,12 @@ LIBNAME = r600winsys C_SOURCES = \ bof.c \ - r600_state.c \ r600_state2.c \ evergreen_state.c \ r600.c \ - radeon_ctx.c \ - radeon_draw.c \ - radeon_state.c \ + r600_drm.c \ radeon_bo.c \ radeon_pciid.c \ - radeon.c \ - r600_drm.c \ radeon_ws_bo.c \ radeon_bo_pb.c diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h deleted file mode 100644 index ced7f147c0f..00000000000 --- a/src/gallium/winsys/r600/drm/eg_states.h +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright © 2009 Jerome Glisse - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef EG_STATES_H -#define EG_STATES_H - -static const struct radeon_register EG_names_CONFIG[] = { - {0x00008C00, 0, 0, "SQ_CONFIG"}, - {0x00009100, 0, 0, "SPI_CONFIG_CNTL"}, - {0x0000913C, 0, 0, "SPI_CONFIG_CNTL_1"}, - {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"}, - {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"}, - {0x00008C0C, 0, 0, "SQ_GPR_RESOURCE_MGMT_3"}, - {0x00008C18, 0, 0, "SQ_THREAD_RESOURCE_MGMT_1"}, - {0x00008C1C, 0, 0, "SQ_THREAD_RESOURCE_MGMT_2"}, - {0x00008C20, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"}, - {0x00008C24, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"}, - {0x00008C28, 0, 0, "SQ_STACK_RESOURCE_MGMT_3"}, - {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"}, - {0x00008A14, 0, 0, "PA_CL_ENHANCE"}, - {0x00028838, 0, 0, "SQ_DYN_GPR_RESOURCE_LIMIT_1"}, - {0x000288EC, 0, 0, "SQ_LDS_ALLOC_PS"}, - {0x00028350, 0, 0, "SX_MISC"}, - {0x00028900, 0, 0, "SQ_ESGS_RING_ITEMSIZE"}, - {0x00028904, 0, 0, "SQ_GSVS_RING_ITEMSIZE"}, - {0x00028908, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"}, - {0x0002890C, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"}, - {0x00028910, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"}, - {0x00028914, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"}, - {0x0002891C, 0, 0, "SQ_GS_VERT_ITEMSIZE"}, - {0x00028920, 0, 0, "SQ_GS_VERT_ITEMSIZE_1"}, - {0x00028924, 0, 0, "SQ_GS_VERT_ITEMSIZE_2"}, - {0x00028928, 0, 0, "SQ_GS_VERT_ITEMSIZE_3"}, - {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"}, - {0x00028A14, 0, 0, "VGT_HOS_CNTL"}, - {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"}, - {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"}, - {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"}, - {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"}, - {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"}, - {0x00028A2C, 0, 0, "VGT_GROUP_DECR"}, - {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"}, - {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"}, - {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"}, - {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"}, - {0x00028A40, 0, 0, "VGT_GS_MODE"}, - {0x00028A48, 0, 0, "PA_SC_MODE_CNTL_0"}, - {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL_1"}, - {0x00028AB4, 0, 0, "VGT_REUSE_OFF"}, - {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"}, - {0x00028B54, 0, 0, "VGT_SHADER_STAGES_EN"}, - {0x00028B94, 0, 0, "VGT_STRMOUT_CONFIG"}, - {0x00028B98, 0, 0, "VGT_STRMOUT_BUFFER_CONFIG"}, -}; - -static const struct radeon_register EG_names_CB_CNTL[] = { - {0x00028238, 0, 0, "CB_TARGET_MASK"}, - {0x0002823C, 0, 0, "CB_SHADER_MASK"}, - {0x00028808, 0, 0, "CB_COLOR_CONTROL"}, - {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"}, - {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"}, - {0x00028C3C, 0, 0, "PA_SC_AA_MASK"}, -}; - -static const struct radeon_register EG_names_RASTERIZER[] = { - {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"}, - {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"}, - {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"}, - {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"}, - {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"}, - {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"}, - {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"}, - {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"}, - {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"}, - {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"}, - {0x00028C08, 0, 0, "PA_SU_VTX_CNTL"}, - {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"}, - {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"}, - {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"}, - {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"}, - {0x00028B78, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"}, - {0x00028B7C, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"}, - {0x00028B80, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"}, - {0x00028B84, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"}, - {0x00028B88, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"}, - {0x00028B8C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"}, -}; - -/* Viewport states are same as r600 */ -static const struct radeon_register EG_names_VIEWPORT[] = { - {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"}, - {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"}, - {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"}, - {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"}, - {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"}, - {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"}, - {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"}, - {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"}, - {0x00028818, 0, 0, "PA_CL_VTE_CNTL"}, -}; - -/* scissor is same as R600 */ -static const struct radeon_register EG_names_SCISSOR[] = { - {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"}, - {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"}, - {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"}, - {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"}, - {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"}, - {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"}, - {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"}, - {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"}, - {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"}, - {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"}, - {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"}, - {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"}, - {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"}, - {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"}, - {0x00028230, 0, 0, "PA_SC_EDGERULE"}, - {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"}, - {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"}, - {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"}, - {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"}, - {0x00028234, 0, 0, "PA_SU_HARDWARE_SCREEN_OFFSET"}, -}; - -/* same as r700 i.e. no blend control */ -static const struct radeon_register EG_names_BLEND[] = { - {0x00028414, 0, 0, "CB_BLEND_RED"}, - {0x00028418, 0, 0, "CB_BLEND_GREEN"}, - {0x0002841C, 0, 0, "CB_BLEND_BLUE"}, - {0x00028420, 0, 0, "CB_BLEND_ALPHA"}, - {0x00028780, 0, 0, "CB_BLEND0_CONTROL"}, - {0x00028784, 0, 0, "CB_BLEND1_CONTROL"}, - {0x00028788, 0, 0, "CB_BLEND2_CONTROL"}, - {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"}, - {0x00028790, 0, 0, "CB_BLEND4_CONTROL"}, - {0x00028794, 0, 0, "CB_BLEND5_CONTROL"}, - {0x00028798, 0, 0, "CB_BLEND6_CONTROL"}, - {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"}, -}; - -/* different */ -static const struct radeon_register EG_names_DSA[] = { - {0x00028028, 0, 0, "DB_STENCIL_CLEAR"}, - {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"}, - {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"}, - {0x00028430, 0, 0, "DB_STENCILREFMASK"}, - {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"}, - {0x00028438, 0, 0, "SX_ALPHA_REF"}, - {0x000286DC, 0, 0, "SPI_FOG_CNTL"}, - {0x00028800, 0, 0, "DB_DEPTH_CONTROL"}, - {0x0002880C, 0, 0, "DB_SHADER_CONTROL"}, - {0x00028000, 0, 0, "DB_RENDER_CONTROL"}, - {0x00028004, 0, 0, "DB_COUNT_CONTROL"}, - {0x0002800C, 0, 0, "DB_RENDER_OVERRIDE"}, - {0x00028010, 0, 0, "DB_RENDER_OVERRIDE2"}, - {0x00028AC0, 0, 0, "DB_SRESULTS_COMPARE_STATE0"}, - {0x00028AC4, 0, 0, "DB_SRESULTS_COMPARE_STATE1"}, - {0x00028AC8, 0, 0, "DB_PRELOAD_CONTROL"}, - {0x00028B70, 0, 0, "DB_ALPHA_TO_MASK"}, -}; - -/* different */ -static const struct radeon_register EG_names_VS_SHADER[] = { - {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"}, - {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"}, - {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"}, - {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"}, - {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"}, - {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"}, - {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"}, - {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"}, - {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"}, - {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"}, - {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"}, - {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"}, - {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"}, - {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"}, - {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"}, - {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"}, - {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"}, - {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"}, - {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"}, - {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"}, - {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"}, - {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"}, - {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"}, - {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"}, - {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"}, - {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"}, - {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"}, - {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"}, - {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"}, - {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"}, - {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"}, - {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"}, - {0x0002861C, 0, 0, "SPI_VS_OUT_ID_0"}, // all diff belwo - {0x00028620, 0, 0, "SPI_VS_OUT_ID_1"}, - {0x00028624, 0, 0, "SPI_VS_OUT_ID_2"}, - {0x00028628, 0, 0, "SPI_VS_OUT_ID_3"}, - {0x0002862C, 0, 0, "SPI_VS_OUT_ID_4"}, - {0x00028630, 0, 0, "SPI_VS_OUT_ID_5"}, - {0x00028634, 0, 0, "SPI_VS_OUT_ID_6"}, - {0x00028638, 0, 0, "SPI_VS_OUT_ID_7"}, - {0x0002863C, 0, 0, "SPI_VS_OUT_ID_8"}, - {0x00028640, 0, 0, "SPI_VS_OUT_ID_9"}, - {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"}, - {0x0002885C, 1, 0, "SQ_PGM_START_VS"}, - {0x00028860, 0, 0, "SQ_PGM_RESOURCES_VS"}, - {0x00028864, 0, 0, "SQ_PGM_RESOURCES_2_VS"}, - {0x000288A4, 1, 1, "SQ_PGM_START_FS"}, - {0x000288A8, 0, 0, "SQ_PGM_RESOURCES_FS"}, -}; - -static const struct radeon_register EG_names_PS_SHADER[] = { - {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"}, - {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"}, - {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"}, - {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"}, - {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"}, - {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"}, - {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"}, - {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"}, - {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"}, - {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"}, - {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"}, - {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"}, - {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"}, - {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"}, - {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"}, - {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"}, - {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"}, - {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"}, - {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"}, - {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"}, - {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"}, - {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"}, - {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"}, - {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"}, - {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"}, - {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"}, - {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"}, - {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"}, - {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"}, - {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"}, - {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"}, - {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"}, - {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"}, - {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"}, - {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"}, - {0x000286D8, 0, 0, "SPI_INPUT_Z"}, - {0x000286E0, 0, 0, "SPI_BARYC_CNTL"}, - {0x000286E4, 0, 0, "SPI_PS_IN_CONTROL_2"}, - {0x000286E8, 0, 0, "SPI_COMPUTE_INPUT_CNTL"}, - {0x00028840, 1, 0, "SQ_PGM_START_PS"}, // diff - {0x00028844, 0, 0, "SQ_PGM_RESOURCES_PS"}, // diff - {0x00028848, 0, 0, "SQ_PGM_RESOURCES_2_PS"}, // diff - {0x0002884C, 0, 0, "SQ_PGM_EXPORTS_PS"}, // diff -}; - -/* different */ -static const struct radeon_register EG_names_UCP[] = { - {0x000285BC, 0, 0, "PA_CL_UCP0_X"}, - {0x000285C0, 0, 0, "PA_CL_UCP0_Y"}, - {0x000285C4, 0, 0, "PA_CL_UCP0_Z"}, - {0x000285C8, 0, 0, "PA_CL_UCP0_W"}, - {0x000285CC, 0, 0, "PA_CL_UCP1_X"}, - {0x000285D0, 0, 0, "PA_CL_UCP1_Y"}, - {0x000285D4, 0, 0, "PA_CL_UCP1_Z"}, - {0x000285D8, 0, 0, "PA_CL_UCP1_W"}, - {0x000285DC, 0, 0, "PA_CL_UCP2_X"}, - {0x000285E0, 0, 0, "PA_CL_UCP2_Y"}, - {0x000285E4, 0, 0, "PA_CL_UCP2_Z"}, - {0x000285E8, 0, 0, "PA_CL_UCP2_W"}, - {0x000285EC, 0, 0, "PA_CL_UCP3_X"}, - {0x000285F0, 0, 0, "PA_CL_UCP3_Y"}, - {0x000285F4, 0, 0, "PA_CL_UCP3_Z"}, - {0x000285F8, 0, 0, "PA_CL_UCP3_W"}, - {0x000285FC, 0, 0, "PA_CL_UCP4_X"}, - {0x00028600, 0, 0, "PA_CL_UCP4_Y"}, - {0x00028604, 0, 0, "PA_CL_UCP4_Z"}, - {0x00028608, 0, 0, "PA_CL_UCP4_W"}, - {0x0002860C, 0, 0, "PA_CL_UCP5_X"}, - {0x00028610, 0, 0, "PA_CL_UCP5_Y"}, - {0x00028614, 0, 0, "PA_CL_UCP5_Z"}, - {0x00028618, 0, 0, "PA_CL_UCP5_W"}, -}; - -static const struct radeon_register EG_names_VS_CBUF[] = { - {0x00028180, 0, 0, "ALU_CONST_BUFFER_SIZE_VS_0"}, - {0x00028980, 1, 0, "ALU_CONST_CACHE_VS_0"}, -}; - -static const struct radeon_register EG_names_PS_CBUF[] = { - {0x00028140, 0, 0, "ALU_CONST_BUFFER_SIZE_PS_0"}, - {0x00028940, 1, 0, "ALU_CONST_CACHE_PS_0"}, -}; - -static const struct radeon_register EG_names_PS_RESOURCE[] = { - {0x00030000, 0, 0, "RESOURCE0_WORD0"}, - {0x00030004, 0, 0, "RESOURCE0_WORD1"}, - {0x00030008, 0, 0, "RESOURCE0_WORD2"}, - {0x0003000C, 0, 0, "RESOURCE0_WORD3"}, - {0x00030010, 0, 0, "RESOURCE0_WORD4"}, - {0x00030014, 0, 0, "RESOURCE0_WORD5"}, - {0x00030018, 0, 0, "RESOURCE0_WORD6"}, - {0x0003001c, 0, 0, "RESOURCE0_WORD7"}, -}; - -static const struct radeon_register EG_names_VS_RESOURCE[] = { - {0x00031600, 0, 0, "RESOURCE160_WORD0"}, - {0x00031604, 0, 0, "RESOURCE160_WORD1"}, - {0x00031608, 0, 0, "RESOURCE160_WORD2"}, - {0x0003160C, 0, 0, "RESOURCE160_WORD3"}, - {0x00031610, 0, 0, "RESOURCE160_WORD4"}, - {0x00031614, 0, 0, "RESOURCE160_WORD5"}, - {0x00031618, 0, 0, "RESOURCE160_WORD6"}, - {0x0003161c, 0, 0, "RESOURCE160_WORD7"}, -}; - -static const struct radeon_register EG_names_FS_RESOURCE[] = { - {0x0003A300, 0, 0, "RESOURCE320_WORD0"}, - {0x0003A304, 0, 0, "RESOURCE320_WORD1"}, - {0x0003A308, 0, 0, "RESOURCE320_WORD2"}, - {0x0003A30C, 0, 0, "RESOURCE320_WORD3"}, - {0x0003A310, 0, 0, "RESOURCE320_WORD4"}, - {0x0003A314, 0, 0, "RESOURCE320_WORD5"}, - {0x0003A318, 0, 0, "RESOURCE320_WORD6"}, - {0x0003A31C, 0, 0, "RESOURCE320_WORD7"}, -}; - -static const struct radeon_register EG_names_GS_RESOURCE[] = { - {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"}, - {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"}, - {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"}, - {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"}, - {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"}, - {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"}, - {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"}, - {0x0003A4DC, 0, 0, "RESOURCE336_WORD7"}, -}; - -static const struct radeon_register EG_names_PS_SAMPLER[] = { - {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"}, - {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"}, - {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"}, -}; - -static const struct radeon_register EG_names_VS_SAMPLER[] = { - {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"}, - {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"}, - {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"}, -}; - -static const struct radeon_register EG_names_GS_SAMPLER[] = { - {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"}, - {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"}, - {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"}, -}; - -static const struct radeon_register EG_names_PS_SAMPLER_BORDER[] = { - {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_INDEX"}, - {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, - {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, - {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, - {0x0000A410, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register EG_names_VS_SAMPLER_BORDER[] = { - {0x0000A414, 0, 0, "TD_VS_SAMPLER0_BORDER_INDEX"}, - {0x0000A418, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, - {0x0000A41C, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, - {0x0000A420, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, - {0x0000A424, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register EG_names_GS_SAMPLER_BORDER[] = { - {0x0000A428, 0, 0, "TD_GS_SAMPLER0_BORDER_INDEX"}, - {0x0000A42C, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, - {0x0000A430, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, - {0x0000A434, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, - {0x0000A438, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register EG_names_CB[] = { - {0x00028C60, 1, 0, "CB_COLOR0_BASE"}, - {0x00028C64, 0, 0, "CB_COLOR0_PITCH"}, - {0x00028C68, 0, 0, "CB_COLOR0_SLICE"}, - {0x00028C6C, 0, 0, "CB_COLOR0_VIEW"}, - {0x00028C70, 1, 0, "CB_COLOR0_INFO"}, - {0x00028C74, 0, 0, "CB_COLOR0_ATTRIB"}, - {0x00028C78, 0, 0, "CB_COLOR0_DIM"}, -}; - -/* different - TODO */ -static const struct radeon_register EG_names_DB[] = { - {0x00028014, 1, 0, "DB_HTILE_DATA_BASE"}, - {0x00028040, 1, 0, "DB_Z_INFO"}, - {0x00028044, 0, 0, "DB_STENCIL_INFO"}, - {0x00028058, 0, 0, "DB_DEPTH_SIZE"}, - {0x0002805C, 0, 0, "DB_DEPTH_SLICE"}, - {0x00028008, 0, 0, "DB_DEPTH_VIEW"}, - {0x00028ABC, 0, 0, "DB_HTILE_SURFACE"}, - {0x00028048, 1, 0, "DB_Z_READ_BASE"}, - {0x0002804C, 1, 0, "DB_STENCIL_READ_BASE"}, - {0x00028050, 1, 0, "DB_Z_WRITE_BASE"}, - {0x00028054, 1, 0, "DB_STENCIL_WRITE_BASE"}, -}; - -static const struct radeon_register EG_names_VGT[] = { - {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, //s - {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, //s - {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, //s - {0x00028408, 0, 0, "VGT_INDX_OFFSET"}, //s - {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"}, //s - {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"}, //s - {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"}, //s - {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"}, //s - {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"}, //s - {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, //s -}; - -static const struct radeon_register EG_names_DRAW[] = { - {0x00008970, 0, 0, "VGT_NUM_INDICES"}, - {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, //same - {0x000287E8, 1, 0, "VGT_DMA_BASE"}, //same - {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, //same -}; - -static const struct radeon_register EG_names_VGT_EVENT[] = { - {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, //done -}; - -static const struct radeon_register EG_names_CB_FLUSH[] = { -}; - -static const struct radeon_register EG_names_DB_FLUSH[] = { -}; - -#endif diff --git a/src/gallium/winsys/r600/drm/gen_eg_states.py b/src/gallium/winsys/r600/drm/gen_eg_states.py deleted file mode 100644 index b2e5b2203a4..00000000000 --- a/src/gallium/winsys/r600/drm/gen_eg_states.py +++ /dev/null @@ -1,39 +0,0 @@ -import os -import re - -def main(): - fileIN = open('eg_states.h', 'r') - line = fileIN.readline() - next_is_reg = False - count = 0 - - print "/* This file is autogenerated from eg_states.h - do not edit directly */" - print "/* autogenerating script is gen_eg_states.py */" - print "" - while line: - if line[0:2] == "};": - if next_is_reg == True: - print "#define " + name + "_SIZE\t\t", count - print "#define " + name + "_PM4 128\t\t" - next_is_reg = False - count = 0 - print "" - - if line[0:6] == "static": - name = line.rstrip("\n") - cline = name.split() - name = cline[4].split('[') - name = name[0].replace("_names", "") - print "/* " + name + " */" - next_is_reg = True - elif next_is_reg == True: - reg = line.split(); - reg = reg[3].replace("},", "") - reg = reg.replace("\"", "") - print "#define " + name + "__" + reg + "\t\t", count - count = count + 1 - - line = fileIN.readline() - -if __name__ == "__main__": - main() diff --git a/src/gallium/winsys/r600/drm/gen_r600_states.py b/src/gallium/winsys/r600/drm/gen_r600_states.py deleted file mode 100644 index 9bd5ab20825..00000000000 --- a/src/gallium/winsys/r600/drm/gen_r600_states.py +++ /dev/null @@ -1,39 +0,0 @@ -import os -import re - -def main(): - fileIN = open('r600_states.h', 'r') - line = fileIN.readline() - next_is_reg = False - count = 0 - - print "/* This file is autogenerated from r600_states.h - do not edit directly */" - print "/* autogenerating script is gen_r600_states.py */" - print "" - while line: - if line[0:2] == "};": - if next_is_reg == True: - print "#define " + name + "_SIZE\t\t", count - print "#define " + name + "_PM4 128\t\t" - next_is_reg = False - count = 0 - print "" - - if line[0:6] == "static": - name = line.rstrip("\n") - cline = name.split() - name = cline[4].split('[') - name = name[0].replace("_names", "") - print "/* " + name + " */" - next_is_reg = True - elif next_is_reg == True: - reg = line.split(); - reg = reg[3].replace("},", "") - reg = reg.replace("\"", "") - print "#define " + name + "__" + reg + "\t\t", count - count = count + 1 - - line = fileIN.readline() - -if __name__ == "__main__": - main() diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 7a1a762f540..a7ad96f5a20 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -25,14 +25,166 @@ * Corbin Simpson * Joakim Sindholt */ +#include +#include #include #include "util/u_inlines.h" #include "util/u_debug.h" +#include #include "radeon_priv.h" #include "r600_drm_public.h" +#include "xf86drm.h" +#include "radeon_drm.h" + +static int radeon_get_device(struct radeon *radeon) +{ + struct drm_radeon_info info; + int r; + + radeon->device = 0; + info.request = RADEON_INFO_DEVICE_ID; + info.value = (uintptr_t)&radeon->device; + r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info, + sizeof(struct drm_radeon_info)); + return r; +} + +struct radeon *radeon_new(int fd, unsigned device) +{ + struct radeon *radeon; + int r; + + radeon = calloc(1, sizeof(*radeon)); + if (radeon == NULL) { + return NULL; + } + radeon->fd = fd; + radeon->device = device; + radeon->refcount = 1; + if (fd >= 0) { + r = radeon_get_device(radeon); + if (r) { + fprintf(stderr, "Failed to get device id\n"); + return radeon_decref(radeon); + } + } + radeon->family = radeon_family_from_device(radeon->device); + if (radeon->family == CHIP_UNKNOWN) { + fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->device); + return radeon_decref(radeon); + } + switch (radeon->family) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + case CHIP_CEDAR: + case CHIP_REDWOOD: + case CHIP_JUNIPER: + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + break; + case CHIP_R100: + case CHIP_RV100: + case CHIP_RS100: + case CHIP_RV200: + case CHIP_RS200: + case CHIP_R200: + case CHIP_RV250: + case CHIP_RS300: + case CHIP_RV280: + case CHIP_R300: + case CHIP_R350: + case CHIP_RV350: + case CHIP_RV380: + case CHIP_R420: + case CHIP_R423: + case CHIP_RV410: + case CHIP_RS400: + case CHIP_RS480: + case CHIP_RS600: + case CHIP_RS690: + case CHIP_RS740: + case CHIP_RV515: + case CHIP_R520: + case CHIP_RV530: + case CHIP_RV560: + case CHIP_RV570: + case CHIP_R580: + default: + fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", + __func__, radeon->device); + break; + } + + /* setup class */ + switch (radeon->family) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + radeon->chip_class = R600; + break; + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + radeon->chip_class = R700; + break; + case CHIP_CEDAR: + case CHIP_REDWOOD: + case CHIP_JUNIPER: + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + radeon->chip_class = EVERGREEN; + break; + default: + fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", + __func__, radeon->device); + break; + } + + radeon->mman = pb_malloc_bufmgr_create(); + if (!radeon->mman) + return NULL; + radeon->kman = radeon_bo_pbmgr_create(radeon); + if (!radeon->kman) + return NULL; + radeon->cman = pb_cache_manager_create(radeon->kman, 100000); + if (!radeon->cman) + return NULL; + return radeon; +} struct radeon *r600_drm_winsys_create(int drmfd) { return radeon_new(drmfd, 0); } +struct radeon *radeon_decref(struct radeon *radeon) +{ + if (radeon == NULL) + return NULL; + if (--radeon->refcount > 0) { + return NULL; + } + + radeon->mman->destroy(radeon->mman); + radeon->cman->destroy(radeon->cman); + radeon->kman->destroy(radeon->kman); + drmClose(radeon->fd); + free(radeon); + return NULL; +} diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c deleted file mode 100644 index 25dd8fe7d81..00000000000 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ /dev/null @@ -1,662 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include -#include -#include "radeon_priv.h" -#include "r600d.h" - -#include "util/u_memory.h" - -static int r600_state_pm4_resource(struct radeon_state *state); -static int r600_state_pm4_cb0(struct radeon_state *state); -static int r600_state_pm4_vgt(struct radeon_state *state); -static int r600_state_pm4_db(struct radeon_state *state); -static int r600_state_pm4_shader(struct radeon_state *state); -static int r600_state_pm4_draw(struct radeon_state *state); -static int r600_state_pm4_config(struct radeon_state *state); -static int r600_state_pm4_generic(struct radeon_state *state); -static int r600_state_pm4_query_begin(struct radeon_state *state); -static int r600_state_pm4_query_end(struct radeon_state *state); -static int r700_state_pm4_config(struct radeon_state *state); -static int r600_state_pm4_db_flush(struct radeon_state *state); -static int r600_state_pm4_cb_flush(struct radeon_state *state); - -static int eg_state_pm4_vgt(struct radeon_state *state); - -#include "r600_states.h" -#include "eg_states.h" - - -#define SUB_NONE(param) { { 0, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } } -#define SUB_PS(param) { R600_SHADER_PS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } -#define SUB_VS(param) { R600_SHADER_VS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } -#define SUB_GS(param) { R600_SHADER_GS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } -#define SUB_FS(param) { R600_SHADER_FS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } - -#define EG_SUB_NONE(param) { { 0, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } } -#define EG_SUB_PS(param) { R600_SHADER_PS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } -#define EG_SUB_VS(param) { R600_SHADER_VS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } -#define EG_SUB_GS(param) { R600_SHADER_GS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } -#define EG_SUB_FS(param) { R600_SHADER_FS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } - -/* some of these are overriden at runtime for R700 */ -struct radeon_stype_info r600_stypes[] = { - { R600_STATE_CONFIG, 1, 0, r600_state_pm4_config, SUB_NONE(CONFIG), }, - { R600_STATE_CB_CNTL, 1, 0, r600_state_pm4_generic, SUB_NONE(CB_CNTL) }, - { R600_STATE_RASTERIZER, 1, 0, r600_state_pm4_generic, SUB_NONE(RASTERIZER) }, - { R600_STATE_VIEWPORT, 1, 0, r600_state_pm4_generic, SUB_NONE(VIEWPORT) }, - { R600_STATE_SCISSOR, 1, 0, r600_state_pm4_generic, SUB_NONE(SCISSOR) }, - { R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, SUB_NONE(BLEND), }, - { R600_STATE_DSA, 1, 0, r600_state_pm4_generic, SUB_NONE(DSA), }, - { R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_SHADER), SUB_VS(VS_SHADER) } }, - { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_CBUF), SUB_VS(VS_CBUF) } }, - { R600_STATE_CONSTANT, 256, 0x10, r600_state_pm4_generic, { SUB_PS(PS_CONSTANT), SUB_VS(VS_CONSTANT) } }, - { R600_STATE_RESOURCE, 160, 0x1c, r600_state_pm4_resource, { SUB_PS(PS_RESOURCE), SUB_VS(VS_RESOURCE), SUB_GS(GS_RESOURCE), SUB_FS(FS_RESOURCE)} }, - { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER), SUB_VS(VS_SAMPLER), SUB_GS(GS_SAMPLER) } }, - { R600_STATE_SAMPLER_BORDER, 18, 0x10, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER_BORDER), SUB_VS(VS_SAMPLER_BORDER), SUB_GS(GS_SAMPLER_BORDER) } }, - { R600_STATE_CB0, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB0) }, - { R600_STATE_CB1, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB1) }, - { R600_STATE_CB2, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB2) }, - { R600_STATE_CB3, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB3) }, - { R600_STATE_CB4, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB4) }, - { R600_STATE_CB5, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB5) }, - { R600_STATE_CB6, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB6) }, - { R600_STATE_CB7, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB7) }, - { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, SUB_NONE(VGT_EVENT) }, - { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, SUB_NONE(VGT_EVENT) }, - { R600_STATE_DB, 1, 0, r600_state_pm4_db, SUB_NONE(DB) }, - { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, SUB_NONE(UCP) }, - { R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) }, - { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) }, - { R600_STATE_CB_FLUSH, 1, 0, r600_state_pm4_cb_flush, SUB_NONE(CB_FLUSH) }, - { R600_STATE_DB_FLUSH, 1, 0, r600_state_pm4_db_flush, SUB_NONE(DB_FLUSH) }, -}; -#define STYPES_SIZE Elements(r600_stypes) - -struct radeon_stype_info eg_stypes[] = { - { R600_STATE_CONFIG, 1, 0, r700_state_pm4_config, EG_SUB_NONE(CONFIG), }, - { R600_STATE_CB_CNTL, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(CB_CNTL) }, - { R600_STATE_RASTERIZER, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(RASTERIZER) }, - { R600_STATE_VIEWPORT, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(VIEWPORT) }, - { R600_STATE_SCISSOR, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(SCISSOR) }, - { R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(BLEND), }, - { R600_STATE_DSA, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(DSA), }, - { R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_SHADER), EG_SUB_VS(VS_SHADER) } }, - { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_CBUF), EG_SUB_VS(VS_CBUF) } }, - { R600_STATE_RESOURCE, 176, 0x20, r600_state_pm4_resource, { EG_SUB_PS(PS_RESOURCE), EG_SUB_VS(VS_RESOURCE), EG_SUB_GS(GS_RESOURCE), EG_SUB_FS(FS_RESOURCE)} }, - { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER), EG_SUB_VS(VS_SAMPLER), EG_SUB_GS(GS_SAMPLER) } }, - { R600_STATE_SAMPLER_BORDER, 18, 0, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER_BORDER), EG_SUB_VS(VS_SAMPLER_BORDER), EG_SUB_GS(GS_SAMPLER_BORDER) } }, - { R600_STATE_CB0, 11, 0x3c, r600_state_pm4_generic, EG_SUB_NONE(CB) }, - { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, EG_SUB_NONE(VGT_EVENT) }, - { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, EG_SUB_NONE(VGT_EVENT) }, - { R600_STATE_DB, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(DB) }, - { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(UCP) }, - { R600_STATE_VGT, 1, 0, eg_state_pm4_vgt, EG_SUB_NONE(VGT) }, - { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, EG_SUB_NONE(DRAW) }, - { R600_STATE_CB_FLUSH, 1, 0, r600_state_pm4_cb_flush, EG_SUB_NONE(CB_FLUSH) }, - { R600_STATE_DB_FLUSH, 1, 0, r600_state_pm4_db_flush, EG_SUB_NONE(DB_FLUSH) }, - -}; -#define EG_STYPES_SIZE Elements(eg_stypes) - -static const struct radeon_register *get_regs(struct radeon_state *state) -{ - return state->stype->reginfo[state->shader_index].regs; -} - -/* - * r600/r700 state functions - */ -static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg) -{ - const struct radeon_register *regs = get_regs(state); - unsigned i; - int r; - - if (!offset) { - fprintf(stderr, "%s invalid register for state %d %d\n", - __func__, state->stype->stype, id); - return -EINVAL; - } - if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg); - state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - for (i = 0; i < nreg; i++) { - if (regs[id + i].need_reloc) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]); - } - } - return 0; - } - if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg); - state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - for (i = 0; i < nreg; i++) { - if (regs[id + i].need_reloc) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]); - } - } - return 0; - } - if (offset >= R600_ALU_CONST_OFFSET && offset < R600_ALU_CONST_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_ALU_CONST, nreg); - state->pm4[state->cpm4++] = (offset - R600_ALU_CONST_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - return 0; - } - if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg); - state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - return 0; - } - fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset); - return -EINVAL; -} - -static int eg_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg) -{ - const struct radeon_register *regs = get_regs(state); - unsigned i; - int r; - - if (!offset) { - fprintf(stderr, "%s invalid register for state %d %d\n", - __func__, state->stype->stype, id); - return -EINVAL; - } - if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg); - state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - for (i = 0; i < nreg; i++) { - if (regs[id + i].need_reloc) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]); - } - } - return 0; - } - if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg); - state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - for (i = 0; i < nreg; i++) { - if (regs[id + i].need_reloc) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]); - } - } - return 0; - } - if (offset >= EG_RESOURCE_OFFSET && offset < EG_RESOURCE_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, nreg); - state->pm4[state->cpm4++] = (offset - EG_RESOURCE_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - return 0; - } - if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) { - state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg); - state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2; - for (i = 0; i < nreg; i++) { - state->pm4[state->cpm4++] = state->states[id + i]; - } - return 0; - } - fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset); - return -EINVAL; -} - - -static int r600_state_pm4_generic(struct radeon_state *state) -{ - const struct radeon_register *regs = get_regs(state); - unsigned i, offset, nreg, coffset, loffset, soffset; - unsigned start; - int r; - - if (!state->nstates) - return 0; - soffset = state->id * state->stype->stride; - offset = loffset = regs[0].offset + soffset; - start = 0; - for (i = 1, nreg = 1; i < state->nstates; i++) { - coffset = regs[i].offset + soffset; - if (coffset == (loffset + 4)) { - nreg++; - loffset = coffset; - } else { - if (state->radeon->family >= CHIP_CEDAR) - r = eg_state_pm4_bytecode(state, offset, start, nreg); - else - r = r600_state_pm4_bytecode(state, offset, start, nreg); - if (r) { - fprintf(stderr, "%s invalid 0x%08X %d\n", __func__, start, nreg); - return r; - } - offset = loffset = coffset; - nreg = 1; - start = i; - } - } - if (state->radeon->family >= CHIP_CEDAR) - r = eg_state_pm4_bytecode(state, offset, start, nreg); - else - r = r600_state_pm4_bytecode(state, offset, start, nreg); - return r; -} - -static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int bufs_are_cbs) -{ - unsigned i, j, add, size; - uint32_t flags_cb; - - state->nreloc = 0; - for (i = 0; i < state->nbo; i++) { - for (j = 0, add = 1; j < state->nreloc; j++) { - if (state->bo[state->reloc_bo_id[j]] == state->bo[i]) { - add = 0; - break; - } - } - if (add) { - state->reloc_bo_id[state->nreloc++] = i; - } - } - for (i = 0; i < state->nreloc; i++) { - flags_cb = flags; - size = (radeon_ws_bo_get_size(state->bo[state->reloc_bo_id[i]]) + 255) >> 8; - state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3); - if (bufs_are_cbs) - flags_cb |= S_0085F0_CB0_DEST_BASE_ENA(1 << i); - state->pm4[state->cpm4++] = flags_cb; - state->pm4[state->cpm4++] = size; - state->pm4[state->cpm4++] = 0x00000000; - state->pm4[state->cpm4++] = 0x0000000A; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - state->reloc_pm4_id[i] = state->cpm4; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[state->reloc_bo_id[i]]); - } -} - -static int r600_state_pm4_cb0(struct radeon_state *state) -{ - int r; - uint32_t sbu; - r = r600_state_pm4_generic(state); - if (r) - return r; - - sbu = (2 << (state->stype->stype - R600_STATE_CB0)); - state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); - state->pm4[state->cpm4++] = sbu; - return 0; -} - -static int r600_state_pm4_db(struct radeon_state *state) -{ - int r; - - r = r600_state_pm4_generic(state); - if (r) - return r; - state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0); - state->pm4[state->cpm4++] = 0x00000001; - return 0; -} - -static int r600_state_pm4_config(struct radeon_state *state) -{ - state->pm4[state->cpm4++] = PKT3(PKT3_START_3D_CMDBUF, 0); - state->pm4[state->cpm4++] = 0x00000000; - state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); - state->pm4[state->cpm4++] = 0x00000010; - state->pm4[state->cpm4++] = 0x00028000; - return r600_state_pm4_generic(state); -} - -static int r600_state_pm4_query_begin(struct radeon_state *state) -{ - int r; - - state->cpm4 = 0; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); - state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; - state->pm4[state->cpm4++] = state->states[0]; - state->pm4[state->cpm4++] = 0x0; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]); - return 0; -} - -static int r600_state_pm4_query_end(struct radeon_state *state) -{ - int r; - - state->cpm4 = 0; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2); - state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE; - state->pm4[state->cpm4++] = state->states[0]; - state->pm4[state->cpm4++] = 0x0; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]); - return 0; -} - -static int r700_state_pm4_config(struct radeon_state *state) -{ - state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1); - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = 0x80000000; - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1); - state->pm4[state->cpm4++] = 0x00000010; - state->pm4[state->cpm4++] = 0x00028000; - return r600_state_pm4_generic(state); -} - -static int r600_state_pm4_shader(struct radeon_state *state) -{ - r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1), 0); - return r600_state_pm4_generic(state); -} - -static int eg_state_pm4_vgt(struct radeon_state *state) -{ - int r; - r = eg_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, EG_VGT__VGT_MAX_VTX_INDX, 1); - if (r) - return r; - r = eg_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, EG_VGT__VGT_MIN_VTX_INDX, 1); - if (r) - return r; - r = eg_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, EG_VGT__VGT_INDX_OFFSET, 1); - if (r) - return r; - r = eg_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, EG_VGT__VGT_PRIMITIVE_TYPE, 1); - if (r) - return r; - state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0); - state->pm4[state->cpm4++] = state->states[EG_VGT__VGT_DMA_INDEX_TYPE]; - state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0); - state->pm4[state->cpm4++] = state->states[EG_VGT__VGT_DMA_NUM_INSTANCES]; - return 0; -} - -static int r600_state_pm4_vgt(struct radeon_state *state) -{ - int r; - - r = r600_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, R600_VGT__VGT_MAX_VTX_INDX, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, R600_VGT__VGT_MIN_VTX_INDX, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, R600_VGT__VGT_INDX_OFFSET, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX, 1); - if (r) - return r; - r = r600_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, R600_VGT__VGT_PRIMITIVE_TYPE, 1); - if (r) - return r; - state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0); - state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_INDEX_TYPE]; - state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0); - state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_NUM_INSTANCES]; - return 0; -} - -static int r600_state_pm4_draw(struct radeon_state *state) -{ - int r; - - if (state->nbo) { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX, 3); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE_HI]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]); - } else { - state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES]; - state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR]; - } - state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0); - state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - - return 0; -} - -static int r600_state_pm4_cb_flush(struct radeon_state *state) -{ - if (!state->nbo) - return 0; - - r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1), 1); - - return 0; -} - -static int r600_state_pm4_db_flush(struct radeon_state *state) -{ - if (!state->nbo) - return 0; - - r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) | - S_0085F0_DB_DEST_BASE_ENA(1), 0); - - return 0; -} - -static int r600_state_pm4_resource(struct radeon_state *state) -{ - u32 flags, type, nbo, offset, soffset; - int r, nres; - const struct radeon_register *regs = get_regs(state); - - soffset = state->id * state->stype->stride; - if (state->radeon->family >= CHIP_CEDAR) - type = G_038018_TYPE(state->states[7]); - else - type = G_038018_TYPE(state->states[6]); - - switch (type) { - case 2: - flags = S_0085F0_TC_ACTION_ENA(1); - nbo = 2; - break; - case 3: - flags = S_0085F0_VC_ACTION_ENA(1); - nbo = 1; - break; - default: - return 0; - } - if (state->nbo != nbo) { - fprintf(stderr, "%s need %d bo got %d\n", __func__, nbo, state->nbo); - return -EINVAL; - } - r600_state_pm4_with_flush(state, flags, 0); - offset = regs[0].offset + soffset; - if (state->radeon->family >= CHIP_CEDAR) - nres = 8; - else - nres = 7; - state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, nres); - if (state->radeon->family >= CHIP_CEDAR) - state->pm4[state->cpm4++] = (offset - EG_RESOURCE_OFFSET) >> 2; - else - state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2; - state->pm4[state->cpm4++] = state->states[0]; - state->pm4[state->cpm4++] = state->states[1]; - state->pm4[state->cpm4++] = state->states[2]; - state->pm4[state->cpm4++] = state->states[3]; - state->pm4[state->cpm4++] = state->states[4]; - state->pm4[state->cpm4++] = state->states[5]; - state->pm4[state->cpm4++] = state->states[6]; - if (state->radeon->family >= CHIP_CEDAR) - state->pm4[state->cpm4++] = state->states[7]; - - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 0); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]); - if (type == 2) { - state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0); - r = radeon_state_reloc(state, state->cpm4, 1); - if (r) - return r; - state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[1]); - } - return 0; -} - - -static void r600_modify_type_array(struct radeon *radeon) -{ - int i; - switch (radeon->family) { - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - break; - default: - return; - } - - /* r700 needs some mods */ - for (i = 0; i < radeon->nstype; i++) { - struct radeon_stype_info *info = &radeon->stype[i]; - - switch(info->stype) { - case R600_STATE_CONFIG: - info->pm4 = r700_state_pm4_config; - break; - case R600_STATE_CB0: - info->pm4 = r600_state_pm4_generic; - break; - case R600_STATE_DB: - info->pm4 = r600_state_pm4_generic; - break; - }; - } -} - -static void build_types_array(struct radeon *radeon, struct radeon_stype_info *types, int size) -{ - int i, j; - int id = 0; - - for (i = 0; i < size; i++) { - types[i].base_id = id; - types[i].npm4 = 128; - if (types[i].reginfo[0].shader_type == 0) { - id += types[i].num; - } else { - for (j = 0; j < R600_SHADER_MAX; j++) { - if (types[i].reginfo[j].shader_type) - id += types[i].num; - } - } - } - radeon->max_states = id; - radeon->stype = types; - radeon->nstype = size; -} - -static void r600_build_types_array(struct radeon *radeon) -{ - build_types_array(radeon, r600_stypes, STYPES_SIZE); - r600_modify_type_array(radeon); -} - -static void eg_build_types_array(struct radeon *radeon) -{ - build_types_array(radeon, eg_stypes, EG_STYPES_SIZE); -} - -int r600_init(struct radeon *radeon) -{ - if (radeon->family >= CHIP_CEDAR) - eg_build_types_array(radeon); - else - r600_build_types_array(radeon); - return 0; -} diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h deleted file mode 100644 index 76e185ac035..00000000000 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ /dev/null @@ -1,522 +0,0 @@ -/* - * Copyright © 2009 Jerome Glisse - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef R600_STATES_H -#define R600_STATES_H - -static const struct radeon_register R600_names_CONFIG[] = { - {0x00008C00, 0, 0, "SQ_CONFIG"}, - {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"}, - {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"}, - {0x00008C0C, 0, 0, "SQ_THREAD_RESOURCE_MGMT"}, - {0x00008C10, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"}, - {0x00008C14, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"}, - {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"}, - {0x00009508, 0, 0, "TA_CNTL_AUX"}, - {0x00009714, 0, 0, "VC_ENHANCE"}, - {0x00009830, 0, 0, "DB_DEBUG"}, - {0x00009838, 0, 0, "DB_WATERMARKS"}, - {0x00028350, 0, 0, "SX_MISC"}, - {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"}, - {0x000288A8, 0, 0, "SQ_ESGS_RING_ITEMSIZE"}, - {0x000288AC, 0, 0, "SQ_GSVS_RING_ITEMSIZE"}, - {0x000288B0, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"}, - {0x000288B4, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"}, - {0x000288B8, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"}, - {0x000288BC, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"}, - {0x000288C0, 0, 0, "SQ_FBUF_RING_ITEMSIZE"}, - {0x000288C4, 0, 0, "SQ_REDUC_RING_ITEMSIZE"}, - {0x000288C8, 0, 0, "SQ_GS_VERT_ITEMSIZE"}, - {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"}, - {0x00028A14, 0, 0, "VGT_HOS_CNTL"}, - {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"}, - {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"}, - {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"}, - {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"}, - {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"}, - {0x00028A2C, 0, 0, "VGT_GROUP_DECR"}, - {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"}, - {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"}, - {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"}, - {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"}, - {0x00028A40, 0, 0, "VGT_GS_MODE"}, - {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL"}, - {0x00028AB0, 0, 0, "VGT_STRMOUT_EN"}, - {0x00028AB4, 0, 0, "VGT_REUSE_OFF"}, - {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"}, - {0x00028B20, 0, 0, "VGT_STRMOUT_BUFFER_EN"}, -}; - -static const struct radeon_register R600_names_CB_CNTL[] = { - {0x00028120, 0, 0, "CB_CLEAR_RED"}, - {0x00028124, 0, 0, "CB_CLEAR_GREEN"}, - {0x00028128, 0, 0, "CB_CLEAR_BLUE"}, - {0x0002812C, 0, 0, "CB_CLEAR_ALPHA"}, - {0x0002823C, 0, 0, "CB_SHADER_MASK"}, - {0x00028238, 0, 0, "CB_TARGET_MASK"}, - {0x00028424, 0, 0, "CB_FOG_RED"}, - {0x00028428, 0, 0, "CB_FOG_GREEN"}, - {0x0002842C, 0, 0, "CB_FOG_BLUE"}, - {0x00028808, 0, 0, "CB_COLOR_CONTROL"}, - {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"}, - {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"}, - {0x00028C20, 0, 0, "PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX"}, - {0x00028C30, 0, 0, "CB_CLRCMP_CONTROL"}, - {0x00028C34, 0, 0, "CB_CLRCMP_SRC"}, - {0x00028C38, 0, 0, "CB_CLRCMP_DST"}, - {0x00028C3C, 0, 0, "CB_CLRCMP_MSK"}, - {0x00028C48, 0, 0, "PA_SC_AA_MASK"}, - {0x000287A0, 0, 0, "CB_SHADER_CONTROL"}, -}; - -static const struct radeon_register R600_names_RASTERIZER[] = { - {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"}, - {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"}, - {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"}, - {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"}, - {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"}, - {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"}, - {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"}, - {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"}, - {0x00028A0C, 0, 0, "PA_SC_LINE_STIPPLE"}, - {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"}, - {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"}, - {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"}, - {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"}, - {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"}, - {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"}, - {0x00028DF8, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"}, - {0x00028DFC, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"}, - {0x00028E00, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"}, - {0x00028E04, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"}, - {0x00028E08, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"}, - {0x00028E0C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"}, -}; - -static const struct radeon_register R600_names_VIEWPORT[] = { - {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"}, - {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"}, - {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"}, - {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"}, - {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"}, - {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"}, - {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"}, - {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"}, - {0x00028818, 0, 0, "PA_CL_VTE_CNTL"}, -}; - -static const struct radeon_register R600_names_SCISSOR[] = { - {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"}, - {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"}, - {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"}, - {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"}, - {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"}, - {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"}, - {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"}, - {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"}, - {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"}, - {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"}, - {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"}, - {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"}, - {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"}, - {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"}, - {0x00028230, 0, 0, "PA_SC_EDGERULE"}, - {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"}, - {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"}, - {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"}, - {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"}, -}; - -static const struct radeon_register R600_names_BLEND[] = { - {0x00028414, 0, 0, "CB_BLEND_RED"}, - {0x00028418, 0, 0, "CB_BLEND_GREEN"}, - {0x0002841C, 0, 0, "CB_BLEND_BLUE"}, - {0x00028420, 0, 0, "CB_BLEND_ALPHA"}, - {0x00028780, 0, 0, "CB_BLEND0_CONTROL"}, - {0x00028784, 0, 0, "CB_BLEND1_CONTROL"}, - {0x00028788, 0, 0, "CB_BLEND2_CONTROL"}, - {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"}, - {0x00028790, 0, 0, "CB_BLEND4_CONTROL"}, - {0x00028794, 0, 0, "CB_BLEND5_CONTROL"}, - {0x00028798, 0, 0, "CB_BLEND6_CONTROL"}, - {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"}, - {0x00028804, 0, 0, "CB_BLEND_CONTROL"}, -}; - -static const struct radeon_register R600_names_DSA[] = { - {0x00028028, 0, 0, "DB_STENCIL_CLEAR"}, - {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"}, - {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"}, - {0x00028430, 0, 0, "DB_STENCILREFMASK"}, - {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"}, - {0x00028438, 0, 0, "SX_ALPHA_REF"}, - {0x000286E0, 0, 0, "SPI_FOG_FUNC_SCALE"}, - {0x000286E4, 0, 0, "SPI_FOG_FUNC_BIAS"}, - {0x000286DC, 0, 0, "SPI_FOG_CNTL"}, - {0x00028800, 0, 0, "DB_DEPTH_CONTROL"}, - {0x0002880C, 0, 0, "DB_SHADER_CONTROL"}, - {0x00028D0C, 0, 0, "DB_RENDER_CONTROL"}, - {0x00028D10, 0, 0, "DB_RENDER_OVERRIDE"}, - {0x00028D2C, 0, 0, "DB_SRESULTS_COMPARE_STATE1"}, - {0x00028D30, 0, 0, "DB_PRELOAD_CONTROL"}, - {0x00028D44, 0, 0, "DB_ALPHA_TO_MASK"}, -}; - -static const struct radeon_register R600_names_VS_SHADER[] = { - {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"}, - {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"}, - {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"}, - {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"}, - {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"}, - {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"}, - {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"}, - {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"}, - {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"}, - {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"}, - {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"}, - {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"}, - {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"}, - {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"}, - {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"}, - {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"}, - {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"}, - {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"}, - {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"}, - {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"}, - {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"}, - {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"}, - {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"}, - {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"}, - {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"}, - {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"}, - {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"}, - {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"}, - {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"}, - {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"}, - {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"}, - {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"}, - {0x00028614, 0, 0, "SPI_VS_OUT_ID_0"}, - {0x00028618, 0, 0, "SPI_VS_OUT_ID_1"}, - {0x0002861C, 0, 0, "SPI_VS_OUT_ID_2"}, - {0x00028620, 0, 0, "SPI_VS_OUT_ID_3"}, - {0x00028624, 0, 0, "SPI_VS_OUT_ID_4"}, - {0x00028628, 0, 0, "SPI_VS_OUT_ID_5"}, - {0x0002862C, 0, 0, "SPI_VS_OUT_ID_6"}, - {0x00028630, 0, 0, "SPI_VS_OUT_ID_7"}, - {0x00028634, 0, 0, "SPI_VS_OUT_ID_8"}, - {0x00028638, 0, 0, "SPI_VS_OUT_ID_9"}, - {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"}, - {0x00028858, 1, 0, "SQ_PGM_START_VS"}, - {0x00028868, 0, 0, "SQ_PGM_RESOURCES_VS"}, - {0x00028894, 1, 1, "SQ_PGM_START_FS"}, - {0x000288A4, 0, 0, "SQ_PGM_RESOURCES_FS"}, - {0x000288D0, 0, 0, "SQ_PGM_CF_OFFSET_VS"}, - {0x000288DC, 0, 0, "SQ_PGM_CF_OFFSET_FS"}, -}; - -static const struct radeon_register R600_names_PS_SHADER[] = { - {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"}, - {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"}, - {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"}, - {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"}, - {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"}, - {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"}, - {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"}, - {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"}, - {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"}, - {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"}, - {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"}, - {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"}, - {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"}, - {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"}, - {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"}, - {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"}, - {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"}, - {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"}, - {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"}, - {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"}, - {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"}, - {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"}, - {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"}, - {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"}, - {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"}, - {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"}, - {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"}, - {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"}, - {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"}, - {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"}, - {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"}, - {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"}, - {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"}, - {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"}, - {0x000286D8, 0, 0, "SPI_INPUT_Z"}, - {0x00028840, 1, 0, "SQ_PGM_START_PS"}, - {0x00028850, 0, 0, "SQ_PGM_RESOURCES_PS"}, - {0x00028854, 0, 0, "SQ_PGM_EXPORTS_PS"}, - {0x000288CC, 0, 0, "SQ_PGM_CF_OFFSET_PS"}, -}; - -static const struct radeon_register R600_names_VS_CBUF[] = { - {0x00028180, 0, 0, "ALU_CONST_BUFFER_SIZE_VS_0"}, - {0x00028980, 1, 0, "ALU_CONST_CACHE_VS_0"}, -}; - -static const struct radeon_register R600_names_PS_CBUF[] = { - {0x00028140, 0, 0, "ALU_CONST_BUFFER_SIZE_PS_0"}, - {0x00028940, 1, 0, "ALU_CONST_CACHE_PS_0"}, -}; - -static const struct radeon_register R600_names_PS_CONSTANT[] = { - {0x00030000, 0, 0, "SQ_ALU_CONSTANT0_0"}, - {0x00030004, 0, 0, "SQ_ALU_CONSTANT1_0"}, - {0x00030008, 0, 0, "SQ_ALU_CONSTANT2_0"}, - {0x0003000C, 0, 0, "SQ_ALU_CONSTANT3_0"}, -}; - -static const struct radeon_register R600_names_VS_CONSTANT[] = { - {0x00031000, 0, 0, "SQ_ALU_CONSTANT0_256"}, - {0x00031004, 0, 0, "SQ_ALU_CONSTANT1_256"}, - {0x00031008, 0, 0, "SQ_ALU_CONSTANT2_256"}, - {0x0003100C, 0, 0, "SQ_ALU_CONSTANT3_256"}, -}; - -static const struct radeon_register R600_names_UCP[] = { - {0x00028E20, 0, 0, "PA_CL_UCP0_X"}, - {0x00028E24, 0, 0, "PA_CL_UCP0_Y"}, - {0x00028E28, 0, 0, "PA_CL_UCP0_Z"}, - {0x00028E2C, 0, 0, "PA_CL_UCP0_W"}, - {0x00028E30, 0, 0, "PA_CL_UCP1_X"}, - {0x00028E34, 0, 0, "PA_CL_UCP1_Y"}, - {0x00028E38, 0, 0, "PA_CL_UCP1_Z"}, - {0x00028E3C, 0, 0, "PA_CL_UCP1_W"}, - {0x00028E40, 0, 0, "PA_CL_UCP2_X"}, - {0x00028E44, 0, 0, "PA_CL_UCP2_Y"}, - {0x00028E48, 0, 0, "PA_CL_UCP2_Z"}, - {0x00028E4C, 0, 0, "PA_CL_UCP2_W"}, - {0x00028E50, 0, 0, "PA_CL_UCP3_X"}, - {0x00028E54, 0, 0, "PA_CL_UCP3_Y"}, - {0x00028E58, 0, 0, "PA_CL_UCP3_Z"}, - {0x00028E5C, 0, 0, "PA_CL_UCP3_W"}, - {0x00028E60, 0, 0, "PA_CL_UCP4_X"}, - {0x00028E64, 0, 0, "PA_CL_UCP4_Y"}, - {0x00028E68, 0, 0, "PA_CL_UCP4_Z"}, - {0x00028E6C, 0, 0, "PA_CL_UCP4_W"}, - {0x00028E70, 0, 0, "PA_CL_UCP5_X"}, - {0x00028E74, 0, 0, "PA_CL_UCP5_Y"}, - {0x00028E78, 0, 0, "PA_CL_UCP5_Z"}, - {0x00028E7C, 0, 0, "PA_CL_UCP5_W"}, -}; - -static const struct radeon_register R600_names_PS_RESOURCE[] = { - {0x00038000, 0, 0, "RESOURCE0_WORD0"}, - {0x00038004, 0, 0, "RESOURCE0_WORD1"}, - {0x00038008, 0, 0, "RESOURCE0_WORD2"}, - {0x0003800C, 0, 0, "RESOURCE0_WORD3"}, - {0x00038010, 0, 0, "RESOURCE0_WORD4"}, - {0x00038014, 0, 0, "RESOURCE0_WORD5"}, - {0x00038018, 0, 0, "RESOURCE0_WORD6"}, -}; - -static const struct radeon_register R600_names_VS_RESOURCE[] = { - {0x00039180, 0, 0, "RESOURCE160_WORD0"}, - {0x00039184, 0, 0, "RESOURCE160_WORD1"}, - {0x00039188, 0, 0, "RESOURCE160_WORD2"}, - {0x0003918C, 0, 0, "RESOURCE160_WORD3"}, - {0x00039190, 0, 0, "RESOURCE160_WORD4"}, - {0x00039194, 0, 0, "RESOURCE160_WORD5"}, - {0x00039198, 0, 0, "RESOURCE160_WORD6"}, -}; - -static const struct radeon_register R600_names_FS_RESOURCE[] = { - {0x0003A300, 0, 0, "RESOURCE320_WORD0"}, - {0x0003A304, 0, 0, "RESOURCE320_WORD1"}, - {0x0003A308, 0, 0, "RESOURCE320_WORD2"}, - {0x0003A30C, 0, 0, "RESOURCE320_WORD3"}, - {0x0003A310, 0, 0, "RESOURCE320_WORD4"}, - {0x0003A314, 0, 0, "RESOURCE320_WORD5"}, - {0x0003A318, 0, 0, "RESOURCE320_WORD6"}, -}; - -static const struct radeon_register R600_names_GS_RESOURCE[] = { - {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"}, - {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"}, - {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"}, - {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"}, - {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"}, - {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"}, - {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"}, -}; - -static const struct radeon_register R600_names_PS_SAMPLER[] = { - {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"}, - {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"}, - {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"}, -}; - -static const struct radeon_register R600_names_VS_SAMPLER[] = { - {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"}, - {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"}, - {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"}, -}; - -static const struct radeon_register R600_names_GS_SAMPLER[] = { - {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"}, - {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"}, - {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"}, -}; - -static const struct radeon_register R600_names_PS_SAMPLER_BORDER[] = { - {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"}, - {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"}, - {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"}, - {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register R600_names_VS_SAMPLER_BORDER[] = { - {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"}, - {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"}, - {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"}, - {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register R600_names_GS_SAMPLER_BORDER[] = { - {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"}, - {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"}, - {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"}, - {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"}, -}; - -static const struct radeon_register R600_names_CB0[] = { - {0x00028040, 1, 0, "CB_COLOR0_BASE"}, - {0x000280A0, 1, 0, "CB_COLOR0_INFO"}, - {0x00028060, 0, 0, "CB_COLOR0_SIZE"}, - {0x00028080, 0, 0, "CB_COLOR0_VIEW"}, - {0x000280E0, 1, 0, "CB_COLOR0_FRAG"}, - {0x000280C0, 1, 0, "CB_COLOR0_TILE"}, - {0x00028100, 0, 0, "CB_COLOR0_MASK"}, -}; - -static const struct radeon_register R600_names_CB1[] = { - {0x00028044, 1, 0, "CB_COLOR1_BASE"}, - {0x000280A4, 1, 0, "CB_COLOR1_INFO"}, - {0x00028064, 0, 0, "CB_COLOR1_SIZE"}, - {0x00028084, 0, 0, "CB_COLOR1_VIEW"}, - {0x000280E4, 1, 0, "CB_COLOR1_FRAG"}, - {0x000280C4, 1, 0, "CB_COLOR1_TILE"}, - {0x00028104, 0, 0, "CB_COLOR1_MASK"}, -}; - -static const struct radeon_register R600_names_CB2[] = { - {0x00028048, 1, 0, "CB_COLOR2_BASE"}, - {0x000280A8, 1, 0, "CB_COLOR2_INFO"}, - {0x00028068, 0, 0, "CB_COLOR2_SIZE"}, - {0x00028088, 0, 0, "CB_COLOR2_VIEW"}, - {0x000280E8, 1, 0, "CB_COLOR2_FRAG"}, - {0x000280C8, 1, 0, "CB_COLOR2_TILE"}, - {0x00028108, 0, 0, "CB_COLOR2_MASK"}, -}; - -static const struct radeon_register R600_names_CB3[] = { - {0x0002804C, 1, 0, "CB_COLOR3_BASE"}, - {0x000280AC, 1, 0, "CB_COLOR3_INFO"}, - {0x0002806C, 0, 0, "CB_COLOR3_SIZE"}, - {0x0002808C, 0, 0, "CB_COLOR3_VIEW"}, - {0x000280EC, 1, 0, "CB_COLOR3_FRAG"}, - {0x000280CC, 1, 0, "CB_COLOR3_TILE"}, - {0x0002810C, 0, 0, "CB_COLOR3_MASK"}, -}; - -static const struct radeon_register R600_names_CB4[] = { - {0x00028050, 1, 0, "CB_COLOR4_BASE"}, - {0x000280B0, 1, 0, "CB_COLOR4_INFO"}, - {0x00028070, 0, 0, "CB_COLOR4_SIZE"}, - {0x00028090, 0, 0, "CB_COLOR4_VIEW"}, - {0x000280F0, 1, 0, "CB_COLOR4_FRAG"}, - {0x000280D0, 1, 0, "CB_COLOR4_TILE"}, - {0x00028110, 0, 0, "CB_COLOR4_MASK"}, -}; - -static const struct radeon_register R600_names_CB5[] = { - {0x00028054, 1, 0, "CB_COLOR5_BASE"}, - {0x000280B4, 1, 0, "CB_COLOR5_INFO"}, - {0x00028074, 0, 0, "CB_COLOR5_SIZE"}, - {0x00028094, 0, 0, "CB_COLOR5_VIEW"}, - {0x000280F4, 1, 0, "CB_COLOR5_FRAG"}, - {0x000280D4, 1, 0, "CB_COLOR5_TILE"}, - {0x00028114, 0, 0, "CB_COLOR5_MASK"}, -}; - -static const struct radeon_register R600_names_CB6[] = { - {0x00028058, 1, 0, "CB_COLOR6_BASE"}, - {0x000280B8, 1, 0, "CB_COLOR6_INFO"}, - {0x00028078, 0, 0, "CB_COLOR6_SIZE"}, - {0x00028098, 0, 0, "CB_COLOR6_VIEW"}, - {0x000280F8, 1, 0, "CB_COLOR6_FRAG"}, - {0x000280D8, 1, 0, "CB_COLOR6_TILE"}, - {0x00028118, 0, 0, "CB_COLOR6_MASK"}, -}; - -static const struct radeon_register R600_names_CB7[] = { - {0x0002805C, 1, 0, "CB_COLOR7_BASE"}, - {0x000280BC, 1, 0, "CB_COLOR7_INFO"}, - {0x0002807C, 0, 0, "CB_COLOR7_SIZE"}, - {0x0002809C, 0, 0, "CB_COLOR7_VIEW"}, - {0x000280FC, 1, 0, "CB_COLOR7_FRAG"}, - {0x000280DC, 1, 0, "CB_COLOR7_TILE"}, - {0x0002811C, 0, 0, "CB_COLOR7_MASK"}, -}; - -static const struct radeon_register R600_names_DB[] = { - {0x0002800C, 1, 0, "DB_DEPTH_BASE"}, - {0x00028000, 0, 0, "DB_DEPTH_SIZE"}, - {0x00028004, 0, 0, "DB_DEPTH_VIEW"}, - {0x00028010, 1, 0, "DB_DEPTH_INFO"}, - {0x00028D24, 0, 0, "DB_HTILE_SURFACE"}, - {0x00028D34, 0, 0, "DB_PREFETCH_LIMIT"}, -}; - -static const struct radeon_register R600_names_VGT[] = { - {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, - {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, - {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, - {0x00028408, 0, 0, "VGT_INDX_OFFSET"}, - {0x0002840C, 0, 0, "VGT_MULTI_PRIM_IB_RESET_INDX"}, - {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"}, - {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"}, - {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"}, - {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"}, - {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"}, - {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, -}; - -static const struct radeon_register R600_names_DRAW[] = { - {0x00008970, 0, 0, "VGT_NUM_INDICES"}, - {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, - {0x000287E8, 1, 0, "VGT_DMA_BASE"}, - {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, -}; - -static const struct radeon_register R600_names_VGT_EVENT[] = { - {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, -}; - -static const struct radeon_register R600_names_CB_FLUSH[] = { -}; - -static const struct radeon_register R600_names_DB_FLUSH[] = { -}; - -#endif diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c deleted file mode 100644 index f7e3e354de1..00000000000 --- a/src/gallium/winsys/r600/drm/radeon.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright © 2009 Jerome Glisse - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include -#include -#include -#include -#include -#include -#include -#include "xf86drm.h" -#include "radeon_priv.h" -#include "radeon_drm.h" - -enum radeon_family radeon_get_family(struct radeon *radeon) -{ - return radeon->family; -} - -enum chip_class radeon_get_family_class(struct radeon *radeon) -{ - return radeon->chip_class; -} - -void radeon_set_mem_constant(struct radeon *radeon, boolean state) -{ - radeon->use_mem_constant = state; -} - -static int radeon_get_device(struct radeon *radeon) -{ - struct drm_radeon_info info; - int r; - - radeon->device = 0; - info.request = RADEON_INFO_DEVICE_ID; - info.value = (uintptr_t)&radeon->device; - r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info, - sizeof(struct drm_radeon_info)); - return r; -} - -struct radeon *radeon_new(int fd, unsigned device) -{ - struct radeon *radeon; - int r; - - radeon = calloc(1, sizeof(*radeon)); - if (radeon == NULL) { - return NULL; - } - radeon->fd = fd; - radeon->device = device; - radeon->refcount = 1; - if (fd >= 0) { - r = radeon_get_device(radeon); - if (r) { - fprintf(stderr, "Failed to get device id\n"); - return radeon_decref(radeon); - } - } - radeon->family = radeon_family_from_device(radeon->device); - if (radeon->family == CHIP_UNKNOWN) { - fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->device); - return radeon_decref(radeon); - } - switch (radeon->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - if (r600_init(radeon)) { - return radeon_decref(radeon); - } - break; - case CHIP_R100: - case CHIP_RV100: - case CHIP_RS100: - case CHIP_RV200: - case CHIP_RS200: - case CHIP_R200: - case CHIP_RV250: - case CHIP_RS300: - case CHIP_RV280: - case CHIP_R300: - case CHIP_R350: - case CHIP_RV350: - case CHIP_RV380: - case CHIP_R420: - case CHIP_R423: - case CHIP_RV410: - case CHIP_RS400: - case CHIP_RS480: - case CHIP_RS600: - case CHIP_RS690: - case CHIP_RS740: - case CHIP_RV515: - case CHIP_R520: - case CHIP_RV530: - case CHIP_RV560: - case CHIP_RV570: - case CHIP_R580: - default: - fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", - __func__, radeon->device); - break; - } - - /* setup class */ - switch (radeon->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - radeon->chip_class = R600; - break; - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - radeon->chip_class = R700; - break; - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - radeon->chip_class = EVERGREEN; - break; - default: - fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", - __func__, radeon->device); - break; - } - - radeon->mman = pb_malloc_bufmgr_create(); - if (!radeon->mman) - return NULL; - radeon->kman = radeon_bo_pbmgr_create(radeon); - if (!radeon->kman) - return NULL; - radeon->cman = pb_cache_manager_create(radeon->kman, 100000); - if (!radeon->cman) - return NULL; - return radeon; -} - -struct radeon *radeon_incref(struct radeon *radeon) -{ - if (radeon == NULL) - return NULL; - radeon->refcount++; - return radeon; -} - -struct radeon *radeon_decref(struct radeon *radeon) -{ - if (radeon == NULL) - return NULL; - if (--radeon->refcount > 0) { - return NULL; - } - - radeon->mman->destroy(radeon->mman); - radeon->cman->destroy(radeon->cman); - radeon->kman->destroy(radeon->kman); - drmClose(radeon->fd); - free(radeon); - return NULL; -} diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c deleted file mode 100644 index 7ccb5245905..00000000000 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include -#include "radeon_priv.h" -#include "radeon_drm.h" -#include "bof.h" - -static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_ws_bo *bo) -{ - if (ctx->nbo >= RADEON_CTX_MAX_PM4) - return -EBUSY; - /* take a reference to the kernel bo */ - radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->nbo], radeon_bo_pb_get_bo(bo->pb)); - ctx->nbo++; - return 0; -} - -static void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement) -{ - struct radeon_cs_reloc *greloc; - unsigned i; - - placement[0] = 0; - placement[1] = 0; - greloc = (void *)(((u8 *)ctx->reloc) + reloc * 4); - for (i = 0; i < ctx->nbo; i++) { - if (ctx->bo[i]->handle == greloc->handle) { - placement[0] = greloc->read_domain | greloc->write_domain; - placement[1] = placement[0]; - return; - } - } -} - -void radeon_ctx_clear(struct radeon_ctx *ctx) -{ - for (int i = 0; i < ctx->nbo; i++) { - radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); - } - ctx->ndwords = RADEON_CTX_MAX_PM4; - ctx->cdwords = 0; - ctx->nreloc = 0; - ctx->nbo = 0; -} - -struct radeon_ctx *radeon_ctx_init(struct radeon *radeon) -{ - struct radeon_ctx *ctx; - if (radeon == NULL) - return NULL; - ctx = calloc(1, sizeof(struct radeon_ctx)); - ctx->radeon = radeon_incref(radeon); - radeon_ctx_clear(ctx); - ctx->pm4 = malloc(RADEON_CTX_MAX_PM4 * 4); - if (ctx->pm4 == NULL) { - radeon_ctx_fini(ctx); - return NULL; - } - ctx->reloc = malloc(sizeof(struct radeon_cs_reloc) * RADEON_CTX_MAX_PM4); - if (ctx->reloc == NULL) { - radeon_ctx_fini(ctx); - return NULL; - } - ctx->bo = calloc(sizeof(void *), RADEON_CTX_MAX_PM4); - if (ctx->bo == NULL) { - radeon_ctx_fini(ctx); - return NULL; - } - return ctx; -} - -void radeon_ctx_fini(struct radeon_ctx *ctx) -{ - unsigned i; - - if (ctx == NULL) - return; - - for (i = 0; i < ctx->nbo; i++) { - radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); - } - ctx->radeon = radeon_decref(ctx->radeon); - free(ctx->bo); - free(ctx->pm4); - free(ctx->reloc); - free(ctx); -} - -static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state) -{ - unsigned i, j; - int r; - struct radeon_bo *state_bo; - if (state == NULL) - return 0; - for (i = 0; i < state->nbo; i++) { - for (j = 0; j < ctx->nbo; j++) { - state_bo = radeon_bo_pb_get_bo(state->bo[i]->pb); - if (state_bo == ctx->bo[j]) - break; - } - if (j == ctx->nbo) { - r = radeon_ctx_set_bo_new(ctx, state->bo[i]); - if (r) - return r; - } - } - return 0; -} - - -int radeon_ctx_submit(struct radeon_ctx *ctx) -{ - struct drm_radeon_cs drmib; - struct drm_radeon_cs_chunk chunks[2]; - uint64_t chunk_array[2]; - int r = 0; - - if (!ctx->cdwords) - return 0; - - radeon_bo_pbmgr_flush_maps(ctx->radeon->kman); -#if 0 - for (r = 0; r < ctx->cdwords; r++) { - fprintf(stderr, "0x%08X\n", ctx->pm4[r]); - } -#endif - drmib.num_chunks = 2; - drmib.chunks = (uint64_t)(uintptr_t)chunk_array; - chunks[0].chunk_id = RADEON_CHUNK_ID_IB; - chunks[0].length_dw = ctx->cdwords; - chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; - chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; - chunks[1].length_dw = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; - chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc; - chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0]; - chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1]; -#if 1 - r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib, - sizeof(struct drm_radeon_cs)); -#endif - return r; -} - -static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_ws_bo *bo, - unsigned id, unsigned *placement) -{ - unsigned i; - unsigned bo_handle = radeon_ws_bo_get_handle(bo); - - for (i = 0; i < ctx->nreloc; i++) { - if (ctx->reloc[i].handle == bo_handle) { - ctx->pm4[id] = i * sizeof(struct radeon_cs_reloc) / 4; - return 0; - } - } - if (ctx->nreloc >= RADEON_CTX_MAX_PM4) { - return -EBUSY; - } - ctx->reloc[ctx->nreloc].handle = bo_handle; - ctx->reloc[ctx->nreloc].read_domain = placement[0] | placement [1]; - ctx->reloc[ctx->nreloc].write_domain = placement[0] | placement [1]; - ctx->reloc[ctx->nreloc].flags = 0; - ctx->pm4[id] = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4; - ctx->nreloc++; - return 0; -} - -static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state *state) -{ - unsigned i, rid, bid, cid; - int r; - - if (state == NULL) - return 0; - if (state->cpm4 > ctx->ndwords) { - return -EBUSY; - } - memcpy(&ctx->pm4[ctx->cdwords], state->pm4, state->cpm4 * 4); - for (i = 0; i < state->nreloc; i++) { - rid = state->reloc_pm4_id[i]; - bid = state->reloc_bo_id[i]; - cid = ctx->cdwords + rid; - r = radeon_ctx_reloc(ctx, state->bo[bid], cid, - &state->placement[bid * 2]); - if (r) { - fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->stype->stype); - return r; - } - } - ctx->cdwords += state->cpm4; - ctx->ndwords -= state->cpm4; - return 0; -} - -int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state) -{ - int r = 0; - - /* !!! ONLY ACCEPT QUERY STATE HERE !!! */ - r = radeon_state_pm4(state); - if (r) - return r; - /* BEGIN/END query are balanced in the same cs so account for END - * END query when scheduling BEGIN query - */ - switch (state->stype->stype) { - case R600_STATE_QUERY_BEGIN: - /* is there enough place for begin & end */ - if ((state->cpm4 * 2) > ctx->ndwords) - return -EBUSY; - ctx->ndwords -= state->cpm4; - break; - case R600_STATE_QUERY_END: - ctx->ndwords += state->cpm4; - break; - default: - return -EINVAL; - } - return radeon_ctx_state_schedule(ctx, state); -} - -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) -{ - unsigned previous_cdwords; - int r = 0; - int i; - - for (i = 0; i < ctx->radeon->max_states; i++) { - r = radeon_ctx_state_bo(ctx, draw->state[i]); - if (r) - return r; - } - previous_cdwords = ctx->cdwords; - for (i = 0; i < ctx->radeon->max_states; i++) { - if (draw->state[i]) { - r = radeon_ctx_state_schedule(ctx, draw->state[i]); - if (r) { - ctx->cdwords = previous_cdwords; - return r; - } - } - } - - return 0; -} - -#if 0 -int radeon_ctx_pm4(struct radeon_ctx *ctx) -{ - unsigned i; - int r; - - free(ctx->pm4); - ctx->cpm4 = 0; - ctx->pm4 = malloc(ctx->draw_cpm4 * 4); - if (ctx->pm4 == NULL) - return -EINVAL; - for (i = 0, ctx->id = 0; i < ctx->nstate; i++) { - } - if (ctx->id != ctx->draw_cpm4) { - fprintf(stderr, "%s miss predicted pm4 size %d for %d\n", - __func__, ctx->draw_cpm4, ctx->id); - return -EINVAL; - } - ctx->cpm4 = ctx->draw_cpm4; - return 0; -} -#endif - -void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file) -{ - bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root; - unsigned i; - unsigned bo_size; - root = device_id = bcs = blob = array = bo = size = handle = NULL; - root = bof_object(); - if (root == NULL) - goto out_err; - device_id = bof_int32(ctx->radeon->device); - if (device_id == NULL) - return; - if (bof_object_set(root, "device_id", device_id)) - goto out_err; - bof_decref(device_id); - device_id = NULL; - /* dump relocs */ - blob = bof_blob(ctx->nreloc * 16, ctx->reloc); - if (blob == NULL) - goto out_err; - if (bof_object_set(root, "reloc", blob)) - goto out_err; - bof_decref(blob); - blob = NULL; - /* dump cs */ - blob = bof_blob(ctx->cdwords * 4, ctx->pm4); - if (blob == NULL) - goto out_err; - if (bof_object_set(root, "pm4", blob)) - goto out_err; - bof_decref(blob); - blob = NULL; - /* dump bo */ - array = bof_array(); - if (array == NULL) - goto out_err; - for (i = 0; i < ctx->nbo; i++) { - bo = bof_object(); - if (bo == NULL) - goto out_err; - bo_size = ctx->bo[i]->size; - size = bof_int32(bo_size); - if (size == NULL) - goto out_err; - if (bof_object_set(bo, "size", size)) - goto out_err; - bof_decref(size); - size = NULL; - handle = bof_int32(ctx->bo[i]->handle); - if (handle == NULL) - goto out_err; - if (bof_object_set(bo, "handle", handle)) - goto out_err; - bof_decref(handle); - handle = NULL; - radeon_bo_map(ctx->radeon, ctx->bo[i]); - blob = bof_blob(bo_size, ctx->bo[i]->data); - radeon_bo_unmap(ctx->radeon, ctx->bo[i]); - if (blob == NULL) - goto out_err; - if (bof_object_set(bo, "data", blob)) - goto out_err; - bof_decref(blob); - blob = NULL; - if (bof_array_append(array, bo)) - goto out_err; - bof_decref(bo); - bo = NULL; - } - if (bof_object_set(root, "bo", array)) - goto out_err; - bof_dump_file(root, file); -out_err: - bof_decref(blob); - bof_decref(array); - bof_decref(bo); - bof_decref(size); - bof_decref(handle); - bof_decref(device_id); - bof_decref(root); -} diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c deleted file mode 100644 index a1269014958..00000000000 --- a/src/gallium/winsys/r600/drm/radeon_draw.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include -#include "radeon_priv.h" - -/* - * draw functions - */ -int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon) -{ - draw->radeon = radeon; - draw->state = calloc(radeon->max_states, sizeof(void*)); - if (draw->state == NULL) - return -ENOMEM; - return 0; -} - -void radeon_draw_bind(struct radeon_draw *draw, struct radeon_state *state) -{ - if (state == NULL) - return; - draw->state[state->state_id] = state; -} - -void radeon_draw_unbind(struct radeon_draw *draw, struct radeon_state *state) -{ - if (state == NULL) - return; - if (draw->state[state->state_id] == state) { - draw->state[state->state_id] = NULL; - } -} diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c deleted file mode 100644 index c7aa73c8d4e..00000000000 --- a/src/gallium/winsys/r600/drm/radeon_state.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include -#include -#include "radeon_priv.h" - -/* - * state core functions - */ -int radeon_state_init(struct radeon_state *state, struct radeon *radeon, u32 stype, u32 id, u32 shader_type) -{ - struct radeon_stype_info *found = NULL; - int i, j, shader_index = -1; - - /* traverse the stype array */ - for (i = 0; i < radeon->nstype; i++) { - /* if the type doesn't match, if the shader doesn't match */ - if (stype != radeon->stype[i].stype) - continue; - if (shader_type) { - for (j = 0; j < 4; j++) { - if (radeon->stype[i].reginfo[j].shader_type == shader_type) { - shader_index = j; - break; - } - } - if (shader_index == -1) - continue; - } else { - if (radeon->stype[i].reginfo[0].shader_type) - continue; - else - shader_index = 0; - } - if (id > radeon->stype[i].num) - continue; - - found = &radeon->stype[i]; - break; - } - - if (!found) { - fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); - return -EINVAL; - } - - memset(state, 0, sizeof(struct radeon_state)); - state->stype = found; - state->state_id = state->stype->num * shader_index + state->stype->base_id + id; - state->radeon = radeon; - state->id = id; - state->shader_index = shader_index; - state->refcount = 1; - state->npm4 = found->npm4; - state->nstates = found->reginfo[shader_index].nstates; - return 0; -} - -int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type) -{ - struct radeon_stype_info *found = NULL; - int i, j, shader_index = -1; - - if (state == NULL) - return 0; - /* traverse the stype array */ - for (i = 0; i < state->radeon->nstype; i++) { - /* if the type doesn't match, if the shader doesn't match */ - if (stype != state->radeon->stype[i].stype) - continue; - if (shader_type) { - for (j = 0; j < 4; j++) { - if (state->radeon->stype[i].reginfo[j].shader_type == shader_type) { - shader_index = j; - break; - } - } - if (shader_index == -1) - continue; - } else { - if (state->radeon->stype[i].reginfo[0].shader_type) - continue; - else - shader_index = 0; - } - if (id > state->radeon->stype[i].num) - continue; - - found = &state->radeon->stype[i]; - break; - } - - if (!found) { - fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type); - return -EINVAL; - } - - if (found->reginfo[shader_index].nstates != state->nstates) { - fprintf(stderr, "invalid type change from (%d %d %d) to (%d %d %d)\n", - state->stype->stype, state->id, state->shader_index, stype, id, shader_index); - } - - state->stype = found; - state->id = id; - state->shader_index = shader_index; - state->state_id = state->stype->num * shader_index + state->stype->base_id + id; - return radeon_state_pm4(state); -} - -void radeon_state_fini(struct radeon_state *state) -{ - unsigned i; - - if (state == NULL) - return; - for (i = 0; i < state->nbo; i++) { - radeon_ws_bo_reference(state->radeon, &state->bo[i], NULL); - } - memset(state, 0, sizeof(struct radeon_state)); -} - -int radeon_state_replace_always(struct radeon_state *ostate, - struct radeon_state *nstate) -{ - return 1; -} - -int radeon_state_pm4_generic(struct radeon_state *state) -{ - return -EINVAL; -} - -static u32 crc32(void *d, size_t len) -{ - u16 *data = (uint16_t*)d; - u32 sum1 = 0xffff, sum2 = 0xffff; - - len = len >> 1; - while (len) { - unsigned tlen = len > 360 ? 360 : len; - len -= tlen; - do { - sum1 += *data++; - sum2 += sum1; - } while (--tlen); - sum1 = (sum1 & 0xffff) + (sum1 >> 16); - sum2 = (sum2 & 0xffff) + (sum2 >> 16); - } - /* Second reduction step to reduce sums to 16 bits */ - sum1 = (sum1 & 0xffff) + (sum1 >> 16); - sum2 = (sum2 & 0xffff) + (sum2 >> 16); - return sum2 << 16 | sum1; -} - -int radeon_state_pm4(struct radeon_state *state) -{ - int r; - - if (state == NULL) - return 0; - state->cpm4 = 0; - r = state->stype->pm4(state); - if (r) { - fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n", - __func__, state->stype->stype, state->id); - return r; - } - state->pm4_crc = crc32(state->pm4, state->cpm4 * 4); - return 0; -} - -int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id) -{ - state->reloc_pm4_id[state->nreloc] = id; - state->reloc_bo_id[state->nreloc] = bo_id; - state->nreloc++; - return 0; -} -- cgit v1.2.3 From 45d22a9b20b6728adf4ed7c96cdf6ebf572f186d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 11:29:12 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. radeon_program_alu.c: In function ‘r300_transform_trig_simple’: radeon_program_alu.c:882: warning: ISO C90 forbids mixed declarations and code radeon_program_alu.c:932: warning: ISO C90 forbids mixed declarations and code radeon_program_alu.c: In function ‘radeonTransformTrigScale’: radeon_program_alu.c:996: warning: ISO C90 forbids mixed declarations and code radeon_program_alu.c: In function ‘r300_transform_trig_scale_vertex’: radeon_program_alu.c:1033: warning: ISO C90 forbids mixed declarations and code --- .../drivers/dri/r300/compiler/radeon_program_alu.c | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 4d3e26f28cd..39408845d5a 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -874,13 +874,15 @@ int r300_transform_trig_simple(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { + unsigned int constants[2]; + unsigned int tempreg; + if (inst->U.I.Opcode != RC_OPCODE_COS && inst->U.I.Opcode != RC_OPCODE_SIN && inst->U.I.Opcode != RC_OPCODE_SCS) return 0; - unsigned int constants[2]; - unsigned int tempreg = rc_find_free_temporary(c); + tempreg = rc_find_free_temporary(c); sincos_constants(c, constants); @@ -918,6 +920,8 @@ int r300_transform_trig_simple(struct radeon_compiler* c, swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)), constants); } else { + struct rc_dst_register dst; + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY), swizzle_xxxx(inst->U.I.SrcReg[0]), swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])), @@ -929,7 +933,7 @@ int r300_transform_trig_simple(struct radeon_compiler* c, swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])), negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0])))); - struct rc_dst_register dst = inst->U.I.DstReg; + dst = inst->U.I.DstReg; dst.WriteMask = inst->U.I.DstReg.WriteMask & RC_MASK_X; sin_approx(c, inst, dst, @@ -988,16 +992,16 @@ int radeonTransformTrigScale(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->U.I.Opcode != RC_OPCODE_COS && - inst->U.I.Opcode != RC_OPCODE_SIN && - inst->U.I.Opcode != RC_OPCODE_SCS) - return 0; - static const float RCP_2PI = 0.15915494309189535; unsigned int temp; unsigned int constant; unsigned int constant_swizzle; + if (inst->U.I.Opcode != RC_OPCODE_COS && + inst->U.I.Opcode != RC_OPCODE_SIN && + inst->U.I.Opcode != RC_OPCODE_SCS) + return 0; + temp = rc_find_free_temporary(c); constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle); @@ -1020,6 +1024,10 @@ int r300_transform_trig_scale_vertex(struct radeon_compiler *c, struct rc_instruction *inst, void *unused) { + static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979}; + unsigned int temp; + unsigned int constant; + if (inst->U.I.Opcode != RC_OPCODE_COS && inst->U.I.Opcode != RC_OPCODE_SIN && inst->U.I.Opcode != RC_OPCODE_SCS) @@ -1030,10 +1038,6 @@ int r300_transform_trig_scale_vertex(struct radeon_compiler *c, * repeat(x) = frac(x / 2PI + 0.5) * 2PI - PI */ - static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979}; - unsigned int temp; - unsigned int constant; - temp = rc_find_free_temporary(c); constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons); -- cgit v1.2.3 From 4e07aadabbf4b3ff57d79033e92dfab9fe299f45 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 11:41:14 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. radeon_pair_translate.c: In function ‘set_pair_instruction’: radeon_pair_translate.c:153: warning: ISO C90 forbids mixed declarations and code radeon_pair_translate.c:170: warning: ISO C90 forbids mixed declarations and code radeon_pair_translate.c: In function ‘rc_pair_translate’: radeon_pair_translate.c:336: warning: ISO C90 forbids mixed declarations and code radeon_pair_translate.c:341: warning: ISO C90 forbids mixed declarations and code --- .../drivers/dri/r300/compiler/radeon_pair_translate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index ff825844663..c549be52183 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -148,9 +148,12 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, struct rc_pair_instruction * pair, struct rc_sub_instruction * inst) { + int needrgb, needalpha, istranscendent; + const struct rc_opcode_info * opcode; + int i; + memset(pair, 0, sizeof(struct rc_pair_instruction)); - int needrgb, needalpha, istranscendent; classify_instruction(inst, &needrgb, &needalpha, &istranscendent); if (needrgb) { @@ -167,8 +170,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, pair->Alpha.Saturate = 1; } - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); - int i; + opcode = rc_get_opcode_info(inst->Opcode); /* Presubtract handling: * We need to make sure that the values used by the presubtract @@ -330,15 +332,18 @@ void rc_pair_translate(struct radeon_compiler *cc, void *user) for(struct rc_instruction * inst = c->Base.Program.Instructions.Next; inst != &c->Base.Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info * opcode; + struct rc_sub_instruction copy; + if (inst->Type != RC_INSTRUCTION_NORMAL) continue; - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + opcode = rc_get_opcode_info(inst->U.I.Opcode); if (opcode->HasTexture || opcode->IsFlowControl || opcode->Opcode == RC_OPCODE_KIL) continue; - struct rc_sub_instruction copy = inst->U.I; + copy = inst->U.I; check_opcode_support(c, ©); -- cgit v1.2.3 From 94e9ab975cb4187a63eeb4cd03694ebd3cb27bd8 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 29 Sep 2010 17:54:31 +0200 Subject: r300g: add support for formats beginning with X, like X8R8G8B8 This is actually a format translator fix. --- src/gallium/drivers/r300/r300_state_inlines.h | 18 ++++++++++---- src/gallium/drivers/r300/r300_texture.c | 34 +++++++++++++++++++++------ 2 files changed, 40 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 03ec127ff79..7e501221b1f 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -364,6 +364,7 @@ static INLINE uint16_t r300_translate_vertex_data_type(enum pipe_format format) { uint32_t result = 0; const struct util_format_description *desc; + unsigned i; desc = util_format_description(format); @@ -371,10 +372,17 @@ r300_translate_vertex_data_type(enum pipe_format format) { return R300_INVALID_FORMAT; } - switch (desc->channel[0].type) { + /* Find the first non-VOID channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + switch (desc->channel[i].type) { /* Half-floats, floats, doubles */ case UTIL_FORMAT_TYPE_FLOAT: - switch (desc->channel[0].size) { + switch (desc->channel[i].size) { case 16: /* Supported only on RV350 and later. */ if (desc->nr_channels > 2) { @@ -394,7 +402,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { case UTIL_FORMAT_TYPE_UNSIGNED: /* Signed ints */ case UTIL_FORMAT_TYPE_SIGNED: - switch (desc->channel[0].size) { + switch (desc->channel[i].size) { case 8: result = R300_DATA_TYPE_BYTE; break; @@ -413,10 +421,10 @@ r300_translate_vertex_data_type(enum pipe_format format) { return R300_INVALID_FORMAT; } - if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) { + if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) { result |= R300_SIGNED; } - if (desc->channel[0].normalized) { + if (desc->channel[i].normalized) { result |= R300_NORMALIZE; } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index a7911c6fcc4..2d8431dbb80 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -260,16 +260,26 @@ uint32_t r300_translate_texformat(enum pipe_format format, return ~0; /* Unsupported/unknown. */ } + /* Find the first non-VOID channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + if (i == 4) + return ~0; /* Unsupported/unknown. */ + /* And finally, uniform formats. */ - switch (desc->channel[0].type) { + switch (desc->channel[i].type) { case UTIL_FORMAT_TYPE_UNSIGNED: case UTIL_FORMAT_TYPE_SIGNED: - if (!desc->channel[0].normalized && + if (!desc->channel[i].normalized && desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) { return ~0; } - switch (desc->channel[0].size) { + switch (desc->channel[i].size) { case 4: switch (desc->nr_channels) { case 2: @@ -303,7 +313,7 @@ uint32_t r300_translate_texformat(enum pipe_format format, return ~0; case UTIL_FORMAT_TYPE_FLOAT: - switch (desc->channel[0].size) { + switch (desc->channel[i].size) { case 16: switch (desc->nr_channels) { case 1: @@ -443,15 +453,25 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) desc = util_format_description(format); + /* Find the first non-VOID channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + if (i == 4) + return ~0; /* Unsupported/unknown. */ + /* Specifies how the shader output is written to the fog unit. */ - if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) { - if (desc->channel[0].size == 32) { + if (desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT) { + if (desc->channel[i].size == 32) { modifier |= R300_US_OUT_FMT_C4_32_FP; } else { modifier |= R300_US_OUT_FMT_C4_16_FP; } } else { - if (desc->channel[0].size == 16) { + if (desc->channel[i].size == 16) { modifier |= R300_US_OUT_FMT_C4_16; } else { /* C4_8 seems to be used for the formats whose pixel size -- cgit v1.2.3 From 845bda34d0c10b72cf3e41b445985a67572c0c1d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 11:52:55 -0700 Subject: r600g: Update SConscript. This is a follow-up to commit 9c284b5cae916a083d17d1039d2f2da128b47882. Fixes SCons build. --- src/gallium/drivers/r600/SConscript | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/SConscript b/src/gallium/drivers/r600/SConscript index 99c8644e026..3f3740a554c 100644 --- a/src/gallium/drivers/r600/SConscript +++ b/src/gallium/drivers/r600/SConscript @@ -17,18 +17,15 @@ r600 = env.ConvenienceLibrary( target = 'r600', source = [ 'r600_buffer.c', - 'r600_context.c', - 'r600_draw.c', - 'r600_blit.c', + 'r600_state2.c', + 'evergreen_state.c', + 'r600_shader.c', 'r600_helper.c', - 'r600_query.c', 'r600_resource.c', - 'r600_screen.c', - 'r600_state.c', 'r600_texture.c', - 'r600_shader.c', 'r600_asm.c', 'r700_asm.c', + 'eg_asm.c', ]) Export('r600') -- cgit v1.2.3 From 1235becaa1cf7e29f580900592563c3329d326de Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 29 Sep 2010 15:05:19 -0400 Subject: r600g: cleanup Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/Makefile | 10 +- src/gallium/drivers/r600/evergreen_state.c | 7 +- src/gallium/drivers/r600/r600_buffer.c | 58 + src/gallium/drivers/r600/r600_pipe.c | 449 +++++ src/gallium/drivers/r600/r600_pipe.h | 25 +- src/gallium/drivers/r600/r600_query.c | 80 + src/gallium/drivers/r600/r600_resource.c | 12 + src/gallium/drivers/r600/r600_shader.c | 278 +++ src/gallium/drivers/r600/r600_state.c | 1673 +++++++++++++++++ src/gallium/drivers/r600/r600_state2.c | 2507 ------------------------- src/gallium/drivers/r600/radeon.h | 224 --- src/gallium/winsys/r600/drm/evergreen_state.c | 11 - src/gallium/winsys/r600/drm/r600_drm.c | 3 +- src/gallium/winsys/r600/drm/r600_priv.h | 48 +- src/gallium/winsys/r600/drm/r600_state2.c | 9 - src/gallium/winsys/r600/drm/radeon_bo.c | 2 +- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 38 +- src/gallium/winsys/r600/drm/radeon_pciid.c | 2 +- src/gallium/winsys/r600/drm/radeon_priv.h | 150 -- src/gallium/winsys/r600/drm/radeon_ws_bo.c | 27 +- 20 files changed, 2681 insertions(+), 2932 deletions(-) create mode 100644 src/gallium/drivers/r600/r600_pipe.c create mode 100644 src/gallium/drivers/r600/r600_query.c create mode 100644 src/gallium/drivers/r600/r600_state.c delete mode 100644 src/gallium/drivers/r600/r600_state2.c delete mode 100644 src/gallium/drivers/r600/radeon.h delete mode 100644 src/gallium/winsys/r600/drm/radeon_priv.h (limited to 'src') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 83be2935793..213534198a2 100644 --- a/src/gallium/drivers/r600/Makefile +++ b/src/gallium/drivers/r600/Makefile @@ -7,15 +7,17 @@ LIBRARY_INCLUDES = \ $(shell pkg-config libdrm --cflags-only-I) C_SOURCES = \ + r600_asm.c \ r600_buffer.c \ - r600_state2.c \ - evergreen_state.c \ - r600_shader.c \ r600_helper.c \ + r600_pipe.c \ + r600_query.c \ r600_resource.c \ + r600_shader.c \ + r600_state.c \ r600_texture.c \ - r600_asm.c \ r700_asm.c \ + evergreen_state.c \ eg_asm.c include ../../Makefile.template diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 74e2373b197..fc517f13ad1 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -42,9 +42,6 @@ #include #include "r600.h" #include "evergreend.h" -struct radeon_state { - unsigned dummy; -}; #include "r600_resource.h" #include "r600_shader.h" #include "r600_pipe.h" @@ -1349,7 +1346,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) assert(info->index_bias == 0); if (rctx->any_user_vbs) { - r600_upload_user_buffers2(rctx); + r600_upload_user_buffers(rctx); rctx->any_user_vbs = FALSE; } @@ -1372,7 +1369,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.index_buffer = rctx->index_buffer.buffer; draw.index_buffer_offset = draw.start * draw.index_size; draw.start = 0; - r600_upload_index_buffer2(rctx, &draw); + r600_upload_index_buffer(rctx, &draw); } else { draw.index_size = 0; draw.index_buffer = NULL; diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 69caba2fbc4..3900b3779f3 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -258,3 +258,61 @@ struct u_resource_vtbl r600_buffer_vtbl = r600_buffer_transfer_unmap, /* transfer_unmap */ u_default_transfer_inline_write /* transfer_inline_write */ }; + +int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw) +{ + struct pipe_resource *upload_buffer = NULL; + unsigned index_offset = draw->index_buffer_offset; + int ret = 0; + + if (r600_buffer_is_user_buffer(draw->index_buffer)) { + ret = u_upload_buffer(rctx->upload_ib, + index_offset, + draw->count * draw->index_size, + draw->index_buffer, + &index_offset, + &upload_buffer); + if (ret) { + goto done; + } + draw->index_buffer_offset = index_offset; + + /* Transfer ownership. */ + pipe_resource_reference(&draw->index_buffer, upload_buffer); + pipe_resource_reference(&upload_buffer, NULL); + } + +done: + return ret; +} + +int r600_upload_user_buffers(struct r600_pipe_context *rctx) +{ + enum pipe_error ret = PIPE_OK; + int i, nr; + + nr = rctx->vertex_elements->count; + + for (i = 0; i < nr; i++) { + struct pipe_vertex_buffer *vb = + &rctx->vertex_buffer[rctx->vertex_elements->elements[i].vertex_buffer_index]; + + if (r600_buffer_is_user_buffer(vb->buffer)) { + struct pipe_resource *upload_buffer = NULL; + unsigned offset = 0; /*vb->buffer_offset * 4;*/ + unsigned size = vb->buffer->width0; + unsigned upload_offset; + ret = u_upload_buffer(rctx->upload_vb, + offset, size, + vb->buffer, + &upload_offset, &upload_buffer); + if (ret) + return ret; + + pipe_resource_reference(&vb->buffer, NULL); + vb->buffer = upload_buffer; + vb->buffer_offset = upload_offset; + } + } + return ret; +} diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c new file mode 100644 index 00000000000..0613cd1eca6 --- /dev/null +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -0,0 +1,449 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "r600.h" +#include "r600d.h" +#include "r700_sq.h" +#include "r600_resource.h" +#include "r600_shader.h" +#include "r600_pipe.h" +#include "r600_state_inlines.h" + +/* + * pipe_context + */ +static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) +{ + struct pipe_depth_stencil_alpha_state dsa; + struct r600_pipe_state *rstate; + boolean quirk = false; + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + quirk = true; + + memset(&dsa, 0, sizeof(dsa)); + + if (quirk) { + dsa.depth.enabled = 1; + dsa.depth.func = PIPE_FUNC_LEQUAL; + dsa.stencil[0].enabled = 1; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; + dsa.stencil[0].writemask = 0xff; + } + + rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + 0x0, + S_02880C_DUAL_EXPORT_ENABLE(1), NULL); + r600_pipe_state_add_reg(rstate, + R_028D0C_DB_RENDER_CONTROL, + S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1), + S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1), NULL); + return rstate; +} + +static void r600_flush2(struct pipe_context *ctx, unsigned flags, + struct pipe_fence_handle **fence) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; +#if 0 + static int dc = 0; + char dname[256]; +#endif + + if (!rctx->ctx.pm4_cdwords) + return; + + u_upload_flush(rctx->upload_vb); + u_upload_flush(rctx->upload_ib); + +#if 0 + sprintf(dname, "gallium-%08d.bof", dc); + if (dc < 20) { + r600_context_dump_bof(&rctx->ctx, dname); + R600_ERR("dumped %s\n", dname); + } + dc++; +#endif + r600_context_flush(&rctx->ctx); +} + +static void r600_destroy_context(struct pipe_context *context) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)context; + + r600_context_fini(&rctx->ctx); + for (int i = 0; i < R600_PIPE_NSTATES; i++) { + free(rctx->states[i]); + } + + u_upload_destroy(rctx->upload_vb); + u_upload_destroy(rctx->upload_ib); + + FREE(rctx); +} + +static struct pipe_context *r600_create_context2(struct pipe_screen *screen, void *priv) +{ + struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); + struct r600_screen* rscreen = (struct r600_screen *)screen; + + if (rctx == NULL) + return NULL; + rctx->context.winsys = rscreen->screen.winsys; + rctx->context.screen = screen; + rctx->context.priv = priv; + rctx->context.destroy = r600_destroy_context; + rctx->context.flush = r600_flush2; + + /* Easy accessing of screen/winsys. */ + rctx->screen = rscreen; + rctx->radeon = rscreen->radeon; + rctx->family = r600_get_family(rctx->radeon); + + r600_init_blit_functions2(rctx); + r600_init_query_functions2(rctx); + r600_init_context_resource_functions2(rctx); + + switch (r600_get_family(rctx->radeon)) { + case CHIP_R600: + case CHIP_RV610: + case CHIP_RV630: + case CHIP_RV670: + case CHIP_RV620: + case CHIP_RV635: + case CHIP_RS780: + case CHIP_RS880: + case CHIP_RV770: + case CHIP_RV730: + case CHIP_RV710: + case CHIP_RV740: + rctx->context.draw_vbo = r600_draw_vbo2; + r600_init_state_functions2(rctx); + if (r600_context_init(&rctx->ctx, rctx->radeon)) { + r600_destroy_context(&rctx->context); + return NULL; + } + r600_init_config2(rctx); + break; + case CHIP_CEDAR: + case CHIP_REDWOOD: + case CHIP_JUNIPER: + case CHIP_CYPRESS: + case CHIP_HEMLOCK: + rctx->context.draw_vbo = evergreen_draw; + evergreen_init_state_functions2(rctx); + if (evergreen_context_init(&rctx->ctx, rctx->radeon)) { + r600_destroy_context(&rctx->context); + return NULL; + } + evergreen_init_config2(rctx); + break; + default: + R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon)); + r600_destroy_context(&rctx->context); + return NULL; + } + + rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16, + PIPE_BIND_INDEX_BUFFER); + if (rctx->upload_ib == NULL) { + r600_destroy_context(&rctx->context); + return NULL; + } + + rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16, + PIPE_BIND_VERTEX_BUFFER); + if (rctx->upload_vb == NULL) { + r600_destroy_context(&rctx->context); + return NULL; + } + + rctx->blitter = util_blitter_create(&rctx->context); + if (rctx->blitter == NULL) { + FREE(rctx); + return NULL; + } + + LIST_INITHEAD(&rctx->query_list); + rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); + + r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth2; + + return &rctx->context; +} + +/* + * pipe_screen + */ +static const char* r600_get_vendor(struct pipe_screen* pscreen) +{ + return "X.Org"; +} + +static const char* r600_get_name(struct pipe_screen* pscreen) +{ + struct r600_screen *rscreen = (struct r600_screen *)pscreen; + enum radeon_family family = r600_get_family(rscreen->radeon); + + if (family >= CHIP_R600 && family < CHIP_RV770) + return "R600 (HD2XXX,HD3XXX)"; + else if (family < CHIP_CEDAR) + return "R700 (HD4XXX)"; + else + return "EVERGREEN"; +} + +static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) +{ + switch (param) { + /* Supported features (boolean caps). */ + case PIPE_CAP_NPOT_TEXTURES: + case PIPE_CAP_TWO_SIDED_STENCIL: + case PIPE_CAP_GLSL: + case PIPE_CAP_DUAL_SOURCE_BLEND: + case PIPE_CAP_ANISOTROPIC_FILTER: + case PIPE_CAP_POINT_SPRITE: + case PIPE_CAP_OCCLUSION_QUERY: + case PIPE_CAP_TEXTURE_SHADOW_MAP: + case PIPE_CAP_TEXTURE_MIRROR_CLAMP: + case PIPE_CAP_TEXTURE_MIRROR_REPEAT: + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + case PIPE_CAP_SM3: + case PIPE_CAP_TEXTURE_SWIZZLE: + case PIPE_CAP_INDEP_BLEND_ENABLE: + case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: + case PIPE_CAP_DEPTH_CLAMP: + return 1; + + /* Unsupported features (boolean caps). */ + case PIPE_CAP_TIMER_QUERY: + case PIPE_CAP_STREAM_OUTPUT: + case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */ + return 0; + + /* Texturing. */ + case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: + return 14; + case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: + /* FIXME allow this once infrastructure is there */ + return 0; + case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: + case PIPE_CAP_MAX_COMBINED_SAMPLERS: + return 16; + + /* Render targets. */ + case PIPE_CAP_MAX_RENDER_TARGETS: + /* FIXME some r6xx are buggy and can only do 4 */ + return 8; + + /* Fragment coordinate conventions. */ + case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: + case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: + return 1; + case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: + case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: + return 0; + + default: + R600_ERR("r600: unknown param %d\n", param); + return 0; + } +} + +static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param) +{ + switch (param) { + case PIPE_CAP_MAX_LINE_WIDTH: + case PIPE_CAP_MAX_LINE_WIDTH_AA: + case PIPE_CAP_MAX_POINT_WIDTH: + case PIPE_CAP_MAX_POINT_WIDTH_AA: + return 8192.0f; + case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: + return 16.0f; + case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: + return 16.0f; + default: + R600_ERR("r600: unsupported paramf %d\n", param); + return 0.0f; + } +} + +static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) +{ + switch(shader) + { + case PIPE_SHADER_FRAGMENT: + case PIPE_SHADER_VERTEX: + break; + case PIPE_SHADER_GEOMETRY: + /* TODO: support and enable geometry programs */ + return 0; + default: + /* TODO: support tessellation on Evergreen */ + return 0; + } + + /* TODO: all these should be fixed, since r600 surely supports much more! */ + switch (param) { + case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: + case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: + case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: + case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: + return 16384; + case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: + return 8; /* FIXME */ + case PIPE_SHADER_CAP_MAX_INPUTS: + if(shader == PIPE_SHADER_FRAGMENT) + return 10; + else + return 16; + case PIPE_SHADER_CAP_MAX_TEMPS: + return 256; //max native temporaries + case PIPE_SHADER_CAP_MAX_ADDRS: + return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */ + case PIPE_SHADER_CAP_MAX_CONSTS: + return 256; //max native parameters + case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: + return 1; + case PIPE_SHADER_CAP_MAX_PREDS: + return 0; /* FIXME */ + case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: + return 1; + default: + return 0; + } +} + +static boolean r600_is_format_supported(struct pipe_screen* screen, + enum pipe_format format, + enum pipe_texture_target target, + unsigned sample_count, + unsigned usage, + unsigned geom_flags) +{ + unsigned retval = 0; + if (target >= PIPE_MAX_TEXTURE_TYPES) { + R600_ERR("r600: unsupported texture type %d\n", target); + return FALSE; + } + + /* Multisample */ + if (sample_count > 1) + return FALSE; + + if ((usage & PIPE_BIND_SAMPLER_VIEW) && + r600_is_sampler_format_supported(format)) { + retval |= PIPE_BIND_SAMPLER_VIEW; + } + + if ((usage & (PIPE_BIND_RENDER_TARGET | + PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_SCANOUT | + PIPE_BIND_SHARED)) && + r600_is_colorbuffer_format_supported(format)) { + retval |= usage & + (PIPE_BIND_RENDER_TARGET | + PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_SCANOUT | + PIPE_BIND_SHARED); + } + + if ((usage & PIPE_BIND_DEPTH_STENCIL) && + r600_is_zs_format_supported(format)) { + retval |= PIPE_BIND_DEPTH_STENCIL; + } + + if ((usage & PIPE_BIND_VERTEX_BUFFER) && + r600_is_vertex_format_supported(format)) + retval |= PIPE_BIND_VERTEX_BUFFER; + + if (usage & PIPE_BIND_TRANSFER_READ) + retval |= PIPE_BIND_TRANSFER_READ; + if (usage & PIPE_BIND_TRANSFER_WRITE) + retval |= PIPE_BIND_TRANSFER_WRITE; + + return retval == usage; +} + +static void r600_destroy_screen(struct pipe_screen* pscreen) +{ + struct r600_screen *rscreen = (struct r600_screen *)pscreen; + + if (rscreen == NULL) + return; + FREE(rscreen); +} + + +struct pipe_screen *r600_screen_create2(struct radeon *radeon) +{ + struct r600_screen *rscreen; + + rscreen = CALLOC_STRUCT(r600_screen); + if (rscreen == NULL) { + return NULL; + } + + rscreen->radeon = radeon; + rscreen->screen.winsys = (struct pipe_winsys*)radeon; + rscreen->screen.destroy = r600_destroy_screen; + rscreen->screen.get_name = r600_get_name; + rscreen->screen.get_vendor = r600_get_vendor; + rscreen->screen.get_param = r600_get_param; + rscreen->screen.get_shader_param = r600_get_shader_param; + rscreen->screen.get_paramf = r600_get_paramf; + rscreen->screen.is_format_supported = r600_is_format_supported; + rscreen->screen.context_create = r600_create_context2; + r600_init_screen_texture_functions(&rscreen->screen); + r600_init_screen_resource_functions(&rscreen->screen); + + return &rscreen->screen; +} diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index b1e76b692c7..ab31180df7d 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -153,8 +153,6 @@ uint32_t r600_translate_texformat(enum pipe_format format, /* r600_state2.c */ int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader); int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); -int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl *draw); -int r600_upload_user_buffers2(struct r600_pipe_context *rctx); void r600_translate_index_buffer2(struct r600_pipe_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, @@ -175,6 +173,10 @@ static INLINE u32 S_FIXED(float value, u32 frac_bits) } #define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) +/* r600_blit.c */ +void r600_init_blit_functions2(struct r600_pipe_context *rctx); +int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture); + /* r600_buffer.c */ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ); @@ -186,5 +188,24 @@ unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context, unsigned face, unsigned level); struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen, struct winsys_handle *whandle); +int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw); +int r600_upload_user_buffers(struct r600_pipe_context *rctx); + +/* r600_query.c */ +void r600_init_query_functions2(struct r600_pipe_context *rctx); + +/* r600_resource.c */ +void r600_init_context_resource_functions2(struct r600_pipe_context *r600); + +/* r600_state.c */ +void r600_init_state_functions2(struct r600_pipe_context *rctx); +void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info); +void r600_init_config2(struct r600_pipe_context *rctx); + +/* r600_helper.h */ +int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); + +/* r600_texture.c */ +void r600_init_screen_texture_functions(struct pipe_screen *screen); #endif diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c new file mode 100644 index 00000000000..7385a6f1e19 --- /dev/null +++ b/src/gallium/drivers/r600/r600_query.c @@ -0,0 +1,80 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + */ + +/* TODO: + * - fix mask for depth control & cull for query + */ +#include "r600_pipe.h" + +static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + return (struct pipe_query*)r600_context_query_create(&rctx->ctx, query_type); +} + +static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + r600_context_query_destroy(&rctx->ctx, (struct r600_query *)query); +} + +static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_query *rquery = (struct r600_query *)query; + + rquery->result = 0; + rquery->num_results = 0; + r600_query_begin(&rctx->ctx, (struct r600_query *)query); +} + +static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + r600_query_end(&rctx->ctx, (struct r600_query *)query); +} + +static boolean r600_get_query_result(struct pipe_context *ctx, + struct pipe_query *query, + boolean wait, void *vresult) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_query *rquery = (struct r600_query *)query; + + if (rquery->num_results) { + ctx->flush(ctx, 0, NULL); + } + return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); +} + +void r600_init_query_functions2(struct r600_pipe_context *rctx) +{ + rctx->context.create_query = r600_create_query; + rctx->context.destroy_query = r600_destroy_query; + rctx->context.begin_query = r600_begin_query; + rctx->context.end_query = r600_end_query; + rctx->context.get_query_result = r600_get_query_result; +} diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index ee6013e865e..b8f490c344a 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -52,3 +52,15 @@ void r600_init_screen_resource_functions(struct pipe_screen *screen) screen->resource_destroy = u_resource_destroy_vtbl; screen->user_buffer_create = r600_user_buffer_create; } + +void r600_init_context_resource_functions2(struct r600_pipe_context *r600) +{ + r600->context.get_transfer = u_get_transfer_vtbl; + r600->context.transfer_map = u_transfer_map_vtbl; + r600->context.transfer_flush_region = u_transfer_flush_region_vtbl; + r600->context.transfer_unmap = u_transfer_unmap_vtbl; + r600->context.transfer_destroy = u_transfer_destroy_vtbl; + r600->context.transfer_inline_write = u_transfer_inline_write_vtbl; + r600->context.is_resource_referenced = u_is_resource_referenced_vtbl; +} + diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 97e1d5ee121..718754b104e 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -33,7 +33,285 @@ #include #include +static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) +{ + struct r600_pipe_state *rstate = &shader->rstate; + struct r600_shader *rshader = &shader->shader; + unsigned spi_vs_out_id[10]; + unsigned i, tmp; + + /* clear previous register */ + rstate->nregs = 0; + + /* so far never got proper semantic id from tgsi */ + for (i = 0; i < 10; i++) { + spi_vs_out_id[i] = 0; + } + for (i = 0; i < 32; i++) { + tmp = i << ((i & 3) * 8); + spi_vs_out_id[i / 4] |= tmp; + } + for (i = 0; i < 10; i++) { + r600_pipe_state_add_reg(rstate, + R_028614_SPI_VS_OUT_ID_0 + i * 4, + spi_vs_out_id[i], 0xFFFFFFFF, NULL); + } + + r600_pipe_state_add_reg(rstate, + R_0286C4_SPI_VS_OUT_CONFIG, + S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028868_SQ_PGM_RESOURCES_VS, + S_028868_NUM_GPRS(rshader->bc.ngpr) | + S_028868_STACK_SIZE(rshader->bc.nstack), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_0288A4_SQ_PGM_RESOURCES_FS, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_0288D0_SQ_PGM_CF_OFFSET_VS, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_0288DC_SQ_PGM_CF_OFFSET_FS, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028858_SQ_PGM_START_VS, + 0x00000000, 0xFFFFFFFF, shader->bo); + r600_pipe_state_add_reg(rstate, + R_028894_SQ_PGM_START_FS, + 0x00000000, 0xFFFFFFFF, shader->bo); +} + +int r600_find_vs_semantic_index2(struct r600_shader *vs, + struct r600_shader *ps, int id) +{ + struct r600_shader_io *input = &ps->input[id]; + + for (int i = 0; i < vs->noutput; i++) { + if (input->name == vs->output[i].name && + input->sid == vs->output[i].sid) { + return i - 1; + } + } + return 0; +} + +static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = &shader->rstate; + struct r600_shader *rshader = &shader->shader; + unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z; + boolean have_pos = FALSE, have_face = FALSE; + + /* clear previous register */ + rstate->nregs = 0; + + for (i = 0; i < rshader->ninput; i++) { + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); + tmp |= S_028644_SEL_CENTROID(1); + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) + have_pos = TRUE; + if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || + rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || + rshader->input[i].name == TGSI_SEMANTIC_POSITION) { + tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); + } + if (rshader->input[i].name == TGSI_SEMANTIC_FACE) + have_face = TRUE; + if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && + rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) { + tmp |= S_028644_PT_SPRITE_TEX(1); + } + r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); + } + for (i = 0; i < rshader->noutput; i++) { + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + S_02880C_Z_EXPORT_ENABLE(1), + S_02880C_Z_EXPORT_ENABLE(1), NULL); + } + + exports_ps = 0; + num_cout = 0; + for (i = 0; i < rshader->noutput; i++) { + if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) + exports_ps |= 1; + else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { + num_cout++; + } + } + exports_ps |= S_028854_EXPORT_COLORS(num_cout); + if (!exports_ps) { + /* always at least export 1 component per pixel */ + exports_ps = 2; + } + + spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) | + S_0286CC_PERSP_GRADIENT_ENA(1); + spi_input_z = 0; + if (have_pos) { + spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1) | + S_0286CC_BARYC_SAMPLE_CNTL(1); + spi_input_z |= 1; + } + r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028840_SQ_PGM_START_PS, + 0x00000000, 0xFFFFFFFF, shader->bo); + r600_pipe_state_add_reg(rstate, + R_028850_SQ_PGM_RESOURCES_PS, + S_028868_NUM_GPRS(rshader->bc.ngpr) | + S_028868_STACK_SIZE(rshader->bc.nstack), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028854_SQ_PGM_EXPORTS_PS, + exports_ps, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_0288CC_SQ_PGM_CF_OFFSET_PS, + 0x00000000, 0xFFFFFFFF, NULL); + + if (rshader->uses_kill) { + /* only set some bits here, the other bits are set in the dsa state */ + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + S_02880C_KILL_ENABLE(1), + S_02880C_KILL_ENABLE(1), NULL); + } +} +static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_shader *rshader = &shader->shader; + void *ptr; + + /* copy new shader */ + if (shader->bo == NULL) { + shader->bo = radeon_ws_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0); + if (shader->bo == NULL) { + return -ENOMEM; + } + ptr = radeon_ws_bo_map(rctx->radeon, shader->bo, 0, NULL); + memcpy(ptr, rshader->bc.bytecode, rshader->bc.ndw * 4); + radeon_ws_bo_unmap(rctx->radeon, shader->bo); + } + /* build state */ + rshader->flat_shade = rctx->flatshade; + switch (rshader->processor_type) { + case TGSI_PROCESSOR_VERTEX: + if (rshader->family >= CHIP_CEDAR) { + evergreen_pipe_shader_vs(ctx, shader); + } else { + r600_pipe_shader_vs(ctx, shader); + } + break; + case TGSI_PROCESSOR_FRAGMENT: + if (rshader->family >= CHIP_CEDAR) { + evergreen_pipe_shader_ps(ctx, shader); + } else { + r600_pipe_shader_ps(ctx, shader); + } + break; + default: + return -EINVAL; + } + r600_context_pipe_state_set(&rctx->ctx, &shader->rstate); + return 0; +} + +static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *rshader) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_shader *shader = &rshader->shader; + const struct util_format_description *desc; + enum pipe_format resource_format[160]; + unsigned i, nresources = 0; + struct r600_bc *bc = &shader->bc; + struct r600_bc_cf *cf; + struct r600_bc_vtx *vtx; + + if (shader->processor_type != TGSI_PROCESSOR_VERTEX) + return 0; + if (!memcmp(&rshader->vertex_elements, rctx->vertex_elements, sizeof(struct r600_vertex_element))) { + return 0; + } + rshader->vertex_elements = *rctx->vertex_elements; + for (i = 0; i < rctx->vertex_elements->count; i++) { + resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format; + } + radeon_ws_bo_reference(rctx->radeon, &rshader->bo, NULL); + LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) { + switch (cf->inst) { + case V_SQ_CF_WORD1_SQ_CF_INST_VTX: + case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC: + LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) { + desc = util_format_description(resource_format[vtx->buffer_id]); + if (desc == NULL) { + R600_ERR("unknown format %d\n", resource_format[vtx->buffer_id]); + return -EINVAL; + } + vtx->dst_sel_x = desc->swizzle[0]; + vtx->dst_sel_y = desc->swizzle[1]; + vtx->dst_sel_z = desc->swizzle[2]; + vtx->dst_sel_w = desc->swizzle[3]; + } + break; + default: + break; + } + } + return r600_bc_build(&shader->bc); +} + +int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + int r; + + if (shader == NULL) + return -EINVAL; + /* there should be enough input */ + if (rctx->vertex_elements->count < shader->shader.bc.nresource) { + R600_ERR("%d resources provided, expecting %d\n", + rctx->vertex_elements->count, shader->shader.bc.nresource); + return -EINVAL; + } + r = r600_shader_update(ctx, shader); + if (r) + return r; + return r600_pipe_shader(ctx, shader); +} + +int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader); +int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + int r; + +//fprintf(stderr, "--------------------------------------------------------------\n"); +//tgsi_dump(tokens, 0); + shader->shader.family = r600_get_family(rctx->radeon); + r = r600_shader_from_tgsi(tokens, &shader->shader); + if (r) { + R600_ERR("translation from TGSI failed !\n"); + return r; + } + r = r600_bc_build(&shader->shader.bc); + if (r) { + R600_ERR("building bytecode failed !\n"); + return r; + } +//fprintf(stderr, "______________________________________________________________\n"); + return 0; +} + +/* + * tgsi -> r600 shader + */ struct r600_shader_tgsi_instruction; struct r600_shader_ctx { diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c new file mode 100644 index 00000000000..911d4835b4f --- /dev/null +++ b/src/gallium/drivers/r600/r600_state.c @@ -0,0 +1,1673 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + */ + +/* TODO: + * - fix mask for depth control & cull for query + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "r600.h" +#include "r600d.h" +#include "r700_sq.h" +#include "r600_resource.h" +#include "r600_shader.h" +#include "r600_pipe.h" +#include "r600_state_inlines.h" + +static void r600_draw_common(struct r600_drawl *draw) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)draw->ctx; + struct r600_pipe_state *rstate; + struct r600_resource *rbuffer; + unsigned i, j, offset, format, prim; + u32 vgt_dma_index_type, vgt_draw_initiator, mask; + struct pipe_vertex_buffer *vertex_buffer; + struct r600_draw rdraw; + struct r600_pipe_state vgt; + + switch (draw->index_size) { + case 2: + vgt_draw_initiator = 0; + vgt_dma_index_type = 0; + break; + case 4: + vgt_draw_initiator = 0; + vgt_dma_index_type = 1; + break; + case 0: + vgt_draw_initiator = 2; + vgt_dma_index_type = 0; + break; + default: + R600_ERR("unsupported index size %d\n", draw->index_size); + return; + } + if (r600_conv_pipe_prim(draw->mode, &prim)) + return; + + + /* rebuild vertex shader if input format changed */ + if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader)) + return; + if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader)) + return; + + for (i = 0 ; i < rctx->vertex_elements->count; i++) { + unsigned num_format = 0, format_comp = 0; + + rstate = &rctx->vs_resource[i]; + j = rctx->vertex_elements->elements[i].vertex_buffer_index; + vertex_buffer = &rctx->vertex_buffer[j]; + rbuffer = (struct r600_resource*)vertex_buffer->buffer; + offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; + format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); + rstate->id = R600_PIPE_STATE_RESOURCE; + rstate->nregs = 0; + + r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); + r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_038008_RESOURCE0_WORD2, + S_038008_STRIDE(vertex_buffer->stride) | + S_038008_DATA_FORMAT(format) | + S_038008_NUM_FORMAT_ALL(num_format) | + S_038008_FORMAT_COMP_ALL(format_comp), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL); + r600_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, i); + } + + mask = 0; + for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { + mask |= (0xF << (i * 4)); + } + + vgt.id = R600_PIPE_STATE_VGT; + vgt.nregs = 0; + r600_pipe_state_add_reg(&vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); + /* build late state */ + if (rctx->rasterizer && rctx->framebuffer.zsbuf) { + float offset_units = rctx->rasterizer->offset_units; + unsigned offset_db_fmt_cntl = 0, depth; + + switch (rctx->framebuffer.zsbuf->texture->format) { + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + depth = -24; + offset_units *= 2.0f; + break; + case PIPE_FORMAT_Z32_FLOAT: + depth = -23; + offset_units *= 1.0f; + offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); + break; + case PIPE_FORMAT_Z16_UNORM: + depth = -16; + offset_units *= 4.0f; + break; + default: + return; + } + offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); + r600_pipe_state_add_reg(&vgt, + R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, + fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, + R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, + fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, + R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, + fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, + R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, + fui(offset_units), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, + R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, + offset_db_fmt_cntl, 0xFFFFFFFF, NULL); + } + r600_context_pipe_state_set(&rctx->ctx, &vgt); + + rdraw.vgt_num_indices = draw->count; + rdraw.vgt_num_instances = 1; + rdraw.vgt_index_type = vgt_dma_index_type; + rdraw.vgt_draw_initiator = vgt_draw_initiator; + rdraw.indices = NULL; + if (draw->index_buffer) { + rbuffer = (struct r600_resource*)draw->index_buffer; + rdraw.indices = rbuffer->bo; + rdraw.indices_bo_offset = draw->index_buffer_offset; + } + r600_context_draw(&rctx->ctx, &rdraw); +} + +void r600_translate_index_buffer2(struct r600_pipe_context *r600, + struct pipe_resource **index_buffer, + unsigned *index_size, + unsigned *start, unsigned count) +{ + switch (*index_size) { + case 1: + util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count); + *index_size = 2; + *start = 0; + break; + + case 2: + if (*start % 2 != 0) { + util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count); + *start = 0; + } + break; + + case 4: + break; + } +} + +void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_drawl draw; + + if (rctx->any_user_vbs) { + r600_upload_user_buffers(rctx); + rctx->any_user_vbs = FALSE; + } + + memset(&draw, 0, sizeof(struct r600_drawl)); + draw.ctx = ctx; + draw.mode = info->mode; + draw.start = info->start; + draw.count = info->count; + if (info->indexed && rctx->index_buffer.buffer) { + draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; + draw.min_index = info->min_index; + draw.max_index = info->max_index; + draw.index_bias = info->index_bias; + + r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer, + &rctx->index_buffer.index_size, + &draw.start, + info->count); + + draw.index_size = rctx->index_buffer.index_size; + pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer); + draw.index_buffer_offset = draw.start * draw.index_size; + draw.start = 0; + r600_upload_index_buffer(rctx, &draw); + } else { + draw.index_size = 0; + draw.index_buffer = NULL; + draw.min_index = info->min_index; + draw.max_index = info->max_index; + draw.index_bias = info->start; + } + r600_draw_common(&draw); + + pipe_resource_reference(&draw.index_buffer, NULL); +} + + +static void r600_blitter_save_states(struct pipe_context *ctx) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]); + util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]); + if (rctx->states[R600_PIPE_STATE_STENCIL_REF]) { + util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref); + } + util_blitter_save_rasterizer(rctx->blitter, rctx->states[R600_PIPE_STATE_RASTERIZER]); + util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader); + util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader); + util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements); + if (rctx->states[R600_PIPE_STATE_VIEWPORT]) { + util_blitter_save_viewport(rctx->blitter, &rctx->viewport); + } + if (rctx->states[R600_PIPE_STATE_CLIP]) { + util_blitter_save_clip(rctx->blitter, &rctx->clip); + } + util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer); + + rctx->vertex_elements = NULL; + + /* TODO queries */ +} + +int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state fb = *rctx->pframebuffer; + struct pipe_surface *zsurf, *cbsurf; + int level = 0; + float depth = 1.0f; + + r600_context_queries_suspend(&rctx->ctx); + for (int i = 0; i < fb.nr_cbufs; i++) { + fb.cbufs[i] = NULL; + pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]); + } + fb.zsbuf = NULL; + pipe_surface_reference(&fb.zsbuf, rctx->pframebuffer->zsbuf); + + zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, + PIPE_BIND_DEPTH_STENCIL); + + cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0, + PIPE_BIND_RENDER_TARGET); + + r600_blitter_save_states(ctx); + util_blitter_save_framebuffer(rctx->blitter, &fb); + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + depth = 0.0f; + + util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); + + pipe_surface_reference(&zsurf, NULL); + pipe_surface_reference(&cbsurf, NULL); + for (int i = 0; i < fb.nr_cbufs; i++) { + pipe_surface_reference(&fb.cbufs[i], NULL); + } + pipe_surface_reference(&fb.zsbuf, NULL); + r600_context_queries_resume(&rctx->ctx); + + return 0; +} + +static void r600_clear(struct pipe_context *ctx, unsigned buffers, + const float *rgba, double depth, unsigned stencil) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state *fb = &rctx->framebuffer; + + r600_context_queries_suspend(&rctx->ctx); + r600_blitter_save_states(ctx); + util_blitter_clear(rctx->blitter, fb->width, fb->height, + fb->nr_cbufs, buffers, rgba, depth, + stencil); + r600_context_queries_resume(&rctx->ctx); +} + +static void r600_clear_render_target(struct pipe_context *ctx, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state *fb = &rctx->framebuffer; + + r600_context_queries_suspend(&rctx->ctx); + util_blitter_save_framebuffer(rctx->blitter, fb); + util_blitter_clear_render_target(rctx->blitter, dst, rgba, + dstx, dsty, width, height); + r600_context_queries_resume(&rctx->ctx); +} + +static void r600_clear_depth_stencil(struct pipe_context *ctx, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state *fb = &rctx->framebuffer; + + r600_context_queries_suspend(&rctx->ctx); + util_blitter_save_framebuffer(rctx->blitter, fb); + util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, + dstx, dsty, width, height); + r600_context_queries_resume(&rctx->ctx); +} + + +static void r600_resource_copy_region(struct pipe_context *ctx, + struct pipe_resource *dst, + struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + struct pipe_subresource subsrc, + unsigned srcx, unsigned srcy, unsigned srcz, + unsigned width, unsigned height) +{ + util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height); +} + +void r600_init_blit_functions2(struct r600_pipe_context *rctx) +{ + rctx->context.clear = r600_clear; + rctx->context.clear_render_target = r600_clear_render_target; + rctx->context.clear_depth_stencil = r600_clear_depth_stencil; + rctx->context.resource_copy_region = r600_resource_copy_region; +} + +static void r600_set_blend_color(struct pipe_context *ctx, + const struct pipe_blend_color *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + + if (rstate == NULL) + return; + + rstate->id = R600_PIPE_STATE_BLEND_COLOR; + r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); + free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); + rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void *r600_create_blend_state(struct pipe_context *ctx, + const struct pipe_blend_state *state) +{ + struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend); + struct r600_pipe_state *rstate; + u32 color_control, target_mask; + + if (blend == NULL) { + return NULL; + } + rstate = &blend->rstate; + + rstate->id = R600_PIPE_STATE_BLEND; + + target_mask = 0; + color_control = S_028808_PER_MRT_BLEND(1); + if (state->logicop_enable) { + color_control |= (state->logicop_func << 16) | (state->logicop_func << 20); + } else { + color_control |= (0xcc << 16); + } + /* we pretend 8 buffer are used, CB_SHADER_MASK will disable unused one */ + if (state->independent_blend_enable) { + for (int i = 0; i < 8; i++) { + if (state->rt[i].blend_enable) { + color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i); + } + target_mask |= (state->rt[i].colormask << (4 * i)); + } + } else { + for (int i = 0; i < 8; i++) { + if (state->rt[0].blend_enable) { + color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i); + } + target_mask |= (state->rt[0].colormask << (4 * i)); + } + } + blend->cb_target_mask = target_mask; + r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL, + color_control, 0xFFFFFFFF, NULL); + + for (int i = 0; i < 8; i++) { + unsigned eqRGB = state->rt[i].rgb_func; + unsigned srcRGB = state->rt[i].rgb_src_factor; + unsigned dstRGB = state->rt[i].rgb_dst_factor; + + unsigned eqA = state->rt[i].alpha_func; + unsigned srcA = state->rt[i].alpha_src_factor; + unsigned dstA = state->rt[i].alpha_dst_factor; + uint32_t bc = 0; + + if (!state->rt[i].blend_enable) + continue; + + bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB)); + bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB)); + bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB)); + + if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) { + bc |= S_028804_SEPARATE_ALPHA_BLEND(1); + bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA)); + bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA)); + bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA)); + } + + r600_pipe_state_add_reg(rstate, R_028780_CB_BLEND0_CONTROL + i * 4, bc, 0xFFFFFFFF, NULL); + if (i == 0) { + r600_pipe_state_add_reg(rstate, R_028804_CB_BLEND_CONTROL, bc, 0xFFFFFFFF, NULL); + } + } + return rstate; +} + +static void r600_bind_blend_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_blend *blend = (struct r600_pipe_blend *)state; + struct r600_pipe_state *rstate; + + if (state == NULL) + return; + rstate = &blend->rstate; + rctx->states[rstate->id] = rstate; + rctx->cb_target_mask = blend->cb_target_mask; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void *r600_create_dsa_state(struct pipe_context *ctx, + const struct pipe_depth_stencil_alpha_state *state) +{ + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; + unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control; + + if (rstate == NULL) { + return NULL; + } + + rstate->id = R600_PIPE_STATE_DSA; + /* depth TODO some of those db_shader_control field depend on shader adjust mask & add it to shader */ + /* db_shader_control is 0xFFFFFFBE as Z_EXPORT_ENABLE (bit 0) will be + * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will + * be set if shader use texkill instruction + */ + db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); + stencil_ref_mask = 0; + stencil_ref_mask_bf = 0; + db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | + S_028800_Z_WRITE_ENABLE(state->depth.writemask) | + S_028800_ZFUNC(state->depth.func); + + /* stencil */ + if (state->stencil[0].enabled) { + db_depth_control |= S_028800_STENCIL_ENABLE(1); + db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)); + db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)); + db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)); + db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); + + + stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) | + S_028430_STENCILWRITEMASK(state->stencil[0].writemask); + if (state->stencil[1].enabled) { + db_depth_control |= S_028800_BACKFACE_ENABLE(1); + db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)); + db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)); + db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)); + db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); + stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | + S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask); + } + } + + /* alpha */ + alpha_test_control = 0; + alpha_ref = 0; + if (state->alpha.enabled) { + alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func); + alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1); + alpha_ref = fui(state->alpha.ref_value); + } + + /* misc */ + db_render_control = 0; + db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | + S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | + S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); + /* TODO db_render_override depends on query */ + r600_pipe_state_add_reg(rstate, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028430_DB_STENCILREFMASK, stencil_ref_mask, + 0xFFFFFFFF & C_028430_STENCILREF, NULL); + r600_pipe_state_add_reg(rstate, + R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf, + 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL); + r600_pipe_state_add_reg(rstate, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286E0_SPI_FOG_FUNC_SCALE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286E4_SPI_FOG_FUNC_BIAS, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); + r600_pipe_state_add_reg(rstate, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D30_DB_PRELOAD_CONTROL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028D44_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); + + return rstate; +} + +static void *r600_create_rs_state(struct pipe_context *ctx, + const struct pipe_rasterizer_state *state) +{ + struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); + struct r600_pipe_state *rstate; + unsigned tmp; + unsigned prov_vtx = 1, polygon_dual_mode; + + if (rs == NULL) { + return NULL; + } + + rstate = &rs->rstate; + rs->flatshade = state->flatshade; + rs->sprite_coord_enable = state->sprite_coord_enable; + + /* offset */ + rs->offset_units = state->offset_units; + rs->offset_scale = state->offset_scale * 12.0f; + + rstate->id = R600_PIPE_STATE_RASTERIZER; + if (state->flatshade_first) + prov_vtx = 0; + tmp = 0x00000001; + if (state->sprite_coord_enable) { + tmp |= S_0286D4_PNT_SPRITE_ENA(1) | + S_0286D4_PNT_SPRITE_OVRD_X(2) | + S_0286D4_PNT_SPRITE_OVRD_Y(3) | + S_0286D4_PNT_SPRITE_OVRD_Z(0) | + S_0286D4_PNT_SPRITE_OVRD_W(1); + if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) { + tmp |= S_0286D4_PNT_SPRITE_TOP_1(1); + } + } + r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); + + polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || + state->fill_back != PIPE_POLYGON_MODE_FILL); + r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL, + S_028814_PROVOKING_VTX_LAST(prov_vtx) | + S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | + S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | + S_028814_FACE(!state->front_ccw) | + S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | + S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | + S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | + S_028814_POLY_MODE(polygon_dual_mode) | + S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | + S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL, + S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | + S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + /* point size 12.4 fixed point */ + tmp = (unsigned)(state->point_size * 8.0); + r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A0C_PA_SC_LINE_STIPPLE, 0x00000005, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MPASS_PS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL); + return rstate; +} + +static void r600_bind_rs_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + if (state == NULL) + return; + + rctx->flatshade = rs->flatshade; + rctx->sprite_coord_enable = rs->sprite_coord_enable; + rctx->rasterizer = rs; + + rctx->states[rs->rstate.id] = &rs->rstate; + r600_context_pipe_state_set(&rctx->ctx, &rs->rstate); +} + +static void r600_delete_rs_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; + + if (rctx->rasterizer == rs) { + rctx->rasterizer = NULL; + } + if (rctx->states[rs->rstate.id] == &rs->rstate) { + rctx->states[rs->rstate.id] = NULL; + } + free(rs); +} + +static void *r600_create_sampler_state(struct pipe_context *ctx, + const struct pipe_sampler_state *state) +{ + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + union util_color uc; + + if (rstate == NULL) { + return NULL; + } + + rstate->id = R600_PIPE_STATE_SAMPLER; + util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + r600_pipe_state_add_reg(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0, + S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | + S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | + S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | + S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) | + S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) | + S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) | + S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | + S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL); + /* FIXME LOD it depends on texture base level ... */ + r600_pipe_state_add_reg(rstate, R_03C004_SQ_TEX_SAMPLER_WORD1_0, + S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | + S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) | + S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL); + if (uc.ui) { + r600_pipe_state_add_reg(rstate, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); + } + return rstate; +} + +static void *r600_create_vertex_elements(struct pipe_context *ctx, + unsigned count, + const struct pipe_vertex_element *elements) +{ + struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); + + assert(count < 32); + v->count = count; + v->refcount = 1; + memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element)); + return v; +} + +static void r600_sampler_view_destroy(struct pipe_context *ctx, + struct pipe_sampler_view *state) +{ + struct r600_pipe_sampler_view *resource = (struct r600_pipe_sampler_view *)state; + + pipe_resource_reference(&state->texture, NULL); + FREE(resource); +} + +static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *ctx, + struct pipe_resource *texture, + const struct pipe_sampler_view *state) +{ + struct r600_pipe_sampler_view *resource = CALLOC_STRUCT(r600_pipe_sampler_view); + struct r600_pipe_state *rstate; + const struct util_format_description *desc; + struct r600_resource_texture *tmp; + struct r600_resource *rbuffer; + unsigned format; + uint32_t word4 = 0, yuv_format = 0, pitch = 0; + unsigned char swizzle[4], array_mode = 0, tile_type = 0; + struct radeon_ws_bo *bo[2]; + + if (resource == NULL) + return NULL; + rstate = &resource->state; + + /* initialize base object */ + resource->base = *state; + resource->base.texture = NULL; + pipe_reference(NULL, &texture->reference); + resource->base.texture = texture; + resource->base.reference.count = 1; + resource->base.context = ctx; + + swizzle[0] = state->swizzle_r; + swizzle[1] = state->swizzle_g; + swizzle[2] = state->swizzle_b; + swizzle[3] = state->swizzle_a; + format = r600_translate_texformat(texture->format, + swizzle, + &word4, &yuv_format); + if (format == ~0) { + format = 0; + } + desc = util_format_description(texture->format); + if (desc == NULL) { + R600_ERR("unknow format %d\n", texture->format); + } + tmp = (struct r600_resource_texture*)texture; + rbuffer = &tmp->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; + /* FIXME depth texture decompression */ + if (tmp->depth) { + r600_texture_depth_flush(ctx, texture); + tmp = (struct r600_resource_texture*)texture; + rbuffer = &tmp->flushed_depth_texture->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; + } + pitch = align(tmp->pitch[0] / tmp->bpt, 8); + + /* FIXME properly handle first level != 0 */ + r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, + S_038000_DIM(r600_tex_dim(texture->target)) | + S_038000_TILE_MODE(array_mode) | + S_038000_TILE_TYPE(tile_type) | + S_038000_PITCH((pitch / 8) - 1) | + S_038000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, + S_038004_TEX_HEIGHT(texture->height0 - 1) | + S_038004_TEX_DEPTH(texture->depth0 - 1) | + S_038004_DATA_FORMAT(format), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, + tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); + r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, + tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); + r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, + word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | + S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | + S_038010_REQUEST_SIZE(1) | + S_038010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, + S_038014_LAST_LEVEL(state->last_level) | + S_038014_BASE_ARRAY(0) | + S_038014_LAST_ARRAY(0), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, + S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL); + + return &resource->base; +} + +static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, + struct pipe_sampler_view **views) +{ + /* TODO */ + assert(1); +} + +static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, + struct pipe_sampler_view **views) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; + + for (int i = 0; i < count; i++) { + if (resource[i]) { + r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); + } + } +} + +static void r600_bind_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; + + if (state == NULL) + return; + rctx->states[rstate->id] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void r600_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void **states) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; + + for (int i = 0; i < count; i++) { + r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); + } +} + +static void r600_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void **states) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; + + /* TODO implement */ + for (int i = 0; i < count; i++) { + r600_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); + } +} + +static void r600_delete_state(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; + + if (rctx->states[rstate->id] == rstate) { + rctx->states[rstate->id] = NULL; + } + for (int i = 0; i < rstate->nregs; i++) { + radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); + } + free(rstate); +} + +static void r600_delete_vertex_element(struct pipe_context *ctx, void *state) +{ + struct r600_vertex_element *v = (struct r600_vertex_element*)state; + + if (v == NULL) + return; + if (--v->refcount) + return; + free(v); +} + +static void r600_set_clip_state(struct pipe_context *ctx, + const struct pipe_clip_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + + if (rstate == NULL) + return; + + rctx->clip = *state; + rstate->id = R600_PIPE_STATE_CLIP; + for (int i = 0; i < state->nr; i++) { + r600_pipe_state_add_reg(rstate, + R_028E20_PA_CL_UCP0_X + i * 4, + fui(state->ucp[i][0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028E24_PA_CL_UCP0_Y + i * 4, + fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028E28_PA_CL_UCP0_Z + i * 4, + fui(state->ucp[i][2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028E2C_PA_CL_UCP0_W + i * 4, + fui(state->ucp[i][3]), 0xFFFFFFFF, NULL); + } + r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, + S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) | + S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) | + S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_CLIP]); + rctx->states[R600_PIPE_STATE_CLIP] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_vertex_element *v = (struct r600_vertex_element*)state; + + r600_delete_vertex_element(ctx, rctx->vertex_elements); + rctx->vertex_elements = v; + if (v) { + v->refcount++; +// rctx->vs_rebuild = TRUE; + } +} + +static void r600_set_polygon_stipple(struct pipe_context *ctx, + const struct pipe_poly_stipple *state) +{ +} + +static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask) +{ +} + +static void r600_set_scissor_state(struct pipe_context *ctx, + const struct pipe_scissor_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + u32 tl, br; + + if (rstate == NULL) + return; + + rstate->id = R600_PIPE_STATE_SCISSOR; + tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1); + br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy); + r600_pipe_state_add_reg(rstate, + R_028030_PA_SC_SCREEN_SCISSOR_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028034_PA_SC_SCREEN_SCISSOR_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028204_PA_SC_WINDOW_SCISSOR_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028208_PA_SC_WINDOW_SCISSOR_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028210_PA_SC_CLIPRECT_0_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028214_PA_SC_CLIPRECT_0_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028218_PA_SC_CLIPRECT_1_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_02821C_PA_SC_CLIPRECT_1_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028220_PA_SC_CLIPRECT_2_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028224_PA_SC_CLIPRECT_2_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028228_PA_SC_CLIPRECT_3_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_02822C_PA_SC_CLIPRECT_3_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028200_PA_SC_WINDOW_OFFSET, 0x00000000, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, + 0xFFFFFFFF, NULL); + if (rctx->family >= CHIP_RV770) { + r600_pipe_state_add_reg(rstate, + R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, + 0xFFFFFFFF, NULL); + } + + free(rctx->states[R600_PIPE_STATE_SCISSOR]); + rctx->states[R600_PIPE_STATE_SCISSOR] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void r600_set_stencil_ref(struct pipe_context *ctx, + const struct pipe_stencil_ref *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + u32 tmp; + + if (rstate == NULL) + return; + + rctx->stencil_ref = *state; + rstate->id = R600_PIPE_STATE_STENCIL_REF; + tmp = S_028430_STENCILREF(state->ref_value[0]); + r600_pipe_state_add_reg(rstate, + R_028430_DB_STENCILREFMASK, tmp, + ~C_028430_STENCILREF, NULL); + tmp = S_028434_STENCILREF_BF(state->ref_value[1]); + r600_pipe_state_add_reg(rstate, + R_028434_DB_STENCILREFMASK_BF, tmp, + ~C_028434_STENCILREF_BF, NULL); + + free(rctx->states[R600_PIPE_STATE_STENCIL_REF]); + rctx->states[R600_PIPE_STATE_STENCIL_REF] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void r600_set_viewport_state(struct pipe_context *ctx, + const struct pipe_viewport_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + + if (rstate == NULL) + return; + + rctx->viewport = *state; + rstate->id = R600_PIPE_STATE_VIEWPORT; + r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_VIEWPORT]); + rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, + const struct pipe_framebuffer_state *state, int cb) +{ + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + unsigned level = state->cbufs[cb]->level; + unsigned pitch, slice; + unsigned color_info; + unsigned format, swap, ntype; + const struct util_format_description *desc; + struct radeon_ws_bo *bo[3]; + + rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; + rbuffer = &rtex->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; + bo[2] = rbuffer->bo; + + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; + ntype = 0; + desc = util_format_description(rtex->resource.base.b.format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) + ntype = V_0280A0_NUMBER_SRGB; + + format = r600_translate_colorformat(rtex->resource.base.b.format); + swap = r600_translate_colorswap(rtex->resource.base.b.format); + color_info = S_0280A0_FORMAT(format) | + S_0280A0_COMP_SWAP(swap) | + S_0280A0_BLEND_CLAMP(1) | + S_0280A0_NUMBER_TYPE(ntype); + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) + color_info |= S_0280A0_SOURCE_FORMAT(1); + + r600_pipe_state_add_reg(rstate, + R_028040_CB_COLOR0_BASE + cb * 4, + state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); + r600_pipe_state_add_reg(rstate, + R_0280A0_CB_COLOR0_INFO + cb * 4, + color_info, 0xFFFFFFFF, bo[0]); + r600_pipe_state_add_reg(rstate, + R_028060_CB_COLOR0_SIZE + cb * 4, + S_028060_PITCH_TILE_MAX(pitch) | + S_028060_SLICE_TILE_MAX(slice), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028080_CB_COLOR0_VIEW + cb * 4, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_0280E0_CB_COLOR0_FRAG + cb * 4, + 0x00000000, 0xFFFFFFFF, bo[1]); + r600_pipe_state_add_reg(rstate, + R_0280C0_CB_COLOR0_TILE + cb * 4, + 0x00000000, 0xFFFFFFFF, bo[2]); + r600_pipe_state_add_reg(rstate, + R_028100_CB_COLOR0_MASK + cb * 4, + 0x00000000, 0xFFFFFFFF, NULL); +} + +static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, + const struct pipe_framebuffer_state *state) +{ + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + unsigned level; + unsigned pitch, slice, format; + + if (state->zsbuf == NULL) + return; + + rtex = (struct r600_resource_texture*)state->zsbuf->texture; + rtex->tiled = 1; + rtex->array_mode = 2; + rtex->tile_type = 1; + rtex->depth = 1; + rbuffer = &rtex->resource; + + level = state->zsbuf->level; + pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; + format = r600_translate_dbformat(state->zsbuf->texture->format); + + r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE, + state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_028000_DB_DEPTH_SIZE, + S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028010_DB_DEPTH_INFO, + S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format), + 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_028D34_DB_PREFETCH_LIMIT, + (state->zsbuf->height / 8) - 1, 0xFFFFFFFF, NULL); +} + +static void r600_set_framebuffer_state(struct pipe_context *ctx, + const struct pipe_framebuffer_state *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); + u32 shader_mask, tl, br, shader_control, target_mask; + + if (rstate == NULL) + return; + + /* unreference old buffer and reference new one */ + rstate->id = R600_PIPE_STATE_FRAMEBUFFER; + for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { + pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL); + } + for (int i = 0; i < state->nr_cbufs; i++) { + pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]); + } + pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf); + rctx->framebuffer = *state; + rctx->pframebuffer = &rctx->framebuffer; + + /* build states */ + for (int i = 0; i < state->nr_cbufs; i++) { + r600_cb(rctx, rstate, state, i); + } + if (state->zsbuf) { + r600_db(rctx, rstate, state); + } + + target_mask = 0x00000000; + target_mask = 0xFFFFFFFF; + shader_mask = 0; + shader_control = 0; + for (int i = 0; i < state->nr_cbufs; i++) { + target_mask ^= 0xf << (i * 4); + shader_mask |= 0xf << (i * 4); + shader_control |= 1 << i; + } + tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1); + br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height); + + r600_pipe_state_add_reg(rstate, + R_028240_PA_SC_GENERIC_SCISSOR_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028244_PA_SC_GENERIC_SCISSOR_BR, br, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, + R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, + 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_0287A0_CB_SHADER_CONTROL, + shader_control, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK, + 0x00000000, target_mask, NULL); + r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK, + shader_mask, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C04_PA_SC_AA_CONFIG, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C30_CB_CLRCMP_CONTROL, + 0x01000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C34_CB_CLRCMP_SRC, + 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C38_CB_CLRCMP_DST, + 0x000000FF, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C3C_CB_CLRCMP_MSK, + 0xFFFFFFFF, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028C48_PA_SC_AA_MASK, + 0xFFFFFFFF, 0xFFFFFFFF, NULL); + + free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); + rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate; + r600_context_pipe_state_set(&rctx->ctx, rstate); +} + +static void r600_set_index_buffer(struct pipe_context *ctx, + const struct pipe_index_buffer *ib) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + if (ib) { + pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer); + memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer)); + } else { + pipe_resource_reference(&rctx->index_buffer.buffer, NULL); + memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer)); + } + + /* TODO make this more like a state */ +} + +static void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, + const struct pipe_vertex_buffer *buffers) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + for (int i = 0; i < rctx->nvertex_buffer; i++) { + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + } + memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); + for (int i = 0; i < count; i++) { + rctx->vertex_buffer[i].buffer = NULL; + if (r600_buffer_is_user_buffer(buffers[i].buffer)) + rctx->any_user_vbs = TRUE; + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); + } + rctx->nvertex_buffer = count; +} + +static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, + struct pipe_resource *buffer) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_state *rstate; + struct pipe_transfer *transfer; + unsigned *nconst = NULL; + u32 *ptr, offset; + + switch (shader) { + case PIPE_SHADER_VERTEX: + rstate = rctx->vs_const; + nconst = &rctx->vs_nconst; + offset = R_030000_SQ_ALU_CONSTANT0_0 + 0x1000; + break; + case PIPE_SHADER_FRAGMENT: + rstate = rctx->ps_const; + nconst = &rctx->ps_nconst; + offset = R_030000_SQ_ALU_CONSTANT0_0; + break; + default: + R600_ERR("unsupported %d\n", shader); + return; + } + if (buffer && buffer->width0 > 0) { + *nconst = buffer->width0 / 16; + ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer); + if (ptr == NULL) + return; + for (int i = 0; i < *nconst; i++, offset += 0x10) { + rstate[i].nregs = 0; + r600_pipe_state_add_reg(&rstate[i], offset + 0x0, ptr[i * 4 + 0], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0x4, ptr[i * 4 + 1], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0x8, ptr[i * 4 + 2], 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rstate[i], offset + 0xC, ptr[i * 4 + 3], 0xFFFFFFFF, NULL); + r600_context_pipe_state_set(&rctx->ctx, &rstate[i]); + } + pipe_buffer_unmap(ctx, buffer, transfer); + } +} + +static void *r600_create_shader_state(struct pipe_context *ctx, + const struct pipe_shader_state *state) +{ + struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); + int r; + + r = r600_pipe_shader_create2(ctx, shader, state->tokens); + if (r) { + return NULL; + } + return shader; +} + +static void r600_bind_ps_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + /* TODO delete old shader */ + rctx->ps_shader = (struct r600_pipe_shader *)state; +} + +static void r600_bind_vs_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + /* TODO delete old shader */ + rctx->vs_shader = (struct r600_pipe_shader *)state; +} + +static void r600_delete_ps_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; + + if (rctx->ps_shader == shader) { + rctx->ps_shader = NULL; + } + /* TODO proper delete */ + free(shader); +} + +static void r600_delete_vs_shader(struct pipe_context *ctx, void *state) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; + + if (rctx->vs_shader == shader) { + rctx->vs_shader = NULL; + } + /* TODO proper delete */ + free(shader); +} + +void r600_init_state_functions2(struct r600_pipe_context *rctx) +{ + rctx->context.create_blend_state = r600_create_blend_state; + rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state; + rctx->context.create_fs_state = r600_create_shader_state; + rctx->context.create_rasterizer_state = r600_create_rs_state; + rctx->context.create_sampler_state = r600_create_sampler_state; + rctx->context.create_sampler_view = r600_create_sampler_view; + rctx->context.create_vertex_elements_state = r600_create_vertex_elements; + rctx->context.create_vs_state = r600_create_shader_state; + rctx->context.bind_blend_state = r600_bind_blend_state; + rctx->context.bind_depth_stencil_alpha_state = r600_bind_state; + rctx->context.bind_fragment_sampler_states = r600_bind_ps_sampler; + rctx->context.bind_fs_state = r600_bind_ps_shader; + rctx->context.bind_rasterizer_state = r600_bind_rs_state; + rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements; + rctx->context.bind_vertex_sampler_states = r600_bind_vs_sampler; + rctx->context.bind_vs_state = r600_bind_vs_shader; + rctx->context.delete_blend_state = r600_delete_state; + rctx->context.delete_depth_stencil_alpha_state = r600_delete_state; + rctx->context.delete_fs_state = r600_delete_ps_shader; + rctx->context.delete_rasterizer_state = r600_delete_rs_state; + rctx->context.delete_sampler_state = r600_delete_state; + rctx->context.delete_vertex_elements_state = r600_delete_vertex_element; + rctx->context.delete_vs_state = r600_delete_vs_shader; + rctx->context.set_blend_color = r600_set_blend_color; + rctx->context.set_clip_state = r600_set_clip_state; + rctx->context.set_constant_buffer = r600_set_constant_buffer; + rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_view; + rctx->context.set_framebuffer_state = r600_set_framebuffer_state; + rctx->context.set_polygon_stipple = r600_set_polygon_stipple; + rctx->context.set_sample_mask = r600_set_sample_mask; + rctx->context.set_scissor_state = r600_set_scissor_state; + rctx->context.set_stencil_ref = r600_set_stencil_ref; + rctx->context.set_vertex_buffers = r600_set_vertex_buffers; + rctx->context.set_index_buffer = r600_set_index_buffer; + rctx->context.set_vertex_sampler_views = r600_set_vs_sampler_view; + rctx->context.set_viewport_state = r600_set_viewport_state; + rctx->context.sampler_view_destroy = r600_sampler_view_destroy; +} + +void r600_init_config2(struct r600_pipe_context *rctx) +{ + int ps_prio; + int vs_prio; + int gs_prio; + int es_prio; + int num_ps_gprs; + int num_vs_gprs; + int num_gs_gprs; + int num_es_gprs; + int num_temp_gprs; + int num_ps_threads; + int num_vs_threads; + int num_gs_threads; + int num_es_threads; + int num_ps_stack_entries; + int num_vs_stack_entries; + int num_gs_stack_entries; + int num_es_stack_entries; + enum radeon_family family; + struct r600_pipe_state *rstate = &rctx->config; + u32 tmp; + + family = r600_get_family(rctx->radeon); + ps_prio = 0; + vs_prio = 1; + gs_prio = 2; + es_prio = 3; + switch (family) { + case CHIP_R600: + num_ps_gprs = 192; + num_vs_gprs = 56; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 136; + num_vs_threads = 48; + num_gs_threads = 4; + num_es_threads = 4; + num_ps_stack_entries = 128; + num_vs_stack_entries = 128; + num_gs_stack_entries = 0; + num_es_stack_entries = 0; + break; + case CHIP_RV630: + case CHIP_RV635: + num_ps_gprs = 84; + num_vs_gprs = 36; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 144; + num_vs_threads = 40; + num_gs_threads = 4; + num_es_threads = 4; + num_ps_stack_entries = 40; + num_vs_stack_entries = 40; + num_gs_stack_entries = 32; + num_es_stack_entries = 16; + break; + case CHIP_RV610: + case CHIP_RV620: + case CHIP_RS780: + case CHIP_RS880: + default: + num_ps_gprs = 84; + num_vs_gprs = 36; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 136; + num_vs_threads = 48; + num_gs_threads = 4; + num_es_threads = 4; + num_ps_stack_entries = 40; + num_vs_stack_entries = 40; + num_gs_stack_entries = 32; + num_es_stack_entries = 16; + break; + case CHIP_RV670: + num_ps_gprs = 144; + num_vs_gprs = 40; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 136; + num_vs_threads = 48; + num_gs_threads = 4; + num_es_threads = 4; + num_ps_stack_entries = 40; + num_vs_stack_entries = 40; + num_gs_stack_entries = 32; + num_es_stack_entries = 16; + break; + case CHIP_RV770: + num_ps_gprs = 192; + num_vs_gprs = 56; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 188; + num_vs_threads = 60; + num_gs_threads = 0; + num_es_threads = 0; + num_ps_stack_entries = 256; + num_vs_stack_entries = 256; + num_gs_stack_entries = 0; + num_es_stack_entries = 0; + break; + case CHIP_RV730: + case CHIP_RV740: + num_ps_gprs = 84; + num_vs_gprs = 36; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 188; + num_vs_threads = 60; + num_gs_threads = 0; + num_es_threads = 0; + num_ps_stack_entries = 128; + num_vs_stack_entries = 128; + num_gs_stack_entries = 0; + num_es_stack_entries = 0; + break; + case CHIP_RV710: + num_ps_gprs = 192; + num_vs_gprs = 56; + num_temp_gprs = 4; + num_gs_gprs = 0; + num_es_gprs = 0; + num_ps_threads = 144; + num_vs_threads = 48; + num_gs_threads = 0; + num_es_threads = 0; + num_ps_stack_entries = 128; + num_vs_stack_entries = 128; + num_gs_stack_entries = 0; + num_es_stack_entries = 0; + break; + } + + rstate->id = R600_PIPE_STATE_CONFIG; + + /* SQ_CONFIG */ + tmp = 0; + switch (family) { + case CHIP_RV610: + case CHIP_RV620: + case CHIP_RS780: + case CHIP_RS880: + case CHIP_RV710: + break; + default: + tmp |= S_008C00_VC_ENABLE(1); + break; + } + tmp |= S_008C00_DX9_CONSTS(1); + tmp |= S_008C00_ALU_INST_PREFER_VECTOR(1); + tmp |= S_008C00_PS_PRIO(ps_prio); + tmp |= S_008C00_VS_PRIO(vs_prio); + tmp |= S_008C00_GS_PRIO(gs_prio); + tmp |= S_008C00_ES_PRIO(es_prio); + r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); + + /* SQ_GPR_RESOURCE_MGMT_1 */ + tmp = 0; + tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); + tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); + tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); + r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + + /* SQ_GPR_RESOURCE_MGMT_2 */ + tmp = 0; + tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); + tmp |= S_008C08_NUM_GS_GPRS(num_es_gprs); + r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + + /* SQ_THREAD_RESOURCE_MGMT */ + tmp = 0; + tmp |= S_008C0C_NUM_PS_THREADS(num_ps_threads); + tmp |= S_008C0C_NUM_VS_THREADS(num_vs_threads); + tmp |= S_008C0C_NUM_GS_THREADS(num_gs_threads); + tmp |= S_008C0C_NUM_ES_THREADS(num_es_threads); + r600_pipe_state_add_reg(rstate, R_008C0C_SQ_THREAD_RESOURCE_MGMT, tmp, 0xFFFFFFFF, NULL); + + /* SQ_STACK_RESOURCE_MGMT_1 */ + tmp = 0; + tmp |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); + tmp |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); + r600_pipe_state_add_reg(rstate, R_008C10_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + + /* SQ_STACK_RESOURCE_MGMT_2 */ + tmp = 0; + tmp |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); + tmp |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); + r600_pipe_state_add_reg(rstate, R_008C14_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_009714_VC_ENHANCE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028350_SX_MISC, 0x00000000, 0xFFFFFFFF, NULL); + + if (family >= CHIP_RV770) { + r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00004000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000002, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x00420204, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00514000, 0xFFFFFFFF, NULL); + } else { + r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000003, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x82000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x01020204, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000001, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00004010, 0xFFFFFFFF, NULL); + } + r600_pipe_state_add_reg(rstate, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A14_VGT_HOS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A20_VGT_HOS_REUSE_DEPTH, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A24_VGT_GROUP_PRIM_TYPE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A28_VGT_GROUP_FIRST_DECR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A2C_VGT_GROUP_DECR, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A40_VGT_GS_MODE, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB0_VGT_STRMOUT_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL); + + r600_pipe_state_add_reg(rstate, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL); + r600_context_pipe_state_set(&rctx->ctx, rstate); +} diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c deleted file mode 100644 index 38cd9acf450..00000000000 --- a/src/gallium/drivers/r600/r600_state2.c +++ /dev/null @@ -1,2507 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - */ - -/* TODO: - * - fix mask for depth control & cull for query - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "r600.h" -#include "r600d.h" -#include "r700_sq.h" -struct radeon_state { - unsigned dummy; -}; -#include "r600_resource.h" -#include "r600_shader.h" -#include "r600_pipe.h" -#include "r600_state_inlines.h" - -/* r600_shader.c */ -static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) -{ - struct r600_pipe_state *rstate = &shader->rstate; - struct r600_shader *rshader = &shader->shader; - unsigned spi_vs_out_id[10]; - unsigned i, tmp; - - /* clear previous register */ - rstate->nregs = 0; - - /* so far never got proper semantic id from tgsi */ - for (i = 0; i < 10; i++) { - spi_vs_out_id[i] = 0; - } - for (i = 0; i < 32; i++) { - tmp = i << ((i & 3) * 8); - spi_vs_out_id[i / 4] |= tmp; - } - for (i = 0; i < 10; i++) { - r600_pipe_state_add_reg(rstate, - R_028614_SPI_VS_OUT_ID_0 + i * 4, - spi_vs_out_id[i], 0xFFFFFFFF, NULL); - } - - r600_pipe_state_add_reg(rstate, - R_0286C4_SPI_VS_OUT_CONFIG, - S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028868_SQ_PGM_RESOURCES_VS, - S_028868_NUM_GPRS(rshader->bc.ngpr) | - S_028868_STACK_SIZE(rshader->bc.nstack), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_0288A4_SQ_PGM_RESOURCES_FS, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_0288D0_SQ_PGM_CF_OFFSET_VS, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_0288DC_SQ_PGM_CF_OFFSET_FS, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028858_SQ_PGM_START_VS, - 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, - R_028894_SQ_PGM_START_FS, - 0x00000000, 0xFFFFFFFF, shader->bo); -} - -int r600_find_vs_semantic_index2(struct r600_shader *vs, - struct r600_shader *ps, int id) -{ - struct r600_shader_io *input = &ps->input[id]; - - for (int i = 0; i < vs->noutput; i++) { - if (input->name == vs->output[i].name && - input->sid == vs->output[i].sid) { - return i - 1; - } - } - return 0; -} - -static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = &shader->rstate; - struct r600_shader *rshader = &shader->shader; - unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z; - boolean have_pos = FALSE, have_face = FALSE; - - /* clear previous register */ - rstate->nregs = 0; - - for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); - tmp |= S_028644_SEL_CENTROID(1); - if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) - have_pos = TRUE; - if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || - rshader->input[i].name == TGSI_SEMANTIC_BCOLOR || - rshader->input[i].name == TGSI_SEMANTIC_POSITION) { - tmp |= S_028644_FLAT_SHADE(rshader->flat_shade); - } - if (rshader->input[i].name == TGSI_SEMANTIC_FACE) - have_face = TRUE; - if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && - rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) { - tmp |= S_028644_PT_SPRITE_TEX(1); - } - r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); - } - for (i = 0; i < rshader->noutput; i++) { - r600_pipe_state_add_reg(rstate, - R_02880C_DB_SHADER_CONTROL, - S_02880C_Z_EXPORT_ENABLE(1), - S_02880C_Z_EXPORT_ENABLE(1), NULL); - } - - exports_ps = 0; - num_cout = 0; - for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) - exports_ps |= 1; - else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { - num_cout++; - } - } - exports_ps |= S_028854_EXPORT_COLORS(num_cout); - if (!exports_ps) { - /* always at least export 1 component per pixel */ - exports_ps = 2; - } - - spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) | - S_0286CC_PERSP_GRADIENT_ENA(1); - spi_input_z = 0; - if (have_pos) { - spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1) | - S_0286CC_BARYC_SAMPLE_CNTL(1); - spi_input_z |= 1; - } - r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028840_SQ_PGM_START_PS, - 0x00000000, 0xFFFFFFFF, shader->bo); - r600_pipe_state_add_reg(rstate, - R_028850_SQ_PGM_RESOURCES_PS, - S_028868_NUM_GPRS(rshader->bc.ngpr) | - S_028868_STACK_SIZE(rshader->bc.nstack), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028854_SQ_PGM_EXPORTS_PS, - exports_ps, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_0288CC_SQ_PGM_CF_OFFSET_PS, - 0x00000000, 0xFFFFFFFF, NULL); - - if (rshader->uses_kill) { - /* only set some bits here, the other bits are set in the dsa state */ - r600_pipe_state_add_reg(rstate, - R_02880C_DB_SHADER_CONTROL, - S_02880C_KILL_ENABLE(1), - S_02880C_KILL_ENABLE(1), NULL); - } -} - -static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_shader *rshader = &shader->shader; - void *ptr; - - /* copy new shader */ - if (shader->bo == NULL) { - shader->bo = radeon_ws_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0); - if (shader->bo == NULL) { - return -ENOMEM; - } - ptr = radeon_ws_bo_map(rctx->radeon, shader->bo, 0, NULL); - memcpy(ptr, rshader->bc.bytecode, rshader->bc.ndw * 4); - radeon_ws_bo_unmap(rctx->radeon, shader->bo); - } - /* build state */ - rshader->flat_shade = rctx->flatshade; - switch (rshader->processor_type) { - case TGSI_PROCESSOR_VERTEX: - if (rshader->family >= CHIP_CEDAR) { - evergreen_pipe_shader_vs(ctx, shader); - } else { - r600_pipe_shader_vs(ctx, shader); - } - break; - case TGSI_PROCESSOR_FRAGMENT: - if (rshader->family >= CHIP_CEDAR) { - evergreen_pipe_shader_ps(ctx, shader); - } else { - r600_pipe_shader_ps(ctx, shader); - } - break; - default: - return -EINVAL; - } - r600_context_pipe_state_set(&rctx->ctx, &shader->rstate); - return 0; -} - -static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *rshader) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_shader *shader = &rshader->shader; - const struct util_format_description *desc; - enum pipe_format resource_format[160]; - unsigned i, nresources = 0; - struct r600_bc *bc = &shader->bc; - struct r600_bc_cf *cf; - struct r600_bc_vtx *vtx; - - if (shader->processor_type != TGSI_PROCESSOR_VERTEX) - return 0; - if (!memcmp(&rshader->vertex_elements, rctx->vertex_elements, sizeof(struct r600_vertex_element))) { - return 0; - } - rshader->vertex_elements = *rctx->vertex_elements; - for (i = 0; i < rctx->vertex_elements->count; i++) { - resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format; - } - radeon_ws_bo_reference(rctx->radeon, &rshader->bo, NULL); - LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) { - switch (cf->inst) { - case V_SQ_CF_WORD1_SQ_CF_INST_VTX: - case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC: - LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) { - desc = util_format_description(resource_format[vtx->buffer_id]); - if (desc == NULL) { - R600_ERR("unknown format %d\n", resource_format[vtx->buffer_id]); - return -EINVAL; - } - vtx->dst_sel_x = desc->swizzle[0]; - vtx->dst_sel_y = desc->swizzle[1]; - vtx->dst_sel_z = desc->swizzle[2]; - vtx->dst_sel_w = desc->swizzle[3]; - } - break; - default: - break; - } - } - return r600_bc_build(&shader->bc); -} - -int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - int r; - - if (shader == NULL) - return -EINVAL; - /* there should be enough input */ - if (rctx->vertex_elements->count < shader->shader.bc.nresource) { - R600_ERR("%d resources provided, expecting %d\n", - rctx->vertex_elements->count, shader->shader.bc.nresource); - return -EINVAL; - } - r = r600_shader_update(ctx, shader); - if (r) - return r; - return r600_pipe_shader(ctx, shader); -} - -int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader); -int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - int r; - -//fprintf(stderr, "--------------------------------------------------------------\n"); -//tgsi_dump(tokens, 0); - shader->shader.family = r600_get_family(rctx->radeon); - r = r600_shader_from_tgsi(tokens, &shader->shader); - if (r) { - R600_ERR("translation from TGSI failed !\n"); - return r; - } - r = r600_bc_build(&shader->shader.bc); - if (r) { - R600_ERR("building bytecode failed !\n"); - return r; - } -//fprintf(stderr, "______________________________________________________________\n"); - return 0; -} -/* r600_shader.c END */ - -static const char* r600_get_vendor(struct pipe_screen* pscreen) -{ - return "X.Org"; -} - -static const char* r600_get_name(struct pipe_screen* pscreen) -{ - struct r600_screen *rscreen = (struct r600_screen *)pscreen; - enum radeon_family family = r600_get_family(rscreen->radeon); - - if (family >= CHIP_R600 && family < CHIP_RV770) - return "R600 (HD2XXX,HD3XXX)"; - else if (family < CHIP_CEDAR) - return "R700 (HD4XXX)"; - else - return "EVERGREEN"; -} - -static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) -{ - switch (param) { - /* Supported features (boolean caps). */ - case PIPE_CAP_NPOT_TEXTURES: - case PIPE_CAP_TWO_SIDED_STENCIL: - case PIPE_CAP_GLSL: - case PIPE_CAP_DUAL_SOURCE_BLEND: - case PIPE_CAP_ANISOTROPIC_FILTER: - case PIPE_CAP_POINT_SPRITE: - case PIPE_CAP_OCCLUSION_QUERY: - case PIPE_CAP_TEXTURE_SHADOW_MAP: - case PIPE_CAP_TEXTURE_MIRROR_CLAMP: - case PIPE_CAP_TEXTURE_MIRROR_REPEAT: - case PIPE_CAP_BLEND_EQUATION_SEPARATE: - case PIPE_CAP_SM3: - case PIPE_CAP_TEXTURE_SWIZZLE: - case PIPE_CAP_INDEP_BLEND_ENABLE: - case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: - case PIPE_CAP_DEPTH_CLAMP: - return 1; - - /* Unsupported features (boolean caps). */ - case PIPE_CAP_TIMER_QUERY: - case PIPE_CAP_STREAM_OUTPUT: - case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */ - return 0; - - /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 14; - case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - /* FIXME allow this once infrastructure is there */ - return 0; - case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: - case PIPE_CAP_MAX_COMBINED_SAMPLERS: - return 16; - - /* Render targets. */ - case PIPE_CAP_MAX_RENDER_TARGETS: - /* FIXME some r6xx are buggy and can only do 4 */ - return 8; - - /* Fragment coordinate conventions. */ - case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: - case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: - return 1; - case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: - case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: - return 0; - - default: - R600_ERR("r600: unknown param %d\n", param); - return 0; - } -} - -static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param) -{ - switch (param) { - case PIPE_CAP_MAX_LINE_WIDTH: - case PIPE_CAP_MAX_LINE_WIDTH_AA: - case PIPE_CAP_MAX_POINT_WIDTH: - case PIPE_CAP_MAX_POINT_WIDTH_AA: - return 8192.0f; - case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: - return 16.0f; - case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: - return 16.0f; - default: - R600_ERR("r600: unsupported paramf %d\n", param); - return 0.0f; - } -} - -static boolean r600_is_format_supported(struct pipe_screen* screen, - enum pipe_format format, - enum pipe_texture_target target, - unsigned sample_count, - unsigned usage, - unsigned geom_flags) -{ - unsigned retval = 0; - if (target >= PIPE_MAX_TEXTURE_TYPES) { - R600_ERR("r600: unsupported texture type %d\n", target); - return FALSE; - } - - /* Multisample */ - if (sample_count > 1) - return FALSE; - - if ((usage & PIPE_BIND_SAMPLER_VIEW) && - r600_is_sampler_format_supported(format)) { - retval |= PIPE_BIND_SAMPLER_VIEW; - } - - if ((usage & (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT | - PIPE_BIND_SHARED)) && - r600_is_colorbuffer_format_supported(format)) { - retval |= usage & - (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_SCANOUT | - PIPE_BIND_SHARED); - } - - if ((usage & PIPE_BIND_DEPTH_STENCIL) && - r600_is_zs_format_supported(format)) { - retval |= PIPE_BIND_DEPTH_STENCIL; - } - - if ((usage & PIPE_BIND_VERTEX_BUFFER) && - r600_is_vertex_format_supported(format)) - retval |= PIPE_BIND_VERTEX_BUFFER; - - if (usage & PIPE_BIND_TRANSFER_READ) - retval |= PIPE_BIND_TRANSFER_READ; - if (usage & PIPE_BIND_TRANSFER_WRITE) - retval |= PIPE_BIND_TRANSFER_WRITE; - - return retval == usage; -} - -static void r600_destroy_screen(struct pipe_screen* pscreen) -{ - struct r600_screen *rscreen = (struct r600_screen *)pscreen; - - if (rscreen == NULL) - return; - FREE(rscreen); -} - -int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); -static void r600_draw_common(struct r600_drawl *draw) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)draw->ctx; - struct r600_pipe_state *rstate; - struct r600_resource *rbuffer; - unsigned i, j, offset, format, prim; - u32 vgt_dma_index_type, vgt_draw_initiator, mask; - struct pipe_vertex_buffer *vertex_buffer; - struct r600_draw rdraw; - struct r600_pipe_state vgt; - - switch (draw->index_size) { - case 2: - vgt_draw_initiator = 0; - vgt_dma_index_type = 0; - break; - case 4: - vgt_draw_initiator = 0; - vgt_dma_index_type = 1; - break; - case 0: - vgt_draw_initiator = 2; - vgt_dma_index_type = 0; - break; - default: - R600_ERR("unsupported index size %d\n", draw->index_size); - return; - } - if (r600_conv_pipe_prim(draw->mode, &prim)) - return; - - - /* rebuild vertex shader if input format changed */ - if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader)) - return; - if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader)) - return; - - for (i = 0 ; i < rctx->vertex_elements->count; i++) { - unsigned num_format = 0, format_comp = 0; - - rstate = &rctx->vs_resource[i]; - j = rctx->vertex_elements->elements[i].vertex_buffer_index; - vertex_buffer = &rctx->vertex_buffer[j]; - rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - rstate->id = R600_PIPE_STATE_RESOURCE; - rstate->nregs = 0; - - r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); - r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_038008_RESOURCE0_WORD2, - S_038008_STRIDE(vertex_buffer->stride) | - S_038008_DATA_FORMAT(format) | - S_038008_NUM_FORMAT_ALL(num_format) | - S_038008_FORMAT_COMP_ALL(format_comp), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL); - r600_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, i); - } - - mask = 0; - for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { - mask |= (0xF << (i * 4)); - } - - vgt.id = R600_PIPE_STATE_VGT; - vgt.nregs = 0; - r600_pipe_state_add_reg(&vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); - /* build late state */ - if (rctx->rasterizer && rctx->framebuffer.zsbuf) { - float offset_units = rctx->rasterizer->offset_units; - unsigned offset_db_fmt_cntl = 0, depth; - - switch (rctx->framebuffer.zsbuf->texture->format) { - case PIPE_FORMAT_Z24X8_UNORM: - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - depth = -24; - offset_units *= 2.0f; - break; - case PIPE_FORMAT_Z32_FLOAT: - depth = -23; - offset_units *= 1.0f; - offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1); - break; - case PIPE_FORMAT_Z16_UNORM: - depth = -16; - offset_units *= 4.0f; - break; - default: - return; - } - offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth); - r600_pipe_state_add_reg(&vgt, - R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, - fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, - R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, - fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, - R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, - fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, - R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, - fui(offset_units), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&vgt, - R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, - offset_db_fmt_cntl, 0xFFFFFFFF, NULL); - } - r600_context_pipe_state_set(&rctx->ctx, &vgt); - - rdraw.vgt_num_indices = draw->count; - rdraw.vgt_num_instances = 1; - rdraw.vgt_index_type = vgt_dma_index_type; - rdraw.vgt_draw_initiator = vgt_draw_initiator; - rdraw.indices = NULL; - if (draw->index_buffer) { - rbuffer = (struct r600_resource*)draw->index_buffer; - rdraw.indices = rbuffer->bo; - rdraw.indices_bo_offset = draw->index_buffer_offset; - } - r600_context_draw(&rctx->ctx, &rdraw); -} - -void r600_translate_index_buffer2(struct r600_pipe_context *r600, - struct pipe_resource **index_buffer, - unsigned *index_size, - unsigned *start, unsigned count) -{ - switch (*index_size) { - case 1: - util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count); - *index_size = 2; - *start = 0; - break; - - case 2: - if (*start % 2 != 0) { - util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count); - *start = 0; - } - break; - - case 4: - break; - } -} - -static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_drawl draw; - - if (rctx->any_user_vbs) { - r600_upload_user_buffers2(rctx); - rctx->any_user_vbs = FALSE; - } - - memset(&draw, 0, sizeof(struct r600_drawl)); - draw.ctx = ctx; - draw.mode = info->mode; - draw.start = info->start; - draw.count = info->count; - if (info->indexed && rctx->index_buffer.buffer) { - draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; - draw.min_index = info->min_index; - draw.max_index = info->max_index; - draw.index_bias = info->index_bias; - - r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer, - &rctx->index_buffer.index_size, - &draw.start, - info->count); - - draw.index_size = rctx->index_buffer.index_size; - pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer); - draw.index_buffer_offset = draw.start * draw.index_size; - draw.start = 0; - r600_upload_index_buffer2(rctx, &draw); - } else { - draw.index_size = 0; - draw.index_buffer = NULL; - draw.min_index = info->min_index; - draw.max_index = info->max_index; - draw.index_bias = info->start; - } - r600_draw_common(&draw); - - pipe_resource_reference(&draw.index_buffer, NULL); -} - -static void r600_flush2(struct pipe_context *ctx, unsigned flags, - struct pipe_fence_handle **fence) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; -#if 0 - static int dc = 0; - char dname[256]; -#endif - - if (!rctx->ctx.pm4_cdwords) - return; - - u_upload_flush(rctx->upload_vb); - u_upload_flush(rctx->upload_ib); - -#if 0 - sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 20) { - r600_context_dump_bof(&rctx->ctx, dname); - R600_ERR("dumped %s\n", dname); - } - dc++; -#endif - r600_context_flush(&rctx->ctx); -} - -static void r600_destroy_context(struct pipe_context *context) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)context; - - r600_context_fini(&rctx->ctx); - for (int i = 0; i < R600_PIPE_NSTATES; i++) { - free(rctx->states[i]); - } - - u_upload_destroy(rctx->upload_vb); - u_upload_destroy(rctx->upload_ib); - - FREE(rctx); -} - -static void r600_blitter_save_states(struct pipe_context *ctx) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]); - util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]); - if (rctx->states[R600_PIPE_STATE_STENCIL_REF]) { - util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref); - } - util_blitter_save_rasterizer(rctx->blitter, rctx->states[R600_PIPE_STATE_RASTERIZER]); - util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader); - util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader); - util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements); - if (rctx->states[R600_PIPE_STATE_VIEWPORT]) { - util_blitter_save_viewport(rctx->blitter, &rctx->viewport); - } - if (rctx->states[R600_PIPE_STATE_CLIP]) { - util_blitter_save_clip(rctx->blitter, &rctx->clip); - } - util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer); - - rctx->vertex_elements = NULL; - - /* TODO queries */ -} - -int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state fb = *rctx->pframebuffer; - struct pipe_surface *zsurf, *cbsurf; - int level = 0; - float depth = 1.0f; - - r600_context_queries_suspend(&rctx->ctx); - for (int i = 0; i < fb.nr_cbufs; i++) { - fb.cbufs[i] = NULL; - pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]); - } - fb.zsbuf = NULL; - pipe_surface_reference(&fb.zsbuf, rctx->pframebuffer->zsbuf); - - zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, - PIPE_BIND_DEPTH_STENCIL); - - cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0, - PIPE_BIND_RENDER_TARGET); - - r600_blitter_save_states(ctx); - util_blitter_save_framebuffer(rctx->blitter, &fb); - - if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || - rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) - depth = 0.0f; - - util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); - - pipe_surface_reference(&zsurf, NULL); - pipe_surface_reference(&cbsurf, NULL); - for (int i = 0; i < fb.nr_cbufs; i++) { - pipe_surface_reference(&fb.cbufs[i], NULL); - } - pipe_surface_reference(&fb.zsbuf, NULL); - r600_context_queries_resume(&rctx->ctx); - - return 0; -} - -static void r600_clear(struct pipe_context *ctx, unsigned buffers, - const float *rgba, double depth, unsigned stencil) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer; - - r600_context_queries_suspend(&rctx->ctx); - r600_blitter_save_states(ctx); - util_blitter_clear(rctx->blitter, fb->width, fb->height, - fb->nr_cbufs, buffers, rgba, depth, - stencil); - r600_context_queries_resume(&rctx->ctx); -} - -static void r600_clear_render_target(struct pipe_context *ctx, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer; - - r600_context_queries_suspend(&rctx->ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - util_blitter_clear_render_target(rctx->blitter, dst, rgba, - dstx, dsty, width, height); - r600_context_queries_resume(&rctx->ctx); -} - -static void r600_clear_depth_stencil(struct pipe_context *ctx, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer; - - r600_context_queries_suspend(&rctx->ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, - dstx, dsty, width, height); - r600_context_queries_resume(&rctx->ctx); -} - - -static void r600_resource_copy_region(struct pipe_context *ctx, - struct pipe_resource *dst, - struct pipe_subresource subdst, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - struct pipe_subresource subsrc, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height) -{ - util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, - src, subsrc, srcx, srcy, srcz, width, height); -} - -static void r600_init_blit_functions2(struct r600_pipe_context *rctx) -{ - rctx->context.clear = r600_clear; - rctx->context.clear_render_target = r600_clear_render_target; - rctx->context.clear_depth_stencil = r600_clear_depth_stencil; - rctx->context.resource_copy_region = r600_resource_copy_region; -} - -static void r600_init_context_resource_functions2(struct r600_pipe_context *r600) -{ - r600->context.get_transfer = u_get_transfer_vtbl; - r600->context.transfer_map = u_transfer_map_vtbl; - r600->context.transfer_flush_region = u_transfer_flush_region_vtbl; - r600->context.transfer_unmap = u_transfer_unmap_vtbl; - r600->context.transfer_destroy = u_transfer_destroy_vtbl; - r600->context.transfer_inline_write = u_transfer_inline_write_vtbl; - r600->context.is_resource_referenced = u_is_resource_referenced_vtbl; -} - -static void r600_set_blend_color(struct pipe_context *ctx, - const struct pipe_blend_color *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - - if (rstate == NULL) - return; - - rstate->id = R600_PIPE_STATE_BLEND_COLOR; - r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL); - free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); - rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void *r600_create_blend_state(struct pipe_context *ctx, - const struct pipe_blend_state *state) -{ - struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend); - struct r600_pipe_state *rstate; - u32 color_control, target_mask; - - if (blend == NULL) { - return NULL; - } - rstate = &blend->rstate; - - rstate->id = R600_PIPE_STATE_BLEND; - - target_mask = 0; - color_control = S_028808_PER_MRT_BLEND(1); - if (state->logicop_enable) { - color_control |= (state->logicop_func << 16) | (state->logicop_func << 20); - } else { - color_control |= (0xcc << 16); - } - /* we pretend 8 buffer are used, CB_SHADER_MASK will disable unused one */ - if (state->independent_blend_enable) { - for (int i = 0; i < 8; i++) { - if (state->rt[i].blend_enable) { - color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i); - } - target_mask |= (state->rt[i].colormask << (4 * i)); - } - } else { - for (int i = 0; i < 8; i++) { - if (state->rt[0].blend_enable) { - color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i); - } - target_mask |= (state->rt[0].colormask << (4 * i)); - } - } - blend->cb_target_mask = target_mask; - r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL, - color_control, 0xFFFFFFFF, NULL); - - for (int i = 0; i < 8; i++) { - unsigned eqRGB = state->rt[i].rgb_func; - unsigned srcRGB = state->rt[i].rgb_src_factor; - unsigned dstRGB = state->rt[i].rgb_dst_factor; - - unsigned eqA = state->rt[i].alpha_func; - unsigned srcA = state->rt[i].alpha_src_factor; - unsigned dstA = state->rt[i].alpha_dst_factor; - uint32_t bc = 0; - - if (!state->rt[i].blend_enable) - continue; - - bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB)); - bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB)); - bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB)); - - if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) { - bc |= S_028804_SEPARATE_ALPHA_BLEND(1); - bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA)); - bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA)); - bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA)); - } - - r600_pipe_state_add_reg(rstate, R_028780_CB_BLEND0_CONTROL + i * 4, bc, 0xFFFFFFFF, NULL); - if (i == 0) { - r600_pipe_state_add_reg(rstate, R_028804_CB_BLEND_CONTROL, bc, 0xFFFFFFFF, NULL); - } - } - return rstate; -} - -static void r600_bind_blend_state(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_blend *blend = (struct r600_pipe_blend *)state; - struct r600_pipe_state *rstate; - - if (state == NULL) - return; - rstate = &blend->rstate; - rctx->states[rstate->id] = rstate; - rctx->cb_target_mask = blend->cb_target_mask; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void *r600_create_dsa_state(struct pipe_context *ctx, - const struct pipe_depth_stencil_alpha_state *state) -{ - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control; - unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control; - - if (rstate == NULL) { - return NULL; - } - - rstate->id = R600_PIPE_STATE_DSA; - /* depth TODO some of those db_shader_control field depend on shader adjust mask & add it to shader */ - /* db_shader_control is 0xFFFFFFBE as Z_EXPORT_ENABLE (bit 0) will be - * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will - * be set if shader use texkill instruction - */ - db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z); - stencil_ref_mask = 0; - stencil_ref_mask_bf = 0; - db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) | - S_028800_Z_WRITE_ENABLE(state->depth.writemask) | - S_028800_ZFUNC(state->depth.func); - - /* stencil */ - if (state->stencil[0].enabled) { - db_depth_control |= S_028800_STENCIL_ENABLE(1); - db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)); - db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)); - db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)); - db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op)); - - - stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) | - S_028430_STENCILWRITEMASK(state->stencil[0].writemask); - if (state->stencil[1].enabled) { - db_depth_control |= S_028800_BACKFACE_ENABLE(1); - db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)); - db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)); - db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)); - db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op)); - stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) | - S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask); - } - } - - /* alpha */ - alpha_test_control = 0; - alpha_ref = 0; - if (state->alpha.enabled) { - alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func); - alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1); - alpha_ref = fui(state->alpha.ref_value); - } - - /* misc */ - db_render_control = 0; - db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) | - S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE); - /* TODO db_render_override depends on query */ - r600_pipe_state_add_reg(rstate, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028430_DB_STENCILREFMASK, stencil_ref_mask, - 0xFFFFFFFF & C_028430_STENCILREF, NULL); - r600_pipe_state_add_reg(rstate, - R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf, - 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL); - r600_pipe_state_add_reg(rstate, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286E0_SPI_FOG_FUNC_SCALE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286E4_SPI_FOG_FUNC_BIAS, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL); - r600_pipe_state_add_reg(rstate, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028D30_DB_PRELOAD_CONTROL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028D44_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL); - - return rstate; -} - -static void *r600_create_rs_state(struct pipe_context *ctx, - const struct pipe_rasterizer_state *state) -{ - struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); - struct r600_pipe_state *rstate; - unsigned tmp; - unsigned prov_vtx = 1, polygon_dual_mode; - - if (rs == NULL) { - return NULL; - } - - rstate = &rs->rstate; - rs->flatshade = state->flatshade; - rs->sprite_coord_enable = state->sprite_coord_enable; - - /* offset */ - rs->offset_units = state->offset_units; - rs->offset_scale = state->offset_scale * 12.0f; - - rstate->id = R600_PIPE_STATE_RASTERIZER; - if (state->flatshade_first) - prov_vtx = 0; - tmp = 0x00000001; - if (state->sprite_coord_enable) { - tmp |= S_0286D4_PNT_SPRITE_ENA(1) | - S_0286D4_PNT_SPRITE_OVRD_X(2) | - S_0286D4_PNT_SPRITE_OVRD_Y(3) | - S_0286D4_PNT_SPRITE_OVRD_Z(0) | - S_0286D4_PNT_SPRITE_OVRD_W(1); - if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) { - tmp |= S_0286D4_PNT_SPRITE_TOP_1(1); - } - } - r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL); - - polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL || - state->fill_back != PIPE_POLYGON_MODE_FILL); - r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL, - S_028814_PROVOKING_VTX_LAST(prov_vtx) | - S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) | - S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) | - S_028814_FACE(!state->front_ccw) | - S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) | - S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) | - S_028814_POLY_MODE(polygon_dual_mode) | - S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) | - S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL, - S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) | - S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - /* point size 12.4 fixed point */ - tmp = (unsigned)(state->point_size * 8.0); - r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A0C_PA_SC_LINE_STIPPLE, 0x00000005, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MPASS_PS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL); - return rstate; -} - -static void r600_bind_rs_state(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - if (state == NULL) - return; - - rctx->flatshade = rs->flatshade; - rctx->sprite_coord_enable = rs->sprite_coord_enable; - rctx->rasterizer = rs; - - rctx->states[rs->rstate.id] = &rs->rstate; - r600_context_pipe_state_set(&rctx->ctx, &rs->rstate); -} - -static void r600_delete_rs_state(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; - - if (rctx->rasterizer == rs) { - rctx->rasterizer = NULL; - } - if (rctx->states[rs->rstate.id] == &rs->rstate) { - rctx->states[rs->rstate.id] = NULL; - } - free(rs); -} - -static void *r600_create_sampler_state(struct pipe_context *ctx, - const struct pipe_sampler_state *state) -{ - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - union util_color uc; - - if (rstate == NULL) { - return NULL; - } - - rstate->id = R600_PIPE_STATE_SAMPLER; - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); - r600_pipe_state_add_reg(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0, - S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | - S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | - S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) | - S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) | - S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) | - S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) | - S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) | - S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL); - /* FIXME LOD it depends on texture base level ... */ - r600_pipe_state_add_reg(rstate, R_03C004_SQ_TEX_SAMPLER_WORD1_0, - S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) | - S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) | - S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL); - if (uc.ui) { - r600_pipe_state_add_reg(rstate, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL); - } - return rstate; -} - -static void *r600_create_vertex_elements(struct pipe_context *ctx, - unsigned count, - const struct pipe_vertex_element *elements) -{ - struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); - - assert(count < 32); - v->count = count; - v->refcount = 1; - memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element)); - return v; -} - -static void r600_sampler_view_destroy(struct pipe_context *ctx, - struct pipe_sampler_view *state) -{ - struct r600_pipe_sampler_view *resource = (struct r600_pipe_sampler_view *)state; - - pipe_resource_reference(&state->texture, NULL); - FREE(resource); -} - -static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *ctx, - struct pipe_resource *texture, - const struct pipe_sampler_view *state) -{ - struct r600_pipe_sampler_view *resource = CALLOC_STRUCT(r600_pipe_sampler_view); - struct r600_pipe_state *rstate; - const struct util_format_description *desc; - struct r600_resource_texture *tmp; - struct r600_resource *rbuffer; - unsigned format; - uint32_t word4 = 0, yuv_format = 0, pitch = 0; - unsigned char swizzle[4], array_mode = 0, tile_type = 0; - struct radeon_ws_bo *bo[2]; - - if (resource == NULL) - return NULL; - rstate = &resource->state; - - /* initialize base object */ - resource->base = *state; - resource->base.texture = NULL; - pipe_reference(NULL, &texture->reference); - resource->base.texture = texture; - resource->base.reference.count = 1; - resource->base.context = ctx; - - swizzle[0] = state->swizzle_r; - swizzle[1] = state->swizzle_g; - swizzle[2] = state->swizzle_b; - swizzle[3] = state->swizzle_a; - format = r600_translate_texformat(texture->format, - swizzle, - &word4, &yuv_format); - if (format == ~0) { - format = 0; - } - desc = util_format_description(texture->format); - if (desc == NULL) { - R600_ERR("unknow format %d\n", texture->format); - } - tmp = (struct r600_resource_texture*)texture; - rbuffer = &tmp->resource; - bo[0] = rbuffer->bo; - bo[1] = rbuffer->bo; - /* FIXME depth texture decompression */ - if (tmp->depth) { - r600_texture_depth_flush(ctx, texture); - tmp = (struct r600_resource_texture*)texture; - rbuffer = &tmp->flushed_depth_texture->resource; - bo[0] = rbuffer->bo; - bo[1] = rbuffer->bo; - } - pitch = align(tmp->pitch[0] / tmp->bpt, 8); - - /* FIXME properly handle first level != 0 */ - r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, - S_038000_DIM(r600_tex_dim(texture->target)) | - S_038000_TILE_MODE(array_mode) | - S_038000_TILE_TYPE(tile_type) | - S_038000_PITCH((pitch / 8) - 1) | - S_038000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, - S_038004_TEX_HEIGHT(texture->height0 - 1) | - S_038004_TEX_DEPTH(texture->depth0 - 1) | - S_038004_DATA_FORMAT(format), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, - tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, - tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); - r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, - word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | - S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | - S_038010_REQUEST_SIZE(1) | - S_038010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, - S_038014_LAST_LEVEL(state->last_level) | - S_038014_BASE_ARRAY(0) | - S_038014_LAST_ARRAY(0), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, - S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL); - - return &resource->base; -} - -static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, - struct pipe_sampler_view **views) -{ - /* TODO */ - assert(1); -} - -static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, - struct pipe_sampler_view **views) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; - - for (int i = 0; i < count; i++) { - if (resource[i]) { - r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); - } - } -} - -static void r600_bind_state(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; - - if (state == NULL) - return; - rctx->states[rstate->id] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void r600_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void **states) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; - - for (int i = 0; i < count; i++) { - r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); - } -} - -static void r600_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void **states) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; - - /* TODO implement */ - for (int i = 0; i < count; i++) { - r600_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); - } -} - -static void r600_delete_state(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; - - if (rctx->states[rstate->id] == rstate) { - rctx->states[rstate->id] = NULL; - } - for (int i = 0; i < rstate->nregs; i++) { - radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); - } - free(rstate); -} - -static void r600_delete_vertex_element(struct pipe_context *ctx, void *state) -{ - struct r600_vertex_element *v = (struct r600_vertex_element*)state; - - if (v == NULL) - return; - if (--v->refcount) - return; - free(v); -} - -static void r600_set_clip_state(struct pipe_context *ctx, - const struct pipe_clip_state *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - - if (rstate == NULL) - return; - - rctx->clip = *state; - rstate->id = R600_PIPE_STATE_CLIP; - for (int i = 0; i < state->nr; i++) { - r600_pipe_state_add_reg(rstate, - R_028E20_PA_CL_UCP0_X + i * 4, - fui(state->ucp[i][0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028E24_PA_CL_UCP0_Y + i * 4, - fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028E28_PA_CL_UCP0_Z + i * 4, - fui(state->ucp[i][2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028E2C_PA_CL_UCP0_W + i * 4, - fui(state->ucp[i][3]), 0xFFFFFFFF, NULL); - } - r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, - S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) | - S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) | - S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL); - - free(rctx->states[R600_PIPE_STATE_CLIP]); - rctx->states[R600_PIPE_STATE_CLIP] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_vertex_element *v = (struct r600_vertex_element*)state; - - r600_delete_vertex_element(ctx, rctx->vertex_elements); - rctx->vertex_elements = v; - if (v) { - v->refcount++; -// rctx->vs_rebuild = TRUE; - } -} - -static void r600_set_polygon_stipple(struct pipe_context *ctx, - const struct pipe_poly_stipple *state) -{ -} - -static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask) -{ -} - -static void r600_set_scissor_state(struct pipe_context *ctx, - const struct pipe_scissor_state *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - u32 tl, br; - - if (rstate == NULL) - return; - - rstate->id = R600_PIPE_STATE_SCISSOR; - tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1); - br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy); - r600_pipe_state_add_reg(rstate, - R_028030_PA_SC_SCREEN_SCISSOR_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028034_PA_SC_SCREEN_SCISSOR_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028204_PA_SC_WINDOW_SCISSOR_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028208_PA_SC_WINDOW_SCISSOR_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028210_PA_SC_CLIPRECT_0_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028214_PA_SC_CLIPRECT_0_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028218_PA_SC_CLIPRECT_1_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_02821C_PA_SC_CLIPRECT_1_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028220_PA_SC_CLIPRECT_2_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028224_PA_SC_CLIPRECT_2_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028228_PA_SC_CLIPRECT_3_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_02822C_PA_SC_CLIPRECT_3_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028200_PA_SC_WINDOW_OFFSET, 0x00000000, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF, - 0xFFFFFFFF, NULL); - if (rctx->family >= CHIP_RV770) { - r600_pipe_state_add_reg(rstate, - R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, - 0xFFFFFFFF, NULL); - } - - free(rctx->states[R600_PIPE_STATE_SCISSOR]); - rctx->states[R600_PIPE_STATE_SCISSOR] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void r600_set_stencil_ref(struct pipe_context *ctx, - const struct pipe_stencil_ref *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - u32 tmp; - - if (rstate == NULL) - return; - - rctx->stencil_ref = *state; - rstate->id = R600_PIPE_STATE_STENCIL_REF; - tmp = S_028430_STENCILREF(state->ref_value[0]); - r600_pipe_state_add_reg(rstate, - R_028430_DB_STENCILREFMASK, tmp, - ~C_028430_STENCILREF, NULL); - tmp = S_028434_STENCILREF_BF(state->ref_value[1]); - r600_pipe_state_add_reg(rstate, - R_028434_DB_STENCILREFMASK_BF, tmp, - ~C_028434_STENCILREF_BF, NULL); - - free(rctx->states[R600_PIPE_STATE_STENCIL_REF]); - rctx->states[R600_PIPE_STATE_STENCIL_REF] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void r600_set_viewport_state(struct pipe_context *ctx, - const struct pipe_viewport_state *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - - if (rstate == NULL) - return; - - rctx->viewport = *state; - rstate->id = R600_PIPE_STATE_VIEWPORT; - r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL); - - free(rctx->states[R600_PIPE_STATE_VIEWPORT]); - rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, - const struct pipe_framebuffer_state *state, int cb) -{ - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - unsigned level = state->cbufs[cb]->level; - unsigned pitch, slice; - unsigned color_info; - unsigned format, swap, ntype; - const struct util_format_description *desc; - struct radeon_ws_bo *bo[3]; - - rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; - rbuffer = &rtex->resource; - bo[0] = rbuffer->bo; - bo[1] = rbuffer->bo; - bo[2] = rbuffer->bo; - - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; - ntype = 0; - desc = util_format_description(rtex->resource.base.b.format); - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) - ntype = V_0280A0_NUMBER_SRGB; - - format = r600_translate_colorformat(rtex->resource.base.b.format); - swap = r600_translate_colorswap(rtex->resource.base.b.format); - color_info = S_0280A0_FORMAT(format) | - S_0280A0_COMP_SWAP(swap) | - S_0280A0_BLEND_CLAMP(1) | - S_0280A0_NUMBER_TYPE(ntype); - if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) - color_info |= S_0280A0_SOURCE_FORMAT(1); - - r600_pipe_state_add_reg(rstate, - R_028040_CB_COLOR0_BASE + cb * 4, - state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, - R_0280A0_CB_COLOR0_INFO + cb * 4, - color_info, 0xFFFFFFFF, bo[0]); - r600_pipe_state_add_reg(rstate, - R_028060_CB_COLOR0_SIZE + cb * 4, - S_028060_PITCH_TILE_MAX(pitch) | - S_028060_SLICE_TILE_MAX(slice), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028080_CB_COLOR0_VIEW + cb * 4, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_0280E0_CB_COLOR0_FRAG + cb * 4, - 0x00000000, 0xFFFFFFFF, bo[1]); - r600_pipe_state_add_reg(rstate, - R_0280C0_CB_COLOR0_TILE + cb * 4, - 0x00000000, 0xFFFFFFFF, bo[2]); - r600_pipe_state_add_reg(rstate, - R_028100_CB_COLOR0_MASK + cb * 4, - 0x00000000, 0xFFFFFFFF, NULL); -} - -static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, - const struct pipe_framebuffer_state *state) -{ - struct r600_resource_texture *rtex; - struct r600_resource *rbuffer; - unsigned level; - unsigned pitch, slice, format; - - if (state->zsbuf == NULL) - return; - - rtex = (struct r600_resource_texture*)state->zsbuf->texture; - rtex->tiled = 1; - rtex->array_mode = 2; - rtex->tile_type = 1; - rtex->depth = 1; - rbuffer = &rtex->resource; - - level = state->zsbuf->level; - pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; - format = r600_translate_dbformat(state->zsbuf->texture->format); - - r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE, - state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R_028000_DB_DEPTH_SIZE, - S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028010_DB_DEPTH_INFO, - S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format), - 0xFFFFFFFF, rbuffer->bo); - r600_pipe_state_add_reg(rstate, R_028D34_DB_PREFETCH_LIMIT, - (state->zsbuf->height / 8) - 1, 0xFFFFFFFF, NULL); -} - -static void r600_set_framebuffer_state(struct pipe_context *ctx, - const struct pipe_framebuffer_state *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - u32 shader_mask, tl, br, shader_control, target_mask; - - if (rstate == NULL) - return; - - /* unreference old buffer and reference new one */ - rstate->id = R600_PIPE_STATE_FRAMEBUFFER; - for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) { - pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL); - } - for (int i = 0; i < state->nr_cbufs; i++) { - pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]); - } - pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf); - rctx->framebuffer = *state; - rctx->pframebuffer = &rctx->framebuffer; - - /* build states */ - for (int i = 0; i < state->nr_cbufs; i++) { - r600_cb(rctx, rstate, state, i); - } - if (state->zsbuf) { - r600_db(rctx, rstate, state); - } - - target_mask = 0x00000000; - target_mask = 0xFFFFFFFF; - shader_mask = 0; - shader_control = 0; - for (int i = 0; i < state->nr_cbufs; i++) { - target_mask ^= 0xf << (i * 4); - shader_mask |= 0xf << (i * 4); - shader_control |= 1 << i; - } - tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1); - br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height); - - r600_pipe_state_add_reg(rstate, - R_028240_PA_SC_GENERIC_SCISSOR_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028244_PA_SC_GENERIC_SCISSOR_BR, br, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl, - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, - 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R_0287A0_CB_SHADER_CONTROL, - shader_control, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK, - 0x00000000, target_mask, NULL); - r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK, - shader_mask, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C04_PA_SC_AA_CONFIG, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C30_CB_CLRCMP_CONTROL, - 0x01000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C34_CB_CLRCMP_SRC, - 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C38_CB_CLRCMP_DST, - 0x000000FF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C3C_CB_CLRCMP_MSK, - 0xFFFFFFFF, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028C48_PA_SC_AA_MASK, - 0xFFFFFFFF, 0xFFFFFFFF, NULL); - - free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); - rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static void r600_set_index_buffer(struct pipe_context *ctx, - const struct pipe_index_buffer *ib) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - if (ib) { - pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer); - memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer)); - } else { - pipe_resource_reference(&rctx->index_buffer.buffer, NULL); - memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer)); - } - - /* TODO make this more like a state */ -} - -static void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, - const struct pipe_vertex_buffer *buffers) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - for (int i = 0; i < rctx->nvertex_buffer; i++) { - pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); - } - memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); - for (int i = 0; i < count; i++) { - rctx->vertex_buffer[i].buffer = NULL; - if (r600_buffer_is_user_buffer(buffers[i].buffer)) - rctx->any_user_vbs = TRUE; - pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); - } - rctx->nvertex_buffer = count; -} - -static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, - struct pipe_resource *buffer) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate; - struct pipe_transfer *transfer; - unsigned *nconst = NULL; - u32 *ptr, offset; - - switch (shader) { - case PIPE_SHADER_VERTEX: - rstate = rctx->vs_const; - nconst = &rctx->vs_nconst; - offset = R_030000_SQ_ALU_CONSTANT0_0 + 0x1000; - break; - case PIPE_SHADER_FRAGMENT: - rstate = rctx->ps_const; - nconst = &rctx->ps_nconst; - offset = R_030000_SQ_ALU_CONSTANT0_0; - break; - default: - R600_ERR("unsupported %d\n", shader); - return; - } - if (buffer && buffer->width0 > 0) { - *nconst = buffer->width0 / 16; - ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer); - if (ptr == NULL) - return; - for (int i = 0; i < *nconst; i++, offset += 0x10) { - rstate[i].nregs = 0; - r600_pipe_state_add_reg(&rstate[i], offset + 0x0, ptr[i * 4 + 0], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], offset + 0x4, ptr[i * 4 + 1], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], offset + 0x8, ptr[i * 4 + 2], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], offset + 0xC, ptr[i * 4 + 3], 0xFFFFFFFF, NULL); - r600_context_pipe_state_set(&rctx->ctx, &rstate[i]); - } - pipe_buffer_unmap(ctx, buffer, transfer); - } -} - -static void *r600_create_shader_state(struct pipe_context *ctx, - const struct pipe_shader_state *state) -{ - struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); - int r; - - r = r600_pipe_shader_create2(ctx, shader, state->tokens); - if (r) { - return NULL; - } - return shader; -} - -static void r600_bind_ps_shader(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - /* TODO delete old shader */ - rctx->ps_shader = (struct r600_pipe_shader *)state; -} - -static void r600_bind_vs_shader(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - /* TODO delete old shader */ - rctx->vs_shader = (struct r600_pipe_shader *)state; -} - -static void r600_delete_ps_shader(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; - - if (rctx->ps_shader == shader) { - rctx->ps_shader = NULL; - } - /* TODO proper delete */ - free(shader); -} - -static void r600_delete_vs_shader(struct pipe_context *ctx, void *state) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; - - if (rctx->vs_shader == shader) { - rctx->vs_shader = NULL; - } - /* TODO proper delete */ - free(shader); -} - -static void r600_init_state_functions2(struct r600_pipe_context *rctx) -{ - rctx->context.create_blend_state = r600_create_blend_state; - rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state; - rctx->context.create_fs_state = r600_create_shader_state; - rctx->context.create_rasterizer_state = r600_create_rs_state; - rctx->context.create_sampler_state = r600_create_sampler_state; - rctx->context.create_sampler_view = r600_create_sampler_view; - rctx->context.create_vertex_elements_state = r600_create_vertex_elements; - rctx->context.create_vs_state = r600_create_shader_state; - rctx->context.bind_blend_state = r600_bind_blend_state; - rctx->context.bind_depth_stencil_alpha_state = r600_bind_state; - rctx->context.bind_fragment_sampler_states = r600_bind_ps_sampler; - rctx->context.bind_fs_state = r600_bind_ps_shader; - rctx->context.bind_rasterizer_state = r600_bind_rs_state; - rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements; - rctx->context.bind_vertex_sampler_states = r600_bind_vs_sampler; - rctx->context.bind_vs_state = r600_bind_vs_shader; - rctx->context.delete_blend_state = r600_delete_state; - rctx->context.delete_depth_stencil_alpha_state = r600_delete_state; - rctx->context.delete_fs_state = r600_delete_ps_shader; - rctx->context.delete_rasterizer_state = r600_delete_rs_state; - rctx->context.delete_sampler_state = r600_delete_state; - rctx->context.delete_vertex_elements_state = r600_delete_vertex_element; - rctx->context.delete_vs_state = r600_delete_vs_shader; - rctx->context.set_blend_color = r600_set_blend_color; - rctx->context.set_clip_state = r600_set_clip_state; - rctx->context.set_constant_buffer = r600_set_constant_buffer; - rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_view; - rctx->context.set_framebuffer_state = r600_set_framebuffer_state; - rctx->context.set_polygon_stipple = r600_set_polygon_stipple; - rctx->context.set_sample_mask = r600_set_sample_mask; - rctx->context.set_scissor_state = r600_set_scissor_state; - rctx->context.set_stencil_ref = r600_set_stencil_ref; - rctx->context.set_vertex_buffers = r600_set_vertex_buffers; - rctx->context.set_index_buffer = r600_set_index_buffer; - rctx->context.set_vertex_sampler_views = r600_set_vs_sampler_view; - rctx->context.set_viewport_state = r600_set_viewport_state; - rctx->context.sampler_view_destroy = r600_sampler_view_destroy; -} - -static void r600_init_config2(struct r600_pipe_context *rctx) -{ - int ps_prio; - int vs_prio; - int gs_prio; - int es_prio; - int num_ps_gprs; - int num_vs_gprs; - int num_gs_gprs; - int num_es_gprs; - int num_temp_gprs; - int num_ps_threads; - int num_vs_threads; - int num_gs_threads; - int num_es_threads; - int num_ps_stack_entries; - int num_vs_stack_entries; - int num_gs_stack_entries; - int num_es_stack_entries; - enum radeon_family family; - struct r600_pipe_state *rstate = &rctx->config; - u32 tmp; - - family = r600_get_family(rctx->radeon); - ps_prio = 0; - vs_prio = 1; - gs_prio = 2; - es_prio = 3; - switch (family) { - case CHIP_R600: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_RV630: - case CHIP_RV635: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 40; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_RV610: - case CHIP_RV620: - case CHIP_RS780: - case CHIP_RS880: - default: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_RV670: - num_ps_gprs = 144; - num_vs_gprs = 40; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 136; - num_vs_threads = 48; - num_gs_threads = 4; - num_es_threads = 4; - num_ps_stack_entries = 40; - num_vs_stack_entries = 40; - num_gs_stack_entries = 32; - num_es_stack_entries = 16; - break; - case CHIP_RV770: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 256; - num_vs_stack_entries = 256; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_RV730: - case CHIP_RV740: - num_ps_gprs = 84; - num_vs_gprs = 36; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 188; - num_vs_threads = 60; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - case CHIP_RV710: - num_ps_gprs = 192; - num_vs_gprs = 56; - num_temp_gprs = 4; - num_gs_gprs = 0; - num_es_gprs = 0; - num_ps_threads = 144; - num_vs_threads = 48; - num_gs_threads = 0; - num_es_threads = 0; - num_ps_stack_entries = 128; - num_vs_stack_entries = 128; - num_gs_stack_entries = 0; - num_es_stack_entries = 0; - break; - } - - rstate->id = R600_PIPE_STATE_CONFIG; - - /* SQ_CONFIG */ - tmp = 0; - switch (family) { - case CHIP_RV610: - case CHIP_RV620: - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV710: - break; - default: - tmp |= S_008C00_VC_ENABLE(1); - break; - } - tmp |= S_008C00_DX9_CONSTS(1); - tmp |= S_008C00_ALU_INST_PREFER_VECTOR(1); - tmp |= S_008C00_PS_PRIO(ps_prio); - tmp |= S_008C00_VS_PRIO(vs_prio); - tmp |= S_008C00_GS_PRIO(gs_prio); - tmp |= S_008C00_ES_PRIO(es_prio); - r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); - - /* SQ_GPR_RESOURCE_MGMT_1 */ - tmp = 0; - tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); - tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); - tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); - r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); - - /* SQ_GPR_RESOURCE_MGMT_2 */ - tmp = 0; - tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); - tmp |= S_008C08_NUM_GS_GPRS(num_es_gprs); - r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); - - /* SQ_THREAD_RESOURCE_MGMT */ - tmp = 0; - tmp |= S_008C0C_NUM_PS_THREADS(num_ps_threads); - tmp |= S_008C0C_NUM_VS_THREADS(num_vs_threads); - tmp |= S_008C0C_NUM_GS_THREADS(num_gs_threads); - tmp |= S_008C0C_NUM_ES_THREADS(num_es_threads); - r600_pipe_state_add_reg(rstate, R_008C0C_SQ_THREAD_RESOURCE_MGMT, tmp, 0xFFFFFFFF, NULL); - - /* SQ_STACK_RESOURCE_MGMT_1 */ - tmp = 0; - tmp |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries); - tmp |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries); - r600_pipe_state_add_reg(rstate, R_008C10_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); - - /* SQ_STACK_RESOURCE_MGMT_2 */ - tmp = 0; - tmp |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries); - tmp |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries); - r600_pipe_state_add_reg(rstate, R_008C14_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R_009714_VC_ENHANCE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028350_SX_MISC, 0x00000000, 0xFFFFFFFF, NULL); - - if (family >= CHIP_RV770) { - r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00004000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000002, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x00420204, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00514000, 0xFFFFFFFF, NULL); - } else { - r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000003, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x82000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x01020204, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000001, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00004010, 0xFFFFFFFF, NULL); - } - r600_pipe_state_add_reg(rstate, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A14_VGT_HOS_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A20_VGT_HOS_REUSE_DEPTH, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A24_VGT_GROUP_PRIM_TYPE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A28_VGT_GROUP_FIRST_DECR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A2C_VGT_GROUP_DECR, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A40_VGT_GS_MODE, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028AB0_VGT_STRMOUT_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL); - - r600_pipe_state_add_reg(rstate, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL); - r600_context_pipe_state_set(&rctx->ctx, rstate); -} - -static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - return (struct pipe_query*)r600_context_query_create(&rctx->ctx, query_type); -} - -static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - r600_context_query_destroy(&rctx->ctx, (struct r600_query *)query); -} - -static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_query *rquery = (struct r600_query *)query; - - rquery->result = 0; - rquery->num_results = 0; - r600_query_begin(&rctx->ctx, (struct r600_query *)query); -} - -static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - r600_query_end(&rctx->ctx, (struct r600_query *)query); -} - -static boolean r600_get_query_result(struct pipe_context *ctx, - struct pipe_query *query, - boolean wait, void *vresult) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_query *rquery = (struct r600_query *)query; - - if (rquery->num_results) { - ctx->flush(ctx, 0, NULL); - } - return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); -} - -static void r600_init_query_functions2(struct r600_pipe_context *rctx) -{ - rctx->context.create_query = r600_create_query; - rctx->context.destroy_query = r600_destroy_query; - rctx->context.begin_query = r600_begin_query; - rctx->context.end_query = r600_end_query; - rctx->context.get_query_result = r600_get_query_result; -} - -static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) -{ - struct pipe_depth_stencil_alpha_state dsa; - struct r600_pipe_state *rstate; - boolean quirk = false; - - if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || - rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) - quirk = true; - - memset(&dsa, 0, sizeof(dsa)); - - if (quirk) { - dsa.depth.enabled = 1; - dsa.depth.func = PIPE_FUNC_LEQUAL; - dsa.stencil[0].enabled = 1; - dsa.stencil[0].func = PIPE_FUNC_ALWAYS; - dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; - dsa.stencil[0].writemask = 0xff; - } - - rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); - r600_pipe_state_add_reg(rstate, - R_02880C_DB_SHADER_CONTROL, - 0x0, - S_02880C_DUAL_EXPORT_ENABLE(1), NULL); - r600_pipe_state_add_reg(rstate, - R_028D0C_DB_RENDER_CONTROL, - S_028D0C_DEPTH_COPY_ENABLE(1) | - S_028D0C_STENCIL_COPY_ENABLE(1) | - S_028D0C_COPY_CENTROID(1), - S_028D0C_DEPTH_COPY_ENABLE(1) | - S_028D0C_STENCIL_COPY_ENABLE(1) | - S_028D0C_COPY_CENTROID(1), NULL); - return rstate; -} - -static struct pipe_context *r600_create_context2(struct pipe_screen *screen, void *priv) -{ - struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); - struct r600_screen* rscreen = (struct r600_screen *)screen; - - if (rctx == NULL) - return NULL; - rctx->context.winsys = rscreen->screen.winsys; - rctx->context.screen = screen; - rctx->context.priv = priv; - rctx->context.destroy = r600_destroy_context; - rctx->context.flush = r600_flush2; - - /* Easy accessing of screen/winsys. */ - rctx->screen = rscreen; - rctx->radeon = rscreen->radeon; - rctx->family = r600_get_family(rctx->radeon); - - r600_init_blit_functions2(rctx); - r600_init_query_functions2(rctx); - r600_init_context_resource_functions2(rctx); - - switch (r600_get_family(rctx->radeon)) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - rctx->context.draw_vbo = r600_draw_vbo2; - r600_init_state_functions2(rctx); - if (r600_context_init(&rctx->ctx, rctx->radeon)) { - r600_destroy_context(&rctx->context); - return NULL; - } - r600_init_config2(rctx); - break; - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - rctx->context.draw_vbo = evergreen_draw; - evergreen_init_state_functions2(rctx); - if (evergreen_context_init(&rctx->ctx, rctx->radeon)) { - r600_destroy_context(&rctx->context); - return NULL; - } - evergreen_init_config2(rctx); - break; - default: - R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon)); - r600_destroy_context(&rctx->context); - return NULL; - } - - rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16, - PIPE_BIND_INDEX_BUFFER); - if (rctx->upload_ib == NULL) { - r600_destroy_context(&rctx->context); - return NULL; - } - - rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16, - PIPE_BIND_VERTEX_BUFFER); - if (rctx->upload_vb == NULL) { - r600_destroy_context(&rctx->context); - return NULL; - } - - rctx->blitter = util_blitter_create(&rctx->context); - if (rctx->blitter == NULL) { - FREE(rctx); - return NULL; - } - - LIST_INITHEAD(&rctx->query_list); - rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); - - r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth2; - - return &rctx->context; -} - -static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) -{ - switch(shader) - { - case PIPE_SHADER_FRAGMENT: - case PIPE_SHADER_VERTEX: - break; - case PIPE_SHADER_GEOMETRY: - /* TODO: support and enable geometry programs */ - return 0; - default: - /* TODO: support tessellation on Evergreen */ - return 0; - } - - /* TODO: all these should be fixed, since r600 surely supports much more! */ - switch (param) { - case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: - case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: - case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: - case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: - return 16384; - case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: - return 8; /* FIXME */ - case PIPE_SHADER_CAP_MAX_INPUTS: - if(shader == PIPE_SHADER_FRAGMENT) - return 10; - else - return 16; - case PIPE_SHADER_CAP_MAX_TEMPS: - return 256; //max native temporaries - case PIPE_SHADER_CAP_MAX_ADDRS: - return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */ - case PIPE_SHADER_CAP_MAX_CONSTS: - return 256; //max native parameters - case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: - return 1; - case PIPE_SHADER_CAP_MAX_PREDS: - return 0; /* FIXME */ - case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: - return 1; - default: - return 0; - } -} - -struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, - const struct pipe_resource *templ); -struct pipe_resource *r600_user_buffer_create2(struct pipe_screen *screen, - void *ptr, unsigned bytes, - unsigned bind) -{ - struct pipe_resource *resource; - struct r600_resource *rresource; - struct pipe_resource desc; - struct radeon *radeon = (struct radeon *)screen->winsys; - void *rptr; - - desc.screen = screen; - desc.target = PIPE_BUFFER; - desc.format = PIPE_FORMAT_R8_UNORM; - desc.usage = PIPE_USAGE_IMMUTABLE; - desc.bind = bind; - desc.width0 = bytes; - desc.height0 = 1; - desc.depth0 = 1; - desc.flags = 0; - resource = r600_buffer_create(screen, &desc); - if (resource == NULL) { - return NULL; - } - - rresource = (struct r600_resource *)resource; - rptr = radeon_ws_bo_map(radeon, rresource->bo, 0, NULL); - memcpy(rptr, ptr, bytes); - radeon_ws_bo_unmap(radeon, rresource->bo); - - return resource; -} - -void r600_init_screen_texture_functions(struct pipe_screen *screen); -struct pipe_screen *r600_screen_create2(struct radeon *radeon) -{ - struct r600_screen *rscreen; - - rscreen = CALLOC_STRUCT(r600_screen); - if (rscreen == NULL) { - return NULL; - } - - rscreen->radeon = radeon; - rscreen->screen.winsys = (struct pipe_winsys*)radeon; - rscreen->screen.destroy = r600_destroy_screen; - rscreen->screen.get_name = r600_get_name; - rscreen->screen.get_vendor = r600_get_vendor; - rscreen->screen.get_param = r600_get_param; - rscreen->screen.get_shader_param = r600_get_shader_param; - rscreen->screen.get_paramf = r600_get_paramf; - rscreen->screen.is_format_supported = r600_is_format_supported; - rscreen->screen.context_create = r600_create_context2; - r600_init_screen_texture_functions(&rscreen->screen); - r600_init_screen_resource_functions(&rscreen->screen); -// rscreen->screen.user_buffer_create = r600_user_buffer_create2; - - return &rscreen->screen; -} - -int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl *draw) -{ - struct pipe_resource *upload_buffer = NULL; - unsigned index_offset = draw->index_buffer_offset; - int ret = 0; - - if (r600_buffer_is_user_buffer(draw->index_buffer)) { - ret = u_upload_buffer(rctx->upload_ib, - index_offset, - draw->count * draw->index_size, - draw->index_buffer, - &index_offset, - &upload_buffer); - if (ret) { - goto done; - } - draw->index_buffer_offset = index_offset; - - /* Transfer ownership. */ - pipe_resource_reference(&draw->index_buffer, upload_buffer); - pipe_resource_reference(&upload_buffer, NULL); - } - -done: - return ret; -} - -int r600_upload_user_buffers2(struct r600_pipe_context *rctx) -{ - enum pipe_error ret = PIPE_OK; - int i, nr; - - nr = rctx->vertex_elements->count; - - for (i = 0; i < nr; i++) { - struct pipe_vertex_buffer *vb = - &rctx->vertex_buffer[rctx->vertex_elements->elements[i].vertex_buffer_index]; - - if (r600_buffer_is_user_buffer(vb->buffer)) { - struct pipe_resource *upload_buffer = NULL; - unsigned offset = 0; /*vb->buffer_offset * 4;*/ - unsigned size = vb->buffer->width0; - unsigned upload_offset; - ret = u_upload_buffer(rctx->upload_vb, - offset, size, - vb->buffer, - &upload_offset, &upload_buffer); - if (ret) - return ret; - - pipe_resource_reference(&vb->buffer, NULL); - vb->buffer = upload_buffer; - vb->buffer_offset = upload_offset; - } - } - return ret; -} diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h deleted file mode 100644 index a7e7982c195..00000000000 --- a/src/gallium/drivers/r600/radeon.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright © 2009 Jerome Glisse - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef RADEON_H -#define RADEON_H - -#define RADEON_CTX_MAX_PM4 (64 * 1024 / 4) - -#include - -#include - -typedef uint64_t u64; -typedef uint32_t u32; -typedef uint16_t u16; -typedef uint8_t u8; - -struct radeon; - -enum radeon_family { - CHIP_UNKNOWN, - CHIP_R100, - CHIP_RV100, - CHIP_RS100, - CHIP_RV200, - CHIP_RS200, - CHIP_R200, - CHIP_RV250, - CHIP_RS300, - CHIP_RV280, - CHIP_R300, - CHIP_R350, - CHIP_RV350, - CHIP_RV380, - CHIP_R420, - CHIP_R423, - CHIP_RV410, - CHIP_RS400, - CHIP_RS480, - CHIP_RS600, - CHIP_RS690, - CHIP_RS740, - CHIP_RV515, - CHIP_R520, - CHIP_RV530, - CHIP_RV560, - CHIP_RV570, - CHIP_R580, - CHIP_R600, - CHIP_RV610, - CHIP_RV630, - CHIP_RV670, - CHIP_RV620, - CHIP_RV635, - CHIP_RS780, - CHIP_RS880, - CHIP_RV770, - CHIP_RV730, - CHIP_RV710, - CHIP_RV740, - CHIP_CEDAR, - CHIP_REDWOOD, - CHIP_JUNIPER, - CHIP_CYPRESS, - CHIP_HEMLOCK, - CHIP_LAST, -}; - -enum chip_class { - R600, - R700, - EVERGREEN, -}; - -enum { - R600_SHADER_PS = 1, - R600_SHADER_VS, - R600_SHADER_GS, - R600_SHADER_FS, - R600_SHADER_MAX = R600_SHADER_FS, -}; - -enum radeon_family radeon_get_family(struct radeon *rw); -enum chip_class radeon_get_family_class(struct radeon *radeon); -void radeon_set_mem_constant(struct radeon *radeon, boolean state); - -/* lowlevel WS bo */ -struct radeon_ws_bo; -struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon, - unsigned size, unsigned alignment, unsigned usage); -struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon, - unsigned handle); -void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx); -void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo); -void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, - struct radeon_ws_bo *src); - -struct radeon_stype_info; - -/* currently limited to max buffers in a cb flush */ -#define RADEON_STATE_MAX_BO 8 -/* - * states functions - */ -struct radeon_state { - struct radeon *radeon; - unsigned refcount; - struct radeon_stype_info *stype; - unsigned state_id; - unsigned id; - unsigned shader_index; - unsigned nstates; - u32 states[64]; - unsigned npm4; - unsigned cpm4; - u32 pm4_crc; - u32 pm4[128]; - unsigned nbo; - struct radeon_ws_bo *bo[RADEON_STATE_MAX_BO]; - unsigned nreloc; - unsigned reloc_pm4_id[8]; - unsigned reloc_bo_id[8]; - u32 placement[8]; - unsigned bo_dirty[4]; -}; - -int radeon_state_init(struct radeon_state *rstate, struct radeon *radeon, u32 type, u32 id, u32 shader_class); -void radeon_state_fini(struct radeon_state *state); -int radeon_state_pm4(struct radeon_state *state); -int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type); - -/* - * draw functions - */ -struct radeon_draw { - struct radeon *radeon; - struct radeon_state **state; -}; - -int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon); -void radeon_draw_bind(struct radeon_draw *draw, struct radeon_state *state); -void radeon_draw_unbind(struct radeon_draw *draw, struct radeon_state *state); - -/* - * radeon context functions - */ -#pragma pack(1) -struct radeon_cs_reloc { - uint32_t handle; - uint32_t read_domain; - uint32_t write_domain; - uint32_t flags; -}; -#pragma pack() - -struct radeon_ctx; - -struct radeon_ctx *radeon_ctx_init(struct radeon *radeon); -void radeon_ctx_fini(struct radeon_ctx *ctx); -void radeon_ctx_clear(struct radeon_ctx *ctx); -int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw); -int radeon_ctx_submit(struct radeon_ctx *ctx); -void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file); -int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state); - -/* - * R600/R700 - */ - -enum r600_stype { - R600_STATE_CONFIG, - R600_STATE_CB_CNTL, - R600_STATE_RASTERIZER, - R600_STATE_VIEWPORT, - R600_STATE_SCISSOR, - R600_STATE_BLEND, - R600_STATE_DSA, - R600_STATE_SHADER, /* has PS,VS,GS,FS variants */ - R600_STATE_CONSTANT, /* has PS,VS,GS,FS variants */ - R600_STATE_CBUF, /* has PS,VS,GS,FS variants */ - R600_STATE_RESOURCE, /* has PS,VS,GS,FS variants */ - R600_STATE_SAMPLER, /* has PS,VS,GS,FS variants */ - R600_STATE_SAMPLER_BORDER, /* has PS,VS,GS,FS variants */ - R600_STATE_CB0, - R600_STATE_CB1, - R600_STATE_CB2, - R600_STATE_CB3, - R600_STATE_CB4, - R600_STATE_CB5, - R600_STATE_CB6, - R600_STATE_CB7, - R600_STATE_DB, - R600_STATE_QUERY_BEGIN, - R600_STATE_QUERY_END, - R600_STATE_UCP, - R600_STATE_VGT, - R600_STATE_DRAW, - R600_STATE_CB_FLUSH, - R600_STATE_DB_FLUSH, - R600_STATE_MAX, -}; - -#include "r600_states_inc.h" -#include "eg_states_inc.h" - -/* R600 QUERY BEGIN/END */ -#define R600_QUERY__OFFSET 0 -#define R600_QUERY_SIZE 1 -#define R600_QUERY_PM4 128 - -#endif diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c index 3165bcd6781..7ba778e9f42 100644 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ b/src/gallium/winsys/r600/drm/evergreen_state.c @@ -38,17 +38,6 @@ #include #include "r600_priv.h" -struct radeon_bo { - struct pipe_reference reference; - unsigned handle; - unsigned size; - unsigned alignment; - unsigned map_count; - void *data; -}; - -struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); - struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index a7ad96f5a20..31fb7d4e0fd 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -31,7 +31,8 @@ #include "util/u_inlines.h" #include "util/u_debug.h" #include -#include "radeon_priv.h" +#include "r600.h" +#include "r600_priv.h" #include "r600_drm_public.h" #include "xf86drm.h" #include "radeon_drm.h" diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 92dadf8d1c6..f836e607c0b 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "r600.h" @@ -56,13 +57,50 @@ struct r600_reg { unsigned flush_flags; }; +struct radeon_bo { + struct pipe_reference reference; + unsigned handle; + unsigned size; + unsigned alignment; + unsigned map_count; + void *data; +}; + +struct radeon_ws_bo { + struct pipe_reference reference; + struct pb_buffer *pb; +}; + + /* radeon_pciid.c */ unsigned radeon_family_from_device(unsigned device); +/* r600_drm.c */ +struct radeon *radeon_decref(struct radeon *radeon); + +/* radeon_bo.c */ +struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); +struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, + unsigned size, unsigned alignment, void *ptr); +int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); +void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); +void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, + struct radeon_bo *src); +int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); +int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain); + +/* radeon_bo_pb.c */ +struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr, + uint32_t handle); + +/* radeon_ws_bo.c */ +unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *bo); +unsigned radeon_ws_bo_get_size(struct radeon_ws_bo *bo); + #define CTX_RANGE_ID(ctx, offset) (((offset) >> (ctx)->hash_shift) & 255) #define CTX_BLOCK_ID(ctx, offset) ((offset) & ((1 << (ctx)->hash_shift) - 1)) - static void inline r600_context_reg(struct r600_context *ctx, unsigned offset, unsigned value, unsigned mask) @@ -83,14 +121,6 @@ static void inline r600_context_reg(struct r600_context *ctx, block->status |= R600_BLOCK_STATUS_DIRTY; } -struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); -void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); - -struct radeon_ws_bo { - struct pipe_reference reference; - struct pb_buffer *pb; -}; - static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block) { struct radeon_bo *bo; diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 87f33e05264..416fcebc9fe 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -40,14 +40,6 @@ #define GROUP_FORCE_NEW_BLOCK 0 -struct radeon_bo { - struct pipe_reference reference; - unsigned handle; - unsigned size; - unsigned alignment; - unsigned map_count; - void *data; -}; int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); void radeon_bo_reference(struct radeon *radeon, @@ -1003,7 +995,6 @@ void r600_context_flush(struct r600_context *ctx) struct drm_radeon_cs drmib; struct drm_radeon_cs_chunk chunks[2]; uint64_t chunk_array[2]; - struct r600_block *block; int r; if (!ctx->pm4_cdwords) diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index 51ce8649742..d16e38d4e04 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -29,7 +29,7 @@ #include #include #include -#include "radeon_priv.h" +#include "r600_priv.h" #include "xf86drm.h" #include "radeon_drm.h" diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index aac3d7b6049..33964814a02 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -1,10 +1,34 @@ -#include "radeon_priv.h" - -#include "util/u_inlines.h" -#include "util/u_memory.h" -#include "util/u_double_list.h" -#include "pipebuffer/pb_buffer.h" -#include "pipebuffer/pb_bufmgr.h" +/* + * Copyright 2010 Dave Airlie + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Dave Airlie + */ +#include +#include +#include +#include +#include +#include "r600_priv.h" struct radeon_bo_pb { struct pb_buffer b; diff --git a/src/gallium/winsys/r600/drm/radeon_pciid.c b/src/gallium/winsys/r600/drm/radeon_pciid.c index dd6156d585e..08cc1c41e37 100644 --- a/src/gallium/winsys/r600/drm/radeon_pciid.c +++ b/src/gallium/winsys/r600/drm/radeon_pciid.c @@ -24,7 +24,7 @@ * Jerome Glisse */ #include -#include "radeon_priv.h" +#include "r600.h" struct pci_id { unsigned vendor; diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h deleted file mode 100644 index 4cb3fc79d43..00000000000 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright © 2009 Jerome Glisse - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef RADEON_PRIV_H -#define RADEON_PRIV_H - -#include -#include "xf86drm.h" -#include "xf86drmMode.h" -#include -#include "radeon.h" - -#include "pipe/p_compiler.h" -#include "util/u_inlines.h" -#include "pipe/p_defines.h" - -struct radeon; -struct radeon_ctx; - - -/* - * radeon functions - */ -typedef int (*radeon_state_pm4_t)(struct radeon_state *state); -struct radeon_register { - unsigned offset; - unsigned need_reloc; - unsigned bo_id; - char name[64]; -}; - -struct radeon_bo { - struct pipe_reference reference; - unsigned handle; - unsigned size; - unsigned alignment; - unsigned map_count; - void *data; -}; - -struct radeon_sub_type { - int shader_type; - const struct radeon_register *regs; - unsigned nstates; -}; - -struct radeon_stype_info { - unsigned stype; - unsigned num; - unsigned stride; - radeon_state_pm4_t pm4; - struct radeon_sub_type reginfo[R600_SHADER_MAX]; - unsigned base_id; - unsigned npm4; -}; - -struct radeon_ctx { - struct radeon *radeon; - u32 *pm4; - int cdwords; - int ndwords; - unsigned nreloc; - struct radeon_cs_reloc *reloc; - unsigned nbo; - struct radeon_bo **bo; -}; - -struct radeon { - int fd; - int refcount; - unsigned device; - unsigned family; - enum chip_class chip_class; - boolean use_mem_constant; /* true for evergreen */ - struct pb_manager *mman; /* malloc manager */ - struct pb_manager *kman; /* kernel bo manager */ - struct pb_manager *cman; /* cached bo manager */ - unsigned nstype; - struct radeon_stype_info *stype; - unsigned max_states; -}; - -struct radeon_ws_bo { - struct pipe_reference reference; - struct pb_buffer *pb; -}; - -extern struct radeon *radeon_new(int fd, unsigned device); -extern struct radeon *radeon_incref(struct radeon *radeon); -extern struct radeon *radeon_decref(struct radeon *radeon); -extern unsigned radeon_family_from_device(unsigned device); -extern int radeon_is_family_compatible(unsigned family1, unsigned family2); - -/* - * r600/r700 context functions - */ -extern int r600_init(struct radeon *radeon); -extern int r600_ctx_draw(struct radeon_ctx *ctx); -extern int r600_ctx_next_reloc(struct radeon_ctx *ctx, unsigned *reloc); - -/* - * radeon state functions - */ -extern u32 radeon_state_register_get(struct radeon_state *state, unsigned offset); -extern int radeon_state_register_set(struct radeon_state *state, unsigned offset, u32 value); -extern struct radeon_state *radeon_state_duplicate(struct radeon_state *state); -extern int radeon_state_replace_always(struct radeon_state *ostate, struct radeon_state *nstate); -extern int radeon_state_pm4_generic(struct radeon_state *state); -extern int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id); - -/* - * radeon draw functions - */ -extern int radeon_draw_pm4(struct radeon_draw *draw); - -/* ws bo winsys only */ -unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *bo); -unsigned radeon_ws_bo_get_size(struct radeon_ws_bo *bo); - -/* bo */ -struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, - unsigned size, unsigned alignment, void *ptr); -int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, - struct radeon_bo *src); -int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); -int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain); - -/* pipebuffer kernel bo manager */ -struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon); -struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); -void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); -struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr, - uint32_t handle); - -#endif diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c index 4a64be23a28..ed3b4e72bf9 100644 --- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c @@ -1,7 +1,32 @@ +/* + * Copyright 2010 Dave Airlie + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Dave Airlie + */ #include #include #include -#include "radeon_priv.h" +#include "r600_priv.h" struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon, unsigned size, unsigned alignment, unsigned usage) -- cgit v1.2.3 From 4f80a2d1700a1916e0ac6f24f60b117f9c4dfef1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 12:00:19 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. radeon_pair_schedule.c: In function ‘emit_all_tex’: radeon_pair_schedule.c:244: warning: ISO C90 forbids mixed declarations and code radeon_pair_schedule.c: In function ‘destructive_merge_instructions’: radeon_pair_schedule.c:291: warning: ISO C90 forbids mixed declarations and code radeon_pair_schedule.c:438: warning: ISO C90 forbids mixed declarations and code radeon_pair_schedule.c: In function ‘scan_read’: radeon_pair_schedule.c:619: warning: ISO C90 forbids mixed declarations and code radeon_pair_schedule.c: In function ‘scan_write’: radeon_pair_schedule.c:645: warning: ISO C90 forbids mixed declarations and code radeon_pair_schedule.c: In function ‘schedule_block’: radeon_pair_schedule.c:673: warning: ISO C90 forbids mixed declarations and code radeon_pair_schedule.c: In function ‘rc_pair_schedule’: radeon_pair_schedule.c:730: warning: ISO C90 forbids mixed declarations and code --- .../dri/r300/compiler/radeon_pair_schedule.c | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index 38bae26f3c1..bfe3553460e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -237,11 +237,12 @@ static void commit_alu_instruction(struct schedule_state * s, struct schedule_in static void emit_all_tex(struct schedule_state * s, struct rc_instruction * before) { struct schedule_instruction *readytex; + struct rc_instruction * inst_begin; assert(s->ReadyTEX); /* Node marker for R300 */ - struct rc_instruction * inst_begin = rc_insert_new_instruction(s->C, before->Prev); + inst_begin = rc_insert_new_instruction(s->C, before->Prev); inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX; /* Link texture instructions back in */ @@ -280,6 +281,8 @@ static int destructive_merge_instructions( struct rc_pair_instruction * alpha) { const struct rc_opcode_info * opcode; + const struct rc_opcode_info * rgb_info; + assert(rgb->Alpha.Opcode == RC_OPCODE_NOP); assert(alpha->RGB.Opcode == RC_OPCODE_NOP); @@ -288,8 +291,7 @@ static int destructive_merge_instructions( * src1. */ /* Merge the rgb presubtract registers. */ - const struct rc_opcode_info * rgb_info = - rc_get_opcode_info(rgb->RGB.Opcode); + rgb_info = rc_get_opcode_info(rgb->RGB.Opcode); if (alpha->RGB.Src[RC_PAIR_PRESUB_SRC].Used) { unsigned int srcp_src; unsigned int srcp_regs; @@ -424,6 +426,7 @@ static int destructive_merge_instructions( unsigned int oldsrc = alpha->Alpha.Arg[arg].Source; rc_register_file file = 0; unsigned int index = 0; + int source; if (alpha->Alpha.Arg[arg].Swizzle < 3) { srcrgb = 1; @@ -435,7 +438,7 @@ static int destructive_merge_instructions( index = alpha->Alpha.Src[oldsrc].Index; } - int source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index); + source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index); if (source < 0) return 0; @@ -603,6 +606,7 @@ static void scan_read(void * data, struct rc_instruction * inst, { struct schedule_state * s = data; struct reg_value * v = get_reg_value(s, file, index, chan); + struct reg_value_reader * reader; if (!v) return; @@ -616,7 +620,7 @@ static void scan_read(void * data, struct rc_instruction * inst, DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); - struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader)); + reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader)); reader->Reader = s->Current; reader->Next = v->Readers; v->Readers = reader; @@ -636,13 +640,14 @@ static void scan_write(void * data, struct rc_instruction * inst, { struct schedule_state * s = data; struct reg_value ** pv = get_reg_valuep(s, file, index, chan); + struct reg_value * newv; if (!pv) return; DBG("%i: write %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); - struct reg_value * newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv)); + newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv)); memset(newv, 0, sizeof(*newv)); newv->Writer = s->Current; @@ -665,12 +670,13 @@ static void schedule_block(struct r300_fragment_program_compiler * c, struct rc_instruction * begin, struct rc_instruction * end) { struct schedule_state s; + unsigned int ip; memset(&s, 0, sizeof(s)); s.C = &c->Base; /* Scan instructions for data dependencies */ - unsigned int ip = 0; + ip = 0; for(struct rc_instruction * inst = begin; inst != end; inst = inst->Next) { s.Current = memory_pool_malloc(&c->Base.Pool, sizeof(*s.Current)); memset(s.Current, 0, sizeof(struct schedule_instruction)); @@ -722,12 +728,14 @@ void rc_pair_schedule(struct radeon_compiler *cc, void *user) struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc; struct rc_instruction * inst = c->Base.Program.Instructions.Next; while(inst != &c->Base.Program.Instructions) { + struct rc_instruction * first; + if (is_controlflow(inst)) { inst = inst->Next; continue; } - struct rc_instruction * first = inst; + first = inst; while(inst != &c->Base.Program.Instructions && !is_controlflow(inst)) inst = inst->Next; -- cgit v1.2.3 From 22c06a08e76a4edb468e0a6a85dd4e5c0483d275 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 12:09:21 -0700 Subject: r600g: Update SConscript. Fixes SCons build. --- src/gallium/drivers/r600/SConscript | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/SConscript b/src/gallium/drivers/r600/SConscript index 3f3740a554c..b6d9b7d8d22 100644 --- a/src/gallium/drivers/r600/SConscript +++ b/src/gallium/drivers/r600/SConscript @@ -16,15 +16,17 @@ env.Append(CPPPATH = [ r600 = env.ConvenienceLibrary( target = 'r600', source = [ + 'r600_asm.c', 'r600_buffer.c', - 'r600_state2.c', - 'evergreen_state.c', - 'r600_shader.c', 'r600_helper.c', + 'r600_pipe.c', + 'r600_query.c', 'r600_resource.c', + 'r600_shader.c', + 'r600_state.c', 'r600_texture.c', - 'r600_asm.c', 'r700_asm.c', + 'evergreen_state.c', 'eg_asm.c', ]) -- cgit v1.2.3 From a9d5808232087ace460fe0d30dc9b8a49c30fd5c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 12:15:14 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this GCC warning on linux-x86 build. radeon_pair_regalloc.c: In function ‘rc_pair_regalloc_inputs_only’: radeon_pair_regalloc.c:330: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c index c73845512f8..91524f5ec68 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c @@ -322,12 +322,13 @@ void rc_pair_regalloc_inputs_only(struct radeon_compiler *cc, void *user) { struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc; struct regalloc_state s; + int temp_reg_offset; compute_live_intervals(cc, &s); c->AllocateHwInputs(c, &alloc_input, &s); - int temp_reg_offset = 0; + temp_reg_offset = 0; for (unsigned i = 0; i < RC_REGISTER_MAX_INDEX; i++) { if (s.Input[i].Allocated && temp_reg_offset <= s.Input[i].Index) temp_reg_offset = s.Input[i].Index + 1; -- cgit v1.2.3 From 7e536371f901e97cb4d73c6662f79a904c943e17 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 12:16:39 -0700 Subject: r600g: Update SConscript. Fixes SCons build. --- src/gallium/winsys/r600/drm/SConscript | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index 2f20d9f8957..55b88fa0d9d 100644 --- a/src/gallium/winsys/r600/drm/SConscript +++ b/src/gallium/winsys/r600/drm/SConscript @@ -4,14 +4,14 @@ env = env.Clone() r600_sources = [ 'bof.c', - 'r600_state.c', - 'radeon_ctx.c', - 'radeon_draw.c', - 'radeon_state.c', + 'r600_state2.c', + 'evergreen_state.c', + 'r600.c', + 'r600_drm.c', 'radeon_bo.c', 'radeon_pciid.c', - 'radeon.c', - 'r600_drm.c' + 'radeon_ws_bo.c', + 'radeon_bo_pb.c', ] env.ParseConfig('pkg-config --cflags libdrm_radeon') -- cgit v1.2.3 From 6abd7771c6ab2c733b20835e211060dd18fd847d Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 29 Sep 2010 15:39:40 -0400 Subject: r600g: more cleanup Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/Makefile | 1 + src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_asm.h | 7 + src/gallium/drivers/r600/r600_blit.c | 164 +++ src/gallium/drivers/r600/r600_pipe.c | 5 +- src/gallium/drivers/r600/r600_pipe.h | 47 +- src/gallium/drivers/r600/r600_public.h | 27 +- src/gallium/drivers/r600/r600_query.c | 6 +- src/gallium/drivers/r600/r600_shader.c | 28 - src/gallium/drivers/r600/r600_state.c | 146 +-- src/gallium/targets/dri-r600/target.c | 29 +- src/gallium/winsys/r600/drm/Makefile | 10 +- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 857 +++++++++++++ src/gallium/winsys/r600/drm/evergreen_state.c | 857 ------------- src/gallium/winsys/r600/drm/r600_drm_public.h | 26 +- src/gallium/winsys/r600/drm/r600_hw_context.c | 1258 ++++++++++++++++++++ src/gallium/winsys/r600/drm/r600_state2.c | 1258 -------------------- 17 files changed, 2372 insertions(+), 2356 deletions(-) create mode 100644 src/gallium/drivers/r600/r600_blit.c create mode 100644 src/gallium/winsys/r600/drm/evergreen_hw_context.c delete mode 100644 src/gallium/winsys/r600/drm/evergreen_state.c create mode 100644 src/gallium/winsys/r600/drm/r600_hw_context.c delete mode 100644 src/gallium/winsys/r600/drm/r600_state2.c (limited to 'src') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 213534198a2..ede0bb2ec45 100644 --- a/src/gallium/drivers/r600/Makefile +++ b/src/gallium/drivers/r600/Makefile @@ -8,6 +8,7 @@ LIBRARY_INCLUDES = \ C_SOURCES = \ r600_asm.c \ + r600_blit.c \ r600_buffer.c \ r600_helper.c \ r600_pipe.c \ diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index fc517f13ad1..a30025642d2 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1360,7 +1360,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.max_index = info->max_index; draw.index_bias = info->index_bias; - r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer, + r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer, &rctx->index_buffer.index_size, &draw.start, info->count); diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index 6aadf72957b..cf67ca2d68e 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -176,6 +176,10 @@ struct r600_bc { struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH]; }; +/* eg_asm.c */ +int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf); + +/* r600_asm.c */ int r600_bc_init(struct r600_bc *bc, enum radeon_family family); int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu); int r600_bc_add_literal(struct r600_bc *bc, const u32 *value); @@ -186,4 +190,7 @@ int r600_bc_build(struct r600_bc *bc); int r600_bc_add_cfinst(struct r600_bc *bc, int inst); int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type); +/* r700_asm.c */ +int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id); + #endif diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c new file mode 100644 index 00000000000..a19f494ea0c --- /dev/null +++ b/src/gallium/drivers/r600/r600_blit.c @@ -0,0 +1,164 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + */ +#include +#include +#include "r600_pipe.h" + +static void r600_blitter_save_states(struct pipe_context *ctx) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]); + util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]); + if (rctx->states[R600_PIPE_STATE_STENCIL_REF]) { + util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref); + } + util_blitter_save_rasterizer(rctx->blitter, rctx->states[R600_PIPE_STATE_RASTERIZER]); + util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader); + util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader); + util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements); + if (rctx->states[R600_PIPE_STATE_VIEWPORT]) { + util_blitter_save_viewport(rctx->blitter, &rctx->viewport); + } + if (rctx->states[R600_PIPE_STATE_CLIP]) { + util_blitter_save_clip(rctx->blitter, &rctx->clip); + } + util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer); + + rctx->vertex_elements = NULL; + + /* TODO queries */ +} + +int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state fb = *rctx->pframebuffer; + struct pipe_surface *zsurf, *cbsurf; + int level = 0; + float depth = 1.0f; + + r600_context_queries_suspend(&rctx->ctx); + for (int i = 0; i < fb.nr_cbufs; i++) { + fb.cbufs[i] = NULL; + pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]); + } + fb.zsbuf = NULL; + pipe_surface_reference(&fb.zsbuf, rctx->pframebuffer->zsbuf); + + zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, + PIPE_BIND_DEPTH_STENCIL); + + cbsurf = ctx->screen->get_tex_surface(ctx->screen, + (struct pipe_resource*)texture->flushed_depth_texture, + 0, level, 0, PIPE_BIND_RENDER_TARGET); + + r600_blitter_save_states(ctx); + util_blitter_save_framebuffer(rctx->blitter, &fb); + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + depth = 0.0f; + + util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); + + pipe_surface_reference(&zsurf, NULL); + pipe_surface_reference(&cbsurf, NULL); + for (int i = 0; i < fb.nr_cbufs; i++) { + pipe_surface_reference(&fb.cbufs[i], NULL); + } + pipe_surface_reference(&fb.zsbuf, NULL); + r600_context_queries_resume(&rctx->ctx); + + return 0; +} + +static void r600_clear(struct pipe_context *ctx, unsigned buffers, + const float *rgba, double depth, unsigned stencil) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state *fb = &rctx->framebuffer; + + r600_context_queries_suspend(&rctx->ctx); + r600_blitter_save_states(ctx); + util_blitter_clear(rctx->blitter, fb->width, fb->height, + fb->nr_cbufs, buffers, rgba, depth, + stencil); + r600_context_queries_resume(&rctx->ctx); +} + +static void r600_clear_render_target(struct pipe_context *ctx, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state *fb = &rctx->framebuffer; + + r600_context_queries_suspend(&rctx->ctx); + util_blitter_save_framebuffer(rctx->blitter, fb); + util_blitter_clear_render_target(rctx->blitter, dst, rgba, + dstx, dsty, width, height); + r600_context_queries_resume(&rctx->ctx); +} + +static void r600_clear_depth_stencil(struct pipe_context *ctx, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct pipe_framebuffer_state *fb = &rctx->framebuffer; + + r600_context_queries_suspend(&rctx->ctx); + util_blitter_save_framebuffer(rctx->blitter, fb); + util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, + dstx, dsty, width, height); + r600_context_queries_resume(&rctx->ctx); +} + + +static void r600_resource_copy_region(struct pipe_context *ctx, + struct pipe_resource *dst, + struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + struct pipe_subresource subsrc, + unsigned srcx, unsigned srcy, unsigned srcz, + unsigned width, unsigned height) +{ + util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height); +} + +void r600_init_blit_functions2(struct r600_pipe_context *rctx) +{ + rctx->context.clear = r600_clear; + rctx->context.clear_render_target = r600_clear_render_target; + rctx->context.clear_depth_stencil = r600_clear_depth_stencil; + rctx->context.resource_copy_region = r600_resource_copy_region; +} diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 0613cd1eca6..3c4424039b5 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -147,7 +147,7 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi rctx->family = r600_get_family(rctx->radeon); r600_init_blit_functions2(rctx); - r600_init_query_functions2(rctx); + r600_init_query_functions(rctx); r600_init_context_resource_functions2(rctx); switch (r600_get_family(rctx->radeon)) { @@ -210,7 +210,6 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi return NULL; } - LIST_INITHEAD(&rctx->query_list); rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth2; @@ -423,7 +422,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) } -struct pipe_screen *r600_screen_create2(struct radeon *radeon) +struct pipe_screen *r600_screen_create(struct radeon *radeon) { struct r600_screen *rscreen; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index ab31180df7d..98ed8b7c69c 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -31,6 +31,7 @@ #include #include #include "r600.h" +#include "r600_public.h" #include "r600_shader.h" #include "r600_resource.h" @@ -91,14 +92,12 @@ struct r600_pipe_shader { struct r600_vertex_element vertex_elements; }; - struct r600_pipe_context { struct pipe_context context; struct blitter_context *blitter; struct pipe_framebuffer_state *pframebuffer; unsigned family; void *custom_dsa_flush; - struct list_head query_list; /* fake member for depth remove once merged */ struct r600_screen *screen; struct radeon *radeon; struct r600_pipe_state *states[R600_PIPE_NSTATES]; @@ -146,20 +145,6 @@ struct r600_drawl { struct pipe_resource *index_buffer; }; -uint32_t r600_translate_texformat(enum pipe_format format, - const unsigned char *swizzle_view, - uint32_t *word4_p, uint32_t *yuv_format_p); - -/* r600_state2.c */ -int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader); -int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); -void r600_translate_index_buffer2(struct r600_pipe_context *r600, - struct pipe_resource **index_buffer, - unsigned *index_size, - unsigned *start, unsigned count); -int r600_find_vs_semantic_index2(struct r600_shader *vs, - struct r600_shader *ps, int id); - /* evergreen_state.c */ void evergreen_init_state_functions2(struct r600_pipe_context *rctx); void evergreen_init_config2(struct r600_pipe_context *rctx); @@ -167,12 +152,6 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader); void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader); -static INLINE u32 S_FIXED(float value, u32 frac_bits) -{ - return value * (1 << frac_bits); -} -#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) - /* r600_blit.c */ void r600_init_blit_functions2(struct r600_pipe_context *rctx); int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture); @@ -192,20 +171,42 @@ int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl * int r600_upload_user_buffers(struct r600_pipe_context *rctx); /* r600_query.c */ -void r600_init_query_functions2(struct r600_pipe_context *rctx); +void r600_init_query_functions(struct r600_pipe_context *rctx); /* r600_resource.c */ void r600_init_context_resource_functions2(struct r600_pipe_context *r600); +/* r600_shader.c */ +int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader); +int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); +int r600_find_vs_semantic_index2(struct r600_shader *vs, + struct r600_shader *ps, int id); + /* r600_state.c */ void r600_init_state_functions2(struct r600_pipe_context *rctx); void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info); void r600_init_config2(struct r600_pipe_context *rctx); +void r600_translate_index_buffer(struct r600_pipe_context *r600, + struct pipe_resource **index_buffer, + unsigned *index_size, + unsigned *start, unsigned count); /* r600_helper.h */ int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); /* r600_texture.c */ void r600_init_screen_texture_functions(struct pipe_screen *screen); +uint32_t r600_translate_texformat(enum pipe_format format, + const unsigned char *swizzle_view, + uint32_t *word4_p, uint32_t *yuv_format_p); + +/* + * common helpers + */ +static INLINE u32 S_FIXED(float value, u32 frac_bits) +{ + return value * (1 << frac_bits); +} +#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) #endif diff --git a/src/gallium/drivers/r600/r600_public.h b/src/gallium/drivers/r600/r600_public.h index 1d89c9f9f61..f1970201e89 100644 --- a/src/gallium/drivers/r600/r600_public.h +++ b/src/gallium/drivers/r600/r600_public.h @@ -1,9 +1,28 @@ - +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + */ #ifndef R600_PUBLIC_H #define R600_PUBLIC_H -struct radeon; - -struct pipe_screen* r600_screen_create(struct radeon *rw); +struct pipe_screen *r600_screen_create(struct radeon *radeon); #endif diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 7385a6f1e19..726668260cc 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -20,10 +20,6 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/* TODO: - * - fix mask for depth control & cull for query - */ #include "r600_pipe.h" static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) @@ -70,7 +66,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx, return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); } -void r600_init_query_functions2(struct r600_pipe_context *rctx) +void r600_init_query_functions(struct r600_pipe_context *rctx) { rctx->context.create_query = r600_create_query; rctx->context.destroy_query = r600_destroy_query; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 718754b104e..a0cd830d26d 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1349,34 +1349,6 @@ static int tgsi_rsq(struct r600_shader_ctx *ctx) return tgsi_helper_tempx_replicate(ctx); } -static int tgsi_trans(struct r600_shader_ctx *ctx) -{ - struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; - struct r600_bc_alu alu; - int i, j, r; - - for (i = 0; i < 4; i++) { - memset(&alu, 0, sizeof(struct r600_bc_alu)); - if (inst->Dst[0].Register.WriteMask & (1 << i)) { - alu.inst = ctx->inst_info->r600_opcode; - for (j = 0; j < inst->Instruction.NumSrcRegs; j++) { - r = tgsi_src(ctx, &inst->Src[j], &alu.src[j]); - if (r) - return r; - alu.src[j].chan = tgsi_chan(&inst->Src[j], i); - } - r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); - if (r) - return r; - alu.last = 1; - r = r600_bc_add_alu(ctx->bc, &alu); - if (r) - return r; - } - } - return 0; -} - static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 911d4835b4f..f5ec5cde37b 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -32,10 +32,7 @@ #include #include #include -#include #include -#include -#include #include #include #include @@ -184,7 +181,7 @@ static void r600_draw_common(struct r600_drawl *draw) r600_context_draw(&rctx->ctx, &rdraw); } -void r600_translate_index_buffer2(struct r600_pipe_context *r600, +void r600_translate_index_buffer(struct r600_pipe_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, unsigned *start, unsigned count) @@ -229,7 +226,7 @@ void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.max_index = info->max_index; draw.index_bias = info->index_bias; - r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer, + r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer, &rctx->index_buffer.index_size, &draw.start, info->count); @@ -251,145 +248,6 @@ void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info) pipe_resource_reference(&draw.index_buffer, NULL); } - -static void r600_blitter_save_states(struct pipe_context *ctx) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - - util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]); - util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]); - if (rctx->states[R600_PIPE_STATE_STENCIL_REF]) { - util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref); - } - util_blitter_save_rasterizer(rctx->blitter, rctx->states[R600_PIPE_STATE_RASTERIZER]); - util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader); - util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader); - util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements); - if (rctx->states[R600_PIPE_STATE_VIEWPORT]) { - util_blitter_save_viewport(rctx->blitter, &rctx->viewport); - } - if (rctx->states[R600_PIPE_STATE_CLIP]) { - util_blitter_save_clip(rctx->blitter, &rctx->clip); - } - util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer); - - rctx->vertex_elements = NULL; - - /* TODO queries */ -} - -int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state fb = *rctx->pframebuffer; - struct pipe_surface *zsurf, *cbsurf; - int level = 0; - float depth = 1.0f; - - r600_context_queries_suspend(&rctx->ctx); - for (int i = 0; i < fb.nr_cbufs; i++) { - fb.cbufs[i] = NULL; - pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]); - } - fb.zsbuf = NULL; - pipe_surface_reference(&fb.zsbuf, rctx->pframebuffer->zsbuf); - - zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0, - PIPE_BIND_DEPTH_STENCIL); - - cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0, - PIPE_BIND_RENDER_TARGET); - - r600_blitter_save_states(ctx); - util_blitter_save_framebuffer(rctx->blitter, &fb); - - if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || - rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) - depth = 0.0f; - - util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth); - - pipe_surface_reference(&zsurf, NULL); - pipe_surface_reference(&cbsurf, NULL); - for (int i = 0; i < fb.nr_cbufs; i++) { - pipe_surface_reference(&fb.cbufs[i], NULL); - } - pipe_surface_reference(&fb.zsbuf, NULL); - r600_context_queries_resume(&rctx->ctx); - - return 0; -} - -static void r600_clear(struct pipe_context *ctx, unsigned buffers, - const float *rgba, double depth, unsigned stencil) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer; - - r600_context_queries_suspend(&rctx->ctx); - r600_blitter_save_states(ctx); - util_blitter_clear(rctx->blitter, fb->width, fb->height, - fb->nr_cbufs, buffers, rgba, depth, - stencil); - r600_context_queries_resume(&rctx->ctx); -} - -static void r600_clear_render_target(struct pipe_context *ctx, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer; - - r600_context_queries_suspend(&rctx->ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - util_blitter_clear_render_target(rctx->blitter, dst, rgba, - dstx, dsty, width, height); - r600_context_queries_resume(&rctx->ctx); -} - -static void r600_clear_depth_stencil(struct pipe_context *ctx, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) -{ - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct pipe_framebuffer_state *fb = &rctx->framebuffer; - - r600_context_queries_suspend(&rctx->ctx); - util_blitter_save_framebuffer(rctx->blitter, fb); - util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, - dstx, dsty, width, height); - r600_context_queries_resume(&rctx->ctx); -} - - -static void r600_resource_copy_region(struct pipe_context *ctx, - struct pipe_resource *dst, - struct pipe_subresource subdst, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - struct pipe_subresource subsrc, - unsigned srcx, unsigned srcy, unsigned srcz, - unsigned width, unsigned height) -{ - util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, - src, subsrc, srcx, srcy, srcz, width, height); -} - -void r600_init_blit_functions2(struct r600_pipe_context *rctx) -{ - rctx->context.clear = r600_clear; - rctx->context.clear_render_target = r600_clear_render_target; - rctx->context.clear_depth_stencil = r600_clear_depth_stencil; - rctx->context.resource_copy_region = r600_resource_copy_region; -} - static void r600_set_blend_color(struct pipe_context *ctx, const struct pipe_blend_color *state) { diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index 2c1b2f5be45..8753e2bab17 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -1,33 +1,9 @@ - #include "state_tracker/drm_driver.h" #include "target-helpers/inline_debug_helper.h" #include "r600/drm/r600_drm_public.h" #include "r600/r600_public.h" -#if 0 -static struct pipe_screen * -create_screen(int fd) -{ - struct radeon *rw; - struct pipe_screen *screen; - - rw = r600_drm_winsys_create(fd); - if (!rw) - return NULL; - - screen = r600_screen_create(rw); - if (!screen) - return NULL; - - screen = debug_screen_wrap(screen); - - return screen; -} -#else -struct radeon *r600_new(int fd, unsigned device); -struct pipe_screen *r600_screen_create2(struct radeon *radeon); -static struct pipe_screen * -create_screen(int fd) +static struct pipe_screen *create_screen(int fd) { struct radeon *radeon; struct pipe_screen *screen; @@ -36,7 +12,7 @@ create_screen(int fd) if (!radeon) return NULL; - screen = r600_screen_create2(radeon); + screen = r600_screen_create(radeon); if (!screen) return NULL; @@ -44,6 +20,5 @@ create_screen(int fd) return screen; } -#endif DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen) diff --git a/src/gallium/winsys/r600/drm/Makefile b/src/gallium/winsys/r600/drm/Makefile index 41e736c9cde..f407817a8ea 100644 --- a/src/gallium/winsys/r600/drm/Makefile +++ b/src/gallium/winsys/r600/drm/Makefile @@ -6,14 +6,14 @@ LIBNAME = r600winsys C_SOURCES = \ bof.c \ - r600_state2.c \ - evergreen_state.c \ - r600.c \ - r600_drm.c \ + evergreen_hw_context.c \ radeon_bo.c \ + radeon_bo_pb.c \ radeon_pciid.c \ radeon_ws_bo.c \ - radeon_bo_pb.c + r600.c \ + r600_drm.c \ + r600_hw_context.c LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r600 \ $(shell pkg-config libdrm --cflags-only-I) diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c new file mode 100644 index 00000000000..7ba778e9f42 --- /dev/null +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -0,0 +1,857 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Jerome Glisse + */ +#include +#include +#include +#include +#include +#include "xf86drm.h" +#include "r600.h" +#include "evergreend.h" +#include "radeon_drm.h" +#include "bof.h" +#include "pipe/p_compiler.h" +#include "util/u_inlines.h" +#include +#include "r600_priv.h" + +struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); + +#define GROUP_FORCE_NEW_BLOCK 0 + +static const struct r600_reg evergreen_config_reg_list[] = { + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008A14_PA_CL_ENHANCE, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C20_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C24_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C28_SQ_STACK_RESOURCE_MGMT_3, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_009100_SPI_CONFIG_CNTL, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0}, +}; + +static const struct r600_reg evergreen_context_reg_list[] = { + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028008_DB_DEPTH_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02800C_DB_RENDER_OVERRIDE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028010_DB_RENDER_OVERRIDE2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028014_DB_HTILE_DATA_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028040_DB_Z_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028044_DB_STENCIL_INFO, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028048_DB_Z_READ_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02804C_DB_STENCIL_READ_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028050_DB_Z_WRITE_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028054_DB_STENCIL_WRITE_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028058_DB_DEPTH_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02805C_DB_DEPTH_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285BC_PA_CL_UCP0_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C0_PA_CL_UCP0_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C4_PA_CL_UCP0_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C8_PA_CL_UCP0_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285CC_PA_CL_UCP1_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D0_PA_CL_UCP1_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D4_PA_CL_UCP1_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D8_PA_CL_UCP1_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285DC_PA_CL_UCP2_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E0_PA_CL_UCP2_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E4_PA_CL_UCP2_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E8_PA_CL_UCP2_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285EC_PA_CL_UCP3_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F0_PA_CL_UCP3_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F4_PA_CL_UCP3_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F8_PA_CL_UCP3_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285FC_PA_CL_UCP4_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028600_PA_CL_UCP4_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028604_PA_CL_UCP4_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028608_PA_CL_UCP4_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02860C_PA_CL_UCP5_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028610_PA_CL_UCP5_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028614_PA_CL_UCP5_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028618_PA_CL_UCP5_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02863C_SPI_VS_OUT_ID_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028640_SPI_VS_OUT_ID_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E0_SPI_BARYC_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E4_SPI_PS_IN_CONTROL_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E8_SPI_COMPUTE_INPUT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028844_SQ_PGM_RESOURCES_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028848_SQ_PGM_RESOURCES_2_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02884C_SQ_PGM_EXPORTS_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02885C_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028860_SQ_PGM_RESOURCES_VS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028864_SQ_PGM_RESOURCES_2_VS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A8_SQ_PGM_RESOURCES_FS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288EC_SQ_LDS_ALLOC_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028900_SQ_ESGS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028904_SQ_GSVS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02891C_SQ_GS_VERT_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MODE_CNTL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028ABC_DB_HTILE_SURFACE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC8_DB_PRELOAD_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B54_VGT_SHADER_STAGES_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B70_DB_ALPHA_TO_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B94_VGT_STRMOUT_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C08_PA_SU_VTX_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C3C_PA_SC_AA_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C60_CB_COLOR0_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C64_CB_COLOR0_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA0_CB_COLOR1_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB8_CB_COLOR1_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D18_CB_COLOR3_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D54_CB_COLOR4_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D90_CB_COLOR5_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DCC_CB_COLOR6_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E08_CB_COLOR7_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E44_CB_COLOR8_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E60_CB_COLOR9_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E7C_CB_COLOR10_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E98_CB_COLOR11_PITCH, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0}, +}; + +/* SHADER RESOURCE R600/R700 */ +static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_resource[] = { + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_resource[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_resource, nreg); +} + +/* SHADER SAMPLER R600/R700 */ +static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_sampler[] = { + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_sampler[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_sampler, nreg); +} + +/* SHADER SAMPLER BORDER R600/R700 */ +static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id) +{ + struct r600_reg r600_shader_sampler_border[] = { + {PKT3_SET_CONFIG_REG, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); + unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + struct r600_range *range; + struct r600_block *block; + int r; + + for (int i = 0; i < nreg; i++) { + r600_shader_sampler_border[i].offset -= R_00A400_TD_PS_SAMPLER0_BORDER_INDEX; + r600_shader_sampler_border[i].offset += fake_offset; + } + r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg); + if (r) { + return r; + } + /* set proper offset */ + range = &ctx->range[CTX_RANGE_ID(ctx, r600_shader_sampler_border[0].offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, r600_shader_sampler_border[0].offset)]; + block->pm4[1] = (offset - EVERGREEN_CONFIG_REG_OFFSET) >> 2; + return 0; +} + +int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) +{ + int r; + + memset(ctx, 0, sizeof(struct r600_context)); + radeon->use_mem_constant = TRUE; + ctx->radeon = radeon; + LIST_INITHEAD(&ctx->query_list); + + /* initialize hash */ + ctx->hash_size = 19; + ctx->hash_shift = 11; + for (int i = 0; i < 256; i++) { + ctx->range[i].start_offset = i << ctx->hash_shift; + ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1; + ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*)); + if (ctx->range[i].blocks == NULL) { + return -ENOMEM; + } + } + + /* add blocks */ + r = r600_context_add_block(ctx, evergreen_config_reg_list, + sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg)); + if (r) + goto out_err; + r = r600_context_add_block(ctx, evergreen_context_reg_list, + sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg)); + if (r) + goto out_err; + + /* PS SAMPLER */ + for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) { + r = r600_state_sampler_init(ctx, offset); + if (r) + goto out_err; + } + /* VS SAMPLER */ + for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) { + r = r600_state_sampler_init(ctx, offset); + if (r) + goto out_err; + } + /* PS SAMPLER BORDER */ + for (int j = 0; j < 18; j++) { + r = evergreen_state_sampler_border_init(ctx, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, j); + if (r) + goto out_err; + } + /* VS SAMPLER BORDER */ + for (int j = 0; j < 18; j++) { + r = evergreen_state_sampler_border_init(ctx, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, j); + if (r) + goto out_err; + } + /* PS RESOURCE */ + for (int j = 0, offset = 0; j < 176; j++, offset += 0x20) { + r = evergreen_state_resource_init(ctx, offset); + if (r) + goto out_err; + } + /* VS RESOURCE */ + for (int j = 0, offset = 0x1600; j < 160; j++, offset += 0x20) { + r = evergreen_state_resource_init(ctx, offset); + if (r) + goto out_err; + } + + /* setup block table */ + ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); + for (int i = 0, c = 0; i < 256; i++) { + for (int j = 0; j < (1 << ctx->hash_shift); j++) { + if (ctx->range[i].blocks[j]) { + assert(c < ctx->nblocks); + ctx->blocks[c++] = ctx->range[i].blocks[j]; + j += (ctx->range[i].blocks[j]->nreg << 2) - 1; + } + } + } + + /* allocate cs variables */ + ctx->nreloc = RADEON_CTX_MAX_PM4; + ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); + if (ctx->reloc == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx->bo = calloc(ctx->nreloc, sizeof(void *)); + if (ctx->bo == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; + ctx->pm4 = calloc(ctx->pm4_ndwords, 4); + if (ctx->pm4 == NULL) { + r = -ENOMEM; + goto out_err; + } + return 0; +out_err: + r600_context_fini(ctx); + return r; +} + +static inline void evergreen_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + return; + } + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->reg[3] = state->regs[3].value; + block->reg[4] = state->regs[4].value; + block->reg[5] = state->regs[5].value; + block->reg[6] = state->regs[6].value; + block->reg[7] = state->regs[7].value; + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + if (state->regs[0].bo) { + /* VERTEX RESOURCE, we preted there is 2 bo to relocate so + * we have single case btw VERTEX & TEXTURE resource + */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + } else { + /* TEXTURE RESOURCE */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x20 * rid; + + evergreen_context_pipe_state_set_resource(ctx, state, offset); +} + +void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x1600 + 0x20 * rid; + + evergreen_context_pipe_state_set_resource(ctx, state, offset); +} + +static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) +{ + unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, fake_offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } + if (state->nregs <= 3) { + return; + } + block->reg[0] = id; + block->reg[1] = state->regs[3].value; + block->reg[2] = state->regs[4].value; + block->reg[3] = state->regs[5].value; + block->reg[4] = state->regs[6].value; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) +{ + unsigned offset; + + offset = 0x0003C000 + id * 0xc; + evergreen_context_pipe_state_set_sampler(ctx, state, offset); + evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id); +} + +void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) +{ + unsigned offset; + + offset = 0x0003C0D8 + id * 0xc; + evergreen_context_pipe_state_set_sampler(ctx, state, offset); + evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id); +} + + +void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw) +{ + struct radeon_bo *cb[12]; + unsigned ndwords = 9; + + if (draw->indices) { + ndwords = 13; + /* make sure there is enough relocation space before scheduling draw */ + if (ctx->creloc >= (ctx->nreloc - 1)) { + r600_context_flush(ctx); + } + } + + /* find number of color buffer */ + cb[0] = r600_context_reg_bo(ctx, R_028C60_CB_COLOR0_BASE); + cb[1] = r600_context_reg_bo(ctx, R_028C9C_CB_COLOR1_BASE); + cb[2] = r600_context_reg_bo(ctx, R_028CD8_CB_COLOR2_BASE); + cb[3] = r600_context_reg_bo(ctx, R_028D14_CB_COLOR3_BASE); + cb[4] = r600_context_reg_bo(ctx, R_028D50_CB_COLOR4_BASE); + cb[5] = r600_context_reg_bo(ctx, R_028D8C_CB_COLOR5_BASE); + cb[6] = r600_context_reg_bo(ctx, R_028DC8_CB_COLOR6_BASE); + cb[7] = r600_context_reg_bo(ctx, R_028E04_CB_COLOR7_BASE); + cb[8] = r600_context_reg_bo(ctx, R_028E40_CB_COLOR8_BASE); + cb[9] = r600_context_reg_bo(ctx, R_028E5C_CB_COLOR9_BASE); + cb[10] = r600_context_reg_bo(ctx, R_028E78_CB_COLOR10_BASE); + cb[11] = r600_context_reg_bo(ctx, R_028E94_CB_COLOR11_BASE); + for (int i = 0; i < 12; i++) { + if (cb[i]) { + ndwords += 7; + } + } + + /* queries need some special values */ + if (ctx->num_query_running) { + r600_context_reg(ctx, + R_028004_DB_COUNT_CONTROL, + S_028004_PERFECT_ZPASS_COUNTS(1), + S_028004_PERFECT_ZPASS_COUNTS(1)); + r600_context_reg(ctx, + R_02800C_DB_RENDER_OVERRIDE, + S_02800C_NOOP_CULL_DISABLE(1), + S_02800C_NOOP_CULL_DISABLE(1)); + } + + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { + /* need to flush */ + r600_context_flush(ctx); + } + /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */ + if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) { + R600_ERR("context is too big to be scheduled\n"); + return; + } + + /* enough room to copy packet */ + for (int i = 0; i < ctx->nblocks; i++) { + if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { + r600_context_block_emit_dirty(ctx, ctx->blocks[i]); + } + } + + /* draw packet */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; + if (draw->indices) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); + ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); + } else { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; + } + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + + /* flush color buffer */ + for (int i = 0; i < 8; i++) { + if (cb[i]) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + S_0085F0_CB_ACTION_ENA(1); + ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); + } + } + + /* all dirty state have been scheduled in current cs */ + ctx->pm4_dirty_cdwords = 0; +} + +static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->reg[3] = state->regs[3].value; + block->reg[4] = state->regs[4].value; + block->reg[5] = state->regs[5].value; + block->reg[6] = state->regs[6].value; + block->reg[7] = state->regs[7].value; + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + if (state->regs[0].bo) { + /* VERTEX RESOURCE, we preted there is 2 bo to relocate so + * we have single case btw VERTEX & TEXTURE resource + */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + } else { + /* TEXTURE RESOURCE */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid; + + evergreen_resource_set(ctx, state, offset); +} + +void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid; + + evergreen_resource_set(ctx, state, offset); +} diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c deleted file mode 100644 index 7ba778e9f42..00000000000 --- a/src/gallium/winsys/r600/drm/evergreen_state.c +++ /dev/null @@ -1,857 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include -#include -#include -#include "xf86drm.h" -#include "r600.h" -#include "evergreend.h" -#include "radeon_drm.h" -#include "bof.h" -#include "pipe/p_compiler.h" -#include "util/u_inlines.h" -#include -#include "r600_priv.h" - -struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); - -#define GROUP_FORCE_NEW_BLOCK 0 - -static const struct r600_reg evergreen_config_reg_list[] = { - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008A14_PA_CL_ENHANCE, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C20_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C24_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C28_SQ_STACK_RESOURCE_MGMT_3, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_009100_SPI_CONFIG_CNTL, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0}, -}; - -static const struct r600_reg evergreen_context_reg_list[] = { - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028008_DB_DEPTH_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02800C_DB_RENDER_OVERRIDE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028010_DB_RENDER_OVERRIDE2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028014_DB_HTILE_DATA_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028040_DB_Z_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028044_DB_STENCIL_INFO, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028048_DB_Z_READ_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02804C_DB_STENCIL_READ_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028050_DB_Z_WRITE_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028054_DB_STENCIL_WRITE_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028058_DB_DEPTH_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02805C_DB_DEPTH_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285BC_PA_CL_UCP0_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C0_PA_CL_UCP0_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C4_PA_CL_UCP0_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C8_PA_CL_UCP0_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285CC_PA_CL_UCP1_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D0_PA_CL_UCP1_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D4_PA_CL_UCP1_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D8_PA_CL_UCP1_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285DC_PA_CL_UCP2_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E0_PA_CL_UCP2_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E4_PA_CL_UCP2_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E8_PA_CL_UCP2_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285EC_PA_CL_UCP3_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F0_PA_CL_UCP3_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F4_PA_CL_UCP3_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F8_PA_CL_UCP3_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285FC_PA_CL_UCP4_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028600_PA_CL_UCP4_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028604_PA_CL_UCP4_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028608_PA_CL_UCP4_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02860C_PA_CL_UCP5_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028610_PA_CL_UCP5_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028614_PA_CL_UCP5_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028618_PA_CL_UCP5_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02863C_SPI_VS_OUT_ID_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028640_SPI_VS_OUT_ID_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E0_SPI_BARYC_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E4_SPI_PS_IN_CONTROL_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E8_SPI_COMPUTE_INPUT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028844_SQ_PGM_RESOURCES_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028848_SQ_PGM_RESOURCES_2_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02884C_SQ_PGM_EXPORTS_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02885C_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028860_SQ_PGM_RESOURCES_VS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028864_SQ_PGM_RESOURCES_2_VS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A8_SQ_PGM_RESOURCES_FS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288EC_SQ_LDS_ALLOC_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028900_SQ_ESGS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028904_SQ_GSVS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02891C_SQ_GS_VERT_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MODE_CNTL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028ABC_DB_HTILE_SURFACE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC8_DB_PRELOAD_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B54_VGT_SHADER_STAGES_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B70_DB_ALPHA_TO_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B94_VGT_STRMOUT_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C08_PA_SU_VTX_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C3C_PA_SC_AA_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C60_CB_COLOR0_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C64_CB_COLOR0_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA0_CB_COLOR1_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB8_CB_COLOR1_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D18_CB_COLOR3_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D54_CB_COLOR4_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D90_CB_COLOR5_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DCC_CB_COLOR6_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E08_CB_COLOR7_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E44_CB_COLOR8_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E60_CB_COLOR9_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E7C_CB_COLOR10_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E98_CB_COLOR11_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0}, -}; - -/* SHADER RESOURCE R600/R700 */ -static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_resource[] = { - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_resource[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_resource, nreg); -} - -/* SHADER SAMPLER R600/R700 */ -static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_sampler[] = { - {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, - {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, - {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_sampler[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_sampler, nreg); -} - -/* SHADER SAMPLER BORDER R600/R700 */ -static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id) -{ - struct r600_reg r600_shader_sampler_border[] = { - {PKT3_SET_CONFIG_REG, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); - unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; - struct r600_range *range; - struct r600_block *block; - int r; - - for (int i = 0; i < nreg; i++) { - r600_shader_sampler_border[i].offset -= R_00A400_TD_PS_SAMPLER0_BORDER_INDEX; - r600_shader_sampler_border[i].offset += fake_offset; - } - r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg); - if (r) { - return r; - } - /* set proper offset */ - range = &ctx->range[CTX_RANGE_ID(ctx, r600_shader_sampler_border[0].offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, r600_shader_sampler_border[0].offset)]; - block->pm4[1] = (offset - EVERGREEN_CONFIG_REG_OFFSET) >> 2; - return 0; -} - -int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) -{ - int r; - - memset(ctx, 0, sizeof(struct r600_context)); - radeon->use_mem_constant = TRUE; - ctx->radeon = radeon; - LIST_INITHEAD(&ctx->query_list); - - /* initialize hash */ - ctx->hash_size = 19; - ctx->hash_shift = 11; - for (int i = 0; i < 256; i++) { - ctx->range[i].start_offset = i << ctx->hash_shift; - ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1; - ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*)); - if (ctx->range[i].blocks == NULL) { - return -ENOMEM; - } - } - - /* add blocks */ - r = r600_context_add_block(ctx, evergreen_config_reg_list, - sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg)); - if (r) - goto out_err; - r = r600_context_add_block(ctx, evergreen_context_reg_list, - sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg)); - if (r) - goto out_err; - - /* PS SAMPLER */ - for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) { - r = r600_state_sampler_init(ctx, offset); - if (r) - goto out_err; - } - /* VS SAMPLER */ - for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) { - r = r600_state_sampler_init(ctx, offset); - if (r) - goto out_err; - } - /* PS SAMPLER BORDER */ - for (int j = 0; j < 18; j++) { - r = evergreen_state_sampler_border_init(ctx, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, j); - if (r) - goto out_err; - } - /* VS SAMPLER BORDER */ - for (int j = 0; j < 18; j++) { - r = evergreen_state_sampler_border_init(ctx, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, j); - if (r) - goto out_err; - } - /* PS RESOURCE */ - for (int j = 0, offset = 0; j < 176; j++, offset += 0x20) { - r = evergreen_state_resource_init(ctx, offset); - if (r) - goto out_err; - } - /* VS RESOURCE */ - for (int j = 0, offset = 0x1600; j < 160; j++, offset += 0x20) { - r = evergreen_state_resource_init(ctx, offset); - if (r) - goto out_err; - } - - /* setup block table */ - ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); - for (int i = 0, c = 0; i < 256; i++) { - for (int j = 0; j < (1 << ctx->hash_shift); j++) { - if (ctx->range[i].blocks[j]) { - assert(c < ctx->nblocks); - ctx->blocks[c++] = ctx->range[i].blocks[j]; - j += (ctx->range[i].blocks[j]->nreg << 2) - 1; - } - } - } - - /* allocate cs variables */ - ctx->nreloc = RADEON_CTX_MAX_PM4; - ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); - if (ctx->reloc == NULL) { - r = -ENOMEM; - goto out_err; - } - ctx->bo = calloc(ctx->nreloc, sizeof(void *)); - if (ctx->bo == NULL) { - r = -ENOMEM; - goto out_err; - } - ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; - ctx->pm4 = calloc(ctx->pm4_ndwords, 4); - if (ctx->pm4 == NULL) { - r = -ENOMEM; - goto out_err; - } - return 0; -out_err: - r600_context_fini(ctx); - return r; -} - -static inline void evergreen_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - if (state == NULL) { - block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - return; - } - block->reg[0] = state->regs[0].value; - block->reg[1] = state->regs[1].value; - block->reg[2] = state->regs[2].value; - block->reg[3] = state->regs[3].value; - block->reg[4] = state->regs[4].value; - block->reg[5] = state->regs[5].value; - block->reg[6] = state->regs[6].value; - block->reg[7] = state->regs[7].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - if (state->regs[0].bo) { - /* VERTEX RESOURCE, we preted there is 2 bo to relocate so - * we have single case btw VERTEX & TEXTURE resource - */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); - } else { - /* TEXTURE RESOURCE */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); - } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x20 * rid; - - evergreen_context_pipe_state_set_resource(ctx, state, offset); -} - -void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x1600 + 0x20 * rid; - - evergreen_context_pipe_state_set_resource(ctx, state, offset); -} - -static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - if (state == NULL) { - block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - return; - } - block->reg[0] = state->regs[0].value; - block->reg[1] = state->regs[1].value; - block->reg[2] = state->regs[2].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) -{ - unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, fake_offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)]; - if (state == NULL) { - block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - return; - } - if (state->nregs <= 3) { - return; - } - block->reg[0] = id; - block->reg[1] = state->regs[3].value; - block->reg[2] = state->regs[4].value; - block->reg[3] = state->regs[5].value; - block->reg[4] = state->regs[6].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) -{ - unsigned offset; - - offset = 0x0003C000 + id * 0xc; - evergreen_context_pipe_state_set_sampler(ctx, state, offset); - evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id); -} - -void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) -{ - unsigned offset; - - offset = 0x0003C0D8 + id * 0xc; - evergreen_context_pipe_state_set_sampler(ctx, state, offset); - evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id); -} - - -void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw) -{ - struct radeon_bo *cb[12]; - unsigned ndwords = 9; - - if (draw->indices) { - ndwords = 13; - /* make sure there is enough relocation space before scheduling draw */ - if (ctx->creloc >= (ctx->nreloc - 1)) { - r600_context_flush(ctx); - } - } - - /* find number of color buffer */ - cb[0] = r600_context_reg_bo(ctx, R_028C60_CB_COLOR0_BASE); - cb[1] = r600_context_reg_bo(ctx, R_028C9C_CB_COLOR1_BASE); - cb[2] = r600_context_reg_bo(ctx, R_028CD8_CB_COLOR2_BASE); - cb[3] = r600_context_reg_bo(ctx, R_028D14_CB_COLOR3_BASE); - cb[4] = r600_context_reg_bo(ctx, R_028D50_CB_COLOR4_BASE); - cb[5] = r600_context_reg_bo(ctx, R_028D8C_CB_COLOR5_BASE); - cb[6] = r600_context_reg_bo(ctx, R_028DC8_CB_COLOR6_BASE); - cb[7] = r600_context_reg_bo(ctx, R_028E04_CB_COLOR7_BASE); - cb[8] = r600_context_reg_bo(ctx, R_028E40_CB_COLOR8_BASE); - cb[9] = r600_context_reg_bo(ctx, R_028E5C_CB_COLOR9_BASE); - cb[10] = r600_context_reg_bo(ctx, R_028E78_CB_COLOR10_BASE); - cb[11] = r600_context_reg_bo(ctx, R_028E94_CB_COLOR11_BASE); - for (int i = 0; i < 12; i++) { - if (cb[i]) { - ndwords += 7; - } - } - - /* queries need some special values */ - if (ctx->num_query_running) { - r600_context_reg(ctx, - R_028004_DB_COUNT_CONTROL, - S_028004_PERFECT_ZPASS_COUNTS(1), - S_028004_PERFECT_ZPASS_COUNTS(1)); - r600_context_reg(ctx, - R_02800C_DB_RENDER_OVERRIDE, - S_02800C_NOOP_CULL_DISABLE(1), - S_02800C_NOOP_CULL_DISABLE(1)); - } - - if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { - /* need to flush */ - r600_context_flush(ctx); - } - /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */ - if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) { - R600_ERR("context is too big to be scheduled\n"); - return; - } - - /* enough room to copy packet */ - for (int i = 0; i < ctx->nblocks; i++) { - if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { - r600_context_block_emit_dirty(ctx, ctx->blocks[i]); - } - } - - /* draw packet */ - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0); - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; - if (draw->indices) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); - ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; - ctx->pm4[ctx->pm4_cdwords++] = 0; - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); - } else { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; - } - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); - ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - - /* flush color buffer */ - for (int i = 0; i < 8; i++) { - if (cb[i]) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | - S_0085F0_CB_ACTION_ENA(1); - ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; - ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; - ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); - } - } - - /* all dirty state have been scheduled in current cs */ - ctx->pm4_dirty_cdwords = 0; -} - -static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - block->reg[0] = state->regs[0].value; - block->reg[1] = state->regs[1].value; - block->reg[2] = state->regs[2].value; - block->reg[3] = state->regs[3].value; - block->reg[4] = state->regs[4].value; - block->reg[5] = state->regs[5].value; - block->reg[6] = state->regs[6].value; - block->reg[7] = state->regs[7].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - if (state->regs[0].bo) { - /* VERTEX RESOURCE, we preted there is 2 bo to relocate so - * we have single case btw VERTEX & TEXTURE resource - */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); - } else { - /* TEXTURE RESOURCE */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); - } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid; - - evergreen_resource_set(ctx, state, offset); -} - -void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid; - - evergreen_resource_set(ctx, state, offset); -} diff --git a/src/gallium/winsys/r600/drm/r600_drm_public.h b/src/gallium/winsys/r600/drm/r600_drm_public.h index 84f2dce437a..cfce8df9c2c 100644 --- a/src/gallium/winsys/r600/drm/r600_drm_public.h +++ b/src/gallium/winsys/r600/drm/r600_drm_public.h @@ -1,4 +1,28 @@ - +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Jerome Glisse + */ #ifndef R600_DRM_PUBLIC_H #define R600_DRM_PUBLIC_H diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c new file mode 100644 index 00000000000..416fcebc9fe --- /dev/null +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -0,0 +1,1258 @@ +/* + * Copyright 2010 Jerome Glisse + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Jerome Glisse + */ +#include +#include +#include +#include +#include +#include "xf86drm.h" +#include "r600.h" +#include "r600d.h" +#include "radeon_drm.h" +#include "bof.h" +#include "pipe/p_compiler.h" +#include "util/u_inlines.h" +#include +#include "r600_priv.h" + +#define GROUP_FORCE_NEW_BLOCK 0 + +int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); +void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); +void radeon_bo_reference(struct radeon *radeon, + struct radeon_bo **dst, + struct radeon_bo *src); + +unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); +void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); + +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) +{ + struct r600_block *block; + struct r600_range *range; + int offset; + + for (unsigned i = 0, n = 0; i < nreg; i += n) { + u32 j; + + /* ignore new block balise */ + if (reg[i].offset == GROUP_FORCE_NEW_BLOCK) { + n = 1; + continue; + } + + /* register that need relocation are in their own group */ + /* find number of consecutive registers */ + n = 0; + offset = reg[i].offset; + while (reg[i + n].offset == offset) { + n++; + offset += 4; + if ((n + i) >= nreg) + break; + if (n >= (R600_BLOCK_MAX_REG - 2)) + break; + } + + /* allocate new block */ + block = calloc(1, sizeof(struct r600_block)); + if (block == NULL) { + return -ENOMEM; + } + ctx->nblocks++; + for (int j = 0; j < n; j++) { + range = &ctx->range[CTX_RANGE_ID(ctx, reg[i + j].offset)]; + range->blocks[CTX_BLOCK_ID(ctx, reg[i + j].offset)] = block; + } + + /* initialize block */ + block->start_offset = reg[i].offset; + block->pm4[block->pm4_ndwords++] = PKT3(reg[i].opcode, n); + block->pm4[block->pm4_ndwords++] = (block->start_offset - reg[i].offset_base) >> 2; + block->reg = &block->pm4[block->pm4_ndwords]; + block->pm4_ndwords += n; + block->nreg = n; + for (j = 0; j < n; j++) { + if (reg[i+j].need_bo) { + block->nbo++; + assert(block->nbo < R600_BLOCK_MAX_BO); + block->pm4_bo_index[j] = block->nbo; + block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0); + block->pm4[block->pm4_ndwords++] = 0x00000000; + block->reloc[block->nbo].bo_pm4_index[block->reloc[block->nbo].nreloc++] = block->pm4_ndwords - 1; + } + } + for (j = 0; j < n; j++) { + if (reg[i+j].flush_flags) { + unsigned id; + + block->pm4[block->pm4_ndwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + block->pm4[block->pm4_ndwords++] = reg[i+j].flush_flags; + block->pm4[block->pm4_ndwords++] = 0xFFFFFFFF; + block->pm4[block->pm4_ndwords++] = 0x00000000; + block->pm4[block->pm4_ndwords++] = 0x0000000A; + block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0); + block->pm4[block->pm4_ndwords++] = 0x00000000; + id = block->pm4_bo_index[j]; + block->reloc[id].bo_pm4_index[block->reloc[id].nreloc++] = block->pm4_ndwords - 1; + } + } + /* check that we stay in limit */ + assert(block->pm4_ndwords < R600_BLOCK_MAX_REG); + } + return 0; +} + +/* R600/R700 configuration */ +static const struct r600_reg r600_config_reg_list[] = { + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C10_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C14_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009508_TA_CNTL_AUX, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009714_VC_ENHANCE, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009830_DB_DEBUG, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0}, +}; + +static const struct r600_reg r600_context_reg_list[] = { + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB0_VGT_STRMOUT_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028B20_VGT_STRMOUT_BUFFER_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E0_CB_COLOR0_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C0_CB_COLOR0_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028100_CB_COLOR0_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E4_CB_COLOR1_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C4_CB_COLOR1_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028104_CB_COLOR1_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E8_CB_COLOR2_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C8_CB_COLOR2_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028108_CB_COLOR2_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280EC_CB_COLOR3_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280CC_CB_COLOR3_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02810C_CB_COLOR3_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F0_CB_COLOR4_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D0_CB_COLOR4_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028110_CB_COLOR4_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F4_CB_COLOR5_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F8_CB_COLOR6_FRAG, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D8_CB_COLOR6_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028118_CB_COLOR6_MASK, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, 1, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280DC_CB_COLOR7_TILE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02811C_CB_COLOR7_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028120_CB_CLEAR_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028424_CB_FOG_RED, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028428_CB_FOG_GREEN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02842C_CB_FOG_BLUE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E0_SPI_FOG_FUNC_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E4_SPI_FOG_FUNC_BIAS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0287A0_CB_SHADER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028804_CB_BLEND_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C30_CB_CLRCMP_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C34_CB_CLRCMP_SRC, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C38_CB_CLRCMP_DST, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C3C_CB_CLRCMP_MSK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C48_PA_SC_AA_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D44_DB_ALPHA_TO_MASK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02800C_DB_DEPTH_BASE, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028000_DB_DEPTH_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028004_DB_DEPTH_VIEW, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028010_DB_DEPTH_INFO, 1, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D0C_DB_RENDER_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D10_DB_RENDER_OVERRIDE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D24_DB_HTILE_SURFACE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D30_DB_PRELOAD_CONTROL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D34_DB_PREFETCH_LIMIT, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A0C_PA_SC_LINE_STIPPLE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MPASS_PS_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E20_PA_CL_UCP0_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E24_PA_CL_UCP0_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E28_PA_CL_UCP0_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E2C_PA_CL_UCP0_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E30_PA_CL_UCP1_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E34_PA_CL_UCP1_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E38_PA_CL_UCP1_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E3C_PA_CL_UCP1_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E40_PA_CL_UCP2_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E44_PA_CL_UCP2_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E48_PA_CL_UCP2_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E4C_PA_CL_UCP2_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E50_PA_CL_UCP3_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E54_PA_CL_UCP3_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E58_PA_CL_UCP3_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E5C_PA_CL_UCP3_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E60_PA_CL_UCP4_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E64_PA_CL_UCP4_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E68_PA_CL_UCP4_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E6C_PA_CL_UCP4_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E70_PA_CL_UCP5_X, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E74_PA_CL_UCP5_Y, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E78_PA_CL_UCP5_Z, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E7C_PA_CL_UCP5_W, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028614_SPI_VS_OUT_ID_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028618_SPI_VS_OUT_ID_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028858_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028868_SQ_PGM_RESOURCES_VS, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028894_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_RESOURCES_FS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028850_SQ_PGM_RESOURCES_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028854_SQ_PGM_EXPORTS_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A84_VGT_PRIMITIVEID_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0}, +}; + +/* SHADER CONSTANT R600/R700 */ +static int r600_state_constant_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_constant[] = { + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030000_SQ_ALU_CONSTANT0_0, 0, 0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030004_SQ_ALU_CONSTANT1_0, 0, 0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030008_SQ_ALU_CONSTANT2_0, 0, 0}, + {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_03000C_SQ_ALU_CONSTANT3_0, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_constant)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_constant[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_constant, nreg); +} + +/* SHADER RESOURCE R600/R700 */ +static int r600_state_resource_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_resource[] = { + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038000_RESOURCE0_WORD0, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038004_RESOURCE0_WORD1, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_03800C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038010_RESOURCE0_WORD4, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_resource[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_resource, nreg); +} + +/* SHADER SAMPLER R600/R700 */ +static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_sampler[] = { + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_sampler[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_sampler, nreg); +} + +/* SHADER SAMPLER BORDER R600/R700 */ +static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) +{ + struct r600_reg r600_shader_sampler_border[] = { + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A400_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, + }; + unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); + + for (int i = 0; i < nreg; i++) { + r600_shader_sampler_border[i].offset += offset; + } + return r600_context_add_block(ctx, r600_shader_sampler_border, nreg); +} + +/* initialize */ +void r600_context_fini(struct r600_context *ctx) +{ + struct r600_block *block; + struct r600_range *range; + + for (int i = 0; i < 256; i++) { + for (int j = 0; j < (1 << ctx->hash_shift); j++) { + block = ctx->range[i].blocks[j]; + if (block) { + for (int k = 0, offset = block->start_offset; k < block->nreg; k++, offset += 4) { + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + range->blocks[CTX_BLOCK_ID(ctx, offset)] = NULL; + } + free(block); + } + } + free(ctx->range[i].blocks); + } + free(ctx->reloc); + free(ctx->pm4); + memset(ctx, 0, sizeof(struct r600_context)); +} + +int r600_context_init(struct r600_context *ctx, struct radeon *radeon) +{ + int r; + + memset(ctx, 0, sizeof(struct r600_context)); + ctx->radeon = radeon; + LIST_INITHEAD(&ctx->query_list); + + /* initialize hash */ + ctx->hash_size = 19; + ctx->hash_shift = 11; + for (int i = 0; i < 256; i++) { + ctx->range[i].start_offset = i << ctx->hash_shift; + ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1; + ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*)); + if (ctx->range[i].blocks == NULL) { + return -ENOMEM; + } + } + + /* add blocks */ + r = r600_context_add_block(ctx, r600_config_reg_list, + sizeof(r600_config_reg_list)/sizeof(struct r600_reg)); + if (r) + goto out_err; + r = r600_context_add_block(ctx, r600_context_reg_list, + sizeof(r600_context_reg_list)/sizeof(struct r600_reg)); + if (r) + goto out_err; + + /* PS SAMPLER BORDER */ + for (int j = 0, offset = 0; j < 18; j++, offset += 0x10) { + r = r600_state_sampler_border_init(ctx, offset); + if (r) + goto out_err; + } + + /* VS SAMPLER BORDER */ + for (int j = 0, offset = 0x200; j < 18; j++, offset += 0x10) { + r = r600_state_sampler_border_init(ctx, offset); + if (r) + goto out_err; + } + /* PS SAMPLER */ + for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) { + r = r600_state_sampler_init(ctx, offset); + if (r) + goto out_err; + } + /* VS SAMPLER */ + for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) { + r = r600_state_sampler_init(ctx, offset); + if (r) + goto out_err; + } + /* PS RESOURCE */ + for (int j = 0, offset = 0; j < 160; j++, offset += 0x1C) { + r = r600_state_resource_init(ctx, offset); + if (r) + goto out_err; + } + /* VS RESOURCE */ + for (int j = 0, offset = 0x1180; j < 160; j++, offset += 0x1C) { + r = r600_state_resource_init(ctx, offset); + if (r) + goto out_err; + } + /* PS CONSTANT */ + for (int j = 0, offset = 0; j < 256; j++, offset += 0x10) { + r = r600_state_constant_init(ctx, offset); + if (r) + goto out_err; + } + /* VS CONSTANT */ + for (int j = 0, offset = 0x1000; j < 256; j++, offset += 0x10) { + r = r600_state_constant_init(ctx, offset); + if (r) + goto out_err; + } + + /* setup block table */ + ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); + for (int i = 0, c = 0; i < 256; i++) { + for (int j = 0, add; j < (1 << ctx->hash_shift); j++) { + if (ctx->range[i].blocks[j]) { + add = 1; + for (int k = 0; k < c; k++) { + if (ctx->blocks[k] == ctx->range[i].blocks[j]) { + add = 0; + break; + } + } + if (add) { + assert(c < ctx->nblocks); + ctx->blocks[c++] = ctx->range[i].blocks[j]; + j += (ctx->range[i].blocks[j]->nreg << 2) - 1; + } + } + } + } + + /* allocate cs variables */ + ctx->nreloc = RADEON_CTX_MAX_PM4; + ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); + if (ctx->reloc == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx->bo = calloc(ctx->nreloc, sizeof(void *)); + if (ctx->bo == NULL) { + r = -ENOMEM; + goto out_err; + } + ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; + ctx->pm4 = calloc(ctx->pm4_ndwords, 4); + if (ctx->pm4 == NULL) { + r = -ENOMEM; + goto out_err; + } + return 0; +out_err: + r600_context_fini(ctx); + return r; +} + +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo) +{ + int i, reloc_id; + + assert(bo != NULL); + for (i = 0, reloc_id = -1; i < ctx->creloc; i++) { + if (ctx->reloc[i].handle == bo->handle) { + reloc_id = i * sizeof(struct r600_reloc) / 4; + /* set PKT3 to point to proper reloc */ + *pm4 = reloc_id; + } + } + if (reloc_id == -1) { + /* add new relocation */ + if (ctx->creloc >= ctx->nreloc) { + r600_context_flush(ctx); + } + reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4; + ctx->reloc[ctx->creloc].handle = bo->handle; + ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT; + ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT; + ctx->reloc[ctx->creloc].flags = 0; + radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); + ctx->creloc++; + /* set PKT3 to point to proper reloc */ + *pm4 = reloc_id; + } +} + +void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state) +{ + struct r600_range *range; + struct r600_block *block; + + for (int i = 0; i < state->nregs; i++) { + unsigned id; + + range = &ctx->range[CTX_RANGE_ID(ctx, state->regs[i].offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, state->regs[i].offset)]; + id = (state->regs[i].offset - block->start_offset) >> 2; + block->reg[id] &= ~state->regs[i].mask; + block->reg[id] |= state->regs[i].value; + if (block->pm4_bo_index[id]) { + /* find relocation */ + id = block->pm4_bo_index[id]; + radeon_ws_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } +} + +static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + return; + } + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->reg[3] = state->regs[3].value; + block->reg[4] = state->regs[4].value; + block->reg[5] = state->regs[5].value; + block->reg[6] = state->regs[6].value; + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + if (state->regs[0].bo) { + /* VERTEX RESOURCE, we preted there is 2 bo to relocate so + * we have single case btw VERTEX & TEXTURE resource + */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + } else { + /* TEXTURE RESOURCE */ + radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + } + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1C * rid; + + r600_context_pipe_state_set_resource(ctx, state, offset); +} + +void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1180 + 0x1C * rid; + + r600_context_pipe_state_set_resource(ctx, state, offset); +} + +static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } + block->reg[0] = state->regs[0].value; + block->reg[1] = state->regs[1].value; + block->reg[2] = state->regs[2].value; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + if (state == NULL) { + block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + return; + } + if (state->nregs <= 3) { + return; + } + block->reg[0] = state->regs[3].value; + block->reg[1] = state->regs[4].value; + block->reg[2] = state->regs[5].value; + block->reg[3] = state->regs[6].value; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; +} + +void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) +{ + unsigned offset; + + offset = 0x0003C000 + id * 0xc; + r600_context_pipe_state_set_sampler(ctx, state, offset); + offset = 0x0000A400 + id * 0x10; + r600_context_pipe_state_set_sampler_border(ctx, state, offset); +} + +void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) +{ + unsigned offset; + + offset = 0x0003C0D8 + id * 0xc; + r600_context_pipe_state_set_sampler(ctx, state, offset); + offset = 0x0000A600 + id * 0x10; + r600_context_pipe_state_set_sampler_border(ctx, state, offset); +} + +struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) +{ + struct r600_range *range; + struct r600_block *block; + unsigned id; + + range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; + block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; + offset -= block->start_offset; + id = block->pm4_bo_index[offset >> 2]; + if (block->reloc[id].bo) { + return radeon_bo_pb_get_bo(block->reloc[id].bo->pb); + } + return NULL; +} + +void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) +{ + struct radeon_bo *cb[8]; + unsigned ndwords = 9; + + if (draw->indices) { + ndwords = 13; + /* make sure there is enough relocation space before scheduling draw */ + if (ctx->creloc >= (ctx->nreloc - 1)) { + r600_context_flush(ctx); + } + } + + /* find number of color buffer */ + cb[0] = r600_context_reg_bo(ctx, R_028040_CB_COLOR0_BASE); + cb[1] = r600_context_reg_bo(ctx, R_028044_CB_COLOR1_BASE); + cb[2] = r600_context_reg_bo(ctx, R_028048_CB_COLOR2_BASE); + cb[3] = r600_context_reg_bo(ctx, R_02804C_CB_COLOR3_BASE); + cb[4] = r600_context_reg_bo(ctx, R_028050_CB_COLOR4_BASE); + cb[5] = r600_context_reg_bo(ctx, R_028054_CB_COLOR5_BASE); + cb[6] = r600_context_reg_bo(ctx, R_028058_CB_COLOR6_BASE); + cb[7] = r600_context_reg_bo(ctx, R_02805C_CB_COLOR7_BASE); + for (int i = 0; i < 8; i++) { + if (cb[i]) { + ndwords += 7; + } + } + + /* queries need some special values */ + if (ctx->num_query_running) { + if (ctx->radeon->family >= CHIP_RV770) { + r600_context_reg(ctx, + R_028D0C_DB_RENDER_CONTROL, + S_028D0C_R700_PERFECT_ZPASS_COUNTS(1), + S_028D0C_R700_PERFECT_ZPASS_COUNTS(1)); + } + r600_context_reg(ctx, + R_028D10_DB_RENDER_OVERRIDE, + S_028D10_NOOP_CULL_DISABLE(1), + S_028D10_NOOP_CULL_DISABLE(1)); + } + + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { + /* need to flush */ + r600_context_flush(ctx); + } + /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */ + if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) { + R600_ERR("context is too big to be scheduled\n"); + return; + } + + /* enough room to copy packet */ + for (int i = 0; i < ctx->nblocks; i++) { + if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { + r600_context_block_emit_dirty(ctx, ctx->blocks[i]); + } + } + + /* draw packet */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; + if (draw->indices) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); + ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); + } else { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; + ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; + } + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; + + /* flush color buffer */ + for (int i = 0; i < 8; i++) { + if (cb[i]) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + S_0085F0_CB_ACTION_ENA(1); + ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); + } + } + + /* all dirty state have been scheduled in current cs */ + ctx->pm4_dirty_cdwords = 0; +} + +void r600_context_flush(struct r600_context *ctx) +{ + struct drm_radeon_cs drmib; + struct drm_radeon_cs_chunk chunks[2]; + uint64_t chunk_array[2]; + int r; + + if (!ctx->pm4_cdwords) + return; + + /* suspend queries */ + r600_context_queries_suspend(ctx); + + radeon_bo_pbmgr_flush_maps(ctx->radeon->kman); +#if 1 + /* emit cs */ + drmib.num_chunks = 2; + drmib.chunks = (uint64_t)(uintptr_t)chunk_array; + chunks[0].chunk_id = RADEON_CHUNK_ID_IB; + chunks[0].length_dw = ctx->pm4_cdwords; + chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; + chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; + chunks[1].length_dw = ctx->creloc * sizeof(struct r600_reloc) / 4; + chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc; + chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0]; + chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1]; + r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib, + sizeof(struct drm_radeon_cs)); +#endif + /* restart */ + for (int i = 0; i < ctx->creloc; i++) { + radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); + } + ctx->creloc = 0; + ctx->pm4_dirty_cdwords = 0; + ctx->pm4_cdwords = 0; + + /* resume queries */ + r600_context_queries_resume(ctx); + + /* set all valid group as dirty so they get reemited on + * next draw command + */ + for (int i = 0; i < ctx->nblocks; i++) { + if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) { + ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords; + ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY; + } + } +} + +void r600_context_dump_bof(struct r600_context *ctx, const char *file) +{ + bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root; + unsigned i; + + root = device_id = bcs = blob = array = bo = size = handle = NULL; + root = bof_object(); + if (root == NULL) + goto out_err; + device_id = bof_int32(ctx->radeon->device); + if (device_id == NULL) + goto out_err; + if (bof_object_set(root, "device_id", device_id)) + goto out_err; + bof_decref(device_id); + device_id = NULL; + /* dump relocs */ + blob = bof_blob(ctx->creloc * 16, ctx->reloc); + if (blob == NULL) + goto out_err; + if (bof_object_set(root, "reloc", blob)) + goto out_err; + bof_decref(blob); + blob = NULL; + /* dump cs */ + blob = bof_blob(ctx->pm4_cdwords * 4, ctx->pm4); + if (blob == NULL) + goto out_err; + if (bof_object_set(root, "pm4", blob)) + goto out_err; + bof_decref(blob); + blob = NULL; + /* dump bo */ + array = bof_array(); + if (array == NULL) + goto out_err; + for (i = 0; i < ctx->creloc; i++) { + struct radeon_bo *rbo = ctx->bo[i]; + bo = bof_object(); + if (bo == NULL) + goto out_err; + size = bof_int32(rbo->size); + if (size == NULL) + goto out_err; + if (bof_object_set(bo, "size", size)) + goto out_err; + bof_decref(size); + size = NULL; + handle = bof_int32(rbo->handle); + if (handle == NULL) + goto out_err; + if (bof_object_set(bo, "handle", handle)) + goto out_err; + bof_decref(handle); + handle = NULL; + radeon_bo_map(ctx->radeon, rbo); + blob = bof_blob(rbo->size, rbo->data); + radeon_bo_unmap(ctx->radeon, rbo); + if (blob == NULL) + goto out_err; + if (bof_object_set(bo, "data", blob)) + goto out_err; + bof_decref(blob); + blob = NULL; + if (bof_array_append(array, bo)) + goto out_err; + bof_decref(bo); + bo = NULL; + } + if (bof_object_set(root, "bo", array)) + goto out_err; + bof_dump_file(root, file); +out_err: + bof_decref(blob); + bof_decref(array); + bof_decref(bo); + bof_decref(size); + bof_decref(handle); + bof_decref(device_id); + bof_decref(root); +} + +static void r600_query_result(struct r600_context *ctx, struct r600_query *query) +{ + u64 start, end; + u32 *results; + int i; + + results = radeon_ws_bo_map(ctx->radeon, query->buffer, 0, NULL); + for (i = 0; i < query->num_results; i += 4) { + start = (u64)results[i] | (u64)results[i + 1] << 32; + end = (u64)results[i + 2] | (u64)results[i + 3] << 32; + if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) { + query->result += end - start; + } + } + radeon_ws_bo_unmap(ctx->radeon, query->buffer); + query->num_results = 0; +} + +void r600_query_begin(struct r600_context *ctx, struct r600_query *query) +{ + /* query request needs 6 dwords for begin + 6 dwords for end */ + if ((12 + ctx->pm4_cdwords) > ctx->pm4_ndwords) { + /* need to flush */ + r600_context_flush(ctx); + } + + /* if query buffer is full force a flush */ + if (query->num_results >= ((query->buffer_size >> 2) - 2)) { + r600_context_flush(ctx); + r600_query_result(ctx, query); + } + + /* emit begin query */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; + ctx->pm4[ctx->pm4_cdwords++] = query->num_results; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); + + query->state |= R600_QUERY_STATE_STARTED; + query->state ^= R600_QUERY_STATE_ENDED; + ctx->num_query_running++; +} + +void r600_query_end(struct r600_context *ctx, struct r600_query *query) +{ + /* emit begin query */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; + ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); + + query->num_results += 16; + query->state ^= R600_QUERY_STATE_STARTED; + query->state |= R600_QUERY_STATE_ENDED; + ctx->num_query_running--; +} + +struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type) +{ + struct r600_query *query; + + if (query_type != PIPE_QUERY_OCCLUSION_COUNTER) + return NULL; + + query = calloc(1, sizeof(struct r600_query)); + if (query == NULL) + return NULL; + + query->type = query_type; + query->buffer_size = 4096; + + query->buffer = radeon_ws_bo(ctx->radeon, query->buffer_size, 1, 0); + if (!query->buffer) { + free(query); + return NULL; + } + + LIST_ADDTAIL(&query->list, &ctx->query_list); + + return query; +} + +void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query) +{ + radeon_ws_bo_reference(ctx->radeon, &query->buffer, NULL); + LIST_DEL(&query->list); + free(query); +} + +boolean r600_context_query_result(struct r600_context *ctx, + struct r600_query *query, + boolean wait, void *vresult) +{ + uint64_t *result = (uint64_t*)vresult; + + if (query->num_results) { + r600_context_flush(ctx); + } + r600_query_result(ctx, query); + *result = query->result; + query->result = 0; + return TRUE; +} + +void r600_context_queries_suspend(struct r600_context *ctx) +{ + struct r600_query *query; + + LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) { + if (query->state & R600_QUERY_STATE_STARTED) { + r600_query_end(ctx, query); + query->state |= R600_QUERY_STATE_SUSPENDED; + } + } +} + +void r600_context_queries_resume(struct r600_context *ctx) +{ + struct r600_query *query; + + LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) { + if (query->state & R600_QUERY_STATE_SUSPENDED) { + r600_query_begin(ctx, query); + query->state ^= R600_QUERY_STATE_SUSPENDED; + } + } +} diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c deleted file mode 100644 index 416fcebc9fe..00000000000 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ /dev/null @@ -1,1258 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Jerome Glisse - */ -#include -#include -#include -#include -#include -#include "xf86drm.h" -#include "r600.h" -#include "r600d.h" -#include "radeon_drm.h" -#include "bof.h" -#include "pipe/p_compiler.h" -#include "util/u_inlines.h" -#include -#include "r600_priv.h" - -#define GROUP_FORCE_NEW_BLOCK 0 - -int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_reference(struct radeon *radeon, - struct radeon_bo **dst, - struct radeon_bo *src); - -unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); -void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); - -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) -{ - struct r600_block *block; - struct r600_range *range; - int offset; - - for (unsigned i = 0, n = 0; i < nreg; i += n) { - u32 j; - - /* ignore new block balise */ - if (reg[i].offset == GROUP_FORCE_NEW_BLOCK) { - n = 1; - continue; - } - - /* register that need relocation are in their own group */ - /* find number of consecutive registers */ - n = 0; - offset = reg[i].offset; - while (reg[i + n].offset == offset) { - n++; - offset += 4; - if ((n + i) >= nreg) - break; - if (n >= (R600_BLOCK_MAX_REG - 2)) - break; - } - - /* allocate new block */ - block = calloc(1, sizeof(struct r600_block)); - if (block == NULL) { - return -ENOMEM; - } - ctx->nblocks++; - for (int j = 0; j < n; j++) { - range = &ctx->range[CTX_RANGE_ID(ctx, reg[i + j].offset)]; - range->blocks[CTX_BLOCK_ID(ctx, reg[i + j].offset)] = block; - } - - /* initialize block */ - block->start_offset = reg[i].offset; - block->pm4[block->pm4_ndwords++] = PKT3(reg[i].opcode, n); - block->pm4[block->pm4_ndwords++] = (block->start_offset - reg[i].offset_base) >> 2; - block->reg = &block->pm4[block->pm4_ndwords]; - block->pm4_ndwords += n; - block->nreg = n; - for (j = 0; j < n; j++) { - if (reg[i+j].need_bo) { - block->nbo++; - assert(block->nbo < R600_BLOCK_MAX_BO); - block->pm4_bo_index[j] = block->nbo; - block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0); - block->pm4[block->pm4_ndwords++] = 0x00000000; - block->reloc[block->nbo].bo_pm4_index[block->reloc[block->nbo].nreloc++] = block->pm4_ndwords - 1; - } - } - for (j = 0; j < n; j++) { - if (reg[i+j].flush_flags) { - unsigned id; - - block->pm4[block->pm4_ndwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - block->pm4[block->pm4_ndwords++] = reg[i+j].flush_flags; - block->pm4[block->pm4_ndwords++] = 0xFFFFFFFF; - block->pm4[block->pm4_ndwords++] = 0x00000000; - block->pm4[block->pm4_ndwords++] = 0x0000000A; - block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0); - block->pm4[block->pm4_ndwords++] = 0x00000000; - id = block->pm4_bo_index[j]; - block->reloc[id].bo_pm4_index[block->reloc[id].nreloc++] = block->pm4_ndwords - 1; - } - } - /* check that we stay in limit */ - assert(block->pm4_ndwords < R600_BLOCK_MAX_REG); - } - return 0; -} - -/* R600/R700 configuration */ -static const struct r600_reg r600_config_reg_list[] = { - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C10_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C14_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009508_TA_CNTL_AUX, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009714_VC_ENHANCE, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009830_DB_DEBUG, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0}, -}; - -static const struct r600_reg r600_context_reg_list[] = { - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB0_VGT_STRMOUT_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028B20_VGT_STRMOUT_BUFFER_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E0_CB_COLOR0_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C0_CB_COLOR0_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028100_CB_COLOR0_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E4_CB_COLOR1_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C4_CB_COLOR1_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028104_CB_COLOR1_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E8_CB_COLOR2_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C8_CB_COLOR2_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028108_CB_COLOR2_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280EC_CB_COLOR3_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280CC_CB_COLOR3_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02810C_CB_COLOR3_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F0_CB_COLOR4_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D0_CB_COLOR4_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028110_CB_COLOR4_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F4_CB_COLOR5_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F8_CB_COLOR6_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D8_CB_COLOR6_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028118_CB_COLOR6_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280DC_CB_COLOR7_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02811C_CB_COLOR7_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028120_CB_CLEAR_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028424_CB_FOG_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028428_CB_FOG_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02842C_CB_FOG_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E0_SPI_FOG_FUNC_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E4_SPI_FOG_FUNC_BIAS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0287A0_CB_SHADER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028804_CB_BLEND_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C30_CB_CLRCMP_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C34_CB_CLRCMP_SRC, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C38_CB_CLRCMP_DST, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C3C_CB_CLRCMP_MSK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C48_PA_SC_AA_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D44_DB_ALPHA_TO_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02800C_DB_DEPTH_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028000_DB_DEPTH_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028004_DB_DEPTH_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028010_DB_DEPTH_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D0C_DB_RENDER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D10_DB_RENDER_OVERRIDE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D24_DB_HTILE_SURFACE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D30_DB_PRELOAD_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D34_DB_PREFETCH_LIMIT, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A0C_PA_SC_LINE_STIPPLE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MPASS_PS_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E20_PA_CL_UCP0_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E24_PA_CL_UCP0_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E28_PA_CL_UCP0_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E2C_PA_CL_UCP0_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E30_PA_CL_UCP1_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E34_PA_CL_UCP1_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E38_PA_CL_UCP1_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E3C_PA_CL_UCP1_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E40_PA_CL_UCP2_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E44_PA_CL_UCP2_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E48_PA_CL_UCP2_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E4C_PA_CL_UCP2_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E50_PA_CL_UCP3_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E54_PA_CL_UCP3_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E58_PA_CL_UCP3_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E5C_PA_CL_UCP3_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E60_PA_CL_UCP4_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E64_PA_CL_UCP4_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E68_PA_CL_UCP4_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E6C_PA_CL_UCP4_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E70_PA_CL_UCP5_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E74_PA_CL_UCP5_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E78_PA_CL_UCP5_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E7C_PA_CL_UCP5_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028614_SPI_VS_OUT_ID_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028618_SPI_VS_OUT_ID_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028858_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028868_SQ_PGM_RESOURCES_VS, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028894_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_RESOURCES_FS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028850_SQ_PGM_RESOURCES_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028854_SQ_PGM_EXPORTS_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A84_VGT_PRIMITIVEID_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0}, -}; - -/* SHADER CONSTANT R600/R700 */ -static int r600_state_constant_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_constant[] = { - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030000_SQ_ALU_CONSTANT0_0, 0, 0}, - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030004_SQ_ALU_CONSTANT1_0, 0, 0}, - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030008_SQ_ALU_CONSTANT2_0, 0, 0}, - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_03000C_SQ_ALU_CONSTANT3_0, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_constant)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_constant[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_constant, nreg); -} - -/* SHADER RESOURCE R600/R700 */ -static int r600_state_resource_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_resource[] = { - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038000_RESOURCE0_WORD0, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038004_RESOURCE0_WORD1, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_03800C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038010_RESOURCE0_WORD4, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_resource[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_resource, nreg); -} - -/* SHADER SAMPLER R600/R700 */ -static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_sampler[] = { - {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, - {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, - {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_sampler[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_sampler, nreg); -} - -/* SHADER SAMPLER BORDER R600/R700 */ -static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_sampler_border[] = { - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A400_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_sampler_border[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_sampler_border, nreg); -} - -/* initialize */ -void r600_context_fini(struct r600_context *ctx) -{ - struct r600_block *block; - struct r600_range *range; - - for (int i = 0; i < 256; i++) { - for (int j = 0; j < (1 << ctx->hash_shift); j++) { - block = ctx->range[i].blocks[j]; - if (block) { - for (int k = 0, offset = block->start_offset; k < block->nreg; k++, offset += 4) { - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - range->blocks[CTX_BLOCK_ID(ctx, offset)] = NULL; - } - free(block); - } - } - free(ctx->range[i].blocks); - } - free(ctx->reloc); - free(ctx->pm4); - memset(ctx, 0, sizeof(struct r600_context)); -} - -int r600_context_init(struct r600_context *ctx, struct radeon *radeon) -{ - int r; - - memset(ctx, 0, sizeof(struct r600_context)); - ctx->radeon = radeon; - LIST_INITHEAD(&ctx->query_list); - - /* initialize hash */ - ctx->hash_size = 19; - ctx->hash_shift = 11; - for (int i = 0; i < 256; i++) { - ctx->range[i].start_offset = i << ctx->hash_shift; - ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1; - ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*)); - if (ctx->range[i].blocks == NULL) { - return -ENOMEM; - } - } - - /* add blocks */ - r = r600_context_add_block(ctx, r600_config_reg_list, - sizeof(r600_config_reg_list)/sizeof(struct r600_reg)); - if (r) - goto out_err; - r = r600_context_add_block(ctx, r600_context_reg_list, - sizeof(r600_context_reg_list)/sizeof(struct r600_reg)); - if (r) - goto out_err; - - /* PS SAMPLER BORDER */ - for (int j = 0, offset = 0; j < 18; j++, offset += 0x10) { - r = r600_state_sampler_border_init(ctx, offset); - if (r) - goto out_err; - } - - /* VS SAMPLER BORDER */ - for (int j = 0, offset = 0x200; j < 18; j++, offset += 0x10) { - r = r600_state_sampler_border_init(ctx, offset); - if (r) - goto out_err; - } - /* PS SAMPLER */ - for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) { - r = r600_state_sampler_init(ctx, offset); - if (r) - goto out_err; - } - /* VS SAMPLER */ - for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) { - r = r600_state_sampler_init(ctx, offset); - if (r) - goto out_err; - } - /* PS RESOURCE */ - for (int j = 0, offset = 0; j < 160; j++, offset += 0x1C) { - r = r600_state_resource_init(ctx, offset); - if (r) - goto out_err; - } - /* VS RESOURCE */ - for (int j = 0, offset = 0x1180; j < 160; j++, offset += 0x1C) { - r = r600_state_resource_init(ctx, offset); - if (r) - goto out_err; - } - /* PS CONSTANT */ - for (int j = 0, offset = 0; j < 256; j++, offset += 0x10) { - r = r600_state_constant_init(ctx, offset); - if (r) - goto out_err; - } - /* VS CONSTANT */ - for (int j = 0, offset = 0x1000; j < 256; j++, offset += 0x10) { - r = r600_state_constant_init(ctx, offset); - if (r) - goto out_err; - } - - /* setup block table */ - ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); - for (int i = 0, c = 0; i < 256; i++) { - for (int j = 0, add; j < (1 << ctx->hash_shift); j++) { - if (ctx->range[i].blocks[j]) { - add = 1; - for (int k = 0; k < c; k++) { - if (ctx->blocks[k] == ctx->range[i].blocks[j]) { - add = 0; - break; - } - } - if (add) { - assert(c < ctx->nblocks); - ctx->blocks[c++] = ctx->range[i].blocks[j]; - j += (ctx->range[i].blocks[j]->nreg << 2) - 1; - } - } - } - } - - /* allocate cs variables */ - ctx->nreloc = RADEON_CTX_MAX_PM4; - ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc)); - if (ctx->reloc == NULL) { - r = -ENOMEM; - goto out_err; - } - ctx->bo = calloc(ctx->nreloc, sizeof(void *)); - if (ctx->bo == NULL) { - r = -ENOMEM; - goto out_err; - } - ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; - ctx->pm4 = calloc(ctx->pm4_ndwords, 4); - if (ctx->pm4 == NULL) { - r = -ENOMEM; - goto out_err; - } - return 0; -out_err: - r600_context_fini(ctx); - return r; -} - -void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo) -{ - int i, reloc_id; - - assert(bo != NULL); - for (i = 0, reloc_id = -1; i < ctx->creloc; i++) { - if (ctx->reloc[i].handle == bo->handle) { - reloc_id = i * sizeof(struct r600_reloc) / 4; - /* set PKT3 to point to proper reloc */ - *pm4 = reloc_id; - } - } - if (reloc_id == -1) { - /* add new relocation */ - if (ctx->creloc >= ctx->nreloc) { - r600_context_flush(ctx); - } - reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4; - ctx->reloc[ctx->creloc].handle = bo->handle; - ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT; - ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT; - ctx->reloc[ctx->creloc].flags = 0; - radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); - ctx->creloc++; - /* set PKT3 to point to proper reloc */ - *pm4 = reloc_id; - } -} - -void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state) -{ - struct r600_range *range; - struct r600_block *block; - - for (int i = 0; i < state->nregs; i++) { - unsigned id; - - range = &ctx->range[CTX_RANGE_ID(ctx, state->regs[i].offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, state->regs[i].offset)]; - id = (state->regs[i].offset - block->start_offset) >> 2; - block->reg[id] &= ~state->regs[i].mask; - block->reg[id] |= state->regs[i].value; - if (block->pm4_bo_index[id]) { - /* find relocation */ - id = block->pm4_bo_index[id]; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); - } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; - } -} - -static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - if (state == NULL) { - block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - return; - } - block->reg[0] = state->regs[0].value; - block->reg[1] = state->regs[1].value; - block->reg[2] = state->regs[2].value; - block->reg[3] = state->regs[3].value; - block->reg[4] = state->regs[4].value; - block->reg[5] = state->regs[5].value; - block->reg[6] = state->regs[6].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - if (state->regs[0].bo) { - /* VERTEX RESOURCE, we preted there is 2 bo to relocate so - * we have single case btw VERTEX & TEXTURE resource - */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); - } else { - /* TEXTURE RESOURCE */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); - } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1C * rid; - - r600_context_pipe_state_set_resource(ctx, state, offset); -} - -void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1180 + 0x1C * rid; - - r600_context_pipe_state_set_resource(ctx, state, offset); -} - -static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - if (state == NULL) { - block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - return; - } - block->reg[0] = state->regs[0].value; - block->reg[1] = state->regs[1].value; - block->reg[2] = state->regs[2].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - if (state == NULL) { - block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - return; - } - if (state->nregs <= 3) { - return; - } - block->reg[0] = state->regs[3].value; - block->reg[1] = state->regs[4].value; - block->reg[2] = state->regs[5].value; - block->reg[3] = state->regs[6].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; -} - -void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) -{ - unsigned offset; - - offset = 0x0003C000 + id * 0xc; - r600_context_pipe_state_set_sampler(ctx, state, offset); - offset = 0x0000A400 + id * 0x10; - r600_context_pipe_state_set_sampler_border(ctx, state, offset); -} - -void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) -{ - unsigned offset; - - offset = 0x0003C0D8 + id * 0xc; - r600_context_pipe_state_set_sampler(ctx, state, offset); - offset = 0x0000A600 + id * 0x10; - r600_context_pipe_state_set_sampler_border(ctx, state, offset); -} - -struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - unsigned id; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - offset -= block->start_offset; - id = block->pm4_bo_index[offset >> 2]; - if (block->reloc[id].bo) { - return radeon_bo_pb_get_bo(block->reloc[id].bo->pb); - } - return NULL; -} - -void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) -{ - struct radeon_bo *cb[8]; - unsigned ndwords = 9; - - if (draw->indices) { - ndwords = 13; - /* make sure there is enough relocation space before scheduling draw */ - if (ctx->creloc >= (ctx->nreloc - 1)) { - r600_context_flush(ctx); - } - } - - /* find number of color buffer */ - cb[0] = r600_context_reg_bo(ctx, R_028040_CB_COLOR0_BASE); - cb[1] = r600_context_reg_bo(ctx, R_028044_CB_COLOR1_BASE); - cb[2] = r600_context_reg_bo(ctx, R_028048_CB_COLOR2_BASE); - cb[3] = r600_context_reg_bo(ctx, R_02804C_CB_COLOR3_BASE); - cb[4] = r600_context_reg_bo(ctx, R_028050_CB_COLOR4_BASE); - cb[5] = r600_context_reg_bo(ctx, R_028054_CB_COLOR5_BASE); - cb[6] = r600_context_reg_bo(ctx, R_028058_CB_COLOR6_BASE); - cb[7] = r600_context_reg_bo(ctx, R_02805C_CB_COLOR7_BASE); - for (int i = 0; i < 8; i++) { - if (cb[i]) { - ndwords += 7; - } - } - - /* queries need some special values */ - if (ctx->num_query_running) { - if (ctx->radeon->family >= CHIP_RV770) { - r600_context_reg(ctx, - R_028D0C_DB_RENDER_CONTROL, - S_028D0C_R700_PERFECT_ZPASS_COUNTS(1), - S_028D0C_R700_PERFECT_ZPASS_COUNTS(1)); - } - r600_context_reg(ctx, - R_028D10_DB_RENDER_OVERRIDE, - S_028D10_NOOP_CULL_DISABLE(1), - S_028D10_NOOP_CULL_DISABLE(1)); - } - - if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { - /* need to flush */ - r600_context_flush(ctx); - } - /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */ - if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) { - R600_ERR("context is too big to be scheduled\n"); - return; - } - - /* enough room to copy packet */ - for (int i = 0; i < ctx->nblocks; i++) { - if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { - r600_context_block_emit_dirty(ctx, ctx->blocks[i]); - } - } - - /* draw packet */ - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0); - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; - if (draw->indices) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); - ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; - ctx->pm4[ctx->pm4_cdwords++] = 0; - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); - } else { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; - ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; - } - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0); - ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; - - /* flush color buffer */ - for (int i = 0; i < 8; i++) { - if (cb[i]) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | - S_0085F0_CB_ACTION_ENA(1); - ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; - ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; - ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); - } - } - - /* all dirty state have been scheduled in current cs */ - ctx->pm4_dirty_cdwords = 0; -} - -void r600_context_flush(struct r600_context *ctx) -{ - struct drm_radeon_cs drmib; - struct drm_radeon_cs_chunk chunks[2]; - uint64_t chunk_array[2]; - int r; - - if (!ctx->pm4_cdwords) - return; - - /* suspend queries */ - r600_context_queries_suspend(ctx); - - radeon_bo_pbmgr_flush_maps(ctx->radeon->kman); -#if 1 - /* emit cs */ - drmib.num_chunks = 2; - drmib.chunks = (uint64_t)(uintptr_t)chunk_array; - chunks[0].chunk_id = RADEON_CHUNK_ID_IB; - chunks[0].length_dw = ctx->pm4_cdwords; - chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; - chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; - chunks[1].length_dw = ctx->creloc * sizeof(struct r600_reloc) / 4; - chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc; - chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0]; - chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1]; - r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib, - sizeof(struct drm_radeon_cs)); -#endif - /* restart */ - for (int i = 0; i < ctx->creloc; i++) { - radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); - } - ctx->creloc = 0; - ctx->pm4_dirty_cdwords = 0; - ctx->pm4_cdwords = 0; - - /* resume queries */ - r600_context_queries_resume(ctx); - - /* set all valid group as dirty so they get reemited on - * next draw command - */ - for (int i = 0; i < ctx->nblocks; i++) { - if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) { - ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords; - ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY; - } - } -} - -void r600_context_dump_bof(struct r600_context *ctx, const char *file) -{ - bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root; - unsigned i; - - root = device_id = bcs = blob = array = bo = size = handle = NULL; - root = bof_object(); - if (root == NULL) - goto out_err; - device_id = bof_int32(ctx->radeon->device); - if (device_id == NULL) - goto out_err; - if (bof_object_set(root, "device_id", device_id)) - goto out_err; - bof_decref(device_id); - device_id = NULL; - /* dump relocs */ - blob = bof_blob(ctx->creloc * 16, ctx->reloc); - if (blob == NULL) - goto out_err; - if (bof_object_set(root, "reloc", blob)) - goto out_err; - bof_decref(blob); - blob = NULL; - /* dump cs */ - blob = bof_blob(ctx->pm4_cdwords * 4, ctx->pm4); - if (blob == NULL) - goto out_err; - if (bof_object_set(root, "pm4", blob)) - goto out_err; - bof_decref(blob); - blob = NULL; - /* dump bo */ - array = bof_array(); - if (array == NULL) - goto out_err; - for (i = 0; i < ctx->creloc; i++) { - struct radeon_bo *rbo = ctx->bo[i]; - bo = bof_object(); - if (bo == NULL) - goto out_err; - size = bof_int32(rbo->size); - if (size == NULL) - goto out_err; - if (bof_object_set(bo, "size", size)) - goto out_err; - bof_decref(size); - size = NULL; - handle = bof_int32(rbo->handle); - if (handle == NULL) - goto out_err; - if (bof_object_set(bo, "handle", handle)) - goto out_err; - bof_decref(handle); - handle = NULL; - radeon_bo_map(ctx->radeon, rbo); - blob = bof_blob(rbo->size, rbo->data); - radeon_bo_unmap(ctx->radeon, rbo); - if (blob == NULL) - goto out_err; - if (bof_object_set(bo, "data", blob)) - goto out_err; - bof_decref(blob); - blob = NULL; - if (bof_array_append(array, bo)) - goto out_err; - bof_decref(bo); - bo = NULL; - } - if (bof_object_set(root, "bo", array)) - goto out_err; - bof_dump_file(root, file); -out_err: - bof_decref(blob); - bof_decref(array); - bof_decref(bo); - bof_decref(size); - bof_decref(handle); - bof_decref(device_id); - bof_decref(root); -} - -static void r600_query_result(struct r600_context *ctx, struct r600_query *query) -{ - u64 start, end; - u32 *results; - int i; - - results = radeon_ws_bo_map(ctx->radeon, query->buffer, 0, NULL); - for (i = 0; i < query->num_results; i += 4) { - start = (u64)results[i] | (u64)results[i + 1] << 32; - end = (u64)results[i + 2] | (u64)results[i + 3] << 32; - if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) { - query->result += end - start; - } - } - radeon_ws_bo_unmap(ctx->radeon, query->buffer); - query->num_results = 0; -} - -void r600_query_begin(struct r600_context *ctx, struct r600_query *query) -{ - /* query request needs 6 dwords for begin + 6 dwords for end */ - if ((12 + ctx->pm4_cdwords) > ctx->pm4_ndwords) { - /* need to flush */ - r600_context_flush(ctx); - } - - /* if query buffer is full force a flush */ - if (query->num_results >= ((query->buffer_size >> 2) - 2)) { - r600_context_flush(ctx); - r600_query_result(ctx, query); - } - - /* emit begin query */ - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); - ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; - ctx->pm4[ctx->pm4_cdwords++] = query->num_results; - ctx->pm4[ctx->pm4_cdwords++] = 0; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); - - query->state |= R600_QUERY_STATE_STARTED; - query->state ^= R600_QUERY_STATE_ENDED; - ctx->num_query_running++; -} - -void r600_query_end(struct r600_context *ctx, struct r600_query *query) -{ - /* emit begin query */ - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); - ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; - ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8; - ctx->pm4[ctx->pm4_cdwords++] = 0; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); - - query->num_results += 16; - query->state ^= R600_QUERY_STATE_STARTED; - query->state |= R600_QUERY_STATE_ENDED; - ctx->num_query_running--; -} - -struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type) -{ - struct r600_query *query; - - if (query_type != PIPE_QUERY_OCCLUSION_COUNTER) - return NULL; - - query = calloc(1, sizeof(struct r600_query)); - if (query == NULL) - return NULL; - - query->type = query_type; - query->buffer_size = 4096; - - query->buffer = radeon_ws_bo(ctx->radeon, query->buffer_size, 1, 0); - if (!query->buffer) { - free(query); - return NULL; - } - - LIST_ADDTAIL(&query->list, &ctx->query_list); - - return query; -} - -void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query) -{ - radeon_ws_bo_reference(ctx->radeon, &query->buffer, NULL); - LIST_DEL(&query->list); - free(query); -} - -boolean r600_context_query_result(struct r600_context *ctx, - struct r600_query *query, - boolean wait, void *vresult) -{ - uint64_t *result = (uint64_t*)vresult; - - if (query->num_results) { - r600_context_flush(ctx); - } - r600_query_result(ctx, query); - *result = query->result; - query->result = 0; - return TRUE; -} - -void r600_context_queries_suspend(struct r600_context *ctx) -{ - struct r600_query *query; - - LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) { - if (query->state & R600_QUERY_STATE_STARTED) { - r600_query_end(ctx, query); - query->state |= R600_QUERY_STATE_SUSPENDED; - } - } -} - -void r600_context_queries_resume(struct r600_context *ctx) -{ - struct r600_query *query; - - LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) { - if (query->state & R600_QUERY_STATE_SUSPENDED) { - r600_query_begin(ctx, query); - query->state ^= R600_QUERY_STATE_SUSPENDED; - } - } -} -- cgit v1.2.3 From 07a38505c6ee96b6ab1836fa5c0642a2ed86a2b4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:13:09 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. radeon_dataflow_deadcode.c: In function ‘push_branch’: radeon_dataflow_deadcode.c:112: warning: ISO C90 forbids mixed declarations and code radeon_dataflow_deadcode.c: In function ‘update_instruction’: radeon_dataflow_deadcode.c:183: warning: ISO C90 forbids mixed declarations and code radeon_dataflow_deadcode.c: In function ‘rc_dataflow_deadcode’: radeon_dataflow_deadcode.c:352: warning: ISO C90 forbids mixed declarations and code radeon_dataflow_deadcode.c:379: warning: ISO C90 forbids mixed declarations and code --- .../drivers/dri/r300/compiler/radeon_dataflow_deadcode.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c index 9d17b4772ad..87906f37b12 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -106,10 +106,12 @@ static void push_loop(struct deadcode_state * s) static void push_branch(struct deadcode_state * s) { + struct branchinfo * branch; + memory_pool_array_reserve(&s->C->Pool, struct branchinfo, s->BranchStack, s->BranchStackSize, s->BranchStackReserved, 1); - struct branchinfo * branch = &s->BranchStack[s->BranchStackSize++]; + branch = &s->BranchStack[s->BranchStackSize++]; branch->HaveElse = 0; memcpy(&branch->StoreEndif, &s->R, sizeof(s->R)); } @@ -152,6 +154,7 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); struct instruction_state * insts = &s->Instructions[inst->IP]; unsigned int usedmask = 0; + unsigned int srcmasks[3]; if (opcode->HasDstReg) { unsigned char * pused = get_used_ptr(s, inst->U.I.DstReg.File, inst->U.I.DstReg.Index); @@ -180,7 +183,6 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction } } - unsigned int srcmasks[3]; rc_compute_sources_for_writemask(inst, usedmask, srcmasks); for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { @@ -219,6 +221,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void *user) unsigned int nr_instructions; unsigned has_temp_reladdr_src = 0; rc_dataflow_mark_outputs_fn dce = (rc_dataflow_mark_outputs_fn)user; + unsigned int ip; /* Give up if there is relative addressing of destination operands. */ for(struct rc_instruction * inst = c->Program.Instructions.Next; @@ -349,12 +352,14 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void *user) update_instruction(&s, inst); } - unsigned int ip = 0; + ip = 0; for(struct rc_instruction * inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next, ++ip) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); int dead = 1; + unsigned int srcmasks[3]; + unsigned int usemask; if (!opcode->HasDstReg) { dead = 0; @@ -376,8 +381,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void *user) continue; } - unsigned int srcmasks[3]; - unsigned int usemask = s.Instructions[ip].WriteMask; + usemask = s.Instructions[ip].WriteMask; if (inst->U.I.WriteALUResult == RC_ALURESULT_X) usemask |= RC_MASK_X; -- cgit v1.2.3 From 38c31de445c45b59824dac097ad0f93e46a64b77 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:14:34 -0700 Subject: r600g: Fix SCons build. --- src/gallium/winsys/r600/drm/SConscript | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index 55b88fa0d9d..88ee90862b8 100644 --- a/src/gallium/winsys/r600/drm/SConscript +++ b/src/gallium/winsys/r600/drm/SConscript @@ -4,14 +4,14 @@ env = env.Clone() r600_sources = [ 'bof.c', - 'r600_state2.c', - 'evergreen_state.c', - 'r600.c', - 'r600_drm.c', + 'evergreen_hw_context.c', 'radeon_bo.c', + 'radeon_bo_pb.c', 'radeon_pciid.c', 'radeon_ws_bo.c', - 'radeon_bo_pb.c', + 'r600.c', + 'r600_drm.c', + 'r600_hw_context.c', ] env.ParseConfig('pkg-config --cflags libdrm_radeon') -- cgit v1.2.3 From 4cd4fd37aa1a68104c80526923f49cd0998779d9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:30:34 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warning on linux-x86 build. radeon_optimize.c: In function ‘constant_folding’: radeon_optimize.c:419: warning: ISO C90 forbids mixed declarations and code radeon_optimize.c:425: warning: ISO C90 forbids mixed declarations and code radeon_optimize.c:432: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/radeon_optimize.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index 3be50b93e4b..41769e347ec 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -411,27 +411,34 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * /* Replace 0.0, 1.0 and 0.5 immediates by their explicit swizzles */ for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + struct rc_constant * constant; + struct rc_src_register newsrc; + int have_real_reference; + if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT || inst->U.I.SrcReg[src].RelAddr || inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count) continue; - struct rc_constant * constant = + constant = &c->Program.Constants.Constants[inst->U.I.SrcReg[src].Index]; if (constant->Type != RC_CONSTANT_IMMEDIATE) continue; - struct rc_src_register newsrc = inst->U.I.SrcReg[src]; - int have_real_reference = 0; + newsrc = inst->U.I.SrcReg[src]; + have_real_reference = 0; for(unsigned int chan = 0; chan < 4; ++chan) { unsigned int swz = GET_SWZ(newsrc.Swizzle, chan); + unsigned int newswz; + float imm; + float baseimm; + if (swz >= 4) continue; - unsigned int newswz; - float imm = constant->u.Immediate[swz]; - float baseimm = imm; + imm = constant->u.Immediate[swz]; + baseimm = imm; if (imm < 0.0) baseimm = -baseimm; -- cgit v1.2.3 From 0d0273142a4a9a8c895eb6eb90c45772061ae234 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:34:56 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this GCC warning on linux-x86 build. radeon_remove_constants.c: In function ‘rc_remove_unused_constants’: radeon_remove_constants.c:100: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c index c59161640c3..d6c808ad815 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -68,6 +68,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) unsigned are_externals_remapped = 0; struct rc_constant *constants = c->Program.Constants.Constants; struct mark_used_data d; + unsigned new_count; if (!c->Program.Constants.Count) { *out_remap_table = NULL; @@ -97,7 +98,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) * This pass removes unused constants simply by overwriting them by other constants. */ remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); - unsigned new_count = 0; + new_count = 0; for (unsigned i = 0; i < c->Program.Constants.Count; i++) { if (const_used[i]) { -- cgit v1.2.3 From dafbf480dbf30e191594cb505bca6007024262e8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:40:45 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this GCC warning on linux-x86 build. radeon_rename_regs.c: In function ‘rc_rename_regs’: radeon_rename_regs.c:112: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c index 31d25f9ab8a..60e228be5bd 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c @@ -104,13 +104,14 @@ void rc_rename_regs(struct radeon_compiler *c, void *user) inst != &c->Program.Instructions; inst = inst->Next) { const struct rc_opcode_info * info; + unsigned int old_index, temp_index; + struct rc_dst_register * dst; if(inst->Type != RC_INSTRUCTION_NORMAL) { rc_error(c, "%s only works with normal instructions.", __FUNCTION__); return; } - unsigned int old_index, temp_index; - struct rc_dst_register * dst = &inst->U.I.DstReg; + dst = &inst->U.I.DstReg; info = rc_get_opcode_info(inst->U.I.Opcode); if(!info->HasDstReg || dst->File != RC_FILE_TEMPORARY) { continue; -- cgit v1.2.3 From b96a391d14bdfcb4a7183a0767a9b45440330034 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:44:10 -0700 Subject: r300/compiler: Remove declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. r300_fragprog_swizzle.c: In function ‘r300_swizzle_is_native’: r300_fragprog_swizzle.c:120: warning: ISO C90 forbids mixed declarations and code r300_fragprog_swizzle.c: In function ‘r300_swizzle_split’: r300_fragprog_swizzle.c:159: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index caa48fe478c..2d28b065390 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -94,6 +94,9 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle) */ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) { + unsigned int relevant; + int j; + if (reg.Abs) reg.Negate = RC_MASK_NONE; @@ -101,8 +104,6 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) opcode == RC_OPCODE_TEX || opcode == RC_OPCODE_TXB || opcode == RC_OPCODE_TXP) { - int j; - if (reg.Abs || reg.Negate) return 0; @@ -117,8 +118,7 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) return 1; } - unsigned int relevant = 0; - int j; + relevant = 0; for(j = 0; j < 3; ++j) if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED) @@ -154,9 +154,10 @@ static void r300_swizzle_split( unsigned int matchcount = 0; unsigned int matchmask = 0; for(comp = 0; comp < 3; ++comp) { + unsigned int swz; if (!GET_BIT(mask, comp)) continue; - unsigned int swz = GET_SWZ(src.Swizzle, comp); + swz = GET_SWZ(src.Swizzle, comp); if (swz == RC_SWIZZLE_UNUSED) continue; if (swz == GET_SWZ(sd->hash, comp)) { -- cgit v1.2.3 From a4f296d6180d1990916c8e874adb587f6d8cdb7d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 13:56:27 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. r300_fragprog_emit.c: In function ‘emit_alu’: r300_fragprog_emit.c:143: warning: ISO C90 forbids mixed declarations and code r300_fragprog_emit.c:156: warning: ISO C90 forbids mixed declarations and code r300_fragprog_emit.c: In function ‘finish_node’: r300_fragprog_emit.c:271: warning: ISO C90 forbids mixed declarations and code r300_fragprog_emit.c: In function ‘emit_tex’: r300_fragprog_emit.c:344: warning: ISO C90 forbids mixed declarations and code --- .../drivers/dri/r300/compiler/r300_fragprog_emit.c | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 4f13e51bccd..8be32ea91fe 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -133,6 +133,8 @@ static unsigned int translate_alpha_opcode(struct r300_fragment_program_compiler */ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* inst) { + int ip; + int j; PROG_CODE; if (code->alu.length >= c->Base.max_alu_insts) { @@ -140,20 +142,20 @@ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* i return 0; } - int ip = code->alu.length++; - int j; + ip = code->alu.length++; code->alu.inst[ip].rgb_inst = translate_rgb_opcode(c, inst->RGB.Opcode); code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode); for(j = 0; j < 3; ++j) { unsigned int src = use_source(code, inst->RGB.Src[j]); + unsigned int arg; code->alu.inst[ip].rgb_addr |= src << (6*j); src = use_source(code, inst->Alpha.Src[j]); code->alu.inst[ip].alpha_addr |= src << (6*j); - unsigned int arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); + arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); arg |= inst->RGB.Arg[j].Abs << 6; arg |= inst->RGB.Arg[j].Negate << 5; code->alu.inst[ip].rgb_inst |= arg << (7*j); @@ -259,6 +261,10 @@ static int finish_node(struct r300_emit_state * emit) { struct r300_fragment_program_compiler * c = emit->compiler; struct r300_fragment_program_code *code = &emit->compiler->code->code.r300; + unsigned alu_offset; + unsigned alu_end; + unsigned tex_offset; + unsigned tex_end; if (code->alu.length == emit->node_first_alu) { /* Generate a single NOP for this node */ @@ -268,10 +274,10 @@ static int finish_node(struct r300_emit_state * emit) return 0; } - unsigned alu_offset = emit->node_first_alu; - unsigned alu_end = code->alu.length - alu_offset - 1; - unsigned tex_offset = emit->node_first_tex; - unsigned tex_end = code->tex.length - tex_offset - 1; + alu_offset = emit->node_first_alu; + alu_end = code->alu.length - alu_offset - 1; + tex_offset = emit->node_first_tex; + tex_end = code->tex.length - tex_offset - 1; if (code->tex.length == emit->node_first_tex) { if (emit->current_node > 0) { @@ -334,6 +340,9 @@ static int begin_tex(struct r300_emit_state * emit) static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst) { + unsigned int unit; + unsigned int dest; + unsigned int opcode; PROG_CODE; if (code->tex.length >= R300_PFS_MAX_TEX_INST) { @@ -341,9 +350,8 @@ static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst) return 0; } - unsigned int unit = inst->U.I.TexSrcUnit; - unsigned int dest = inst->U.I.DstReg.Index; - unsigned int opcode; + unit = inst->U.I.TexSrcUnit; + dest = inst->U.I.DstReg.Index; switch(inst->U.I.Opcode) { case RC_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break; -- cgit v1.2.3 From ae664daa25ac230e3a97cae0b82b7cd3c392c4bb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 14:04:06 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. r500_fragprog.c: In function ‘r500_transform_IF’: r500_fragprog.c:45: warning: ISO C90 forbids mixed declarations and code r500_fragprog.c: In function ‘r500FragmentProgramDump’: r500_fragprog.c:256: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 627ce374ef1..289bb87ae59 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -39,10 +39,12 @@ int r500_transform_IF( struct rc_instruction * inst, void* data) { + struct rc_instruction * inst_mov; + if (inst->U.I.Opcode != RC_OPCODE_IF) return 0; - struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov = rc_insert_new_instruction(c, inst->Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.WriteMask = 0; inst_mov->U.I.WriteALUResult = RC_ALURESULT_W; @@ -251,12 +253,11 @@ void r500FragmentProgramDump(struct radeon_compiler *c, void *user) { struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c; struct r500_fragment_program_code *code = &compiler->code->code.r500; - fprintf(stderr, "R500 Fragment Program:\n--------\n"); - int n, i; uint32_t inst; uint32_t inst0; char *str = NULL; + fprintf(stderr, "R500 Fragment Program:\n--------\n"); for (n = 0; n < code->inst_end+1; n++) { inst0 = inst = code->inst[n].inst0; -- cgit v1.2.3 From 7c7fdef3b1cfa0db7ec3eb45e39d72ca60753f30 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 14:13:49 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these GCC warnings on linux-x86 build. r500_fragprog_emit.c: In function ‘emit_paired’: r500_fragprog_emit.c:237: warning: ISO C90 forbids mixed declarations and code r500_fragprog_emit.c: In function ‘emit_tex’: r500_fragprog_emit.c:367: warning: ISO C90 forbids mixed declarations and code r500_fragprog_emit.c: In function ‘emit_flowcontrol’: r500_fragprog_emit.c:415: warning: ISO C90 forbids mixed declarations and code r500_fragprog_emit.c: In function ‘r500BuildFragmentProgramHwCode’: r500_fragprog_emit.c:633: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 407d92531a5..6f101c68eb6 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -227,6 +227,7 @@ static void alu_nop(struct r300_fragment_program_compiler *c, int ip) */ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst) { + int ip; PROG_CODE; if (code->inst_end >= c->Base.max_alu_insts-1) { @@ -234,7 +235,7 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair return; } - int ip = ++code->inst_end; + ip = ++code->inst_end; /* Quirk: MDH/MDV (DDX/DDY) need a NOP on previous non-TEX instructions. */ if (inst->RGB.Opcode == RC_OPCODE_DDX || inst->Alpha.Opcode == RC_OPCODE_DDX || @@ -357,6 +358,7 @@ static unsigned int translate_strq_swizzle(unsigned int swizzle) */ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_instruction *inst) { + int ip; PROG_CODE; if (code->inst_end >= c->Base.max_alu_insts-1) { @@ -364,7 +366,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst return 0; } - int ip = ++code->inst_end; + ip = ++code->inst_end; code->inst[ip].inst0 = R500_INST_TYPE_TEX | (inst->DstReg.WriteMask << 11) @@ -407,12 +409,14 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst) { + unsigned int newip; + if (s->Code->inst_end >= s->C->max_alu_insts-1) { rc_error(s->C, "emit_tex: Too many instructions"); return; } - unsigned int newip = ++s->Code->inst_end; + newip = ++s->Code->inst_end; /* Currently all loops use the same integer constant to intialize * the loop variables. */ @@ -623,6 +627,8 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user) if (code->inst_end == -1 || (code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) { + int ip; + /* This may happen when dead-code elimination is disabled or * when most of the fragment program logic is leading to a KIL */ if (code->inst_end >= compiler->Base.max_alu_insts-1) { @@ -630,7 +636,7 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user) return; } - int ip = ++code->inst_end; + ip = ++code->inst_end; code->inst[ip].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT; } -- cgit v1.2.3 From 02b8fb3ed5ac9f3be34b9822c78fa971dfee274d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 29 Sep 2010 14:22:20 -0700 Subject: r300/compiler: Move declaration before code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this GCC warning on linux-x86 build. r3xx_vertprog.c: In function ‘ei_if’: r3xx_vertprog.c:396: warning: ISO C90 forbids mixed declarations and code --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 08785716db5..d7d49e514b9 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -392,9 +392,9 @@ static void ei_if(struct r300_vertex_program_compiler * compiler, * don't already have one. */ if (!compiler->PredicateMask) { unsigned int writemasks[RC_REGISTER_MAX_INDEX]; - memset(writemasks, 0, sizeof(writemasks)); struct rc_instruction * inst; unsigned int i; + memset(writemasks, 0, sizeof(writemasks)); for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { -- cgit v1.2.3 From c7f33624f93fb08264e762e1a6a82b1c99afa58e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 25 Sep 2010 14:55:00 +0100 Subject: trace: Fix set_index_buffer and draw_vbo tracing. --- src/gallium/drivers/trace/tr_context.c | 30 +++++++++++------------------- src/gallium/drivers/trace/tr_dump_state.c | 29 +++++++++++++++++++++++++++++ src/gallium/drivers/trace/tr_dump_state.h | 2 ++ 3 files changed, 42 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 271cd4aff5e..04f30f82c3d 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -92,15 +92,7 @@ trace_context_draw_vbo(struct pipe_context *_pipe, trace_dump_call_begin("pipe_context", "draw_vbo"); trace_dump_arg(ptr, pipe); - trace_dump_arg(bool, info->indexed); - trace_dump_arg(uint, info->mode); - trace_dump_arg(uint, info->start); - trace_dump_arg(uint, info->count); - trace_dump_arg(uint, info->start_instance); - trace_dump_arg(uint, info->instance_count); - trace_dump_arg(int, info->index_bias); - trace_dump_arg(uint, info->min_index); - trace_dump_arg(uint, info->max_index); + trace_dump_arg(draw_info, info); pipe->draw_vbo(pipe, info); @@ -987,24 +979,24 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe, static INLINE void trace_context_set_index_buffer(struct pipe_context *_pipe, - const struct pipe_index_buffer *_ib) + const struct pipe_index_buffer *ib) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - struct pipe_index_buffer unwrapped_ib, *ib = NULL; - - if (_ib) { - unwrapped_ib = *_ib; - unwrapped_ib.buffer = trace_resource_unwrap(tr_ctx, _ib->buffer); - ib = &unwrapped_ib; - } trace_dump_call_begin("pipe_context", "set_index_buffer"); trace_dump_arg(ptr, pipe); - trace_dump_arg(index_buffer, _ib); + trace_dump_arg(index_buffer, ib); - pipe->set_index_buffer(pipe, ib); + if (ib) { + struct pipe_index_buffer _ib; + _ib = *ib; + _ib.buffer = trace_resource_unwrap(tr_ctx, ib->buffer); + pipe->set_index_buffer(pipe, &_ib); + } else { + pipe->set_index_buffer(pipe, NULL); + } trace_dump_call_end(); } diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index bd9a9bfaf16..8f816060324 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -573,3 +573,32 @@ void trace_dump_vertex_element(const struct pipe_vertex_element *state) trace_dump_struct_end(); } + + +void trace_dump_draw_info(const struct pipe_draw_info *state) +{ + if (!trace_dumping_enabled_locked()) + return; + + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_draw_info"); + + trace_dump_member(bool, state, indexed); + + trace_dump_member(uint, state, mode); + trace_dump_member(uint, state, start); + trace_dump_member(uint, state, count); + + trace_dump_member(uint, state, start_instance); + trace_dump_member(uint, state, instance_count); + + trace_dump_member(int, state, index_bias); + trace_dump_member(uint, state, min_index); + trace_dump_member(uint, state, max_index); + + trace_dump_struct_end(); +} diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h index 2e70f4e1c74..078d2086109 100644 --- a/src/gallium/drivers/trace/tr_dump_state.h +++ b/src/gallium/drivers/trace/tr_dump_state.h @@ -79,5 +79,7 @@ void trace_dump_index_buffer(const struct pipe_index_buffer *state); void trace_dump_vertex_element(const struct pipe_vertex_element *state); +void trace_dump_draw_info(const struct pipe_draw_info *state); + #endif /* TR_STATE_H */ -- cgit v1.2.3 From 21f392c9717608873724c121e4aa1b5d6da7566f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 25 Sep 2010 14:55:23 +0100 Subject: python/retrace: Handle set_index_buffer and draw_vbo. --- src/gallium/tests/python/retrace/interpreter.py | 33 ++++++++++--------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/tests/python/retrace/interpreter.py b/src/gallium/tests/python/retrace/interpreter.py index 37d7fd64156..16132abb06d 100755 --- a/src/gallium/tests/python/retrace/interpreter.py +++ b/src/gallium/tests/python/retrace/interpreter.py @@ -111,6 +111,7 @@ struct_factories = { #"pipe_texture": gallium.Texture, 'pipe_subresource': gallium.pipe_subresource, 'pipe_box': gallium.pipe_box, + 'pipe_draw_info': gallium.pipe_draw_info, } @@ -533,30 +534,22 @@ class Context(Object): return minindex + ibias, maxindex + ibias - def draw_arrays(self, mode, start, count): - self.dump_vertices(start, count) - - self.real.draw_arrays(mode, start, count) - self._set_dirty() - - def draw_elements(self, indexBuffer, indexSize, indexBias, mode, start, count): - if self.interpreter.verbosity(2): - minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count) - self.dump_vertices(minindex, maxindex - minindex) + def set_index_buffer(self, ib): + if ib: + self.real.set_index_buffer(ib.index_size, ib.offset, ib.buffer) + else: + self.real.set_index_buffer(0, 0, None) - self.real.draw_elements(indexBuffer, indexSize, indexBias, mode, start, count) - self._set_dirty() - - def draw_range_elements(self, indexBuffer, indexSize, indexBias, minIndex, maxIndex, mode, start, count): + def draw_vbo(self, info): if self.interpreter.verbosity(2): - minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count) - minindex = min(minindex, minIndex) - maxindex = min(maxindex, maxIndex) - self.dump_vertices(minindex, maxindex - minindex) + if 0: + minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count) + + self.dump_vertices(info.minindex, info.maxindex + 1 - info.minindex) - self.real.draw_range_elements(indexBuffer, indexSize, indexBias, minIndex, maxIndex, mode, start, count) + self.real.draw_vbo(info) self._set_dirty() - + def resource_copy_region(self, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height): if dst is not None and src is not None: if self.interpreter.options.all: -- cgit v1.2.3 From e3ccfd4e03e6e2bf3f5a18be80f61819220b4c16 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 29 Sep 2010 22:27:38 +0100 Subject: gallivm: Use SSE4.1's ROUNDSS/ROUNDSD for scalar rounding. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 92 ++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index ff0c7f7ca82..e65c13e64b5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -989,28 +989,67 @@ lp_build_round_sse41(struct lp_build_context *bld, enum lp_build_round_sse41_mode mode) { const struct lp_type type = bld->type; - LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMTypeRef i32t = LLVMInt32Type(); const char *intrinsic; + LLVMValueRef res; assert(type.floating); - assert(type.width*type.length == 128); + assert(lp_check_value(type, a)); assert(util_cpu_caps.has_sse4_1); - switch(type.width) { - case 32: - intrinsic = "llvm.x86.sse41.round.ps"; - break; - case 64: - intrinsic = "llvm.x86.sse41.round.pd"; - break; - default: - assert(0); - return bld->undef; + if (type.length == 1) { + LLVMTypeRef vec_type; + LLVMValueRef undef; + LLVMValueRef args[3]; + LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0); + + switch(type.width) { + case 32: + intrinsic = "llvm.x86.sse41.round.ss"; + break; + case 64: + intrinsic = "llvm.x86.sse41.round.sd"; + break; + default: + assert(0); + return bld->undef; + } + + vec_type = LLVMVectorType(bld->elem_type, 4); + + undef = LLVMGetUndef(vec_type); + + args[0] = undef; + args[1] = LLVMBuildInsertElement(bld->builder, undef, a, index0, ""); + args[2] = LLVMConstInt(i32t, mode, 0); + + res = lp_build_intrinsic(bld->builder, intrinsic, + vec_type, args, Elements(args)); + + res = LLVMBuildExtractElement(bld->builder, res, index0, ""); + } + else { + assert(type.width*type.length == 128); + + switch(type.width) { + case 32: + intrinsic = "llvm.x86.sse41.round.ps"; + break; + case 64: + intrinsic = "llvm.x86.sse41.round.pd"; + break; + default: + assert(0); + return bld->undef; + } + + res = lp_build_intrinsic_binary(bld->builder, intrinsic, + bld->vec_type, a, + LLVMConstInt(i32t, mode, 0)); } - return lp_build_intrinsic_binary(bld->builder, intrinsic, vec_type, a, - LLVMConstInt(LLVMInt32Type(), mode, 0)); + return res; } @@ -1028,8 +1067,10 @@ lp_build_trunc(struct lp_build_context *bld, assert(type.floating); assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE); + } else { LLVMTypeRef vec_type = lp_build_vec_type(type); LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); @@ -1056,8 +1097,10 @@ lp_build_round(struct lp_build_context *bld, assert(type.floating); assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); + } else { LLVMTypeRef vec_type = lp_build_vec_type(type); LLVMValueRef res; @@ -1082,8 +1125,10 @@ lp_build_floor(struct lp_build_context *bld, assert(type.floating); assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); + } else { LLVMTypeRef vec_type = lp_build_vec_type(type); LLVMValueRef res; @@ -1108,8 +1153,10 @@ lp_build_ceil(struct lp_build_context *bld, assert(type.floating); assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); + } else { LLVMTypeRef vec_type = lp_build_vec_type(type); LLVMValueRef res; @@ -1170,7 +1217,8 @@ lp_build_iround(struct lp_build_context *bld, assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) { + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); } else { @@ -1214,7 +1262,8 @@ lp_build_ifloor(struct lp_build_context *bld, assert(type.floating); assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) { + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); } else { @@ -1264,7 +1313,8 @@ lp_build_iceil(struct lp_build_context *bld, assert(type.floating); assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) { + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); } else { -- cgit v1.2.3 From 3da98c1ca530cba9907735e6bf397017ffc8bd77 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Sep 2010 15:19:52 -0700 Subject: i965: Fix use of undefined mem_ctx in vector splitting. --- src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 552254df87b..38195f6910d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -212,7 +212,6 @@ public: struct variable_entry *get_splitting_entry(ir_variable *var); exec_list *variable_list; - void *mem_ctx; }; struct variable_entry * @@ -300,6 +299,7 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) } ir->remove(); } else if (lhs) { + void *mem_ctx = lhs->mem_ctx; int elem = -1; switch (ir->write_mask) { -- cgit v1.2.3 From 0efea25c4b9c6b5505fdbba25b525efb27468de4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Sep 2010 15:48:21 -0700 Subject: i956: Make new FS discard do its work in a temp, not the null reg! Fixes: glsl-fs-discard-02 (GPU hang) glsl1-discard statement (2) --- src/mesa/drivers/dri/i965/brw_fs.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 2ecacb56464..7dde020e36c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -450,7 +450,7 @@ public: struct brw_reg *src); void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); - void generate_discard(fs_inst *inst); + void generate_discard(fs_inst *inst, struct brw_reg temp); void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src); @@ -1276,9 +1276,11 @@ fs_visitor::visit(ir_swizzle *ir) void fs_visitor::visit(ir_discard *ir) { + fs_reg temp = fs_reg(this, glsl_type::uint_type); + assert(ir->condition == NULL); /* FINISHME */ - emit(fs_inst(FS_OPCODE_DISCARD)); + emit(fs_inst(FS_OPCODE_DISCARD, temp, temp)); } void @@ -1884,13 +1886,15 @@ fs_visitor::generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src) } void -fs_visitor::generate_discard(fs_inst *inst) +fs_visitor::generate_discard(fs_inst *inst, struct brw_reg temp) { struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); + temp = brw_uw1_reg(temp.file, temp.nr, 0); + brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */ - brw_AND(p, g0, c->emit_mask_reg, g0); + brw_NOT(p, temp, brw_mask_reg(1)); /* IMASK */ + brw_AND(p, g0, temp, g0); brw_pop_insn_state(p); } @@ -2182,7 +2186,7 @@ fs_visitor::generate_code() generate_tex(inst, dst, src[0]); break; case FS_OPCODE_DISCARD: - generate_discard(inst); + generate_discard(inst, dst /* src0 == dst */); break; case FS_OPCODE_DDX: generate_ddx(inst, dst, src[0]); -- cgit v1.2.3 From 534f7d5749e34003fc9a0a4c83e6cd6f86a1c2cb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 30 Sep 2010 08:56:37 +1000 Subject: r600g: port r300g fix for X* formats in texformat code --- src/gallium/drivers/r600/r600_texture.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 7979f856032..f03d6fcfd60 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -586,16 +586,26 @@ uint32_t r600_translate_texformat(enum pipe_format format, goto out_unknown; } + /* Find the first non-VOID channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + if (i == 4) + goto out_unknown; + /* uniform formats */ - switch (desc->channel[0].type) { + switch (desc->channel[i].type) { case UTIL_FORMAT_TYPE_UNSIGNED: case UTIL_FORMAT_TYPE_SIGNED: - if (!desc->channel[0].normalized && + if (!desc->channel[i].normalized && desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) { goto out_unknown; } - switch (desc->channel[0].size) { + switch (desc->channel[i].size) { case 4: switch (desc->nr_channels) { case 2: @@ -635,7 +645,7 @@ uint32_t r600_translate_texformat(enum pipe_format format, goto out_unknown; case UTIL_FORMAT_TYPE_FLOAT: - switch (desc->channel[0].size) { + switch (desc->channel[i].size) { case 16: switch (desc->nr_channels) { case 1: -- cgit v1.2.3 From 2bc9d3f49837eb56f2602974004552e7852bfe0b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 30 Sep 2010 09:04:04 +1000 Subject: r600g: add L8A8 unorm. fixes texEnv warnings. --- src/gallium/drivers/r600/r600_state_inlines.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 81ce1bb1900..f41b6a0d7f6 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -302,6 +302,9 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_Z16_UNORM: return V_0280A0_SWAP_STD; + case PIPE_FORMAT_L8A8_UNORM: + return V_0280A0_SWAP_STD; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: @@ -383,6 +386,9 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_Z16_UNORM: return V_0280A0_COLOR_16; + case PIPE_FORMAT_L8A8_UNORM: + return V_0280A0_COLOR_8_8; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: case PIPE_FORMAT_A8B8G8R8_UNORM: -- cgit v1.2.3 From dbcd6526021c50770c3e5e04b04dc64c70298124 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 30 Sep 2010 09:07:07 +1000 Subject: r600g: clean up some code from move to new paths. mainly remove 2 suffix from function names --- src/gallium/drivers/r600/evergreen_state.c | 12 ++++++------ src/gallium/drivers/r600/r600_blit.c | 4 ++-- src/gallium/drivers/r600/r600_pipe.c | 24 ++++++++++++------------ src/gallium/drivers/r600/r600_pipe.h | 22 +++++++++++----------- src/gallium/drivers/r600/r600_resource.c | 2 +- src/gallium/drivers/r600/r600_shader.c | 8 ++++---- src/gallium/drivers/r600/r600_state.c | 12 ++++++------ src/gallium/winsys/r600/drm/r600_hw_context.c | 9 --------- src/gallium/winsys/r600/drm/r600_priv.h | 2 ++ 9 files changed, 44 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index a30025642d2..64fadb16e0b 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -974,7 +974,7 @@ static void *evergreen_create_shader_state(struct pipe_context *ctx, int r; shader->shader.use_mem_constant = TRUE; - r = r600_pipe_shader_create2(ctx, shader, state->tokens); + r = r600_pipe_shader_create(ctx, shader, state->tokens); if (r) { return NULL; } @@ -1021,7 +1021,7 @@ static void evergreen_delete_vs_shader(struct pipe_context *ctx, void *state) free(shader); } -void evergreen_init_state_functions2(struct r600_pipe_context *rctx) +void evergreen_init_state_functions(struct r600_pipe_context *rctx) { rctx->context.create_blend_state = evergreen_create_blend_state; rctx->context.create_depth_stencil_alpha_state = evergreen_create_dsa_state; @@ -1062,7 +1062,7 @@ void evergreen_init_state_functions2(struct r600_pipe_context *rctx) rctx->context.sampler_view_destroy = evergreen_sampler_view_destroy; } -void evergreen_init_config2(struct r600_pipe_context *rctx) +void evergreen_init_config(struct r600_pipe_context *rctx) { struct r600_pipe_state *rstate = &rctx->config; int ps_prio; @@ -1399,9 +1399,9 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) return; /* rebuild vertex shader if input format changed */ - if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader)) + if (r600_pipe_shader_update(&rctx->context, rctx->vs_shader)) return; - if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader)) + if (r600_pipe_shader_update(&rctx->context, rctx->ps_shader)) return; for (i = 0 ; i < rctx->vertex_elements->count; i++) { @@ -1519,7 +1519,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader rstate->nregs = 0; for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i)); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index a19f494ea0c..4bf44a171af 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -50,7 +50,7 @@ static void r600_blitter_save_states(struct pipe_context *ctx) /* TODO queries */ } -int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture) +int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct pipe_framebuffer_state fb = *rctx->pframebuffer; @@ -155,7 +155,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, src, subsrc, srcx, srcy, srcz, width, height); } -void r600_init_blit_functions2(struct r600_pipe_context *rctx) +void r600_init_blit_functions(struct r600_pipe_context *rctx) { rctx->context.clear = r600_clear; rctx->context.clear_render_target = r600_clear_render_target; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 3c4424039b5..cf3d58e5068 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -87,7 +87,7 @@ static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) return rstate; } -static void r600_flush2(struct pipe_context *ctx, unsigned flags, +static void r600_flush(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; @@ -128,7 +128,7 @@ static void r600_destroy_context(struct pipe_context *context) FREE(rctx); } -static struct pipe_context *r600_create_context2(struct pipe_screen *screen, void *priv) +static struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) { struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); struct r600_screen* rscreen = (struct r600_screen *)screen; @@ -139,16 +139,16 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi rctx->context.screen = screen; rctx->context.priv = priv; rctx->context.destroy = r600_destroy_context; - rctx->context.flush = r600_flush2; + rctx->context.flush = r600_flush; /* Easy accessing of screen/winsys. */ rctx->screen = rscreen; rctx->radeon = rscreen->radeon; rctx->family = r600_get_family(rctx->radeon); - r600_init_blit_functions2(rctx); + r600_init_blit_functions(rctx); r600_init_query_functions(rctx); - r600_init_context_resource_functions2(rctx); + r600_init_context_resource_functions(rctx); switch (r600_get_family(rctx->radeon)) { case CHIP_R600: @@ -163,13 +163,13 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi case CHIP_RV730: case CHIP_RV710: case CHIP_RV740: - rctx->context.draw_vbo = r600_draw_vbo2; - r600_init_state_functions2(rctx); + rctx->context.draw_vbo = r600_draw_vbo; + r600_init_state_functions(rctx); if (r600_context_init(&rctx->ctx, rctx->radeon)) { r600_destroy_context(&rctx->context); return NULL; } - r600_init_config2(rctx); + r600_init_config(rctx); break; case CHIP_CEDAR: case CHIP_REDWOOD: @@ -177,12 +177,12 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi case CHIP_CYPRESS: case CHIP_HEMLOCK: rctx->context.draw_vbo = evergreen_draw; - evergreen_init_state_functions2(rctx); + evergreen_init_state_functions(rctx); if (evergreen_context_init(&rctx->ctx, rctx->radeon)) { r600_destroy_context(&rctx->context); return NULL; } - evergreen_init_config2(rctx); + evergreen_init_config(rctx); break; default: R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon)); @@ -212,7 +212,7 @@ static struct pipe_context *r600_create_context2(struct pipe_screen *screen, voi rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); - r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth2; + r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth; return &rctx->context; } @@ -440,7 +440,7 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon) rscreen->screen.get_shader_param = r600_get_shader_param; rscreen->screen.get_paramf = r600_get_paramf; rscreen->screen.is_format_supported = r600_is_format_supported; - rscreen->screen.context_create = r600_create_context2; + rscreen->screen.context_create = r600_create_context; r600_init_screen_texture_functions(&rscreen->screen); r600_init_screen_resource_functions(&rscreen->screen); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 98ed8b7c69c..a3b8f66c092 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -146,15 +146,15 @@ struct r600_drawl { }; /* evergreen_state.c */ -void evergreen_init_state_functions2(struct r600_pipe_context *rctx); -void evergreen_init_config2(struct r600_pipe_context *rctx); +void evergreen_init_state_functions(struct r600_pipe_context *rctx); +void evergreen_init_config(struct r600_pipe_context *rctx); void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info); void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader); void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader); /* r600_blit.c */ -void r600_init_blit_functions2(struct r600_pipe_context *rctx); -int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture); +void r600_init_blit_functions(struct r600_pipe_context *rctx); +int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture); /* r600_buffer.c */ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, @@ -174,18 +174,18 @@ int r600_upload_user_buffers(struct r600_pipe_context *rctx); void r600_init_query_functions(struct r600_pipe_context *rctx); /* r600_resource.c */ -void r600_init_context_resource_functions2(struct r600_pipe_context *r600); +void r600_init_context_resource_functions(struct r600_pipe_context *r600); /* r600_shader.c */ -int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader); -int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); -int r600_find_vs_semantic_index2(struct r600_shader *vs, +int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader); +int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens); +int r600_find_vs_semantic_index(struct r600_shader *vs, struct r600_shader *ps, int id); /* r600_state.c */ -void r600_init_state_functions2(struct r600_pipe_context *rctx); -void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info); -void r600_init_config2(struct r600_pipe_context *rctx); +void r600_init_state_functions(struct r600_pipe_context *rctx); +void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info); +void r600_init_config(struct r600_pipe_context *rctx); void r600_translate_index_buffer(struct r600_pipe_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index b8f490c344a..59edab0e24a 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -53,7 +53,7 @@ void r600_init_screen_resource_functions(struct pipe_screen *screen) screen->user_buffer_create = r600_user_buffer_create; } -void r600_init_context_resource_functions2(struct r600_pipe_context *r600) +void r600_init_context_resource_functions(struct r600_pipe_context *r600) { r600->context.get_transfer = u_get_transfer_vtbl; r600->context.transfer_map = u_transfer_map_vtbl; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index a0cd830d26d..8d40079353a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -83,7 +83,7 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade 0x00000000, 0xFFFFFFFF, shader->bo); } -int r600_find_vs_semantic_index2(struct r600_shader *vs, +int r600_find_vs_semantic_index(struct r600_shader *vs, struct r600_shader *ps, int id) { struct r600_shader_io *input = &ps->input[id]; @@ -109,7 +109,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade rstate->nregs = 0; for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i)); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i)); tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; @@ -267,7 +267,7 @@ static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader return r600_bc_build(&shader->bc); } -int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader) +int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; int r; @@ -287,7 +287,7 @@ int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader * } int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader); -int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens) +int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; int r; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index f5ec5cde37b..23323f1ea2b 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -80,9 +80,9 @@ static void r600_draw_common(struct r600_drawl *draw) /* rebuild vertex shader if input format changed */ - if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader)) + if (r600_pipe_shader_update(&rctx->context, rctx->vs_shader)) return; - if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader)) + if (r600_pipe_shader_update(&rctx->context, rctx->ps_shader)) return; for (i = 0 ; i < rctx->vertex_elements->count; i++) { @@ -205,7 +205,7 @@ void r600_translate_index_buffer(struct r600_pipe_context *r600, } } -void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info) +void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_drawl draw; @@ -1191,7 +1191,7 @@ static void *r600_create_shader_state(struct pipe_context *ctx, struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); int r; - r = r600_pipe_shader_create2(ctx, shader, state->tokens); + r = r600_pipe_shader_create(ctx, shader, state->tokens); if (r) { return NULL; } @@ -1238,7 +1238,7 @@ static void r600_delete_vs_shader(struct pipe_context *ctx, void *state) free(shader); } -void r600_init_state_functions2(struct r600_pipe_context *rctx) +void r600_init_state_functions(struct r600_pipe_context *rctx) { rctx->context.create_blend_state = r600_create_blend_state; rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state; @@ -1279,7 +1279,7 @@ void r600_init_state_functions2(struct r600_pipe_context *rctx) rctx->context.sampler_view_destroy = r600_sampler_view_destroy; } -void r600_init_config2(struct r600_pipe_context *rctx) +void r600_init_config(struct r600_pipe_context *rctx) { int ps_prio; int vs_prio; diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 416fcebc9fe..d1cf9e93f8a 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -40,15 +40,6 @@ #define GROUP_FORCE_NEW_BLOCK 0 -int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_reference(struct radeon *radeon, - struct radeon_bo **dst, - struct radeon_bo *src); - -unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo); -void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); - int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) { struct r600_block *block; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index f836e607c0b..7106bb6bcba 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -89,8 +89,10 @@ void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, struct radeon_bo *src); int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain); +void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); /* radeon_bo_pb.c */ +struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon); struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr, uint32_t handle); -- cgit v1.2.3 From 4378c17c88c6d1fb046f53ef83955fd7fbd992db Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 30 Sep 2010 09:17:20 +1000 Subject: r600g: return string for chip family use same strings as r600c. --- src/gallium/drivers/r600/r600_pipe.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index cf3d58e5068..a25674b183c 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -225,17 +225,36 @@ static const char* r600_get_vendor(struct pipe_screen* pscreen) return "X.Org"; } +static const char *r600_get_family_name(enum radeon_family family) +{ + switch(family) { + case CHIP_R600: return "R600"; + case CHIP_RV610: return "RV610"; + case CHIP_RV630: return "RV630"; + case CHIP_RV670: return "RV670"; + case CHIP_RV620: return "RV620"; + case CHIP_RV635: return "RV635"; + case CHIP_RS780: return "RS780"; + case CHIP_RS880: return "RS880"; + case CHIP_RV770: return "RV770"; + case CHIP_RV730: return "RV730"; + case CHIP_RV710: return "RV710"; + case CHIP_RV740: return "RV740"; + case CHIP_CEDAR: return "CEDAR"; + case CHIP_REDWOOD: return "REDWOOD"; + case CHIP_JUNIPER: return "JUNIPER"; + case CHIP_CYPRESS: return "CYPRESS"; + case CHIP_HEMLOCK: return "HEMLOCK"; + default: return "unknown"; + } +} + static const char* r600_get_name(struct pipe_screen* pscreen) { struct r600_screen *rscreen = (struct r600_screen *)pscreen; enum radeon_family family = r600_get_family(rscreen->radeon); - if (family >= CHIP_R600 && family < CHIP_RV770) - return "R600 (HD2XXX,HD3XXX)"; - else if (family < CHIP_CEDAR) - return "R700 (HD4XXX)"; - else - return "EVERGREEN"; + return r600_get_family_name(family); } static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) -- cgit v1.2.3 From 21148e1c0a3cf9cf25ded006a3d5ce2b12803ea9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Sep 2010 10:43:46 -0700 Subject: i965: Clean up the virtual GRF handling. Now, virtual GRFs are consecutive integers, rather than offsetting the next one by the size. We need the size information to still be around for real register allocation, anyway. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 76 +++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 7dde020e36c..e91351cb6cc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -276,9 +276,9 @@ public: /** Register file: ARF, GRF, MRF, IMM. */ enum register_file file; - /** Abstract register number. 0 = fixed hw reg */ + /** virtual register number. 0 = fixed hw reg */ int reg; - /** Offset within the abstract register. */ + /** Offset within the virtual register. */ int reg_offset; /** HW register number. Generally unset until register allocation. */ int hw_reg; @@ -399,7 +399,6 @@ public: this->mem_ctx = talloc_new(NULL); this->shader = shader; this->fail = false; - this->next_abstract_grf = 1; this->variable_ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); @@ -413,6 +412,10 @@ public: this->annotation_string = NULL; this->annotation_ir = NULL; this->base_ir = NULL; + + this->virtual_grf_sizes = NULL; + this->virtual_grf_next = 1; + this->virtual_grf_array_size = 0; } ~fs_visitor() { @@ -421,6 +424,7 @@ public: } fs_reg *variable_storage(ir_variable *var); + int virtual_grf_alloc(int size); void visit(ir_variable *ir); void visit(ir_assignment *ir); @@ -473,7 +477,11 @@ public: struct brw_shader *shader; void *mem_ctx; exec_list instructions; - int next_abstract_grf; + + int *virtual_grf_sizes; + int virtual_grf_next; + int virtual_grf_array_size; + struct hash_table *variable_ht; ir_variable *frag_color, *frag_data, *frag_depth; int first_non_payload_grf; @@ -501,6 +509,24 @@ public: }; +int +fs_visitor::virtual_grf_alloc(int size) +{ + if (virtual_grf_array_size <= virtual_grf_next) { + if (virtual_grf_array_size == 0) + virtual_grf_array_size = 16; + else + virtual_grf_array_size *= 2; + virtual_grf_sizes = talloc_realloc(mem_ctx, virtual_grf_sizes, + int, virtual_grf_array_size); + + /* This slot is always unused. */ + virtual_grf_sizes[0] = 0; + } + virtual_grf_sizes[virtual_grf_next] = size; + return virtual_grf_next++; +} + /** Fixed HW reg constructor. */ fs_reg::fs_reg(enum register_file file, int hw_reg) { @@ -540,9 +566,8 @@ fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) init(); this->file = GRF; - this->reg = v->next_abstract_grf; + this->reg = v->virtual_grf_alloc(type_size(type)); this->reg_offset = 0; - v->next_abstract_grf += type_size(type); this->type = brw_type_for_base_type(type); } @@ -1898,15 +1923,6 @@ fs_visitor::generate_discard(fs_inst *inst, struct brw_reg temp) brw_pop_insn_state(p); } -static void -trivial_assign_reg(int header_size, fs_reg *reg) -{ - if (reg->file == GRF && reg->reg != 0) { - reg->hw_reg = header_size + reg->reg - 1 + reg->reg_offset; - reg->reg = 0; - } -} - void fs_visitor::assign_curb_setup() { @@ -1980,23 +1996,37 @@ fs_visitor::assign_urb_setup() this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length; } +static void +trivial_assign_reg(int *reg_hw_locations, fs_reg *reg) +{ + if (reg->file == GRF && reg->reg != 0) { + reg->hw_reg = reg_hw_locations[reg->reg] + reg->reg_offset; + reg->reg = 0; + } +} + void fs_visitor::assign_regs() { - int header_size = this->first_non_payload_grf; int last_grf = 0; + int hw_reg_mapping[this->virtual_grf_next]; + int i; + + hw_reg_mapping[0] = 0; + hw_reg_mapping[1] = this->first_non_payload_grf; + for (i = 2; i < this->virtual_grf_next; i++) { + hw_reg_mapping[i] = (hw_reg_mapping[i - 1] + + this->virtual_grf_sizes[i - 1]); + } + last_grf = hw_reg_mapping[i - 1] + this->virtual_grf_sizes[i - 1]; /* FINISHME: trivial assignment of register numbers */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); - trivial_assign_reg(header_size, &inst->dst); - trivial_assign_reg(header_size, &inst->src[0]); - trivial_assign_reg(header_size, &inst->src[1]); - - last_grf = MAX2(last_grf, inst->dst.hw_reg); - last_grf = MAX2(last_grf, inst->src[0].hw_reg); - last_grf = MAX2(last_grf, inst->src[1].hw_reg); + trivial_assign_reg(hw_reg_mapping, &inst->dst); + trivial_assign_reg(hw_reg_mapping, &inst->src[0]); + trivial_assign_reg(hw_reg_mapping, &inst->src[1]); } this->grf_used = last_grf + 1; -- cgit v1.2.3 From 9ff90b7230cceb362c7e0fe1c3d5029b8cbfe6bd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Sep 2010 12:34:33 -0700 Subject: ra: First cut at a graph-coloring register allocator for mesa. Notably missing is choice of registers to spill. --- src/mesa/program/register_allocate.c | 361 +++++++++++++++++++++++++++++++++++ src/mesa/program/register_allocate.h | 69 +++++++ src/mesa/sources.mak | 1 + 3 files changed, 431 insertions(+) create mode 100644 src/mesa/program/register_allocate.c create mode 100644 src/mesa/program/register_allocate.h (limited to 'src') diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c new file mode 100644 index 00000000000..03f04697bfb --- /dev/null +++ b/src/mesa/program/register_allocate.c @@ -0,0 +1,361 @@ +/* + * Copyright © 2010 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + * Eric Anholt + * + */ + +/** @file register_allocate.c + * + * Graph-coloring register allocator. + */ + +#include + +#include "main/imports.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "register_allocate.h" + +struct ra_reg { + char *name; + GLboolean *conflicts; +}; + +struct ra_regs { + struct ra_reg *regs; + unsigned int count; + + struct ra_class **classes; + unsigned int class_count; +}; + +struct ra_class { + GLboolean *regs; + + /** + * p_B in Runeson/Nyström paper. + * + * This is "how many regs are in the set." + */ + unsigned int p; + + /** + * q_B,C in Runeson/Nyström paper. + */ + unsigned int *q; +}; + +struct ra_node { + GLboolean *adjacency; + unsigned int class; + unsigned int adjacency_count; + unsigned int reg; + GLboolean in_stack; +}; + +struct ra_graph { + struct ra_regs *regs; + /** + * the variables that need register allocation. + */ + struct ra_node *nodes; + unsigned int count; /**< count of nodes. */ + + unsigned int *stack; + unsigned int stack_count; +}; + +struct ra_regs * +ra_alloc_reg_set(unsigned int count) +{ + unsigned int i; + struct ra_regs *regs; + + regs = talloc_zero(NULL, struct ra_regs); + regs->count = count; + regs->regs = talloc_zero_array(regs, struct ra_reg, count); + + for (i = 0; i < count; i++) { + regs->regs[i].conflicts = talloc_zero_array(regs->regs, GLboolean, count); + regs->regs[i].conflicts[i] = GL_TRUE; + } + + return regs; +} + +void +ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2) +{ + regs->regs[r1].conflicts[r2] = GL_TRUE; + regs->regs[r2].conflicts[r1] = GL_TRUE; +} + +unsigned int +ra_alloc_reg_class(struct ra_regs *regs) +{ + struct ra_class *class; + + regs->classes = talloc_realloc(regs, regs->classes, + struct ra_class *, + regs->class_count + 1); + + class = talloc_zero(regs, struct ra_class); + regs->classes[regs->class_count] = class; + + class->regs = talloc_zero_array(class, GLboolean, regs->count); + + return regs->class_count++; +} + +void +ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r) +{ + struct ra_class *class = regs->classes[c]; + + class->regs[r] = GL_TRUE; + class->p++; +} + +/** + * Must be called after all conflicts and register classes have been + * set up and before the register set is used for allocation. + */ +void +ra_set_finalize(struct ra_regs *regs) +{ + unsigned int b, c; + + for (b = 0; b < regs->class_count; b++) { + regs->classes[b]->q = talloc_array(regs, unsigned int, regs->class_count); + } + + /* Compute, for each class B and C, how many regs of B an + * allocation to C could conflict with. + */ + for (b = 0; b < regs->class_count; b++) { + for (c = 0; c < regs->class_count; c++) { + unsigned int rc; + int max_conflicts = 0; + + for (rc = 0; rc < regs->count; rc++) { + unsigned int rb; + int conflicts = 0; + + if (!regs->classes[c]->regs[rc]) + continue; + + for (rb = 0; rb < regs->count; rb++) { + if (regs->classes[b]->regs[rb] && + regs->regs[rb].conflicts[rc]) + conflicts++; + } + max_conflicts = MAX2(max_conflicts, conflicts); + } + regs->classes[b]->q[c] = max_conflicts; + } + } +} + +struct ra_graph * +ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) +{ + struct ra_graph *g; + unsigned int i; + + g = talloc_zero(regs, struct ra_graph); + g->regs = regs; + g->nodes = talloc_zero_array(g, struct ra_node, count); + g->count = count; + + g->stack = talloc_zero_array(g, unsigned int, count); + + for (i = 0; i < count; i++) { + g->nodes[i].adjacency = talloc_zero_array(g, GLboolean, count); + g->nodes[i].adjacency[i] = GL_TRUE; + g->nodes[i].reg = ~0; + } + + return g; +} + +void +ra_set_node_class(struct ra_graph *g, + unsigned int n, unsigned int class) +{ + g->nodes[n].class = class; +} + +void +ra_add_node_interference(struct ra_graph *g, + unsigned int n1, unsigned int n2) +{ + if (g->nodes[n1].adjacency[n2]) + return; + + g->nodes[n1].adjacency[n2] = GL_TRUE; + g->nodes[n2].adjacency_count++; + g->nodes[n2].adjacency[n1] = GL_TRUE; + g->nodes[n2].adjacency_count++; +} + +static GLboolean pq_test(struct ra_graph *g, unsigned int n) +{ + unsigned int j; + unsigned int q = 0; + int n_class = g->nodes[n].class; + + for (j = 0; j < g->count; j++) { + if (j == n || g->nodes[j].in_stack) + continue; + + if (g->nodes[n].adjacency[j]) { + unsigned int j_class = g->nodes[j].class; + q += g->regs->classes[n_class]->q[j_class]; + } + } + + return q < g->regs->classes[n_class]->p; +} + +/** + * Simplifies the interference graph by pushing all + * trivially-colorable nodes into a stack of nodes to be colored, + * removing them from the graph, and rinsing and repeating. + * + * Returns GL_TRUE if all nodes were removed from the graph. GL_FALSE + * means that either spilling will be required, or optimistic coloring + * should be applied. + */ +GLboolean +ra_simplify(struct ra_graph *g) +{ + GLboolean progress = GL_TRUE; + int i; + + while (progress) { + progress = GL_FALSE; + + for (i = g->count - 1; i >= 0; i--) { + if (g->nodes[i].in_stack) + continue; + + if (pq_test(g, i)) { + g->stack[g->stack_count] = i; + g->stack_count++; + g->nodes[i].in_stack = GL_TRUE; + progress = GL_TRUE; + } + } + } + + for (i = 0; i < g->count; i++) { + if (!g->nodes[i].in_stack) + return GL_FALSE; + } + + return GL_TRUE; +} + +/** + * Pops nodes from the stack back into the graph, coloring them with + * registers as they go. + * + * If all nodes were trivially colorable, then this must succeed. If + * not (optimistic coloring), then it may return GL_FALSE; + */ +GLboolean +ra_select(struct ra_graph *g) +{ + int i; + + while (g->stack_count != 0) { + unsigned int r; + int n = g->stack[g->stack_count - 1]; + struct ra_class *c = g->regs->classes[g->nodes[n].class]; + + /* Find the lowest-numbered reg which is not used by a member + * of the graph adjacent to us. + */ + for (r = 0; r < g->regs->count; r++) { + if (!c->regs[r]) + continue; + + /* Check if any of our neighbors conflict with this register choice. */ + for (i = 0; i < g->count; i++) { + if (g->nodes[n].adjacency[i] && + !g->nodes[i].in_stack && + g->regs->regs[r].conflicts[g->nodes[i].reg]) { + break; + } + } + if (i == g->count) + break; + } + if (r == g->regs->count) + return GL_FALSE; + + g->nodes[n].reg = r; + g->nodes[n].in_stack = GL_FALSE; + g->stack_count--; + } + + return GL_TRUE; +} + +/** + * Optimistic register coloring: Just push the remaining nodes + * on the stack. They'll be colored first in ra_select(), and + * if they succeed then the locally-colorable nodes are still + * locally-colorable and the rest of the register allocation + * will succeed. + */ +void +ra_optimistic_color(struct ra_graph *g) +{ + unsigned int i; + + for (i = 0; i < g->count; i++) { + if (g->nodes[i].in_stack) + continue; + + g->stack[g->stack_count] = i; + g->stack_count++; + g->nodes[i].in_stack = GL_TRUE; + } +} + +GLboolean +ra_allocate_no_spills(struct ra_graph *g) +{ + if (!ra_simplify(g)) { + ra_optimistic_color(g); + } + return ra_select(g); +} + +unsigned int +ra_get_node_reg(struct ra_graph *g, unsigned int n) +{ + return g->nodes[n].reg; +} diff --git a/src/mesa/program/register_allocate.h b/src/mesa/program/register_allocate.h new file mode 100644 index 00000000000..42647b50b8f --- /dev/null +++ b/src/mesa/program/register_allocate.h @@ -0,0 +1,69 @@ +/* + * Copyright © 2010 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + * Eric Anholt + * + */ + +struct ra_class; +struct ra_regs; + +/* @{ + * Register set setup. + * + * This should be done once at backend initializaion, as + * ra_set_finalize is O(r^2*c^2). The registers may be virtual + * registers, such as aligned register pairs that conflict with the + * two real registers from which they are composed. + */ +struct ra_regs *ra_alloc_reg_set(unsigned int count); +unsigned int ra_alloc_reg_class(struct ra_regs *regs); +void ra_add_reg_conflict(struct ra_regs *regs, + unsigned int r1, unsigned int r2); +void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg); +void ra_set_finalize(struct ra_regs *regs); +/** @} */ + +/** @{ Interference graph setup. + * + * Each interference graph node is a virtual variable in the IL. It + * is up to the user to ra_set_node_class() for the virtual variable, + * and compute live ranges and ra_node_interfere() between conflicting + * live ranges. + */ +struct ra_graph *ra_alloc_interference_graph(struct ra_regs *regs, + unsigned int count); +void ra_set_node_class(struct ra_graph *g, unsigned int n, unsigned int c); +void ra_add_node_interference(struct ra_graph *g, + unsigned int n1, unsigned int n2); +/** @} */ + +/** @{ Graph-coloring register allocation */ +GLboolean ra_simplify(struct ra_graph *g); +void ra_optimistic_color(struct ra_graph *g); +GLboolean ra_select(struct ra_graph *g); +GLboolean ra_allocate_no_spills(struct ra_graph *g); + +unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n); +/** @} */ + diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index b2be5ba07f2..11a93d47f6d 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -247,6 +247,7 @@ PROGRAM_SOURCES = \ program/prog_statevars.c \ program/prog_uniform.c \ program/programopt.c \ + program/register_allocate.c \ program/symbol_table.c SHADER_CXX_SOURCES = \ -- cgit v1.2.3 From e1261d3c493ff48348483a0084f3017c7e663dc0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Sep 2010 12:08:11 -0700 Subject: i965: First cut at register allocation using graph coloring. The interference is totally bogus (maximal), so this is equivalent to our trivial register assignment before. As in, passes the same set of piglit tests. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 158 +++++++++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index e91351cb6cc..4de64f09275 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -35,6 +35,7 @@ extern "C" { #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_optimize.h" +#include "program/register_allocate.h" #include "program/sampler.h" #include "program/hash_table.h" #include "brw_context.h" @@ -448,6 +449,7 @@ public: void assign_curb_setup(); void assign_urb_setup(); void assign_regs(); + void assign_regs_trivial(); void generate_code(); void generate_fb_write(fs_inst *inst); void generate_linterp(fs_inst *inst, struct brw_reg dst, @@ -1997,7 +1999,7 @@ fs_visitor::assign_urb_setup() } static void -trivial_assign_reg(int *reg_hw_locations, fs_reg *reg) +assign_reg(int *reg_hw_locations, fs_reg *reg) { if (reg->file == GRF && reg->reg != 0) { reg->hw_reg = reg_hw_locations[reg->reg] + reg->reg_offset; @@ -2006,7 +2008,7 @@ trivial_assign_reg(int *reg_hw_locations, fs_reg *reg) } void -fs_visitor::assign_regs() +fs_visitor::assign_regs_trivial() { int last_grf = 0; int hw_reg_mapping[this->virtual_grf_next]; @@ -2020,18 +2022,157 @@ fs_visitor::assign_regs() } last_grf = hw_reg_mapping[i - 1] + this->virtual_grf_sizes[i - 1]; - /* FINISHME: trivial assignment of register numbers */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); - trivial_assign_reg(hw_reg_mapping, &inst->dst); - trivial_assign_reg(hw_reg_mapping, &inst->src[0]); - trivial_assign_reg(hw_reg_mapping, &inst->src[1]); + assign_reg(hw_reg_mapping, &inst->dst); + assign_reg(hw_reg_mapping, &inst->src[0]); + assign_reg(hw_reg_mapping, &inst->src[1]); } this->grf_used = last_grf + 1; } +void +fs_visitor::assign_regs() +{ + int last_grf = 0; + int hw_reg_mapping[this->virtual_grf_next + 1]; + int base_reg_count = BRW_MAX_GRF - this->first_non_payload_grf; + int class_sizes[base_reg_count]; + int class_count = 0; + + /* Set up the register classes. + * + * The base registers store a scalar value. For texture samples, + * we get virtual GRFs composed of 4 contiguous hw register. For + * structures and arrays, we store them as contiguous larger things + * than that, though we should be able to do better most of the + * time. + */ + class_sizes[class_count++] = 1; + for (int r = 1; r < this->virtual_grf_next; r++) { + int i; + + for (i = 0; i < class_count; i++) { + if (class_sizes[i] == this->virtual_grf_sizes[r]) + break; + } + if (i == class_count) { + class_sizes[class_count++] = this->virtual_grf_sizes[r]; + } + } + + int ra_reg_count = 0; + int class_base_reg[class_count]; + int class_reg_count[class_count]; + int classes[class_count]; + + for (int i = 0; i < class_count; i++) { + class_base_reg[i] = ra_reg_count; + class_reg_count[i] = base_reg_count - (class_sizes[i] - 1); + ra_reg_count += class_reg_count[i]; + } + + struct ra_regs *regs = ra_alloc_reg_set(ra_reg_count); + for (int i = 0; i < class_count; i++) { + classes[i] = ra_alloc_reg_class(regs); + + for (int i_r = 0; i_r < class_reg_count[i]; i_r++) { + ra_class_add_reg(regs, classes[i], class_base_reg[i] + i_r); + } + + /* Add conflicts between our contiguous registers aliasing + * base regs and other register classes' contiguous registers + * that alias base regs, or the base regs themselves for classes[0]. + */ + for (int c = 0; c <= i; c++) { + for (int i_r = 0; i_r < class_reg_count[i] - 1; i_r++) { + for (int c_r = MAX2(0, i_r - (class_sizes[c] - 1)); + c_r <= MIN2(class_reg_count[c] - 1, i_r + class_sizes[i] - 1); + c_r++) { + + if (0) { + printf("%d/%d conflicts %d/%d\n", + class_sizes[i], i_r, + class_sizes[c], c_r); + } + + ra_add_reg_conflict(regs, + class_base_reg[i] + i_r, + class_base_reg[c] + c_r); + } + } + } + } + + ra_set_finalize(regs); + + struct ra_graph *g = ra_alloc_interference_graph(regs, + this->virtual_grf_next); + /* Node 0 is just a placeholder to keep virtual_grf[] mapping 1:1 + * with nodes. + */ + ra_set_node_class(g, 0, classes[0]); + + /* FINISHME: Proper interference (live interval analysis) */ + for (int i = 1; i < this->virtual_grf_next; i++) { + for (int c = 0; c < class_count; c++) { + if (class_sizes[c] == this->virtual_grf_sizes[i]) { + ra_set_node_class(g, i, classes[c]); + break; + } + } + + for (int j = 1; j < i; j++) { + ra_add_node_interference(g, i, j); + } + } + + /* FINISHME: Handle spilling */ + if (!ra_allocate_no_spills(g)) { + fprintf(stderr, "Failed to allocate registers.\n"); + this->fail = true; + return; + } + + /* Get the chosen virtual registers for each node, and map virtual + * regs in the register classes back down to real hardware reg + * numbers. + */ + hw_reg_mapping[0] = 0; /* unused */ + for (int i = 1; i < this->virtual_grf_next; i++) { + int reg = ra_get_node_reg(g, i); + int hw_reg = -1; + + for (int c = 0; c < class_count; c++) { + if (reg >= class_base_reg[c] && + reg < class_base_reg[c] + class_reg_count[c] - 1) { + hw_reg = reg - class_base_reg[c]; + break; + } + } + + assert(hw_reg != -1); + hw_reg_mapping[i] = this->first_non_payload_grf + hw_reg; + last_grf = MAX2(last_grf, + hw_reg_mapping[i] + this->virtual_grf_sizes[i] - 1); + } + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + assign_reg(hw_reg_mapping, &inst->dst); + assign_reg(hw_reg_mapping, &inst->src[0]); + assign_reg(hw_reg_mapping, &inst->src[1]); + } + + this->grf_used = last_grf + 1; + + talloc_free(g); + talloc_free(regs); +} + static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) { struct brw_reg brw_reg; @@ -2319,7 +2460,10 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) v.emit_fb_writes(); v.assign_curb_setup(); v.assign_urb_setup(); - v.assign_regs(); + if (0) + v.assign_regs_trivial(); + else + v.assign_regs(); } v.generate_code(); -- cgit v1.2.3 From b90c7d1713c5a52fd85cb9dacad5828ae2fdbf6c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Sep 2010 15:20:12 -0700 Subject: i965: Add live interval analysis and hook it up to the register allocator. Fixes 13 piglit cases that failed at register allocation before. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 85 +++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4de64f09275..b00930d5cf4 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -417,6 +417,8 @@ public: this->virtual_grf_sizes = NULL; this->virtual_grf_next = 1; this->virtual_grf_array_size = 0; + this->virtual_grf_def = NULL; + this->virtual_grf_use = NULL; } ~fs_visitor() { @@ -450,6 +452,8 @@ public: void assign_urb_setup(); void assign_regs(); void assign_regs_trivial(); + void calculate_live_intervals(); + bool virtual_grf_interferes(int a, int b); void generate_code(); void generate_fb_write(fs_inst *inst); void generate_linterp(fs_inst *inst, struct brw_reg dst, @@ -483,6 +487,8 @@ public: int *virtual_grf_sizes; int virtual_grf_next; int virtual_grf_array_size; + int *virtual_grf_def; + int *virtual_grf_use; struct hash_table *variable_ht; ir_variable *frag_color, *frag_data, *frag_depth; @@ -2042,6 +2048,8 @@ fs_visitor::assign_regs() int class_sizes[base_reg_count]; int class_count = 0; + calculate_live_intervals(); + /* Set up the register classes. * * The base registers store a scalar value. For texture samples, @@ -2115,7 +2123,6 @@ fs_visitor::assign_regs() */ ra_set_node_class(g, 0, classes[0]); - /* FINISHME: Proper interference (live interval analysis) */ for (int i = 1; i < this->virtual_grf_next; i++) { for (int c = 0; c < class_count; c++) { if (class_sizes[c] == this->virtual_grf_sizes[i]) { @@ -2125,7 +2132,9 @@ fs_visitor::assign_regs() } for (int j = 1; j < i; j++) { - ra_add_node_interference(g, i, j); + if (virtual_grf_interferes(i, j)) { + ra_add_node_interference(g, i, j); + } } } @@ -2173,6 +2182,78 @@ fs_visitor::assign_regs() talloc_free(regs); } +void +fs_visitor::calculate_live_intervals() +{ + int num_vars = this->virtual_grf_next; + int *def = talloc_array(mem_ctx, int, num_vars); + int *use = talloc_array(mem_ctx, int, num_vars); + int loop_depth = 0; + int loop_start = 0; + + for (int i = 0; i < num_vars; i++) { + def[i] = 1 << 30; + use[i] = 0; + } + + int ip = 0; + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->opcode == BRW_OPCODE_DO) { + if (loop_depth++ == 0) + loop_start = ip; + } else if (inst->opcode == BRW_OPCODE_WHILE) { + loop_depth--; + + if (loop_depth == 0) { + /* FINISHME: + * + * Patches up any vars marked for use within the loop as + * live until the end. This is conservative, as there + * will often be variables defined and used inside the + * loop but dead at the end of the loop body. + */ + for (int i = 0; i < num_vars; i++) { + if (use[i] == loop_start) { + use[i] = ip; + } + } + } + } else { + int eip = ip; + + if (loop_depth) + eip = loop_start; + + for (unsigned int i = 0; i < 3; i++) { + if (inst->src[i].file == GRF && inst->src[i].reg != 0) { + def[inst->src[i].reg] = MIN2(def[inst->src[i].reg], eip); + use[inst->src[i].reg] = MAX2(use[inst->src[i].reg], eip); + } + } + if (inst->dst.file == GRF && inst->dst.reg != 0) { + def[inst->dst.reg] = MIN2(def[inst->dst.reg], eip); + use[inst->dst.reg] = MAX2(use[inst->dst.reg], eip); + } + } + + ip++; + } + + this->virtual_grf_def = def; + this->virtual_grf_use = use; +} + +bool +fs_visitor::virtual_grf_interferes(int a, int b) +{ + int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]); + int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]); + + return start <= end; +} + static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) { struct brw_reg brw_reg; -- cgit v1.2.3 From ad1506c5ac61b75e45f24a2e18c91dc8a49a3bb0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Sep 2010 16:20:48 -0700 Subject: i965: Remove my "safety counter" code from loops. I've screwed this up enough times that I don't think it's worth it. This time, it was that I was doing it once per top-level body instruction instead of just once at the end of the loop body. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index b00930d5cf4..efbb4c66920 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1400,12 +1400,6 @@ fs_visitor::visit(ir_loop *ir) } } - /* Start a safety counter. If the user messed up their loop - * counting, we don't want to hang the GPU. - */ - fs_reg max_iter = fs_reg(this, glsl_type::int_type); - emit(fs_inst(BRW_OPCODE_MOV, max_iter, fs_reg(10000))); - emit(fs_inst(BRW_OPCODE_DO)); if (ir->to) { @@ -1445,17 +1439,9 @@ fs_visitor::visit(ir_loop *ir) foreach_iter(exec_list_iterator, iter, ir->body_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); - fs_inst *inst; this->base_ir = ir; ir->accept(this); - - /* Check the maximum loop iters counter. */ - inst = emit(fs_inst(BRW_OPCODE_ADD, max_iter, max_iter, fs_reg(-1))); - inst->conditional_mod = BRW_CONDITIONAL_Z; - - inst = emit(fs_inst(BRW_OPCODE_BREAK)); - inst->predicated = true; } if (ir->increment) { -- cgit v1.2.3 From 83278d384ee123fa207229cc444f6e77e2d9a0d2 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 30 Sep 2010 01:08:58 +0200 Subject: r300g: fix conditional rendering in non-wait path NOTE: This is a candidate for the 7.9 branch. --- src/gallium/drivers/r300/r300_query.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 5b0121ce9e1..5f34fcb2744 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -158,7 +158,7 @@ static void r300_render_condition(struct pipe_context *pipe, uint mode) { struct r300_context *r300 = r300_context(pipe); - uint64_t result; + uint64_t result = 0; boolean wait; if (query) { @@ -167,9 +167,9 @@ static void r300_render_condition(struct pipe_context *pipe, if (!r300_get_query_result(pipe, query, wait, &result)) { r300->skip_rendering = FALSE; + } else { + r300->skip_rendering = result == 0; } - - r300->skip_rendering = result == 0; } else { r300->skip_rendering = FALSE; } -- cgit v1.2.3 From 72b368ae69bc037681ab4e458296c07cb04349be Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Thu, 30 Sep 2010 10:49:47 +0800 Subject: i965: always set tiling for fbo depth buffer on sandybridge Sandybridge requires depth buffer must be tiling. Fix 'fbo_firecube' demo. --- src/mesa/drivers/dri/intel/intel_fbo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 984585027c1..8c0491d59aa 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -102,7 +102,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, { struct intel_context *intel = intel_context(ctx); struct intel_renderbuffer *irb = intel_renderbuffer(rb); - int cpp; + int cpp, tiling; ASSERT(rb->Name != 0); @@ -176,7 +176,13 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, /* alloc hardware renderbuffer */ DBG("Allocating %d x %d Intel RBO\n", width, height); - irb->region = intel_region_alloc(intel->intelScreen, I915_TILING_NONE, cpp, + tiling = I915_TILING_NONE; + + /* Gen6 requires depth must be tiling */ + if (intel->gen >= 6 && rb->Format == MESA_FORMAT_S8_Z24) + tiling = I915_TILING_Y; + + irb->region = intel_region_alloc(intel->intelScreen, tiling, cpp, width, height, GL_TRUE); if (!irb->region) return GL_FALSE; /* out of memory? */ -- cgit v1.2.3 From 6b2f1561ad66c358a5d6b7a5ed5eb8f550a3b098 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 24 Sep 2010 02:42:15 +0800 Subject: egl: Check extensions. Do not call into the driver if the extension for the called function is not enabled. --- src/egl/main/eglapi.c | 52 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 829d700b24f..e8f856f6beb 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -402,10 +402,15 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, _EGLContext *context; EGLContext ret; - if (config) - _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv); - else - _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); + _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); + + if (!config) { + /* config may be NULL if surfaceless */ + if (!disp->Extensions.KHR_surfaceless_gles1 && + !disp->Extensions.KHR_surfaceless_gles2 && + !disp->Extensions.KHR_surfaceless_opengl) + RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT); + } if (!share && share_list != EGL_NO_CONTEXT) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT); @@ -459,9 +464,19 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, if (!context && ctx != EGL_NO_CONTEXT) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); - if ((!draw_surf && draw != EGL_NO_SURFACE) || - (!read_surf && read != EGL_NO_SURFACE)) - RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); + if (!draw_surf || !read_surf) { + /* surfaces may be NULL if surfaceless */ + if (!disp->Extensions.KHR_surfaceless_gles1 && + !disp->Extensions.KHR_surfaceless_gles2 && + !disp->Extensions.KHR_surfaceless_opengl) + RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); + + if ((!draw_surf && draw != EGL_NO_SURFACE) || + (!read_surf && read != EGL_NO_SURFACE)) + RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); + if (draw_surf || read_surf) + RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE); + } ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context); @@ -1276,6 +1291,8 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLImageKHR ret; _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); + if (!disp->Extensions.KHR_image_base) + RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); if (!context && ctx != EGL_NO_CONTEXT) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR); @@ -1296,6 +1313,8 @@ eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) EGLBoolean ret; _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + if (!disp->Extensions.KHR_image_base) + RETURN_EGL_EVAL(disp, EGL_FALSE); if (!img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); @@ -1321,6 +1340,8 @@ eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) EGLSyncKHR ret; _EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv); + if (!disp->Extensions.KHR_reusable_sync) + RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR); sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list); ret = (sync) ? _eglLinkSync(sync, disp) : EGL_NO_SYNC_KHR; @@ -1338,6 +1359,8 @@ eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) EGLBoolean ret; _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + assert(disp->Extensions.KHR_reusable_sync); + _eglUnlinkSync(s); ret = drv->API.DestroySyncKHR(drv, disp, s); @@ -1354,6 +1377,7 @@ eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR t EGLint ret; _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + assert(disp->Extensions.KHR_reusable_sync); ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout); RETURN_EGL_EVAL(disp, ret); @@ -1369,6 +1393,7 @@ eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) EGLBoolean ret; _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + assert(disp->Extensions.KHR_reusable_sync); ret = drv->API.SignalSyncKHR(drv, disp, s, mode); RETURN_EGL_EVAL(disp, ret); @@ -1384,6 +1409,7 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *v EGLBoolean ret; _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); + assert(disp->Extensions.KHR_reusable_sync); ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value); RETURN_EGL_EVAL(disp, ret); @@ -1407,14 +1433,14 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); + if (!disp->Extensions.NOK_swap_region) + RETURN_EGL_EVAL(disp, EGL_FALSE); + /* surface must be bound to current context in EGL 1.4 */ if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); - if (drv->API.SwapBuffersRegionNOK) - ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); - else - ret = drv->API.SwapBuffers(drv, disp, surf); + ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); RETURN_EGL_EVAL(disp, ret); } @@ -1433,6 +1459,8 @@ eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list) EGLImageKHR ret; _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); + if (!disp->Extensions.MESA_drm_image) + RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); img = drv->API.CreateDRMImageMESA(drv, disp, attr_list); ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR; @@ -1450,6 +1478,8 @@ eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, EGLBoolean ret; _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + assert(disp->Extensions.MESA_drm_image); + if (!img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); -- cgit v1.2.3 From d63b2622f1c47d6f82fe96c9f1b749d908883a23 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 30 Sep 2010 16:53:33 +0800 Subject: st/egl: Skip single-buffered configs in EGL. Let DRI2 report single-buffered configs and skip them in EGL. This is based on the patch by Luca Barbieri. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 4 ++++ src/gallium/state_trackers/egl/x11/native_dri2.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index ce2b1f7bb94..bfbb431058b 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -258,6 +258,10 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy, EGLint buffer_mask, api_mask; EGLBoolean valid; + /* skip single-buffered configs */ + if (!(nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))) + return EGL_FALSE; + buffer_mask = 0x0; if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK; diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 1be1e42468c..1169e273c34 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -518,10 +518,6 @@ dri2_display_convert_config(struct native_display *ndpy, if (!(mode->renderType & GLX_RGBA_BIT) || !mode->rgbMode) return FALSE; - /* skip single-buffered configs */ - if (!mode->doubleBufferMode) - return FALSE; - /* only interested in native renderable configs */ if (!mode->xRenderable || !mode->drawableType) return FALSE; -- cgit v1.2.3 From ebeb4a7e8af9f59ce8f45f78654b611bb546979d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 30 Sep 2010 17:09:59 +0800 Subject: mapi: Fix compiler warnings. Do not use "void *" in arithmetics. --- src/mapi/mapi/entry_x86-64_tls.h | 2 +- src/mapi/mapi/entry_x86_tls.h | 2 +- src/mapi/mapi/entry_x86_tsd.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h index 0f6e8125e84..2fbe73b5b32 100644 --- a/src/mapi/mapi/entry_x86-64_tls.h +++ b/src/mapi/mapi/entry_x86-64_tls.h @@ -61,7 +61,7 @@ entry_patch_public(void) void entry_patch(mapi_func entry, int slot) { - void *code = (void *) entry; + char *code = (char *) entry; *((unsigned int *) (code + 12)) = slot * sizeof(mapi_func); } diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h index ff2b9575f67..d4f7d98cf12 100644 --- a/src/mapi/mapi/entry_x86_tls.h +++ b/src/mapi/mapi/entry_x86_tls.h @@ -91,7 +91,7 @@ entry_patch_public(void) void entry_patch(mapi_func entry, int slot) { - void *code = (void *) entry; + char *code = (char *) entry; *((unsigned long *) (code + 8)) = slot * sizeof(mapi_func); } diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h index fbf4ec54971..f37c7473a6f 100644 --- a/src/mapi/mapi/entry_x86_tsd.h +++ b/src/mapi/mapi/entry_x86_tsd.h @@ -63,7 +63,7 @@ entry_patch_public(void) void entry_patch(mapi_func entry, int slot) { - void *code = (void *) entry; + char *code = (char *) entry; *((unsigned long *) (code + 11)) = slot * sizeof(mapi_func); *((unsigned long *) (code + 22)) = slot * sizeof(mapi_func); -- cgit v1.2.3 From 6f39280ba910e290fb3cda378057dc91e5811c95 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 28 Sep 2010 22:20:12 +0200 Subject: dri/nouveau: Have a smaller amount of larger scratch buffers. Larger VBOs avoid many kernel trips to get them in sync with the GPU. --- src/mesa/drivers/dri/nouveau/nouveau_render.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h b/src/mesa/drivers/dri/nouveau/nouveau_render.h index 923b79b2cf6..29d96eda77c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_render.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h @@ -55,8 +55,8 @@ struct nouveau_array_state { extract_f_t extract_f; }; -#define RENDER_SCRATCH_COUNT 32 -#define RENDER_SCRATCH_SIZE 64*1024 +#define RENDER_SCRATCH_COUNT 2 +#define RENDER_SCRATCH_SIZE 2*1024*1024 struct nouveau_scratch_state { struct nouveau_bo *bo[RENDER_SCRATCH_COUNT]; -- cgit v1.2.3 From bdd19da2183c685056c4c2eee5cea8358d9935cb Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 28 Sep 2010 22:24:05 +0200 Subject: dri/nouveau: Remove unnecessary flush. --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index fbe4edea584..1121d2d3d39 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -353,8 +353,6 @@ nouveau_validate_framebuffer(GLcontext *ctx) validate_framebuffer(dri_ctx, dri_read, &dri_ctx->dri2.read_stamp); - if (nouveau_next_dirty_state(ctx) >= 0) { + if (nouveau_next_dirty_state(ctx) >= 0) nouveau_state_emit(ctx); - FIRE_RING(context_chan(ctx)); - } } -- cgit v1.2.3 From 065163bcd2df12494ca523538736282fc847fa6b Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Sat, 25 Sep 2010 15:29:02 +0200 Subject: dri/nv10: Use fast Z clears. --- src/mesa/drivers/dri/nouveau/nouveau_class.h | 6 ++++ src/mesa/drivers/dri/nouveau/nouveau_context.h | 5 +++ src/mesa/drivers/dri/nouveau/nouveau_fbo.h | 6 +++- src/mesa/drivers/dri/nouveau/nv10_context.c | 45 +++++++++++++++++++++++--- src/mesa/drivers/dri/nouveau/nv10_driver.h | 8 +++++ src/mesa/drivers/dri/nouveau/nv10_state_fb.c | 29 ++++++++++++++--- 6 files changed, 88 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h b/src/mesa/drivers/dri/nouveau/nouveau_class.h index 5cb13acf7bc..d41d431f796 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_class.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h @@ -3191,6 +3191,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV17TCL_DMA_IN_MEMORY4 0x000001ac #define NV17TCL_DMA_IN_MEMORY5 0x000001b0 #define NV17TCL_COLOR_MASK_ENABLE 0x000002bc +#define NV17TCL_ZCLEAR_ENABLE 0x000003f8 +#define NV17TCL_ZCLEAR_VALUE 0x000003fc +#define NV17TCL_ZCLEAR_VALUE_DEPTH_SHIFT 8 +#define NV17TCL_ZCLEAR_VALUE_DEPTH_MASK 0xffffff00 +#define NV17TCL_ZCLEAR_VALUE_SEQUENCE_SHIFT 0 +#define NV17TCL_ZCLEAR_VALUE_SEQUENCE_MASK 0x000000ff #define NV17TCL_LMA_DEPTH_BUFFER_PITCH 0x00000d5c #define NV17TCL_LMA_DEPTH_BUFFER_OFFSET 0x00000d60 #define NV17TCL_LMA_DEPTH_FILL_VALUE 0x00000d68 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 3dbe72900a6..5f00327119b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -67,6 +67,11 @@ struct nouveau_context { struct nouveau_hw_state hw; struct nouveau_bo_state bo; struct nouveau_render_state render; + + struct { + GLboolean clear_blocked; + int clear_seq; + } hierz; }; #define to_nouveau_context(ctx) ((struct nouveau_context *)(ctx)) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h index 0fe6c08be55..05ea03a075f 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h @@ -29,8 +29,12 @@ struct nouveau_framebuffer { struct gl_framebuffer base; - struct nouveau_bo *lma_bo; GLboolean need_front; + + struct { + struct nouveau_bo *bo; + uint32_t clear_value; + } hierz; }; #define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x)) diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 08be2a25a0d..41723ff190f 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -40,9 +40,31 @@ static const struct dri_extension nv10_extensions[] = { { NULL, NULL } }; +static GLboolean +use_fast_zclear(GLcontext *ctx, GLbitfield buffers) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + + if (buffers & BUFFER_BIT_STENCIL) { + /* + * The stencil test is bypassed when fast Z clears are + * enabled. + */ + nctx->hierz.clear_blocked = GL_TRUE; + context_dirty(ctx, ZCLEAR); + return GL_FALSE; + } + + return !nctx->hierz.clear_blocked && + fb->_Xmax == fb->Width && fb->_Xmin == 0 && + fb->_Ymax == fb->Height && fb->_Ymin == 0; +} + static void nv10_clear(GLcontext *ctx, GLbitfield buffers) { + struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); struct nouveau_framebuffer *nfb = to_nouveau_framebuffer( @@ -50,16 +72,28 @@ nv10_clear(GLcontext *ctx, GLbitfield buffers) nouveau_validate_framebuffer(ctx); - /* Clear the LMA depth buffer, if present. */ - if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask && - nfb->lma_bo) { + if ((buffers & BUFFER_BIT_DEPTH) && + ctx->Depth.Mask && nfb->hierz.bo) { struct nouveau_surface *s = &to_nouveau_renderbuffer( nfb->base._DepthBuffer->Wrapped)->surface; + /* Clear the hierarchical depth buffer */ BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_FILL_VALUE, 1); OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, 0)); BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_BUFFER_CLEAR, 1); OUT_RING(chan, 1); + + /* Mark the depth buffer as cleared */ + if (use_fast_zclear(ctx, buffers)) { + if (nctx->hierz.clear_seq) + buffers &= ~BUFFER_BIT_DEPTH; + + nfb->hierz.clear_value = + pack_zs_f(s->format, ctx->Depth.Clear, 0); + nctx->hierz.clear_seq++; + + context_dirty(ctx, ZCLEAR); + } } nouveau_clear(ctx, buffers); @@ -423,7 +457,8 @@ const struct nouveau_driver nv10_driver = { nv10_emit_tex_obj, nouveau_emit_nothing, nouveau_emit_nothing, - nv10_emit_viewport + nv10_emit_viewport, + nv10_emit_zclear }, - .num_emit = NUM_NOUVEAU_STATE, + .num_emit = NUM_NV10_STATE, }; diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h b/src/mesa/drivers/dri/nouveau/nv10_driver.h index cefd6c6fba8..340ba05adee 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h @@ -27,6 +27,11 @@ #ifndef __NV10_DRIVER_H__ #define __NV10_DRIVER_H__ +enum { + NOUVEAU_STATE_ZCLEAR = NUM_NOUVEAU_STATE, + NUM_NV10_STATE +}; + #define NV10_TEXTURE_UNITS 2 /* nv10_context.c */ @@ -52,6 +57,9 @@ nv10_emit_scissor(GLcontext *ctx, int emit); void nv10_emit_viewport(GLcontext *ctx, int emit); +void +nv10_emit_zclear(GLcontext *ctx, int emit); + /* nv10_state_polygon.c */ void nv10_emit_cull_face(GLcontext *ctx, int emit); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c index a2fcb6b6959..98eb0e8eceb 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c @@ -62,14 +62,14 @@ setup_lma_buffer(GLcontext *ctx) height = align(fb->Height, 2), size = pitch * height; - if (!nfb->lma_bo || nfb->lma_bo->size != size) { - nouveau_bo_ref(NULL, &nfb->lma_bo); + if (!nfb->hierz.bo || nfb->hierz.bo->size != size) { + nouveau_bo_ref(NULL, &nfb->hierz.bo); nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size, - &nfb->lma_bo); + &nfb->hierz.bo); } nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET, - nfb->lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); + nfb->hierz.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); WAIT_RING(chan, 9); BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4); @@ -134,8 +134,10 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit) nouveau_bo_markl(bctx, celsius, NV10TCL_ZETA_OFFSET, s->bo, 0, bo_flags); - if (context_chipset(ctx) >= 0x17) + if (context_chipset(ctx) >= 0x17) { setup_lma_buffer(ctx); + context_dirty(ctx, ZCLEAR); + } } BEGIN_RING(chan, celsius, NV10TCL_RT_FORMAT, 2); @@ -187,3 +189,20 @@ nv10_emit_viewport(GLcontext *ctx, int emit) context_dirty(ctx, PROJECTION); } + +void +nv10_emit_zclear(GLcontext *ctx, int emit) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct nouveau_channel *chan = context_chan(ctx); + struct nouveau_grobj *celsius = context_eng3d(ctx); + struct nouveau_framebuffer *nfb = + to_nouveau_framebuffer(ctx->DrawBuffer); + + if (nfb->hierz.bo) { + BEGIN_RING(chan, celsius, NV17TCL_ZCLEAR_ENABLE, 2); + OUT_RING(chan, nctx->hierz.clear_blocked ? 0 : 1); + OUT_RING(chan, nfb->hierz.clear_value | + (nctx->hierz.clear_seq & 0xff)); + } +} -- cgit v1.2.3 From 7d0b89fda056c89c265518a745ec751287723a12 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:25:21 -0700 Subject: swrast: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/swrast/s_aatriangle.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index 1d90f322a3a..175316790d7 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -31,7 +31,6 @@ #include "main/glheader.h" #include "main/context.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "s_aatriangle.h" -- cgit v1.2.3 From 3b7b1db66162bc762e6ff19131dcd76211de7160 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:25:31 -0700 Subject: egl: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/egl/main/egldriver.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 67f1d3dbaa4..a4ff6911be6 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -18,7 +18,6 @@ #include "eglmisc.h" #include "eglmode.h" #include "eglscreen.h" -#include "eglstring.h" #include "eglsurface.h" #include "eglimage.h" #include "eglsync.h" -- cgit v1.2.3 From 237fa8a81c03b754a425c00b43d5a8e3eb33c228 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:25:36 -0700 Subject: gallium/rtasm: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/gallium/auxiliary/rtasm/rtasm_execmem.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 65d5ce795be..fbde1d191a4 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -58,7 +58,6 @@ #include #include -#include "os/os_thread.h" #include "util/u_mm.h" #define EXEC_HEAP_SIZE (10*1024*1024) -- cgit v1.2.3 From b719c91c8277ef382efab38219cf7f806b4f95f9 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:27:09 -0700 Subject: gallium/util: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/gallium/auxiliary/util/u_sse.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index 87959ab0aab..03198c91da4 100644 --- a/src/gallium/auxiliary/util/u_sse.h +++ b/src/gallium/auxiliary/util/u_sse.h @@ -78,8 +78,6 @@ _mm_castps_si128(__m128 a) #else /* !PIPE_ARCH_SSSE3 */ -#include - /** * Describe _mm_shuffle_epi8() with gcc extended inline assembly, for cases * where -mssse3 is not supported/enabled. -- cgit v1.2.3 From 3e472bee2d9e9359794978d40872f842b2d77d9c Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:28:18 -0700 Subject: gallium/i915: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/gallium/drivers/i915/i915_state_emit.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c index 7bb7893d939..bd059d5716c 100644 --- a/src/gallium/drivers/i915/i915_state_emit.c +++ b/src/gallium/drivers/i915/i915_state_emit.c @@ -30,7 +30,6 @@ #include "i915_context.h" #include "i915_batch.h" #include "i915_debug.h" -#include "i915_reg.h" #include "i915_resource.h" #include "pipe/p_context.h" -- cgit v1.2.3 From d2149f6f2256deda180fd1a4c38cb436660e7407 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:29:49 -0700 Subject: gallium/llvmpipe: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index a95c15751cc..3b217f95447 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -33,7 +33,6 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "lp_perf.h" -#include "lp_setup_context.h" #include "lp_rast.h" #include "lp_state_fs.h" #include "tgsi/tgsi_scan.h" -- cgit v1.2.3 From 6f136094f4b323c99088fb16dbfe757af01a76ed Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:31:08 -0700 Subject: gallium/softpipe: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/gallium/drivers/softpipe/sp_state_sampler.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index aedb5bb19b3..b59fbc33ed6 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -32,7 +32,6 @@ #include "util/u_memory.h" #include "util/u_inlines.h" -#include "draw/draw_context.h" #include "draw/draw_context.h" #include "sp_context.h" -- cgit v1.2.3 From 218d9737864f389d4bd8892d27643789f79b5af6 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:32:40 -0700 Subject: gallium/st: remove duplicated includes Remove duplicated includes. Signed-off-by: Brian Paul --- src/gallium/state_trackers/python/st_device.c | 1 - src/gallium/state_trackers/vega/api_images.c | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index dce24bc17d6..29813456b5f 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -31,7 +31,6 @@ #include "pipe/p_shader_tokens.h" #include "util/u_inlines.h" #include "cso_cache/cso_context.h" -#include "util/u_inlines.h" #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_sampler.h" diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c index 547508f815a..c36b3d2f3c8 100644 --- a/src/gallium/state_trackers/vega/api_images.c +++ b/src/gallium/state_trackers/vega/api_images.c @@ -31,7 +31,6 @@ #include "vg_context.h" #include "vg_translate.h" #include "api_consts.h" -#include "image.h" #include "api.h" #include "pipe/p_context.h" -- cgit v1.2.3 From 3f28dbd9bb78f03681005cafa115008595b3c27d Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:33:43 -0700 Subject: gallium/winsys: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/gallium/winsys/svga/drm/vmw_screen_dri.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c index 7bd4407e9f1..258084a1f10 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_dri.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c @@ -30,7 +30,6 @@ #include "util/u_format.h" #include "vmw_screen.h" -#include "vmw_screen.h" #include "vmw_surface.h" #include "svga_drm_public.h" -- cgit v1.2.3 From 7eed3dba58740a8ade94cfab315afa198d1beebe Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:34:53 -0700 Subject: glx: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/glx/glxclient.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 324b5a65c19..36a0808c048 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -89,8 +89,6 @@ typedef struct __GLXDRIdisplayRec __GLXDRIdisplay; typedef struct __GLXDRIscreenRec __GLXDRIscreen; typedef struct __GLXDRIdrawableRec __GLXDRIdrawable; -#include "glxextensions.h" - struct __GLXDRIdisplayRec { /** -- cgit v1.2.3 From c24e062fdbf21114904258687f95d3d45911f893 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:36:12 -0700 Subject: dri/common: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/common/vblank.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index 29d1ad8003b..067fb5ed8d6 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -61,10 +61,6 @@ extern int driWaitForVBlank( __DRIdrawable *priv, #include /* for usleep() */ #include /* for sched_yield() */ -#ifdef linux -#include /* for sched_yield() */ -#endif - #define DO_USLEEP(nr) \ do { \ if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \ -- cgit v1.2.3 From b958dabe1602d9a59b0aef0c004f8cf20c3e9c70 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:37:26 -0700 Subject: dri/i810: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/i810/i810tex.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index 2ccb9562e90..5c5c80d16d3 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -31,7 +31,6 @@ #include "main/teximage.h" #include "main/texobj.h" #include "main/colormac.h" -#include "main/texobj.h" #include "main/mm.h" #include "texmem.h" -- cgit v1.2.3 From f831212eabe25ea2603be13d8d40b12477012acc Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:38:53 -0700 Subject: dri/i915: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/i915/i915_context.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index bf6762d6666..412714ada8e 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -40,7 +40,6 @@ #include "i915_reg.h" #include "i915_program.h" -#include "intel_tris.h" #include "intel_span.h" /*************************************** -- cgit v1.2.3 From c24144f41fe797a0448f60705d9023902f1178ce Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:39:59 -0700 Subject: dri/i965: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/i965/brw_vtbl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 8f1601d10f1..3d7a98c9812 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -43,7 +43,6 @@ #include "brw_defines.h" #include "brw_state.h" #include "brw_draw.h" -#include "brw_state.h" #include "brw_vs.h" #include "brw_wm.h" -- cgit v1.2.3 From 1a98a463043e1558b1ad6ebf79a1371d6218ac5a Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:41:26 -0700 Subject: dri/intel: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/intel/intel_tex_image.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 03aba58e107..187e537aacb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -10,7 +10,6 @@ #include "main/texstore.h" #include "main/texgetimage.h" #include "main/texobj.h" -#include "main/texstore.h" #include "main/teximage.h" #include "intel_context.h" -- cgit v1.2.3 From f094b352073bf5414a101b056f47f1ee2f814e81 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:42:41 -0700 Subject: dri/mga: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/mga/mga_xmesa.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 069947e252a..13f73a83e90 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -57,7 +57,6 @@ #include "mgatris.h" #include "mgavb.h" #include "mgapixel.h" -#include "mga_xmesa.h" #include "mga_dri.h" #include "utils.h" -- cgit v1.2.3 From 705d98deb80db476ef37674d256530fae68171c1 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:43:48 -0700 Subject: dri/r128: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/r128/r128_tex.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index b5a19b510af..2dd47b06a56 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -43,7 +43,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/teximage.h" #include "main/texobj.h" #include "main/imports.h" -#include "main/texobj.h" #include "main/macros.h" #include "xmlpool.h" -- cgit v1.2.3 From 223c4b418854a6c260723ae8bc4afd7a27463c22 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:44:55 -0700 Subject: dri/r300: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/r300/radeon_context.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h index da4812d3234..e793656dbea 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.h +++ b/src/mesa/drivers/dri/r300/radeon_context.h @@ -49,8 +49,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drm.h" #include "dri_util.h" -#include "radeon_screen.h" - #define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__); /* TCL fallbacks */ -- cgit v1.2.3 From a7670be8a15c56b625f2f1aad08eeff2414200b4 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:46:06 -0700 Subject: dri/r600: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/r600/r600_cmdbuf.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c index b3331fc8b88..ce2f7779563 100644 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c +++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c @@ -47,7 +47,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_reg.h" #include "r600_cmdbuf.h" #include "radeon_bocs_wrapper.h" -#include "radeon_reg.h" #ifdef HAVE_LIBDRM_RADEON #include "radeon_cs_int.h" -- cgit v1.2.3 From 1663e6da2f15ff8db9f08ca6a7337f8bd28add17 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:47:22 -0700 Subject: dri/radeon: remove duplicated includes Remove duplicated includes. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 1 - src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 5ac526c6deb..d08a82f1a55 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -44,7 +44,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/glheader.h" #include "main/imports.h" #include "main/simple_list.h" -#include "swrast/swrast.h" #include "radeon_context.h" #include "radeon_common.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index 98f96ff2a76..ad3bc2d23db 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_pipeline.h" -#include "math/m_translate.h" #include "radeon_context.h" #include "radeon_state.h" #include "radeon_ioctl.h" -- cgit v1.2.3 From 8c92a80b6210bf7d977816690476ff336b350c79 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:48:29 -0700 Subject: dri/savage: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/drivers/dri/savage/savage_xmesa.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index cbdc9c87eeb..bbf2fd3a0ed 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -25,7 +25,6 @@ #include -#include "main/context.h" #include "main/context.h" #include "main/matrix.h" #include "main/framebuffer.h" -- cgit v1.2.3 From 9674929bce0c0ea4862b468d0a1a7e58b2664049 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:50:43 -0700 Subject: main: remove duplicated includes Remove duplicated includes. Signed-off-by: Brian Paul --- src/mesa/main/api_exec.c | 5 +---- src/mesa/main/dlist.c | 1 - src/mesa/main/renderbuffer.c | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index b87aa47d88b..ae653e1914e 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -91,10 +91,7 @@ #include "mtypes.h" #include "varray.h" #include "viewport.h" -#if FEATURE_NV_vertex_program -#include "nvprogram.h" -#endif -#if FEATURE_NV_fragment_program +#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program #include "nvprogram.h" #endif #if FEATURE_ARB_shader_objects diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 3a730f0e406..cccec248539 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -52,7 +52,6 @@ #include "hash.h" #include "image.h" #include "light.h" -#include "dlist.h" #include "macros.h" #include "queryobj.h" #include "teximage.h" diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index adc1199d87a..118fb52bb2e 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -46,7 +46,6 @@ #include "fbobject.h" #include "formats.h" #include "mtypes.h" -#include "fbobject.h" #include "renderbuffer.h" -- cgit v1.2.3 From bad10b961aeae8d695ecec600d47de5f8505b396 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:52:02 -0700 Subject: math: remove duplicated includes Remove duplicated includes. Signed-off-by: Brian Paul --- src/mesa/math/m_matrix.c | 1 - src/mesa/math/m_vector.c | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 048b231c4ed..02aedbad856 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -37,7 +37,6 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/macros.h" -#include "main/imports.h" #include "m_matrix.h" diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index fbd63fd923c..4bded31e096 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -30,7 +30,6 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/macros.h" -#include "main/imports.h" #include "m_vector.h" -- cgit v1.2.3 From 4160d947d289c07f1de6b8bf21a874e842b51f51 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Thu, 30 Sep 2010 07:53:13 -0700 Subject: st: remove duplicated include Remove duplicated include. Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_cb_rasterpos.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 7b2eb8012de..e5f7b6f91e2 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -44,7 +44,6 @@ #include "st_atom.h" #include "st_draw.h" #include "st_cb_rasterpos.h" -#include "st_draw.h" #include "draw/draw_context.h" #include "draw/draw_pipe.h" #include "vbo/vbo.h" -- cgit v1.2.3 From e2b51b7c5baaaa21e64df1377ce0be5c83d016ff Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 30 Sep 2010 23:43:58 +0800 Subject: st/egl: Drop context argument from egl_g3d_get_egl_image. Fix a regression since 17eace581d25a626a7d75d9d1205d012cbb14a6e. --- src/gallium/state_trackers/egl/common/egl_g3d_st.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c index 05cdb0d421c..0affe632cfe 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c @@ -51,7 +51,6 @@ egl_g3d_st_manager(struct st_manager *smapi) static boolean egl_g3d_st_manager_get_egl_image(struct st_manager *smapi, - struct st_context_iface *stctx, void *egl_image, struct st_egl_image *out) { -- cgit v1.2.3 From 4e6f5e8d43ee87c6f8cdc75de2eeb96f70beb013 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 30 Sep 2010 17:39:17 +0100 Subject: gallivm: More comprehensive border usage logic. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 33 ++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_sample.h | 5 +++ src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 42 +++++++---------------- 3 files changed, 51 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d9fbc0f3057..d9fbbbe70f7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -45,6 +45,39 @@ #include "lp_bld_type.h" +/** + * Does the given texture wrap mode allow sampling the texture border color? + * XXX maybe move this into gallium util code. + */ +boolean +lp_sampler_wrap_mode_uses_border_color(unsigned mode, + unsigned min_img_filter, + unsigned mag_img_filter) +{ + switch (mode) { + case PIPE_TEX_WRAP_REPEAT: + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_MIRROR_REPEAT: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return FALSE; + case PIPE_TEX_WRAP_CLAMP: + case PIPE_TEX_WRAP_MIRROR_CLAMP: + if (min_img_filter == PIPE_TEX_FILTER_NEAREST && + mag_img_filter == PIPE_TEX_FILTER_NEAREST) { + return FALSE; + } else { + return TRUE; + } + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return TRUE; + default: + assert(0 && "unexpected wrap mode"); + return FALSE; + } +} + + /** * Initialize lp_sampler_static_state object with the gallium sampler * and texture state. diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index bb485784ef5..9fc9a38a49e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -254,6 +254,11 @@ texture_dims(enum pipe_texture_target tex) } +boolean +lp_sampler_wrap_mode_uses_border_color(unsigned mode, + unsigned min_img_filter, + unsigned mag_img_filter); + /** * Derive the sampler static state. */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 33740f97599..36a77d3aff0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -58,31 +58,6 @@ #include "lp_bld_quad.h" -/** - * Does the given texture wrap mode allow sampling the texture border color? - * XXX maybe move this into gallium util code. - */ -static boolean -wrap_mode_uses_border_color(unsigned mode) -{ - switch (mode) { - case PIPE_TEX_WRAP_REPEAT: - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - case PIPE_TEX_WRAP_MIRROR_REPEAT: - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - return FALSE; - case PIPE_TEX_WRAP_CLAMP: - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - case PIPE_TEX_WRAP_MIRROR_CLAMP: - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - return TRUE; - default: - assert(0 && "unexpected wrap mode"); - return FALSE; - } -} - - /** * Generate code to fetch a texel from a texture at int coords (x, y, z). * The computation depends on whether the texture is 1D, 2D or 3D. @@ -106,21 +81,27 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, LLVMValueRef data_ptr, LLVMValueRef texel_out[4]) { - const int dims = texture_dims(bld->static_state->target); + const struct lp_sampler_static_state *static_state = bld->static_state; + const int dims = texture_dims(static_state->target); struct lp_build_context *int_coord_bld = &bld->int_coord_bld; LLVMValueRef offset; LLVMValueRef i, j; LLVMValueRef use_border = NULL; /* use_border = x < 0 || x >= width || y < 0 || y >= height */ - if (wrap_mode_uses_border_color(bld->static_state->wrap_s)) { + if (lp_sampler_wrap_mode_uses_border_color(static_state->wrap_s, + static_state->min_img_filter, + static_state->mag_img_filter)) { LLVMValueRef b1, b2; b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, x, int_coord_bld->zero); b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, x, width); use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2"); } - if (dims >= 2 && wrap_mode_uses_border_color(bld->static_state->wrap_t)) { + if (dims >= 2 && + lp_sampler_wrap_mode_uses_border_color(static_state->wrap_t, + static_state->min_img_filter, + static_state->mag_img_filter)) { LLVMValueRef b1, b2; b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, y, int_coord_bld->zero); b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, y, height); @@ -133,7 +114,10 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, } } - if (dims == 3 && wrap_mode_uses_border_color(bld->static_state->wrap_r)) { + if (dims == 3 && + lp_sampler_wrap_mode_uses_border_color(static_state->wrap_r, + static_state->min_img_filter, + static_state->mag_img_filter)) { LLVMValueRef b1, b2; b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, z, int_coord_bld->zero); b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, z, depth); -- cgit v1.2.3 From 874f3a57ce5ae41ced103bf5a549a2eb663db6c5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Sep 2010 10:52:26 -0600 Subject: gallivm: check for level=0 case in lp_build_minify() This lets us avoid the shift and max() operations. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d9fbbbe70f7..6e53bca269a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -362,9 +362,16 @@ lp_build_minify(struct lp_build_sample_context *bld, LLVMValueRef base_size, LLVMValueRef level) { - LLVMValueRef size = LLVMBuildLShr(bld->builder, base_size, level, "minify"); - size = lp_build_max(&bld->int_coord_bld, size, bld->int_coord_bld.one); - return size; + if (level == bld->int_coord_bld.zero) { + /* if we're using mipmap level zero, no minification is needed */ + return base_size; + } + else { + LLVMValueRef size = + LLVMBuildLShr(bld->builder, base_size, level, "minify"); + size = lp_build_max(&bld->int_coord_bld, size, bld->int_coord_bld.one); + return size; + } } -- cgit v1.2.3 From 153105cfbfd8d6ff30de144605016f6e4f2a1b9e Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 30 Sep 2010 10:43:26 -0400 Subject: r600g: use constant buffer instead of register for constant Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_state.c | 47 ++++++++++++--------------- src/gallium/drivers/r600/r600d.h | 5 +++ src/gallium/winsys/r600/drm/r600_hw_context.c | 34 +++---------------- src/gallium/winsys/r600/drm/r600d.h | 5 +++ 4 files changed, 36 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 23323f1ea2b..23c2e5964a4 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1148,41 +1148,35 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint struct pipe_resource *buffer) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - struct r600_pipe_state *rstate; - struct pipe_transfer *transfer; - unsigned *nconst = NULL; - u32 *ptr, offset; + struct r600_resource *rbuffer = (struct r600_resource*)buffer; switch (shader) { case PIPE_SHADER_VERTEX: - rstate = rctx->vs_const; - nconst = &rctx->vs_nconst; - offset = R_030000_SQ_ALU_CONSTANT0_0 + 0x1000; + rctx->vs_const_buffer.nregs = 0; + r600_pipe_state_add_reg(&rctx->vs_const_buffer, + R_028180_ALU_CONST_BUFFER_SIZE_VS_0, + ALIGN_DIVUP(buffer->width0 >> 4, 16), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rctx->vs_const_buffer, + R_028980_ALU_CONST_CACHE_VS_0, + 0, 0xFFFFFFFF, rbuffer->bo); + r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); break; case PIPE_SHADER_FRAGMENT: - rstate = rctx->ps_const; - nconst = &rctx->ps_nconst; - offset = R_030000_SQ_ALU_CONSTANT0_0; + rctx->ps_const_buffer.nregs = 0; + r600_pipe_state_add_reg(&rctx->ps_const_buffer, + R_028140_ALU_CONST_BUFFER_SIZE_PS_0, + ALIGN_DIVUP(buffer->width0 >> 4, 16), + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&rctx->ps_const_buffer, + R_028940_ALU_CONST_CACHE_PS_0, + 0, 0xFFFFFFFF, rbuffer->bo); + r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); break; default: R600_ERR("unsupported %d\n", shader); return; } - if (buffer && buffer->width0 > 0) { - *nconst = buffer->width0 / 16; - ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer); - if (ptr == NULL) - return; - for (int i = 0; i < *nconst; i++, offset += 0x10) { - rstate[i].nregs = 0; - r600_pipe_state_add_reg(&rstate[i], offset + 0x0, ptr[i * 4 + 0], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], offset + 0x4, ptr[i * 4 + 1], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], offset + 0x8, ptr[i * 4 + 2], 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(&rstate[i], offset + 0xC, ptr[i * 4 + 3], 0xFFFFFFFF, NULL); - r600_context_pipe_state_set(&rctx->ctx, &rstate[i]); - } - pipe_buffer_unmap(ctx, buffer, transfer); - } } static void *r600_create_shader_state(struct pipe_context *ctx, @@ -1191,6 +1185,7 @@ static void *r600_create_shader_state(struct pipe_context *ctx, struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); int r; + shader->shader.use_mem_constant = TRUE; r = r600_pipe_shader_create(ctx, shader, state->tokens); if (r) { return NULL; @@ -1436,7 +1431,7 @@ void r600_init_config(struct r600_pipe_context *rctx) tmp |= S_008C00_VC_ENABLE(1); break; } - tmp |= S_008C00_DX9_CONSTS(1); + tmp |= S_008C00_DX9_CONSTS(0); tmp |= S_008C00_ALU_INST_PREFER_VECTOR(1); tmp |= S_008C00_PS_PRIO(ps_prio); tmp |= S_008C00_VS_PRIO(vs_prio); diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 47ab1eb9650..169cda5295b 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -3484,6 +3484,11 @@ #define R_038014_RESOURCE0_WORD5 0x038014 #define R_038018_RESOURCE0_WORD6 0x038018 +#define R_028140_ALU_CONST_BUFFER_SIZE_PS_0 0x00028140 +#define R_028180_ALU_CONST_BUFFER_SIZE_VS_0 0x00028180 +#define R_028940_ALU_CONST_CACHE_PS_0 0x00028940 +#define R_028980_ALU_CONST_CACHE_VS_0 0x00028980 + #define SQ_TEX_INST_LD 0x03 #define SQ_TEX_INST_GET_GRADIENTS_H 0x7 #define SQ_TEX_INST_GET_GRADIENTS_V 0x8 diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index d1cf9e93f8a..f363b698bc0 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -253,6 +253,10 @@ static const struct r600_reg r600_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0}, {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0}, {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, @@ -479,23 +483,6 @@ static const struct r600_reg r600_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0}, }; -/* SHADER CONSTANT R600/R700 */ -static int r600_state_constant_init(struct r600_context *ctx, u32 offset) -{ - struct r600_reg r600_shader_constant[] = { - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030000_SQ_ALU_CONSTANT0_0, 0, 0}, - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030004_SQ_ALU_CONSTANT1_0, 0, 0}, - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_030008_SQ_ALU_CONSTANT2_0, 0, 0}, - {PKT3_SET_ALU_CONST, R600_ALU_CONST_OFFSET, R_03000C_SQ_ALU_CONSTANT3_0, 0, 0}, - }; - unsigned nreg = sizeof(r600_shader_constant)/sizeof(struct r600_reg); - - for (int i = 0; i < nreg; i++) { - r600_shader_constant[i].offset += offset; - } - return r600_context_add_block(ctx, r600_shader_constant, nreg); -} - /* SHADER RESOURCE R600/R700 */ static int r600_state_resource_init(struct r600_context *ctx, u32 offset) { @@ -578,6 +565,7 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) int r; memset(ctx, 0, sizeof(struct r600_context)); + radeon->use_mem_constant = TRUE; ctx->radeon = radeon; LIST_INITHEAD(&ctx->query_list); @@ -640,18 +628,6 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) if (r) goto out_err; } - /* PS CONSTANT */ - for (int j = 0, offset = 0; j < 256; j++, offset += 0x10) { - r = r600_state_constant_init(ctx, offset); - if (r) - goto out_err; - } - /* VS CONSTANT */ - for (int j = 0, offset = 0x1000; j < 256; j++, offset += 0x10) { - r = r600_state_constant_init(ctx, offset); - if (r) - goto out_err; - } /* setup block table */ ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index fcce2934d39..5c08c5a04d1 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -2200,4 +2200,9 @@ #define R_038014_RESOURCE0_WORD5 0x038014 #define R_038018_RESOURCE0_WORD6 0x038018 +#define R_028140_ALU_CONST_BUFFER_SIZE_PS_0 0x00028140 +#define R_028180_ALU_CONST_BUFFER_SIZE_VS_0 0x00028180 +#define R_028940_ALU_CONST_CACHE_PS_0 0x00028940 +#define R_028980_ALU_CONST_CACHE_VS_0 0x00028980 + #endif -- cgit v1.2.3 From 0c86e1f29483d9557f30796c03b94a34d965c095 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 30 Sep 2010 14:08:35 -0400 Subject: i965: Update renderer strings for sandybridge Signed-off-by: Adam Jackson --- src/mesa/drivers/dri/intel/intel_context.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index edcc9536da2..039ac6d4c12 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -163,6 +163,19 @@ intelGetString(GLcontext * ctx, GLenum name) case PCI_CHIP_ILM_G: chipset = "Intel(R) Ironlake Mobile"; break; + case PCI_CHIP_SANDYBRIDGE_GT1: + case PCI_CHIP_SANDYBRIDGE_GT2: + case PCI_CHIP_SANDYBRIDGE_GT2_PLUS: + chipset = "Intel(R) Sandybridge Desktop"; + break; + case PCI_CHIP_SANDYBRIDGE_M_GT1: + case PCI_CHIP_SANDYBRIDGE_M_GT2: + case PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS: + chipset = "Intel(R) Sandybridge Mobile"; + break; + case PCI_CHIP_SANDYBRIDGE_S: + chipset = "Intel(R) Sandybridge Server"; + break; default: chipset = "Unknown Intel Chipset"; break; -- cgit v1.2.3 From 76a60faf529e6107e3f50406c0d40e64bc484686 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Sun, 26 Sep 2010 18:57:59 -0600 Subject: Implement x86_64 atomics for compilers w/o intrinsics. Really old gcc's (3.3, at least) don't have support for the intrinsics we need. This implements a fallback for that case. --- src/gallium/auxiliary/util/u_atomic.h | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index a1568233906..8434491a421 100644 --- a/src/gallium/auxiliary/util/u_atomic.h +++ b/src/gallium/auxiliary/util/u_atomic.h @@ -29,6 +29,8 @@ #define PIPE_ATOMIC_ASM_MSVC_X86 #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_GCC_X86 +#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)) +#define PIPE_ATOMIC_ASM_GCC_X86_64 #elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) #define PIPE_ATOMIC_GCC_INTRINSIC #else @@ -36,6 +38,51 @@ #endif +#if defined(PIPE_ATOMIC_ASM_GCC_X86_64) +#define PIPE_ATOMIC "GCC x86_64 assembly" + +#ifdef __cplusplus +extern "C" { +#endif + +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) + +static INLINE boolean +p_atomic_dec_zero(int32_t *v) +{ + unsigned char c; + + __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c) + ::"memory"); + + return c != 0; +} + +static INLINE void +p_atomic_inc(int32_t *v) +{ + __asm__ __volatile__("lock; incl %0":"+m"(*v)); +} + +static INLINE void +p_atomic_dec(int32_t *v) +{ + __asm__ __volatile__("lock; decl %0":"+m"(*v)); +} + +static INLINE int32_t +p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) +{ + return __sync_val_compare_and_swap(v, old, _new); +} + +#ifdef __cplusplus +} +#endif + +#endif /* PIPE_ATOMIC_ASM_GCC_X86_64 */ + #if defined(PIPE_ATOMIC_ASM_GCC_X86) -- cgit v1.2.3 From 5f66b340aa49c6bc8d0acb2d1a6f8e9a7ef2cb2e Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Sun, 26 Sep 2010 22:32:15 -0600 Subject: Prefer intrinsics to handrolled atomic ops. --- src/gallium/auxiliary/util/u_atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index 8434491a421..4ae6def495a 100644 --- a/src/gallium/auxiliary/util/u_atomic.h +++ b/src/gallium/auxiliary/util/u_atomic.h @@ -27,12 +27,12 @@ #define PIPE_ATOMIC_MSVC_INTRINSIC #elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_MSVC_X86 +#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) +#define PIPE_ATOMIC_GCC_INTRINSIC #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_GCC_X86 #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)) #define PIPE_ATOMIC_ASM_GCC_X86_64 -#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) -#define PIPE_ATOMIC_GCC_INTRINSIC #else #error "Unsupported platform" #endif -- cgit v1.2.3 From 9d4ae914e28ac7857a32a88ba27aecc182f697c6 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 30 Sep 2010 16:26:33 -0400 Subject: r600g: fix constant & literal src splitting, also fix mplayer gl2 shader Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_shader.c | 56 ++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 8d40079353a..a2091db460b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -777,12 +777,12 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s } } for (i = 0, j = nconst - 1; i < inst->Instruction.NumSrcRegs; i++) { - if (inst->Src[j].Register.File == TGSI_FILE_CONSTANT && j > 0) { + if (j > 0 && inst->Src[i].Register.File == TGSI_FILE_CONSTANT) { int treg = r600_get_temp(ctx); for (k = 0; k < 4; k++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV); - alu.src[0].sel = r600_src[j].sel; + alu.src[0].sel = r600_src[i].sel; alu.src[0].chan = k; alu.dst.sel = treg; alu.dst.chan = k; @@ -793,7 +793,7 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s if (r) return r; } - r600_src[j].sel = treg; + r600_src[i].sel = treg; j--; } } @@ -805,20 +805,20 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_ { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu alu; - int i, j, k, nliteral, r; + int i, j, k, nliteral, r, index; for (i = 0, nliteral = 0; i < inst->Instruction.NumSrcRegs; i++) { if (inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) { nliteral++; } } - for (i = 0, j = 0; i < inst->Instruction.NumSrcRegs; i++) { - if (inst->Src[j].Register.File == TGSI_FILE_IMMEDIATE) { + for (i = 0, j = nliteral - 1; i < inst->Instruction.NumSrcRegs; i++) { + if (j > 0 && inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) { int treg = r600_get_temp(ctx); for (k = 0; k < 4; k++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV); - alu.src[0].sel = r600_src[j].sel; + alu.src[0].sel = r600_src[i].sel; alu.src[0].chan = k; alu.dst.sel = treg; alu.dst.chan = k; @@ -829,11 +829,11 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_ if (r) return r; } - r = r600_bc_add_literal(ctx->bc, ctx->value); + r = r600_bc_add_literal(ctx->bc, &ctx->literals[inst->Src[i].Register.Index * 4]); if (r) return r; - r600_src[j].sel = treg; - j++; + r600_src[i].sel = treg; + j--; } } return 0; @@ -854,6 +854,9 @@ static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap) } r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; for (i = 0; i < lasti + 1; i++) { @@ -924,6 +927,9 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx, memset(lit_vals, 0, 4*4); r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; @@ -1463,6 +1469,9 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx) int i, r; r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; @@ -1559,6 +1568,9 @@ static int tgsi_op3(struct r600_shader_ctx *ctx) int i, j, r; r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; /* do it in 2 step as op3 doesn't support writemask */ @@ -1591,6 +1603,9 @@ static int tgsi_dp(struct r600_shader_ctx *ctx) int i, j, r; r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; for (i = 0; i < 4; i++) { @@ -1666,7 +1681,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) r = r600_bc_add_alu(ctx->bc, &alu); if (r) return r; - + for (i = 0; i < 3; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL); @@ -1843,10 +1858,10 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) tex.sampler_id = tex.resource_id; tex.src_gpr = src_gpr; tex.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + inst->Dst[0].Register.Index; - tex.dst_sel_x = 0; - tex.dst_sel_y = 1; - tex.dst_sel_z = 2; - tex.dst_sel_w = 3; + tex.dst_sel_x = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7; + tex.dst_sel_y = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7; + tex.dst_sel_z = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7; + tex.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7; tex.src_sel_x = 0; tex.src_sel_y = 1; tex.src_sel_z = 2; @@ -1887,6 +1902,9 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx) int r; r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; /* 1 - src0 */ @@ -1966,6 +1984,9 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx) int i, r; r = tgsi_split_constant(ctx, r600_src); + if (r) + return r; + r = tgsi_split_literal_constant(ctx, r600_src); if (r) return r; @@ -2019,7 +2040,10 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx) r = tgsi_split_constant(ctx, r600_src); if (r) return r; - + r = tgsi_split_literal_constant(ctx, r600_src); + if (r) + return r; + for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL); -- cgit v1.2.3 From 3661f757ee7e75348f0df834ecf1febb211ddf66 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Thu, 30 Sep 2010 14:39:14 -0600 Subject: Revert "Prefer intrinsics to handrolled atomic ops." This reverts commit 5f66b340aa49c6bc8d0acb2d1a6f8e9a7ef2cb2e, quickly fixing 30514. --- src/gallium/auxiliary/util/u_atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index 4ae6def495a..8434491a421 100644 --- a/src/gallium/auxiliary/util/u_atomic.h +++ b/src/gallium/auxiliary/util/u_atomic.h @@ -27,12 +27,12 @@ #define PIPE_ATOMIC_MSVC_INTRINSIC #elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_MSVC_X86 -#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) -#define PIPE_ATOMIC_GCC_INTRINSIC #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_GCC_X86 #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)) #define PIPE_ATOMIC_ASM_GCC_X86_64 +#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) +#define PIPE_ATOMIC_GCC_INTRINSIC #else #error "Unsupported platform" #endif -- cgit v1.2.3 From 6f6542a483ec726538f8a4555bddaeb0be6b2146 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Sep 2010 11:46:24 -0700 Subject: i965: Fix whole-structure/array assignment in new FS. We need to walk the type tree to get the right register types for structure components. Fixes glsl-fs-statevar-call. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 76 ++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index efbb4c66920..efa0f2136b2 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -469,6 +469,8 @@ public: void emit_general_interpolation(ir_variable *ir); void emit_interpolation_setup(); void emit_fb_writes(); + void emit_assignment_writes(fs_reg &l, fs_reg &r, + const glsl_type *type, bool predicated); struct brw_reg interp_reg(int location, int channel); int setup_uniform_values(int loc, const glsl_type *type); @@ -1137,12 +1139,51 @@ fs_visitor::visit(ir_expression *ir) } } +void +fs_visitor::emit_assignment_writes(fs_reg &l, fs_reg &r, + const glsl_type *type, bool predicated) +{ + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + for (unsigned int i = 0; i < type->components(); i++) { + l.type = brw_type_for_base_type(type); + r.type = brw_type_for_base_type(type); + + fs_inst *inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); + inst->predicated = predicated; + + l.reg_offset++; + r.reg_offset++; + } + break; + case GLSL_TYPE_ARRAY: + for (unsigned int i = 0; i < type->length; i++) { + emit_assignment_writes(l, r, type->fields.array, predicated); + } + + case GLSL_TYPE_STRUCT: + for (unsigned int i = 0; i < type->length; i++) { + emit_assignment_writes(l, r, type->fields.structure[i].type, + predicated); + } + break; + + case GLSL_TYPE_SAMPLER: + break; + + default: + assert(!"not reached"); + break; + } +} + void fs_visitor::visit(ir_assignment *ir) { struct fs_reg l, r; - int i; - int write_mask; fs_inst *inst; /* FINISHME: arrays on the lhs */ @@ -1152,18 +1193,6 @@ fs_visitor::visit(ir_assignment *ir) ir->rhs->accept(this); r = this->result; - /* FINISHME: This should really set to the correct maximal writemask for each - * FINISHME: component written (in the loops below). This case can only - * FINISHME: occur for matrices, arrays, and structures. - */ - if (ir->write_mask == 0) { - assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); - write_mask = WRITEMASK_XYZW; - } else { - assert(ir->lhs->type->is_vector() || ir->lhs->type->is_scalar()); - write_mask = ir->write_mask; - } - assert(l.file != BAD_FILE); assert(r.file != BAD_FILE); @@ -1174,14 +1203,19 @@ fs_visitor::visit(ir_assignment *ir) inst->conditional_mod = BRW_CONDITIONAL_NZ; } - for (i = 0; i < type_size(ir->lhs->type); i++) { - if (i >= 4 || (write_mask & (1 << i))) { - inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); - if (ir->condition) - inst->predicated = true; - r.reg_offset++; + if (ir->lhs->type->is_scalar() || + ir->lhs->type->is_vector()) { + for (int i = 0; i < ir->lhs->type->vector_elements; i++) { + if (ir->write_mask & (1 << i)) { + inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); + if (ir->condition) + inst->predicated = true; + r.reg_offset++; + } + l.reg_offset++; } - l.reg_offset++; + } else { + emit_assignment_writes(l, r, ir->lhs->type, ir->condition != NULL); } } -- cgit v1.2.3 From a7cddd7de3123eb13e68c35aa111ff4060669f59 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Sep 2010 13:40:22 -0700 Subject: mesa: Don't reference a W component in setting up a vec3 uniform component. The 965 driver would try to set up storage for the W component, and the offsets would get mixed up. --- src/mesa/main/uniforms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 29a9be8c996..87ce6e49388 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -122,7 +122,11 @@ static struct gl_builtin_uniform_element gl_LightSource_elements[] = { {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW}, {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW}, - {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW}, + {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, + MAKE_SWIZZLE4(SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_Z)}, {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW}, {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX}, {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW}, -- cgit v1.2.3 From c6960e4471abe287448b9d0e7e6519d588cdf43c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Sep 2010 13:26:38 -0700 Subject: i965: Fix new FS handling of builtin uniforms with packed scalars in structs. We were pointing each element at the .x channel of the ParameterValues. Fixes glsl1-linear fog. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index efa0f2136b2..0a77b5ab4ed 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -696,12 +696,12 @@ fs_visitor::setup_builtin_uniform_values(ir_variable *ir) */ int last_swiz = -1; for (unsigned int i = 0; i < 4; i++) { - int this_swiz = GET_SWZ(element->swizzle, i); - if (this_swiz == last_swiz) + int swiz = GET_SWZ(element->swizzle, i); + if (swiz == last_swiz) break; - last_swiz = this_swiz; + last_swiz = swiz; - c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[swiz]; } } } -- cgit v1.2.3 From 113f1cdfcedf858e4b426ce2dba9e99d2a1e0286 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 30 Sep 2010 17:06:29 -0400 Subject: evergreeng: avoid overlapping border color btw VS & PS Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 7ba778e9f42..7d6bd504a6f 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -467,7 +467,7 @@ static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 off {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, }; unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); - unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C; struct r600_range *range; struct r600_block *block; int r; @@ -665,7 +665,7 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) { - unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C; + unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C; struct r600_range *range; struct r600_block *block; -- cgit v1.2.3 From dde1391cc95478f4dedccdf920ba0a6607472937 Mon Sep 17 00:00:00 2001 From: John Doe Date: Thu, 30 Sep 2010 17:30:25 -0400 Subject: r600g: don't double count dirty block This avoid to overcount the number of dwords we need and thus avoid maximazation of cs buffer use. Signed-off-by: Jerome Glisse radeon, &block->reloc[1].bo, state->regs[2].bo); radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) @@ -658,9 +660,11 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) @@ -683,9 +687,11 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c block->reg[2] = state->regs[4].value; block->reg[3] = state->regs[5].value; block->reg[4] = state->regs[6].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) @@ -837,9 +843,11 @@ static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_ radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index f363b698bc0..6cb0b940dac 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -721,9 +721,11 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat id = block->pm4_bo_index[id]; radeon_ws_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } } @@ -760,9 +762,11 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) @@ -793,9 +797,11 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) @@ -816,9 +822,11 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex block->reg[1] = state->regs[4].value; block->reg[2] = state->regs[5].value; block->reg[3] = state->regs[6].value; - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; + ctx->pm4_dirty_cdwords += block->pm4_ndwords; + } } void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 7106bb6bcba..125fb4f76e9 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -118,9 +118,9 @@ static void inline r600_context_reg(struct r600_context *ctx, block->reg[id] |= value; if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { ctx->pm4_dirty_cdwords += block->pm4_ndwords; + block->status |= R600_BLOCK_STATUS_ENABLED; + block->status |= R600_BLOCK_STATUS_DIRTY; } - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; } static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block) -- cgit v1.2.3 From 40181aef6045af9df9d8baa8910210c0c8f84f46 Mon Sep 17 00:00:00 2001 From: John Doe Date: Thu, 30 Sep 2010 17:53:36 -0400 Subject: r600g: keep a mapping around for each bo Save a lot of call into the kernel and thus improve performances. Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600_priv.h | 14 +++-- src/gallium/winsys/r600/drm/radeon_bo.c | 91 ++++++++++++++++----------------- 2 files changed, 54 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 125fb4f76e9..f39778da624 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -33,7 +33,6 @@ #include #include "r600.h" - struct radeon { int fd; int refcount; @@ -83,8 +82,6 @@ struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, unsigned size, unsigned alignment, void *ptr); -int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo); -void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo); void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, struct radeon_bo *src); int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); @@ -145,4 +142,15 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc block->status ^= R600_BLOCK_STATUS_DIRTY; } +static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo) +{ + bo->map_count++; +} + +static inline void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo) +{ + bo->map_count--; + assert(bo->map_count >= 0); +} + #endif diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index d16e38d4e04..bb93ce6c9e3 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -33,6 +33,43 @@ #include "xf86drm.h" #include "radeon_drm.h" +static int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo) +{ + struct drm_radeon_gem_mmap args; + void *ptr; + int r; + + /* Zero out args to make valgrind happy */ + memset(&args, 0, sizeof(args)); + args.handle = bo->handle; + args.offset = 0; + args.size = (uint64_t)bo->size; + r = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_MMAP, + &args, sizeof(args)); + if (r) { + fprintf(stderr, "error mapping %p 0x%08X (error = %d)\n", + bo, bo->handle, r); + return r; + } + ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, radeon->fd, args.addr_ptr); + if (ptr == MAP_FAILED) { + fprintf(stderr, "%s failed to map bo\n", __func__); + return -errno; + } + bo->data = ptr; + +success: + bo->map_count++; + + return 0; +} + +static void radeon_bo_fixed_unmap(struct radeon *radeon, struct radeon_bo *bo) +{ + munmap(bo->data, bo->size); + bo->data = NULL; +} + struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, unsigned size, unsigned alignment, void *ptr) { @@ -79,65 +116,23 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, return NULL; } } + if (radeon_bo_fixed_map(radeon, bo)) { + R600_ERR("failed to map bo\n"); + radeon_bo_reference(radeon, &bo, NULL); + return bo; + } if (ptr) { - if (radeon_bo_map(radeon, bo)) { - fprintf(stderr, "%s failed to copy data into bo\n", __func__); - radeon_bo_reference(radeon, &bo, NULL); - return bo; - } memcpy(bo->data, ptr, size); - radeon_bo_unmap(radeon, bo); } return bo; } -int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo) -{ - struct drm_radeon_gem_mmap args; - void *ptr; - int r; - - if (bo->map_count != 0) { - goto success; - } - /* Zero out args to make valgrind happy */ - memset(&args, 0, sizeof(args)); - args.handle = bo->handle; - args.offset = 0; - args.size = (uint64_t)bo->size; - r = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_MMAP, - &args, sizeof(args)); - if (r) { - fprintf(stderr, "error mapping %p 0x%08X (error = %d)\n", - bo, bo->handle, r); - return r; - } - ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, radeon->fd, args.addr_ptr); - if (ptr == MAP_FAILED) { - fprintf(stderr, "%s failed to map bo\n", __func__); - return -errno; - } - bo->data = ptr; - -success: - bo->map_count++; - - return 0; -} - -void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo) -{ - if (--bo->map_count > 0) { - return; - } - munmap(bo->data, bo->size); - bo->data = NULL; -} static void radeon_bo_destroy(struct radeon *radeon, struct radeon_bo *bo) { struct drm_gem_close args; + radeon_bo_fixed_unmap(radeon, bo); memset(&args, 0, sizeof(args)); args.handle = bo->handle; drmIoctl(radeon->fd, DRM_IOCTL_GEM_CLOSE, &args); -- cgit v1.2.3 From 542d6cb1b8a87615b4c4498ce1fcbf39d743f963 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Sep 2010 11:01:09 -0600 Subject: gallivm: added some comments --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 5 +++++ src/gallium/auxiliary/gallivm/lp_bld_sample.h | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 6e53bca269a..aee94c1b866 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -331,6 +331,11 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, } +/** + * Return pointer to a single mipmap level. + * \param data_array array of pointers to mipmap levels + * \param level integer mipmap level + */ LLVMValueRef lp_build_get_mipmap_level(struct lp_build_sample_context *bld, LLVMValueRef data_array, LLVMValueRef level) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 9fc9a38a49e..4d2eeaa5eb4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -99,61 +99,64 @@ struct lp_sampler_static_state struct lp_sampler_dynamic_state { - /** Obtain the base texture width. */ + /** Obtain the base texture width (returns int32) */ LLVMValueRef (*width)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain the base texture height. */ + /** Obtain the base texture height (returns int32) */ LLVMValueRef (*height)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain the base texture depth. */ + /** Obtain the base texture depth (returns int32) */ LLVMValueRef (*depth)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain the number of mipmap levels (minus one). */ + /** Obtain the number of mipmap levels minus one (returns int32) */ LLVMValueRef (*last_level)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); + /** Obtain stride in bytes between image rows/blocks (returns int32) */ LLVMValueRef (*row_stride)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); + /** Obtain stride in bytes between image slices (returns int32) */ LLVMValueRef (*img_stride)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); + /** Obtain pointer to array of pointers to mimpap levels */ LLVMValueRef (*data_ptr)( const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain texture min lod */ + /** Obtain texture min lod (returns float) */ LLVMValueRef (*min_lod)(const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain texture max lod */ + /** Obtain texture max lod (returns float) */ LLVMValueRef (*max_lod)(const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain texture lod bias */ + /** Obtain texture lod bias (returns float) */ LLVMValueRef (*lod_bias)(const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); - /** Obtain texture border color */ + /** Obtain texture border color (returns ptr to float[4]) */ LLVMValueRef (*border_color)(const struct lp_sampler_dynamic_state *state, LLVMBuilderRef builder, unsigned unit); -- cgit v1.2.3 From 66992463ac294b1a106090250ad2af305f9d8a10 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Sep 2010 16:41:31 -0600 Subject: draw: check for null sampler pointers http://bugs.freedesktop.org/show_bug.cgi?id=30516 --- src/gallium/auxiliary/draw/draw_llvm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 4749bb57a53..7fb86d7cb27 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1099,10 +1099,12 @@ draw_llvm_set_sampler_state(struct draw_context *draw) for (i = 0; i < draw->num_samplers; i++) { struct draw_jit_texture *jit_tex = &draw->llvm->jit_context.textures[i]; - jit_tex->min_lod = draw->samplers[i]->min_lod; - jit_tex->max_lod = draw->samplers[i]->max_lod; - jit_tex->lod_bias = draw->samplers[i]->lod_bias; - COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color); + if (draw->samplers[i]) { + jit_tex->min_lod = draw->samplers[i]->min_lod; + jit_tex->max_lod = draw->samplers[i]->max_lod; + jit_tex->lod_bias = draw->samplers[i]->lod_bias; + COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color); + } } } -- cgit v1.2.3 From 7ae4da8056c5aa6b65dc06fb8a0d0785123938db Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 09:39:35 +1000 Subject: r600g: use Elements macro instead of manual sizeofs --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 11 ++++++----- src/gallium/winsys/r600/drm/r600_hw_context.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index e3390fd461b..a92c32e7df9 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -35,6 +35,7 @@ #include "bof.h" #include "pipe/p_compiler.h" #include "util/u_inlines.h" +#include "util/u_memory.h" #include #include "r600_priv.h" @@ -432,7 +433,7 @@ static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0}, {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0}, }; - unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); + unsigned nreg = Elements(r600_shader_resource); for (int i = 0; i < nreg; i++) { r600_shader_resource[i].offset += offset; @@ -448,7 +449,7 @@ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, }; - unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); + unsigned nreg = Elements(r600_shader_sampler); for (int i = 0; i < nreg; i++) { r600_shader_sampler[i].offset += offset; @@ -466,7 +467,7 @@ static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 off {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, }; - unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); + unsigned nreg = Elements(r600_shader_sampler_border); unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C; struct r600_range *range; struct r600_block *block; @@ -510,11 +511,11 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) /* add blocks */ r = r600_context_add_block(ctx, evergreen_config_reg_list, - sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg)); + Elements(evergreen_config_reg_list)); if (r) goto out_err; r = r600_context_add_block(ctx, evergreen_context_reg_list, - sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg)); + Elements(evergreen_context_reg_list)); if (r) goto out_err; diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 6cb0b940dac..53783e8f507 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -35,6 +35,7 @@ #include "bof.h" #include "pipe/p_compiler.h" #include "util/u_inlines.h" +#include "util/u_memory.h" #include #include "r600_priv.h" @@ -495,7 +496,7 @@ static int r600_state_resource_init(struct r600_context *ctx, u32 offset) {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0}, {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0}, }; - unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg); + unsigned nreg = Elements(r600_shader_resource); for (int i = 0; i < nreg; i++) { r600_shader_resource[i].offset += offset; @@ -511,7 +512,7 @@ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, }; - unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg); + unsigned nreg = Elements(r600_shader_sampler); for (int i = 0; i < nreg; i++) { r600_shader_sampler[i].offset += offset; @@ -528,7 +529,7 @@ static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, }; - unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg); + unsigned nreg = Elements(r600_shader_sampler_border); for (int i = 0; i < nreg; i++) { r600_shader_sampler_border[i].offset += offset; @@ -583,11 +584,11 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) /* add blocks */ r = r600_context_add_block(ctx, r600_config_reg_list, - sizeof(r600_config_reg_list)/sizeof(struct r600_reg)); + Elements(r600_config_reg_list)); if (r) goto out_err; r = r600_context_add_block(ctx, r600_context_reg_list, - sizeof(r600_context_reg_list)/sizeof(struct r600_reg)); + Elements(r600_context_reg_list)); if (r) goto out_err; -- cgit v1.2.3 From 084c29baedf2702200b310d6e63a5d0f95aaac37 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 10:13:04 +1000 Subject: r600g: fix evergreen depth flushing. although evergreen can apparantly sample direct from 24-bit, just make it work with the current method for now. --- src/gallium/drivers/r600/evergreen_state.c | 52 +++++++++++++++++++++++++----- src/gallium/drivers/r600/evergreend.h | 8 +++++ src/gallium/drivers/r600/r600_pipe.c | 45 ++++---------------------- src/gallium/drivers/r600/r600_pipe.h | 3 +- src/gallium/drivers/r600/r600_state.c | 38 ++++++++++++++++++++++ 5 files changed, 98 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 64fadb16e0b..5775b04cc7a 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -440,14 +440,11 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte bo[1] = rbuffer->bo; /* FIXME depth texture decompression */ if (tmp->depth) { -#if 0 - r = evergreen_texture_from_depth(ctx, tmp, view->first_level); - if (r) { - return; - } - bo[0] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); - bo[1] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed); -#endif + r600_texture_depth_flush(ctx, texture); + tmp = (struct r600_resource_texture*)texture; + rbuffer = &tmp->flushed_depth_texture->resource; + bo[0] = rbuffer->bo; + bo[1] = rbuffer->bo; } pitch = align(tmp->pitch[0] / tmp->bpt, 8); @@ -852,6 +849,7 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, } pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf); rctx->framebuffer = *state; + rctx->pframebuffer = &rctx->framebuffer; /* build states */ for (int i = 0; i < state->nr_cbufs; i++) { @@ -1645,3 +1643,41 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader R_0288A4_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); } + +void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx) +{ + struct pipe_depth_stencil_alpha_state dsa; + struct r600_pipe_state *rstate; + boolean quirk = false; + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + quirk = true; + + memset(&dsa, 0, sizeof(dsa)); + + if (quirk) { + dsa.depth.enabled = 1; + dsa.depth.func = PIPE_FUNC_LEQUAL; + dsa.stencil[0].enabled = 1; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; + dsa.stencil[0].writemask = 0xff; + } + + rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + 0x0, + S_02880C_DUAL_EXPORT_ENABLE(1), NULL); + r600_pipe_state_add_reg(rstate, + R_028000_DB_RENDER_CONTROL, + S_028000_DEPTH_COPY_ENABLE(1) | + S_028000_STENCIL_COPY_ENABLE(1) | + S_028000_COPY_CENTROID(1), + S_028000_DEPTH_COPY_ENABLE(1) | + S_028000_STENCIL_COPY_ENABLE(1) | + S_028000_COPY_CENTROID(1), NULL); + return rstate; +} diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 486cb29005d..54b26f6fb69 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1424,8 +1424,16 @@ #define R_008C0C_SQ_THREAD_RESOURCE_MGMT 0x00008C0C #define R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x00008D8C #define R_028000_DB_RENDER_CONTROL 0x00028000 +#define S_028000_DEPTH_CLEAR_ENABLE(x) (((x) & 0x1) << 0) +#define S_028000_STENCIL_CLEAR_ENABLE(x) (((x) & 0x1) << 1) +#define S_028000_DEPTH_COPY_ENABLE(x) (((x) & 0x1) << 2) +#define S_028000_STENCIL_COPY_ENABLE(x) (((x) & 0x1) << 3) +#define S_028000_RESUMMARIZE_ENABLE(x) (((x) & 0x1) << 4) #define S_028000_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5) #define S_028000_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6) +#define S_028000_COPY_CENTROID(x) (((x) & 0x1) << 7) +#define S_028000_COPY_SAMPLE(x) (((x) & 0x7) << 8) +#define S_028000_COLOR_DISABLE(x) (((x) & 0x1) << 12) #define R_028004_DB_COUNT_CONTROL 0x00028004 #define S_028004_ZPASS_INCREMENT_DISABLE (((x) & 0x1) << 0) #define S_028004_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 1) diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index a25674b183c..1c23995123f 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -49,44 +49,6 @@ /* * pipe_context */ -static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) -{ - struct pipe_depth_stencil_alpha_state dsa; - struct r600_pipe_state *rstate; - boolean quirk = false; - - if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || - rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) - quirk = true; - - memset(&dsa, 0, sizeof(dsa)); - - if (quirk) { - dsa.depth.enabled = 1; - dsa.depth.func = PIPE_FUNC_LEQUAL; - dsa.stencil[0].enabled = 1; - dsa.stencil[0].func = PIPE_FUNC_ALWAYS; - dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; - dsa.stencil[0].writemask = 0xff; - } - - rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); - r600_pipe_state_add_reg(rstate, - R_02880C_DB_SHADER_CONTROL, - 0x0, - S_02880C_DUAL_EXPORT_ENABLE(1), NULL); - r600_pipe_state_add_reg(rstate, - R_028D0C_DB_RENDER_CONTROL, - S_028D0C_DEPTH_COPY_ENABLE(1) | - S_028D0C_STENCIL_COPY_ENABLE(1) | - S_028D0C_COPY_CENTROID(1), - S_028D0C_DEPTH_COPY_ENABLE(1) | - S_028D0C_STENCIL_COPY_ENABLE(1) | - S_028D0C_COPY_CENTROID(1), NULL); - return rstate; -} - static void r600_flush(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { @@ -132,6 +94,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void { struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); struct r600_screen* rscreen = (struct r600_screen *)screen; + enum chip_class class; if (rctx == NULL) return NULL; @@ -210,7 +173,11 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void return NULL; } - rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); + class = r600_get_family_class(rctx->radeon); + if (class == R600 || class == R700) + rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); + else + rctx->custom_dsa_flush = evergreen_create_db_flush_dsa(rctx); r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index a3b8f66c092..18ebb0eb226 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -151,6 +151,7 @@ void evergreen_init_config(struct r600_pipe_context *rctx); void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info); void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader); void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader); +void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx); /* r600_blit.c */ void r600_init_blit_functions(struct r600_pipe_context *rctx); @@ -190,7 +191,7 @@ void r600_translate_index_buffer(struct r600_pipe_context *r600, struct pipe_resource **index_buffer, unsigned *index_size, unsigned *start, unsigned count); - +void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx); /* r600_helper.h */ int r600_conv_pipe_prim(unsigned pprim, unsigned *prim); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 23c2e5964a4..83eedd2040f 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1524,3 +1524,41 @@ void r600_init_config(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(rstate, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL); r600_context_pipe_state_set(&rctx->ctx, rstate); } + +void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) +{ + struct pipe_depth_stencil_alpha_state dsa; + struct r600_pipe_state *rstate; + boolean quirk = false; + + if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || + rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) + quirk = true; + + memset(&dsa, 0, sizeof(dsa)); + + if (quirk) { + dsa.depth.enabled = 1; + dsa.depth.func = PIPE_FUNC_LEQUAL; + dsa.stencil[0].enabled = 1; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; + dsa.stencil[0].writemask = 0xff; + } + + rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + 0x0, + S_02880C_DUAL_EXPORT_ENABLE(1), NULL); + r600_pipe_state_add_reg(rstate, + R_028D0C_DB_RENDER_CONTROL, + S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1), + S_028D0C_DEPTH_COPY_ENABLE(1) | + S_028D0C_STENCIL_COPY_ENABLE(1) | + S_028D0C_COPY_CENTROID(1), NULL); + return rstate; +} -- cgit v1.2.3 From 05d1d86907b12011fdb80e147ae68b4cd207f789 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 09:43:14 +1000 Subject: r600g: add winsys support for CTL constants. These need to be emitted, we also need them to do proper vtx start, instead of abusing index offset. --- src/gallium/drivers/r600/evergreen_state.c | 2 ++ src/gallium/drivers/r600/evergreend.h | 6 ++++++ src/gallium/drivers/r600/r600_state.c | 2 ++ src/gallium/drivers/r600/r600d.h | 3 +++ src/gallium/winsys/r600/drm/evergreen_hw_context.c | 10 ++++++++++ src/gallium/winsys/r600/drm/r600_hw_context.c | 9 +++++++++ src/gallium/winsys/r600/drm/r600d.h | 3 +++ 7 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 5775b04cc7a..21d3394ca60 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1450,6 +1450,8 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0xFFFFFFFF, NULL); if (rctx->rasterizer && rctx->framebuffer.zsbuf) { float offset_units = rctx->rasterizer->offset_units; diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 54b26f6fb69..ce2b667868b 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -40,6 +40,9 @@ #define EVERGREEN_SAMPLER_OFFSET 0X0003C000 #define EVERGREEN_SAMPLER_END 0X0003CFF0 +#define EVERGREEN_CTL_CONST_OFFSET 0x0003CFF0 +#define EVERGREEN_CTL_CONST_END 0x0003E200 + #define EVENT_TYPE_ZPASS_DONE 0x15 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16 @@ -1890,4 +1893,7 @@ #define R_008970_VGT_NUM_INDICES 0x008970 #define R_0287F0_VGT_DRAW_INITIATOR 0x0287F0 +#define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0 +#define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4 + #endif diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 83eedd2040f..c86bad7ff55 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -126,6 +126,8 @@ static void r600_draw_common(struct r600_drawl *draw) r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(&vgt, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0xFFFFFFFF, NULL); /* build late state */ if (rctx->rasterizer && rctx->framebuffer.zsbuf) { float offset_units = rctx->rasterizer->offset_units; diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 169cda5295b..02e3734fcc8 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -3489,6 +3489,9 @@ #define R_028940_ALU_CONST_CACHE_PS_0 0x00028940 #define R_028980_ALU_CONST_CACHE_VS_0 0x00028980 +#define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0 +#define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4 + #define SQ_TEX_INST_LD 0x03 #define SQ_TEX_INST_GET_GRADIENTS_H 0x7 #define SQ_TEX_INST_GET_GRADIENTS_V 0x8 diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index a92c32e7df9..225027b8a3e 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -61,6 +61,11 @@ static const struct r600_reg evergreen_config_reg_list[] = { {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0}, }; +static const struct r600_reg evergreen_ctl_const_list[] = { + {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0}, + {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0}, +}; + static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0}, @@ -518,6 +523,11 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) Elements(evergreen_context_reg_list)); if (r) goto out_err; + r = r600_context_add_block(ctx, evergreen_ctl_const_list, + Elements(evergreen_ctl_const_list)); + if (r) + goto out_err; + /* PS SAMPLER */ for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) { diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 53783e8f507..88a86d2cf28 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -134,6 +134,11 @@ static const struct r600_reg r600_config_reg_list[] = { {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0}, }; +static const struct r600_reg r600_ctl_const_list[] = { + {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0}, + {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0}, +}; + static const struct r600_reg r600_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, @@ -591,6 +596,10 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) Elements(r600_context_reg_list)); if (r) goto out_err; + r = r600_context_add_block(ctx, r600_ctl_const_list, + Elements(r600_ctl_const_list)); + if (r) + goto out_err; /* PS SAMPLER BORDER */ for (int j = 0, offset = 0; j < 18; j++, offset += 0x10) { diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index 5c08c5a04d1..ccc9ffaf8e3 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -2205,4 +2205,7 @@ #define R_028940_ALU_CONST_CACHE_PS_0 0x00028940 #define R_028980_ALU_CONST_CACHE_VS_0 0x00028980 +#define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0 +#define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4 + #endif -- cgit v1.2.3 From 40ccb235d693ea6184ab61529f2910086e68edda Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 10:19:39 +1000 Subject: r600g: drop depth quirk on evergreen none of the EG cards need the quirk. --- src/gallium/drivers/r600/evergreen_state.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 21d3394ca60..7337839a32e 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1650,24 +1650,9 @@ void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx) { struct pipe_depth_stencil_alpha_state dsa; struct r600_pipe_state *rstate; - boolean quirk = false; - - if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 || - rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) - quirk = true; memset(&dsa, 0, sizeof(dsa)); - if (quirk) { - dsa.depth.enabled = 1; - dsa.depth.func = PIPE_FUNC_LEQUAL; - dsa.stencil[0].enabled = 1; - dsa.stencil[0].func = PIPE_FUNC_ALWAYS; - dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR; - dsa.stencil[0].writemask = 0xff; - } - rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa); r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, -- cgit v1.2.3 From 5eccdc62b998a6b3a82d9fd204db733d4852fc73 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 10:52:09 +1000 Subject: r600g: add reloc for evergreen color attrib we'll need this for color tiling on evergreen. --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 24 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7337839a32e..55eede98d53 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -786,7 +786,7 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state r600_pipe_state_add_reg(rstate, R_028C74_CB_COLOR0_ATTRIB + cb * 0x3C, S_028C74_NON_DISP_TILING_ORDER(1), - 0xFFFFFFFF, NULL); + 0xFFFFFFFF, bo[0]); } static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 225027b8a3e..3af299c1803 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -333,7 +333,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0}, @@ -341,7 +341,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB8_CB_COLOR1_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0}, @@ -349,7 +349,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0}, @@ -357,7 +357,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0}, @@ -365,7 +365,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0}, @@ -373,7 +373,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0}, @@ -381,7 +381,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0}, @@ -389,7 +389,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0}, @@ -397,7 +397,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0}, @@ -405,7 +405,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0}, @@ -413,7 +413,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0}, @@ -421,7 +421,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0}, }; -- cgit v1.2.3 From a3e9998614da6bd10d9015134bc19f5b8cf6e518 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 30 Sep 2010 20:54:26 -0400 Subject: r600c: add reloc for CB_COLOR0_ATTRIB We'll need a reloc for tiling eventually, so add it now. --- src/mesa/drivers/dri/r600/evergreen_chip.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index 1050c776bf7..5287a98c053 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -1415,9 +1415,17 @@ static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_VIEW.u32All); END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 2); + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 1); R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All); + R600_OUT_BATCH_RELOC(0, + rrb->bo, + 0, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_DIM, 1); R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_DIM.u32All); /* R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All); @@ -1523,7 +1531,7 @@ void evergreenInitAtoms(context_t *context) EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX); EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */ EVERGREEN_ALLOC_STATE(db, always, 65, evergreenSendDB); - EVERGREEN_ALLOC_STATE(cb, always, 33, evergreenSendCB); + EVERGREEN_ALLOC_STATE(cb, always, 37, evergreenSendCB); EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT); evergreen_init_query_stateobj(&context->radeon, 6 * 2); -- cgit v1.2.3 From 35cfe286d69206d3108c7a8702bd4be6521b5706 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 11:13:02 +1000 Subject: r600g: realign evergreen code with r600 code. fixes segfault in depth-tex-modes-glsl and OA startup. --- src/gallium/drivers/r600/evergreen_state.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 55eede98d53..06dc8407a18 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1341,14 +1341,13 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) struct r600_pipe_state vgt; struct r600_drawl draw; - assert(info->index_bias == 0); - if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); rctx->any_user_vbs = FALSE; } memset(&draw, 0, sizeof(struct r600_drawl)); + draw.ctx = ctx; draw.mode = info->mode; draw.start = info->start; draw.count = info->count; @@ -1364,7 +1363,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) info->count); draw.index_size = rctx->index_buffer.index_size; - draw.index_buffer = rctx->index_buffer.buffer; + pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer); draw.index_buffer_offset = draw.start * draw.index_size; draw.start = 0; r600_upload_index_buffer(rctx, &draw); @@ -1505,6 +1504,8 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) rdraw.indices_bo_offset = draw.index_buffer_offset; } evergreen_context_draw(&rctx->ctx, &rdraw); + + pipe_resource_reference(&draw.index_buffer, NULL); } void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) -- cgit v1.2.3 From aae338104fa6022b8b1d6b22c7ad1115b252b9b6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Sep 2010 20:07:27 -0700 Subject: glsl: Add a lowering pass for texture projection. --- src/glsl/Makefile | 1 + src/glsl/ir_optimization.h | 1 + src/glsl/lower_texture_projection.cpp | 100 ++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 src/glsl/lower_texture_projection.cpp (limited to 'src') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 47ac42667c7..83869b1d846 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -76,6 +76,7 @@ CXX_SOURCES = \ loop_controls.cpp \ loop_unroll.cpp \ lower_noise.cpp \ + lower_texture_projection.cpp \ lower_variable_index_to_cond_assign.cpp \ opt_redundant_jumps.cpp \ s_expression.cpp diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 6a37e167fe5..ffdc66b9f75 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -44,6 +44,7 @@ bool do_div_to_mul_rcp(exec_list *instructions); bool do_explog_to_explog2(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false, bool lower_break = false); +bool do_lower_texture_projection(exec_list *instructions); bool do_if_simplification(exec_list *instructions); bool do_if_to_cond_assign(exec_list *instructions); bool do_mat_op_to_vec(exec_list *instructions); diff --git a/src/glsl/lower_texture_projection.cpp b/src/glsl/lower_texture_projection.cpp new file mode 100644 index 00000000000..f82ca0a9fd9 --- /dev/null +++ b/src/glsl/lower_texture_projection.cpp @@ -0,0 +1,100 @@ +/* + * Copyright © 2010 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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 lower_texture_projection.cpp + * + * IR lower pass to perform the division of texture coordinates by the texture + * projector if present. + * + * Many GPUs have a texture sampling opcode that takes the projector + * and does the divide internally, thus the presence of the projector + * in the IR. For GPUs that don't, this saves the driver needing the + * logic for handling the divide. + * + * \author Eric Anholt + */ + +#include "ir.h" +#include "ir_rvalue_visitor.h" + +class lower_texture_projection_visitor : public ir_hierarchical_visitor { +public: + lower_texture_projection_visitor() + { + progress = false; + } + + ir_visitor_status visit_leave(ir_texture *ir); + + bool progress; +}; + +ir_visitor_status +lower_texture_projection_visitor::visit_leave(ir_texture *ir) +{ + if (!ir->projector) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + ir_variable *var = new(mem_ctx) ir_variable(ir->projector->type, + "projector", ir_var_auto); + base_ir->insert_before(var); + ir_dereference *deref = new(mem_ctx) ir_dereference_variable(var); + ir_expression *expr = new(mem_ctx) ir_expression(ir_unop_rcp, + ir->projector->type, + ir->projector, + NULL); + ir_assignment *assign = new(mem_ctx) ir_assignment(deref, expr, NULL); + base_ir->insert_before(assign); + + deref = new(mem_ctx) ir_dereference_variable(var); + ir->coordinate = new(mem_ctx) ir_expression(ir_binop_mul, + ir->coordinate->type, + ir->coordinate, + deref); + + if (ir->shadow_comparitor) { + deref = new(mem_ctx) ir_dereference_variable(var); + ir->shadow_comparitor = new(mem_ctx) ir_expression(ir_binop_mul, + ir->shadow_comparitor->type, + ir->shadow_comparitor, + deref); + } + + ir->projector = NULL; + + progress = true; + return visit_continue; +} + +bool +do_lower_texture_projection(exec_list *instructions) +{ + lower_texture_projection_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} -- cgit v1.2.3 From 5f237a1ccb28399fbbceecea694f5d18ebba9938 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Sep 2010 20:09:53 -0700 Subject: i965: Use the lowering pass for texture projection. We should end up with the same code, but anyone else with this issue could share the handling (which I got wrong for shadow comparisons in the driver before). --- src/mesa/drivers/dri/i965/brw_fs.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 0a77b5ab4ed..c49b27b0b5c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -138,6 +138,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) do_div_to_mul_rcp(shader->ir); do_sub_to_add_neg(shader->ir); do_explog_to_explog2(shader->ir); + do_lower_texture_projection(shader->ir); do { progress = false; @@ -1229,22 +1230,8 @@ fs_visitor::visit(ir_texture *ir) ir->coordinate->accept(this); fs_reg coordinate = this->result; - if (ir->projector) { - fs_reg inv_proj = fs_reg(this, glsl_type::float_type); - - ir->projector->accept(this); - emit(fs_inst(FS_OPCODE_RCP, inv_proj, this->result)); - - fs_reg proj_coordinate = fs_reg(this, ir->coordinate->type); - for (unsigned int i = 0; i < ir->coordinate->type->vector_elements; i++) { - emit(fs_inst(BRW_OPCODE_MUL, proj_coordinate, coordinate, inv_proj)); - coordinate.reg_offset++; - proj_coordinate.reg_offset++; - } - proj_coordinate.reg_offset = 0; - - coordinate = proj_coordinate; - } + /* Should be lowered by do_lower_texture_projection */ + assert(!ir->projector); for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); -- cgit v1.2.3 From 1d073cb2d920d1c0b8c6d598055b14048fedc96e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Sep 2010 19:18:25 -0700 Subject: i965: Split the gen4 and gen5 sampler handling apart. Trying to track the insanity of the different argument layouts for normal/shadow crossed with normal/lod/bias one generation at a time is enough. Fixes: glsl1-texture2D() with bias. (first test passing in this code that doesn't pass without it!) --- src/mesa/drivers/dri/i965/brw_fs.cpp | 126 ++++++++++++++++++++++++++++------- 1 file changed, 103 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c49b27b0b5c..78cdfed3fbb 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -469,6 +469,8 @@ public: void emit_fragcoord_interpolation(ir_variable *ir); void emit_general_interpolation(ir_variable *ir); void emit_interpolation_setup(); + fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf); + fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf); void emit_fb_writes(); void emit_assignment_writes(fs_reg &l, fs_reg &r, const glsl_type *type, bool predicated); @@ -1220,48 +1222,93 @@ fs_visitor::visit(ir_assignment *ir) } } -void -fs_visitor::visit(ir_texture *ir) +fs_inst * +fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf) { - int base_mrf = 2; - fs_inst *inst = NULL; - unsigned int mlen = 0; + /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ + int mlen = 3; - ir->coordinate->accept(this); - fs_reg coordinate = this->result; + if (ir->shadow_comparitor) { + if (ir->op == ir_tex) { + /* There's no plain shadow compare message, so we use shadow + * compare with a bias of 0.0. + */ + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + fs_reg(0.0f))); + mlen++; + } else if (ir->op == ir_txb) { + ir->lod_info.bias->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } else { + assert(ir->op == ir_txl); + ir->lod_info.lod->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } - /* Should be lowered by do_lower_texture_projection */ - assert(!ir->projector); + ir->shadow_comparitor->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); + mlen++; + } else { + /* Oh joy. gen4 doesn't have SIMD8 non-shadow-compare sampler + * instructions. We'll need to do SIMD16 here. + */ + abort(); + } - for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { - emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); - coordinate.reg_offset++; + fs_inst *inst = NULL; + switch (ir->op) { + case ir_tex: + inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf))); + break; + case ir_txb: + inst = emit(fs_inst(FS_OPCODE_TXB, dst, fs_reg(MRF, base_mrf))); + break; + case ir_txl: + inst = emit(fs_inst(FS_OPCODE_TXL, dst, fs_reg(MRF, base_mrf))); + break; + case ir_txd: + case ir_txf: + assert(!"GLSL 1.30 features unsupported"); + break; } + inst->mlen = mlen; - /* Pre-Ironlake, the 8-wide sampler always took u,v,r. */ - if (intel->gen < 5) - mlen = 3; + return inst; +} + +fs_inst * +fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf) +{ + /* gen5's SIMD8 sampler has slots for u, v, r, array index, then + * optional parameters like shadow comparitor or LOD bias. If + * optional parameters aren't present, those base slots are + * optional and don't need to be included in the message. + * + * We don't fill in the unnecessary slots regardless, which may + * look surprising in the disassembly. + */ + int mlen = ir->coordinate->type->vector_elements; if (ir->shadow_comparitor) { - /* For shadow comparisons, we have to supply u,v,r. */ - mlen = 3; + mlen = MAX2(mlen, 4); ir->shadow_comparitor->accept(this); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; } - /* Do we ever want to handle writemasking on texture samples? Is it - * performance relevant? - */ - fs_reg dst = fs_reg(this, glsl_type::vec4_type); - + fs_inst *inst = NULL; switch (ir->op) { case ir_tex: inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf))); break; case ir_txb: ir->lod_info.bias->accept(this); + mlen = MAX2(mlen, 4); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; @@ -1269,6 +1316,7 @@ fs_visitor::visit(ir_texture *ir) break; case ir_txl: ir->lod_info.lod->accept(this); + mlen = MAX2(mlen, 4); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; @@ -1279,6 +1327,39 @@ fs_visitor::visit(ir_texture *ir) assert(!"GLSL 1.30 features unsupported"); break; } + inst->mlen = mlen; + + return inst; +} + +void +fs_visitor::visit(ir_texture *ir) +{ + int base_mrf = 2; + fs_inst *inst = NULL; + unsigned int mlen = 0; + + ir->coordinate->accept(this); + fs_reg coordinate = this->result; + + /* Should be lowered by do_lower_texture_projection */ + assert(!ir->projector); + + for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); + coordinate.reg_offset++; + } + + /* Writemasking doesn't eliminate channels on SIMD8 texture + * samples, so don't worry about them. + */ + fs_reg dst = fs_reg(this, glsl_type::vec4_type); + + if (intel->gen < 5) { + inst = emit_texture_gen4(ir, dst, base_mrf); + } else { + inst = emit_texture_gen5(ir, dst, base_mrf); + } inst->sampler = _mesa_get_sampler_uniform_value(ir->sampler, @@ -1290,7 +1371,6 @@ fs_visitor::visit(ir_texture *ir) if (ir->shadow_comparitor) inst->shadow_compare = true; - inst->mlen = mlen; } void -- cgit v1.2.3 From e973221538d5edfad62abedf5b37a4fb774d71fc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 11:38:40 +1000 Subject: r600g: add assembler support for other vtx fetch fields. this shouldn't change behaviour, just push the choice of what to do out to the shader. --- src/gallium/drivers/r600/r600_asm.c | 6 +++++- src/gallium/drivers/r600/r600_asm.h | 5 +++++ src/gallium/drivers/r600/r600_shader.c | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index dc8dc9fe436..f07af8126ce 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -601,7 +601,11 @@ static int r600_bc_vtx_build(struct r600_bc *bc, struct r600_bc_vtx *vtx, unsign S_SQ_VTX_WORD1_DST_SEL_Y(vtx->dst_sel_y) | S_SQ_VTX_WORD1_DST_SEL_Z(vtx->dst_sel_z) | S_SQ_VTX_WORD1_DST_SEL_W(vtx->dst_sel_w) | - S_SQ_VTX_WORD1_USE_CONST_FIELDS(1) | + S_SQ_VTX_WORD1_USE_CONST_FIELDS(vtx->use_const_fields) | + S_SQ_VTX_WORD1_DATA_FORMAT(vtx->data_format) | + S_SQ_VTX_WORD1_NUM_FORMAT_ALL(vtx->num_format_all) | + S_SQ_VTX_WORD1_FORMAT_COMP_ALL(vtx->format_comp_all) | + S_SQ_VTX_WORD1_SRF_MODE_ALL(vtx->srf_mode_all) | S_SQ_VTX_WORD1_GPR_DST_GPR(vtx->dst_gpr); bc->bytecode[id++] = S_SQ_VTX_WORD2_MEGA_FETCH(1); bc->bytecode[id++] = 0; diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index cf67ca2d68e..cbf46a8b64b 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -101,6 +101,11 @@ struct r600_bc_vtx { unsigned dst_sel_y; unsigned dst_sel_z; unsigned dst_sel_w; + unsigned use_const_fields; + unsigned data_format; + unsigned num_format_all; + unsigned format_comp_all; + unsigned srf_mode_all; }; struct r600_bc_output { diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index a2091db460b..d35a99085dc 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -439,6 +439,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) vtx.dst_sel_y = 1; vtx.dst_sel_z = 2; vtx.dst_sel_w = 3; + vtx.use_const_fields = 1; r = r600_bc_add_vtx(ctx->bc, &vtx); if (r) return r; -- cgit v1.2.3 From d662195f00fe60349cdda368eeb065910764842f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 13:09:09 +1000 Subject: r600g: fixup vertex format picking. there are some vertex formats defined in r600c not in the docs. --- src/gallium/drivers/r600/eg_state_inlines.h | 188 +++++++++++++++++++++++--- src/gallium/drivers/r600/evergreen_state.c | 36 ++--- src/gallium/drivers/r600/evergreend.h | 73 +++++----- src/gallium/drivers/r600/r600_state.c | 23 ++-- src/gallium/drivers/r600/r600_state_inlines.h | 158 ++++++++++++++++++---- src/gallium/drivers/r600/r600d.h | 73 +++++----- 6 files changed, 407 insertions(+), 144 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 497865a66dd..c93b9d94c55 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -453,25 +453,6 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) } } -static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uint32_t *num_format_p, - uint32_t *format_comp_p) -{ - uint32_t num_format = 0, format_comp = 0; - switch (format) { - case PIPE_FORMAT_R16G16B16A16_SSCALED: - case PIPE_FORMAT_R16G16B16_SSCALED: - case PIPE_FORMAT_R16G16_SSCALED: - case PIPE_FORMAT_R32G32_SSCALED: - num_format = V_030008_SQ_NUM_FORMAT_SCALED; - format_comp = 1; - break; - default: - break; - } - *num_format_p = num_format; - *format_comp_p = format_comp; -} - static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format) { return r600_translate_texformat(format, NULL, NULL, NULL) != ~0; @@ -493,4 +474,173 @@ static INLINE boolean r600_is_vertex_format_supported(enum pipe_format format) return r600_translate_colorformat(format) != ~0; } +static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) +{ + uint32_t result = 0; + const struct util_format_description *desc; + unsigned i; + + desc = util_format_description(format); + if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { + goto out_unknown; + } + + /* Find the first non-VOID channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + switch (desc->channel[i].type) { + /* Half-floats, floats, doubles */ + case UTIL_FORMAT_TYPE_FLOAT: + switch (desc->channel[i].size) { + case 16: + switch (desc->nr_channels) { + case 1: + result = V_030008_FMT_16_FLOAT; + break; + case 2: + result = V_030008_FMT_16_16_FLOAT; + break; + case 3: + result = V_030008_FMT_16_16_16_FLOAT; + break; + case 4: + result = V_030008_FMT_16_16_16_16_FLOAT; + break; + } + break; + case 32: + switch (desc->nr_channels) { + case 1: + result = V_030008_FMT_32_FLOAT; + break; + case 2: + result = V_030008_FMT_32_32_FLOAT; + break; + case 3: + result = V_030008_FMT_32_32_32_FLOAT; + break; + case 4: + result = V_030008_FMT_32_32_32_32_FLOAT; + break; + } + break; + default: + goto out_unknown; + } + break; + /* Unsigned ints */ + case UTIL_FORMAT_TYPE_UNSIGNED: + /* Signed ints */ + case UTIL_FORMAT_TYPE_SIGNED: + switch (desc->channel[i].size) { + case 8: + switch (desc->nr_channels) { + case 1: + result = V_030008_FMT_8; + break; + case 2: + result = V_030008_FMT_8_8; + break; + case 3: + // result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */ + // break; + case 4: + result = V_030008_FMT_8_8_8_8; + break; + } + break; + case 16: + switch (desc->nr_channels) { + case 1: + result = V_030008_FMT_16; + break; + case 2: + result = V_030008_FMT_16_16; + break; + case 3: + // result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */ + // break; + case 4: + result = V_030008_FMT_16_16_16_16; + break; + } + break; + case 32: + switch (desc->nr_channels) { + case 1: + result = V_030008_FMT_32; + break; + case 2: + result = V_030008_FMT_32_32; + break; + case 3: + result = V_030008_FMT_32_32_32; + break; + case 4: + result = V_030008_FMT_32_32_32_32; + break; + } + break; + default: + goto out_unknown; + } + break; + default: + goto out_unknown; + } + + result = S_030008_DATA_FORMAT(result); + + if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) { + result |= S_030008_FORMAT_COMP_ALL(1); + } + if (desc->channel[i].normalized) { + result |= S_030008_NUM_FORMAT_ALL(0); + } else { + result |= S_030008_NUM_FORMAT_ALL(2); + } + return result; +out_unknown: + R600_ERR("unsupported vertex format %s\n", util_format_name(format)); + return ~0; +} + +static INLINE uint32_t r600_translate_vertex_data_swizzle(enum pipe_format format) +{ + const struct util_format_description *desc = util_format_description(format); + unsigned i; + uint32_t word3; + + assert(format); + + if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { + fprintf(stderr, "r600: Bad format %s in %s:%d\n", + util_format_short_name(format), __FUNCTION__, __LINE__); + return 0; + } + + word3 = 0; + for (i = 0; i < desc->nr_channels; i++) { + switch (i) { + case 0: + word3 |= S_03000C_DST_SEL_X(desc->swizzle[0]); + break; + case 1: + word3 |= S_03000C_DST_SEL_Y(desc->swizzle[1]); + break; + case 2: + word3 |= S_03000C_DST_SEL_Z(desc->swizzle[2]); + break; + case 3: + word3 |= S_03000C_DST_SEL_W(desc->swizzle[3]); + break; + } + } + return word3; +} + #endif diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 06dc8407a18..2f5f1bff28e 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1334,7 +1334,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_state *rstate; struct r600_resource *rbuffer; - unsigned i, j, offset, format, prim; + unsigned i, j, offset, prim; u32 vgt_dma_index_type, vgt_draw_initiator, mask; struct pipe_vertex_buffer *vertex_buffer; struct r600_draw rdraw; @@ -1402,34 +1402,28 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) return; for (i = 0 ; i < rctx->vertex_elements->count; i++) { - unsigned num_format = 0, format_comp = 0; - + uint32_t word3, word2; + uint32_t format; rstate = &rctx->vs_resource[i]; + + rstate->id = R600_PIPE_STATE_RESOURCE; + rstate->nregs = 0; + j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - rstate->id = R600_PIPE_STATE_RESOURCE; - rstate->nregs = 0; - r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); + format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format); + + word2 = format | S_030008_STRIDE(vertex_buffer->stride); + + word3 = r600_translate_vertex_data_swizzle(rctx->vertex_elements->elements[i].src_format); + r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_030008_RESOURCE0_WORD2, - S_030008_STRIDE(vertex_buffer->stride) | - S_030008_DATA_FORMAT(format) | - S_030008_NUM_FORMAT_ALL(num_format) | - S_030008_FORMAT_COMP_ALL(format_comp), - 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_03000C_RESOURCE0_WORD3, - S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) | - S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) | - S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) | - S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W), - 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, word3, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL); diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index ce2b667868b..f9328c61983 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1050,40 +1050,45 @@ #define S_030008_DATA_FORMAT(x) (((x) & 0x3F) << 20) #define G_030008_DATA_FORMAT(x) (((x) >> 20) & 0x3F) #define C_030008_DATA_FORMAT 0xFC0FFFFF -#define V_030008_COLOR_INVALID 0x00000000 -#define V_030008_COLOR_8 0x00000001 -#define V_030008_COLOR_4_4 0x00000002 -#define V_030008_COLOR_3_3_2 0x00000003 -#define V_030008_COLOR_16 0x00000005 -#define V_030008_COLOR_16_FLOAT 0x00000006 -#define V_030008_COLOR_8_8 0x00000007 -#define V_030008_COLOR_5_6_5 0x00000008 -#define V_030008_COLOR_6_5_5 0x00000009 -#define V_030008_COLOR_1_5_5_5 0x0000000A -#define V_030008_COLOR_4_4_4_4 0x0000000B -#define V_030008_COLOR_5_5_5_1 0x0000000C -#define V_030008_COLOR_32 0x0000000D -#define V_030008_COLOR_32_FLOAT 0x0000000E -#define V_030008_COLOR_16_16 0x0000000F -#define V_030008_COLOR_16_16_FLOAT 0x00000010 -#define V_030008_COLOR_8_24 0x00000011 -#define V_030008_COLOR_8_24_FLOAT 0x00000012 -#define V_030008_COLOR_24_8 0x00000013 -#define V_030008_COLOR_24_8_FLOAT 0x00000014 -#define V_030008_COLOR_10_11_11 0x00000015 -#define V_030008_COLOR_10_11_11_FLOAT 0x00000016 -#define V_030008_COLOR_11_11_10 0x00000017 -#define V_030008_COLOR_11_11_10_FLOAT 0x00000018 -#define V_030008_COLOR_2_10_10_10 0x00000019 -#define V_030008_COLOR_8_8_8_8 0x0000001A -#define V_030008_COLOR_10_10_10_2 0x0000001B -#define V_030008_COLOR_X24_8_32_FLOAT 0x0000001C -#define V_030008_COLOR_32_32 0x0000001D -#define V_030008_COLOR_32_32_FLOAT 0x0000001E -#define V_030008_COLOR_16_16_16_16 0x0000001F -#define V_030008_COLOR_16_16_16_16_FLOAT 0x00000020 -#define V_030008_COLOR_32_32_32_32 0x00000022 -#define V_030008_COLOR_32_32_32_32_FLOAT 0x00000023 +#define V_030008_FMT_INVALID 0x00000000 +#define V_030008_FMT_8 0x00000001 +#define V_030008_FMT_4_4 0x00000002 +#define V_030008_FMT_3_3_2 0x00000003 +#define V_030008_FMT_16 0x00000005 +#define V_030008_FMT_16_FLOAT 0x00000006 +#define V_030008_FMT_8_8 0x00000007 +#define V_030008_FMT_5_6_5 0x00000008 +#define V_030008_FMT_6_5_5 0x00000009 +#define V_030008_FMT_1_5_5_5 0x0000000A +#define V_030008_FMT_4_4_4_4 0x0000000B +#define V_030008_FMT_5_5_5_1 0x0000000C +#define V_030008_FMT_32 0x0000000D +#define V_030008_FMT_32_FLOAT 0x0000000E +#define V_030008_FMT_16_16 0x0000000F +#define V_030008_FMT_16_16_FLOAT 0x00000010 +#define V_030008_FMT_8_24 0x00000011 +#define V_030008_FMT_8_24_FLOAT 0x00000012 +#define V_030008_FMT_24_8 0x00000013 +#define V_030008_FMT_24_8_FLOAT 0x00000014 +#define V_030008_FMT_10_11_11 0x00000015 +#define V_030008_FMT_10_11_11_FLOAT 0x00000016 +#define V_030008_FMT_11_11_10 0x00000017 +#define V_030008_FMT_11_11_10_FLOAT 0x00000018 +#define V_030008_FMT_2_10_10_10 0x00000019 +#define V_030008_FMT_8_8_8_8 0x0000001A +#define V_030008_FMT_10_10_10_2 0x0000001B +#define V_030008_FMT_X24_8_32_FLOAT 0x0000001C +#define V_030008_FMT_32_32 0x0000001D +#define V_030008_FMT_32_32_FLOAT 0x0000001E +#define V_030008_FMT_16_16_16_16 0x0000001F +#define V_030008_FMT_16_16_16_16_FLOAT 0x00000020 +#define V_030008_FMT_32_32_32_32 0x00000022 +#define V_030008_FMT_32_32_32_32_FLOAT 0x00000023 +#define V_030008_FMT_8_8_8 0x0000002c +#define V_030008_FMT_16_16_16 0x0000002d +#define V_030008_FMT_16_16_16_FLOAT 0x0000002e +#define V_030008_FMT_32_32_32 0x0000002f +#define V_030008_FMT_32_32_32_FLOAT 0x00000030 #define S_030008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26) #define G_030008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3) #define C_030008_NUM_FORMAT_ALL 0xF3FFFFFF diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index c86bad7ff55..8ed87180d56 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -52,7 +52,7 @@ static void r600_draw_common(struct r600_drawl *draw) struct r600_pipe_context *rctx = (struct r600_pipe_context *)draw->ctx; struct r600_pipe_state *rstate; struct r600_resource *rbuffer; - unsigned i, j, offset, format, prim; + unsigned i, j, offset, prim; u32 vgt_dma_index_type, vgt_draw_initiator, mask; struct pipe_vertex_buffer *vertex_buffer; struct r600_draw rdraw; @@ -86,27 +86,24 @@ static void r600_draw_common(struct r600_drawl *draw) return; for (i = 0 ; i < rctx->vertex_elements->count; i++) { - unsigned num_format = 0, format_comp = 0; + uint32_t word2, format; rstate = &rctx->vs_resource[i]; + rstate->id = R600_PIPE_STATE_RESOURCE; + rstate->nregs = 0; + j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; - format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format); - rstate->id = R600_PIPE_STATE_RESOURCE; - rstate->nregs = 0; - r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp); + format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format); + + word2 = format | S_038008_STRIDE(vertex_buffer->stride); + r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_038008_RESOURCE0_WORD2, - S_038008_STRIDE(vertex_buffer->stride) | - S_038008_DATA_FORMAT(format) | - S_038008_NUM_FORMAT_ALL(num_format) | - S_038008_FORMAT_COMP_ALL(format_comp), - 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL); diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index f41b6a0d7f6..81f285027e6 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -464,29 +464,6 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) } } -static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uint32_t *num_format_p, - uint32_t *format_comp_p) -{ - uint32_t num_format = 0, format_comp = 0; - switch (format) { - case PIPE_FORMAT_R16G16B16A16_SSCALED: - case PIPE_FORMAT_R16G16B16_SSCALED: - case PIPE_FORMAT_R16G16_SSCALED: - case PIPE_FORMAT_R32G32_SSCALED: - format_comp = 1; - case PIPE_FORMAT_R16G16B16A16_USCALED: - case PIPE_FORMAT_R16G16B16_USCALED: - case PIPE_FORMAT_R16G16_USCALED: - case PIPE_FORMAT_R32G32_USCALED: - num_format = V_038008_SQ_NUM_FORMAT_SCALED; - break; - default: - break; - } - *num_format_p = num_format; - *format_comp_p = format_comp; -} - static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format) { return r600_translate_texformat(format, NULL, NULL, NULL) != ~0; @@ -508,4 +485,139 @@ static INLINE boolean r600_is_vertex_format_supported(enum pipe_format format) return r600_translate_colorformat(format) != ~0; } +static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) +{ + uint32_t result = 0; + const struct util_format_description *desc; + unsigned i; + + desc = util_format_description(format); + if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { + goto out_unknown; + } + + /* Find the first non-VOID channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + switch (desc->channel[i].type) { + /* Half-floats, floats, doubles */ + case UTIL_FORMAT_TYPE_FLOAT: + switch (desc->channel[i].size) { + case 16: + switch (desc->nr_channels) { + case 1: + result = V_038008_FMT_16_FLOAT; + break; + case 2: + result = V_038008_FMT_16_16_FLOAT; + break; + case 3: + result = V_038008_FMT_16_16_16_FLOAT; + break; + case 4: + result = V_038008_FMT_16_16_16_16_FLOAT; + break; + } + break; + case 32: + switch (desc->nr_channels) { + case 1: + result = V_038008_FMT_32_FLOAT; + break; + case 2: + result = V_038008_FMT_32_32_FLOAT; + break; + case 3: + result = V_038008_FMT_32_32_32_FLOAT; + break; + case 4: + result = V_038008_FMT_32_32_32_32_FLOAT; + break; + } + break; + default: + goto out_unknown; + } + break; + /* Unsigned ints */ + case UTIL_FORMAT_TYPE_UNSIGNED: + /* Signed ints */ + case UTIL_FORMAT_TYPE_SIGNED: + switch (desc->channel[i].size) { + case 8: + switch (desc->nr_channels) { + case 1: + result = V_038008_FMT_8; + break; + case 2: + result = V_038008_FMT_8_8; + break; + case 3: + // result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */ + // break; + case 4: + result = V_038008_FMT_8_8_8_8; + break; + } + break; + case 16: + switch (desc->nr_channels) { + case 1: + result = V_038008_FMT_16; + break; + case 2: + result = V_038008_FMT_16_16; + break; + case 3: + // result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */ + // break; + case 4: + result = V_038008_FMT_16_16_16_16; + break; + } + break; + case 32: + switch (desc->nr_channels) { + case 1: + result = V_038008_FMT_32; + break; + case 2: + result = V_038008_FMT_32_32; + break; + case 3: + result = V_038008_FMT_32_32_32; + break; + case 4: + result = V_038008_FMT_32_32_32_32; + break; + } + break; + default: + goto out_unknown; + } + break; + default: + goto out_unknown; + } + + result = S_038008_DATA_FORMAT(result); + + if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) { + result |= S_038008_FORMAT_COMP_ALL(1); + } + if (desc->channel[i].normalized) { + result |= S_038008_NUM_FORMAT_ALL(0); + } else { + result |= S_038008_NUM_FORMAT_ALL(2); + } + return result; +out_unknown: + R600_ERR("unsupported vertex format %s\n", util_format_name(format)); + return ~0; +} + #endif diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 02e3734fcc8..3d1c5dbfd87 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -1025,40 +1025,45 @@ #define S_038008_DATA_FORMAT(x) (((x) & 0x3F) << 20) #define G_038008_DATA_FORMAT(x) (((x) >> 20) & 0x3F) #define C_038008_DATA_FORMAT 0xFC0FFFFF -#define V_038008_COLOR_INVALID 0x00000000 -#define V_038008_COLOR_8 0x00000001 -#define V_038008_COLOR_4_4 0x00000002 -#define V_038008_COLOR_3_3_2 0x00000003 -#define V_038008_COLOR_16 0x00000005 -#define V_038008_COLOR_16_FLOAT 0x00000006 -#define V_038008_COLOR_8_8 0x00000007 -#define V_038008_COLOR_5_6_5 0x00000008 -#define V_038008_COLOR_6_5_5 0x00000009 -#define V_038008_COLOR_1_5_5_5 0x0000000A -#define V_038008_COLOR_4_4_4_4 0x0000000B -#define V_038008_COLOR_5_5_5_1 0x0000000C -#define V_038008_COLOR_32 0x0000000D -#define V_038008_COLOR_32_FLOAT 0x0000000E -#define V_038008_COLOR_16_16 0x0000000F -#define V_038008_COLOR_16_16_FLOAT 0x00000010 -#define V_038008_COLOR_8_24 0x00000011 -#define V_038008_COLOR_8_24_FLOAT 0x00000012 -#define V_038008_COLOR_24_8 0x00000013 -#define V_038008_COLOR_24_8_FLOAT 0x00000014 -#define V_038008_COLOR_10_11_11 0x00000015 -#define V_038008_COLOR_10_11_11_FLOAT 0x00000016 -#define V_038008_COLOR_11_11_10 0x00000017 -#define V_038008_COLOR_11_11_10_FLOAT 0x00000018 -#define V_038008_COLOR_2_10_10_10 0x00000019 -#define V_038008_COLOR_8_8_8_8 0x0000001A -#define V_038008_COLOR_10_10_10_2 0x0000001B -#define V_038008_COLOR_X24_8_32_FLOAT 0x0000001C -#define V_038008_COLOR_32_32 0x0000001D -#define V_038008_COLOR_32_32_FLOAT 0x0000001E -#define V_038008_COLOR_16_16_16_16 0x0000001F -#define V_038008_COLOR_16_16_16_16_FLOAT 0x00000020 -#define V_038008_COLOR_32_32_32_32 0x00000022 -#define V_038008_COLOR_32_32_32_32_FLOAT 0x00000023 +#define V_038008_FMT_INVALID 0x00000000 +#define V_038008_FMT_8 0x00000001 +#define V_038008_FMT_4_4 0x00000002 +#define V_038008_FMT_3_3_2 0x00000003 +#define V_038008_FMT_16 0x00000005 +#define V_038008_FMT_16_FLOAT 0x00000006 +#define V_038008_FMT_8_8 0x00000007 +#define V_038008_FMT_5_6_5 0x00000008 +#define V_038008_FMT_6_5_5 0x00000009 +#define V_038008_FMT_1_5_5_5 0x0000000A +#define V_038008_FMT_4_4_4_4 0x0000000B +#define V_038008_FMT_5_5_5_1 0x0000000C +#define V_038008_FMT_32 0x0000000D +#define V_038008_FMT_32_FLOAT 0x0000000E +#define V_038008_FMT_16_16 0x0000000F +#define V_038008_FMT_16_16_FLOAT 0x00000010 +#define V_038008_FMT_8_24 0x00000011 +#define V_038008_FMT_8_24_FLOAT 0x00000012 +#define V_038008_FMT_24_8 0x00000013 +#define V_038008_FMT_24_8_FLOAT 0x00000014 +#define V_038008_FMT_10_11_11 0x00000015 +#define V_038008_FMT_10_11_11_FLOAT 0x00000016 +#define V_038008_FMT_11_11_10 0x00000017 +#define V_038008_FMT_11_11_10_FLOAT 0x00000018 +#define V_038008_FMT_2_10_10_10 0x00000019 +#define V_038008_FMT_8_8_8_8 0x0000001A +#define V_038008_FMT_10_10_10_2 0x0000001B +#define V_038008_FMT_X24_8_32_FLOAT 0x0000001C +#define V_038008_FMT_32_32 0x0000001D +#define V_038008_FMT_32_32_FLOAT 0x0000001E +#define V_038008_FMT_16_16_16_16 0x0000001F +#define V_038008_FMT_16_16_16_16_FLOAT 0x00000020 +#define V_038008_FMT_32_32_32_32 0x00000022 +#define V_038008_FMT_32_32_32_32_FLOAT 0x00000023 +#define V_038008_FMT_8_8_8 0x0000002c +#define V_038008_FMT_16_16_16 0x0000002d +#define V_038008_FMT_16_16_16_FLOAT 0x0000002e +#define V_038008_FMT_32_32_32 0x0000002f +#define V_038008_FMT_32_32_32_FLOAT 0x00000030 #define S_038008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26) #define G_038008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3) #define C_038008_NUM_FORMAT_ALL 0xF3FFFFFF -- cgit v1.2.3 From ac225c76a6a7c98d7e9afa50880db2480be6951f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 13:48:10 +1000 Subject: r600g: sync vertex/texture cache on resources on evergreen this gets rid of lots of the instability on evergreen, which isn't surprising since it really broken not to flush caches. --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 3af299c1803..1b2c2655b50 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -431,8 +431,8 @@ static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) struct r600_reg r600_shader_resource[] = { {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0}, {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0}, {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0}, {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0}, -- cgit v1.2.3 From 14c95bb4eec4417887ae882c39fead47624f0fda Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 14:00:27 +1000 Subject: r600g: add cb flushing for extra buffers + depth buffer on r600/evergreen --- src/gallium/drivers/r600/evergreend.h | 15 ++++++++++--- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 25 +++++++++++++++++++--- src/gallium/winsys/r600/drm/r600_hw_context.c | 15 +++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index f9328c61983..3cb9e634f71 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1865,9 +1865,18 @@ #define S_0085F0_DB_DEST_BASE_ENA(x) (((x) & 0x1) << 14) #define G_0085F0_DB_DEST_BASE_ENA(x) (((x) >> 14) & 0x1) #define C_0085F0_DB_DEST_BASE_ENA 0xFFFFBFFF -#define S_0085F0_CR_DEST_BASE_ENA(x) (((x) & 0x1) << 15) -#define G_0085F0_CR_DEST_BASE_ENA(x) (((x) >> 15) & 0x1) -#define C_0085F0_CR_DEST_BASE_ENA 0xFFFF7FFF +#define S_0085F0_CB8_DEST_BASE_ENA(x) (((x) & 0x1) << 15) +#define G_0085F0_CB8_DEST_BASE_ENA(x) (((x) >> 15) & 0x1) + +#define S_0085F0_CB9_DEST_BASE_ENA(x) (((x) & 0x1) << 16) +#define G_0085F0_CB9_DEST_BASE_ENA(x) (((x) >> 16) & 0x1) + +#define S_0085F0_CB10_DEST_BASE_ENA(x) (((x) & 0x1) << 17) +#define G_0085F0_CB10_DEST_BASE_ENA(x) (((x) >> 17) & 0x1) + +#define S_0085F0_CB11_DEST_BASE_ENA(x) (((x) & 0x1) << 18) +#define G_0085F0_CB11_DEST_BASE_ENA(x) (((x) >> 18) & 0x1) + #define S_0085F0_TC_ACTION_ENA(x) (((x) & 0x1) << 23) #define G_0085F0_TC_ACTION_ENA(x) (((x) >> 23) & 0x1) #define C_0085F0_TC_ACTION_ENA 0xFF7FFFFF diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 1b2c2655b50..88db69c4f7d 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -727,6 +727,7 @@ void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struc void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw) { struct radeon_bo *cb[12]; + struct radeon_bo *db; unsigned ndwords = 9; if (draw->indices) { @@ -738,6 +739,7 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } /* find number of color buffer */ + db = r600_context_reg_bo(ctx, R_028048_DB_Z_READ_BASE); cb[0] = r600_context_reg_bo(ctx, R_028C60_CB_COLOR0_BASE); cb[1] = r600_context_reg_bo(ctx, R_028C9C_CB_COLOR1_BASE); cb[2] = r600_context_reg_bo(ctx, R_028CD8_CB_COLOR2_BASE); @@ -755,6 +757,8 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr ndwords += 7; } } + if (db) + ndwords += 7; /* queries need some special values */ if (ctx->num_query_running) { @@ -808,11 +812,15 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT; /* flush color buffer */ - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 12; i++) { if (cb[i]) { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | - S_0085F0_CB_ACTION_ENA(1); + if (i > 7) + ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB8_DEST_BASE_ENA(1) << (i - 8)) | + S_0085F0_CB_ACTION_ENA(1); + else + ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + S_0085F0_CB_ACTION_ENA(1); ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; @@ -821,6 +829,17 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); } } + if (db) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = S_0085F0_DB_DEST_BASE_ENA(1) | + S_0085F0_DB_ACTION_ENA(1); + ctx->pm4[ctx->pm4_cdwords++] = (db->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], db); + } /* all dirty state have been scheduled in current cs */ ctx->pm4_dirty_cdwords = 0; diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 88a86d2cf28..4d7547c9758 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -878,6 +878,7 @@ struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) { struct radeon_bo *cb[8]; + struct radeon_bo *db; unsigned ndwords = 9; if (draw->indices) { @@ -889,6 +890,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } /* find number of color buffer */ + db = r600_context_reg_bo(ctx, R_02800C_DB_DEPTH_BASE); cb[0] = r600_context_reg_bo(ctx, R_028040_CB_COLOR0_BASE); cb[1] = r600_context_reg_bo(ctx, R_028044_CB_COLOR1_BASE); cb[2] = r600_context_reg_bo(ctx, R_028048_CB_COLOR2_BASE); @@ -902,6 +904,8 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) ndwords += 7; } } + if (db) + ndwords += 7; /* queries need some special values */ if (ctx->num_query_running) { @@ -970,6 +974,17 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); } } + if (db) { + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = S_0085F0_DB_DEST_BASE_ENA(1) | + S_0085F0_DB_ACTION_ENA(1); + ctx->pm4[ctx->pm4_cdwords++] = (db->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], db); + } /* all dirty state have been scheduled in current cs */ ctx->pm4_dirty_cdwords = 0; -- cgit v1.2.3 From b67aa5311fa5d4130cf150c9004946fb30a15fae Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 14:24:14 +1000 Subject: r600g: fix evergreen draw-buffers just a typo in the register headers. --- src/gallium/drivers/r600/evergreend.h | 2 +- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 3cb9e634f71..e265348a19c 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1740,7 +1740,7 @@ #define R_028CA8_CB_COLOR1_VIEW 0x00028CA8 #define R_028CAC_CB_COLOR1_INFO 0x00028CAC #define R_028CB0_CB_COLOR1_ATTRIB 0x00028CB0 -#define R_028CB8_CB_COLOR1_DIM 0x00028CB8 +#define R_028CB4_CB_COLOR1_DIM 0x00028CB4 #define R_028CD8_CB_COLOR2_BASE 0x00028CD8 #define R_028CDC_CB_COLOR2_PITCH 0x00028CDC #define R_028CE0_CB_COLOR2_SLICE 0x00028CE0 diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 88db69c4f7d..557751efacd 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -342,7 +342,7 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB8_CB_COLOR1_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB4_CB_COLOR1_DIM, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0}, -- cgit v1.2.3 From 539a2978ed7f8d1756591061252d081f0f39fb9c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 14:43:02 +1000 Subject: r600g: flush SH cache on constant change on evergreen --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 557751efacd..129f571a04f 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -282,8 +282,8 @@ static const struct r600_reg evergreen_context_reg_list[] = { {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, -- cgit v1.2.3 From 0c39a53aa6b9ef47152e3d44f94fa4486a11831b Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 30 Sep 2010 23:13:50 -0400 Subject: r600c: pull over 6xx/7xx vertex fixes for evergreen --- src/mesa/drivers/dri/r600/evergreen_chip.c | 28 ++--------- src/mesa/drivers/dri/r600/evergreen_render.c | 66 ++++++++++++++------------ src/mesa/drivers/dri/r600/evergreen_vertprog.c | 6 +-- 3 files changed, 42 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index 5287a98c053..16627418232 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -275,7 +275,6 @@ static void evergreenSetupVTXConstants(GLcontext * ctx, { context_t *context = EVERGREEN_CONTEXT(ctx); struct radeon_aos * paos = (struct radeon_aos *)pAos; - unsigned int nVBsize; BATCH_LOCALS(&context->radeon); unsigned int uSQ_VTX_CONSTANT_WORD0_0; @@ -289,21 +288,11 @@ static void evergreenSetupVTXConstants(GLcontext * ctx, r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - if(0 == pStreamDesc->stride) - { - nVBsize = paos->count * pStreamDesc->size * getTypeSize(pStreamDesc->type); - } - else - { - nVBsize = (paos->count - 1) * pStreamDesc->stride - + pStreamDesc->size * getTypeSize(pStreamDesc->type); - } - //uSQ_VTX_CONSTANT_WORD0_0 uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; //uSQ_VTX_CONSTANT_WORD1_0 - uSQ_VTX_CONSTANT_WORD1_0 = nVBsize; + uSQ_VTX_CONSTANT_WORD1_0 = paos->bo->size - paos->offset - 1; //uSQ_VTX_CONSTANT_WORD2_0 SETfield(uSQ_VTX_CONSTANT_WORD2_0, @@ -391,17 +380,6 @@ static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) if (context->radeon.tcl.aos_count == 0) return; - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - END_BATCH(); - COMMIT_BATCH(); - for(i=0; imesa_program->Base.InputsRead & (1 << i)) { @@ -410,7 +388,7 @@ static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) &(context->stream_desc[j])); j++; } - } + } } static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom) { @@ -1522,7 +1500,7 @@ void evergreenInitAtoms(context_t *context) context->radeon.hw.atomlist.name = "atom-list"; EVERGREEN_ALLOC_STATE(init, always, 19, evergreenSendSQConfig); - EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (6 + (VERT_ATTRIB_MAX * 12)), evergreenSendVTX); + EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (VERT_ATTRIB_MAX * 12), evergreenSendVTX); EVERGREEN_ALLOC_STATE(pa, always, 124, evergreenSendPA); EVERGREEN_ALLOC_STATE(tp, always, 0, evergreenSendTP); EVERGREEN_ALLOC_STATE(sq, always, 86, evergreenSendSQ); /* 85 */ diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 85b2f9d6ab7..27089bfcf75 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -148,7 +148,8 @@ static int evergreenNumVerts(int num_verts, int prim) //same return num_verts - verts_off; } -static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) //same +static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int prim, + GLint basevertex) //same { context_t *context = EVERGREEN_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); @@ -186,6 +187,7 @@ static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ + + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ + 5 + 2; /* DRAW_INDEX */ BEGIN_BATCH_NO_AUTOSTATE(total_emit); @@ -198,6 +200,11 @@ static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int // num instances R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); R600_OUT_BATCH(1); + /* offset */ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); + R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); + R600_OUT_BATCH(basevertex); //VTX_BASE_VTX_LOC + R600_OUT_BATCH(0); //VTX_START_INST_LOC // draw packet R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); R600_OUT_BATCH(context->ind_buf.bo_offset); @@ -268,6 +275,7 @@ static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int total_emit += 3 /* VGT_PRIMITIVE_TYPE */ + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ + + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ + 3; /* DRAW */ BEGIN_BATCH_NO_AUTOSTATE(total_emit); @@ -280,6 +288,11 @@ static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int // num instances R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); R600_OUT_BATCH(1); + /* offset */ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); + R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); + R600_OUT_BATCH(0); //VTX_BASE_VTX_LOC + R600_OUT_BATCH(0); //VTX_START_INST_LOC // draw packet if(start == 0) { @@ -527,16 +540,16 @@ static GLuint evergreenPredictRenderSize(GLcontext* ctx, dwords = PRE_EMIT_STATE_BUFSZ; if (ib) - dwords += nr_prims * 14; + dwords += nr_prims * 18; else { for (i = 0; i < nr_prims; ++i) { if (prim[i].start == 0) - dwords += 10; + dwords += 14; else if (prim[i].count > 0xffff) - dwords += prim[i].count + 10; + dwords += prim[i].count + 14; else - dwords += ((prim[i].count + 1) / 2) + 10; + dwords += ((prim[i].count + 1) / 2) + 14; } } @@ -665,11 +678,11 @@ static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array * stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB; - if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT || + if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT #if MESA_BIG_ENDIAN - getTypeSize(input[i]->Type) != 4 || + || getTypeSize(input[i]->Type) != 4 #endif - stride < 4) + ) { evergreenConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); } @@ -677,19 +690,10 @@ static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array * { if (input[i]->BufferObj->Name) { - if (stride % 4 != 0) - { - assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 0); - evergreenAlignDataToDword(ctx, input[i], count, &context->stream_desc[index]); - context->stream_desc[index].is_named_bo = GL_FALSE; - } - else - { - context->stream_desc[index].stride = input[i]->StrideB; - context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; - context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; - context->stream_desc[index].is_named_bo = GL_TRUE; - } + context->stream_desc[index].stride = input[i]->StrideB; + context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; + context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; + context->stream_desc[index].is_named_bo = GL_TRUE; } else { @@ -857,7 +861,8 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, evergreenRunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, - prim[i].mode); + prim[i].mode, + prim[i].basevertex); else evergreenRunRenderPrimitiveImmediate(ctx, prim[i].start, @@ -907,15 +912,16 @@ static void evergreenDrawPrims(GLcontext *ctx, /* This check should get folded into just the places that * min/max index are really needed. */ - if (!index_bounds_valid) { - vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); - } - - if (min_index) { - vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims ); - return; + if (!vbo_all_varyings_in_vbos(arrays)) { + if (!index_bounds_valid) + vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); + /* do we want to rebase, minimizes the + * amount of data to upload? */ + if (min_index) { + vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims ); + return; + } } - /* Make an attempt at drawing */ retval = evergreenTryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 6840fa3c869..0099cef527a 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -459,11 +459,11 @@ static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, co stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size : input->StrideB; - if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT #if MESA_BIG_ENDIAN - evergreen_getTypeSize(input->Type) != 4 || + || evergreen_getTypeSize(input->Type) != 4 #endif - stride < 4) + ) { pStreamDesc->type = GL_FLOAT; -- cgit v1.2.3 From 7777c997e0f4cf75ff292f34a5a64ee2834c0f26 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 15:16:47 +1000 Subject: r600g: only set the Z export if shader exports it. --- src/gallium/drivers/r600/evergreen_state.c | 9 +++++---- src/gallium/drivers/r600/r600_shader.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 2f5f1bff28e..4fa94e31e71 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1531,10 +1531,11 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } for (i = 0; i < rshader->noutput; i++) { - r600_pipe_state_add_reg(rstate, - R_02880C_DB_SHADER_CONTROL, - S_02880C_Z_EXPORT_ENABLE(1), - S_02880C_Z_EXPORT_ENABLE(1), NULL); + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + S_02880C_Z_EXPORT_ENABLE(1), + S_02880C_Z_EXPORT_ENABLE(1), NULL); } exports_ps = 0; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d35a99085dc..66cc035e7d9 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -127,10 +127,11 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } for (i = 0; i < rshader->noutput; i++) { - r600_pipe_state_add_reg(rstate, - R_02880C_DB_SHADER_CONTROL, - S_02880C_Z_EXPORT_ENABLE(1), - S_02880C_Z_EXPORT_ENABLE(1), NULL); + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + S_02880C_Z_EXPORT_ENABLE(1), + S_02880C_Z_EXPORT_ENABLE(1), NULL); } exports_ps = 0; -- cgit v1.2.3 From 738aa29289296512959cbb37d8602131dae44dab Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 1 Oct 2010 15:56:05 +1000 Subject: r600g: setup basic loop consts on r600 + evergreen. this sets up a single loop constant like r600c does. --- src/gallium/drivers/r600/evergreen_state.c | 8 ++++++++ src/gallium/drivers/r600/evergreend.h | 1 + src/gallium/drivers/r600/r600_shader.c | 8 ++++++++ src/gallium/drivers/r600/r600d.h | 2 ++ src/gallium/winsys/r600/drm/evergreen_hw_context.c | 21 +++++++++++++++++++++ src/gallium/winsys/r600/drm/r600_hw_context.c | 21 +++++++++++++++++++++ 6 files changed, 61 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 4fa94e31e71..70799f6378e 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1593,6 +1593,10 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader S_02880C_KILL_ENABLE(1), S_02880C_KILL_ENABLE(1), NULL); } + + r600_pipe_state_add_reg(rstate, + R_03A200_SQ_LOOP_CONST_0, 0x01000FFF, + 0xFFFFFFFF, NULL); } void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) @@ -1640,6 +1644,10 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); + + r600_pipe_state_add_reg(rstate, + R_03A200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF, + 0xFFFFFFFF, NULL); } void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx) diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index e265348a19c..9971dded782 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1910,4 +1910,5 @@ #define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0 #define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4 +#define R_03A200_SQ_LOOP_CONST_0 0x3A200 #endif diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 66cc035e7d9..41c01d4a7b3 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -81,6 +81,11 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R_028894_SQ_PGM_START_FS, 0x00000000, 0xFFFFFFFF, shader->bo); + + r600_pipe_state_add_reg(rstate, + R_03E200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF, + 0xFFFFFFFF, NULL); + } int r600_find_vs_semantic_index(struct r600_shader *vs, @@ -182,6 +187,9 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade S_02880C_KILL_ENABLE(1), S_02880C_KILL_ENABLE(1), NULL); } + r600_pipe_state_add_reg(rstate, + R_03E200_SQ_LOOP_CONST_0, 0x01000FFF, + 0xFFFFFFFF, NULL); } static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 3d1c5dbfd87..a96d2ce26c1 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -3497,6 +3497,8 @@ #define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0 #define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4 +#define R_03E200_SQ_LOOP_CONST_0 0x3E200 + #define SQ_TEX_INST_LD 0x03 #define SQ_TEX_INST_GET_GRADIENTS_H 0x7 #define SQ_TEX_INST_GET_GRADIENTS_V 0x8 diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 129f571a04f..c3569e60e88 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -493,6 +493,22 @@ static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 off return 0; } +static int evergreen_loop_const_init(struct r600_context *ctx, u32 offset) +{ + unsigned nreg = 32; + struct r600_reg r600_loop_consts[32]; + int i; + + for (i = 0; i < nreg; i++) { + r600_loop_consts[i].opcode = PKT3_SET_LOOP_CONST; + r600_loop_consts[i].offset_base = EVERGREEN_LOOP_CONST_OFFSET; + r600_loop_consts[i].offset = EVERGREEN_LOOP_CONST_OFFSET + ((offset + i) * 4); + r600_loop_consts[i].need_bo = 0; + r600_loop_consts[i].flush_flags = 0; + } + return r600_context_add_block(ctx, r600_loop_consts, nreg); +} + int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) { int r; @@ -566,6 +582,11 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } + /* PS loop const */ + evergreen_loop_const_init(ctx, 0); + /* VS loop const */ + evergreen_loop_const_init(ctx, 32); + /* setup block table */ ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); for (int i = 0, c = 0; i < 256; i++) { diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 4d7547c9758..2ca5a45e03d 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -542,6 +542,22 @@ static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) return r600_context_add_block(ctx, r600_shader_sampler_border, nreg); } +static int r600_loop_const_init(struct r600_context *ctx, u32 offset) +{ + unsigned nreg = 32; + struct r600_reg r600_loop_consts[32]; + int i; + + for (i = 0; i < nreg; i++) { + r600_loop_consts[i].opcode = PKT3_SET_LOOP_CONST; + r600_loop_consts[i].offset_base = R600_LOOP_CONST_OFFSET; + r600_loop_consts[i].offset = R600_LOOP_CONST_OFFSET + ((offset + i) * 4); + r600_loop_consts[i].need_bo = 0; + r600_loop_consts[i].flush_flags = 0; + } + return r600_context_add_block(ctx, r600_loop_consts, nreg); +} + /* initialize */ void r600_context_fini(struct r600_context *ctx) { @@ -639,6 +655,11 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } + /* PS loop const */ + r600_loop_const_init(ctx, 0); + /* VS loop const */ + r600_loop_const_init(ctx, 32); + /* setup block table */ ctx->blocks = calloc(ctx->nblocks, sizeof(void*)); for (int i = 0, c = 0; i < 256; i++) { -- cgit v1.2.3 From 29b491bd033dd97e5afa3ca0058c50f28c01f39d Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 1 Oct 2010 10:26:58 -0400 Subject: r600g: indentation fixes Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/eg_asm.c | 4 +- src/gallium/drivers/r600/eg_state_inlines.h | 96 ++++++++++++++--------------- src/gallium/drivers/r600/r600_asm.h | 2 +- src/gallium/drivers/r600/r600_buffer.c | 12 ++-- src/gallium/drivers/r600/r600_resource.c | 1 - 5 files changed, 57 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c index dd9eda18d1f..52b7189e9e5 100644 --- a/src/gallium/drivers/r600/eg_asm.c +++ b/src/gallium/drivers/r600/eg_asm.c @@ -72,8 +72,8 @@ int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1); bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) | S_SQ_CF_WORD1_BARRIER(1) | - S_SQ_CF_WORD1_COND(cf->cond) | - S_SQ_CF_WORD1_POP_COUNT(cf->pop_count); + S_SQ_CF_WORD1_COND(cf->cond) | + S_SQ_CF_WORD1_POP_COUNT(cf->pop_count); break; default: diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index c93b9d94c55..81094904485 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -494,9 +494,9 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) switch (desc->channel[i].type) { /* Half-floats, floats, doubles */ - case UTIL_FORMAT_TYPE_FLOAT: + case UTIL_FORMAT_TYPE_FLOAT: switch (desc->channel[i].size) { - case 16: + case 16: switch (desc->nr_channels) { case 1: result = V_030008_FMT_16_FLOAT; @@ -512,7 +512,7 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) break; } break; - case 32: + case 32: switch (desc->nr_channels) { case 1: result = V_030008_FMT_32_FLOAT; @@ -528,16 +528,16 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) break; } break; - default: + default: goto out_unknown; } break; - /* Unsigned ints */ - case UTIL_FORMAT_TYPE_UNSIGNED: - /* Signed ints */ - case UTIL_FORMAT_TYPE_SIGNED: + /* Unsigned ints */ + case UTIL_FORMAT_TYPE_UNSIGNED: + /* Signed ints */ + case UTIL_FORMAT_TYPE_SIGNED: switch (desc->channel[i].size) { - case 8: + case 8: switch (desc->nr_channels) { case 1: result = V_030008_FMT_8; @@ -546,14 +546,14 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) result = V_030008_FMT_8_8; break; case 3: - // result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */ - // break; +// result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */ +// break; case 4: result = V_030008_FMT_8_8_8_8; break; } break; - case 16: + case 16: switch (desc->nr_channels) { case 1: result = V_030008_FMT_16; @@ -562,14 +562,14 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) result = V_030008_FMT_16_16; break; case 3: - // result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */ - // break; +// result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */ +// break; case 4: result = V_030008_FMT_16_16_16_16; break; } break; - case 32: + case 32: switch (desc->nr_channels) { case 1: result = V_030008_FMT_32; @@ -585,14 +585,14 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) break; } break; - default: + default: goto out_unknown; } break; - default: + default: goto out_unknown; } - + result = S_030008_DATA_FORMAT(result); if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) { @@ -611,36 +611,36 @@ out_unknown: static INLINE uint32_t r600_translate_vertex_data_swizzle(enum pipe_format format) { - const struct util_format_description *desc = util_format_description(format); - unsigned i; - uint32_t word3; - - assert(format); - - if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { - fprintf(stderr, "r600: Bad format %s in %s:%d\n", - util_format_short_name(format), __FUNCTION__, __LINE__); - return 0; - } - - word3 = 0; - for (i = 0; i < desc->nr_channels; i++) { - switch (i) { - case 0: - word3 |= S_03000C_DST_SEL_X(desc->swizzle[0]); - break; - case 1: - word3 |= S_03000C_DST_SEL_Y(desc->swizzle[1]); - break; - case 2: - word3 |= S_03000C_DST_SEL_Z(desc->swizzle[2]); - break; - case 3: - word3 |= S_03000C_DST_SEL_W(desc->swizzle[3]); - break; - } - } - return word3; + const struct util_format_description *desc = util_format_description(format); + unsigned i; + uint32_t word3; + + assert(format); + + if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { + fprintf(stderr, "r600: Bad format %s in %s:%d\n", + util_format_short_name(format), __FUNCTION__, __LINE__); + return 0; + } + + word3 = 0; + for (i = 0; i < desc->nr_channels; i++) { + switch (i) { + case 0: + word3 |= S_03000C_DST_SEL_X(desc->swizzle[0]); + break; + case 1: + word3 |= S_03000C_DST_SEL_Y(desc->swizzle[1]); + break; + case 2: + word3 |= S_03000C_DST_SEL_Z(desc->swizzle[2]); + break; + case 3: + word3 |= S_03000C_DST_SEL_W(desc->swizzle[3]); + break; + } + } + return word3; } #endif diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index cbf46a8b64b..dba60afc528 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -58,7 +58,7 @@ struct r600_bc_alu { unsigned bank_swizzle; unsigned bank_swizzle_force; u32 value[4]; - int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS]; + int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS]; }; struct r600_bc_tex { diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 3900b3779f3..1bbcb310ebf 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -43,23 +43,23 @@ u32 r600_domain_from_usage(unsigned usage) u32 domain = RADEON_GEM_DOMAIN_GTT; if (usage & PIPE_BIND_RENDER_TARGET) { - domain |= RADEON_GEM_DOMAIN_VRAM; + domain |= RADEON_GEM_DOMAIN_VRAM; } if (usage & PIPE_BIND_DEPTH_STENCIL) { - domain |= RADEON_GEM_DOMAIN_VRAM; + domain |= RADEON_GEM_DOMAIN_VRAM; } if (usage & PIPE_BIND_SAMPLER_VIEW) { - domain |= RADEON_GEM_DOMAIN_VRAM; + domain |= RADEON_GEM_DOMAIN_VRAM; } /* also need BIND_BLIT_SOURCE/DESTINATION ? */ if (usage & PIPE_BIND_VERTEX_BUFFER) { - domain |= RADEON_GEM_DOMAIN_GTT; + domain |= RADEON_GEM_DOMAIN_GTT; } if (usage & PIPE_BIND_INDEX_BUFFER) { - domain |= RADEON_GEM_DOMAIN_GTT; + domain |= RADEON_GEM_DOMAIN_GTT; } if (usage & PIPE_BIND_CONSTANT_BUFFER) { - domain |= RADEON_GEM_DOMAIN_VRAM; + domain |= RADEON_GEM_DOMAIN_VRAM; } return domain; diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index 59edab0e24a..207642ccfa9 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -63,4 +63,3 @@ void r600_init_context_resource_functions(struct r600_pipe_context *r600) r600->context.transfer_inline_write = u_transfer_inline_write_vtbl; r600->context.is_resource_referenced = u_is_resource_referenced_vtbl; } - -- cgit v1.2.3 From efc4a6f7909dbf554ee440210233c4b0f89ac89e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 10:45:26 -0700 Subject: i965: Add gen6 attribute interpolation to new FS backend. Untested, since my hardware is not booting at the moment. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 42 +++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 78cdfed3fbb..864c0b91e5b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -468,7 +468,8 @@ public: void emit_dummy_fs(); void emit_fragcoord_interpolation(ir_variable *ir); void emit_general_interpolation(ir_variable *ir); - void emit_interpolation_setup(); + void emit_interpolation_setup_gen4(); + void emit_interpolation_setup_gen6(); fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf); fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf); void emit_fb_writes(); @@ -1662,7 +1663,7 @@ fs_visitor::interp_reg(int location, int channel) /** Emits the interpolation for the varying inputs. */ void -fs_visitor::emit_interpolation_setup() +fs_visitor::emit_interpolation_setup_gen4() { struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); @@ -1705,6 +1706,38 @@ fs_visitor::emit_interpolation_setup() this->current_annotation = NULL; } +/** Emits the interpolation for the varying inputs. */ +void +fs_visitor::emit_interpolation_setup_gen6() +{ + struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); + + /* If the pixel centers end up used, the setup is the same as for gen4. */ + this->current_annotation = "compute pixel centers"; + this->pixel_x = fs_reg(this, glsl_type::uint_type); + this->pixel_y = fs_reg(this, glsl_type::uint_type); + this->pixel_x.type = BRW_REGISTER_TYPE_UW; + this->pixel_y.type = BRW_REGISTER_TYPE_UW; + emit(fs_inst(BRW_OPCODE_ADD, + this->pixel_x, + fs_reg(stride(suboffset(g1_uw, 4), 2, 4, 0)), + fs_reg(brw_imm_v(0x10101010)))); + emit(fs_inst(BRW_OPCODE_ADD, + this->pixel_y, + fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)), + fs_reg(brw_imm_v(0x11001100)))); + + this->current_annotation = "compute 1/pos.w"; + this->wpos_w = fs_reg(brw_vec8_grf(c->key.source_w_reg, 0)); + this->pixel_w = fs_reg(this, glsl_type::float_type); + emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos_w)); + + this->delta_x = fs_reg(brw_vec8_grf(2, 0)); + this->delta_y = fs_reg(brw_vec8_grf(3, 0)); + + this->current_annotation = NULL; +} + void fs_visitor::emit_fb_writes() { @@ -2614,7 +2647,10 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) if (0) { v.emit_dummy_fs(); } else { - v.emit_interpolation_setup(); + if (intel->gen < 6) + v.emit_interpolation_setup_gen4(); + else + v.emit_interpolation_setup_gen6(); /* Generate FS IR for main(). (the visitor only descends into * functions called "main"). -- cgit v1.2.3 From 354c40a62411262d1223f439fdaf2176ca9adbe9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 10:49:01 -0700 Subject: i965: Fix the gen6 jump size for BREAK/CONT in new FS. Since gen5, jumps are in increments of 64 bits instead of increments of 128-bit instructions. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 864c0b91e5b..1968e7fde0e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2518,7 +2518,7 @@ fs_visitor::generate_code() struct brw_instruction *inst0, *inst1; GLuint br = 1; - if (intel->gen == 5) + if (intel->gen >= 5) br = 2; assert(loop_stack_depth > 0); -- cgit v1.2.3 From ff5ce9289b5159e7de34706b31be771d3e3cefd6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 11:44:27 -0700 Subject: i965: Also increment attribute location when skipping unused slots. Fixes glsl1-texcoord varying. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 1968e7fde0e..95671412296 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -786,6 +786,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) * we'd fall over later trying to find the setup data. */ attr.reg_offset += type->vector_elements; + location++; continue; } -- cgit v1.2.3 From 8f63a44636e4fef2f35fe73f24c27db9b04389b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 12:15:48 -0700 Subject: i965: Pre-gen6, map VS outputs (not FS inputs) to URB setup in the new FS. We should fix the SF to actually give us just the data we need, but this fixes regressions in the new FS until then. Fixes: glsl-kwin-blur glsl-routing --- src/mesa/drivers/dri/i965/brw_fs.cpp | 72 ++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 95671412296..9783e6170b8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -450,6 +450,7 @@ public: fs_inst *emit(fs_inst inst); void assign_curb_setup(); + void calculate_urb_setup(); void assign_urb_setup(); void assign_regs(); void assign_regs_trivial(); @@ -499,6 +500,7 @@ public: struct hash_table *variable_ht; ir_variable *frag_color, *frag_data, *frag_depth; int first_non_payload_grf; + int urb_setup[FRAG_ATTRIB_MAX]; /** @{ debug annotation info */ const char *current_annotation; @@ -780,10 +782,9 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) int location = ir->location; for (unsigned int i = 0; i < array_elements; i++) { for (unsigned int j = 0; j < type->matrix_columns; j++) { - if (!(fp->Base.InputsRead & BITFIELD64_BIT(location))) { + if (urb_setup[location] == -1) { /* If there's no incoming setup data for this slot, don't - * emit interpolation for it (since it's not used, and - * we'd fall over later trying to find the setup data. + * emit interpolation for it. */ attr.reg_offset += type->vector_elements; location++; @@ -1656,9 +1657,11 @@ fs_visitor::emit_dummy_fs() struct brw_reg fs_visitor::interp_reg(int location, int channel) { - int regnr = location * 2 + channel / 2; + int regnr = urb_setup[location] * 2 + channel / 2; int stride = (channel & 1) * 4; + assert(urb_setup[location] != -1); + return brw_vec1_grf(regnr, stride); } @@ -2085,28 +2088,51 @@ fs_visitor::assign_curb_setup() } void -fs_visitor::assign_urb_setup() +fs_visitor::calculate_urb_setup() { - int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length; - int interp_reg_nr[FRAG_ATTRIB_MAX]; - - c->prog_data.urb_read_length = 0; + for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + urb_setup[i] = -1; + } + int urb_next = 0; /* Figure out where each of the incoming setup attributes lands. */ - for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { - interp_reg_nr[i] = -1; + if (intel->gen >= 6) { + for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (i == FRAG_ATTRIB_WPOS || + (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i))) { + urb_setup[i] = urb_next++; + } + } + } else { + /* FINISHME: The sf doesn't map VS->FS inputs for us very well. */ + for (unsigned int i = 0; i < VERT_RESULT_MAX; i++) { + if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { + int fp_index; + + if (i >= VERT_RESULT_VAR0) + fp_index = i - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0); + else if (i <= VERT_RESULT_TEX7) + fp_index = i; + else + fp_index = -1; + + if (fp_index >= 0) + urb_setup[fp_index] = urb_next++; + } + } + } - if (i != FRAG_ATTRIB_WPOS && - !(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i))) - continue; + /* Each attribute is 4 setup channels, each of which is half a reg. */ + c->prog_data.urb_read_length = urb_next * 2; +} - /* Each attribute is 4 setup channels, each of which is half a reg. */ - interp_reg_nr[i] = urb_start + c->prog_data.urb_read_length; - c->prog_data.urb_read_length += 2; - } +void +fs_visitor::assign_urb_setup() +{ + int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length; - /* Map the register numbers for FS_OPCODE_LINTERP so that it uses - * the correct setup input. + /* Offset all the urb_setup[] index by the actual position of the + * setup regs, now that the location of the constants has been chosen. */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -2116,10 +2142,7 @@ fs_visitor::assign_urb_setup() assert(inst->src[2].file == FIXED_HW_REG); - int location = inst->src[2].fixed_hw_reg.nr / 2; - assert(interp_reg_nr[location] != -1); - inst->src[2].fixed_hw_reg.nr = (interp_reg_nr[location] + - (inst->src[2].fixed_hw_reg.nr & 1)); + inst->src[2].fixed_hw_reg.nr += urb_start; } this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length; @@ -2648,6 +2671,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) if (0) { v.emit_dummy_fs(); } else { + v.calculate_urb_setup(); if (intel->gen < 6) v.emit_interpolation_setup_gen4(); else -- cgit v1.2.3 From 92eb07a281d3b8748b5570d502c98aca654823de Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 1 Oct 2010 16:10:02 -0400 Subject: evergreen : fix z format setting, enable stencil. --- src/mesa/drivers/dri/r600/evergreen_chip.c | 48 +++++++++++++++++++++-------- src/mesa/drivers/dri/r600/evergreen_state.c | 44 ++++++++++++++++---------- 2 files changed, 62 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index 16627418232..b591d5fa27c 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -876,13 +876,13 @@ static void evergreenSetDepthTarget(context_t *context) if(4 == rrb->cpp) { - SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_8_24, + SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_24, EG_DB_Z_INFO__FORMAT_shift, EG_DB_Z_INFO__FORMAT_mask); } else { - SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_16, + SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_16, EG_DB_Z_INFO__FORMAT_shift, EG_DB_Z_INFO__FORMAT_mask); } @@ -896,6 +896,7 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); struct radeon_renderbuffer *rrb; + unsigned int zheight, zpitch, offtostencil; BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); @@ -949,17 +950,28 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); rrb = radeon_get_depthbuffer(&context->radeon); + + if (context->radeon.radeonScreen->driScreen->dri2.enabled) + { + zheight = rrb->base.Height; + } + else + { + zheight = context->radeon.radeonScreen->driScreen->fbHeight; + } + zpitch = rrb->pitch; + if( (rrb != NULL) && (rrb->bo != NULL) ) { /* make the hw happy */ BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All, + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All, rrb->bo, evergreen->DB_HTILE_DATA_BASE.u32All, 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); + END_BATCH(); //5 BEGIN_BATCH_NO_AUTOSTATE(3 + 2); @@ -993,27 +1005,37 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } } -/* + if (ctx->DrawBuffer) { rrb = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); if((rrb != NULL) && (rrb->bo != NULL)) - { + { //5 BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_Z_INFO.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_STENCIL_INFO.u32All); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_INFO.u32All, rrb->bo, evergreen->DB_STENCIL_INFO.u32All, 0, RADEON_GEM_DOMAIN_VRAM, 0); END_BATCH(); + + //4 + BEGIN_BATCH_NO_AUTOSTATE(4); + R600_OUT_BATCH_REGSEQ(DB_STENCILREFMASK, 2); + R600_OUT_BATCH(evergreen->DB_STENCILREFMASK.u32All); + R600_OUT_BATCH(evergreen->DB_STENCILREFMASK_BF.u32All); + END_BATCH(); + //------------------------ //10 if((evergreen->DB_DEPTH_CONTROL.u32All & STENCIL_ENABLE_bit) > 0) { - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, evergreen->DB_STENCIL_READ_BASE.u32All); + offtostencil = ((zheight * zpitch + 255) >> 8) & 0xffffffff; + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, offtostencil); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_READ_BASE.u32All, rrb->bo, evergreen->DB_STENCIL_READ_BASE.u32All, @@ -1021,7 +1043,7 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_WRITE_BASE, evergreen->DB_STENCIL_WRITE_BASE.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_WRITE_BASE, offtostencil); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_WRITE_BASE.u32All, rrb->bo, evergreen->DB_STENCIL_WRITE_BASE.u32All, @@ -1030,7 +1052,7 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) } } } -*/ + COMMIT_BATCH(); } @@ -1508,7 +1530,7 @@ void evergreenInitAtoms(context_t *context) EVERGREEN_ALLOC_STATE(spi, always, 59, evergreenSendSPI); EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX); EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */ - EVERGREEN_ALLOC_STATE(db, always, 65, evergreenSendDB); + EVERGREEN_ALLOC_STATE(db, always, 69, evergreenSendDB); EVERGREEN_ALLOC_STATE(cb, always, 37, evergreenSendCB); EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT); diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c index 931478caa5a..69c5ab656ea 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.c +++ b/src/mesa/drivers/dri/r600/evergreen_state.c @@ -703,24 +703,25 @@ static void evergreenSetDepthState(GLcontext * ctx) //same static void evergreenSetStencilState(GLcontext * ctx, GLboolean state) //same { - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - GLboolean hw_stencil = GL_FALSE; + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + GLboolean hw_stencil = GL_FALSE; - if (ctx->DrawBuffer) { - struct radeon_renderbuffer *rrbStencil - = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - hw_stencil = (rrbStencil && rrbStencil->bo); - } + if (ctx->DrawBuffer) { + struct radeon_renderbuffer *rrbStencil + = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); + hw_stencil = (rrbStencil && rrbStencil->bo); + } - if (hw_stencil) { - EVERGREEN_STATECHANGE(context, db); - if (state) { - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); - } else - CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - } + if (hw_stencil) { + EVERGREEN_STATECHANGE(context, db); + if (state) { + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); + SETbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); + } else + CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); + } } static void evergreenUpdateCulling(GLcontext * ctx) //same @@ -1699,7 +1700,7 @@ void evergreenInitState(GLcontext * ctx) //diff evergreen->DB_STENCIL_INFO.u32All = 0; CLEARbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); - SETfield(evergreen->DB_STENCIL_INFO.u32All, EG_ADDR_SURF_TILE_SPLIT_256B, + SETfield(evergreen->DB_STENCIL_INFO.u32All, 0, EG_DB_STENCIL_INFO__TILE_SPLIT_shift, EG_DB_STENCIL_INFO__TILE_SPLIT_mask); evergreen->DB_RENDER_CONTROL.u32All = 0; @@ -1709,6 +1710,15 @@ void evergreenInitState(GLcontext * ctx) //diff SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); + /* stencil */ + evergreenEnable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); + evergreenStencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]); + evergreenStencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0], + ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]); + evergreenStencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0], + ctx->Stencil.ZFailFunc[0], + ctx->Stencil.ZPassFunc[0]); + // Disable ROP3 modes by setting src to dst copy: SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC, EG_CB_COLOR_CONTROL__ROP3_shift, -- cgit v1.2.3 From bfd9715c3c9d40b3f937638073ff2f0969ebd143 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 13:37:40 -0700 Subject: i965: Add real support for pre-gen5 texture sampling to the new FS. Fixes 36 testcases, including glsl-fs-shadow2d*-bias which fail on the Mesa IR backend. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 122 ++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9783e6170b8..99f50b91e15 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -471,8 +471,8 @@ public: void emit_general_interpolation(ir_variable *ir); void emit_interpolation_setup_gen4(); void emit_interpolation_setup_gen6(); - fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf); - fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf); + fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate); + fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate); void emit_fb_writes(); void emit_assignment_writes(fs_reg &l, fs_reg &r, const glsl_type *type, bool predicated); @@ -1226,12 +1226,23 @@ fs_visitor::visit(ir_assignment *ir) } fs_inst * -fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf) +fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate) { - /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ - int mlen = 3; + int mlen; + int base_mrf = 2; + bool simd16 = false; + fs_reg orig_dst; if (ir->shadow_comparitor) { + for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + coordinate)); + coordinate.reg_offset++; + mlen++; + } + /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ + mlen = 3; + if (ir->op == ir_tex) { /* There's no plain shadow compare message, so we use shadow * compare with a bias of 0.0. @@ -1255,11 +1266,57 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf) ir->shadow_comparitor->accept(this); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; + } else if (ir->op == ir_tex) { + for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + coordinate)); + coordinate.reg_offset++; + } + /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ + mlen = 3; } else { - /* Oh joy. gen4 doesn't have SIMD8 non-shadow-compare sampler + /* Oh joy. gen4 doesn't have SIMD8 non-shadow-compare bias/lod * instructions. We'll need to do SIMD16 here. */ - abort(); + assert(ir->op == ir_txb || ir->op == ir_txl); + + for (mlen = 0; mlen < ir->coordinate->type->vector_elements * 2;) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + coordinate)); + coordinate.reg_offset++; + mlen++; + + /* The unused upper half. */ + mlen++; + } + + /* lod/bias appears after u/v/r. */ + mlen = 6; + + if (ir->op == ir_txb) { + ir->lod_info.bias->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } else { + ir->lod_info.lod->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } + + /* The unused upper half. */ + mlen++; + + /* Now, since we're doing simd16, the return is 2 interleaved + * vec4s where the odd-indexed ones are junk. We'll need to move + * this weirdness around to the expected layout. + */ + simd16 = true; + orig_dst = dst; + dst = fs_reg(this, glsl_type::get_array_instance(glsl_type::vec4_type, + 2)); + dst.type = BRW_REGISTER_TYPE_F; } fs_inst *inst = NULL; @@ -1280,11 +1337,19 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, int base_mrf) } inst->mlen = mlen; + if (simd16) { + for (int i = 0; i < 4; i++) { + emit(fs_inst(BRW_OPCODE_MOV, orig_dst, dst)); + orig_dst.reg_offset++; + dst.reg_offset += 2; + } + } + return inst; } fs_inst * -fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf) +fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate) { /* gen5's SIMD8 sampler has slots for u, v, r, array index, then * optional parameters like shadow comparitor or LOD bias. If @@ -1294,7 +1359,14 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf) * We don't fill in the unnecessary slots regardless, which may * look surprising in the disassembly. */ - int mlen = ir->coordinate->type->vector_elements; + int mlen; + int base_mrf = 2; + + for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); + coordinate.reg_offset++; + mlen++; + } if (ir->shadow_comparitor) { mlen = MAX2(mlen, 4); @@ -1338,9 +1410,7 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, int base_mrf) void fs_visitor::visit(ir_texture *ir) { - int base_mrf = 2; fs_inst *inst = NULL; - unsigned int mlen = 0; ir->coordinate->accept(this); fs_reg coordinate = this->result; @@ -1348,20 +1418,15 @@ fs_visitor::visit(ir_texture *ir) /* Should be lowered by do_lower_texture_projection */ assert(!ir->projector); - for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { - emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); - coordinate.reg_offset++; - } - /* Writemasking doesn't eliminate channels on SIMD8 texture * samples, so don't worry about them. */ fs_reg dst = fs_reg(this, glsl_type::vec4_type); if (intel->gen < 5) { - inst = emit_texture_gen4(ir, dst, base_mrf); + inst = emit_texture_gen4(ir, dst, coordinate); } else { - inst = emit_texture_gen5(ir, dst, base_mrf); + inst = emit_texture_gen5(ir, dst, coordinate); } inst->sampler = @@ -1919,6 +1984,7 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) { int msg_type = -1; int rlen = 4; + uint32_t simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8; if (intel->gen == 5) { switch (inst->opcode) { @@ -1943,24 +2009,32 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) /* Note that G45 and older determines shadow compare and dispatch width * from message length for most messages. */ + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; if (inst->shadow_compare) { - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; + assert(inst->mlen == 5); } else { - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + assert(inst->mlen <= 6); } + break; case FS_OPCODE_TXB: if (inst->shadow_compare) { - assert(!"FINISHME: shadow compare with bias."); - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + assert(inst->mlen == 5); + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; } else { + assert(inst->mlen == 8); msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; - rlen = 8; + simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16; } break; } } assert(msg_type != -1); + if (simd_mode == BRW_SAMPLER_SIMD_MODE_SIMD16) { + rlen = 8; + dst = vec16(dst); + } + /* g0 header. */ src.nr--; @@ -1976,7 +2050,7 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) inst->mlen + 1, 0, 1, - BRW_SAMPLER_SIMD_MODE_SIMD8); + simd_mode); } -- cgit v1.2.3 From e9bcc8328968f05a5688a020bfa8165260865a9b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 14:09:00 -0700 Subject: i965: Fix up copy'n'pasteo from moving coordinate setup around for gen4. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 99f50b91e15..4c8aafb2548 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1238,7 +1238,6 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate) emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); coordinate.reg_offset++; - mlen++; } /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ mlen = 3; @@ -1365,7 +1364,6 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate) for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); coordinate.reg_offset++; - mlen++; } if (ir->shadow_comparitor) { -- cgit v1.2.3 From 96efa8a923846f52f8a4d4667eab369457739f1e Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Fri, 1 Oct 2010 13:39:20 -0700 Subject: i965g: use Elements macro instead of manual sizeofs Signed-off-by: Nicolas Kaiser Signed-off-by: Brian Paul --- src/gallium/drivers/i965/intel_decode.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i965/intel_decode.c b/src/gallium/drivers/i965/intel_decode.c index bd8b9174a89..36c04a31655 100644 --- a/src/gallium/drivers/i965/intel_decode.c +++ b/src/gallium/drivers/i965/intel_decode.c @@ -40,6 +40,7 @@ #include #include +#include "util/u_memory.h" #include "util/u_string.h" #include "intel_decode.h" @@ -116,8 +117,7 @@ decode_mi(const uint32_t *data, int count, uint32_t hw_offset, int *failures) }; - for (opcode = 0; opcode < sizeof(opcodes_mi) / sizeof(opcodes_mi[0]); - opcode++) { + for (opcode = 0; opcode < Elements(opcodes_mi); opcode++) { if ((data[0] & 0x1f800000) >> 23 == opcodes_mi[opcode].opcode) { unsigned int len = 1, i; @@ -275,8 +275,7 @@ decode_2d(const uint32_t *data, int count, uint32_t hw_offset, int *failures) return len; } - for (opcode = 0; opcode < sizeof(opcodes_2d) / sizeof(opcodes_2d[0]); - opcode++) { + for (opcode = 0; opcode < Elements(opcodes_2d); opcode++) { if ((data[0] & 0x1fc00000) >> 22 == opcodes_2d[opcode].opcode) { unsigned int i; @@ -1037,9 +1036,7 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures, return len; } - for (opcode = 0; opcode < sizeof(opcodes_3d_1d) / sizeof(opcodes_3d_1d[0]); - opcode++) - { + for (opcode = 0; opcode < Elements(opcodes_3d_1d); opcode++) { if (opcodes_3d_1d[opcode].i830_only && !i830) continue; @@ -1291,8 +1288,7 @@ decode_3d(const uint32_t *data, int count, uint32_t hw_offset, int *failures) return decode_3d_1c(data, count, hw_offset, failures); } - for (opcode = 0; opcode < sizeof(opcodes_3d) / sizeof(opcodes_3d[0]); - opcode++) { + for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) { if ((data[0] & 0x1f000000) >> 24 == opcodes_3d[opcode].opcode) { unsigned int len = 1, i; @@ -1637,8 +1633,7 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures return len; } - for (opcode = 0; opcode < sizeof(opcodes_3d) / sizeof(opcodes_3d[0]); - opcode++) { + for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) { if ((data[0] & 0xffff0000) >> 16 == opcodes_3d[opcode].opcode) { unsigned int i; len = 1; @@ -1705,8 +1700,7 @@ decode_3d_i830(const uint32_t *data, int count, uint32_t hw_offset, int *failure return decode_3d_1c(data, count, hw_offset, failures); } - for (opcode = 0; opcode < sizeof(opcodes_3d) / sizeof(opcodes_3d[0]); - opcode++) { + for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) { if ((data[0] & 0x1f000000) >> 24 == opcodes_3d[opcode].opcode) { unsigned int len = 1, i; -- cgit v1.2.3 From bb45ab0a96bd17bc4c575ef5460d5c65acd8768b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 20 Nov 2009 11:03:31 -0800 Subject: ARB_texture_rg: Add GLX protocol support --- src/glx/compsize.c | 1 + src/glx/glxextensions.c | 1 + src/glx/glxextensions.h | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/glx/compsize.c b/src/glx/compsize.c index ccb3a0e924e..f69ffaba316 100644 --- a/src/glx/compsize.c +++ b/src/glx/compsize.c @@ -66,6 +66,7 @@ __glElementsPerGroup(GLenum format, GLenum type) case GL_RGB: case GL_BGR: return 3; + case GL_RG: case GL_422_EXT: case GL_422_REV_EXT: case GL_422_AVERAGE_EXT: diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c index 23161ef49a1..3a0e64c46d1 100644 --- a/src/glx/glxextensions.c +++ b/src/glx/glxextensions.c @@ -165,6 +165,7 @@ static const struct extension_info known_gl_extensions[] = { { GL(ARB_texture_mirrored_repeat), VER(1,4), Y, N, N, N }, { GL(ARB_texture_non_power_of_two), VER(1,5), Y, N, N, N }, { GL(ARB_texture_rectangle), VER(0,0), Y, N, N, N }, + { GL(ARB_texture_rg), VER(0,0), Y, N, N, N }, { GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N }, { GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N }, { GL(ARB_vertex_program), VER(0,0), Y, N, N, N }, diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h index a11fe88ffc9..78776618338 100644 --- a/src/glx/glxextensions.h +++ b/src/glx/glxextensions.h @@ -93,6 +93,7 @@ enum GL_ARB_texture_mirrored_repeat_bit, GL_ARB_texture_non_power_of_two_bit, GL_ARB_texture_rectangle_bit, + GL_ARB_texture_rg_bit, GL_ARB_transpose_matrix_bit, GL_ARB_vertex_buffer_object_bit, GL_ARB_vertex_program_bit, -- cgit v1.2.3 From 3ebbc176f9200ac954d461758937e755220ac551 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Sep 2010 11:11:43 -0700 Subject: ARB_texture_rg: Correct some errors in RED / RG internal format handling Fixes several problems: The half-float, float, and integer internal formats depend on ARB_texture_rg and other extensions. RG_INTEGER is not a valid internal format. Generic compressed formats depend on ARB_texture_rg, not EXT_texture_compression_rgtc. Use GL_RED instead of GL_R. --- src/mesa/main/teximage.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 614f0014dab..28d370eb659 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -403,29 +403,54 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) if (ctx->Extensions.ARB_texture_rg) { switch (internalFormat) { - case GL_R8: - case GL_R16: case GL_R16F: + /* R16F depends on both ARB_half_float_pixel and ARB_texture_float. + */ + if (!ctx->Extensions.ARB_half_float_pixel) + break; + /* FALLTHROUGH */ case GL_R32F: + if (!ctx->Extensions.ARB_texture_float) + break; + return GL_RED; case GL_R8I: case GL_R8UI: case GL_R16I: case GL_R16UI: case GL_R32I: case GL_R32UI: - return GL_R; - case GL_RG: - case GL_RG_INTEGER: - case GL_RG8: - case GL_RG16: + if (!ctx->Extensions.EXT_texture_integer) + break; + /* FALLTHROUGH */ + case GL_R8: + case GL_R16: + case GL_RED: + case GL_COMPRESSED_RED: + return GL_RED; + case GL_RG16F: + /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float. + */ + if (!ctx->Extensions.ARB_half_float_pixel) + break; + /* FALLTHROUGH */ case GL_RG32F: + if (!ctx->Extensions.ARB_texture_float) + break; + return GL_RG; case GL_RG8I: case GL_RG8UI: case GL_RG16I: case GL_RG16UI: case GL_RG32I: case GL_RG32UI: + if (!ctx->Extensions.EXT_texture_integer) + break; + /* FALLTHROUGH */ + case GL_RG: + case GL_RG8: + case GL_RG16: + case GL_COMPRESSED_RG: return GL_RG; default: ; /* fallthrough */ @@ -463,11 +488,9 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) if (ctx->Extensions.EXT_texture_compression_rgtc) { switch (internalFormat) { - case GL_COMPRESSED_RED: case GL_COMPRESSED_RED_RGTC1_EXT: case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: return GL_RED; - case GL_COMPRESSED_RG: case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: return GL_RG; -- cgit v1.2.3 From cc6f13def53eb280b63427fbdeca197a09315062 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Sep 2010 11:17:27 -0700 Subject: ARB_texture_rg: Add GL_TEXTURE_{RED,GREEN}_SIZE query support --- src/mesa/main/texparam.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 187049c0701..58d785812ea 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -870,7 +870,17 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Border; break; case GL_TEXTURE_RED_SIZE: + if (img->_BaseFormat == GL_RED) { + *params = _mesa_get_format_bits(texFormat, pname); + break; + } + /* FALLTHROUGH */ case GL_TEXTURE_GREEN_SIZE: + if (img->_BaseFormat == GL_RG) { + *params = _mesa_get_format_bits(texFormat, pname); + break; + } + /* FALLTHROUGH */ case GL_TEXTURE_BLUE_SIZE: if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) *params = _mesa_get_format_bits(texFormat, pname); -- cgit v1.2.3 From cd5dea640144b45ba2e88c2451f1f01ee08c1c4a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Sep 2010 13:50:34 -0700 Subject: ARB_texture_rg: Add GL_RED as a valid GL_DEPTH_TEXTURE_MODE --- src/mesa/main/texparam.c | 3 ++- src/mesa/swrast/s_texfilter.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 58d785812ea..e96ace73403 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -351,7 +351,8 @@ set_tex_parameteri(GLcontext *ctx, if (ctx->Extensions.ARB_depth_texture && (params[0] == GL_LUMINANCE || params[0] == GL_INTENSITY || - params[0] == GL_ALPHA)) { + params[0] == GL_ALPHA || + (ctx->Extensions.ARB_texture_rg && params[0] == GL_RED))) { if (texObj->DepthMode != params[0]) { flush(ctx, texObj); texObj->DepthMode = params[0]; diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 1aa2bcaf74d..de694c31bf1 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -3051,6 +3051,9 @@ sample_depth_texture( GLcontext *ctx, case GL_ALPHA: ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result); break; + case GL_RED: + ASSIGN_4V(texel[i], result, 0.0F, 0.0F, 1.0F); + break; default: _mesa_problem(ctx, "Bad depth texture mode"); } -- cgit v1.2.3 From 214a33f6104511bc163fdb964161d264e67090d3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Sep 2010 13:58:28 -0700 Subject: ARB_texture_rg: Handle RED and RG the same as RGB for tex env --- src/mesa/main/texstate.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index dae173d1bde..30c978c1cdd 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -179,6 +179,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, break; case GL_LUMINANCE: + case GL_RED: + case GL_RG: case GL_RGB: case GL_YCBCR_MESA: case GL_DUDV_ATI: @@ -219,6 +221,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, case GL_INTENSITY: state->SourceRGB[0] = GL_PREVIOUS; break; + case GL_RED: + case GL_RG: case GL_RGB: case GL_YCBCR_MESA: case GL_DUDV_ATI: @@ -244,6 +248,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, state->OperandA[2] = GL_SRC_ALPHA; /* FALLTHROUGH */ case GL_LUMINANCE: + case GL_RED: + case GL_RG: case GL_RGB: case GL_LUMINANCE_ALPHA: case GL_RGBA: -- cgit v1.2.3 From 5d1387b2da3626326410804026f8b92f1a121fdc Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Sep 2010 17:24:39 -0700 Subject: ARB_texture_rg: Add R8, R16, RG88, and RG1616 internal formats --- src/mesa/main/formats.c | 80 +++++++++++++++++++++ src/mesa/main/formats.h | 6 ++ src/mesa/main/image.c | 88 +++++++++++++++++++++++ src/mesa/main/readpix.c | 1 + src/mesa/main/texfetch.c | 42 +++++++++++ src/mesa/main/texfetch_tmp.h | 144 ++++++++++++++++++++++++++++++++++++++ src/mesa/main/texformat.c | 23 +++++++ src/mesa/main/texstore.c | 161 +++++++++++++++++++++++++++++++++++-------- 8 files changed, 515 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 9db9f1c56ea..a82aa9c6a0e 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -320,6 +320,60 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 2 /* BlockWidth/Height,Bytes */ }, + { + MESA_FORMAT_R8, + "MESA_FORMAT_R8", + GL_RED, + GL_UNSIGNED_NORMALIZED, + 8, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_RG88, + "MESA_FORMAT_RG88", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_RG88_REV, + "MESA_FORMAT_RG88_REV", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_R16, + "MESA_FORMAT_R16", + GL_RED, + GL_UNSIGNED_NORMALIZED, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_RG1616, + "MESA_FORMAT_RG1616", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG1616_REV, + "MESA_FORMAT_RG1616_REV", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, { MESA_FORMAT_Z24_S8, /* Name */ "MESA_FORMAT_Z24_S8", /* StrName */ @@ -1073,6 +1127,22 @@ _mesa_test_formats(void) assert(info->LuminanceBits == 0); assert(info->IntensityBits == 0); } + else if (info->BaseFormat == GL_RG) { + assert(info->RedBits > 0); + assert(info->GreenBits > 0); + assert(info->BlueBits == 0); + assert(info->AlphaBits == 0); + assert(info->LuminanceBits == 0); + assert(info->IntensityBits == 0); + } + else if (info->BaseFormat == GL_RED) { + assert(info->RedBits > 0); + assert(info->GreenBits == 0); + assert(info->BlueBits == 0); + assert(info->AlphaBits == 0); + assert(info->LuminanceBits == 0); + assert(info->IntensityBits == 0); + } else if (info->BaseFormat == GL_LUMINANCE) { assert(info->RedBits == 0); assert(info->GreenBits == 0); @@ -1137,16 +1207,25 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_AL88: case MESA_FORMAT_AL88_REV: + case MESA_FORMAT_RG88: + case MESA_FORMAT_RG88_REV: *datatype = GL_UNSIGNED_BYTE; *comps = 2; return; case MESA_FORMAT_AL1616: case MESA_FORMAT_AL1616_REV: + case MESA_FORMAT_RG1616: + case MESA_FORMAT_RG1616_REV: *datatype = GL_UNSIGNED_SHORT; *comps = 2; return; + case MESA_FORMAT_R16: + *datatype = GL_UNSIGNED_SHORT; + *comps = 1; + return; + case MESA_FORMAT_RGB332: *datatype = GL_UNSIGNED_BYTE_3_3_2; *comps = 3; @@ -1156,6 +1235,7 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_L8: case MESA_FORMAT_I8: case MESA_FORMAT_CI8: + case MESA_FORMAT_R8: *datatype = GL_UNSIGNED_BYTE; *comps = 1; return; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index e9467f486bf..7674d8eaa4e 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -76,6 +76,12 @@ typedef enum MESA_FORMAT_CI8, /* CCCC CCCC */ MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ + MESA_FORMAT_R8, /* RRRR RRRR */ + MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_RG88_REV, /* GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */ + MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_RG1616_REV, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 029d2fef8a6..1992c7448b3 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -286,6 +286,7 @@ _mesa_components_in_format( GLenum format ) return 1; case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA_INTEGER_EXT: + case GL_RG: return 2; case GL_RGB: case GL_RGB_INTEGER_EXT: @@ -428,6 +429,24 @@ _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ) case GL_LUMINANCE: case GL_LUMINANCE_ALPHA: case GL_DEPTH_COMPONENT: + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } + case GL_RG: + if (!ctx->Extensions.ARB_texture_rg) + return GL_FALSE; + switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: @@ -596,6 +615,11 @@ _mesa_is_color_format(GLenum format) case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: + case GL_R8: + case GL_R16: + case GL_RG: + case GL_RG8: + case GL_RG16: case 3: case GL_RGB: case GL_BGR: @@ -626,6 +650,10 @@ _mesa_is_color_format(GLenum format) case GL_LUMINANCE_ALPHA32F_ARB: case GL_INTENSITY16F_ARB: case GL_INTENSITY32F_ARB: + case GL_R16F: + case GL_R32F: + case GL_RG16F: + case GL_RG32F: case GL_RGB16F_ARB: case GL_RGB32F_ARB: case GL_RGBA16F_ARB: @@ -1585,6 +1613,25 @@ _mesa_lookup_rgba_float(const struct gl_color_table *table, rgba[i][ACOMP] = alpha;; } break; + case GL_RED: + /* replace RGB with RGB */ + for (i = 0; i < n; i++) { + GLint jR = IROUND(rgba[i][RCOMP] * scale); + jR = CLAMP(jR, 0, max); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + } + break; + case GL_RG: + /* replace RG with RG */ + for (i = 0; i < n; i++) { + GLint jR = IROUND(rgba[i][RCOMP] * scale); + GLint jG = IROUND(rgba[i][GCOMP] * scale); + jR = CLAMP(jR, 0, max); + jG = CLAMP(jG, 0, max); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + } + break; case GL_RGB: /* replace RGB with RGB */ for (i = 0; i < n; i++) { @@ -3201,6 +3248,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], srcFormat == GL_LUMINANCE || srcFormat == GL_LUMINANCE_ALPHA || srcFormat == GL_INTENSITY || + srcFormat == GL_RG || srcFormat == GL_RGB || srcFormat == GL_BGR || srcFormat == GL_RGBA || @@ -3283,6 +3331,18 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], redIndex = greenIndex = blueIndex = alphaIndex = 0; stride = 1; break; + case GL_RG: + case GL_RG_INTEGER: + redIndex = 0; + greenIndex = 1; + blueIndex = -1; + alphaIndex = -1; + rComp = 0; + gComp = 1; + bComp = 2; + aComp = 3; + stride = 2; + break; case GL_RGB: case GL_RGB_INTEGER: redIndex = 0; @@ -3852,6 +3912,8 @@ _mesa_unpack_color_span_chan( GLcontext *ctx, dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || + dstFormat == GL_RED || + dstFormat == GL_RG || dstFormat == GL_RGB || dstFormat == GL_RGBA || dstFormat == GL_COLOR_INDEX); @@ -3863,6 +3925,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx, srcFormat == GL_LUMINANCE || srcFormat == GL_LUMINANCE_ALPHA || srcFormat == GL_INTENSITY || + srcFormat == GL_RG || srcFormat == GL_RGB || srcFormat == GL_BGR || srcFormat == GL_RGBA || @@ -4090,6 +4153,17 @@ _mesa_unpack_color_span_chan( GLcontext *ctx, dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstLuminanceIndex = -1; break; + case GL_RED: + dstRedIndex = 0; + dstGreenIndex = dstBlueIndex = -1; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RG: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = -1; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; case GL_RGB: dstRedIndex = 0; dstGreenIndex = 1; @@ -4188,6 +4262,8 @@ _mesa_unpack_color_span_float( GLcontext *ctx, dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || + dstFormat == GL_RED || + dstFormat == GL_RG || dstFormat == GL_RGB || dstFormat == GL_RGBA || dstFormat == GL_COLOR_INDEX); @@ -4199,6 +4275,7 @@ _mesa_unpack_color_span_float( GLcontext *ctx, srcFormat == GL_LUMINANCE || srcFormat == GL_LUMINANCE_ALPHA || srcFormat == GL_INTENSITY || + srcFormat == GL_RG || srcFormat == GL_RGB || srcFormat == GL_BGR || srcFormat == GL_RGBA || @@ -4315,6 +4392,17 @@ _mesa_unpack_color_span_float( GLcontext *ctx, dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstLuminanceIndex = -1; break; + case GL_RED: + dstRedIndex = 0; + dstGreenIndex = dstBlueIndex = -1; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RG: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = -1; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; case GL_RGB: dstRedIndex = 0; dstGreenIndex = 1; diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 93f2bd31cc6..bb3fb9eb662 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -66,6 +66,7 @@ _mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, /* additional checks */ switch (format) { + case GL_RG: case GL_RED: case GL_GREEN: case GL_BLUE: diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index c03bc71cd7a..aa3a6961b64 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -313,6 +313,48 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_ycbcr_rev, store_texel_ycbcr_rev }, + { + MESA_FORMAT_R8, + fetch_texel_1d_f_r8, + fetch_texel_2d_f_r8, + fetch_texel_3d_f_r8, + store_texel_r8, + }, + { + MESA_FORMAT_RG88, + fetch_texel_1d_f_rg88, + fetch_texel_2d_f_rg88, + fetch_texel_3d_f_rg88, + store_texel_rg88, + }, + { + MESA_FORMAT_RG88_REV, + fetch_texel_1d_f_rg88_rev, + fetch_texel_2d_f_rg88_rev, + fetch_texel_3d_f_rg88_rev, + store_texel_rg88_rev, + }, + { + MESA_FORMAT_R16, + fetch_texel_1d_f_r16, + fetch_texel_2d_f_r16, + fetch_texel_3d_f_r16, + store_texel_r16, + }, + { + MESA_FORMAT_RG1616, + fetch_texel_1d_f_rg1616, + fetch_texel_2d_f_rg1616, + fetch_texel_3d_f_rg1616, + store_texel_rg1616, + }, + { + MESA_FORMAT_RG1616_REV, + fetch_texel_1d_f_rg1616_rev, + fetch_texel_2d_f_rg1616_rev, + fetch_texel_3d_f_rg1616_rev, + store_texel_rg1616_rev, + }, { MESA_FORMAT_Z24_S8, fetch_texel_1d_f_z24_s8, diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index f943554370f..2f583ed5223 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -810,6 +810,54 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_RG88 **********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ +static void FETCH(f_rg88)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 ); + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + +#if DIM == 3 +static void store_texel_rg88(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_88(rgba[RCOMP], rgba[GCOMP]); +} +#endif + + +/* MESA_FORMAT_RG88_REV ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */ +static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 ); + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + +#if DIM == 3 +static void store_texel_rg88_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_88(rgba[GCOMP], rgba[RCOMP]); +} +#endif + + /* MESA_FORMAT_AL88 **********************************************************/ /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ @@ -834,6 +882,54 @@ static void store_texel_al88(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_R8 ************************************************************/ + +/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ +static void FETCH(f_r8)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + texel[RCOMP] = UBYTE_TO_FLOAT(s); + texel[GCOMP] = 0.0; + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + +#if DIM == 3 +static void store_texel_r8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_R16 ***********************************************************/ + +/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */ +static void FETCH(f_r16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + texel[RCOMP] = USHORT_TO_FLOAT(s); + texel[GCOMP] = 0.0; + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + +#if DIM == 3 +static void store_texel_r16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + /* MESA_FORMAT_AL88_REV ******************************************************/ /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ @@ -858,6 +954,54 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_RG1616 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */ +static void FETCH(f_rg1616)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = USHORT_TO_FLOAT( s & 0xffff ); + texel[GCOMP] = USHORT_TO_FLOAT( s >> 16 ); + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + +#if DIM == 3 +static void store_texel_rg1616(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[GCOMP]); +} +#endif + + +/* MESA_FORMAT_RG1616_REV ****************************************************/ + +/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */ +static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = USHORT_TO_FLOAT( s >> 16 ); + texel[GCOMP] = USHORT_TO_FLOAT( s & 0xffff ); + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + +#if DIM == 3 +static void store_texel_rg1616_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_1616(rgba[GCOMP], rgba[RCOMP]); +} +#endif + + /* MESA_FORMAT_AL1616 ********************************************************/ /* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */ diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index b9271ef58ef..24efb108bb6 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -429,6 +429,29 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, } } + if (ctx->Extensions.ARB_texture_rg) { + switch (internalFormat) { + case GL_R8: + case GL_RED: + case GL_COMPRESSED_RED: + return MESA_FORMAT_R8; + + case GL_R16: + return MESA_FORMAT_R16; + + case GL_RG: + case GL_RG8: + case GL_COMPRESSED_RG: + return MESA_FORMAT_RG88; + + case GL_RG16: + return MESA_FORMAT_RG1616; + + default: + ; /* fallthrough */ + } + } + _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); return MESA_FORMAT_NONE; } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a1574e6cd83..5ca36d955e2 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -99,6 +99,7 @@ can_swizzle(GLenum logicalBaseFormat) case GL_BGR: case GL_BGRA: case GL_ABGR_EXT: + case GL_RG: return GL_TRUE; default: return GL_FALSE; @@ -120,6 +121,7 @@ enum { IDX_BGR, IDX_BGRA, IDX_ABGR, + IDX_RG, MAX_IDX }; @@ -207,6 +209,12 @@ static const struct { MAP4(3,2,1,0), MAP4(3,2,1,0) }, + + { + IDX_RG, + MAP4(0, 1, ZERO, ONE), + MAP2(0, 1) + }, }; @@ -230,6 +238,7 @@ get_map_idx(GLenum value) case GL_BGR: return IDX_BGR; case GL_BGRA: return IDX_BGRA; case GL_ABGR_EXT: return IDX_ABGR; + case GL_RG: return IDX_RG; default: _mesa_problem(NULL, "Unexpected inFormat"); return 0; @@ -319,6 +328,8 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, ASSERT(logicalBaseFormat == GL_RGBA || logicalBaseFormat == GL_RGB || + logicalBaseFormat == GL_RG || + logicalBaseFormat == GL_RED || logicalBaseFormat == GL_LUMINANCE_ALPHA || logicalBaseFormat == GL_LUMINANCE || logicalBaseFormat == GL_ALPHA || @@ -328,6 +339,8 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, ASSERT(textureBaseFormat == GL_RGBA || textureBaseFormat == GL_RGB || + textureBaseFormat == GL_RG || + textureBaseFormat == GL_RED || textureBaseFormat == GL_LUMINANCE_ALPHA || textureBaseFormat == GL_LUMINANCE || textureBaseFormat == GL_ALPHA || @@ -445,6 +458,8 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, ASSERT(logicalBaseFormat == GL_RGBA || logicalBaseFormat == GL_RGB || + logicalBaseFormat == GL_RG || + logicalBaseFormat == GL_RED || logicalBaseFormat == GL_LUMINANCE_ALPHA || logicalBaseFormat == GL_LUMINANCE || logicalBaseFormat == GL_ALPHA || @@ -452,6 +467,8 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, ASSERT(textureBaseFormat == GL_RGBA || textureBaseFormat == GL_RGB || + textureBaseFormat == GL_RG || + textureBaseFormat == GL_RED || textureBaseFormat == GL_LUMINANCE_ALPHA || textureBaseFormat == GL_LUMINANCE || textureBaseFormat == GL_ALPHA || @@ -1907,21 +1924,22 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) static GLboolean -_mesa_texstore_al88(TEXSTORE_PARAMS) +_mesa_texstore_unorm88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_AL88 || - dstFormat == MESA_FORMAT_AL88_REV); + dstFormat == MESA_FORMAT_AL88_REV || + dstFormat == MESA_FORMAT_RG88 || + dstFormat == MESA_FORMAT_RG88_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_AL88 && - baseInternalFormat == GL_LUMINANCE_ALPHA && - srcFormat == GL_LUMINANCE_ALPHA && + (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_RG88) && + baseInternalFormat == srcFormat && srcType == GL_UNSIGNED_BYTE && littleEndian) { /* simple memcpy path */ @@ -1942,14 +1960,27 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == MESA_FORMAT_AL88) || - (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) { - dstmap[0] = 0; - dstmap[1] = 3; + if (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_AL88_REV) { + if ((littleEndian && dstFormat == MESA_FORMAT_AL88) || + (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) { + dstmap[0] = 0; + dstmap[1] = 3; + } + else { + dstmap[0] = 3; + dstmap[1] = 0; + } } else { - dstmap[0] = 3; - dstmap[1] = 0; + if ((littleEndian && dstFormat == MESA_FORMAT_RG88) || + (!littleEndian && dstFormat == MESA_FORMAT_RG88_REV)) { + dstmap[0] = 0; + dstmap[1] = 1; + } + else { + dstmap[0] = 1; + dstmap[1] = 0; + } } dstmap[2] = ZERO; /* ? */ dstmap[3] = ONE; /* ? */ @@ -1983,7 +2014,8 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == MESA_FORMAT_AL88) { + if (dstFormat == MESA_FORMAT_AL88 || + dstFormat == MESA_FORMAT_RG88) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]), @@ -2009,21 +2041,22 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) static GLboolean -_mesa_texstore_al1616(TEXSTORE_PARAMS) +_mesa_texstore_unorm1616(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_AL1616 || - dstFormat == MESA_FORMAT_AL1616_REV); + dstFormat == MESA_FORMAT_AL1616_REV || + dstFormat == MESA_FORMAT_RG1616 || + dstFormat == MESA_FORMAT_RG1616_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_AL1616 && - baseInternalFormat == GL_LUMINANCE_ALPHA && - srcFormat == GL_LUMINANCE_ALPHA && + (dstFormat == MESA_FORMAT_AL1616 || dstFormat == MESA_FORMAT_RG1616) && + baseInternalFormat == srcFormat && srcType == GL_UNSIGNED_SHORT && littleEndian) { /* simple memcpy path */ @@ -2053,7 +2086,8 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == MESA_FORMAT_AL1616) { + if (dstFormat == MESA_FORMAT_AL1616 || + dstFormat == MESA_FORMAT_RG1616) { for (col = 0; col < srcWidth; col++) { GLushort l, a; @@ -2082,6 +2116,66 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) } +static GLboolean +_mesa_texstore_r16(TEXSTORE_PARAMS) +{ + const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_R16); + ASSERT(texelBytes == 2); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == MESA_FORMAT_R16 && + baseInternalFormat == GL_RED && + srcFormat == GL_RED && + srcType == GL_UNSIGNED_SHORT && + littleEndian) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + for (col = 0; col < srcWidth; col++) { + GLushort r; + + UNCLAMPED_FLOAT_TO_USHORT(r, src[0]); + dstUS[col] = r; + src += 1; + } + dstRow += dstRowStride; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + + static GLboolean _mesa_texstore_rgba_16(TEXSTORE_PARAMS) { @@ -2278,7 +2372,8 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) ASSERT(dstFormat == MESA_FORMAT_A8 || dstFormat == MESA_FORMAT_L8 || - dstFormat == MESA_FORMAT_I8); + dstFormat == MESA_FORMAT_I8 || + dstFormat == MESA_FORMAT_R8); ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && @@ -3604,13 +3699,13 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) /* reuse normal luminance/alpha texstore code */ newDstFormat = MESA_FORMAT_AL88; - k = _mesa_texstore_al88(ctx, dims, baseInternalFormat, - newDstFormat, dstAddr, - dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, - srcAddr, srcPacking); + k = _mesa_texstore_unorm88(ctx, dims, baseInternalFormat, + newDstFormat, dstAddr, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, + srcAddr, srcPacking); return k; } @@ -3654,10 +3749,10 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 }, { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 }, { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 }, - { MESA_FORMAT_AL88, _mesa_texstore_al88 }, - { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 }, - { MESA_FORMAT_AL1616, _mesa_texstore_al1616 }, - { MESA_FORMAT_AL1616_REV, _mesa_texstore_al1616 }, + { MESA_FORMAT_AL88, _mesa_texstore_unorm88 }, + { MESA_FORMAT_AL88_REV, _mesa_texstore_unorm88 }, + { MESA_FORMAT_AL1616, _mesa_texstore_unorm1616 }, + { MESA_FORMAT_AL1616_REV, _mesa_texstore_unorm1616 }, { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 }, { MESA_FORMAT_A8, _mesa_texstore_a8 }, { MESA_FORMAT_L8, _mesa_texstore_a8 }, @@ -3665,6 +3760,12 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_CI8, _mesa_texstore_ci8 }, { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr }, { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr }, + { MESA_FORMAT_R8, _mesa_texstore_a8 }, + { MESA_FORMAT_RG88, _mesa_texstore_unorm88 }, + { MESA_FORMAT_RG88_REV, _mesa_texstore_unorm88 }, + { MESA_FORMAT_R16, _mesa_texstore_r16 }, + { MESA_FORMAT_RG1616, _mesa_texstore_unorm1616 }, + { MESA_FORMAT_RG1616_REV, _mesa_texstore_unorm1616 }, { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, { MESA_FORMAT_Z16, _mesa_texstore_z16 }, -- cgit v1.2.3 From 421f4d8dc1e324067534719fc096e82fd9ef3017 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 30 Sep 2010 16:30:09 -0700 Subject: ARB_texture_rg: Allow RED and RG textures as FBO color buffer attachments --- src/mesa/main/fbobject.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 5201f502527..f28846c4c99 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -451,7 +451,11 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (baseFormat != GL_RGB && baseFormat != GL_RGBA && (!ctx->Extensions.ARB_framebuffer_object || - baseFormat != GL_ALPHA)) { + baseFormat != GL_ALPHA) && + (!ctx->Extensions.ARB_texture_rg || + baseFormat != GL_RED) && + (!ctx->Extensions.ARB_texture_rg || + baseFormat != GL_RG)) { att_incomplete("bad format"); att->Complete = GL_FALSE; return; @@ -631,7 +635,9 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) numImages++; if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT && f != GL_DEPTH_STENCIL_EXT - && (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA)) { + && (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA) + && (!ctx->Extensions.ARB_texture_rg || f != GL_RED) + && (!ctx->Extensions.ARB_texture_rg || f != GL_RG)) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; fbo_incomplete("texture attachment incomplete", -1); return; -- cgit v1.2.3 From 9ef390dc14edd0adc0fa0d07c64621b0f220edd8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 30 Sep 2010 16:29:46 -0700 Subject: mesa: Enable GL_ARB_texture_rg in software paths --- src/mesa/main/extensions.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 9b723ef74bd..e7116d789e8 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -270,6 +270,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/ ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; + ctx->Extensions.ARB_texture_rg = GL_TRUE; ctx->Extensions.ARB_vertex_array_object = GL_TRUE; #if FEATURE_ARB_vertex_program ctx->Extensions.ARB_vertex_program = GL_TRUE; -- cgit v1.2.3 From c77cd9ec10f7c6ad2927740e15900591d1ff388a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 20 Nov 2009 10:45:36 -0800 Subject: i965: Enable GL_ARB_texture_rg --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 24 +++++++++++++ src/mesa/drivers/dri/intel/intel_extensions.c | 1 + src/mesa/drivers/dri/intel/intel_fbo.c | 46 ++++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_tex_format.c | 20 +++++++++++ 4 files changed, 91 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 05f1aa18137..37104f1f238 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -89,6 +89,18 @@ static GLuint translate_tex_format( gl_format mesa_format, case MESA_FORMAT_AL1616: return BRW_SURFACEFORMAT_L16A16_UNORM; + case MESA_FORMAT_R8: + return BRW_SURFACEFORMAT_R8_UNORM; + + case MESA_FORMAT_R16: + return BRW_SURFACEFORMAT_R16_UNORM; + + case MESA_FORMAT_RG88: + return BRW_SURFACEFORMAT_R8G8_UNORM; + + case MESA_FORMAT_RG1616: + return BRW_SURFACEFORMAT_R16G16_UNORM; + case MESA_FORMAT_RGB888: assert(0); /* not supported for sampling */ return BRW_SURFACEFORMAT_R8G8B8_UNORM; @@ -444,6 +456,18 @@ brw_update_renderbuffer_surface(struct brw_context *brw, case MESA_FORMAT_A8: key.surface_format = BRW_SURFACEFORMAT_A8_UNORM; break; + case MESA_FORMAT_R8: + key.surface_format = BRW_SURFACEFORMAT_R8_UNORM; + break; + case MESA_FORMAT_R16: + key.surface_format = BRW_SURFACEFORMAT_R16_UNORM; + break; + case MESA_FORMAT_RG88: + key.surface_format = BRW_SURFACEFORMAT_R8G8_UNORM; + break; + case MESA_FORMAT_RG1616: + key.surface_format = BRW_SURFACEFORMAT_R16G16_UNORM; + break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format); } diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index d741f827678..b1b29d85266 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -166,6 +166,7 @@ static const struct dri_extension brw_extensions[] = { { "GL_ARB_shadow", NULL }, { "GL_MESA_texture_signed_rgba", NULL }, { "GL_ARB_texture_non_power_of_two", NULL }, + { "GL_ARB_texture_rg", NULL }, { "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions }, { "GL_EXT_shadow_funcs", NULL }, { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 8c0491d59aa..a70c83b39da 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -107,6 +107,24 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, ASSERT(rb->Name != 0); switch (internalFormat) { + case GL_RED: + case GL_R8: + rb->Format = MESA_FORMAT_R8; + rb->DataType = GL_UNSIGNED_BYTE; + break; + case GL_R16: + rb->Format = MESA_FORMAT_R16; + rb->DataType = GL_UNSIGNED_SHORT; + break; + case GL_RG: + case GL_RG8: + rb->Format = MESA_FORMAT_RG88; + rb->DataType = GL_UNSIGNED_BYTE; + break; + case GL_RG16: + rb->Format = MESA_FORMAT_RG1616; + rb->DataType = GL_UNSIGNED_SHORT; + break; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: @@ -346,6 +364,14 @@ intel_create_renderbuffer(gl_format format) irb->Base._BaseFormat = GL_ALPHA; irb->Base.DataType = GL_UNSIGNED_BYTE; break; + case MESA_FORMAT_R8: + irb->Base._BaseFormat = GL_RED; + irb->Base.DataType = GL_UNSIGNED_BYTE; + break; + case MESA_FORMAT_RG88: + irb->Base._BaseFormat = GL_RG; + irb->Base.DataType = GL_UNSIGNED_BYTE; + break; default: _mesa_problem(NULL, "Unexpected intFormat in intel_create_renderbuffer"); @@ -459,6 +485,22 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to A8 texture OK\n"); } + else if (texImage->TexFormat == MESA_FORMAT_R8) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to R8 texture OK\n"); + } + else if (texImage->TexFormat == MESA_FORMAT_RG88) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to RG88 texture OK\n"); + } + else if (texImage->TexFormat == MESA_FORMAT_R16) { + irb->Base.DataType = GL_UNSIGNED_SHORT; + DBG("Render to R8 texture OK\n"); + } + else if (texImage->TexFormat == MESA_FORMAT_RG1616) { + irb->Base.DataType = GL_UNSIGNED_SHORT; + DBG("Render to RG88 texture OK\n"); + } else if (texImage->TexFormat == MESA_FORMAT_Z16) { irb->Base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); @@ -673,6 +715,10 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) case MESA_FORMAT_ARGB1555: case MESA_FORMAT_ARGB4444: case MESA_FORMAT_A8: + case MESA_FORMAT_R8: + case MESA_FORMAT_R16: + case MESA_FORMAT_RG88: + case MESA_FORMAT_RG1616: break; default: fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index e03b203fb40..97b26efcb7c 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -93,6 +93,10 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: + /* i915 could implement this mode using MT_32BIT_RG1616. However, this + * would require an extra swizzle instruction in the fragment shader to + * convert the { R, G, 1.0, 1.0 } to { R, R, R, G }. + */ #ifndef I915 return MESA_FORMAT_AL1616; #else @@ -193,6 +197,22 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_RGBA_SNORM: case GL_RGBA8_SNORM: return MESA_FORMAT_SIGNED_RGBA8888_REV; + + /* i915 can do a RG16, but it can't do any of the other RED or RG formats. + * In addition, it only implements the broken D3D mode where undefined + * components are read as 1.0. I'm not sure who thought reading + * { R, G, 1.0, 1.0 } from a red-green texture would be useful. + */ + case GL_RED: + case GL_R8: + return MESA_FORMAT_R8; + case GL_R16: + return MESA_FORMAT_R16; + case GL_RG: + case GL_RG8: + return MESA_FORMAT_RG88; + case GL_RG16: + return MESA_FORMAT_RG1616; #endif default: -- cgit v1.2.3 From 841503fddf647bf7eaa715f3500c36389bca2c80 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 1 Oct 2010 16:27:58 -0700 Subject: glsl: Remove unnecessary header. --- src/glsl/lower_texture_projection.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/glsl/lower_texture_projection.cpp b/src/glsl/lower_texture_projection.cpp index f82ca0a9fd9..1fd26a7a2b5 100644 --- a/src/glsl/lower_texture_projection.cpp +++ b/src/glsl/lower_texture_projection.cpp @@ -36,7 +36,6 @@ */ #include "ir.h" -#include "ir_rvalue_visitor.h" class lower_texture_projection_visitor : public ir_hierarchical_visitor { public: -- cgit v1.2.3 From e5fd15199dce4cb56e84edb5866167d4906d063f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 1 Oct 2010 16:57:19 -0700 Subject: savage: Remove unnecessary header. --- src/mesa/drivers/dri/savage/savage_xmesa.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index bbf2fd3a0ed..45c1e56fe00 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -26,7 +26,6 @@ #include #include "main/context.h" -#include "main/matrix.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/simple_list.h" -- cgit v1.2.3 From e2a054b70cb5dace40fc1426cbf936366dc72fb9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 1 Oct 2010 16:07:28 -0700 Subject: mesa: Add ARB_texture_compression_rgtc as an alias for EXT_texture_compression_rgtc Change the name in the extension tracking structure to ARB (from EXT). --- src/mesa/main/extensions.c | 3 ++- src/mesa/main/mtypes.h | 2 +- src/mesa/main/teximage.c | 10 +++++----- src/mesa/main/version.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index e7116d789e8..d845ecee840 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -82,6 +82,7 @@ static const struct { { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, { OFF, "GL_ARB_texture_buffer_object", F(ARB_texture_buffer_object) }, { ON, "GL_ARB_texture_compression", F(ARB_texture_compression) }, + { OFF, "GL_ARB_texture_compression_rgtc", F(ARB_texture_compression_rgtc) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) }, @@ -147,7 +148,7 @@ static const struct { { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, { OFF, "GL_EXT_texture_array", F(EXT_texture_array) }, { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, - { OFF, "GL_EXT_texture_compression_rgtc", F(EXT_texture_compression_rgtc) }, + { OFF, "GL_EXT_texture_compression_rgtc", F(ARB_texture_compression_rgtc) }, { OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) }, { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0a69bcc4e32..269968d6772 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2594,6 +2594,7 @@ struct gl_extensions GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_buffer_object; GLboolean ARB_texture_compression; + GLboolean ARB_texture_compression_rgtc; GLboolean ARB_texture_cube_map; GLboolean ARB_texture_env_combine; GLboolean ARB_texture_env_crossbar; @@ -2656,7 +2657,6 @@ struct gl_extensions GLboolean EXT_texture3D; GLboolean EXT_texture_array; GLboolean EXT_texture_compression_s3tc; - GLboolean EXT_texture_compression_rgtc; GLboolean EXT_texture_env_add; GLboolean EXT_texture_env_combine; GLboolean EXT_texture_env_dot3; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 28d370eb659..6c3f49f667b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -486,13 +486,13 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) } } - if (ctx->Extensions.EXT_texture_compression_rgtc) { + if (ctx->Extensions.ARB_texture_compression_rgtc) { switch (internalFormat) { - case GL_COMPRESSED_RED_RGTC1_EXT: - case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: + case GL_COMPRESSED_RED_RGTC1: + case GL_COMPRESSED_SIGNED_RED_RGTC1: return GL_RED; - case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: - case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: + case GL_COMPRESSED_RG_RGTC2: + case GL_COMPRESSED_SIGNED_RG_RGTC2: return GL_RG; default: ; /* fallthrough */ diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 5997ca00fdc..692e8733c60 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -92,6 +92,7 @@ compute_version(GLcontext *ctx) ctx->Extensions.ARB_map_buffer_range && ctx->Extensions.ARB_texture_float && ctx->Extensions.ARB_texture_rg && + ctx->Extensions.ARB_texture_compression_rgtc && ctx->Extensions.APPLE_vertex_array_object && ctx->Extensions.EXT_draw_buffers2 && ctx->Extensions.EXT_framebuffer_blit && @@ -101,7 +102,6 @@ compute_version(GLcontext *ctx) ctx->Extensions.EXT_packed_depth_stencil && ctx->Extensions.EXT_packed_float && ctx->Extensions.EXT_texture_array && - ctx->Extensions.EXT_texture_compression_rgtc && ctx->Extensions.EXT_texture_integer && ctx->Extensions.EXT_texture_shared_exponent && ctx->Extensions.EXT_transform_feedback && -- cgit v1.2.3 From 7c6147014a726eefb7a73c8520a0b48a57248a03 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 1 Oct 2010 16:21:12 -0700 Subject: ARB_texture_rg: Add GL_COMPRESSED_{RED,RG} cases in _mesa_is_color_format --- src/mesa/main/image.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 1992c7448b3..3951b6a207f 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -663,6 +663,8 @@ _mesa_is_color_format(GLenum format) case GL_COMPRESSED_LUMINANCE: case GL_COMPRESSED_LUMINANCE_ALPHA: case GL_COMPRESSED_INTENSITY: + case GL_COMPRESSED_RED: + case GL_COMPRESSED_RG: case GL_COMPRESSED_RGB: case GL_COMPRESSED_RGBA: case GL_RGB_S3TC: -- cgit v1.2.3 From 69c78bf2c21c239d6064847dd0628f3526d68f9b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 1 Oct 2010 16:23:06 -0700 Subject: mesa: Fix misplaced #endif If FEATURE_texture_s3tc is not defined, FXT1 formats would erroneously fall through to the MESA_FORMAT_RGBA_FLOAT32 case. --- src/mesa/main/formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index a82aa9c6a0e..654ea038a55 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -1338,12 +1338,12 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_SRGBA_DXT1: case MESA_FORMAT_SRGBA_DXT3: case MESA_FORMAT_SRGBA_DXT5: +#endif #endif /* XXX generate error instead? */ *datatype = GL_UNSIGNED_BYTE; *comps = 0; return; -#endif case MESA_FORMAT_RGBA_FLOAT32: *datatype = GL_FLOAT; -- cgit v1.2.3 From 5ebbabc5ccd03afe59299b8ce52ca862334fd252 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 1 Oct 2010 16:35:25 -0700 Subject: mesa: Trivial correction to comment --- src/mesa/main/texcompress_fxt1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 3d8996c2fdc..33f46d4c8bb 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -25,7 +25,7 @@ /** * \file texcompress_fxt1.c - * GL_EXT_texture_compression_fxt1 support. + * GL_3DFX_texture_compression_FXT1 support. */ -- cgit v1.2.3 From 1ca6cbec1b1168b55fecb264d4e75a26de2cccaf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 1 Oct 2010 16:40:14 -0700 Subject: rgtc: Detect RGTC formats as color formats and as compressed formats --- src/mesa/main/image.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 3951b6a207f..ce10b3b1f85 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -695,6 +695,10 @@ _mesa_is_color_format(GLenum format) case GL_COMPRESSED_SLUMINANCE_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: #endif /* FEATURE_EXT_texture_sRGB */ + case GL_COMPRESSED_RED_RGTC1: + case GL_COMPRESSED_SIGNED_RED_RGTC1: + case GL_COMPRESSED_RG_RGTC2: + case GL_COMPRESSED_SIGNED_RG_RGTC2: return GL_TRUE; /* signed texture formats */ case GL_RGBA_SNORM: @@ -887,6 +891,11 @@ _mesa_is_compressed_format(GLcontext *ctx, GLenum format) case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: return ctx->Extensions.TDFX_texture_compression_FXT1; + case GL_COMPRESSED_RED_RGTC1: + case GL_COMPRESSED_SIGNED_RED_RGTC1: + case GL_COMPRESSED_RG_RGTC2: + case GL_COMPRESSED_SIGNED_RG_RGTC2: + return ctx->Extensions.ARB_texture_compression_rgtc; default: return GL_FALSE; } -- cgit v1.2.3 From 20846a8ce102aa2bc6d3f1e907d490940c0d0a69 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 1 Oct 2010 17:00:43 -0700 Subject: r600g: Remove unused variable. Fixes this GCC warning. r600_shader.c: In function 'tgsi_split_literal_constant': r600_shader.c:818: warning: unused variable 'index' --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 41c01d4a7b3..5709426ea75 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -815,7 +815,7 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_ { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; struct r600_bc_alu alu; - int i, j, k, nliteral, r, index; + int i, j, k, nliteral, r; for (i = 0, nliteral = 0; i < inst->Instruction.NumSrcRegs; i++) { if (inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) { -- cgit v1.2.3 From 7af2a22d1f10fa1f556e0d0c55092184ff734c88 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 1 Oct 2010 17:06:33 -0700 Subject: r600g: Remove unnecessary headers. --- src/gallium/drivers/r600/r600_pipe.c | 2 -- src/gallium/drivers/r600/r600_state.c | 1 - 2 files changed, 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 1c23995123f..0589652f705 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -36,11 +36,9 @@ #include #include #include -#include #include #include "r600.h" #include "r600d.h" -#include "r700_sq.h" #include "r600_resource.h" #include "r600_shader.h" #include "r600_pipe.h" diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 8ed87180d56..2814ecc239a 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -41,7 +41,6 @@ #include #include "r600.h" #include "r600d.h" -#include "r700_sq.h" #include "r600_resource.h" #include "r600_shader.h" #include "r600_pipe.h" -- cgit v1.2.3 From fb0eed84cac3cdb45bd0b46047fc389b81a5b1df Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 1 Oct 2010 20:13:36 -0400 Subject: r600c: fix segfault in evergreen stencil code Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=30551 --- src/mesa/drivers/dri/r600/evergreen_chip.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index b591d5fa27c..770e7f91c6a 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -843,7 +843,7 @@ static void evergreenSetDepthTarget(context_t *context) { EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); struct radeon_renderbuffer *rrb; - unsigned int nPitchInPixel, height; + unsigned int nPitchInPixel, height, offtostencil; rrb = radeon_get_depthbuffer(&context->radeon); if (!rrb) @@ -889,6 +889,12 @@ static void evergreenSetDepthTarget(context_t *context) SETfield(evergreen->DB_Z_INFO.u32All, ARRAY_1D_TILED_THIN1, EG_DB_Z_INFO__ARRAY_MODE_shift, EG_DB_Z_INFO__ARRAY_MODE_mask); + + + offtostencil = ((height * rrb->pitch) + 255) & ~255; + evergreen->DB_STENCIL_WRITE_BASE.u32All = offtostencil >> 8; + evergreen->DB_STENCIL_READ_BASE.u32All = offtostencil >> 8; + } static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) @@ -896,7 +902,6 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); struct radeon_renderbuffer *rrb; - unsigned int zheight, zpitch, offtostencil; BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); @@ -951,16 +956,6 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) rrb = radeon_get_depthbuffer(&context->radeon); - if (context->radeon.radeonScreen->driScreen->dri2.enabled) - { - zheight = rrb->base.Height; - } - else - { - zheight = context->radeon.radeonScreen->driScreen->fbHeight; - } - zpitch = rrb->pitch; - if( (rrb != NULL) && (rrb->bo != NULL) ) { @@ -1032,10 +1027,9 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) //10 if((evergreen->DB_DEPTH_CONTROL.u32All & STENCIL_ENABLE_bit) > 0) { - offtostencil = ((zheight * zpitch + 255) >> 8) & 0xffffffff; BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, offtostencil); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, evergreen->DB_STENCIL_READ_BASE.u32All); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_READ_BASE.u32All, rrb->bo, evergreen->DB_STENCIL_READ_BASE.u32All, @@ -1043,7 +1037,7 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_WRITE_BASE, offtostencil); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_WRITE_BASE, evergreen->DB_STENCIL_WRITE_BASE.u32All); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_WRITE_BASE.u32All, rrb->bo, evergreen->DB_STENCIL_WRITE_BASE.u32All, -- cgit v1.2.3 From a0799725f52386cef911d3e104c5514a2811290b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 15:11:09 -0700 Subject: i965: Restore the forcing of aligned pairs for delta_xy on chips with PLN. By doing so using the register allocator now, we avoid wasting a register to make the alignment happen. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 55 ++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4c8aafb2548..50341ba3835 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1749,8 +1749,14 @@ fs_visitor::emit_interpolation_setup_gen4() fs_reg(brw_imm_v(0x11001100)))); this->current_annotation = "compute pixel deltas from v0"; - this->delta_x = fs_reg(this, glsl_type::float_type); - this->delta_y = fs_reg(this, glsl_type::float_type); + if (brw->has_pln) { + this->delta_x = fs_reg(this, glsl_type::vec2_type); + this->delta_y = this->delta_x; + this->delta_y.reg_offset++; + } else { + this->delta_x = fs_reg(this, glsl_type::float_type); + this->delta_y = fs_reg(this, glsl_type::float_type); + } emit(fs_inst(BRW_OPCODE_ADD, this->delta_x, this->pixel_x, @@ -2133,14 +2139,6 @@ fs_visitor::assign_curb_setup() c->prog_data.first_curbe_grf = c->key.nr_payload_regs; c->prog_data.curb_read_length = ALIGN(c->prog_data.nr_params, 8) / 8; - if (intel->gen == 5 && (c->prog_data.first_curbe_grf + - c->prog_data.curb_read_length) & 1) { - /* Align the start of the interpolation coefficients so that we can use - * the PLN instruction. - */ - c->prog_data.first_curbe_grf++; - } - /* Map the offsets in the UNIFORM file to fixed HW regs. */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -2263,6 +2261,7 @@ fs_visitor::assign_regs() int base_reg_count = BRW_MAX_GRF - this->first_non_payload_grf; int class_sizes[base_reg_count]; int class_count = 0; + int aligned_pair_class = -1; calculate_live_intervals(); @@ -2275,6 +2274,12 @@ fs_visitor::assign_regs() * time. */ class_sizes[class_count++] = 1; + if (brw->has_pln && intel->gen < 6) { + /* Always set up the (unaligned) pairs for gen5, so we can find + * them for making the aligned pair class. + */ + class_sizes[class_count++] = 2; + } for (int r = 1; r < this->virtual_grf_next; r++) { int i; @@ -2290,7 +2295,7 @@ fs_visitor::assign_regs() int ra_reg_count = 0; int class_base_reg[class_count]; int class_reg_count[class_count]; - int classes[class_count]; + int classes[class_count + 1]; for (int i = 0; i < class_count; i++) { class_base_reg[i] = ra_reg_count; @@ -2330,6 +2335,27 @@ fs_visitor::assign_regs() } } + /* Add a special class for aligned pairs, which we'll put delta_x/y + * in on gen5 so that we can do PLN. + */ + if (brw->has_pln && intel->gen < 6) { + int reg_count = (base_reg_count - 1) / 2; + int unaligned_pair_class = 1; + assert(class_sizes[unaligned_pair_class] == 2); + + aligned_pair_class = class_count; + classes[aligned_pair_class] = ra_alloc_reg_class(regs); + class_base_reg[aligned_pair_class] = 0; + class_reg_count[aligned_pair_class] = 0; + int start = (this->first_non_payload_grf & 1) ? 1 : 0; + + for (int i = 0; i < reg_count; i++) { + ra_class_add_reg(regs, classes[aligned_pair_class], + class_base_reg[unaligned_pair_class] + i * 2 + start); + } + class_count++; + } + ra_set_finalize(regs); struct ra_graph *g = ra_alloc_interference_graph(regs, @@ -2342,7 +2368,12 @@ fs_visitor::assign_regs() for (int i = 1; i < this->virtual_grf_next; i++) { for (int c = 0; c < class_count; c++) { if (class_sizes[c] == this->virtual_grf_sizes[i]) { - ra_set_node_class(g, i, classes[c]); + if (aligned_pair_class >= 0 && + this->delta_x.reg == i) { + ra_set_node_class(g, i, classes[aligned_pair_class]); + } else { + ra_set_node_class(g, i, classes[c]); + } break; } } -- cgit v1.2.3 From 5ee09413162f4ec83cc7a738e807ffde8c89cca7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 15:42:39 -0700 Subject: i965: When producing a single channel swizzle, don't make a temporary. This quickly cuts 8% of the instructions in my glsl demo. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 50341ba3835..b38df71a84a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1445,6 +1445,11 @@ fs_visitor::visit(ir_swizzle *ir) ir->val->accept(this); fs_reg val = this->result; + if (ir->type->vector_elements == 1) { + this->result.reg_offset += ir->mask.x; + return; + } + fs_reg result = fs_reg(this, ir->type); this->result = result; -- cgit v1.2.3 From afb64311e3484002e06aeac62187b68467610449 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 16:35:55 -0700 Subject: i965: Add a sanity check for register allocation sizes. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index b38df71a84a..ba6c048f38f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2293,6 +2293,11 @@ fs_visitor::assign_regs() break; } if (i == class_count) { + if (this->virtual_grf_sizes[r] >= base_reg_count) { + fprintf(stderr, "Object too large to register allocate.\n"); + this->fail = true; + } + class_sizes[class_count++] = this->virtual_grf_sizes[r]; } } -- cgit v1.2.3 From 6397addd6146661689a0e315b06e543ef12d8868 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 16:36:17 -0700 Subject: i965: Fix off-by-ones in handling the last members of register classes. Luckily, one of them would result in failing out register allocation when the other bugs were encountered. Applies to glsl-fs-vec4-indexing-temp-dst-in-nested-loop-combined, which still fails register allocation, but now legitimately. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ba6c048f38f..ddf96ca22dd 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2326,15 +2326,15 @@ fs_visitor::assign_regs() * that alias base regs, or the base regs themselves for classes[0]. */ for (int c = 0; c <= i; c++) { - for (int i_r = 0; i_r < class_reg_count[i] - 1; i_r++) { + for (int i_r = 0; i_r < class_reg_count[i]; i_r++) { for (int c_r = MAX2(0, i_r - (class_sizes[c] - 1)); - c_r <= MIN2(class_reg_count[c] - 1, i_r + class_sizes[i] - 1); + c_r < MIN2(class_reg_count[c], i_r + class_sizes[i]); c_r++) { if (0) { printf("%d/%d conflicts %d/%d\n", - class_sizes[i], i_r, - class_sizes[c], c_r); + class_sizes[i], this->first_non_payload_grf + i_r, + class_sizes[c], this->first_non_payload_grf + c_r); } ra_add_reg_conflict(regs, @@ -2413,7 +2413,7 @@ fs_visitor::assign_regs() for (int c = 0; c < class_count; c++) { if (reg >= class_base_reg[c] && - reg < class_base_reg[c] + class_reg_count[c] - 1) { + reg < class_base_reg[c] + class_reg_count[c]) { hw_reg = reg - class_base_reg[c]; break; } -- cgit v1.2.3 From 64a9fc3fc15603a8e25d0e1146fe5da5a5bde55b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 1 Oct 2010 17:18:07 -0700 Subject: i965: Don't try to emit code if we failed register allocation. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ddf96ca22dd..dd2af2bd1d3 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2808,7 +2808,8 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) v.assign_regs(); } - v.generate_code(); + if (!v.fail) + v.generate_code(); assert(!v.fail); /* FINISHME: Cleanly fail, tested at link time, etc. */ -- cgit v1.2.3 From f31771343259d195ba243ce8d307831e495d5a2c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 1 Oct 2010 19:53:24 -0700 Subject: i965: Fix incorrect batchbuffer size in gen6 clip state command. FORCE_ZERO_RTAINDEX should be in the fourth (and final) dword. --- src/mesa/drivers/dri/i965/gen6_clip_state.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c index 045d9c6f76e..e8bca83e3a0 100644 --- a/src/mesa/drivers/dri/i965/gen6_clip_state.c +++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c @@ -60,7 +60,6 @@ upload_clip_state(struct brw_context *brw) depth_clamp | provoking); OUT_BATCH(GEN6_CLIP_FORCE_ZERO_RTAINDEX); - OUT_BATCH(0); ADVANCE_BATCH(); intel_batchbuffer_emit_mi_flush(intel->batch); -- cgit v1.2.3 From 71a079fb4ecbd17703ac9b5e6d5ef622fd7bc50f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 11 Aug 2010 19:04:05 +1000 Subject: mesa/st: initial attempt at RG support for gallium drivers passes all piglit RG tests with softpipe. --- src/mesa/state_tracker/st_atom_texture.c | 10 ++++- src/mesa/state_tracker/st_cb_fbo.c | 12 ++++++ src/mesa/state_tracker/st_extensions.c | 6 +++ src/mesa/state_tracker/st_format.c | 66 ++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 981129621c7..029b0403462 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -52,7 +52,7 @@ * * \param format PIPE_FORMAT_*. * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. - * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA. + * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA, GL_RED. */ static GLuint apply_depthmode(enum pipe_format format, GLuint swizzle, GLenum depthmode) @@ -96,6 +96,14 @@ static GLuint apply_depthmode(enum pipe_format format, else if (swiz[i] < SWIZZLE_W) swiz[i] = SWIZZLE_ZERO; break; + case GL_RED: + /* Rewrite reads W to 1, XYZ to X00 */ + for (i = 0; i < 4; i++) + if (swiz[i] == SWIZZLE_W) + swiz[i] = SWIZZLE_ONE; + else if (swiz[i] == SWIZZLE_Y || swiz[i] == SWIZZLE_Z) + swiz[i] = SWIZZLE_ZERO; + break; } return MAKE_SWIZZLE4(swiz[0], swiz[1], swiz[2], swiz[3]); diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 71bd4729e03..ac1f6812b85 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -260,6 +260,18 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) case PIPE_FORMAT_R16G16B16A16_SNORM: strb->Base.InternalFormat = GL_RGBA16; break; + case PIPE_FORMAT_R8_UNORM: + strb->Base.InternalFormat = GL_R8; + break; + case PIPE_FORMAT_R8G8_UNORM: + strb->Base.InternalFormat = GL_RG8; + break; + case PIPE_FORMAT_R16_UNORM: + strb->Base.InternalFormat = GL_R16; + break; + case PIPE_FORMAT_R16G16_UNORM: + strb->Base.InternalFormat = GL_RG16; + break; default: _mesa_problem(NULL, "Unexpected format in st_new_renderbuffer_fb"); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 225f75e3af0..9b09601bbc5 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -373,6 +373,12 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_texture_sRGB = GL_TRUE; } + if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_SAMPLER_VIEW, 0)) { + ctx->Extensions.ARB_texture_rg = GL_TRUE; + } + /* s3tc support */ if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA, PIPE_TEXTURE_2D, 0, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 95064605d7f..b7c54cef841 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -202,6 +202,14 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) case MESA_FORMAT_SARGB8: return PIPE_FORMAT_B8G8R8A8_SRGB; #endif + case MESA_FORMAT_R8: + return PIPE_FORMAT_R8_UNORM; + case MESA_FORMAT_R16: + return PIPE_FORMAT_R16_UNORM; + case MESA_FORMAT_RG88: + return PIPE_FORMAT_R8G8_UNORM; + case MESA_FORMAT_RG1616: + return PIPE_FORMAT_R16G16_UNORM; default: assert(0); return PIPE_FORMAT_NONE; @@ -299,6 +307,15 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_B8G8R8A8_SRGB: return MESA_FORMAT_SARGB8; #endif + + case PIPE_FORMAT_R8_UNORM: + return MESA_FORMAT_R8; + case PIPE_FORMAT_R16_UNORM: + return MESA_FORMAT_R16; + case PIPE_FORMAT_R8G8_UNORM: + return MESA_FORMAT_RG88; + case PIPE_FORMAT_R16G16_UNORM: + return MESA_FORMAT_RG1616; default: assert(0); return MESA_FORMAT_NONE; @@ -688,6 +705,55 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, return default_srgba_format( screen, target, sample_count, bindings, geom_flags ); + case GL_RED: + case GL_R8: + if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_R8_UNORM; + return PIPE_FORMAT_NONE; + case GL_RG: + case GL_RG8: + if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_R8G8_UNORM; + return PIPE_FORMAT_NONE; + + case GL_R16: + if (screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_R16_UNORM; + return PIPE_FORMAT_NONE; + + case GL_RG16: + if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_R16G16_UNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_RED_RGTC1: + if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_RGTC1_UNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_SIGNED_RED_RGTC1: + if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_SNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_RGTC1_SNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_RG_RGTC2: + if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_RGTC2_UNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_SIGNED_RG_RGTC2: + if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_SNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_RGTC2_SNORM; + return PIPE_FORMAT_NONE; + default: return PIPE_FORMAT_NONE; } -- cgit v1.2.3 From e75bce026c33ba670fd3146076fc2a2cf00f4371 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 2 Oct 2010 21:42:22 +0200 Subject: r300g: add support for R8G8 colorbuffers The hw swizzles have been obtained by a brute force approach, and only C0 and C2 are stored in UV88, the other channels are ignored. R16G16 is going to be a lot trickier. --- src/gallium/drivers/r300/r300_texture.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 2d8431dbb80..a084bdff11c 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -369,6 +369,10 @@ static uint32_t r300_translate_colorformat(enum pipe_format format) return R300_COLOR_FORMAT_I8; /* 16-bit buffers. */ + case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_R8G8_SNORM: + return R300_COLOR_FORMAT_UV88; + case PIPE_FORMAT_B5G6R5_UNORM: return R300_COLOR_FORMAT_RGB565; @@ -488,7 +492,7 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) /* Add swizzles and return. */ switch (format) { - /* 8-bit outputs. + /* 8-bit outputs, one channel. * COLORFORMAT_I8 stores the C2 component. */ case PIPE_FORMAT_A8_UNORM: return modifier | R300_C2_SEL_A; @@ -498,6 +502,12 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) case PIPE_FORMAT_R8_SNORM: return modifier | R300_C2_SEL_R; + /* 16-bit outputs, two channels. + * COLORFORMAT_UV88 stores C2 and C0. */ + case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_R8G8_SNORM: + return modifier | R300_C0_SEL_G | R300_C2_SEL_R; + /* BGRA outputs. */ case PIPE_FORMAT_B5G6R5_UNORM: case PIPE_FORMAT_B5G5R5A1_UNORM: -- cgit v1.2.3 From 8f7177e0de06877ae717250ccaa3ac292340b7be Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 2 Oct 2010 23:13:12 +0200 Subject: r300g: add support for L8A8 colorbuffers Blending with DST_ALPHA is undefined. SRC_ALPHA works, though. I bet some other formats have similar limitations too. --- src/gallium/drivers/r300/r300_texture.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index a084bdff11c..cee56bccdcd 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -369,6 +369,7 @@ static uint32_t r300_translate_colorformat(enum pipe_format format) return R300_COLOR_FORMAT_I8; /* 16-bit buffers. */ + case PIPE_FORMAT_L8A8_UNORM: case PIPE_FORMAT_R8G8_UNORM: case PIPE_FORMAT_R8G8_SNORM: return R300_COLOR_FORMAT_UV88; @@ -504,6 +505,8 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) /* 16-bit outputs, two channels. * COLORFORMAT_UV88 stores C2 and C0. */ + case PIPE_FORMAT_L8A8_UNORM: + return modifier | R300_C0_SEL_A | R300_C2_SEL_R; case PIPE_FORMAT_R8G8_UNORM: case PIPE_FORMAT_R8G8_SNORM: return modifier | R300_C0_SEL_G | R300_C2_SEL_R; -- cgit v1.2.3 From 4fb0c92c6986cf4e88296bab8837320210f1794f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 2 Oct 2010 23:44:29 -0700 Subject: i965: Add support for EXT_texture_swizzle to the new FS backend. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index dd2af2bd1d3..5ebf9063df2 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1437,6 +1437,27 @@ fs_visitor::visit(ir_texture *ir) if (ir->shadow_comparitor) inst->shadow_compare = true; + + if (c->key.tex_swizzles[inst->sampler] != SWIZZLE_NOOP) { + fs_reg swizzle_dst = fs_reg(this, glsl_type::vec4_type); + + for (int i = 0; i < 4; i++) { + int swiz = GET_SWZ(c->key.tex_swizzles[inst->sampler], i); + fs_reg l = swizzle_dst; + l.reg_offset += i; + + if (swiz == SWIZZLE_ZERO) { + emit(fs_inst(BRW_OPCODE_MOV, l, fs_reg(0.0f))); + } else if (swiz == SWIZZLE_ONE) { + emit(fs_inst(BRW_OPCODE_MOV, l, fs_reg(1.0f))); + } else { + fs_reg r = dst; + r.reg_offset += GET_SWZ(c->key.tex_swizzles[inst->sampler], i); + emit(fs_inst(BRW_OPCODE_MOV, l, r)); + } + } + this->result = swizzle_dst; + } } void -- cgit v1.2.3 From a7fa00dfc5ab5782b2e497fbf4ca292dde69cdbd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 2 Oct 2010 23:27:31 -0700 Subject: i965: Set up swizzling of shadow compare results for GL_DEPTH_TEXTURE_MODE. The brw_wm_surface_state.c handling of GL_DEPTH_TEXTURE_MODE doesn't apply to shadow compares, which always return an intensity value. The texture swizzles can do the job for us. Fixes: glsl1-shadow2D(): 1 glsl1-shadow2D(): 3 --- src/mesa/drivers/dri/i965/brw_wm.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 9ca8e709f55..66106408c9e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -342,13 +342,44 @@ static void brw_wm_populate_key( struct brw_context *brw, if (unit->_ReallyEnabled) { const struct gl_texture_object *t = unit->_Current; const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; + + key->tex_swizzles[i] = SWIZZLE_NOOP; + + /* GL_DEPTH_TEXTURE_MODE is normally handled through + * brw_wm_surface_state, but it applies to shadow compares as + * well and our shadow compares always return the result in + * all 4 channels. + */ + if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { + if (t->DepthMode == GL_ALPHA) { + key->tex_swizzles[i] = + MAKE_SWIZZLE4(SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_X); + } else if (t->DepthMode == GL_LUMINANCE) { + key->tex_swizzles[i] = + MAKE_SWIZZLE4(SWIZZLE_X, + SWIZZLE_X, + SWIZZLE_X, + SWIZZLE_ONE); + } + } + if (img->InternalFormat == GL_YCBCR_MESA) { key->yuvtex_mask |= 1 << i; if (img->TexFormat == MESA_FORMAT_YCBCR) key->yuvtex_swap_mask |= 1 << i; } - key->tex_swizzles[i] = t->_Swizzle; + key->tex_swizzles[i] = MAKE_SWIZZLE4(GET_SWZ(key->tex_swizzles[i], + GET_SWZ(t->_Swizzle, 0)), + GET_SWZ(key->tex_swizzles[i], + GET_SWZ(t->_Swizzle, 1)), + GET_SWZ(key->tex_swizzles[i], + GET_SWZ(t->_Swizzle, 2)), + GET_SWZ(key->tex_swizzles[i], + GET_SWZ(t->_Swizzle, 3))); } else { key->tex_swizzles[i] = SWIZZLE_NOOP; -- cgit v1.2.3 From 14bf92ba19373d54e9909bbdda5e430e0affea37 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 3 Oct 2010 00:24:09 -0700 Subject: i965: Fix glean/texSwizzle regression in previous commit. Easy enough patch, who needs a full test run. Oh, that's right. Me. --- src/mesa/drivers/dri/i965/brw_wm.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 66106408c9e..2ea5967df12 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -342,6 +342,15 @@ static void brw_wm_populate_key( struct brw_context *brw, if (unit->_ReallyEnabled) { const struct gl_texture_object *t = unit->_Current; const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; + int swizzles[SWIZZLE_NIL + 1] = { + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + SWIZZLE_ZERO, + SWIZZLE_ONE, + SWIZZLE_NIL + }; key->tex_swizzles[i] = SWIZZLE_NOOP; @@ -352,17 +361,11 @@ static void brw_wm_populate_key( struct brw_context *brw, */ if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { if (t->DepthMode == GL_ALPHA) { - key->tex_swizzles[i] = - MAKE_SWIZZLE4(SWIZZLE_ZERO, - SWIZZLE_ZERO, - SWIZZLE_ZERO, - SWIZZLE_X); + swizzles[0] = SWIZZLE_ZERO; + swizzles[1] = SWIZZLE_ZERO; + swizzles[2] = SWIZZLE_ZERO; } else if (t->DepthMode == GL_LUMINANCE) { - key->tex_swizzles[i] = - MAKE_SWIZZLE4(SWIZZLE_X, - SWIZZLE_X, - SWIZZLE_X, - SWIZZLE_ONE); + swizzles[3] = SWIZZLE_ONE; } } @@ -372,14 +375,11 @@ static void brw_wm_populate_key( struct brw_context *brw, key->yuvtex_swap_mask |= 1 << i; } - key->tex_swizzles[i] = MAKE_SWIZZLE4(GET_SWZ(key->tex_swizzles[i], - GET_SWZ(t->_Swizzle, 0)), - GET_SWZ(key->tex_swizzles[i], - GET_SWZ(t->_Swizzle, 1)), - GET_SWZ(key->tex_swizzles[i], - GET_SWZ(t->_Swizzle, 2)), - GET_SWZ(key->tex_swizzles[i], - GET_SWZ(t->_Swizzle, 3))); + key->tex_swizzles[i] = + MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)], + swizzles[GET_SWZ(t->_Swizzle, 1)], + swizzles[GET_SWZ(t->_Swizzle, 2)], + swizzles[GET_SWZ(t->_Swizzle, 3)]); } else { key->tex_swizzles[i] = SWIZZLE_NOOP; -- cgit v1.2.3 From 92aba9c1f54b2681aed11f572f74bda941f19a54 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 4 Oct 2010 15:58:39 +1000 Subject: r600g: break out of search for reloc bo after finding it. this function was taking quite a lot of pointless CPU. --- src/gallium/winsys/r600/drm/r600_hw_context.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 2ca5a45e03d..c67c93541a3 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -715,6 +715,7 @@ void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo reloc_id = i * sizeof(struct r600_reloc) / 4; /* set PKT3 to point to proper reloc */ *pm4 = reloc_id; + break; } } if (reloc_id == -1) { -- cgit v1.2.3 From 6dc051557d99e81fc58e09edf21f185874dc1979 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 4 Oct 2010 16:24:59 +1000 Subject: r600g: the code to check whether a new vertex shader is needed was wrong this code was memcmp'ing two structs, but refcounting one of them afterwards, so any subsequent memcmp was never going to work. again this stops unnecessary uploads of vertex program, --- src/gallium/drivers/r600/r600_shader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 5709426ea75..21b91805824 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -245,7 +245,9 @@ static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader if (shader->processor_type != TGSI_PROCESSOR_VERTEX) return 0; - if (!memcmp(&rshader->vertex_elements, rctx->vertex_elements, sizeof(struct r600_vertex_element))) { + /* doing a full memcmp fell over the refcount */ + if ((rshader->vertex_elements.count == rctx->vertex_elements->count) && + (!memcmp(&rshader->vertex_elements.elements, &rctx->vertex_elements->elements, 32 * sizeof(struct pipe_vertex_element)))) { return 0; } rshader->vertex_elements = *rctx->vertex_elements; -- cgit v1.2.3 From 1c2b3cb1e933dc55af57310a567fa7c418dbee9c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 4 Oct 2010 16:26:46 +1000 Subject: r600g: fix wwarning in bo_map function --- src/gallium/winsys/r600/drm/r600_priv.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index f39778da624..fdca6f01e84 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -145,6 +145,7 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo) { bo->map_count++; + return 0; } static inline void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo) -- cgit v1.2.3 From 3d45d57044507506ca834a4bf983422549c5240a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 4 Oct 2010 16:41:49 +1000 Subject: r600g: TODO domain management no wonder it was slow, the code is deliberately forcing stuff into GTT, we used to have domain management but it seems to have disappeared. --- src/gallium/winsys/r600/drm/r600_hw_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index c67c93541a3..0a1b3a94190 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -725,8 +725,8 @@ void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo } reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4; ctx->reloc[ctx->creloc].handle = bo->handle; - ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT; - ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT; + ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM; + ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM; ctx->reloc[ctx->creloc].flags = 0; radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); ctx->creloc++; -- cgit v1.2.3 From 68c7994ab5d86cdbfcba75b7f6c3ad734b9fb6b0 Mon Sep 17 00:00:00 2001 From: Krzysztof Smiechowicz Date: Mon, 4 Oct 2010 11:43:29 -0700 Subject: nvfx: Pair os_malloc_aligned() with os_free_aligned(). From AROS. --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 23fdb0820a5..13e8beed479 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1558,7 +1558,7 @@ nvfx_fragprog_destroy(struct nvfx_context *nvfx, struct nvfx_fragment_program_bo* next = fpbo->next; nouveau_bo_unmap(fpbo->bo); nouveau_bo_ref(0, &fpbo->bo); - free(fpbo); + os_free_aligned(fpbo); fpbo = next; } while(fpbo != fp->fpbo); -- cgit v1.2.3 From 294c9fce1b924beddf198a3cce738b88eabb5537 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 4 Oct 2010 10:06:13 -0400 Subject: r600g: rename radeon_ws_bo to r600_bo Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 6 ++--- src/gallium/drivers/r600/r600.h | 24 +++++++++---------- src/gallium/drivers/r600/r600_buffer.c | 20 ++++++++-------- src/gallium/drivers/r600/r600_pipe.h | 2 +- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_shader.c | 8 +++---- src/gallium/drivers/r600/r600_state.c | 6 ++--- src/gallium/drivers/r600/r600_texture.c | 16 ++++++------- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 28 +++++++++++----------- src/gallium/winsys/r600/drm/r600_hw_context.c | 26 ++++++++++---------- src/gallium/winsys/r600/drm/r600_priv.h | 8 +++---- src/gallium/winsys/r600/drm/radeon_ws_bo.c | 26 ++++++++++---------- 12 files changed, 86 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 70799f6378e..6fcb2ae6f32 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -406,7 +406,7 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4]; - struct radeon_ws_bo *bo[2]; + struct r600_bo *bo[2]; if (resource == NULL) return NULL; @@ -539,7 +539,7 @@ static void evergreen_delete_state(struct pipe_context *ctx, void *state) rctx->states[rstate->id] = NULL; } for (int i = 0; i < rstate->nregs; i++) { - radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); + r600_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); } free(rstate); } @@ -738,7 +738,7 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state unsigned color_info; unsigned format, swap, ntype; const struct util_format_description *desc; - struct radeon_ws_bo *bo[3]; + struct r600_bo *bo[3]; rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; rbuffer = &rtex->resource; diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index f0b74ad8740..dd3c4e30065 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -103,15 +103,15 @@ enum radeon_family r600_get_family(struct radeon *rw); enum chip_class r600_get_family_class(struct radeon *radeon); /* lowlevel WS bo */ -struct radeon_ws_bo; -struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon, +struct r600_bo; +struct r600_bo *r600_bo(struct radeon *radeon, unsigned size, unsigned alignment, unsigned usage); -struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon, +struct r600_bo *r600_bo_handle(struct radeon *radeon, unsigned handle); -void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx); -void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo); -void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, - struct radeon_ws_bo *src); +void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx); +void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo); +void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, + struct r600_bo *src); /* R600/R700 STATES */ #define R600_GROUP_MAX 16 @@ -122,7 +122,7 @@ struct r600_pipe_reg { u32 offset; u32 mask; u32 value; - struct radeon_ws_bo *bo; + struct r600_bo *bo; }; struct r600_pipe_state { @@ -133,7 +133,7 @@ struct r600_pipe_state { static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state, u32 offset, u32 value, u32 mask, - struct radeon_ws_bo *bo) + struct r600_bo *bo) { state->regs[state->nregs].offset = offset; state->regs[state->nregs].value = value; @@ -147,7 +147,7 @@ static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state, #define R600_BLOCK_STATUS_DIRTY (1 << 1) struct r600_block_reloc { - struct radeon_ws_bo *bo; + struct r600_bo *bo; unsigned nreloc; unsigned bo_pm4_index[R600_BLOCK_MAX_BO]; }; @@ -195,7 +195,7 @@ struct r600_query { /* if we've flushed the query */ unsigned state; /* The buffer where query results are stored. */ - struct radeon_ws_bo *buffer; + struct r600_bo *buffer; unsigned buffer_size; /* linked list of queries */ struct list_head list; @@ -232,7 +232,7 @@ struct r600_draw { u32 vgt_index_type; u32 vgt_draw_initiator; u32 indices_bo_offset; - struct radeon_ws_bo *indices; + struct r600_bo *indices; }; int r600_context_init(struct r600_context *ctx, struct radeon *radeon); diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 1bbcb310ebf..2bfa4e22fec 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -69,7 +69,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ) { struct r600_resource_buffer *rbuffer; - struct radeon_ws_bo *bo; + struct r600_bo *bo; /* XXX We probably want a different alignment for buffers and textures. */ unsigned alignment = 4096; @@ -86,7 +86,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, rbuffer->r.base.vtbl = &r600_buffer_vtbl; rbuffer->r.size = rbuffer->r.base.b.width0; rbuffer->r.domain = r600_domain_from_usage(rbuffer->r.base.b.bind); - bo = radeon_ws_bo((struct radeon*)screen->winsys, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind); + bo = r600_bo((struct radeon*)screen->winsys, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind); if (bo == NULL) { FREE(rbuffer); return NULL; @@ -129,7 +129,7 @@ static void r600_buffer_destroy(struct pipe_screen *screen, struct r600_resource_buffer *rbuffer = r600_buffer(buf); if (rbuffer->r.bo) { - radeon_ws_bo_reference((struct radeon*)screen->winsys, &rbuffer->r.bo, NULL); + r600_bo_reference((struct radeon*)screen->winsys, &rbuffer->r.bo, NULL); } FREE(rbuffer); } @@ -153,9 +153,9 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, flush = TRUE; if (flush) { - radeon_ws_bo_reference((struct radeon*)pipe->winsys, &rbuffer->r.bo, NULL); + r600_bo_reference((struct radeon*)pipe->winsys, &rbuffer->r.bo, NULL); rbuffer->num_ranges = 0; - rbuffer->r.bo = radeon_ws_bo((struct radeon*)pipe->winsys, + rbuffer->r.bo = r600_bo((struct radeon*)pipe->winsys, rbuffer->r.base.b.width0, 0, rbuffer->r.base.b.bind); break; @@ -168,7 +168,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, if (transfer->usage & PIPE_TRANSFER_WRITE) { write = 1; } - data = radeon_ws_bo_map((struct radeon*)pipe->winsys, rbuffer->r.bo, transfer->usage, pipe); + data = r600_bo_map((struct radeon*)pipe->winsys, rbuffer->r.bo, transfer->usage, pipe); if (!data) return NULL; @@ -181,7 +181,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe, struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource); if (rbuffer->r.bo) - radeon_ws_bo_unmap((struct radeon*)pipe->winsys, rbuffer->r.bo); + r600_bo_unmap((struct radeon*)pipe->winsys, rbuffer->r.bo); } static void r600_buffer_transfer_flush_region(struct pipe_context *pipe, @@ -225,16 +225,16 @@ struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen, { struct radeon *rw = (struct radeon*)screen->winsys; struct r600_resource *rbuffer; - struct radeon_ws_bo *bo = NULL; + struct r600_bo *bo = NULL; - bo = radeon_ws_bo_handle(rw, whandle->handle); + bo = r600_bo_handle(rw, whandle->handle); if (bo == NULL) { return NULL; } rbuffer = CALLOC_STRUCT(r600_resource); if (rbuffer == NULL) { - radeon_ws_bo_reference(rw, &bo, NULL); + r600_bo_reference(rw, &bo, NULL); return NULL; } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 18ebb0eb226..c46029a5617 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -88,7 +88,7 @@ struct r600_vertex_element struct r600_pipe_shader { struct r600_shader shader; struct r600_pipe_state rstate; - struct radeon_ws_bo *bo; + struct r600_bo *bo; struct r600_vertex_element vertex_elements; }; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index ae1ad24bfd5..f6377ea802b 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -41,7 +41,7 @@ struct r600_transfer { */ struct r600_resource { struct u_resource base; - struct radeon_ws_bo *bo; + struct r600_bo *bo; u32 domain; u32 flink; u32 size; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 21b91805824..e9d4ee13b94 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -200,13 +200,13 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s /* copy new shader */ if (shader->bo == NULL) { - shader->bo = radeon_ws_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0); + shader->bo = r600_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0); if (shader->bo == NULL) { return -ENOMEM; } - ptr = radeon_ws_bo_map(rctx->radeon, shader->bo, 0, NULL); + ptr = r600_bo_map(rctx->radeon, shader->bo, 0, NULL); memcpy(ptr, rshader->bc.bytecode, rshader->bc.ndw * 4); - radeon_ws_bo_unmap(rctx->radeon, shader->bo); + r600_bo_unmap(rctx->radeon, shader->bo); } /* build state */ rshader->flat_shade = rctx->flatshade; @@ -254,7 +254,7 @@ static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader for (i = 0; i < rctx->vertex_elements->count; i++) { resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format; } - radeon_ws_bo_reference(rctx->radeon, &rshader->bo, NULL); + r600_bo_reference(rctx->radeon, &rshader->bo, NULL); LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) { switch (cf->inst) { case V_SQ_CF_WORD1_SQ_CF_INST_VTX: diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 2814ecc239a..326e3aa1419 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -606,7 +606,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c unsigned format; uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4], array_mode = 0, tile_type = 0; - struct radeon_ws_bo *bo[2]; + struct r600_bo *bo[2]; if (resource == NULL) return NULL; @@ -739,7 +739,7 @@ static void r600_delete_state(struct pipe_context *ctx, void *state) rctx->states[rstate->id] = NULL; } for (int i = 0; i < rstate->nregs; i++) { - radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); + r600_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL); } free(rstate); } @@ -940,7 +940,7 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta unsigned color_info; unsigned format, swap, ntype; const struct util_format_description *desc; - struct radeon_ws_bo *bo[3]; + struct r600_bo *bo[3]; rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture; rbuffer = &rtex->resource; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index f03d6fcfd60..c46bfa66ba1 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -127,7 +127,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, /* FIXME alignment 4096 enought ? too much ? */ resource->domain = r600_domain_from_usage(resource->base.b.bind); resource->size = rtex->size; - resource->bo = radeon_ws_bo(radeon, rtex->size, 4096, 0); + resource->bo = r600_bo(radeon, rtex->size, 4096, 0); if (resource->bo == NULL) { FREE(rtex); return NULL; @@ -146,7 +146,7 @@ static void r600_texture_destroy(struct pipe_screen *screen, pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL); if (resource->bo) { - radeon_ws_bo_reference(radeon, &resource->bo, NULL); + r600_bo_reference(radeon, &resource->bo, NULL); } FREE(rtex); } @@ -190,7 +190,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, struct radeon *rw = (struct radeon*)screen->winsys; struct r600_resource_texture *rtex; struct r600_resource *resource; - struct radeon_ws_bo *bo = NULL; + struct r600_bo *bo = NULL; /* Support only 2D textures without mipmaps */ if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT) || @@ -201,7 +201,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, if (rtex == NULL) return NULL; - bo = radeon_ws_bo_handle(rw, whandle->handle); + bo = r600_bo_handle(rw, whandle->handle); if (bo == NULL) { FREE(rtex); return NULL; @@ -359,7 +359,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer) { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; - struct radeon_ws_bo *bo; + struct r600_bo *bo; enum pipe_format format = transfer->resource->format; struct radeon *radeon = (struct radeon *)ctx->screen->winsys; unsigned long offset = 0; @@ -379,7 +379,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, transfer->box.y / util_format_get_blockheight(format) * transfer->stride + transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } - map = radeon_ws_bo_map(radeon, bo, 0, ctx); + map = r600_bo_map(radeon, bo, 0, ctx); if (!map) { return NULL; } @@ -392,7 +392,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct radeon *radeon = (struct radeon *)ctx->screen->winsys; - struct radeon_ws_bo *bo; + struct r600_bo *bo; if (rtransfer->linear_texture) { bo = ((struct r600_resource *)rtransfer->linear_texture)->bo; @@ -405,7 +405,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, bo = ((struct r600_resource *)transfer->resource)->bo; } } - radeon_ws_bo_unmap(radeon, bo); + r600_bo_unmap(radeon, bo); } struct u_resource_vtbl r600_texture_vtbl = diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index c3569e60e88..fadfe286921 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -632,8 +632,8 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); return; } block->reg[0] = state->regs[0].value; @@ -644,18 +644,18 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context block->reg[5] = state->regs[5].value; block->reg[6] = state->regs[6].value; block->reg[7] = state->regs[7].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { /* VERTEX RESOURCE, we preted there is 2 bo to relocate so * we have single case btw VERTEX & TEXTURE resource */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); } else { /* TEXTURE RESOURCE */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; @@ -881,18 +881,18 @@ static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_ block->reg[5] = state->regs[5].value; block->reg[6] = state->regs[6].value; block->reg[7] = state->regs[7].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { /* VERTEX RESOURCE, we preted there is 2 bo to relocate so * we have single case btw VERTEX & TEXTURE resource */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); } else { /* TEXTURE RESOURCE */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 0a1b3a94190..48727b9e6bc 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -751,7 +751,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat if (block->pm4_bo_index[id]) { /* find relocation */ id = block->pm4_bo_index[id]; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); + r600_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); } if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; @@ -770,8 +770,8 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); return; } block->reg[0] = state->regs[0].value; @@ -781,18 +781,18 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx block->reg[4] = state->regs[4].value; block->reg[5] = state->regs[5].value; block->reg[6] = state->regs[6].value; - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); + r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); if (state->regs[0].bo) { /* VERTEX RESOURCE, we preted there is 2 bo to relocate so * we have single case btw VERTEX & TEXTURE resource */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); + r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); } else { /* TEXTURE RESOURCE */ - radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); + r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); + r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; @@ -1151,7 +1151,7 @@ static void r600_query_result(struct r600_context *ctx, struct r600_query *query u32 *results; int i; - results = radeon_ws_bo_map(ctx->radeon, query->buffer, 0, NULL); + results = r600_bo_map(ctx->radeon, query->buffer, 0, NULL); for (i = 0; i < query->num_results; i += 4) { start = (u64)results[i] | (u64)results[i + 1] << 32; end = (u64)results[i + 2] | (u64)results[i + 3] << 32; @@ -1159,7 +1159,7 @@ static void r600_query_result(struct r600_context *ctx, struct r600_query *query query->result += end - start; } } - radeon_ws_bo_unmap(ctx->radeon, query->buffer); + r600_bo_unmap(ctx->radeon, query->buffer); query->num_results = 0; } @@ -1222,7 +1222,7 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query->type = query_type; query->buffer_size = 4096; - query->buffer = radeon_ws_bo(ctx->radeon, query->buffer_size, 1, 0); + query->buffer = r600_bo(ctx->radeon, query->buffer_size, 1, 0); if (!query->buffer) { free(query); return NULL; @@ -1235,7 +1235,7 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query) { - radeon_ws_bo_reference(ctx->radeon, &query->buffer, NULL); + r600_bo_reference(ctx->radeon, &query->buffer, NULL); LIST_DEL(&query->list); free(query); } diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index fdca6f01e84..4bd2c278bc7 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -65,7 +65,7 @@ struct radeon_bo { void *data; }; -struct radeon_ws_bo { +struct r600_bo { struct pipe_reference reference; struct pb_buffer *pb; }; @@ -93,9 +93,9 @@ struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon); struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr, uint32_t handle); -/* radeon_ws_bo.c */ -unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *bo); -unsigned radeon_ws_bo_get_size(struct radeon_ws_bo *bo); +/* r600_bo.c */ +unsigned r600_bo_get_handle(struct r600_bo *bo); +unsigned r600_bo_get_size(struct r600_bo *bo); #define CTX_RANGE_ID(ctx, offset) (((offset) >> (ctx)->hash_shift) & 255) #define CTX_BLOCK_ID(ctx, offset) ((offset) & ((1 << (ctx)->hash_shift) - 1)) diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c index ed3b4e72bf9..a502c7e2521 100644 --- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c @@ -28,10 +28,10 @@ #include #include "r600_priv.h" -struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon, +struct r600_bo *r600_bo(struct radeon *radeon, unsigned size, unsigned alignment, unsigned usage) { - struct radeon_ws_bo *ws_bo = calloc(1, sizeof(struct radeon_ws_bo)); + struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); struct pb_desc desc; struct pb_manager *man; @@ -55,10 +55,10 @@ struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon, return ws_bo; } -struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon, +struct r600_bo *r600_bo_handle(struct radeon *radeon, unsigned handle) { - struct radeon_ws_bo *ws_bo = calloc(1, sizeof(struct radeon_ws_bo)); + struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle); if (!ws_bo->pb) { @@ -69,35 +69,35 @@ struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon, return ws_bo; } -void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx) +void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx) { return pb_map(bo->pb, usage, ctx); } -void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo) +void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo) { pb_unmap(bo->pb); } -static void radeon_ws_bo_destroy(struct radeon *radeon, struct radeon_ws_bo *bo) +static void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo) { if (bo->pb) pb_reference(&bo->pb, NULL); free(bo); } -void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst, - struct radeon_ws_bo *src) +void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, + struct r600_bo *src) { - struct radeon_ws_bo *old = *dst; + struct r600_bo *old = *dst; if (pipe_reference(&(*dst)->reference, &src->reference)) { - radeon_ws_bo_destroy(radeon, old); + r600_bo_destroy(radeon, old); } *dst = src; } -unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo) +unsigned r600_bo_get_handle(struct r600_bo *pb_bo) { struct radeon_bo *bo; @@ -108,7 +108,7 @@ unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo) return bo->handle; } -unsigned radeon_ws_bo_get_size(struct radeon_ws_bo *pb_bo) +unsigned r600_bo_get_size(struct r600_bo *pb_bo) { struct radeon_bo *bo; -- cgit v1.2.3 From d22a1247d8a709cf433a6dd99b2f87a224c27d88 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 4 Oct 2010 10:25:23 -0400 Subject: r600g: allow r600_bo to be a sub allocation of a big bo Add bo offset everywhere needed if r600_bo is ever a sub bo of a bigger bo. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 24 ++++++++++++---------- src/gallium/drivers/r600/r600.h | 7 ++++++- src/gallium/drivers/r600/r600_shader.c | 6 +++--- src/gallium/drivers/r600/r600_state.c | 20 ++++++++++-------- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 2 +- src/gallium/winsys/r600/drm/r600_hw_context.c | 6 +++--- 6 files changed, 37 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 6fcb2ae6f32..06cdd5ffdf3 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -458,9 +458,9 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte S_030004_TEX_DEPTH(texture->depth0 - 1), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, - tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); + (tmp->offset[0] + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, - tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); + (tmp->offset[1] + r600_bo_offset(bo[1])) >> 8, 0xFFFFFFFF, bo[1]); r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, word4 | S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) | S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) | @@ -765,7 +765,7 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state /* FIXME handle enabling of CB beyond BASE8 which has different offset */ r600_pipe_state_add_reg(rstate, R_028C60_CB_COLOR0_BASE + cb * 0x3C, - state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); + (state->cbufs[cb]->offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R_028C78_CB_COLOR0_DIM + cb * 0x3C, 0x0, 0xFFFFFFFF, NULL); @@ -813,9 +813,9 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state format = r600_translate_dbformat(state->zsbuf->texture->format); r600_pipe_state_add_reg(rstate, R_028048_DB_Z_READ_BASE, - state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R_028050_DB_Z_WRITE_BASE, - state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); // r600_pipe_state_add_reg(rstate, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_028040_DB_Z_INFO, @@ -945,7 +945,7 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&rctx->vs_const_buffer, R_028980_ALU_CONST_CACHE_VS_0, - 0, 0xFFFFFFFF, rbuffer->bo); + (r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); break; case PIPE_SHADER_FRAGMENT: @@ -956,7 +956,7 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&rctx->ps_const_buffer, R_028940_ALU_CONST_CACHE_PS_0, - 0, 0xFFFFFFFF, rbuffer->bo); + (r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); break; default: @@ -1412,7 +1412,9 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; + offset = rctx->vertex_elements->elements[i].src_offset + + vertex_buffer->buffer_offset + + r600_bo_offset(rbuffer->bo); format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format); @@ -1567,7 +1569,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_028840_SQ_PGM_START_PS, - 0x00000000, 0xFFFFFFFF, shader->bo); + (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo); r600_pipe_state_add_reg(rstate, R_028844_SQ_PGM_RESOURCES_PS, S_028844_NUM_GPRS(rshader->bc.ngpr) | @@ -1640,10 +1642,10 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_02885C_SQ_PGM_START_VS, - 0x00000000, 0xFFFFFFFF, shader->bo); + (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo); r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_START_FS, - 0x00000000, 0xFFFFFFFF, shader->bo); + (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo); r600_pipe_state_add_reg(rstate, R_03A200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF, diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index dd3c4e30065..8a2e5c514d4 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -102,7 +102,7 @@ enum chip_class { enum radeon_family r600_get_family(struct radeon *rw); enum chip_class r600_get_family_class(struct radeon *radeon); -/* lowlevel WS bo */ +/* r600_bo.c */ struct r600_bo; struct r600_bo *r600_bo(struct radeon *radeon, unsigned size, unsigned alignment, unsigned usage); @@ -112,6 +112,11 @@ void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, voi void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo); void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, struct r600_bo *src); +static INLINE unsigned r600_bo_offset(struct r600_bo *bo) +{ + return 0; +} + /* R600/R700 STATES */ #define R600_GROUP_MAX 16 diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e9d4ee13b94..d7edf6a44fb 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -77,10 +77,10 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_028858_SQ_PGM_START_VS, - 0x00000000, 0xFFFFFFFF, shader->bo); + r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo); r600_pipe_state_add_reg(rstate, R_028894_SQ_PGM_START_FS, - 0x00000000, 0xFFFFFFFF, shader->bo); + r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo); r600_pipe_state_add_reg(rstate, R_03E200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF, @@ -167,7 +167,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_028840_SQ_PGM_START_PS, - 0x00000000, 0xFFFFFFFF, shader->bo); + r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo); r600_pipe_state_add_reg(rstate, R_028850_SQ_PGM_RESOURCES_PS, S_028868_NUM_GPRS(rshader->bc.ngpr) | diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 326e3aa1419..f7c77cde944 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -94,7 +94,9 @@ static void r600_draw_common(struct r600_drawl *draw) j = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[j]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset; + offset = rctx->vertex_elements->elements[i].src_offset + + vertex_buffer->buffer_offset + + r600_bo_offset(rbuffer->bo); format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format); @@ -660,9 +662,9 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c S_038004_TEX_DEPTH(texture->depth0 - 1) | S_038004_DATA_FORMAT(format), 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, - tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]); + (tmp->offset[0] + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, - tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]); + (tmp->offset[1] + r600_bo_offset(bo[1])) >> 8, 0xFFFFFFFF, bo[1]); r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) | S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) | @@ -966,7 +968,7 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta r600_pipe_state_add_reg(rstate, R_028040_CB_COLOR0_BASE + cb * 4, - state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]); + (state->cbufs[cb]->offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]); r600_pipe_state_add_reg(rstate, R_0280A0_CB_COLOR0_INFO + cb * 4, color_info, 0xFFFFFFFF, bo[0]); @@ -980,10 +982,10 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_0280E0_CB_COLOR0_FRAG + cb * 4, - 0x00000000, 0xFFFFFFFF, bo[1]); + r600_bo_offset(bo[1]) >> 8, 0xFFFFFFFF, bo[1]); r600_pipe_state_add_reg(rstate, R_0280C0_CB_COLOR0_TILE + cb * 4, - 0x00000000, 0xFFFFFFFF, bo[2]); + r600_bo_offset(bo[2]) >> 8, 0xFFFFFFFF, bo[2]); r600_pipe_state_add_reg(rstate, R_028100_CB_COLOR0_MASK + cb * 4, 0x00000000, 0xFFFFFFFF, NULL); @@ -1013,7 +1015,7 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta format = r600_translate_dbformat(state->zsbuf->texture->format); r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE, - state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R_028000_DB_DEPTH_SIZE, S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice), 0xFFFFFFFF, NULL); @@ -1157,7 +1159,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&rctx->vs_const_buffer, R_028980_ALU_CONST_CACHE_VS_0, - 0, 0xFFFFFFFF, rbuffer->bo); + r600_bo_offset(rbuffer->bo) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); break; case PIPE_SHADER_FRAGMENT: @@ -1168,7 +1170,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(&rctx->ps_const_buffer, R_028940_ALU_CONST_CACHE_PS_0, - 0, 0xFFFFFFFF, rbuffer->bo); + r600_bo_offset(rbuffer->bo) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); break; default: diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index fadfe286921..f51b14e48ec 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -817,7 +817,7 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; if (draw->indices) { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); - ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; + ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset + r600_bo_offset(draw->indices); ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 48727b9e6bc..61e3fbcc9ab 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -967,7 +967,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances; if (draw->indices) { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3); - ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset; + ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset + r600_bo_offset(draw->indices); ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; @@ -1180,7 +1180,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) /* emit begin query */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; - ctx->pm4[ctx->pm4_cdwords++] = query->num_results; + ctx->pm4[ctx->pm4_cdwords++] = query->num_results + r600_bo_offset(query->buffer); ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; @@ -1196,7 +1196,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) /* emit begin query */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2); ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE; - ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8; + ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8 + r600_bo_offset(query->buffer); ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; -- cgit v1.2.3 From 674452faf98d6f107c42bcb0c56a2a6ac6890023 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 4 Oct 2010 10:37:32 -0400 Subject: r600g: use r600_bo for relocation argument, simplify code Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 9 +++------ src/gallium/winsys/r600/drm/r600_hw_context.c | 18 ++++++++++-------- src/gallium/winsys/r600/drm/r600_priv.h | 17 ++++++++++++----- src/gallium/winsys/r600/drm/radeon_ws_bo.c | 4 ++++ 4 files changed, 29 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index f51b14e48ec..ff2c48e770e 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -39,9 +39,6 @@ #include #include "r600_priv.h" -struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); -int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); - #define GROUP_FORCE_NEW_BLOCK 0 static const struct r600_reg evergreen_config_reg_list[] = { @@ -747,8 +744,8 @@ void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struc void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw) { - struct radeon_bo *cb[12]; - struct radeon_bo *db; + struct r600_bo *cb[12]; + struct r600_bo *db; unsigned ndwords = 9; if (draw->indices) { @@ -823,7 +820,7 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], draw->indices); } else { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 61e3fbcc9ab..7a908b3ca4d 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -705,10 +705,12 @@ out_err: return r; } -void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo) +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo) { + struct radeon_bo *bo; int i, reloc_id; + bo = r600_bo_get_bo(rbo); assert(bo != NULL); for (i = 0, reloc_id = -1; i < ctx->creloc; i++) { if (ctx->reloc[i].handle == bo->handle) { @@ -881,7 +883,7 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 r600_context_pipe_state_set_sampler_border(ctx, state, offset); } -struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) +struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) { struct r600_range *range; struct r600_block *block; @@ -892,15 +894,15 @@ struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset) offset -= block->start_offset; id = block->pm4_bo_index[offset >> 2]; if (block->reloc[id].bo) { - return radeon_bo_pb_get_bo(block->reloc[id].bo->pb); + return block->reloc[id].bo; } return NULL; } void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) { - struct radeon_bo *cb[8]; - struct radeon_bo *db; + struct r600_bo *cb[8]; + struct r600_bo *db; unsigned ndwords = 9; if (draw->indices) { @@ -973,7 +975,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb)); + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], draw->indices); } else { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1); ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices; @@ -1184,7 +1186,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], query->buffer); query->state |= R600_QUERY_STATE_STARTED; query->state ^= R600_QUERY_STATE_ENDED; @@ -1200,7 +1202,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb)); + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], query->buffer); query->num_results += 16; query->state ^= R600_QUERY_STATE_STARTED; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 4bd2c278bc7..5c954ea6213 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -68,6 +68,7 @@ struct radeon_bo { struct r600_bo { struct pipe_reference reference; struct pb_buffer *pb; + unsigned size; }; @@ -78,8 +79,6 @@ unsigned radeon_family_from_device(unsigned device); struct radeon *radeon_decref(struct radeon *radeon); /* radeon_bo.c */ -struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); -void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo); struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, unsigned size, unsigned alignment, void *ptr); void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, @@ -89,13 +88,23 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); /* radeon_bo_pb.c */ +struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon); struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr, uint32_t handle); +/* r600_hw_context.c */ +void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo); +struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); +int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); + /* r600_bo.c */ unsigned r600_bo_get_handle(struct r600_bo *bo); unsigned r600_bo_get_size(struct r600_bo *bo); +static INLINE struct radeon_bo *r600_bo_get_bo(struct r600_bo *bo) +{ + return radeon_bo_pb_get_bo(bo->pb); +} #define CTX_RANGE_ID(ctx, offset) (((offset) >> (ctx)->hash_shift) & 255) #define CTX_BLOCK_ID(ctx, offset) ((offset) & ((1 << (ctx)->hash_shift) - 1)) @@ -122,18 +131,16 @@ static void inline r600_context_reg(struct r600_context *ctx, static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block) { - struct radeon_bo *bo; int id; for (int j = 0; j < block->nreg; j++) { if (block->pm4_bo_index[j]) { /* find relocation */ id = block->pm4_bo_index[j]; - bo = radeon_bo_pb_get_bo(block->reloc[id].bo->pb); for (int k = 0; k < block->reloc[id].nreloc; k++) { r600_context_bo_reloc(ctx, &block->pm4[block->reloc[id].bo_pm4_index[k]], - bo); + block->reloc[id].bo); } } } diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c index a502c7e2521..8089c916404 100644 --- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c @@ -37,6 +37,7 @@ struct r600_bo *r600_bo(struct radeon *radeon, desc.alignment = alignment; desc.usage = usage; + ws_bo->size = size; if (!radeon->use_mem_constant && (usage & PIPE_BIND_CONSTANT_BUFFER)) { man = radeon->mman; @@ -59,12 +60,15 @@ struct r600_bo *r600_bo_handle(struct radeon *radeon, unsigned handle) { struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); + struct radeon_bo *bo; ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle); if (!ws_bo->pb) { free(ws_bo); return NULL; } + bo = radeon_bo_pb_get_bo(ws_bo->pb); + ws_bo->size = bo->size; pipe_reference_init(&ws_bo->reference, 1); return ws_bo; } -- cgit v1.2.3 From 243d6ea6091514f04bf3c23f1957665cf25ae6eb Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 4 Oct 2010 10:38:50 -0400 Subject: r600g: rename radeon_ws_bo to r600_bo Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/Makefile | 2 +- src/gallium/winsys/r600/drm/r600_bo.c | 124 +++++++++++++++++++++++++++++ src/gallium/winsys/r600/drm/radeon_ws_bo.c | 124 ----------------------------- 3 files changed, 125 insertions(+), 125 deletions(-) create mode 100644 src/gallium/winsys/r600/drm/r600_bo.c delete mode 100644 src/gallium/winsys/r600/drm/radeon_ws_bo.c (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/Makefile b/src/gallium/winsys/r600/drm/Makefile index f407817a8ea..a396205f897 100644 --- a/src/gallium/winsys/r600/drm/Makefile +++ b/src/gallium/winsys/r600/drm/Makefile @@ -10,8 +10,8 @@ C_SOURCES = \ radeon_bo.c \ radeon_bo_pb.c \ radeon_pciid.c \ - radeon_ws_bo.c \ r600.c \ + r600_bo.c \ r600_drm.c \ r600_hw_context.c diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c new file mode 100644 index 00000000000..8089c916404 --- /dev/null +++ b/src/gallium/winsys/r600/drm/r600_bo.c @@ -0,0 +1,124 @@ +/* + * Copyright 2010 Dave Airlie + * + * 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 + * on 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 + * THE AUTHOR(S) AND/OR THEIR 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. + * + * Authors: + * Dave Airlie + */ +#include +#include +#include +#include "r600_priv.h" + +struct r600_bo *r600_bo(struct radeon *radeon, + unsigned size, unsigned alignment, unsigned usage) +{ + struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); + struct pb_desc desc; + struct pb_manager *man; + + desc.alignment = alignment; + desc.usage = usage; + ws_bo->size = size; + + if (!radeon->use_mem_constant && (usage & PIPE_BIND_CONSTANT_BUFFER)) { + man = radeon->mman; + } else if (usage & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) + man = radeon->cman; + else + man = radeon->kman; + + ws_bo->pb = man->create_buffer(man, size, &desc); + if (ws_bo->pb == NULL) { + free(ws_bo); + return NULL; + } + + pipe_reference_init(&ws_bo->reference, 1); + return ws_bo; +} + +struct r600_bo *r600_bo_handle(struct radeon *radeon, + unsigned handle) +{ + struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); + struct radeon_bo *bo; + + ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle); + if (!ws_bo->pb) { + free(ws_bo); + return NULL; + } + bo = radeon_bo_pb_get_bo(ws_bo->pb); + ws_bo->size = bo->size; + pipe_reference_init(&ws_bo->reference, 1); + return ws_bo; +} + +void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx) +{ + return pb_map(bo->pb, usage, ctx); +} + +void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo) +{ + pb_unmap(bo->pb); +} + +static void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo) +{ + if (bo->pb) + pb_reference(&bo->pb, NULL); + free(bo); +} + +void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, + struct r600_bo *src) +{ + struct r600_bo *old = *dst; + + if (pipe_reference(&(*dst)->reference, &src->reference)) { + r600_bo_destroy(radeon, old); + } + *dst = src; +} + +unsigned r600_bo_get_handle(struct r600_bo *pb_bo) +{ + struct radeon_bo *bo; + + bo = radeon_bo_pb_get_bo(pb_bo->pb); + if (!bo) + return 0; + + return bo->handle; +} + +unsigned r600_bo_get_size(struct r600_bo *pb_bo) +{ + struct radeon_bo *bo; + + bo = radeon_bo_pb_get_bo(pb_bo->pb); + if (!bo) + return 0; + + return bo->size; +} diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c deleted file mode 100644 index 8089c916404..00000000000 --- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2010 Dave Airlie - * - * 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 - * on 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 - * THE AUTHOR(S) AND/OR THEIR 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. - * - * Authors: - * Dave Airlie - */ -#include -#include -#include -#include "r600_priv.h" - -struct r600_bo *r600_bo(struct radeon *radeon, - unsigned size, unsigned alignment, unsigned usage) -{ - struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); - struct pb_desc desc; - struct pb_manager *man; - - desc.alignment = alignment; - desc.usage = usage; - ws_bo->size = size; - - if (!radeon->use_mem_constant && (usage & PIPE_BIND_CONSTANT_BUFFER)) { - man = radeon->mman; - } else if (usage & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) - man = radeon->cman; - else - man = radeon->kman; - - ws_bo->pb = man->create_buffer(man, size, &desc); - if (ws_bo->pb == NULL) { - free(ws_bo); - return NULL; - } - - pipe_reference_init(&ws_bo->reference, 1); - return ws_bo; -} - -struct r600_bo *r600_bo_handle(struct radeon *radeon, - unsigned handle) -{ - struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo)); - struct radeon_bo *bo; - - ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle); - if (!ws_bo->pb) { - free(ws_bo); - return NULL; - } - bo = radeon_bo_pb_get_bo(ws_bo->pb); - ws_bo->size = bo->size; - pipe_reference_init(&ws_bo->reference, 1); - return ws_bo; -} - -void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx) -{ - return pb_map(bo->pb, usage, ctx); -} - -void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo) -{ - pb_unmap(bo->pb); -} - -static void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo) -{ - if (bo->pb) - pb_reference(&bo->pb, NULL); - free(bo); -} - -void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, - struct r600_bo *src) -{ - struct r600_bo *old = *dst; - - if (pipe_reference(&(*dst)->reference, &src->reference)) { - r600_bo_destroy(radeon, old); - } - *dst = src; -} - -unsigned r600_bo_get_handle(struct r600_bo *pb_bo) -{ - struct radeon_bo *bo; - - bo = radeon_bo_pb_get_bo(pb_bo->pb); - if (!bo) - return 0; - - return bo->handle; -} - -unsigned r600_bo_get_size(struct r600_bo *pb_bo) -{ - struct radeon_bo *bo; - - bo = radeon_bo_pb_get_bo(pb_bo->pb); - if (!bo) - return 0; - - return bo->size; -} -- cgit v1.2.3 From b25c52201bae6d38c809f0d63f4fb287bf69d05a Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 4 Oct 2010 10:40:07 -0400 Subject: r600g: remove dead label & fix indentation Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/radeon_bo.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index bb93ce6c9e3..14af3ec97ec 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -58,9 +58,7 @@ static int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo) } bo->data = ptr; -success: bo->map_count++; - return 0; } @@ -168,16 +166,16 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo) int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain) { - struct drm_radeon_gem_busy args; - int ret; + struct drm_radeon_gem_busy args; + int ret; - memset(&args, 0, sizeof(args)); - args.handle = bo->handle; - args.domain = 0; + memset(&args, 0, sizeof(args)); + args.handle = bo->handle; + args.domain = 0; - ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_BUSY, - &args, sizeof(args)); + ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_BUSY, + &args, sizeof(args)); - *domain = args.domain; - return ret; + *domain = args.domain; + return ret; } -- cgit v1.2.3 From a0a8e2438587c606411060a052da8da119014a20 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 4 Oct 2010 15:56:55 -0700 Subject: r600g: Fix SCons build. --- src/gallium/winsys/r600/drm/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index 88ee90862b8..cc053c06dd0 100644 --- a/src/gallium/winsys/r600/drm/SConscript +++ b/src/gallium/winsys/r600/drm/SConscript @@ -8,8 +8,8 @@ r600_sources = [ 'radeon_bo.c', 'radeon_bo_pb.c', 'radeon_pciid.c', - 'radeon_ws_bo.c', 'r600.c', + 'r600_bo.c', 'r600_drm.c', 'r600_hw_context.c', ] -- cgit v1.2.3 From 9faf64bc32cf7c1a06a302fff9f80d7e2e2685d5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 3 Oct 2010 15:01:20 -0700 Subject: i965: Be more conservative on live interval calculation. This also means that our intervals now highlight dead code. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 5ebf9063df2..6106445fbb7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2471,7 +2471,7 @@ fs_visitor::calculate_live_intervals() for (int i = 0; i < num_vars; i++) { def[i] = 1 << 30; - use[i] = 0; + use[i] = -1; } int ip = 0; @@ -2506,13 +2506,11 @@ fs_visitor::calculate_live_intervals() for (unsigned int i = 0; i < 3; i++) { if (inst->src[i].file == GRF && inst->src[i].reg != 0) { - def[inst->src[i].reg] = MIN2(def[inst->src[i].reg], eip); use[inst->src[i].reg] = MAX2(use[inst->src[i].reg], eip); } } if (inst->dst.file == GRF && inst->dst.reg != 0) { def[inst->dst.reg] = MIN2(def[inst->dst.reg], eip); - use[inst->dst.reg] = MAX2(use[inst->dst.reg], eip); } } @@ -2529,6 +2527,16 @@ fs_visitor::virtual_grf_interferes(int a, int b) int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]); int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]); + /* For dead code, just check if the def interferes with the other range. */ + if (this->virtual_grf_use[a] == -1) { + return (this->virtual_grf_def[a] >= this->virtual_grf_def[b] && + this->virtual_grf_def[a] < this->virtual_grf_use[b]); + } + if (this->virtual_grf_use[b] == -1) { + return (this->virtual_grf_def[b] >= this->virtual_grf_def[a] && + this->virtual_grf_def[b] < this->virtual_grf_use[a]); + } + return start <= end; } -- cgit v1.2.3 From e27c88d8e6c9d18bfa793f884d02ce6011c4bdde Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 3 Oct 2010 15:15:18 -0700 Subject: i965: Add trivial dead code elimination in the new FS backend. The glsl core should be handling most dead code issues for us, but we generate some things in codegen that may not get used, like the 1/w value or pixel deltas. It seems a lot easier this way than trying to work out up front whether we're going to use those values or not. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 52 ++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 6106445fbb7..472e6d06f62 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -455,6 +455,7 @@ public: void assign_regs(); void assign_regs_trivial(); void calculate_live_intervals(); + bool dead_code_eliminate(); bool virtual_grf_interferes(int a, int b); void generate_code(); void generate_fb_write(fs_inst *inst); @@ -2289,8 +2290,6 @@ fs_visitor::assign_regs() int class_count = 0; int aligned_pair_class = -1; - calculate_live_intervals(); - /* Set up the register classes. * * The base registers store a scalar value. For texture samples, @@ -2517,10 +2516,50 @@ fs_visitor::calculate_live_intervals() ip++; } + talloc_free(this->virtual_grf_def); + talloc_free(this->virtual_grf_use); this->virtual_grf_def = def; this->virtual_grf_use = use; } +/** + * Must be called after calculate_live_intervales() to remove unused + * writes to registers -- register allocation will fail otherwise + * because something deffed but not used won't be considered to + * interfere with other regs. + */ +bool +fs_visitor::dead_code_eliminate() +{ + bool progress = false; + int num_vars = this->virtual_grf_next; + bool dead[num_vars]; + + for (int i = 0; i < num_vars; i++) { + /* This would be ">=", but FS_OPCODE_DISCARD has a src == dst where + * it writes dst then reads it as src. + */ + dead[i] = this->virtual_grf_def[i] > this->virtual_grf_use[i]; + + if (dead[i]) { + /* Mark off its interval so it won't interfere with anything. */ + this->virtual_grf_def[i] = -1; + this->virtual_grf_use[i] = -1; + } + } + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->dst.file == GRF && dead[inst->dst.reg]) { + inst->remove(); + progress = true; + } + } + + return progress; +} + bool fs_visitor::virtual_grf_interferes(int a, int b) { @@ -2831,6 +2870,15 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) v.emit_fb_writes(); v.assign_curb_setup(); v.assign_urb_setup(); + + bool progress; + do { + progress = false; + + v.calculate_live_intervals(); + progress = v.dead_code_eliminate() || progress; + } while (progress); + if (0) v.assign_regs_trivial(); else -- cgit v1.2.3 From 3bf8774e9c293fcad654d1bd67d4b43247b82f97 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 4 Oct 2010 11:48:04 -0700 Subject: i965: Add initial folding of constants into operand immediate slots. We could try to detect this in expression handling and do it proactively there, but it seems like less logic to do it in one optional pass at the end. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 90 ++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 472e6d06f62..5eaa9984476 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -455,6 +455,7 @@ public: void assign_regs(); void assign_regs_trivial(); void calculate_live_intervals(); + bool propagate_constants(); bool dead_code_eliminate(); bool virtual_grf_interferes(int a, int b); void generate_code(); @@ -2522,6 +2523,94 @@ fs_visitor::calculate_live_intervals() this->virtual_grf_use = use; } +/** + * Attempts to move immediate constants into the immediate + * constant slot of following instructions. + * + * Immediate constants are a bit tricky -- they have to be in the last + * operand slot, you can't do abs/negate on them, + */ + +bool +fs_visitor::propagate_constants() +{ + bool progress = false; + + return false; + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->opcode != BRW_OPCODE_MOV || + inst->predicated || + inst->dst.file != GRF || inst->src[0].file != IMM || + inst->dst.type != inst->src[0].type) + continue; + + /* Don't bother with cases where we should have had the + * operation on the constant folded in GLSL already. + */ + if (inst->saturate) + continue; + + /* Found a move of a constant to a GRF. Find anything else using the GRF + * before it's written, and replace it with the constant if we can. + */ + exec_list_iterator scan_iter = iter; + scan_iter.next(); + for (; scan_iter.has_next(); scan_iter.next()) { + fs_inst *scan_inst = (fs_inst *)scan_iter.get(); + + if (scan_inst->opcode == BRW_OPCODE_DO || + scan_inst->opcode == BRW_OPCODE_WHILE || + scan_inst->opcode == BRW_OPCODE_ELSE || + scan_inst->opcode == BRW_OPCODE_ENDIF) { + break; + } + + for (int i = 2; i >= 0; i--) { + if (scan_inst->src[i].file != GRF || + scan_inst->src[i].reg != inst->dst.reg || + scan_inst->src[i].reg_offset != inst->dst.reg_offset) + continue; + + /* Don't bother with cases where we should have had the + * operation on the constant folded in GLSL already. + */ + if (scan_inst->src[i].negate || scan_inst->src[i].abs) + continue; + + switch (scan_inst->opcode) { + case BRW_OPCODE_MOV: + scan_inst->src[i] = inst->src[0]; + progress = true; + break; + + case BRW_OPCODE_MUL: + case BRW_OPCODE_ADD: + if (i == 1) { + scan_inst->src[i] = inst->src[0]; + progress = true; + } else if (i == 0 && scan_inst->src[1].file != IMM) { + /* Fit this constant in by commuting the operands */ + scan_inst->src[0] = scan_inst->src[1]; + scan_inst->src[1] = inst->src[0]; + } + break; + } + } + + if (scan_inst->dst.file == GRF && + scan_inst->dst.reg == inst->dst.reg && + (scan_inst->dst.reg_offset == inst->dst.reg_offset || + scan_inst->opcode == FS_OPCODE_TEX)) { + break; + } + } + } + + return progress; +} /** * Must be called after calculate_live_intervales() to remove unused * writes to registers -- register allocation will fail otherwise @@ -2876,6 +2965,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) progress = false; v.calculate_live_intervals(); + progress = v.propagate_constants() || progress; progress = v.dead_code_eliminate() || progress; } while (progress); -- cgit v1.2.3 From 739aec39bd25e79adce306d6cf48296b7c9e4fc0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 4 Oct 2010 15:03:32 -0700 Subject: i965: In disasm, gen6 fb writes don't put msg reg # in destreg_conditionalmod. It instead sensibly appears in the src0 slot. --- src/mesa/drivers/dri/i965/brw_disasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index 90520824f60..3a93b253777 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -886,7 +886,7 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) string (file, ")"); } - if (inst->header.opcode == BRW_OPCODE_SEND) + if (inst->header.opcode == BRW_OPCODE_SEND && gen < 6) format (file, " %d", inst->header.destreg__conditionalmod); if (opcode[inst->header.opcode].ndst > 0) { -- cgit v1.2.3 From ea909be58dda7e916cb9ce434ecb78597881ad33 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 4 Oct 2010 15:07:17 -0700 Subject: i965: Add support for gen6 FB writes to the new FS. This uses message headers for now, since we'll need it for MRT. We can cut out the header later. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 11 +++++++++-- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 +++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 09cc8b2bd5e..59541353214 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -448,6 +448,7 @@ static void brw_set_dp_write_message( struct brw_context *brw, GLuint msg_control, GLuint msg_type, GLuint msg_length, + GLboolean header_present, GLuint pixel_scoreboard_clear, GLuint response_length, GLuint end_of_thread, @@ -462,7 +463,7 @@ static void brw_set_dp_write_message( struct brw_context *brw, insn->bits3.dp_render_cache.pixel_scoreboard_clear = pixel_scoreboard_clear; insn->bits3.dp_render_cache.msg_type = msg_type; insn->bits3.dp_render_cache.send_commit_msg = send_commit_msg; - insn->bits3.dp_render_cache.header_present = 0; /* XXX */ + insn->bits3.dp_render_cache.header_present = header_present; insn->bits3.dp_render_cache.response_length = response_length; insn->bits3.dp_render_cache.msg_length = msg_length; insn->bits3.dp_render_cache.end_of_thread = end_of_thread; @@ -476,7 +477,7 @@ static void brw_set_dp_write_message( struct brw_context *brw, insn->bits3.dp_write_gen5.pixel_scoreboard_clear = pixel_scoreboard_clear; insn->bits3.dp_write_gen5.msg_type = msg_type; insn->bits3.dp_write_gen5.send_commit_msg = send_commit_msg; - insn->bits3.dp_write_gen5.header_present = 1; + insn->bits3.dp_write_gen5.header_present = header_present; insn->bits3.dp_write_gen5.response_length = response_length; insn->bits3.dp_write_gen5.msg_length = msg_length; insn->bits3.dp_write_gen5.end_of_thread = end_of_thread; @@ -1293,6 +1294,7 @@ void brw_dp_WRITE_16( struct brw_compile *p, BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */ BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */ msg_length, + GL_TRUE, /* header_present */ 0, /* pixel scoreboard */ send_commit_msg, /* response_length */ 0, /* eot */ @@ -1530,12 +1532,16 @@ void brw_fb_WRITE(struct brw_compile *p, struct intel_context *intel = &p->brw->intel; struct brw_instruction *insn; GLuint msg_control, msg_type; + GLboolean header_present = GL_TRUE; insn = next_insn(p, BRW_OPCODE_SEND); insn->header.predicate_control = 0; /* XXX */ insn->header.compression_control = BRW_COMPRESSION_NONE; if (intel->gen >= 6) { + if (msg_length == 4) + header_present = GL_FALSE; + /* headerless version, just submit color payload */ src0 = brw_message_reg(msg_reg_nr); @@ -1559,6 +1565,7 @@ void brw_fb_WRITE(struct brw_compile *p, msg_control, msg_type, msg_length, + header_present, 1, /* pixel scoreboard */ response_length, eot, diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 5eaa9984476..f42c4696410 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1920,6 +1920,7 @@ void fs_visitor::generate_fb_write(fs_inst *inst) { GLboolean eot = inst->eot; + struct brw_reg implied_header; /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied * move, here's g1. @@ -1927,16 +1928,27 @@ fs_visitor::generate_fb_write(fs_inst *inst) brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); brw_set_compression_control(p, BRW_COMPRESSION_NONE); + + if (intel->gen >= 6) { + brw_MOV(p, + brw_message_reg(0), + brw_vec8_grf(0, 0)); + implied_header = brw_null_reg(); + } else { + implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW); + } + brw_MOV(p, brw_message_reg(1), brw_vec8_grf(1, 0)); + brw_pop_insn_state(p); brw_fb_WRITE(p, 8, /* dispatch_width */ retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), 0, /* base MRF */ - retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), + implied_header, inst->target, inst->mlen, 0, -- cgit v1.2.3 From d0408cf55d9e8d1d376bd844386ef5c9789a3597 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 4 Oct 2010 21:19:27 +0200 Subject: r300g: fix microtiling for 16-bits-per-channel formats These texture formats (like R16G16B16A16_UNORM) were untested until now because st/mesa doesn't use them. I am testing this with a hacked st/mesa here. --- src/gallium/drivers/r300/r300_texture_desc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index a49029e1e92..543d0fdc15b 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -44,7 +44,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, {{ 32, 1}, { 8, 4}, { 0, 0}}, /* 8 bits per pixel */ {{ 16, 1}, { 8, 2}, { 4, 4}}, /* 16 bits per pixel */ {{ 8, 1}, { 4, 2}, { 0, 0}}, /* 32 bits per pixel */ - {{ 4, 1}, { 0, 0}, { 2, 2}}, /* 64 bits per pixel */ + {{ 4, 1}, { 2, 2}, { 0, 0}}, /* 64 bits per pixel */ {{ 2, 1}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */ }, { @@ -53,7 +53,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, {{256, 8}, {64, 32}, { 0, 0}}, /* 8 bits per pixel */ {{128, 8}, {64, 16}, {32, 32}}, /* 16 bits per pixel */ {{ 64, 8}, {32, 16}, { 0, 0}}, /* 32 bits per pixel */ - {{ 32, 8}, { 0, 0}, {16, 16}}, /* 64 bits per pixel */ + {{ 32, 8}, {16, 16}, { 0, 0}}, /* 64 bits per pixel */ {{ 16, 8}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */ } }; @@ -368,11 +368,11 @@ static void r300_setup_tiling(struct r300_screen *screen, switch (util_format_get_blocksize(format)) { case 1: case 4: + case 8: desc->microtile = R300_BUFFER_TILED; break; case 2: - case 8: if (rws->get_value(rws, R300_VID_SQUARE_TILING_SUPPORT)) { desc->microtile = R300_BUFFER_SQUARETILED; } -- cgit v1.2.3 From fb5e6f88fc426e53af26e98d1c336222a8952cc5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 4 Oct 2010 19:59:23 -0600 Subject: swrast: fix choose_depth_texture_level() to respect mipmap filtering state NOTE: this is a candidate for the 7.9 branch. --- src/mesa/swrast/s_texfilter.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index de694c31bf1..e5ffe8fa5c5 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -2975,11 +2975,16 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda) { GLint level; - lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod); - - level = (GLint) lambda; - - level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel); + if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + /* no mipmapping - use base level */ + level = tObj->BaseLevel; + } + else { + /* choose mipmap level */ + lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod); + level = (GLint) lambda; + level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel); + } return level; } -- cgit v1.2.3 From 3c38e4f138a183ee5ad625ea34b1ec7dd815026f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 15:35:52 +1000 Subject: r600g: add bo fenced list. this just keeps a list of bos submitted together, and uses them to decide bo busy state for the whole group. --- src/gallium/winsys/r600/drm/r600_hw_context.c | 1 + src/gallium/winsys/r600/drm/r600_priv.h | 5 ++++ src/gallium/winsys/r600/drm/radeon_bo.c | 37 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 7a908b3ca4d..822b65facfb 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -1044,6 +1044,7 @@ void r600_context_flush(struct r600_context *ctx) sizeof(struct drm_radeon_cs)); #endif /* restart */ + radeon_bo_fencelist(ctx->radeon, ctx->bo, ctx->creloc); for (int i = 0; i < ctx->creloc; i++) { radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); } diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 5c954ea6213..76a7ba9ec25 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -31,6 +31,7 @@ #include #include #include +#include "util/u_double_list.h" #include "r600.h" struct radeon { @@ -63,6 +64,8 @@ struct radeon_bo { unsigned alignment; unsigned map_count; void *data; + struct list_head fencedlist; + boolean shared; }; struct r600_bo { @@ -86,6 +89,8 @@ void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain); void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr); +int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, uint32_t num_bo); + /* radeon_bo_pb.c */ struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf); diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index 14af3ec97ec..97138f9f9ef 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -95,6 +95,7 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, } bo->handle = open_arg.handle; bo->size = open_arg.size; + bo->shared = TRUE; } else { struct drm_radeon_gem_create args; @@ -122,6 +123,7 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, if (ptr) { memcpy(bo->data, ptr, size); } + LIST_INITHEAD(&bo->fencedlist); return bo; } @@ -130,6 +132,7 @@ static void radeon_bo_destroy(struct radeon *radeon, struct radeon_bo *bo) { struct drm_gem_close args; + LIST_DEL(&bo->fencedlist); radeon_bo_fixed_unmap(radeon, bo); memset(&args, 0, sizeof(args)); args.handle = bo->handle; @@ -154,6 +157,9 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo) struct drm_radeon_gem_wait_idle args; int ret; + if (LIST_IS_EMPTY(&bo->fencedlist) && !bo->shared) + return 0; + /* Zero out args to make valgrind happy */ memset(&args, 0, sizeof(args)); args.handle = bo->handle; @@ -169,6 +175,9 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain struct drm_radeon_gem_busy args; int ret; + if (LIST_IS_EMPTY(&bo->fencedlist) && !bo->shared) + return 0; + memset(&args, 0, sizeof(args)); args.handle = bo->handle; args.domain = 0; @@ -176,6 +185,34 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_BUSY, &args, sizeof(args)); + if (ret == 0) { + struct radeon_bo *entry, *tent; + LIST_FOR_EACH_ENTRY_SAFE(entry, tent, &bo->fencedlist, fencedlist) { + LIST_DELINIT(&entry->fencedlist); + } + } *domain = args.domain; return ret; } + +int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, + uint32_t num_bo) +{ + struct radeon_bo *first; + int i; + + first = bolist[0]; + + if (!LIST_IS_EMPTY(&first->fencedlist)) + LIST_DELINIT(&first->fencedlist); + + LIST_INITHEAD(&first->fencedlist); + + for (i = 1; i < num_bo; i++) { + if (!LIST_IS_EMPTY(&bolist[i]->fencedlist)) + LIST_DELINIT(&bolist[i]->fencedlist); + + LIST_ADDTAIL(&bolist[i]->fencedlist, &first->fencedlist); + } + return 0; +} -- cgit v1.2.3 From 49866c8f34579420a30c33f76cfb2d77bafcdf0a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 15:50:58 +1000 Subject: pb: don't keep checking buffers after first busy If we assume busy buffers are added to the list in order its unlikely we'd fine one after the first busy one that isn't busy. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index b4d81073726..52e626cb44b 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -222,7 +222,7 @@ pb_cache_buffer_vtbl = { }; -static INLINE boolean +static INLINE int pb_cache_is_buffer_compat(struct pb_cache_buffer *buf, pb_size size, const struct pb_desc *desc) @@ -230,26 +230,26 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf, void *map; if(buf->base.base.size < size) - return FALSE; + return 0; /* be lenient with size */ if(buf->base.base.size >= 2*size) - return FALSE; + return 0; if(!pb_check_alignment(desc->alignment, buf->base.base.alignment)) - return FALSE; + return 0; if(!pb_check_usage(desc->usage, buf->base.base.usage)) - return FALSE; + return 0; map = pb_map(buf->buffer, PB_USAGE_DONTBLOCK, NULL); if (!map) { - return FALSE; + return -1; } pb_unmap(buf->buffer); - return TRUE; + return 1; } @@ -263,7 +263,8 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, struct pb_cache_buffer *curr_buf; struct list_head *curr, *next; int64_t now; - + int ret = 0; + pipe_mutex_lock(mgr->mutex); buf = NULL; @@ -274,25 +275,30 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, now = os_time_get(); while(curr != &mgr->delayed) { curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head); - if(!buf && pb_cache_is_buffer_compat(curr_buf, size, desc)) - buf = curr_buf; + if(!buf && (ret = pb_cache_is_buffer_compat(curr_buf, size, desc) > 0)) + buf = curr_buf; else if(os_time_timeout(curr_buf->start, curr_buf->end, now)) - _pb_cache_buffer_destroy(curr_buf); + _pb_cache_buffer_destroy(curr_buf); else /* This buffer (and all hereafter) are still hot in cache */ break; + if (ret == -1) + break; curr = next; next = curr->next; } /* keep searching in the hot buffers */ - if(!buf) { + if(!buf && ret != -1) { while(curr != &mgr->delayed) { curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head); - if(pb_cache_is_buffer_compat(curr_buf, size, desc)) { + ret = pb_cache_is_buffer_compat(curr_buf, size, desc); + if (ret > 0) { buf = curr_buf; break; } + if (ret == -1) + break; /* no need to check the timeout here */ curr = next; next = curr->next; -- cgit v1.2.3 From 05813ad5f440a33cc7e222982a120f62028aa887 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 15:51:38 +1000 Subject: r600g: add bo busy backoff. When we go to do a lot of bos in one draw like constant bufs we need to avoid bouncing off the busy ioctl, this mitigates by backing off on busy bos for a short amount of times. --- src/gallium/winsys/r600/drm/r600_priv.h | 2 ++ src/gallium/winsys/r600/drm/radeon_bo.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 76a7ba9ec25..285a192e743 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -66,6 +66,8 @@ struct radeon_bo { void *data; struct list_head fencedlist; boolean shared; + int64_t last_busy; + boolean set_busy; }; struct r600_bo { diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index 97138f9f9ef..42a23f0ab8f 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -32,6 +32,7 @@ #include "r600_priv.h" #include "xf86drm.h" #include "radeon_drm.h" +#include "util/u_time.h" static int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo) { @@ -170,14 +171,23 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo) return ret; } +#define BO_BUSY_BACKOFF 10000 + int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain) { struct drm_radeon_gem_busy args; int ret; + int64_t now; + now = os_time_get(); if (LIST_IS_EMPTY(&bo->fencedlist) && !bo->shared) return 0; + if (bo->set_busy && (now - bo->last_busy < BO_BUSY_BACKOFF)) + return -EBUSY; + + bo->set_busy = FALSE; + memset(&args, 0, sizeof(args)); args.handle = bo->handle; args.domain = 0; @@ -190,6 +200,9 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain LIST_FOR_EACH_ENTRY_SAFE(entry, tent, &bo->fencedlist, fencedlist) { LIST_DELINIT(&entry->fencedlist); } + } else { + bo->set_busy = TRUE; + bo->last_busy = now; } *domain = args.domain; return ret; -- cgit v1.2.3 From 46997d4fc27e62a1c479f25f5f441b95e6d5cb64 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 15:57:57 +1000 Subject: r600g: drop mman allocator we don't use this since constant buffers are now being used on all gpus. --- src/gallium/winsys/r600/drm/r600_bo.c | 4 +--- src/gallium/winsys/r600/drm/r600_drm.c | 4 ---- src/gallium/winsys/r600/drm/r600_priv.h | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c index 8089c916404..9498f3a82ea 100644 --- a/src/gallium/winsys/r600/drm/r600_bo.c +++ b/src/gallium/winsys/r600/drm/r600_bo.c @@ -39,9 +39,7 @@ struct r600_bo *r600_bo(struct radeon *radeon, desc.usage = usage; ws_bo->size = size; - if (!radeon->use_mem_constant && (usage & PIPE_BIND_CONSTANT_BUFFER)) { - man = radeon->mman; - } else if (usage & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) + if (usage & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) man = radeon->cman; else man = radeon->kman; diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 31fb7d4e0fd..5f175a4df98 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -157,9 +157,6 @@ struct radeon *radeon_new(int fd, unsigned device) break; } - radeon->mman = pb_malloc_bufmgr_create(); - if (!radeon->mman) - return NULL; radeon->kman = radeon_bo_pbmgr_create(radeon); if (!radeon->kman) return NULL; @@ -182,7 +179,6 @@ struct radeon *radeon_decref(struct radeon *radeon) return NULL; } - radeon->mman->destroy(radeon->mman); radeon->cman->destroy(radeon->cman); radeon->kman->destroy(radeon->kman); drmClose(radeon->fd); diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 285a192e743..07e734268d5 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -41,7 +41,6 @@ struct radeon { unsigned family; enum chip_class chip_class; boolean use_mem_constant; /* true for evergreen */ - struct pb_manager *mman; /* malloc manager */ struct pb_manager *kman; /* kernel bo manager */ struct pb_manager *cman; /* cached bo manager */ }; -- cgit v1.2.3 From d2c06b5037fe9282cbbc0c7acd84a1b286716507 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 16:00:23 +1000 Subject: r600g: drop use_mem_constant. since we plan on using dx10 constant buffers everywhere. --- src/gallium/drivers/r600/evergreen_state.c | 1 - src/gallium/drivers/r600/r600_asm.c | 3 +-- src/gallium/drivers/r600/r600_asm.h | 1 - src/gallium/drivers/r600/r600_shader.c | 7 ++----- src/gallium/drivers/r600/r600_shader.h | 1 - src/gallium/drivers/r600/r600_state.c | 1 - src/gallium/winsys/r600/drm/evergreen_hw_context.c | 1 - src/gallium/winsys/r600/drm/r600_hw_context.c | 1 - src/gallium/winsys/r600/drm/r600_priv.h | 1 - 9 files changed, 3 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 06cdd5ffdf3..147d4f372e6 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -971,7 +971,6 @@ static void *evergreen_create_shader_state(struct pipe_context *ctx, struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); int r; - shader->shader.use_mem_constant = TRUE; r = r600_pipe_shader_create(ctx, shader, state->tokens); if (r) { return NULL; diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index f07af8126ce..d13da0ef638 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -465,8 +465,7 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int bc->cf_last->ndw += 2; bc->ndw += 2; - if (bc->use_mem_constant) - bc->cf_last->kcache0_mode = 2; + bc->cf_last->kcache0_mode = 2; /* process cur ALU instructions for bank swizzle */ if (alu->last) { diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index dba60afc528..bebc7c15b00 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -165,7 +165,6 @@ struct r600_cf_callstack { struct r600_bc { enum radeon_family family; int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */ - unsigned use_mem_constant; struct list_head cf; struct r600_bc_cf *cf_last; unsigned ndw; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d7edf6a44fb..016e75bd52b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -498,7 +498,6 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s r = r600_bc_init(ctx.bc, shader->family); if (r) return r; - ctx.bc->use_mem_constant = shader->use_mem_constant; ctx.tokens = tokens; tgsi_scan_shader(tokens, &ctx.info); tgsi_parse_init(&ctx.parse, tokens); @@ -534,10 +533,8 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s ctx.info.file_count[TGSI_FILE_INPUT]; ctx.file_offset[TGSI_FILE_TEMPORARY] = ctx.file_offset[TGSI_FILE_OUTPUT] + ctx.info.file_count[TGSI_FILE_OUTPUT]; - if (ctx.shader->use_mem_constant) - ctx.file_offset[TGSI_FILE_CONSTANT] = 128; - else - ctx.file_offset[TGSI_FILE_CONSTANT] = 256; + + ctx.file_offset[TGSI_FILE_CONSTANT] = 128; ctx.file_offset[TGSI_FILE_IMMEDIATE] = 253; ctx.temp_reg = ctx.file_offset[TGSI_FILE_TEMPORARY] + diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index 06dd65038d5..6e2620f2012 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -43,7 +43,6 @@ struct r600_shader { struct r600_shader_io output[32]; enum radeon_family family; boolean uses_kill; - boolean use_mem_constant; }; int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index f7c77cde944..b55c3450059 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1185,7 +1185,6 @@ static void *r600_create_shader_state(struct pipe_context *ctx, struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader); int r; - shader->shader.use_mem_constant = TRUE; r = r600_pipe_shader_create(ctx, shader, state->tokens); if (r) { return NULL; diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index ff2c48e770e..e51725abb8a 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -511,7 +511,6 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) int r; memset(ctx, 0, sizeof(struct r600_context)); - radeon->use_mem_constant = TRUE; ctx->radeon = radeon; LIST_INITHEAD(&ctx->query_list); diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 822b65facfb..bee0446d58b 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -587,7 +587,6 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) int r; memset(ctx, 0, sizeof(struct r600_context)); - radeon->use_mem_constant = TRUE; ctx->radeon = radeon; LIST_INITHEAD(&ctx->query_list); diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 07e734268d5..ee48754625a 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -40,7 +40,6 @@ struct radeon { unsigned device; unsigned family; enum chip_class chip_class; - boolean use_mem_constant; /* true for evergreen */ struct pb_manager *kman; /* kernel bo manager */ struct pb_manager *cman; /* cached bo manager */ }; -- cgit v1.2.3 From 12be1568d0ad648930a2bb04a10b3181061fa468 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 16:00:48 +1000 Subject: r600g: avoid unneeded bo wait if we know the bo has gone not busy, no need to add another bo wait thanks to Andre (taiu) on irc for pointing this out. --- src/gallium/winsys/r600/drm/radeon_bo_pb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 33964814a02..a3452027f27 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -100,6 +100,10 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, uint32_t domain; if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain)) return NULL; + if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { + return NULL; + } + goto out; } if (buf->bo->data != NULL) { @@ -115,7 +119,7 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, return NULL; } } - +out: LIST_DELINIT(&buf->maplist); return buf->bo->data; } -- cgit v1.2.3 From bf21b7006c63c3dc47045c22d4f372dfe6c7ce67 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 Oct 2010 19:08:41 +1000 Subject: pb: fix numDelayed accounting we weren't decreasing when removing from the list. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index 52e626cb44b..a6eb4039621 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -307,6 +307,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, if(buf) { LIST_DEL(&buf->head); + --mgr->numDelayed; pipe_mutex_unlock(mgr->mutex); /* Increase refcount */ pipe_reference_init(&buf->base.base.reference, 1); -- cgit v1.2.3 From 12d16e5f14237d86315bf5a5d6a7cf0619a7334e Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 5 Oct 2010 08:42:42 -0400 Subject: r600g: store reloc information in bo structure Allow fast lookup of relocation information & id which was a CPU time consumming operation. Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600_hw_context.c | 37 ++++++++++----------------- src/gallium/winsys/r600/drm/r600_priv.h | 2 ++ 2 files changed, 16 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index bee0446d58b..40c612c4eaf 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -707,33 +707,23 @@ out_err: void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo) { struct radeon_bo *bo; - int i, reloc_id; bo = r600_bo_get_bo(rbo); assert(bo != NULL); - for (i = 0, reloc_id = -1; i < ctx->creloc; i++) { - if (ctx->reloc[i].handle == bo->handle) { - reloc_id = i * sizeof(struct r600_reloc) / 4; - /* set PKT3 to point to proper reloc */ - *pm4 = reloc_id; - break; - } - } - if (reloc_id == -1) { - /* add new relocation */ - if (ctx->creloc >= ctx->nreloc) { - r600_context_flush(ctx); - } - reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4; - ctx->reloc[ctx->creloc].handle = bo->handle; - ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM; - ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM; - ctx->reloc[ctx->creloc].flags = 0; - radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); - ctx->creloc++; - /* set PKT3 to point to proper reloc */ - *pm4 = reloc_id; + if (bo->reloc) { + *pm4 = bo->reloc_id; + return; } + bo->reloc = &ctx->reloc[ctx->creloc]; + bo->reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4; + ctx->reloc[ctx->creloc].handle = bo->handle; + ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM; + ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM; + ctx->reloc[ctx->creloc].flags = 0; + radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo); + ctx->creloc++; + /* set PKT3 to point to proper reloc */ + *pm4 = bo->reloc_id; } void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state) @@ -1045,6 +1035,7 @@ void r600_context_flush(struct r600_context *ctx) /* restart */ radeon_bo_fencelist(ctx->radeon, ctx->bo, ctx->creloc); for (int i = 0; i < ctx->creloc; i++) { + ctx->bo[i]->reloc = NULL; radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); } ctx->creloc = 0; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index ee48754625a..46192074328 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -66,6 +66,8 @@ struct radeon_bo { boolean shared; int64_t last_busy; boolean set_busy; + struct r600_reloc *reloc; + unsigned reloc_id; }; struct r600_bo { -- cgit v1.2.3 From 585e4098aa0cb68a2cfce55ced5c585bd20aba24 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 5 Oct 2010 10:29:30 -0400 Subject: r600g: improve bo flushing Flush read cache before writting register. Track flushing inside of a same cs and avoid reflushing same bo if not necessary. Allmost properly force flush if bo rendered too and then use as a texture in same cs (missing pipeline flush dunno if it's needed or not). Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 3 + src/gallium/winsys/r600/drm/evergreen_hw_context.c | 816 ++++++++++---------- src/gallium/winsys/r600/drm/r600_hw_context.c | 820 +++++++++++---------- src/gallium/winsys/r600/drm/r600_priv.h | 8 + 4 files changed, 825 insertions(+), 822 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 8a2e5c514d4..59a255d2fae 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -154,6 +154,8 @@ static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state, struct r600_block_reloc { struct r600_bo *bo; unsigned nreloc; + unsigned flush_flags; + unsigned flush_mask; unsigned bo_pm4_index[R600_BLOCK_MAX_BO]; }; @@ -161,6 +163,7 @@ struct r600_block { unsigned status; unsigned start_offset; unsigned pm4_ndwords; + unsigned pm4_flush_ndwords; unsigned nbo; unsigned nreg; u32 *reg; diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index e51725abb8a..96769add905 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -42,398 +42,398 @@ #define GROUP_FORCE_NEW_BLOCK 0 static const struct r600_reg evergreen_config_reg_list[] = { - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008A14_PA_CL_ENHANCE, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C20_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C24_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C28_SQ_STACK_RESOURCE_MGMT_3, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_009100_SPI_CONFIG_CNTL, 0, 0}, - {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008A14_PA_CL_ENHANCE, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C20_SQ_STACK_RESOURCE_MGMT_1, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C24_SQ_STACK_RESOURCE_MGMT_2, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C28_SQ_STACK_RESOURCE_MGMT_3, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_009100_SPI_CONFIG_CNTL, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0, 0}, }; static const struct r600_reg evergreen_ctl_const_list[] = { - {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0}, - {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0}, + {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0, 0}, + {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0, 0}, }; static const struct r600_reg evergreen_context_reg_list[] = { - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028008_DB_DEPTH_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02800C_DB_RENDER_OVERRIDE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028010_DB_RENDER_OVERRIDE2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028014_DB_HTILE_DATA_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028040_DB_Z_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028044_DB_STENCIL_INFO, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028048_DB_Z_READ_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02804C_DB_STENCIL_READ_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028050_DB_Z_WRITE_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028054_DB_STENCIL_WRITE_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028058_DB_DEPTH_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02805C_DB_DEPTH_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285BC_PA_CL_UCP0_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C0_PA_CL_UCP0_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C4_PA_CL_UCP0_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C8_PA_CL_UCP0_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285CC_PA_CL_UCP1_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D0_PA_CL_UCP1_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D4_PA_CL_UCP1_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D8_PA_CL_UCP1_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285DC_PA_CL_UCP2_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E0_PA_CL_UCP2_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E4_PA_CL_UCP2_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E8_PA_CL_UCP2_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285EC_PA_CL_UCP3_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F0_PA_CL_UCP3_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F4_PA_CL_UCP3_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F8_PA_CL_UCP3_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285FC_PA_CL_UCP4_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028600_PA_CL_UCP4_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028604_PA_CL_UCP4_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028608_PA_CL_UCP4_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02860C_PA_CL_UCP5_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028610_PA_CL_UCP5_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028614_PA_CL_UCP5_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028618_PA_CL_UCP5_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02863C_SPI_VS_OUT_ID_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028640_SPI_VS_OUT_ID_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E0_SPI_BARYC_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E4_SPI_PS_IN_CONTROL_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E8_SPI_COMPUTE_INPUT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028844_SQ_PGM_RESOURCES_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028848_SQ_PGM_RESOURCES_2_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02884C_SQ_PGM_EXPORTS_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02885C_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028860_SQ_PGM_RESOURCES_VS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028864_SQ_PGM_RESOURCES_2_VS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A8_SQ_PGM_RESOURCES_FS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288EC_SQ_LDS_ALLOC_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028900_SQ_ESGS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028904_SQ_GSVS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02891C_SQ_GS_VERT_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MODE_CNTL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028ABC_DB_HTILE_SURFACE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC8_DB_PRELOAD_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B54_VGT_SHADER_STAGES_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B70_DB_ALPHA_TO_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B94_VGT_STRMOUT_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C08_PA_SU_VTX_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C3C_PA_SC_AA_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C60_CB_COLOR0_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C64_CB_COLOR0_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA0_CB_COLOR1_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB4_CB_COLOR1_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D18_CB_COLOR3_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D54_CB_COLOR4_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D90_CB_COLOR5_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DCC_CB_COLOR6_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E08_CB_COLOR7_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E44_CB_COLOR8_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E60_CB_COLOR9_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E7C_CB_COLOR10_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E98_CB_COLOR11_PITCH, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 1, 0}, - {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028008_DB_DEPTH_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02800C_DB_RENDER_OVERRIDE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028010_DB_RENDER_OVERRIDE2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028014_DB_HTILE_DATA_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028040_DB_Z_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028044_DB_STENCIL_INFO, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028048_DB_Z_READ_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02804C_DB_STENCIL_READ_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028050_DB_Z_WRITE_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028054_DB_STENCIL_WRITE_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028058_DB_DEPTH_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02805C_DB_DEPTH_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285BC_PA_CL_UCP0_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C0_PA_CL_UCP0_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C4_PA_CL_UCP0_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C8_PA_CL_UCP0_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285CC_PA_CL_UCP1_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D0_PA_CL_UCP1_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D4_PA_CL_UCP1_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D8_PA_CL_UCP1_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285DC_PA_CL_UCP2_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E0_PA_CL_UCP2_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E4_PA_CL_UCP2_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E8_PA_CL_UCP2_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285EC_PA_CL_UCP3_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F0_PA_CL_UCP3_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F4_PA_CL_UCP3_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F8_PA_CL_UCP3_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285FC_PA_CL_UCP4_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028600_PA_CL_UCP4_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028604_PA_CL_UCP4_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028608_PA_CL_UCP4_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02860C_PA_CL_UCP5_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028610_PA_CL_UCP5_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028614_PA_CL_UCP5_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028618_PA_CL_UCP5_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_4, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_5, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_6, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_7, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02863C_SPI_VS_OUT_ID_8, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028640_SPI_VS_OUT_ID_9, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E0_SPI_BARYC_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E4_SPI_PS_IN_CONTROL_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E8_SPI_COMPUTE_INPUT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028844_SQ_PGM_RESOURCES_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028848_SQ_PGM_RESOURCES_2_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02884C_SQ_PGM_EXPORTS_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02885C_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028860_SQ_PGM_RESOURCES_VS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028864_SQ_PGM_RESOURCES_2_VS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A8_SQ_PGM_RESOURCES_FS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288EC_SQ_LDS_ALLOC_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028900_SQ_ESGS_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028904_SQ_GSVS_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02891C_SQ_GS_VERT_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MODE_CNTL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028ABC_DB_HTILE_SURFACE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC8_DB_PRELOAD_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B54_VGT_SHADER_STAGES_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B70_DB_ALPHA_TO_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B94_VGT_STRMOUT_CONFIG, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C08_PA_SU_VTX_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C3C_PA_SC_AA_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C60_CB_COLOR0_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C64_CB_COLOR0_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA0_CB_COLOR1_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB4_CB_COLOR1_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D18_CB_COLOR3_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D54_CB_COLOR4_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D90_CB_COLOR5_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DCC_CB_COLOR6_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E08_CB_COLOR7_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E44_CB_COLOR8_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E60_CB_COLOR9_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E7C_CB_COLOR10_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E98_CB_COLOR11_PITCH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0, 0}, }; /* SHADER RESOURCE R600/R700 */ static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_resource[] = { - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0}, - {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0, 0}, + {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0, 0}, }; unsigned nreg = Elements(r600_shader_resource); @@ -447,9 +447,9 @@ static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset) static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_sampler[] = { - {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, - {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, - {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0, 0}, + {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0, 0}, }; unsigned nreg = Elements(r600_shader_sampler); @@ -463,11 +463,11 @@ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id) { struct r600_reg r600_shader_sampler_border[] = { - {PKT3_SET_CONFIG_REG, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, - {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0, 0}, }; unsigned nreg = Elements(r600_shader_sampler_border); unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C; @@ -656,7 +656,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } @@ -691,7 +691,7 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } @@ -718,7 +718,7 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } @@ -745,7 +745,7 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr { struct r600_bo *cb[12]; struct r600_bo *db; - unsigned ndwords = 9; + unsigned ndwords = 9, flush; if (draw->indices) { ndwords = 13; @@ -831,31 +831,21 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr /* flush color buffer */ for (int i = 0; i < 12; i++) { if (cb[i]) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - if (i > 7) - ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB8_DEST_BASE_ENA(1) << (i - 8)) | + if (i > 7) { + flush = (S_0085F0_CB8_DEST_BASE_ENA(1) << (i - 8)) | S_0085F0_CB_ACTION_ENA(1); - else - ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + } else { + flush = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | S_0085F0_CB_ACTION_ENA(1); - ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; - ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; - ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); + } + r600_context_bo_flush(ctx, flush, 0, cb[i]); } } if (db) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->pm4_cdwords++] = S_0085F0_DB_DEST_BASE_ENA(1) | - S_0085F0_DB_ACTION_ENA(1); - ctx->pm4[ctx->pm4_cdwords++] = (db->size + 255) >> 8; - ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; - ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], db); + r600_context_bo_flush(ctx, + S_0085F0_DB_ACTION_ENA(1) | + S_0085F0_DB_DEST_BASE_ENA(1), + 0, db); } /* all dirty state have been scheduled in current cs */ @@ -893,7 +883,7 @@ static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 40c612c4eaf..84539d14396 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -94,22 +94,14 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, block->pm4_bo_index[j] = block->nbo; block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0); block->pm4[block->pm4_ndwords++] = 0x00000000; + block->reloc[block->nbo].flush_flags = reg[i+j].flush_flags; + block->reloc[block->nbo].flush_mask = reg[i+j].flush_mask; block->reloc[block->nbo].bo_pm4_index[block->reloc[block->nbo].nreloc++] = block->pm4_ndwords - 1; } } for (j = 0; j < n; j++) { if (reg[i+j].flush_flags) { - unsigned id; - - block->pm4[block->pm4_ndwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - block->pm4[block->pm4_ndwords++] = reg[i+j].flush_flags; - block->pm4[block->pm4_ndwords++] = 0xFFFFFFFF; - block->pm4[block->pm4_ndwords++] = 0x00000000; - block->pm4[block->pm4_ndwords++] = 0x0000000A; - block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0); - block->pm4[block->pm4_ndwords++] = 0x00000000; - id = block->pm4_bo_index[j]; - block->reloc[id].bo_pm4_index[block->reloc[id].nreloc++] = block->pm4_ndwords - 1; + block->pm4_flush_ndwords += 7; } } /* check that we stay in limit */ @@ -120,386 +112,386 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, /* R600/R700 configuration */ static const struct r600_reg r600_config_reg_list[] = { - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C10_SQ_STACK_RESOURCE_MGMT_1, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C14_SQ_STACK_RESOURCE_MGMT_2, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009508_TA_CNTL_AUX, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009714_VC_ENHANCE, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009830_DB_DEBUG, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C10_SQ_STACK_RESOURCE_MGMT_1, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C14_SQ_STACK_RESOURCE_MGMT_2, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009508_TA_CNTL_AUX, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009714_VC_ENHANCE, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009830_DB_DEBUG, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0, 0}, }; static const struct r600_reg r600_ctl_const_list[] = { - {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0}, - {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0}, + {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0, 0}, + {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0, 0}, }; static const struct r600_reg r600_context_reg_list[] = { - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB0_VGT_STRMOUT_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028B20_VGT_STRMOUT_BUFFER_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E0_CB_COLOR0_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C0_CB_COLOR0_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028100_CB_COLOR0_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E4_CB_COLOR1_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C4_CB_COLOR1_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028104_CB_COLOR1_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E8_CB_COLOR2_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C8_CB_COLOR2_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028108_CB_COLOR2_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280EC_CB_COLOR3_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280CC_CB_COLOR3_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02810C_CB_COLOR3_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F0_CB_COLOR4_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D0_CB_COLOR4_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028110_CB_COLOR4_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F4_CB_COLOR5_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F8_CB_COLOR6_FRAG, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D8_CB_COLOR6_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028118_CB_COLOR6_MASK, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, 1, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280DC_CB_COLOR7_TILE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02811C_CB_COLOR7_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028120_CB_CLEAR_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1)}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028424_CB_FOG_RED, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028428_CB_FOG_GREEN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02842C_CB_FOG_BLUE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E0_SPI_FOG_FUNC_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E4_SPI_FOG_FUNC_BIAS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0287A0_CB_SHADER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028804_CB_BLEND_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C30_CB_CLRCMP_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C34_CB_CLRCMP_SRC, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C38_CB_CLRCMP_DST, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C3C_CB_CLRCMP_MSK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C48_PA_SC_AA_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D44_DB_ALPHA_TO_MASK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02800C_DB_DEPTH_BASE, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028000_DB_DEPTH_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028004_DB_DEPTH_VIEW, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028010_DB_DEPTH_INFO, 1, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D0C_DB_RENDER_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D10_DB_RENDER_OVERRIDE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D24_DB_HTILE_SURFACE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D30_DB_PRELOAD_CONTROL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D34_DB_PREFETCH_LIMIT, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A0C_PA_SC_LINE_STIPPLE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MPASS_PS_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E20_PA_CL_UCP0_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E24_PA_CL_UCP0_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E28_PA_CL_UCP0_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E2C_PA_CL_UCP0_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E30_PA_CL_UCP1_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E34_PA_CL_UCP1_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E38_PA_CL_UCP1_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E3C_PA_CL_UCP1_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E40_PA_CL_UCP2_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E44_PA_CL_UCP2_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E48_PA_CL_UCP2_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E4C_PA_CL_UCP2_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E50_PA_CL_UCP3_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E54_PA_CL_UCP3_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E58_PA_CL_UCP3_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E5C_PA_CL_UCP3_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E60_PA_CL_UCP4_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E64_PA_CL_UCP4_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E68_PA_CL_UCP4_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E6C_PA_CL_UCP4_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E70_PA_CL_UCP5_X, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E74_PA_CL_UCP5_Y, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E78_PA_CL_UCP5_Z, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E7C_PA_CL_UCP5_W, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028614_SPI_VS_OUT_ID_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028618_SPI_VS_OUT_ID_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028858_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028868_SQ_PGM_RESOURCES_VS, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028894_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_RESOURCES_FS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1)}, - {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028850_SQ_PGM_RESOURCES_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028854_SQ_PGM_EXPORTS_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A84_VGT_PRIMITIVEID_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0, 0}, - {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB0_VGT_STRMOUT_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028B20_VGT_STRMOUT_BUFFER_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E0_CB_COLOR0_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C0_CB_COLOR0_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028100_CB_COLOR0_MASK, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E4_CB_COLOR1_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C4_CB_COLOR1_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028104_CB_COLOR1_MASK, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E8_CB_COLOR2_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C8_CB_COLOR2_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028108_CB_COLOR2_MASK, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280EC_CB_COLOR3_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280CC_CB_COLOR3_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02810C_CB_COLOR3_MASK, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F0_CB_COLOR4_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D0_CB_COLOR4_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028110_CB_COLOR4_MASK, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F4_CB_COLOR5_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F8_CB_COLOR6_FRAG, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D8_CB_COLOR6_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028118_CB_COLOR6_MASK, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, 1, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 1, 0, 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280DC_CB_COLOR7_TILE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02811C_CB_COLOR7_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028120_CB_CLEAR_RED, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028424_CB_FOG_RED, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028428_CB_FOG_GREEN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02842C_CB_FOG_BLUE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E0_SPI_FOG_FUNC_SCALE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E4_SPI_FOG_FUNC_BIAS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0287A0_CB_SHADER_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028804_CB_BLEND_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C30_CB_CLRCMP_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C34_CB_CLRCMP_SRC, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C38_CB_CLRCMP_DST, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C3C_CB_CLRCMP_MSK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C48_PA_SC_AA_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D44_DB_ALPHA_TO_MASK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02800C_DB_DEPTH_BASE, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028000_DB_DEPTH_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028004_DB_DEPTH_VIEW, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028010_DB_DEPTH_INFO, 1, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D0C_DB_RENDER_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D10_DB_RENDER_OVERRIDE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D24_DB_HTILE_SURFACE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D30_DB_PRELOAD_CONTROL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D34_DB_PREFETCH_LIMIT, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A0C_PA_SC_LINE_STIPPLE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MPASS_PS_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E20_PA_CL_UCP0_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E24_PA_CL_UCP0_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E28_PA_CL_UCP0_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E2C_PA_CL_UCP0_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E30_PA_CL_UCP1_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E34_PA_CL_UCP1_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E38_PA_CL_UCP1_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E3C_PA_CL_UCP1_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E40_PA_CL_UCP2_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E44_PA_CL_UCP2_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E48_PA_CL_UCP2_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E4C_PA_CL_UCP2_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E50_PA_CL_UCP3_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E54_PA_CL_UCP3_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E58_PA_CL_UCP3_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E5C_PA_CL_UCP3_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E60_PA_CL_UCP4_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E64_PA_CL_UCP4_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E68_PA_CL_UCP4_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E6C_PA_CL_UCP4_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E70_PA_CL_UCP5_X, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E74_PA_CL_UCP5_Y, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E78_PA_CL_UCP5_Z, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E7C_PA_CL_UCP5_W, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028614_SPI_VS_OUT_ID_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028618_SPI_VS_OUT_ID_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_4, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_5, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_6, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_7, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_8, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_9, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028858_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028868_SQ_PGM_RESOURCES_VS, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028894_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_RESOURCES_FS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0, 0}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF}, + {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028850_SQ_PGM_RESOURCES_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028854_SQ_PGM_EXPORTS_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A84_VGT_PRIMITIVEID_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0, 0, 0}, + {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0, 0}, }; /* SHADER RESOURCE R600/R700 */ static int r600_state_resource_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_resource[] = { - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038000_RESOURCE0_WORD0, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038004_RESOURCE0_WORD1, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_03800C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1)}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038010_RESOURCE0_WORD4, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0}, - {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038000_RESOURCE0_WORD0, 0, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038004_RESOURCE0_WORD1, 0, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_03800C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038010_RESOURCE0_WORD4, 0, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0, 0}, + {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0, 0}, }; unsigned nreg = Elements(r600_shader_resource); @@ -513,9 +505,9 @@ static int r600_state_resource_init(struct r600_context *ctx, u32 offset) static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_sampler[] = { - {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0}, - {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0}, - {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0, 0}, + {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0, 0}, }; unsigned nreg = Elements(r600_shader_sampler); @@ -529,10 +521,10 @@ static int r600_state_sampler_init(struct r600_context *ctx, u32 offset) static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset) { struct r600_reg r600_shader_sampler_border[] = { - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A400_TD_PS_SAMPLER0_BORDER_RED, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0}, - {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A400_TD_PS_SAMPLER0_BORDER_RED, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0, 0}, + {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0, 0}, }; unsigned nreg = Elements(r600_shader_sampler_border); @@ -554,6 +546,7 @@ static int r600_loop_const_init(struct r600_context *ctx, u32 offset) r600_loop_consts[i].offset = R600_LOOP_CONST_OFFSET + ((offset + i) * 4); r600_loop_consts[i].need_bo = 0; r600_loop_consts[i].flush_flags = 0; + r600_loop_consts[i].flush_mask = 0; } return r600_context_add_block(ctx, r600_loop_consts, nreg); } @@ -704,6 +697,27 @@ out_err: return r; } +void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags, + unsigned flush_mask, struct r600_bo *rbo) +{ + struct radeon_bo *bo; + + bo = r600_bo_get_bo(rbo); + /* if bo has already been flush */ + if (!(bo->last_flush ^ flush_flags)) { + bo->last_flush &= flush_mask; + return; + } + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); + ctx->pm4[ctx->pm4_cdwords++] = flush_flags; + ctx->pm4[ctx->pm4_cdwords++] = (bo->size + 255) >> 8; + ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; + ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = bo->reloc_id; + bo->last_flush = (bo->last_flush | flush_flags) & flush_mask; +} + void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo) { struct radeon_bo *bo; @@ -747,7 +761,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } } @@ -788,7 +802,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } @@ -823,7 +837,7 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } @@ -848,7 +862,7 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords; + ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; } } @@ -976,27 +990,14 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) /* flush color buffer */ for (int i = 0; i < 8; i++) { if (cb[i]) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | - S_0085F0_CB_ACTION_ENA(1); - ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8; - ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; - ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]); + r600_context_bo_flush(ctx, + (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | + S_0085F0_CB_ACTION_ENA(1), + 0, cb[i]); } } if (db) { - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); - ctx->pm4[ctx->pm4_cdwords++] = S_0085F0_DB_DEST_BASE_ENA(1) | - S_0085F0_DB_ACTION_ENA(1); - ctx->pm4[ctx->pm4_cdwords++] = (db->size + 255) >> 8; - ctx->pm4[ctx->pm4_cdwords++] = 0x00000000; - ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A; - ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); - ctx->pm4[ctx->pm4_cdwords++] = 0; - r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], db); + r600_context_bo_flush(ctx, S_0085F0_DB_ACTION_ENA(1), 0, db); } /* all dirty state have been scheduled in current cs */ @@ -1036,6 +1037,7 @@ void r600_context_flush(struct r600_context *ctx) radeon_bo_fencelist(ctx->radeon, ctx->bo, ctx->creloc); for (int i = 0; i < ctx->creloc; i++) { ctx->bo[i]->reloc = NULL; + ctx->bo[i]->last_flush = 0; radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL); } ctx->creloc = 0; @@ -1050,7 +1052,7 @@ void r600_context_flush(struct r600_context *ctx) */ for (int i = 0; i < ctx->nblocks; i++) { if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) { - ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords; + ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords + ctx->blocks[i]->pm4_flush_ndwords; ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY; } } diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 46192074328..f6ceb0adc36 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -53,6 +53,7 @@ struct r600_reg { unsigned offset; unsigned need_bo; unsigned flush_flags; + unsigned flush_mask; }; struct radeon_bo { @@ -68,6 +69,7 @@ struct radeon_bo { boolean set_busy; struct r600_reloc *reloc; unsigned reloc_id; + unsigned last_flush; }; struct r600_bo { @@ -102,6 +104,8 @@ struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr /* r600_hw_context.c */ void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo); +void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags, + unsigned flush_mask, struct r600_bo *rbo); struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset); int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg); @@ -148,6 +152,10 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc r600_context_bo_reloc(ctx, &block->pm4[block->reloc[id].bo_pm4_index[k]], block->reloc[id].bo); + r600_context_bo_flush(ctx, + block->reloc[id].flush_flags, + block->reloc[id].flush_mask, + block->reloc[id].bo); } } } -- cgit v1.2.3 From 71fd35d1adeb63bc64ee31cae2499f896d72dfb1 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Tue, 5 Oct 2010 11:26:43 +0200 Subject: nv50: fix always true conditional in shader optimization --- src/gallium/drivers/nv50/nv50_pc_optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c index 921ed156919..27eb3817bf1 100644 --- a/src/gallium/drivers/nv50/nv50_pc_optimize.c +++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c @@ -452,7 +452,7 @@ nv_pass_lower_mods(struct nv_pass *ctx, struct nv_basic_block *b) if (nvi->opcode == NV_OP_SAT) { mi = nvi->src[0]->value->insn; - if (mi->opcode != NV_OP_ADD || mi->opcode != NV_OP_MAD) + if (mi->opcode != NV_OP_ADD && mi->opcode != NV_OP_MAD) continue; if (mi->flags_def || mi->def[0]->refc > 1) continue; -- cgit v1.2.3 From ac8a1ebe55b08180945ffaebcff6b3bed336c9ec Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Tue, 5 Oct 2010 21:01:43 +0200 Subject: r600g: use dirty list to track dirty blocks Got a speed up by tracking the dirty blocks in a seperate list instead of looping through all blocks. This version should work with block that get their dirty state disabled again and I added a dirty check during the flush as some blocks were already dirty. --- src/gallium/drivers/r600/r600.h | 2 ++ src/gallium/winsys/r600/drm/evergreen_hw_context.c | 18 ++++++++++++++---- src/gallium/winsys/r600/drm/r600_hw_context.c | 20 ++++++++++++++++---- src/gallium/winsys/r600/drm/r600_priv.h | 1 + 4 files changed, 33 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 59a255d2fae..acacec0c413 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -160,6 +160,7 @@ struct r600_block_reloc { }; struct r600_block { + struct list_head list; unsigned status; unsigned start_offset; unsigned pm4_ndwords; @@ -221,6 +222,7 @@ struct r600_context { struct r600_range range[256]; unsigned nblocks; struct r600_block **blocks; + struct list_head dirty; unsigned pm4_ndwords; unsigned pm4_cdwords; unsigned pm4_dirty_cdwords; diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 96769add905..1355b079450 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -613,6 +613,9 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) r = -ENOMEM; goto out_err; } + + /* init dirty list */ + LIST_INITHEAD(&ctx->dirty); return 0; out_err: r600_context_fini(ctx); @@ -630,6 +633,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + LIST_DEL(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -657,6 +661,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } @@ -683,6 +688,7 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + LIST_DEL(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -692,6 +698,7 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } @@ -705,6 +712,7 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + LIST_DEL(&block->list); return; } if (state->nregs <= 3) { @@ -719,6 +727,7 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } @@ -746,6 +755,7 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr struct r600_bo *cb[12]; struct r600_bo *db; unsigned ndwords = 9, flush; + struct r600_block *dirty_block; if (draw->indices) { ndwords = 13; @@ -800,11 +810,10 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } /* enough room to copy packet */ - for (int i = 0; i < ctx->nblocks; i++) { - if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { - r600_context_block_emit_dirty(ctx, ctx->blocks[i]); - } + LIST_FOR_EACH_ENTRY(dirty_block,&ctx->dirty,list) { + r600_context_block_emit_dirty(ctx, dirty_block); } + LIST_INITHEAD(&ctx->dirty); /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -884,6 +893,7 @@ static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_ block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 84539d14396..5019c26df05 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -691,6 +691,9 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) r = -ENOMEM; goto out_err; } + + /* init dirty list */ + LIST_INITHEAD(&ctx->dirty); return 0; out_err: r600_context_fini(ctx); @@ -762,6 +765,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } } @@ -777,6 +781,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); + LIST_DEL(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -803,6 +808,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } @@ -829,6 +835,7 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + LIST_DEL(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -838,6 +845,7 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } @@ -850,6 +858,7 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); + LIST_DEL(&block->list); return; } if (state->nregs <= 3) { @@ -863,6 +872,7 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } @@ -907,6 +917,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) struct r600_bo *cb[8]; struct r600_bo *db; unsigned ndwords = 9; + struct r600_block *dirty_block; if (draw->indices) { ndwords = 13; @@ -959,11 +970,10 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } /* enough room to copy packet */ - for (int i = 0; i < ctx->nblocks; i++) { - if (ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY) { - r600_context_block_emit_dirty(ctx, ctx->blocks[i]); - } + LIST_FOR_EACH_ENTRY(dirty_block,&ctx->dirty,list) { + r600_context_block_emit_dirty(ctx, dirty_block); } + LIST_INITHEAD(&ctx->dirty); /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -1052,6 +1062,8 @@ void r600_context_flush(struct r600_context *ctx) */ for (int i = 0; i < ctx->nblocks; i++) { if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) { + if(!(ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY)) + LIST_ADDTAIL(&ctx->blocks[i]->list,&ctx->dirty); ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords + ctx->blocks[i]->pm4_flush_ndwords; ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY; } diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index f6ceb0adc36..9a38cc51f70 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -137,6 +137,7 @@ static void inline r600_context_reg(struct r600_context *ctx, ctx->pm4_dirty_cdwords += block->pm4_ndwords; block->status |= R600_BLOCK_STATUS_ENABLED; block->status |= R600_BLOCK_STATUS_DIRTY; + LIST_ADDTAIL(&block->list,&ctx->dirty); } } -- cgit v1.2.3 From 2cf3199ee3b0014bc426bc3163dfa279c00eabb3 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 5 Oct 2010 15:23:07 -0400 Subject: r600g: simplify block relocation Since flush rework there could be only one relocation per register in a block. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 5 ++--- src/gallium/winsys/r600/drm/r600_hw_context.c | 2 +- src/gallium/winsys/r600/drm/r600_priv.h | 14 ++++++-------- 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index acacec0c413..630177d6add 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -152,11 +152,10 @@ static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state, #define R600_BLOCK_STATUS_DIRTY (1 << 1) struct r600_block_reloc { - struct r600_bo *bo; - unsigned nreloc; + struct r600_bo *bo; unsigned flush_flags; unsigned flush_mask; - unsigned bo_pm4_index[R600_BLOCK_MAX_BO]; + unsigned bo_pm4_index; }; struct r600_block { diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 5019c26df05..b379499f060 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -96,7 +96,7 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, block->pm4[block->pm4_ndwords++] = 0x00000000; block->reloc[block->nbo].flush_flags = reg[i+j].flush_flags; block->reloc[block->nbo].flush_mask = reg[i+j].flush_mask; - block->reloc[block->nbo].bo_pm4_index[block->reloc[block->nbo].nreloc++] = block->pm4_ndwords - 1; + block->reloc[block->nbo].bo_pm4_index = block->pm4_ndwords - 1; } } for (j = 0; j < n; j++) { diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 9a38cc51f70..ea2cf347785 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -149,15 +149,13 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc if (block->pm4_bo_index[j]) { /* find relocation */ id = block->pm4_bo_index[j]; - for (int k = 0; k < block->reloc[id].nreloc; k++) { - r600_context_bo_reloc(ctx, - &block->pm4[block->reloc[id].bo_pm4_index[k]], + r600_context_bo_reloc(ctx, + &block->pm4[block->reloc[id].bo_pm4_index], + block->reloc[id].bo); + r600_context_bo_flush(ctx, + block->reloc[id].flush_flags, + block->reloc[id].flush_mask, block->reloc[id].bo); - r600_context_bo_flush(ctx, - block->reloc[id].flush_flags, - block->reloc[id].flush_mask, - block->reloc[id].bo); - } } } memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); -- cgit v1.2.3 From 3d6eec0a87ee5549e817cdabb4b6424960678189 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 Oct 2010 14:32:59 -0600 Subject: st/mesa: replace assertion w/ conditional in framebuffer invalidation https://bugs.freedesktop.org/show_bug.cgi?id=30632 NOTE: this is a candidate for the 7.9 branch. --- src/mesa/state_tracker/st_manager.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 66e32b4c9e8..cd418a03661 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -486,9 +486,18 @@ st_context_notify_invalid_framebuffer(struct st_context_iface *stctxi, stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer); if (!stfb || stfb->iface != stfbi) stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer); - assert(stfb && stfb->iface == stfbi); - p_atomic_set(&stfb->revalidate, TRUE); + if (stfb && stfb->iface == stfbi) { + p_atomic_set(&stfb->revalidate, TRUE); + } + else { + /* This function is probably getting called when we've detected a + * change in a window's size but the currently bound context is + * not bound to that window. + * If the st_framebuffer_iface structure had a pointer to the + * corresponding st_framebuffer we'd be able to handle this. + */ + } } static void -- cgit v1.2.3 From ea5a74fb5892c9b6ca62054be2ee83a743103f4c Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 5 Oct 2010 16:14:11 -0400 Subject: r600g: userspace fence to avoid kernel call for testing bo busy status Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600.h | 4 ++ src/gallium/winsys/r600/drm/evergreen_hw_context.c | 7 +++ src/gallium/winsys/r600/drm/r600_hw_context.c | 73 +++++++++++++++++++++- src/gallium/winsys/r600/drm/r600_priv.h | 5 +- src/gallium/winsys/r600/drm/r600d.h | 1 + src/gallium/winsys/r600/drm/radeon_bo.c | 60 +++++------------- 6 files changed, 103 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 630177d6add..24e25cec0db 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -233,6 +233,10 @@ struct r600_context { u32 *pm4; struct list_head query_list; unsigned num_query_running; + unsigned fence; + struct list_head fenced_bo; + unsigned *cfence; + struct r600_bo *fence_bo; }; struct r600_draw { diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 1355b079450..2093a2d09c1 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -613,6 +613,13 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) r = -ENOMEM; goto out_err; } + /* save 16dwords space for fence mecanism */ + ctx->pm4_ndwords -= 16; + + r = r600_context_init_fence(ctx); + if (r) { + goto out_err; + } /* init dirty list */ LIST_INITHEAD(&ctx->dirty); diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index b379499f060..7d81d734571 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -41,6 +41,44 @@ #define GROUP_FORCE_NEW_BLOCK 0 +int r600_context_init_fence(struct r600_context *ctx) +{ + ctx->fence = 1; + ctx->fence_bo = r600_bo(ctx->radeon, 4096, 0, 0); + if (ctx->fence_bo == NULL) { + return -ENOMEM; + } + ctx->cfence = r600_bo_map(ctx->radeon, ctx->fence_bo, PB_USAGE_UNSYNCHRONIZED, NULL); + *ctx->cfence = 0; + LIST_INITHEAD(&ctx->fenced_bo); + return 0; +} + +static void INLINE r600_context_update_fenced_list(struct r600_context *ctx) +{ + for (int i = 0; i < ctx->creloc; i++) { + if (!LIST_IS_EMPTY(&ctx->bo[i]->fencedlist)) + LIST_DELINIT(&ctx->bo[i]->fencedlist); + LIST_ADDTAIL(&ctx->bo[i]->fencedlist, &ctx->fenced_bo); + ctx->bo[i]->fence = ctx->fence; + ctx->bo[i]->ctx = ctx; + } +} + +static void INLINE r600_context_fence_wraparound(struct r600_context *ctx, unsigned fence) +{ + struct radeon_bo *bo, *tmp; + + LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &ctx->fenced_bo, fencedlist) { + if (bo->fence <= *ctx->cfence) { + LIST_DELINIT(&bo->fencedlist); + bo->fence = 0; + } else { + bo->fence = fence; + } + } +} + int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg) { struct r600_block *block; @@ -572,6 +610,9 @@ void r600_context_fini(struct r600_context *ctx) } free(ctx->reloc); free(ctx->pm4); + if (ctx->fence_bo) { + r600_bo_reference(ctx->radeon, &ctx->fence_bo, NULL); + } memset(ctx, 0, sizeof(struct r600_context)); } @@ -691,6 +732,13 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) r = -ENOMEM; goto out_err; } + /* save 16dwords space for fence mecanism */ + ctx->pm4_ndwords -= 16; + + r = r600_context_init_fence(ctx); + if (r) { + goto out_err; + } /* init dirty list */ LIST_INITHEAD(&ctx->dirty); @@ -1019,6 +1067,7 @@ void r600_context_flush(struct r600_context *ctx) struct drm_radeon_cs drmib; struct drm_radeon_cs_chunk chunks[2]; uint64_t chunk_array[2]; + unsigned fence; int r; if (!ctx->pm4_cdwords) @@ -1028,6 +1077,18 @@ void r600_context_flush(struct r600_context *ctx) r600_context_queries_suspend(ctx); radeon_bo_pbmgr_flush_maps(ctx->radeon->kman); + + /* emit fence */ + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4); + ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT | (5 << 8); + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24); + ctx->pm4[ctx->pm4_cdwords++] = ctx->fence; + ctx->pm4[ctx->pm4_cdwords++] = 0; + ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0); + ctx->pm4[ctx->pm4_cdwords++] = 0; + r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], ctx->fence_bo); + #if 1 /* emit cs */ drmib.num_chunks = 2; @@ -1043,8 +1104,18 @@ void r600_context_flush(struct r600_context *ctx) r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib, sizeof(struct drm_radeon_cs)); #endif + + r600_context_update_fenced_list(ctx); + + fence = ctx->fence + 1; + if (fence < ctx->fence) { + /* wrap around */ + fence = 1; + r600_context_fence_wraparound(ctx, fence); + } + ctx->fence = fence; + /* restart */ - radeon_bo_fencelist(ctx->radeon, ctx->bo, ctx->creloc); for (int i = 0; i < ctx->creloc; i++) { ctx->bo[i]->reloc = NULL; ctx->bo[i]->last_flush = 0; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index ea2cf347785..a693a5b5ab8 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -64,9 +64,9 @@ struct radeon_bo { unsigned map_count; void *data; struct list_head fencedlist; + unsigned fence; + struct r600_context *ctx; boolean shared; - int64_t last_busy; - boolean set_busy; struct r600_reloc *reloc; unsigned reloc_id; unsigned last_flush; @@ -103,6 +103,7 @@ struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr uint32_t handle); /* r600_hw_context.c */ +int r600_context_init_fence(struct r600_context *ctx); void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo); void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags, unsigned flush_mask, struct r600_bo *rbo); diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index ccc9ffaf8e3..d91f7737af3 100644 --- a/src/gallium/winsys/r600/drm/r600d.h +++ b/src/gallium/winsys/r600/drm/r600d.h @@ -91,6 +91,7 @@ #define PKT3_SET_CTL_CONST 0x6F #define PKT3_SURFACE_BASE_UPDATE 0x73 +#define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14 #define EVENT_TYPE_ZPASS_DONE 0x15 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16 diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index 42a23f0ab8f..836d5d77e09 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -128,7 +128,6 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, return bo; } - static void radeon_bo_destroy(struct radeon *radeon, struct radeon_bo *bo) { struct drm_gem_close args; @@ -158,8 +157,14 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo) struct drm_radeon_gem_wait_idle args; int ret; - if (LIST_IS_EMPTY(&bo->fencedlist) && !bo->shared) + if (!bo->fence && !bo->shared) + return 0; + + if (bo->fence <= *bo->ctx->cfence) { + LIST_DELINIT(&bo->fencedlist); + bo->fence = 0; return 0; + } /* Zero out args to make valgrind happy */ memset(&args, 0, sizeof(args)); @@ -171,22 +176,20 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo) return ret; } -#define BO_BUSY_BACKOFF 10000 - int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain) { struct drm_radeon_gem_busy args; int ret; - int64_t now; - - now = os_time_get(); - if (LIST_IS_EMPTY(&bo->fencedlist) && !bo->shared) - return 0; - - if (bo->set_busy && (now - bo->last_busy < BO_BUSY_BACKOFF)) - return -EBUSY; - bo->set_busy = FALSE; + if (!bo->shared) { + if (!bo->fence) + return 0; + if (bo->fence <= *bo->ctx->cfence) { + LIST_DELINIT(&bo->fencedlist); + bo->fence = 0; + return 0; + } + } memset(&args, 0, sizeof(args)); args.handle = bo->handle; @@ -195,37 +198,6 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_BUSY, &args, sizeof(args)); - if (ret == 0) { - struct radeon_bo *entry, *tent; - LIST_FOR_EACH_ENTRY_SAFE(entry, tent, &bo->fencedlist, fencedlist) { - LIST_DELINIT(&entry->fencedlist); - } - } else { - bo->set_busy = TRUE; - bo->last_busy = now; - } *domain = args.domain; return ret; } - -int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, - uint32_t num_bo) -{ - struct radeon_bo *first; - int i; - - first = bolist[0]; - - if (!LIST_IS_EMPTY(&first->fencedlist)) - LIST_DELINIT(&first->fencedlist); - - LIST_INITHEAD(&first->fencedlist); - - for (i = 1; i < num_bo; i++) { - if (!LIST_IS_EMPTY(&bolist[i]->fencedlist)) - LIST_DELINIT(&bolist[i]->fencedlist); - - LIST_ADDTAIL(&bolist[i]->fencedlist, &first->fencedlist); - } - return 0; -} -- cgit v1.2.3 From 9528fc2107d4cae39bc932c1943ffc57ebc92499 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 09:21:16 +1000 Subject: r600g: add evergreen stencil support. this sets the stencil up for evergreen properly. --- src/gallium/drivers/r600/eg_state_inlines.h | 8 ++++++++ src/gallium/drivers/r600/evergreen_state.c | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 81094904485..d7a880f5d3a 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -276,6 +276,14 @@ static inline uint32_t r600_translate_dbformat(enum pipe_format format) } } +static inline uint32_t r600_translate_stencilformat(enum pipe_format format) +{ + if (format == PIPE_FORMAT_Z24_UNORM_S8_USCALED) + return 1; + else + return 0; +} + static inline uint32_t r600_translate_colorswap(enum pipe_format format) { switch (format) { diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 147d4f372e6..603a8a7b915 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -795,7 +795,7 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state struct r600_resource_texture *rtex; struct r600_resource *rbuffer; unsigned level; - unsigned pitch, slice, format; + unsigned pitch, slice, format, stencil_format; if (state->zsbuf == NULL) return; @@ -811,13 +811,27 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1; slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); + stencil_format = r600_translate_stencilformat(state->zsbuf->texture->format); r600_pipe_state_add_reg(rstate, R_028048_DB_Z_READ_BASE, (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); r600_pipe_state_add_reg(rstate, R_028050_DB_Z_WRITE_BASE, (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); -// r600_pipe_state_add_reg(rstate, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo); + + if (stencil_format) { + uint32_t stencil_offset; + + stencil_offset = ((state->zsbuf->height * rtex->pitch[level]) + 255) & ~255; + r600_pipe_state_add_reg(rstate, R_02804C_DB_STENCIL_READ_BASE, + (state->zsbuf->offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_028054_DB_STENCIL_WRITE_BASE, + (state->zsbuf->offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo); + } + r600_pipe_state_add_reg(rstate, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028044_DB_STENCIL_INFO, + S_028044_FORMAT(stencil_format), 0xFFFFFFFF, rbuffer->bo); + r600_pipe_state_add_reg(rstate, R_028040_DB_Z_INFO, S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format), 0xFFFFFFFF, rbuffer->bo); -- cgit v1.2.3 From 5661e51c01cec8d8f4a1400300ced8f8f07eaff3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 4 Oct 2010 17:05:03 +0100 Subject: retrace: Handle clear_render_target and clear_depth_stencil. --- src/gallium/tests/python/retrace/interpreter.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/gallium/tests/python/retrace/interpreter.py b/src/gallium/tests/python/retrace/interpreter.py index 16132abb06d..954a701a53f 100755 --- a/src/gallium/tests/python/retrace/interpreter.py +++ b/src/gallium/tests/python/retrace/interpreter.py @@ -610,6 +610,15 @@ class Context(Object): _rgba[i] = rgba[i] self.real.clear(buffers, _rgba, depth, stencil) + def clear_render_target(self, dst, rgba, dstx, dsty, width, height): + _rgba = gallium.FloatArray(4) + for i in range(4): + _rgba[i] = rgba[i] + self.real.clear_render_target(dst, _rgba, dstx, dsty, width, height) + + def clear_depth_stencil(self, dst, clear_flags, depth, stencil, dstx, dsty, width, height): + self.real.clear_depth_stencil(dst, clear_flags, depth, stencil, dstx, dsty, width, height) + def _present(self): self.real.flush() -- cgit v1.2.3 From 591e1bc34f5a5dd065614deae41b59682f59ac08 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 3 Oct 2010 11:39:02 +0100 Subject: llvmpipe: make debug_fs_variant respect variant->nr_samplers --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 48 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index f0a15e11b9b..5a561f9abd1 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -782,31 +782,29 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key) debug_printf("blend.alpha_dst_factor = %s\n", util_dump_blend_factor(key->blend.rt[0].alpha_dst_factor, TRUE)); } debug_printf("blend.colormask = 0x%x\n", key->blend.rt[0].colormask); - for (i = 0; i < PIPE_MAX_SAMPLERS; ++i) { - if (key->sampler[i].format) { - debug_printf("sampler[%u] = \n", i); - debug_printf(" .format = %s\n", - util_format_name(key->sampler[i].format)); - debug_printf(" .target = %s\n", - util_dump_tex_target(key->sampler[i].target, TRUE)); - debug_printf(" .pot = %u %u %u\n", - key->sampler[i].pot_width, - key->sampler[i].pot_height, - key->sampler[i].pot_depth); - debug_printf(" .wrap = %s %s %s\n", - util_dump_tex_wrap(key->sampler[i].wrap_s, TRUE), - util_dump_tex_wrap(key->sampler[i].wrap_t, TRUE), - util_dump_tex_wrap(key->sampler[i].wrap_r, TRUE)); - debug_printf(" .min_img_filter = %s\n", - util_dump_tex_filter(key->sampler[i].min_img_filter, TRUE)); - debug_printf(" .min_mip_filter = %s\n", - util_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE)); - debug_printf(" .mag_img_filter = %s\n", - util_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE)); - if (key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE) - debug_printf(" .compare_func = %s\n", util_dump_func(key->sampler[i].compare_func, TRUE)); - debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords); - } + for (i = 0; i < key->nr_samplers; ++i) { + debug_printf("sampler[%u] = \n", i); + debug_printf(" .format = %s\n", + util_format_name(key->sampler[i].format)); + debug_printf(" .target = %s\n", + util_dump_tex_target(key->sampler[i].target, TRUE)); + debug_printf(" .pot = %u %u %u\n", + key->sampler[i].pot_width, + key->sampler[i].pot_height, + key->sampler[i].pot_depth); + debug_printf(" .wrap = %s %s %s\n", + util_dump_tex_wrap(key->sampler[i].wrap_s, TRUE), + util_dump_tex_wrap(key->sampler[i].wrap_t, TRUE), + util_dump_tex_wrap(key->sampler[i].wrap_r, TRUE)); + debug_printf(" .min_img_filter = %s\n", + util_dump_tex_filter(key->sampler[i].min_img_filter, TRUE)); + debug_printf(" .min_mip_filter = %s\n", + util_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE)); + debug_printf(" .mag_img_filter = %s\n", + util_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE)); + if (key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE) + debug_printf(" .compare_func = %s\n", util_dump_func(key->sampler[i].compare_func, TRUE)); + debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords); } } -- cgit v1.2.3 From 446dbb921762710d678486f3f5a6dfdf318fe34c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 5 Oct 2010 10:50:02 +0100 Subject: llvmpipe: Dump a few missing shader key flags. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 5a561f9abd1..e50768445ff 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -746,6 +746,9 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key) debug_printf("fs variant %p:\n", (void *) key); + if (key->flatshade) { + debug_printf("flatshade = 1\n"); + } for (i = 0; i < key->nr_cbufs; ++i) { debug_printf("cbuf_format[%u] = %s\n", i, util_format_name(key->cbuf_format[i])); } @@ -770,6 +773,10 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key) debug_printf("alpha.func = %s\n", util_dump_func(key->alpha.func, TRUE)); } + if (key->occlusion_count) { + debug_printf("occlusion_count = 1\n"); + } + if (key->blend.logicop_enable) { debug_printf("blend.logicop_func = %s\n", util_dump_logicop(key->blend.logicop_func, TRUE)); } -- cgit v1.2.3 From e74955eba3fc22fcf6e9111a4e5bbc095d34d357 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 26 Sep 2010 11:22:20 +0100 Subject: llvmpipe: Fix perspective interpolation for point sprites. Once a fragment is generated with LP_INTERP_PERSPECTIVE set for an input, it will do a divide by w for that input. Therefore it's not OK to treat LP_INTERP_PERSPECTIVE as LP_INTERP_LINEAR or vice-versa, even if the attribute is known to not vary. A better strategy would be to take the primitive in consideration when generating the fragment shader key, and therefore avoid the per-fragment perspective divide. --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 71 ++++++++++++++++++++------- 1 file changed, 54 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 3b217f95447..c91e85f9159 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -64,12 +64,37 @@ constant_coef(struct lp_setup_context *setup, } +static void +point_persp_coeff(struct lp_setup_context *setup, + struct lp_rast_triangle *point, + const struct point_info *info, + unsigned slot, + unsigned i) +{ + /* + * Fragment shader expects pre-multiplied w for LP_INTERP_PERSPECTIVE. A + * better stratergy would be to take the primitive in consideration when + * generating the fragment shader key, and therefore avoid the per-fragment + * perspective divide. + */ + + float w0 = info->v0[0][3]; + + assert(i < 4); + + point->inputs.a0[slot][i] = info->v0[slot][i]*w0; + point->inputs.dadx[slot][i] = 0.0f; + point->inputs.dady[slot][i] = 0.0f; +} + + /** * Setup automatic texcoord coefficients (for sprite rendering). * \param slot the vertex attribute slot to setup * \param i the attribute channel in [0,3] * \param sprite_coord_origin one of PIPE_SPRITE_COORD_x - * \param perspective_proj will the TEX instruction do a divide by Q? + * \param perspective does the shader expects pre-multiplied w, i.e., + * LP_INTERP_PERSPECTIVE is specified in the shader key */ static void texcoord_coef(struct lp_setup_context *setup, @@ -78,7 +103,7 @@ texcoord_coef(struct lp_setup_context *setup, unsigned slot, unsigned i, unsigned sprite_coord_origin, - boolean perspective_proj) + boolean perspective) { assert(i < 4); @@ -92,7 +117,7 @@ texcoord_coef(struct lp_setup_context *setup, point->inputs.dady[slot][0] = dady; point->inputs.a0[slot][0] = 0.5 - (dadx * x0 + dady * y0); - if (!perspective_proj) { + if (perspective) { /* Divide coefficients by vertex.w here. * * It would be clearer to always multiply by w0 above and @@ -119,7 +144,7 @@ texcoord_coef(struct lp_setup_context *setup, point->inputs.dady[slot][1] = dady; point->inputs.a0[slot][1] = 0.5 - (dadx * x0 + dady * y0); - if (!perspective_proj) { + if (perspective) { float w0 = info->v0[0][3]; point->inputs.dadx[slot][1] *= w0; point->inputs.dady[slot][1] *= w0; @@ -193,11 +218,17 @@ setup_point_coefficients( struct lp_setup_context *setup, /* setup interpolation for all the remaining attributes: */ for (slot = 0; slot < setup->fs.nr_inputs; slot++) { + enum lp_interp interp = setup->fs.input[slot].interp; + boolean perspective = !!(interp == LP_INTERP_PERSPECTIVE); unsigned vert_attr = setup->fs.input[slot].src_index; unsigned usage_mask = setup->fs.input[slot].usage_mask; unsigned i; + + if (perspective & usage_mask) { + fragcoord_usage_mask |= TGSI_WRITEMASK_W; + } - switch (setup->fs.input[slot].interp) { + switch (interp) { case LP_INTERP_POSITION: /* * The generated pixel interpolators will pick up the coeffs from @@ -210,32 +241,38 @@ setup_point_coefficients( struct lp_setup_context *setup, case LP_INTERP_LINEAR: /* Sprite tex coords may use linear interpolation someday */ /* fall-through */ - case LP_INTERP_PERSPECTIVE: /* check if the sprite coord flag is set for this attribute. * If so, set it up so it up so x and y vary from 0 to 1. */ if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { - const int index = shader->info.input_semantic_index[slot]; + unsigned semantic_index = shader->info.input_semantic_index[slot]; /* Note that sprite_coord enable is a bitfield of * PIPE_MAX_SHADER_OUTPUTS bits. */ - if (index < PIPE_MAX_SHADER_OUTPUTS && - (setup->sprite_coord_enable & (1 << index))) { - for (i = 0; i < NUM_CHANNELS; i++) - if (usage_mask & (1 << i)) + if (semantic_index < PIPE_MAX_SHADER_OUTPUTS && + (setup->sprite_coord_enable & (1 << semantic_index))) { + for (i = 0; i < NUM_CHANNELS; i++) { + if (usage_mask & (1 << i)) { texcoord_coef(setup, point, info, slot + 1, i, setup->sprite_coord_origin, - (usage_mask & TGSI_WRITEMASK_W)); - fragcoord_usage_mask |= TGSI_WRITEMASK_W; - break; + perspective); + } + } + break; } } - /* FALLTHROUGH */ + /* fall-through */ case LP_INTERP_CONSTANT: for (i = 0; i < NUM_CHANNELS; i++) { - if (usage_mask & (1 << i)) - constant_coef(setup, point, slot+1, info->v0[vert_attr][i], i); + if (usage_mask & (1 << i)) { + if (perspective) { + point_persp_coeff(setup, point, info, slot+1, i); + } + else { + constant_coef(setup, point, slot+1, info->v0[vert_attr][i], i); + } + } } break; -- cgit v1.2.3 From 06472ad7e835813ef7c9bf8a5cd8b62a25fa9cc3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 09:40:51 +0100 Subject: llvmpipe: Fix sprite coord perspective interpolation of Q. Q coordinate's coefficients also need to be multiplied by w, otherwise it will have 1/w, causing problems with TXP. --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index c91e85f9159..1295aeecd87 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -105,6 +105,8 @@ texcoord_coef(struct lp_setup_context *setup, unsigned sprite_coord_origin, boolean perspective) { + float w0 = info->v0[0][3]; + assert(i < 4); if (i == 0) { @@ -118,13 +120,6 @@ texcoord_coef(struct lp_setup_context *setup, point->inputs.a0[slot][0] = 0.5 - (dadx * x0 + dady * y0); if (perspective) { - /* Divide coefficients by vertex.w here. - * - * It would be clearer to always multiply by w0 above and - * then divide it out for perspective projection here, but - * doing it this way involves less algebra. - */ - float w0 = info->v0[0][3]; point->inputs.dadx[slot][0] *= w0; point->inputs.dady[slot][0] *= w0; point->inputs.a0[slot][0] *= w0; @@ -145,7 +140,6 @@ texcoord_coef(struct lp_setup_context *setup, point->inputs.a0[slot][1] = 0.5 - (dadx * x0 + dady * y0); if (perspective) { - float w0 = info->v0[0][3]; point->inputs.dadx[slot][1] *= w0; point->inputs.dady[slot][1] *= w0; point->inputs.a0[slot][1] *= w0; @@ -157,7 +151,7 @@ texcoord_coef(struct lp_setup_context *setup, point->inputs.dady[slot][2] = 0.0f; } else { - point->inputs.a0[slot][3] = 1.0f; + point->inputs.a0[slot][3] = perspective ? w0 : 1.0f; point->inputs.dadx[slot][3] = 0.0f; point->inputs.dady[slot][3] = 0.0f; } -- cgit v1.2.3 From 1644bb0f40800169a3402f08b8f8a2758e90efee Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 6 Oct 2010 09:40:27 -0400 Subject: r600g: avoid segfault due to unintialized list pointer Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 6 +++--- src/gallium/winsys/r600/drm/r600_hw_context.c | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 2093a2d09c1..9617035c934 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -640,7 +640,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - LIST_DEL(&block->list); + LIST_DELINIT(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -695,7 +695,7 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - LIST_DEL(&block->list); + LIST_DELINIT(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -719,7 +719,7 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - LIST_DEL(&block->list); + LIST_DELINIT(&block->list); return; } if (state->nregs <= 3) { diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 7d81d734571..72bfb357b33 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -125,6 +125,8 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, block->reg = &block->pm4[block->pm4_ndwords]; block->pm4_ndwords += n; block->nreg = n; + LIST_INITHEAD(&block->list); + for (j = 0; j < n; j++) { if (reg[i+j].need_bo) { block->nbo++; @@ -829,7 +831,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - LIST_DEL(&block->list); + LIST_DELINIT(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -883,7 +885,7 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - LIST_DEL(&block->list); + LIST_DELINIT(&block->list); return; } block->reg[0] = state->regs[0].value; @@ -906,7 +908,7 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; if (state == NULL) { block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY); - LIST_DEL(&block->list); + LIST_DELINIT(&block->list); return; } if (state->nregs <= 3) { @@ -1314,7 +1316,7 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query) { r600_bo_reference(ctx->radeon, &query->buffer, NULL); - LIST_DEL(&query->list); + LIST_DELINIT(&query->list); free(query); } -- cgit v1.2.3 From dcd0261affc293b75d231e612091ec7b1076fff6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 5 Oct 2010 10:20:16 -0700 Subject: i965: Enable the constant propagation code. A debug disable had slipped in. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index f42c4696410..0c9f17f8fdc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2548,8 +2548,6 @@ fs_visitor::propagate_constants() { bool progress = false; - return false; - foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); -- cgit v1.2.3 From 634abbf7b2e6ea21db30aafc0de9472ee31d4173 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 5 Oct 2010 10:25:22 -0700 Subject: i965: Also do constant propagation for the second operand of CMP. We could do the first operand as well by flipping the comparison, but this covered several CMPs in code I was looking at. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 0c9f17f8fdc..914141a3978 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2607,6 +2607,11 @@ fs_visitor::propagate_constants() scan_inst->src[1] = inst->src[0]; } break; + case BRW_OPCODE_CMP: + if (i == 1) { + scan_inst->src[i] = inst->src[0]; + progress = true; + } } } -- cgit v1.2.3 From 3fabd218a0ffe1aa362440d957cf9135955045a3 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 6 Oct 2010 12:56:53 -0400 Subject: r600g: fix dirty state handling Avoid having object ending up in dead list of dirty object. Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 5 ++--- src/gallium/winsys/r600/drm/r600_hw_context.c | 8 ++++---- src/gallium/winsys/r600/drm/r600_priv.h | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 9617035c934..9b39c0c4f01 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -762,7 +762,7 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr struct r600_bo *cb[12]; struct r600_bo *db; unsigned ndwords = 9, flush; - struct r600_block *dirty_block; + struct r600_block *dirty_block, *next_block; if (draw->indices) { ndwords = 13; @@ -817,10 +817,9 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr } /* enough room to copy packet */ - LIST_FOR_EACH_ENTRY(dirty_block,&ctx->dirty,list) { + LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &ctx->dirty,list) { r600_context_block_emit_dirty(ctx, dirty_block); } - LIST_INITHEAD(&ctx->dirty); /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 72bfb357b33..86bddccbbbb 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -967,7 +967,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) struct r600_bo *cb[8]; struct r600_bo *db; unsigned ndwords = 9; - struct r600_block *dirty_block; + struct r600_block *dirty_block, *next_block; if (draw->indices) { ndwords = 13; @@ -1020,10 +1020,9 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) } /* enough room to copy packet */ - LIST_FOR_EACH_ENTRY(dirty_block,&ctx->dirty,list) { + LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &ctx->dirty,list) { r600_context_block_emit_dirty(ctx, dirty_block); } - LIST_INITHEAD(&ctx->dirty); /* draw packet */ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0); @@ -1135,8 +1134,9 @@ void r600_context_flush(struct r600_context *ctx) */ for (int i = 0; i < ctx->nblocks; i++) { if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) { - if(!(ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY)) + if(!(ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY)) { LIST_ADDTAIL(&ctx->blocks[i]->list,&ctx->dirty); + } ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords + ctx->blocks[i]->pm4_flush_ndwords; ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY; } diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index a693a5b5ab8..e3868d3cb9a 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -162,6 +162,7 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4); ctx->pm4_cdwords += block->pm4_ndwords; block->status ^= R600_BLOCK_STATUS_DIRTY; + LIST_DELINIT(&block->list); } static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo) -- cgit v1.2.3 From 3c97c00e3810d31c3aa26173eb9fdef91b3e7c87 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 09:57:55 -0700 Subject: i965: Add back gen6 headerless FB writes to the new FS backend. It's not that hard to detect when we need the header. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 43 +++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 914141a3978..a380eb44525 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -324,6 +324,7 @@ public: this->sampler = 0; this->target = 0; this->eot = false; + this->header_present = false; this->shadow_compare = false; } @@ -376,6 +377,7 @@ public: int sampler; int target; /**< MRT target. */ bool eot; + bool header_present; bool shadow_compare; /** @{ @@ -420,7 +422,10 @@ public: this->virtual_grf_array_size = 0; this->virtual_grf_def = NULL; this->virtual_grf_use = NULL; + + this->kill_emitted = false; } + ~fs_visitor() { talloc_free(this->mem_ctx); @@ -503,6 +508,7 @@ public: ir_variable *frag_color, *frag_data, *frag_depth; int first_non_payload_grf; int urb_setup[FRAG_ATTRIB_MAX]; + bool kill_emitted; /** @{ debug annotation info */ const char *current_annotation; @@ -1509,6 +1515,7 @@ fs_visitor::visit(ir_discard *ir) assert(ir->condition == NULL); /* FINISHME */ emit(fs_inst(FS_OPCODE_DISCARD, temp, temp)); + kill_emitted = true; } void @@ -1843,10 +1850,19 @@ void fs_visitor::emit_fb_writes() { this->current_annotation = "FB write header"; + GLboolean header_present = GL_TRUE; int nr = 0; - /* m0, m1 header */ - nr += 2; + if (intel->gen >= 6 && + !this->kill_emitted && + c->key.nr_color_regions == 1) { + header_present = false; + } + + if (header_present) { + /* m0, m1 header */ + nr += 2; + } if (c->key.aa_dest_stencil_reg) { emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), @@ -1911,6 +1927,7 @@ fs_visitor::emit_fb_writes() reg_undef, reg_undef)); inst->mlen = nr; inst->eot = true; + inst->header_present = header_present; } this->current_annotation = NULL; @@ -1929,19 +1946,23 @@ fs_visitor::generate_fb_write(fs_inst *inst) brw_set_mask_control(p, BRW_MASK_DISABLE); brw_set_compression_control(p, BRW_COMPRESSION_NONE); - if (intel->gen >= 6) { + if (inst->header_present) { + if (intel->gen >= 6) { + brw_MOV(p, + brw_message_reg(0), + brw_vec8_grf(0, 0)); + implied_header = brw_null_reg(); + } else { + implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW); + } + brw_MOV(p, - brw_message_reg(0), - brw_vec8_grf(0, 0)); - implied_header = brw_null_reg(); + brw_message_reg(1), + brw_vec8_grf(1, 0)); } else { - implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW); + implied_header = brw_null_reg(); } - brw_MOV(p, - brw_message_reg(1), - brw_vec8_grf(1, 0)); - brw_pop_insn_state(p); brw_fb_WRITE(p, -- cgit v1.2.3 From f7cb28fad9855020e9fbd1481df03bb09346d4be Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 4 Oct 2010 15:09:18 -0700 Subject: i965: Gen6 no longer has the IFF instruction; always use IF. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 59541353214..fbc6894d054 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -899,9 +899,11 @@ void brw_ENDIF(struct brw_compile *p, * instruction respectively. */ if (patch_insn->header.opcode == BRW_OPCODE_IF) { - /* Automagically turn it into an IFF: - */ - patch_insn->header.opcode = BRW_OPCODE_IFF; + if (intel->gen < 6) { + /* Automagically turn it into an IFF: + */ + patch_insn->header.opcode = BRW_OPCODE_IFF; + } patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); patch_insn->bits3.if_else.pop_count = 0; patch_insn->bits3.if_else.pad0 = 0; -- cgit v1.2.3 From feca6609390d4642418cf7aab878e654964510c4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 4 Oct 2010 15:08:03 -0700 Subject: i965: Fix up IF/ELSE/ENDIF for gen6. The jump delta is now in the part of the instruction where the destination fields used to be, and the src args are ignored (or not, for the new non-predicated IF that we don't use yet). --- src/mesa/drivers/dri/i965/brw_disasm.c | 5 ++ src/mesa/drivers/dri/i965/brw_eu_emit.c | 86 ++++++++++++++++++++++++--------- src/mesa/drivers/dri/i965/brw_structs.h | 12 +++++ 3 files changed, 79 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index 3a93b253777..be27f9226c3 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -892,7 +892,12 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) if (opcode[inst->header.opcode].ndst > 0) { pad (file, 16); err |= dest (file, inst); + } else if (gen >= 6 && (inst->header.opcode == BRW_OPCODE_IF || + inst->header.opcode == BRW_OPCODE_ELSE || + inst->header.opcode == BRW_OPCODE_ENDIF)) { + format (file, " %d", inst->bits1.branch_gen6.jump_count); } + if (opcode[inst->header.opcode].nsrc > 0) { pad (file, 32); err |= src0 (file, inst); diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index fbc6894d054..419b40ba84b 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -787,6 +787,7 @@ struct brw_instruction *brw_JMPI(struct brw_compile *p, */ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) { + struct intel_context *intel = &p->brw->intel; struct brw_instruction *insn; if (p->single_program_flow) { @@ -800,9 +801,15 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) /* Override the defaults for this instruction: */ - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); + if (intel->gen < 6) { + brw_set_dest(insn, brw_ip_reg()); + brw_set_src0(insn, brw_ip_reg()); + brw_set_src1(insn, brw_imm_d(0x0)); + } else { + brw_set_dest(insn, brw_imm_w(0)); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); + } insn->header.execution_size = execute_size; insn->header.compression_control = BRW_COMPRESSION_NONE; @@ -835,9 +842,15 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, insn = next_insn(p, BRW_OPCODE_ELSE); } - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); + if (intel->gen < 6) { + brw_set_dest(insn, brw_ip_reg()); + brw_set_src0(insn, brw_ip_reg()); + brw_set_src1(insn, brw_imm_d(0x0)); + } else { + brw_set_dest(insn, brw_imm_w(0)); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); + } insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = if_insn->header.execution_size; @@ -854,9 +867,13 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, } else { assert(if_insn->header.opcode == BRW_OPCODE_IF); - if_insn->bits3.if_else.jump_count = br * (insn - if_insn); - if_insn->bits3.if_else.pop_count = 0; - if_insn->bits3.if_else.pad0 = 0; + if (intel->gen < 6) { + if_insn->bits3.if_else.jump_count = br * (insn - if_insn); + if_insn->bits3.if_else.pop_count = 0; + if_insn->bits3.if_else.pad0 = 0; + } else { + if_insn->bits1.branch_gen6.jump_count = br * (insn - if_insn + 1); + } } return insn; @@ -884,9 +901,15 @@ void brw_ENDIF(struct brw_compile *p, } else { struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF); - brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, brw_imm_d(0x0)); + if (intel->gen < 6) { + brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src1(insn, brw_imm_d(0x0)); + } else { + brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_W)); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); + } insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = patch_insn->header.execution_size; @@ -900,26 +923,41 @@ void brw_ENDIF(struct brw_compile *p, */ if (patch_insn->header.opcode == BRW_OPCODE_IF) { if (intel->gen < 6) { - /* Automagically turn it into an IFF: + /* Turn it into an IFF, which means no mask stack operations for + * all-false and jumping past the ENDIF. */ patch_insn->header.opcode = BRW_OPCODE_IFF; + patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); + patch_insn->bits3.if_else.pop_count = 0; + patch_insn->bits3.if_else.pad0 = 0; + } else { + /* As of gen6, there is no IFF and IF must point to the ENDIF. */ + patch_insn->bits1.branch_gen6.jump_count = br * (insn - patch_insn); } - patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); - patch_insn->bits3.if_else.pop_count = 0; - patch_insn->bits3.if_else.pad0 = 0; - } else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) { - patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); - patch_insn->bits3.if_else.pop_count = 1; - patch_insn->bits3.if_else.pad0 = 0; } else { - assert(0); + assert(patch_insn->header.opcode == BRW_OPCODE_ELSE); + if (intel->gen < 6) { + /* BRW_OPCODE_ELSE pre-gen6 should point just past the + * matching ENDIF. + */ + patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); + patch_insn->bits3.if_else.pop_count = 1; + patch_insn->bits3.if_else.pad0 = 0; + } else { + /* BRW_OPCODE_ELSE on gen6 should point to the matching ENDIF. */ + patch_insn->bits1.branch_gen6.jump_count = br * (insn - patch_insn); + } } /* Also pop item off the stack in the endif instruction: */ - insn->bits3.if_else.jump_count = 0; - insn->bits3.if_else.pop_count = 1; - insn->bits3.if_else.pad0 = 0; + if (intel->gen < 6) { + insn->bits3.if_else.jump_count = 0; + insn->bits3.if_else.pop_count = 1; + insn->bits3.if_else.pad0 = 0; + } else { + insn->bits1.branch_gen6.jump_count = 2; + } } } diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 7b919872c40..8ce9af9c4fe 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -1381,6 +1381,18 @@ struct brw_instruction GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; } ia16; + + struct { + GLuint dest_reg_file:2; + GLuint dest_reg_type:3; + GLuint src0_reg_file:2; + GLuint src0_reg_type:3; + GLuint src1_reg_file:2; + GLuint src1_reg_type:3; + GLuint pad:1; + + GLint jump_count:16; + } branch_gen6; } bits1; -- cgit v1.2.3 From df3505b19341424a605be703a27f50ea585ad71f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 12:09:32 +0100 Subject: gallivm: Take the type signedness in consideration in round/ceil/floor. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 107 +++++++++++++++------------- 1 file changed, 59 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index e65c13e64b5..3f9c250ad57 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1210,7 +1210,7 @@ lp_build_iround(struct lp_build_context *bld, LLVMValueRef a) { const struct lp_type type = bld->type; - LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMTypeRef int_vec_type = bld->int_vec_type; LLVMValueRef res; assert(type.floating); @@ -1222,20 +1222,24 @@ lp_build_iround(struct lp_build_context *bld, res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); } else { - LLVMTypeRef vec_type = lp_build_vec_type(type); - LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1)); - LLVMValueRef sign; LLVMValueRef half; - /* get sign bit */ - sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); - sign = LLVMBuildAnd(bld->builder, sign, mask, ""); - - /* sign * 0.5 */ half = lp_build_const_vec(type, 0.5); - half = LLVMBuildBitCast(bld->builder, half, int_vec_type, ""); - half = LLVMBuildOr(bld->builder, sign, half, ""); - half = LLVMBuildBitCast(bld->builder, half, vec_type, ""); + + if (type.sign) { + LLVMTypeRef vec_type = bld->vec_type; + LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1)); + LLVMValueRef sign; + + /* get sign bit */ + sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); + sign = LLVMBuildAnd(bld->builder, sign, mask, ""); + + /* sign * 0.5 */ + half = LLVMBuildBitCast(bld->builder, half, int_vec_type, ""); + half = LLVMBuildOr(bld->builder, sign, half, ""); + half = LLVMBuildBitCast(bld->builder, half, vec_type, ""); + } res = LLVMBuildFAdd(bld->builder, a, half, ""); } @@ -1256,7 +1260,7 @@ lp_build_ifloor(struct lp_build_context *bld, LLVMValueRef a) { const struct lp_type type = bld->type; - LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMTypeRef int_vec_type = bld->int_vec_type; LLVMValueRef res; assert(type.floating); @@ -1267,27 +1271,31 @@ lp_build_ifloor(struct lp_build_context *bld, res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); } else { - /* Take the sign bit and add it to 1 constant */ - LLVMTypeRef vec_type = lp_build_vec_type(type); - unsigned mantissa = lp_mantissa(type); - LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1)); - LLVMValueRef sign; - LLVMValueRef offset; - - /* sign = a < 0 ? ~0 : 0 */ - sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); - sign = LLVMBuildAnd(bld->builder, sign, mask, ""); - sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "ifloor.sign"); - - /* offset = -0.99999(9)f */ - offset = lp_build_const_vec(type, -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa)); - offset = LLVMConstBitCast(offset, int_vec_type); - - /* offset = a < 0 ? offset : 0.0f */ - offset = LLVMBuildAnd(bld->builder, offset, sign, ""); - offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "ifloor.offset"); - - res = LLVMBuildFAdd(bld->builder, a, offset, "ifloor.res"); + res = a; + + if (type.sign) { + /* Take the sign bit and add it to 1 constant */ + LLVMTypeRef vec_type = bld->vec_type; + unsigned mantissa = lp_mantissa(type); + LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1)); + LLVMValueRef sign; + LLVMValueRef offset; + + /* sign = a < 0 ? ~0 : 0 */ + sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); + sign = LLVMBuildAnd(bld->builder, sign, mask, ""); + sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "ifloor.sign"); + + /* offset = -0.99999(9)f */ + offset = lp_build_const_vec(type, -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa)); + offset = LLVMConstBitCast(offset, int_vec_type); + + /* offset = a < 0 ? offset : 0.0f */ + offset = LLVMBuildAnd(bld->builder, offset, sign, ""); + offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "ifloor.offset"); + + res = LLVMBuildFAdd(bld->builder, res, offset, "ifloor.res"); + } } /* round to nearest (toward zero) */ @@ -1307,7 +1315,7 @@ lp_build_iceil(struct lp_build_context *bld, LLVMValueRef a) { const struct lp_type type = bld->type; - LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMTypeRef int_vec_type = bld->int_vec_type; LLVMValueRef res; assert(type.floating); @@ -1318,25 +1326,28 @@ lp_build_iceil(struct lp_build_context *bld, res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); } else { - LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMTypeRef vec_type = bld->vec_type; unsigned mantissa = lp_mantissa(type); - LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1)); - LLVMValueRef sign; LLVMValueRef offset; - /* sign = a < 0 ? 0 : ~0 */ - sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); - sign = LLVMBuildAnd(bld->builder, sign, mask, ""); - sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "iceil.sign"); - sign = LLVMBuildNot(bld->builder, sign, "iceil.not"); - /* offset = 0.99999(9)f */ offset = lp_build_const_vec(type, (double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa)); - offset = LLVMConstBitCast(offset, int_vec_type); - /* offset = a < 0 ? 0.0 : offset */ - offset = LLVMBuildAnd(bld->builder, offset, sign, ""); - offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "iceil.offset"); + if (type.sign) { + LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1)); + LLVMValueRef sign; + + /* sign = a < 0 ? 0 : ~0 */ + sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); + sign = LLVMBuildAnd(bld->builder, sign, mask, ""); + sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "iceil.sign"); + sign = LLVMBuildNot(bld->builder, sign, "iceil.not"); + + /* offset = a < 0 ? 0.0 : offset */ + offset = LLVMConstBitCast(offset, int_vec_type); + offset = LLVMBuildAnd(bld->builder, offset, sign, ""); + offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "iceil.offset"); + } res = LLVMBuildFAdd(bld->builder, a, offset, "iceil.res"); } -- cgit v1.2.3 From 4648846bd6c376877f024ccf300ceac5b0b3dcd6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 14:06:14 +0100 Subject: gallivm: Use a faster (and less accurate) log2 in lod computation. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 44 +++++++++++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_arit.h | 5 +++ src/gallium/auxiliary/gallivm/lp_bld_sample.c | 4 +++ 3 files changed, 53 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 3f9c250ad57..ff94f498acf 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -2286,3 +2286,47 @@ lp_build_log2(struct lp_build_context *bld, lp_build_log2_approx(bld, x, NULL, NULL, &res); return res; } + + +/** + * Faster (and less accurate) log2. + * + * log2(x) = floor(log2(x)) + frac(x) + * + * See http://www.flipcode.com/archives/Fast_log_Function.shtml + */ +LLVMValueRef +lp_build_fast_log2(struct lp_build_context *bld, + LLVMValueRef x) +{ + const struct lp_type type = bld->type; + LLVMTypeRef vec_type = bld->vec_type; + LLVMTypeRef int_vec_type = bld->int_vec_type; + + unsigned mantissa = lp_mantissa(type); + LLVMValueRef mantmask = lp_build_const_int_vec(type, (1ULL << mantissa) - 1); + LLVMValueRef one = LLVMConstBitCast(bld->one, int_vec_type); + + LLVMValueRef ipart; + LLVMValueRef fpart; + + assert(lp_check_value(bld->type, x)); + + assert(type.floating); + + x = LLVMBuildBitCast(bld->builder, x, int_vec_type, ""); + + /* ipart = floor(log2(x)) - 1 */ + ipart = LLVMBuildLShr(bld->builder, x, lp_build_const_int_vec(type, mantissa), ""); + ipart = LLVMBuildAnd(bld->builder, ipart, lp_build_const_int_vec(type, 255), ""); + ipart = LLVMBuildSub(bld->builder, ipart, lp_build_const_int_vec(type, 128), ""); + ipart = LLVMBuildSIToFP(bld->builder, ipart, vec_type, ""); + + /* fpart = 1.0 + frac(x) */ + fpart = LLVMBuildAnd(bld->builder, x, mantmask, ""); + fpart = LLVMBuildOr(bld->builder, fpart, one, ""); + fpart = LLVMBuildBitCast(bld->builder, fpart, vec_type, ""); + + /* floor(log2(x)) + frac(x) */ + return LLVMBuildFAdd(bld->builder, ipart, fpart, ""); +} diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index 31efa9921ce..3ed4fec2333 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -212,6 +212,11 @@ LLVMValueRef lp_build_log2(struct lp_build_context *bld, LLVMValueRef a); +LLVMValueRef +lp_build_fast_log2(struct lp_build_context *bld, + LLVMValueRef a); + + void lp_build_exp2_approx(struct lp_build_context *bld, LLVMValueRef x, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index aee94c1b866..9dee653eee8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -243,7 +243,11 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, } /* compute lod = log2(rho) */ +#if 0 lod = lp_build_log2(float_bld, rho); +#else + lod = lp_build_fast_log2(float_bld, rho); +#endif /* add shader lod bias */ if (lod_bias) { -- cgit v1.2.3 From 012d57737b1b4e4263aa3414abe433195ff8a713 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 17:44:05 +0100 Subject: gallivm: Fast implementation of iround(log2(x)) Not tested yet, but should be correct. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 35 +++++++++++++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_arit.h | 4 ++++ 2 files changed, 39 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index ff94f498acf..15b74410188 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -2330,3 +2330,38 @@ lp_build_fast_log2(struct lp_build_context *bld, /* floor(log2(x)) + frac(x) */ return LLVMBuildFAdd(bld->builder, ipart, fpart, ""); } + + +/** + * Fast implementation of iround(log2(x)). + * + * Not an approximation -- it should give accurate results all the time. + */ +LLVMValueRef +lp_build_ilog2(struct lp_build_context *bld, + LLVMValueRef x) +{ + const struct lp_type type = bld->type; + LLVMTypeRef int_vec_type = bld->int_vec_type; + + unsigned mantissa = lp_mantissa(type); + LLVMValueRef sqrt2 = lp_build_const_vec(type, 1.4142135623730951); + + LLVMValueRef ipart; + + assert(lp_check_value(bld->type, x)); + + assert(type.floating); + + /* x * 2^(0.5) i.e., add 0.5 to the log2(x) */ + x = LLVMBuildFMul(bld->builder, x, sqrt2, ""); + + x = LLVMBuildBitCast(bld->builder, x, int_vec_type, ""); + + /* ipart = floor(log2(x) + 0.5) */ + ipart = LLVMBuildLShr(bld->builder, x, lp_build_const_int_vec(type, mantissa), ""); + ipart = LLVMBuildAnd(bld->builder, ipart, lp_build_const_int_vec(type, 255), ""); + ipart = LLVMBuildSub(bld->builder, ipart, lp_build_const_int_vec(type, 127), ""); + + return ipart; +} diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index 3ed4fec2333..f36197479f0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -216,6 +216,10 @@ LLVMValueRef lp_build_fast_log2(struct lp_build_context *bld, LLVMValueRef a); +LLVMValueRef +lp_build_ilog2(struct lp_build_context *bld, + LLVMValueRef x); + void lp_build_exp2_approx(struct lp_build_context *bld, -- cgit v1.2.3 From af05f6157668b3c5e6fd73c3d743b11e619b9067 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 18:31:36 +0100 Subject: gallivm: Combined ifloor & fract helper. The only way to ensure we don't do redundant FP <-> SI conversions. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 42 +++++++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_arit.h | 6 ++++ src/gallium/auxiliary/gallivm/lp_bld_sample.c | 4 +-- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 41 +++++++++------------- 4 files changed, 65 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 15b74410188..64c468c14d4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1359,6 +1359,48 @@ lp_build_iceil(struct lp_build_context *bld, } +/** + * Combined ifloor() & fract(). + * + * Preferred to calling the functions separately, as it will ensure that the + * stratergy (floor() vs ifloor()) that results in less redundant work is used. + */ +void +lp_build_ifloor_fract(struct lp_build_context *bld, + LLVMValueRef a, + LLVMValueRef *out_ipart, + LLVMValueRef *out_fpart) +{ + + + const struct lp_type type = bld->type; + LLVMValueRef ipart; + + assert(type.floating); + assert(lp_check_value(type, a)); + + if (util_cpu_caps.has_sse4_1 && + (type.length == 1 || type.width*type.length == 128)) { + /* + * floor() is easier. + */ + + ipart = lp_build_floor(bld, a); + *out_fpart = LLVMBuildFSub(bld->builder, a, ipart, "fpart"); + *out_ipart = LLVMBuildFPToSI(bld->builder, ipart, bld->int_vec_type, "ipart"); + } + else { + /* + * ifloor() is easier. + */ + + *out_ipart = lp_build_ifloor(bld, a); + ipart = LLVMBuildSIToFP(bld->builder, *out_ipart, bld->vec_type, "ipart"); + *out_fpart = LLVMBuildFSub(bld->builder, a, ipart, "fpart"); + } +} + + LLVMValueRef lp_build_sqrt(struct lp_build_context *bld, LLVMValueRef a) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index f36197479f0..8424384f8f7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -171,6 +171,12 @@ LLVMValueRef lp_build_itrunc(struct lp_build_context *bld, LLVMValueRef a); +void +lp_build_ifloor_fract(struct lp_build_context *bld, + LLVMValueRef a, + LLVMValueRef *out_ipart, + LLVMValueRef *out_fpart); + LLVMValueRef lp_build_sqrt(struct lp_build_context *bld, LLVMValueRef a); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 9dee653eee8..acd99741f13 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -319,7 +319,7 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, bld->builder, unit); /* convert float lod to integer */ - level = lp_build_ifloor(float_bld, lod); + lp_build_ifloor_fract(float_bld, lod, &level, weight_out); /* compute level 0 and clamp to legal range of levels */ *level0_out = lp_build_clamp(int_bld, level, @@ -330,8 +330,6 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, *level1_out = lp_build_clamp(int_bld, level, int_bld->zero, last_level); - - *weight_out = lp_build_fract(float_bld, lod); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 36a77d3aff0..d464147371d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -253,11 +253,9 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, /* mul by size and subtract 0.5 */ coord = lp_build_mul(coord_bld, coord, length_f); coord = lp_build_sub(coord_bld, coord, half); - /* convert to int */ - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(uint_coord_bld, coord0, uint_coord_bld->one); - /* compute lerp weight */ - weight = lp_build_fract(coord_bld, coord); /* repeat wrap */ if (is_pot) { coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, ""); @@ -284,8 +282,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_sub(coord_bld, coord, half); - weight = lp_build_fract(coord_bld, coord); - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); break; @@ -304,10 +302,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, max = lp_build_sub(coord_bld, length_f, min); coord = lp_build_clamp(coord_bld, coord, min, max); } - /* compute lerp weight */ - weight = lp_build_fract(coord_bld, coord); - /* coord0 = floor(coord); */ - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); /* coord0 = max(coord0, 0) */ coord0 = lp_build_max(int_coord_bld, coord0, int_coord_bld->zero); @@ -327,10 +323,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, max = lp_build_sub(coord_bld, length_f, min); coord = lp_build_clamp(coord_bld, coord, min, max); coord = lp_build_sub(coord_bld, coord, half); - /* compute lerp weight */ - weight = lp_build_fract(coord_bld, coord); - /* convert to int */ - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); } break; @@ -343,11 +337,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_mul(coord_bld, coord, length_f); coord = lp_build_sub(coord_bld, coord, half); - /* compute lerp weight */ - weight = lp_build_fract(coord_bld, coord); - - /* convert to int coords */ - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); /* coord0 = max(coord0, 0) */ @@ -369,8 +360,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_sub(coord_bld, coord, half); - weight = lp_build_fract(coord_bld, coord); - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); break; @@ -392,8 +383,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_sub(coord_bld, coord, half); - weight = lp_build_fract(coord_bld, coord); - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); } break; @@ -416,8 +407,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_sub(coord_bld, coord, half); - weight = lp_build_fract(coord_bld, coord); - coord0 = lp_build_ifloor(coord_bld, coord); + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); } break; -- cgit v1.2.3 From 5849a6ab6412eddd4552329178e6edb0bea92977 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Sep 2010 16:43:56 +0100 Subject: gallivm: don't apply zero lod_bias --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 7 ++++++- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index acd99741f13..2227a062d08 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -132,6 +132,10 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE; } + if (sampler->lod_bias != 0.0) { + state->lod_bias_non_zero = 1; + } + /* If min_lod == max_lod we can greatly simplify mipmap selection. * This is a case that occurs during automatic mipmap generation. */ @@ -258,7 +262,8 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, } /* add sampler lod bias */ - lod = LLVMBuildFAdd(bld->builder, lod, sampler_lod_bias, "sampler_lod_bias"); + if (bld->static_state->lod_bias_non_zero) + lod = LLVMBuildFAdd(bld->builder, lod, sampler_lod_bias, "sampler_lod_bias"); /* clamp lod */ lod = lp_build_clamp(float_bld, lod, min_lod, max_lod); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 4d2eeaa5eb4..bb1c8c8dcee 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -83,6 +83,7 @@ struct lp_sampler_static_state unsigned compare_func:3; unsigned normalized_coords:1; unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */ + unsigned lod_bias_non_zero:1; }; -- cgit v1.2.3 From 1c32583581ef5aee59901d9dd8e56cc1a125f0d4 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 14:53:19 +0100 Subject: gallivm: Only apply min/max_lod when necessary. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 51 +++++++++++++++++++-------- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 2 ++ src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 +++ 3 files changed, 42 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 2227a062d08..c1c98bf8596 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -126,21 +126,32 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, state->wrap_r = sampler->wrap_r; state->min_img_filter = sampler->min_img_filter; state->mag_img_filter = sampler->mag_img_filter; - if (view->last_level) { + + if (view->last_level && sampler->max_lod > 0.0f) { state->min_mip_filter = sampler->min_mip_filter; } else { state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE; } - if (sampler->lod_bias != 0.0) { - state->lod_bias_non_zero = 1; - } + if (state->min_mip_filter != PIPE_TEX_MIPFILTER_NONE) { + if (sampler->lod_bias != 0.0f) { + state->lod_bias_non_zero = 1; + } - /* If min_lod == max_lod we can greatly simplify mipmap selection. - * This is a case that occurs during automatic mipmap generation. - */ - if (sampler->min_lod == sampler->max_lod) { - state->min_max_lod_equal = 1; + /* If min_lod == max_lod we can greatly simplify mipmap selection. + * This is a case that occurs during automatic mipmap generation. + */ + if (sampler->min_lod == sampler->max_lod) { + state->min_max_lod_equal = 1; + } else { + if (sampler->min_lod > 0.0f) { + state->apply_min_lod = 1; + } + + if (sampler->max_lod < (float)view->last_level) { + state->apply_max_lod = 1; + } + } } state->compare_mode = sampler->compare_mode; @@ -181,21 +192,19 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, LLVMValueRef depth) { - LLVMValueRef min_lod = - bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); - if (bld->static_state->min_max_lod_equal) { /* User is forcing sampling from a particular mipmap level. * This is hit during mipmap generation. */ + LLVMValueRef min_lod = + bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); + return min_lod; } else { struct lp_build_context *float_bld = &bld->float_bld; LLVMValueRef sampler_lod_bias = bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit); - LLVMValueRef max_lod = - bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit); LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0); LLVMValueRef lod; @@ -265,8 +274,20 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, if (bld->static_state->lod_bias_non_zero) lod = LLVMBuildFAdd(bld->builder, lod, sampler_lod_bias, "sampler_lod_bias"); + /* clamp lod */ - lod = lp_build_clamp(float_bld, lod, min_lod, max_lod); + if (bld->static_state->apply_max_lod) { + LLVMValueRef max_lod = + bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit); + + lod = lp_build_min(float_bld, lod, max_lod); + } + if (bld->static_state->apply_min_lod) { + LLVMValueRef min_lod = + bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); + + lod = lp_build_max(float_bld, lod, min_lod); + } return lod; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index bb1c8c8dcee..bb83ede9314 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -84,6 +84,8 @@ struct lp_sampler_static_state unsigned normalized_coords:1; unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */ unsigned lod_bias_non_zero:1; + unsigned apply_min_lod:1; /**< min_lod > 0 ? */ + unsigned apply_max_lod:1; /**< max_lod < last_level ? */ }; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index e50768445ff..3ce8be5a0a9 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -812,6 +812,10 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key) if (key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE) debug_printf(" .compare_func = %s\n", util_dump_func(key->sampler[i].compare_func, TRUE)); debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords); + debug_printf(" .min_max_lod_equal = %u\n", key->sampler[i].min_max_lod_equal); + debug_printf(" .lod_bias_non_zero = %u\n", key->sampler[i].lod_bias_non_zero); + debug_printf(" .apply_min_lod = %u\n", key->sampler[i].apply_min_lod); + debug_printf(" .apply_max_lod = %u\n", key->sampler[i].apply_max_lod); } } -- cgit v1.2.3 From 87dd859b342b844add906358810445da21b6b092 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 18:44:51 +0100 Subject: gallivm: Compute lod as integer whenever possible. More accurate/faster results for PIPE_TEX_MIPFILTER_NEAREST. Less FP <-> SI conversion overall. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 170 ++++++++++++++-------- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 12 +- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 40 ++--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 31 ++-- 4 files changed, 158 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index c1c98bf8596..3287cf7c376 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -167,6 +167,73 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, } +/** + * Generate code to compute coordinate gradient (rho). + * \param ddx partial derivatives of (s, t, r, q) with respect to X + * \param ddy partial derivatives of (s, t, r, q) with respect to Y + * \param width scalar int texture width + * \param height scalar int texture height + * \param depth scalar int texture depth + * + * XXX: The resulting rho is scalar, so we ignore all but the first element of + * derivatives that are passed by the shader. + */ +static LLVMValueRef +lp_build_rho(struct lp_build_sample_context *bld, + const LLVMValueRef ddx[4], + const LLVMValueRef ddy[4], + LLVMValueRef width, + LLVMValueRef height, + LLVMValueRef depth) +{ + struct lp_build_context *float_bld = &bld->float_bld; + const int dims = texture_dims(bld->static_state->target); + LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0); + LLVMValueRef dsdx, dsdy; + LLVMValueRef dtdx = NULL, dtdy = NULL, drdx = NULL, drdy = NULL; + LLVMValueRef rho; + + dsdx = LLVMBuildExtractElement(bld->builder, ddx[0], index0, "dsdx"); + dsdx = lp_build_abs(float_bld, dsdx); + dsdy = LLVMBuildExtractElement(bld->builder, ddy[0], index0, "dsdy"); + dsdy = lp_build_abs(float_bld, dsdy); + if (dims > 1) { + dtdx = LLVMBuildExtractElement(bld->builder, ddx[1], index0, "dtdx"); + dtdx = lp_build_abs(float_bld, dtdx); + dtdy = LLVMBuildExtractElement(bld->builder, ddy[1], index0, "dtdy"); + dtdy = lp_build_abs(float_bld, dtdy); + if (dims > 2) { + drdx = LLVMBuildExtractElement(bld->builder, ddx[2], index0, "drdx"); + drdx = lp_build_abs(float_bld, drdx); + drdy = LLVMBuildExtractElement(bld->builder, ddy[2], index0, "drdy"); + drdy = lp_build_abs(float_bld, drdy); + } + } + + /* Compute rho = max of all partial derivatives scaled by texture size. + * XXX this could be vectorized somewhat + */ + rho = LLVMBuildFMul(bld->builder, + lp_build_max(float_bld, dsdx, dsdy), + lp_build_int_to_float(float_bld, width), ""); + if (dims > 1) { + LLVMValueRef max; + max = LLVMBuildFMul(bld->builder, + lp_build_max(float_bld, dtdx, dtdy), + lp_build_int_to_float(float_bld, height), ""); + rho = lp_build_max(float_bld, rho, max); + if (dims > 2) { + max = LLVMBuildFMul(bld->builder, + lp_build_max(float_bld, drdx, drdy), + lp_build_int_to_float(float_bld, depth), ""); + rho = lp_build_max(float_bld, rho, max); + } + } + + return rho; +} + + /** * Generate code to compute texture level of detail (lambda). * \param ddx partial derivatives of (s, t, r, q) with respect to X @@ -180,7 +247,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, * XXX: The resulting lod is scalar, so ignore all but the first element of * derivatives, lod_bias, etc that are passed by the shader. */ -LLVMValueRef +void lp_build_lod_selector(struct lp_build_sample_context *bld, unsigned unit, const LLVMValueRef ddx[4], @@ -189,9 +256,18 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef width, LLVMValueRef height, - LLVMValueRef depth) + LLVMValueRef depth, + unsigned mip_filter, + LLVMValueRef *out_lod_ipart, + LLVMValueRef *out_lod_fpart) { + struct lp_build_context *float_bld = &bld->float_bld; + LLVMValueRef lod; + + *out_lod_ipart = bld->int_bld.zero; + *out_lod_fpart = bld->float_bld.zero; + if (bld->static_state->min_max_lod_equal) { /* User is forcing sampling from a particular mipmap level. * This is hit during mipmap generation. @@ -199,68 +275,40 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, LLVMValueRef min_lod = bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit); - return min_lod; + lod = min_lod; } else { - struct lp_build_context *float_bld = &bld->float_bld; LLVMValueRef sampler_lod_bias = bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit); LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0); - LLVMValueRef lod; if (explicit_lod) { lod = LLVMBuildExtractElement(bld->builder, explicit_lod, index0, ""); } else { - const int dims = texture_dims(bld->static_state->target); - LLVMValueRef dsdx, dsdy; - LLVMValueRef dtdx = NULL, dtdy = NULL, drdx = NULL, drdy = NULL; LLVMValueRef rho; - dsdx = LLVMBuildExtractElement(bld->builder, ddx[0], index0, "dsdx"); - dsdx = lp_build_abs(float_bld, dsdx); - dsdy = LLVMBuildExtractElement(bld->builder, ddy[0], index0, "dsdy"); - dsdy = lp_build_abs(float_bld, dsdy); - if (dims > 1) { - dtdx = LLVMBuildExtractElement(bld->builder, ddx[1], index0, "dtdx"); - dtdx = lp_build_abs(float_bld, dtdx); - dtdy = LLVMBuildExtractElement(bld->builder, ddy[1], index0, "dtdy"); - dtdy = lp_build_abs(float_bld, dtdy); - if (dims > 2) { - drdx = LLVMBuildExtractElement(bld->builder, ddx[2], index0, "drdx"); - drdx = lp_build_abs(float_bld, drdx); - drdy = LLVMBuildExtractElement(bld->builder, ddy[2], index0, "drdy"); - drdy = lp_build_abs(float_bld, drdy); - } - } + rho = lp_build_rho(bld, ddx, ddy, width, height, depth); - /* Compute rho = max of all partial derivatives scaled by texture size. - * XXX this could be vectorized somewhat - */ - rho = LLVMBuildFMul(bld->builder, - lp_build_max(float_bld, dsdx, dsdy), - lp_build_int_to_float(float_bld, width), ""); - if (dims > 1) { - LLVMValueRef max; - max = LLVMBuildFMul(bld->builder, - lp_build_max(float_bld, dtdx, dtdy), - lp_build_int_to_float(float_bld, height), ""); - rho = lp_build_max(float_bld, rho, max); - if (dims > 2) { - max = LLVMBuildFMul(bld->builder, - lp_build_max(float_bld, drdx, drdy), - lp_build_int_to_float(float_bld, depth), ""); - rho = lp_build_max(float_bld, rho, max); - } + /* compute lod = log2(rho) */ + if ((mip_filter == PIPE_TEX_MIPFILTER_NONE || + mip_filter == PIPE_TEX_MIPFILTER_NEAREST) && + !lod_bias && + !bld->static_state->lod_bias_non_zero && + !bld->static_state->apply_max_lod && + !bld->static_state->apply_min_lod) { + *out_lod_ipart = lp_build_ilog2(float_bld, rho); + *out_lod_fpart = bld->float_bld.zero; + return; } - /* compute lod = log2(rho) */ -#if 0 - lod = lp_build_log2(float_bld, rho); -#else - lod = lp_build_fast_log2(float_bld, rho); -#endif + if (0) { + lod = lp_build_log2(float_bld, rho); + } + else { + lod = lp_build_fast_log2(float_bld, rho); + } /* add shader lod bias */ if (lod_bias) { @@ -288,9 +336,20 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, lod = lp_build_max(float_bld, lod, min_lod); } + } - return lod; + if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { + LLVMValueRef ipart = lp_build_ifloor(float_bld, lod); + lp_build_name(ipart, "lod_ipart"); + *out_lod_ipart = ipart; + ipart = LLVMBuildSIToFP(bld->builder, ipart, float_bld->vec_type, ""); + *out_lod_fpart = LLVMBuildFSub(bld->builder, lod, ipart, "lod_fpart"); } + else { + *out_lod_ipart = lp_build_iround(float_bld, lod); + } + + return; } @@ -304,10 +363,9 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, void lp_build_nearest_mip_level(struct lp_build_sample_context *bld, unsigned unit, - LLVMValueRef lod, + LLVMValueRef lod_ipart, LLVMValueRef *level_out) { - struct lp_build_context *float_bld = &bld->float_bld; struct lp_build_context *int_bld = &bld->int_bld; LLVMValueRef last_level, level; @@ -317,7 +375,7 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld, bld->builder, unit); /* convert float lod to integer */ - level = lp_build_iround(float_bld, lod); + level = lod_ipart; /* clamp level to legal range of levels */ *level_out = lp_build_clamp(int_bld, level, zero, last_level); @@ -332,12 +390,10 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld, void lp_build_linear_mip_levels(struct lp_build_sample_context *bld, unsigned unit, - LLVMValueRef lod, + LLVMValueRef lod_ipart, LLVMValueRef *level0_out, - LLVMValueRef *level1_out, - LLVMValueRef *weight_out) + LLVMValueRef *level1_out) { - struct lp_build_context *float_bld = &bld->float_bld; struct lp_build_context *int_bld = &bld->int_bld; LLVMValueRef last_level, level; @@ -345,7 +401,7 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, bld->builder, unit); /* convert float lod to integer */ - lp_build_ifloor_fract(float_bld, lod, &level, weight_out); + level = lod_ipart; /* compute level 0 and clamp to legal range of levels */ *level0_out = lp_build_clamp(int_bld, level, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index bb83ede9314..b019c3fa5e7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -274,7 +274,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, const struct pipe_sampler_state *sampler); -LLVMValueRef +void lp_build_lod_selector(struct lp_build_sample_context *bld, unsigned unit, const LLVMValueRef ddx[4], @@ -283,7 +283,10 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef width, LLVMValueRef height, - LLVMValueRef depth); + LLVMValueRef depth, + unsigned mip_filter, + LLVMValueRef *out_lod_ipart, + LLVMValueRef *out_lod_fpart); void lp_build_nearest_mip_level(struct lp_build_sample_context *bld, @@ -294,10 +297,9 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld, void lp_build_linear_mip_levels(struct lp_build_sample_context *bld, unsigned unit, - LLVMValueRef lod, + LLVMValueRef lod_ipart, LLVMValueRef *level0_out, - LLVMValueRef *level1_out, - LLVMValueRef *weight_out); + LLVMValueRef *level1_out); LLVMValueRef lp_build_get_mipmap_level(struct lp_build_sample_context *bld, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 49a6eed615f..8a55681166d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -882,13 +882,13 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, LLVMValueRef data_array, LLVMValueRef texel_out[4]) { - struct lp_build_context *float_bld = &bld->float_bld; + struct lp_build_context *int_bld = &bld->int_bld; LLVMBuilderRef builder = bld->builder; const unsigned mip_filter = bld->static_state->min_mip_filter; const unsigned min_filter = bld->static_state->min_img_filter; const unsigned mag_filter = bld->static_state->mag_img_filter; const int dims = texture_dims(bld->static_state->target); - LLVMValueRef lod = NULL, lod_fpart = NULL; + LLVMValueRef lod_ipart = NULL, lod_fpart = NULL; LLVMValueRef ilevel0, ilevel1 = NULL; LLVMValueRef width0_vec = NULL, height0_vec = NULL, depth0_vec = NULL; LLVMValueRef width1_vec = NULL, height1_vec = NULL, depth1_vec = NULL; @@ -936,7 +936,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, ddy = face_ddy; } - /* * Compute the level of detail (float). */ @@ -945,9 +944,13 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* Need to compute lod either to choose mipmap levels or to * distinguish between minification/magnification with one mipmap level. */ - lod = lp_build_lod_selector(bld, unit, ddx, ddy, - lod_bias, explicit_lod, - width, height, depth); + lp_build_lod_selector(bld, unit, ddx, ddy, + lod_bias, explicit_lod, + width, height, depth, + mip_filter, + &lod_ipart, &lod_fpart); + } else { + lod_ipart = LLVMConstInt(LLVMInt32Type(), 0, 0); } /* @@ -966,30 +969,29 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, * We should be able to set ilevel0 = const(0) but that causes * bad x86 code to be emitted. */ - lod = lp_build_const_elem(bld->coord_bld.type, 0.0); - lp_build_nearest_mip_level(bld, unit, lod, &ilevel0); + assert(lod_ipart); + lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); } else { ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0); } break; case PIPE_TEX_MIPFILTER_NEAREST: - assert(lod); - lp_build_nearest_mip_level(bld, unit, lod, &ilevel0); + assert(lod_ipart); + lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); break; case PIPE_TEX_MIPFILTER_LINEAR: { LLVMValueRef f256 = LLVMConstReal(LLVMFloatType(), 256.0); - LLVMValueRef i255 = lp_build_const_int32(255); + LLVMTypeRef i32_type = LLVMIntType(32); LLVMTypeRef i16_type = LLVMIntType(16); - assert(lod); + assert(lod_fpart); + + lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); - lp_build_linear_mip_levels(bld, unit, lod, &ilevel0, &ilevel1, - &lod_fpart); lod_fpart = LLVMBuildFMul(builder, lod_fpart, f256, ""); - lod_fpart = lp_build_ifloor(&bld->float_bld, lod_fpart); - lod_fpart = LLVMBuildAnd(builder, lod_fpart, i255, ""); + lod_fpart = LLVMBuildFPToSI(builder, lod_fpart, i32_type, ""); lod_fpart = LLVMBuildTrunc(builder, lod_fpart, i16_type, ""); lod_fpart = lp_build_broadcast_scalar(&h16, lod_fpart); @@ -1049,9 +1051,9 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, lp_build_flow_scope_declare(flow_ctx, &packed_lo); lp_build_flow_scope_declare(flow_ctx, &packed_hi); - /* minify = lod > 0.0 */ - minify = LLVMBuildFCmp(builder, LLVMRealUGE, - lod, float_bld->zero, ""); + /* minify = lod >= 0.0 */ + minify = LLVMBuildICmp(builder, LLVMIntSGE, + lod_ipart, int_bld->zero, ""); lp_build_if(&if_ctx, flow_ctx, builder, minify); { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index d464147371d..4f9bf6763e6 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -884,12 +884,12 @@ lp_build_sample_general(struct lp_build_sample_context *bld, LLVMValueRef data_array, LLVMValueRef *colors_out) { - struct lp_build_context *float_bld = &bld->float_bld; + struct lp_build_context *int_bld = &bld->int_bld; const unsigned mip_filter = bld->static_state->min_mip_filter; const unsigned min_filter = bld->static_state->min_img_filter; const unsigned mag_filter = bld->static_state->mag_img_filter; const int dims = texture_dims(bld->static_state->target); - LLVMValueRef lod = NULL, lod_fpart = NULL; + LLVMValueRef lod_ipart = NULL, lod_fpart = NULL; LLVMValueRef ilevel0, ilevel1 = NULL; LLVMValueRef width0_vec = NULL, height0_vec = NULL, depth0_vec = NULL; LLVMValueRef width1_vec = NULL, height1_vec = NULL, depth1_vec = NULL; @@ -935,9 +935,13 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* Need to compute lod either to choose mipmap levels or to * distinguish between minification/magnification with one mipmap level. */ - lod = lp_build_lod_selector(bld, unit, ddx, ddy, - lod_bias, explicit_lod, - width, height, depth); + lp_build_lod_selector(bld, unit, ddx, ddy, + lod_bias, explicit_lod, + width, height, depth, + mip_filter, + &lod_ipart, &lod_fpart); + } else { + lod_ipart = LLVMConstInt(LLVMInt32Type(), 0, 0); } /* @@ -950,22 +954,21 @@ lp_build_sample_general(struct lp_build_sample_context *bld, * We should be able to set ilevel0 = const(0) but that causes * bad x86 code to be emitted. */ - lod = lp_build_const_elem(bld->coord_bld.type, 0.0); - lp_build_nearest_mip_level(bld, unit, lod, &ilevel0); + assert(lod_ipart); + lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); } else { ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0); } } else { - assert(lod); + assert(lod_ipart); if (mip_filter == PIPE_TEX_MIPFILTER_NEAREST) { - lp_build_nearest_mip_level(bld, unit, lod, &ilevel0); + lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); } else { assert(mip_filter == PIPE_TEX_MIPFILTER_LINEAR); - lp_build_linear_mip_levels(bld, unit, lod, &ilevel0, &ilevel1, - &lod_fpart); + lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); lod_fpart = lp_build_broadcast_scalar(&bld->coord_bld, lod_fpart); } } @@ -1019,9 +1022,9 @@ lp_build_sample_general(struct lp_build_sample_context *bld, lp_build_flow_scope_declare(flow_ctx, &colors_out[2]); lp_build_flow_scope_declare(flow_ctx, &colors_out[3]); - /* minify = lod > 0.0 */ - minify = LLVMBuildFCmp(bld->builder, LLVMRealUGE, - lod, float_bld->zero, ""); + /* minify = lod >= 0.0 */ + minify = LLVMBuildICmp(bld->builder, LLVMIntSGE, + lod_ipart, int_bld->zero, ""); lp_build_if(&if_ctx, flow_ctx, bld->builder, minify); { -- cgit v1.2.3 From 33f88b3492af1f4f7e78c3688d481f1dee189822 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 10:09:37 +0100 Subject: util: Cleanup util_pack_z_stencil and friends. - Handle PIPE_FORMAT_Z32_FLOAT packing correctly. - In the integer version z shouldn't be passed as as double. - Make it clear that the integer versions should only be used for masks. - Make integer type sizes explicit (uint32_t for now, although uint64_t will be necessary later to encode f32_s8_x24). --- src/gallium/auxiliary/util/u_pack_color.h | 50 +++++++++++++++++-------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index c90b0fdbc3f..5378f2d782f 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -434,8 +434,8 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color * /* Integer versions of util_pack_z and util_pack_z_stencil - useful for * constructing clear masks. */ -static INLINE uint -util_pack_uint_z(enum pipe_format format, unsigned z) +static INLINE uint32_t +util_pack_mask_z(enum pipe_format format, uint32_t z) { switch (format) { case PIPE_FORMAT_Z16_UNORM: @@ -452,29 +452,32 @@ util_pack_uint_z(enum pipe_format format, unsigned z) case PIPE_FORMAT_S8_USCALED: return 0; default: - debug_print_format("gallium: unhandled format in util_pack_z()", format); + debug_print_format("gallium: unhandled format in util_pack_mask_z()", format); assert(0); return 0; } } -static INLINE uint -util_pack_uint_z_stencil(enum pipe_format format, double z, uint s) +static INLINE uint32_t +util_pack_mask_z_stencil(enum pipe_format format, uint32_t z, uint8_t s) { - unsigned packed = util_pack_uint_z(format, z); - - s &= 0xff; + uint32_t packed = util_pack_mask_z(format, z); switch (format) { case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - return packed | (s << 24); + packed |= (uint32_t)s << 24; + break; case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - return packed | s; + packed |= s; + break; case PIPE_FORMAT_S8_USCALED: - return packed | s; + packed |= s; + break; default: - return packed; + break; } + + return packed; } @@ -482,9 +485,11 @@ util_pack_uint_z_stencil(enum pipe_format format, double z, uint s) /** * Note: it's assumed that z is in [0,1] */ -static INLINE uint +static INLINE uint32_t util_pack_z(enum pipe_format format, double z) { + union fi fui; + if (z == 0.0) return 0; @@ -492,24 +497,25 @@ util_pack_z(enum pipe_format format, double z) case PIPE_FORMAT_Z16_UNORM: if (z == 1.0) return 0xffff; - return (uint) (z * 0xffff); + return (uint32_t) (z * 0xffff); case PIPE_FORMAT_Z32_UNORM: /* special-case to avoid overflow */ if (z == 1.0) return 0xffffffff; - return (uint) (z * 0xffffffff); + return (uint32_t) (z * 0xffffffff); case PIPE_FORMAT_Z32_FLOAT: - return (uint)z; + fui.f = (float)z; + return fui.ui; case PIPE_FORMAT_Z24_UNORM_S8_USCALED: case PIPE_FORMAT_Z24X8_UNORM: if (z == 1.0) return 0xffffff; - return (uint) (z * 0xffffff); + return (uint32_t) (z * 0xffffff); case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: if (z == 1.0) return 0xffffff00; - return ((uint) (z * 0xffffff)) << 8; + return ((uint32_t) (z * 0xffffff)) << 8; case PIPE_FORMAT_S8_USCALED: /* this case can get it via util_pack_z_stencil() */ return 0; @@ -525,14 +531,14 @@ util_pack_z(enum pipe_format format, double z) * Pack Z and/or stencil values into a 32-bit value described by format. * Note: it's assumed that z is in [0,1] and s in [0,255] */ -static INLINE uint -util_pack_z_stencil(enum pipe_format format, double z, uint s) +static INLINE uint32_t +util_pack_z_stencil(enum pipe_format format, double z, uint8_t s) { - unsigned packed = util_pack_z(format, z); + uint32_t packed = util_pack_z(format, z); switch (format) { case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - packed |= s << 24; + packed |= (uint32_t)s << 24; break; case PIPE_FORMAT_S8_USCALED_Z24_UNORM: packed |= s; -- cgit v1.2.3 From 9fe510ef35a783a244d0d54baa50f959a6b781dc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 10:11:15 +0100 Subject: llvmpipe: Cleanup depth-stencil clears. Only cosmetic changes. No actual practical difference. --- src/gallium/drivers/llvmpipe/lp_rast.c | 34 ++++++++++++++++++++++++--------- src/gallium/drivers/llvmpipe/lp_rast.h | 4 ++-- src/gallium/drivers/llvmpipe/lp_setup.c | 11 +++++++---- 3 files changed, 34 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index d7e6415e139..790d88a7450 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -211,8 +211,8 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg) { const struct lp_scene *scene = task->scene; - unsigned clear_value = arg.clear_zstencil.value; - unsigned clear_mask = arg.clear_zstencil.mask; + uint32_t clear_value = arg.clear_zstencil.value; + uint32_t clear_mask = arg.clear_zstencil.mask; const unsigned height = TILE_SIZE / TILE_VECTOR_HEIGHT; const unsigned width = TILE_SIZE * TILE_VECTOR_HEIGHT; const unsigned block_size = scene->zsbuf.blocksize; @@ -220,7 +220,8 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task, uint8_t *dst; unsigned i, j; - LP_DBG(DEBUG_RAST, "%s 0x%x%x\n", __FUNCTION__, clear_value, clear_mask); + LP_DBG(DEBUG_RAST, "%s: value=0x%08x, mask=0x%08x\n", + __FUNCTION__, clear_value, clear_mask); /* * Clear the aera of the swizzled depth/depth buffer matching this tile, in @@ -232,16 +233,31 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task, dst = task->depth_tile; + clear_value &= clear_mask; + switch (block_size) { case 1: + assert(clear_mask == 0xff); memset(dst, (uint8_t) clear_value, height * width); break; case 2: - for (i = 0; i < height; i++) { - uint16_t *row = (uint16_t *)dst; - for (j = 0; j < width; j++) - *row++ = (uint16_t) clear_value; - dst += dst_stride; + if (clear_mask == 0xffff) { + for (i = 0; i < height; i++) { + uint16_t *row = (uint16_t *)dst; + for (j = 0; j < width; j++) + *row++ = (uint16_t) clear_value; + dst += dst_stride; + } + } + else { + for (i = 0; i < height; i++) { + uint16_t *row = (uint16_t *)dst; + for (j = 0; j < width; j++) { + uint16_t tmp = ~clear_mask & *row; + *row++ = clear_value | tmp; + } + dst += dst_stride; + } } break; case 4: @@ -258,7 +274,7 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task, uint32_t *row = (uint32_t *)dst; for (j = 0; j < width; j++) { uint32_t tmp = ~clear_mask & *row; - *row++ = (clear_value & clear_mask) | tmp; + *row++ = clear_value | tmp; } dst += dst_stride; } diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index c55b97a9d13..0f62377c072 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -149,8 +149,8 @@ union lp_rast_cmd_arg { const struct lp_rast_state *set_state; uint8_t clear_color[4]; struct { - unsigned value; - unsigned mask; + uint32_t value; + uint32_t mask; } clear_zstencil; struct lp_fence *fence; struct llvmpipe_query *query_obj; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 5ff11a33632..e72ead0def4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -377,16 +377,19 @@ lp_setup_try_clear( struct lp_setup_context *setup, } if (flags & PIPE_CLEAR_DEPTHSTENCIL) { - unsigned zmask = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0; - unsigned smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0; + uint32_t zmask = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0; + uint32_t smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0; zsvalue = util_pack_z_stencil(setup->fb.zsbuf->format, depth, stencil); - zsmask = util_pack_uint_z_stencil(setup->fb.zsbuf->format, + + zsmask = util_pack_mask_z_stencil(setup->fb.zsbuf->format, zmask, smask); + + zsvalue &= zsmask; } if (setup->state == SETUP_ACTIVE) { @@ -431,7 +434,7 @@ lp_setup_try_clear( struct lp_setup_context *setup, if (flags & PIPE_CLEAR_COLOR) { memcpy(setup->clear.color.clear_color, &color_arg, - sizeof color_arg); + sizeof setup->clear.color.clear_color); } } -- cgit v1.2.3 From 5eeaf3671e2f913d38187fd1401c4b22a2900d57 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 11:25:05 -0700 Subject: i965: Fix botch in the header_present case in the new FS. I only set it on the color_regions == 0 case, missing the important case, causing GPU hangs on pre-gen6. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a380eb44525..6e5ea0782e1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1920,6 +1920,7 @@ fs_visitor::emit_fb_writes() inst->mlen = nr; if (target == c->key.nr_color_regions - 1) inst->eot = true; + inst->header_present = header_present; } if (c->key.nr_color_regions == 0) { -- cgit v1.2.3 From 5d99b01501128c7179cdd6aa29bc8953d0d81e75 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 10:22:22 -0700 Subject: i965: Add some clarification of the WECtrl field. --- src/mesa/drivers/dri/i965/brw_defines.h | 21 +++++++++++++++++++-- src/mesa/drivers/dri/i965/brw_disasm.c | 4 ++-- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index f9c12e15558..9633c95ff50 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -501,9 +501,26 @@ #define BRW_MASK_ENABLE 0 #define BRW_MASK_DISABLE 1 -/* Sandybridge is WECtrl (Write enable control) */ +/** @{ + * + * Gen6 has replaced "mask enable/disable" with WECtrl, which is + * effectively the same but much simpler to think about. Now, there + * are two contributors ANDed together to whether channels are + * executed: The predication on the instruction, and the channel write + * enable. + */ +/** + * This is the default value. It means that a channel's write enable is set + * if the per-channel IP is pointing at this instruction. + */ #define BRW_WE_NORMAL 0 -#define BRW_WE_KILL_PRED 1 +/** + * This is used like BRW_MASK_DISABLE, and causes all channels to have + * their write enable set. Note that predication still contributes to + * whether the channel actually gets written. + */ +#define BRW_WE_ALL 1 +/** @} */ #define BRW_OPCODE_MOV 1 #define BRW_OPCODE_SEL 2 diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index be27f9226c3..12b8f2e4678 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -165,8 +165,8 @@ char *accwr[2] = { }; char *wectrl[2] = { - [0] = "WEnormal", - [1] = "WEpredicted" + [0] = "WE_normal", + [1] = "WE_all" }; char *exec_size[8] = { -- cgit v1.2.3 From fe6efc25ed3c1edf26073c4e6b6a3a45c857c1eb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 11:00:31 -0700 Subject: i965: Don't do 1/w multiplication in new FS for gen6 Not needed now that we're doing barycentric. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 6e5ea0782e1..7327c3a700e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -810,12 +810,14 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) } attr.reg_offset -= type->vector_elements; - for (unsigned int c = 0; c < type->vector_elements; c++) { - emit(fs_inst(BRW_OPCODE_MUL, - attr, - attr, - this->pixel_w)); - attr.reg_offset++; + if (intel->gen < 6) { + for (unsigned int c = 0; c < type->vector_elements; c++) { + emit(fs_inst(BRW_OPCODE_MUL, + attr, + attr, + this->pixel_w)); + attr.reg_offset++; + } } location++; } -- cgit v1.2.3 From 75270f705f319b0ecf297d1bdd328e52a8a956aa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 11:04:02 -0700 Subject: i965: Gen6's sampler messages are the same as Ironlake. This should fix texturing in the new FS backend. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 7327c3a700e..19739901619 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2054,7 +2054,7 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) int rlen = 4; uint32_t simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8; - if (intel->gen == 5) { + if (intel->gen >= 5) { switch (inst->opcode) { case FS_OPCODE_TEX: if (inst->shadow_compare) { -- cgit v1.2.3 From a760b5b509f85991a10400977576afabcedbb3c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 11:13:22 -0700 Subject: i965: Refactor gl_FrontFacing setup out of general variable setup. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 53 +++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 19739901619..c5013f05745 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -474,8 +474,9 @@ public: void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void emit_dummy_fs(); - void emit_fragcoord_interpolation(ir_variable *ir); - void emit_general_interpolation(ir_variable *ir); + fs_reg *emit_fragcoord_interpolation(ir_variable *ir); + fs_reg *emit_frontfacing_interpolation(ir_variable *ir); + fs_reg *emit_general_interpolation(ir_variable *ir); void emit_interpolation_setup_gen4(); void emit_interpolation_setup_gen6(); fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate); @@ -721,7 +722,7 @@ fs_visitor::setup_builtin_uniform_values(ir_variable *ir) } } -void +fs_reg * fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) { fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); @@ -761,11 +762,10 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) /* gl_FragCoord.w: Already set up in emit_interpolation */ emit(fs_inst(BRW_OPCODE_MOV, wpos, this->wpos_w)); - hash_table_insert(this->variable_ht, reg, ir); + return reg; } - -void +fs_reg * fs_visitor::emit_general_interpolation(ir_variable *ir) { fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); @@ -823,7 +823,25 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) } } - hash_table_insert(this->variable_ht, reg, ir); + return reg; +} + +fs_reg * +fs_visitor::emit_frontfacing_interpolation(ir_variable *ir) +{ + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); + /* bit 31 is "primitive is back face", so checking < (1 << 31) gives + * us front face + */ + fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, + *reg, + fs_reg(r1_6ud), + fs_reg(1u << 31))); + inst->conditional_mod = BRW_CONDITIONAL_L; + emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); + + return reg; } void @@ -844,24 +862,15 @@ fs_visitor::visit(ir_variable *ir) if (ir->mode == ir_var_in) { if (!strcmp(ir->name, "gl_FragCoord")) { - emit_fragcoord_interpolation(ir); - return; + reg = emit_fragcoord_interpolation(ir); } else if (!strcmp(ir->name, "gl_FrontFacing")) { - reg = new(this->mem_ctx) fs_reg(this, ir->type); - struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); - /* bit 31 is "primitive is back face", so checking < (1 << 31) gives - * us front face - */ - fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, - *reg, - fs_reg(r1_6ud), - fs_reg(1u << 31))); - inst->conditional_mod = BRW_CONDITIONAL_L; - emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); + reg = emit_frontfacing_interpolation(ir); } else { - emit_general_interpolation(ir); - return; + reg = emit_general_interpolation(ir); } + assert(reg); + hash_table_insert(this->variable_ht, reg, ir); + return; } if (ir->mode == ir_var_uniform) { -- cgit v1.2.3 From 1fdc8c007ea66b4c9866bf2c679653a005307fa5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 11:19:48 -0700 Subject: i965: Add support for gl_FrontFacing on gen6. Fixes glsl1-gl_FrontFacing var (2) with new FS. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 49 ++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c5013f05745..1ccf695a597 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -830,16 +830,33 @@ fs_reg * fs_visitor::emit_frontfacing_interpolation(ir_variable *ir) { fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); - struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); - /* bit 31 is "primitive is back face", so checking < (1 << 31) gives - * us front face - */ - fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, - *reg, - fs_reg(r1_6ud), - fs_reg(1u << 31))); - inst->conditional_mod = BRW_CONDITIONAL_L; - emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); + + /* The frontfacing comes in as a bit in the thread payload. */ + if (intel->gen >= 6) { + emit(fs_inst(BRW_OPCODE_ASR, + *reg, + fs_reg(retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_D)), + fs_reg(15))); + emit(fs_inst(BRW_OPCODE_NOT, + *reg, + *reg)); + emit(fs_inst(BRW_OPCODE_AND, + *reg, + *reg, + fs_reg(1))); + } else { + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); + /* bit 31 is "primitive is back face", so checking < (1 << 31) gives + * us front face + */ + fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, + *reg, + fs_reg(r1_6ud), + fs_reg(1u << 31))); + inst->conditional_mod = BRW_CONDITIONAL_L; + emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); + } return reg; } @@ -2818,6 +2835,18 @@ fs_visitor::generate_code() case BRW_OPCODE_XOR: brw_XOR(p, dst, src[0], src[1]); break; + case BRW_OPCODE_NOT: + brw_NOT(p, dst, src[0]); + break; + case BRW_OPCODE_ASR: + brw_ASR(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_SHR: + brw_SHR(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_SHL: + brw_SHL(p, dst, src[0], src[1]); + break; case BRW_OPCODE_CMP: brw_CMP(p, dst, inst->conditional_mod, src[0], src[1]); -- cgit v1.2.3 From b380531fd40e0876218b1116502bafea7911bd3d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 12:10:31 -0700 Subject: i965: Don't assume that WPOS is always provided on gen6 in the new FS. We sensibly only provide it if the FS asks for it. We could actually skip WPOS unless the FS needed WPOS.zw, but that's something for later. Fixes: glsl-texture2d and probably many others. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 1ccf695a597..b93c27ec8ff 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2258,8 +2258,7 @@ fs_visitor::calculate_urb_setup() /* Figure out where each of the incoming setup attributes lands. */ if (intel->gen >= 6) { for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { - if (i == FRAG_ATTRIB_WPOS || - (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i))) { + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i)) { urb_setup[i] = urb_next++; } } -- cgit v1.2.3 From d3163912c1f15fcb44beb33c5069799d56e1dc16 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Oct 2010 17:29:29 -0700 Subject: i965: Fix gen6 pointsize handling to match pre-gen6. Fixes point-line-no-cull. Bug #30532 --- src/mesa/drivers/dri/i965/gen6_sf_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 6c883381958..b2a6bd04e2f 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -125,7 +125,8 @@ upload_sf_state(struct brw_context *brw) } /* _NEW_POINT */ - if (ctx->Point._Attenuated) + if (!(ctx->VertexProgram.PointSizeEnabled || + ctx->Point._Attenuated)) dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH; dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 225.875), 3) << -- cgit v1.2.3 From da495ee8708d655742eff7b0cf1fee8f71ed10e9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 7 Oct 2010 12:06:07 +0800 Subject: targets/egl: Fix linking with libdrm. --- src/gallium/targets/egl/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 47c24cefe5c..38e60dbafbf 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -24,7 +24,9 @@ common_CPPFLAGS := \ -I$(TOP)/src/gallium/auxiliary \ -I$(TOP)/src/gallium/drivers \ -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/winsys + -I$(TOP)/src/gallium/winsys \ + $(LIBDRM_CFLAGS) + common_SYS := common_LIBS := \ $(TOP)/src/gallium/drivers/identity/libidentity.a \ @@ -41,11 +43,11 @@ egl_SYS := -lm $(DLOPEN_LIBS) -L$(TOP)/$(LIB_DIR) -lEGL egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a ifneq ($(findstring x11, $(EGL_PLATFORMS)),) -egl_SYS += -lX11 -lXext -lXfixes +egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB) egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a endif -ifneq ($(findstring kms, $(EGL_PLATFORMS)),) -egl_SYS += -ldrm +ifneq ($(findstring drm, $(EGL_PLATFORMS)),) +egl_SYS += $(LIBDRM_LIB) endif ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a -- cgit v1.2.3 From b2c0ef8b51ce86388335e83f2390940cb8fbc12f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 7 Oct 2010 12:14:38 +0800 Subject: st/vega: Fix version check in context creation. This fixes a regression since 4531356817ec8383ac35932903773de67af92e37. --- src/gallium/state_trackers/vega/vg_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index e7996741d14..232deefa166 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -352,7 +352,7 @@ vg_api_create_context(struct st_api *stapi, struct st_manager *smapi, return NULL; /* only 1.0 is supported */ - if (attribs->major != 1 || attribs->minor > 0) + if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0)) return NULL; pipe = smapi->screen->context_create(smapi->screen, NULL); -- cgit v1.2.3 From 84457701b05ef29126d90c2fe72083278d26bd4f Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 6 Oct 2010 21:14:15 +0300 Subject: r600g: fix evergreen interpolation setup interp data is stored in gpr0 so first interp overwrote it and subsequent ones got wrong values reserve register 0 so it's not used for attribs. alternative is to interpolate attrib0 last (reverse, as r600c does) --- src/gallium/drivers/r600/r600_shader.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 016e75bd52b..1f79c15a2b5 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -529,6 +529,9 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s if (ctx.type == TGSI_PROCESSOR_VERTEX) { ctx.file_offset[TGSI_FILE_INPUT] = 1; } + if (ctx.type == TGSI_PROCESSOR_FRAGMENT && ctx.bc->chiprev == 2) { + ctx.file_offset[TGSI_FILE_INPUT] = 1; + } ctx.file_offset[TGSI_FILE_OUTPUT] = ctx.file_offset[TGSI_FILE_INPUT] + ctx.info.file_count[TGSI_FILE_INPUT]; ctx.file_offset[TGSI_FILE_TEMPORARY] = ctx.file_offset[TGSI_FILE_OUTPUT] + -- cgit v1.2.3 From 97eea87bde5d05f247580aeb2963ac2476417bd5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Oct 2010 15:13:09 +1000 Subject: r600g: use format from the sampler view not from the texture. we want to use the format from the sampler view which isn't always the same as the texture format when creating sampler views. --- src/gallium/drivers/r600/evergreen_state.c | 6 +++--- src/gallium/drivers/r600/r600_state.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 603a8a7b915..0fd1d399518 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -424,15 +424,15 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte swizzle[1] = state->swizzle_g; swizzle[2] = state->swizzle_b; swizzle[3] = state->swizzle_a; - format = r600_translate_texformat(texture->format, + format = r600_translate_texformat(state->format, swizzle, &word4, &yuv_format); if (format == ~0) { format = 0; } - desc = util_format_description(texture->format); + desc = util_format_description(state->format); if (desc == NULL) { - R600_ERR("unknow format %d\n", texture->format); + R600_ERR("unknow format %d\n", state->format); } tmp = (struct r600_resource_texture*)texture; rbuffer = &tmp->resource; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b55c3450059..7ceedf6363b 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -626,15 +626,15 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c swizzle[1] = state->swizzle_g; swizzle[2] = state->swizzle_b; swizzle[3] = state->swizzle_a; - format = r600_translate_texformat(texture->format, + format = r600_translate_texformat(state->format, swizzle, &word4, &yuv_format); if (format == ~0) { format = 0; } - desc = util_format_description(texture->format); + desc = util_format_description(state->format); if (desc == NULL) { - R600_ERR("unknow format %d\n", texture->format); + R600_ERR("unknow format %d\n", state->format); } tmp = (struct r600_resource_texture*)texture; rbuffer = &tmp->resource; -- cgit v1.2.3 From 51f9cc4759c23b74a2e4d9c79b0a5df27d403f54 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Oct 2010 15:32:05 +1000 Subject: r600g: fix Z export enable bits. we should be checking output array not input to decide. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1f79c15a2b5..366d5d9c351 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -132,7 +132,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL); } for (i = 0; i < rshader->noutput; i++) { - if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) + if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, S_02880C_Z_EXPORT_ENABLE(1), -- cgit v1.2.3 From 321ec1a22468c1f23bbbf7d5c9de53d4687fec0c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 7 Oct 2010 22:03:59 +0100 Subject: gallivm: Vectorize the rho computation. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 92 ++++++++++++++--------- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 13 +++- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 24 ++++++ 3 files changed, 92 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 3287cf7c376..a6a64f38c84 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -171,9 +171,6 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, * Generate code to compute coordinate gradient (rho). * \param ddx partial derivatives of (s, t, r, q) with respect to X * \param ddy partial derivatives of (s, t, r, q) with respect to Y - * \param width scalar int texture width - * \param height scalar int texture height - * \param depth scalar int texture depth * * XXX: The resulting rho is scalar, so we ignore all but the first element of * derivatives that are passed by the shader. @@ -181,52 +178,75 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, static LLVMValueRef lp_build_rho(struct lp_build_sample_context *bld, const LLVMValueRef ddx[4], - const LLVMValueRef ddy[4], - LLVMValueRef width, - LLVMValueRef height, - LLVMValueRef depth) + const LLVMValueRef ddy[4]) { + struct lp_build_context *float_size_bld = &bld->float_size_bld; struct lp_build_context *float_bld = &bld->float_bld; const int dims = texture_dims(bld->static_state->target); - LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0); - LLVMValueRef dsdx, dsdy; - LLVMValueRef dtdx = NULL, dtdy = NULL, drdx = NULL, drdy = NULL; + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0); + LLVMValueRef index1 = LLVMConstInt(i32t, 1, 0); + LLVMValueRef index2 = LLVMConstInt(i32t, 2, 0); + LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy; + LLVMValueRef rho_x, rho_y; + LLVMValueRef rho_vec; + LLVMValueRef float_size; LLVMValueRef rho; dsdx = LLVMBuildExtractElement(bld->builder, ddx[0], index0, "dsdx"); - dsdx = lp_build_abs(float_bld, dsdx); dsdy = LLVMBuildExtractElement(bld->builder, ddy[0], index0, "dsdy"); - dsdy = lp_build_abs(float_bld, dsdy); - if (dims > 1) { + + if (dims <= 1) { + rho_x = dsdx; + rho_y = dsdy; + } + else { + rho_x = float_size_bld->undef; + rho_y = float_size_bld->undef; + + rho_x = LLVMBuildInsertElement(bld->builder, rho_x, dsdx, index0, ""); + rho_y = LLVMBuildInsertElement(bld->builder, rho_y, dsdy, index0, ""); + dtdx = LLVMBuildExtractElement(bld->builder, ddx[1], index0, "dtdx"); - dtdx = lp_build_abs(float_bld, dtdx); dtdy = LLVMBuildExtractElement(bld->builder, ddy[1], index0, "dtdy"); - dtdy = lp_build_abs(float_bld, dtdy); - if (dims > 2) { + + rho_x = LLVMBuildInsertElement(bld->builder, rho_x, dtdx, index1, ""); + rho_y = LLVMBuildInsertElement(bld->builder, rho_y, dtdy, index1, ""); + + if (dims >= 3) { drdx = LLVMBuildExtractElement(bld->builder, ddx[2], index0, "drdx"); - drdx = lp_build_abs(float_bld, drdx); drdy = LLVMBuildExtractElement(bld->builder, ddy[2], index0, "drdy"); - drdy = lp_build_abs(float_bld, drdy); + + rho_x = LLVMBuildInsertElement(bld->builder, rho_x, drdx, index2, ""); + rho_y = LLVMBuildInsertElement(bld->builder, rho_y, drdy, index2, ""); } } - /* Compute rho = max of all partial derivatives scaled by texture size. - * XXX this could be vectorized somewhat - */ - rho = LLVMBuildFMul(bld->builder, - lp_build_max(float_bld, dsdx, dsdy), - lp_build_int_to_float(float_bld, width), ""); - if (dims > 1) { - LLVMValueRef max; - max = LLVMBuildFMul(bld->builder, - lp_build_max(float_bld, dtdx, dtdy), - lp_build_int_to_float(float_bld, height), ""); - rho = lp_build_max(float_bld, rho, max); - if (dims > 2) { - max = LLVMBuildFMul(bld->builder, - lp_build_max(float_bld, drdx, drdy), - lp_build_int_to_float(float_bld, depth), ""); - rho = lp_build_max(float_bld, rho, max); + rho_x = lp_build_abs(float_size_bld, rho_x); + rho_y = lp_build_abs(float_size_bld, rho_y); + + rho_vec = lp_build_max(float_size_bld, rho_x, rho_y); + + float_size = lp_build_int_to_float(float_size_bld, bld->uint_size); + + rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size); + + if (dims <= 1) { + rho = rho_vec; + } + else { + if (dims >= 2) { + LLVMValueRef rho_s, rho_t, rho_r; + + rho_s = LLVMBuildExtractElement(bld->builder, rho_vec, index0, ""); + rho_t = LLVMBuildExtractElement(bld->builder, rho_vec, index1, ""); + + rho = lp_build_max(float_bld, rho_s, rho_t); + + if (dims >= 3) { + rho_r = LLVMBuildExtractElement(bld->builder, rho_vec, index0, ""); + rho = lp_build_max(float_bld, rho, rho_r); + } } } @@ -289,7 +309,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, else { LLVMValueRef rho; - rho = lp_build_rho(bld, ddx, ddy, width, height, depth); + rho = lp_build_rho(bld, ddx, ddy); /* compute lod = log2(rho) */ if ((mip_filter == PIPE_TEX_MIPFILTER_NONE || diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index b019c3fa5e7..1dd78a07a24 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -202,9 +202,20 @@ struct lp_build_sample_context struct lp_type int_coord_type; struct lp_build_context int_coord_bld; + /** Unsigned integer texture size */ + struct lp_type uint_size_type; + struct lp_build_context uint_size_bld; + + /** Unsigned integer texture size */ + struct lp_type float_size_type; + struct lp_build_context float_size_bld; + /** Output texels type and build context */ struct lp_type texel_type; struct lp_build_context texel_bld; + + /** Unsigned vector with texture width, height, depth */ + LLVMValueRef uint_size; }; @@ -241,7 +252,7 @@ apply_sampler_swizzle(struct lp_build_sample_context *bld, } -static INLINE int +static INLINE unsigned texture_dims(enum pipe_texture_target tex) { switch (tex) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 4f9bf6763e6..74362abf455 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1141,7 +1141,9 @@ lp_build_sample_soa(LLVMBuilderRef builder, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef texel_out[4]) { + unsigned dims = texture_dims(static_state->target); struct lp_build_sample_context bld; + LLVMTypeRef i32t = LLVMInt32Type(); LLVMValueRef width, width_vec; LLVMValueRef height, height_vec; LLVMValueRef depth, depth_vec; @@ -1171,6 +1173,9 @@ lp_build_sample_soa(LLVMBuilderRef builder, bld.coord_type = type; bld.uint_coord_type = lp_uint_type(type); bld.int_coord_type = lp_int_type(type); + bld.float_size_type = lp_type_float(32); + bld.float_size_type.length = dims > 1 ? 4 : 1; + bld.uint_size_type = lp_uint_type(bld.float_size_type); bld.texel_type = type; float_vec_type = lp_type_float_vec(32); @@ -1181,6 +1186,8 @@ lp_build_sample_soa(LLVMBuilderRef builder, lp_build_context_init(&bld.coord_bld, builder, bld.coord_type); lp_build_context_init(&bld.uint_coord_bld, builder, bld.uint_coord_type); lp_build_context_init(&bld.int_coord_bld, builder, bld.int_coord_type); + lp_build_context_init(&bld.uint_size_bld, builder, bld.uint_size_type); + lp_build_context_init(&bld.float_size_bld, builder, bld.float_size_type); lp_build_context_init(&bld.texel_bld, builder, bld.texel_type); /* Get the dynamic state */ @@ -1196,6 +1203,23 @@ lp_build_sample_soa(LLVMBuilderRef builder, t = coords[1]; r = coords[2]; + /* width, height, depth as single uint vector */ + if (dims <= 1) { + bld.uint_size = width; + } + else { + bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size_bld.undef, + width, LLVMConstInt(i32t, 0, 0), ""); + if (dims >= 2) { + bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size, + height, LLVMConstInt(i32t, 1, 0), ""); + if (dims >= 3) { + bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size, + depth, LLVMConstInt(i32t, 2, 0), ""); + } + } + } + /* width, height, depth as uint vectors */ width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, width); height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, height); -- cgit v1.2.3 From 1d595c7cd4aefc7baf1942626f53bec8f6699f7f Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 7 Oct 2010 17:03:53 -0400 Subject: gles2: Add GL_EXT_texture_format_BGRA8888 support --- src/mesa/drivers/dri/intel/intel_extensions_es2.c | 1 + src/mesa/main/APIspec.xml | 11 ++++++++++- src/mesa/main/extensions.c | 4 ++++ src/mesa/main/mtypes.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c index 24f64045ef8..ed5db20e38a 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c +++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c @@ -69,6 +69,7 @@ static const char *es2_extensions[] = { "GL_ARB_depth_texture", "GL_EXT_packed_depth_stencil", "GL_EXT_framebuffer_object", + "GL_EXT_texture_format_BGRA8888", #if FEATURE_OES_EGL_image "GL_OES_EGL_image", diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml index 4c5fd59d4fb..4dc0b0d4851 100644 --- a/src/mesa/main/APIspec.xml +++ b/src/mesa/main/APIspec.xml @@ -383,6 +383,7 @@ + @@ -458,11 +459,18 @@ - + + + + + + + +