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/gallium') diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst index ee3419ccfc..d547055096 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/gallium') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 2de764c4ee..f05538bbac 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 294df30094..baaa26fea9 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 937b093479..b07de76a49 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 4f0d30123a..1f27cbf488 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 eac21110be..d1aba76309 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 d406a86ccb..5ea552f51c 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 ee2945c7c9..40843c58c2 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 362f563ba6..d417f825a0 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 39d204de8a..c5d61f840f 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 ded242d3dc..50bc2eea5f 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 2599bd5ca0..0fe333ae8a 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 8c2d8b6154..18a7bbe0f9 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/gallium') diff --git a/src/gallium/docs/source/pipeline.txt b/src/gallium/docs/source/pipeline.txt new file mode 100644 index 0000000000..fd1fbe9c76 --- /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/gallium') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index 23f045ecf6..db352de939 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/gallium') diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c index db352de939..e543fda50e 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/gallium') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 5480ca002d..cbfa44868e 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 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 6ec9095a74..ac69c7848e 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 676540538e..42127a138a 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 37b02bbec7..33c4c8ca6d 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 49af9b59be..a8f7721337 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 8c1a5999cf..8057ec9fcf 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index a8f7721337..7c9342b747 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 ad6bdeb27c..6e15230b48 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 8057ec9fcf..7d2989da05 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 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/gallium') diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index c9003c97f5..ab480cabd0 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 7d2989da05..1a2fe758a8 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index f1d8202dff..16c2dab9af 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index 42127a138a..c88e7ba742 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_pc_regalloc.c b/src/gallium/drivers/nv50/nv50_pc_regalloc.c index b9d5ba5ef6..39ae36681c 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index d6f417e1e3..ad8aa4ca9a 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 bca78ee8de..25344c6f82 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/gallium') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 0d17f75da7..93dc142011 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 62a46cb0e1..6aadf72957 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 4da6850b0a..eac46a7ae6 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/gallium') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 93dc142011..8c01987318 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/gallium') 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 0000000000..9473a0e5f4 --- /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 208f73306c..94880c3696 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 cd8e4ff0b2..3a9b1a6788 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/gallium') diff --git a/configure.ac b/configure.ac index bf8feb6352..b19bf8fdf2 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 4758267294..d38f2dd7b7 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 baee1a2f9d..19085a31f1 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 31ff090484..cc0f03e01b 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 4199d7c6ba..8dbfc5b8e5 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 33a838fb79..ce2b1f7bb9 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 9f34c517ef..3c3f57e267 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 0000000000..5d6a07e2fd --- /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 0000000000..8ffdde66ba --- /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 0000000000..3a9b1a6788 --- /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 9473a0e5f4..0000000000 --- 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 94880c3696..0000000000 --- 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 3a9b1a6788..0000000000 --- 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/gallium') diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c index 5d6a07e2fd..06a6077053 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 8ffdde66ba..f6dc558437 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 3a9b1a6788..03c4fe01dc 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 776dc24569..f07cbfc2cc 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 cbfa44868e..00a6aeaef2 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 65ba96233d..8cf6a78130 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/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 274679d127..b7a12edc20 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index bce2707e77..7cbacea89a 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 12900cce11..298cc4eadd 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 b7a12edc20..d41150c938 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 5f9f21db1b..5249194eb1 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 8cf6a78130..b8744b00eb 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 8114526a14..daaf2cbc51 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/gallium') diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index af99163b2e..f78b6838a7 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/gallium') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index e588c5b7bd..4c1f47ac67 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index b8744b00eb..93dc927aba 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index f07cbfc2cc..776dc24569 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 00a6aeaef2..cbfa44868e 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/gallium') diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c index 1832425658..a3fd7e8430 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 876ae5a0ce..1d47d13c9f 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 fccd2f55ef..1742941cc1 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 5a918fe6bc..2ad577915e 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/gallium') diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c index 47390fbcee..06caa45469 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 4f3eb75dc4..2fce725bc9 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/gallium') diff --git a/src/gallium/targets/SConscript.dri b/src/gallium/targets/SConscript.dri index e5981c2461..bc8d179e3d 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index ad8aa4ca9a..65a5c6434b 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 25344c6f82..5e43085c62 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/gallium') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 2de764c4ee..c339f72fe2 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 294df30094..144d929f68 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 0000000000..65b079ed53 --- /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 0000000000..01a6cae94f --- /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 0ea11e5bfc..9247064508 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/gallium') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index cbfa44868e..5cebf67b07 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index b04885a85f..57fc12ccf1 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 4dcdc492fc..e347943873 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 5249194eb1..06b5cec5a6 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e347943873..2b97c2a94e 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/gallium') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 5cebf67b07..ca205932bd 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 65a5c6434b..e8cf577c76 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 5e43085c62..627a820d59 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 86c10a877d..38fab4bbb6 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 627a820d59..17851a9b6e 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 17851a9b6e..5ad396dc15 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 07bfc0593e..3ca3cc764b 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 5ad396dc15..1aefc705a8 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index e8cf577c76..1d3a3e11c1 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 776dc24569..97b21d5e31 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 ca205932bd..51c9b06549 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 1aefc705a8..86bcec727c 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 298cc4eadd..023b09ef65 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 6ddb1ad32a..cd1c31e82d 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 eac46a7ae6..773e5f6cb1 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 38fab4bbb6..a190204ef4 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 86bcec727c..ed7c6b40a4 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 50b25a9940..f7ef266f7d 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/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 4e3514638b..bee2a8adcf 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 b4c21d9e12..9ffdd75582 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/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index bee2a8adcf..0a42abcdf2 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 9ffdd75582..283f1e59b3 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 d41150c938..369e5d28d0 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/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 369e5d28d0..0d24f6ab0d 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index ed7c6b40a4..020d16287f 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 de717f3536..1c8075ebdb 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 f7ef266f7d..76e185ac03 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 773e5f6cb1..bce5297313 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 57fc12ccf1..a4739021c4 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 020d16287f..fe6635df94 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 3ca3cc764b..f1aa49c0f7 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index fe6635df94..a4cd1bf1a1 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/gallium') diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 72dccdf150..ad7d27acbb 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/gallium') diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c index 0cd620189b..781fe6334a 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 b4e90a957d..63ef7f867a 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 ad7d27acbb..f2591c5721 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/gallium') diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript index 6f9336b5ac..172f92d6b8 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 7cbacea89a..a123eb62e0 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 54fbc50bbc..0506e8280a 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 97b21d5e31..72aab91d04 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 a4cd1bf1a1..271bd1ac50 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 1711fabfc7..d280a45bab 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 4be77865fb..502444f03a 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 2b97c2a94e..424f7a8913 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 a190204ef4..ffb18ab7fb 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 0d24f6ab0d..6633258090 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 06b5cec5a6..e52dcb4a34 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 af9b9187ab..fdcadffc53 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 7a9025ad3c..d02562f17f 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 f39d020559..c3d345fef9 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 c284f6aa7d..85aea89c70 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 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index ff0e207a54..84c66dd36e 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 2d80db6dc9..f86d0553c7 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/gallium') diff --git a/src/gallium/include/state_tracker/sw_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h index d461dedb90..0b11fe3beb 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 5590d40892..425fecd5da 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/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index e472947507..b3123ed016 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 425fecd5da..e9b9262617 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index e54dd9f0a3..fb673db6d0 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 2914e7d7ef..4999b8dca1 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index 0bad7320f3..b81c2cfd15 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 5538987151..5521cbbe87 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bce5297313..523b6d2451 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 5521cbbe87..fb4fb2c436 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 523b6d2451..1702475fa3 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 6674d281d1..ea7002aafc 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 b94061b7d4..81ff43f8ad 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 80b356476a..8506ed2dc9 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 fb4fb2c436..f8f411f4f1 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 b81c2cfd15..dbd73812e4 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/gallium') diff --git a/src/gallium/tests/python/samples/tri.py b/src/gallium/tests/python/samples/tri.py index fed929d420..6d17c88c05 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index f8f411f4f1..bb6b88069b 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/gallium') diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index dc3fc812e1..ea370782fd 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 72aab91d04..7a63d966eb 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 023b09ef65..6e50701de6 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 1702475fa3..e1e2891b6e 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 ffb18ab7fb..5269e6db91 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 6633258090..abfe406402 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 e52dcb4a34..a7e7982c19 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 93dc927aba..148cf6d81d 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 8b92543987..c575a8ac7c 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/gallium') diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index eb268d5bc0..2c1b2f5be4 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 148cf6d81d..897938c2ca 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index bb6b88069b..774a3c80da 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index 40843c58c2..3646c6a714 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 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/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 0757f05dfa..3a71540506 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/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 13e2e8eb99..83a6d75896 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 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/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 83a6d75896..67deffbd11 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/gallium') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 8c01987318..dcb1b4fccc 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/gallium') diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index 2c1b2f5be4..eb268d5bc0 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index abfe406402..f60fe9f316 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 1d3a3e11c1..3d10095919 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 462f31cc79..9f8007c8e9 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 c26ba6c6cd..518e05fefb 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 a4739021c4..25dd8fe7d8 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e1e2891b6e..e18c6ce605 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/Makefile b/src/gallium/state_trackers/d3d1x/Makefile new file mode 100644 index 0000000000..6d55376be1 --- /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 0000000000..1b9423b9d6 --- /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 0000000000..6ac74d1895 --- /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 0000000000..44fce81079 --- /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 0000000000..923942a778 --- /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 0000000000..2761b794d5 --- /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 0000000000..a3feec7446 --- /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 0000000000..6b696ae1af --- /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 0000000000..a100ee5c3f --- /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 0000000000..2e6e0949a8 --- /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 0000000000..a4f6cc6b66 --- /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 0000000000..94192c9279 --- /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 0000000000..6e77b51175 --- /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 0000000000..721f95fc8a --- /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 0000000000..f986f8e5f1 --- /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 0000000000..a9260acdba --- /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 0000000000..da28e64384 --- /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 0000000000..8b16b1bcbc --- /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 0000000000..c371bbea13 --- /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 0000000000..b507e09890 --- /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 0000000000..d2241e643e --- /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 0000000000..c4668a87dd --- /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 0000000000..5a57da36ee --- /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 0000000000..09588a02f5 --- /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 0000000000..3594bf58f8 --- /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 0000000000..d268e43c0d --- /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 0000000000..28846e9601 --- /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 0000000000..9584407693 --- /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 0000000000..fbd390fbd3 --- /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 0000000000..ca1e3ce05d --- /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 0000000000..a644a1323f --- /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 0000000000..3db6fb2167 --- /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 0000000000..46e9f2d983 --- /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 0000000000..323f6f7bbe --- /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 0000000000..e5ba309fe4 --- /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 0000000000..69ddbc5a0c --- /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 0000000000..30a6932635 --- /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 0000000000..85f41e8158 --- /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 0000000000..dd00226134 --- /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 0000000000..591d1bea94 --- /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 0000000000..86bb24baef --- /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 0000000000..c6cfea25ea --- /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 0000000000..4687b8365a --- /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 0000000000..650c11d3d0 --- /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 0000000000..22cbf150fe --- /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 0000000000..a8573cdf68 --- /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 0000000000..ad6b28fceb --- /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 0000000000..50039e388d --- /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 0000000000..924b2f17c5 --- /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 0000000000..6756b2112d --- /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 0000000000..7932e438c9 --- /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 0000000000..2e5062f2ca --- /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 0000000000..676c939aa0 --- /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 0000000000..68a30d2d2e --- /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 0000000000..8b16b1bcbc --- /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 0000000000..c42e10cb66 --- /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 0000000000..d2b72f56a1 --- /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 0000000000..640cbfa881 --- /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 0000000000..9fbe5d01a7 --- /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 0000000000..15a6317180 --- /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 0000000000..4766d3684d --- /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 0000000000..77ab03fcce 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 0000000000..c2cd296a40 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 0000000000..c3bc667fb3 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 0000000000..0be5cb8dd7 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 0000000000..abada5484b 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 0000000000..c27e66ed54 --- /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 0000000000..ac4798a108 --- /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 0000000000..4ce3dcf1c5 --- /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 0000000000..4e92f0a544 --- /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 0000000000..6bdd448ce0 --- /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 0000000000..3502d9f729 --- /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 0000000000..5c941d8a9f --- /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 0000000000..f269e3bbc1 --- /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 0000000000..9eb69d6f5d --- /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 0000000000..4075160d17 --- /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 0000000000..d034c87222 --- /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 0000000000..8e884d9248 --- /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 0000000000..3b0644a573 --- /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 0000000000..76903e57f0 --- /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 0000000000..9dcb32537e --- /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 0000000000..32a63ae6dd --- /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 0000000000..679d417cd7 --- /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 0000000000..890b1af276 --- /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 0000000000..3170d3a0b6 --- /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 0000000000..eb2c37a961 --- /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 0000000000..31af95ca2c --- /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 0000000000..1edf42f769 --- /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 0000000000..4ec1f6b87e --- /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 0000000000..316bcdfedd --- /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 0000000000..df0ad05288 --- /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 0000000000..15a4663c0d --- /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 0000000000..0cf8c709d4 --- /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 0000000000..db3742e2f1 --- /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 0000000000..1a6990cc39 --- /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 0000000000..722ed9afd0 --- /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 0000000000..0e3ebcd66d --- /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 0000000000..ea6cc03868 --- /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 0000000000..5622074e19 --- /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 0000000000..6bdd448ce0 --- /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 0000000000..21f6141f38 --- /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 0000000000..edf18e01f7 --- /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 0000000000..3ed69fc6f2 --- /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 0000000000..007b151f09 --- /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 0000000000..53aeffa558 --- /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 0000000000..13c2d6e581 --- /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 0000000000..0cf76a0af6 --- /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 0000000000..e47a1989e1 --- /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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 9f090d1992..829eb8a5a0 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h index 44fce81079..06a078af6e 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 0000000000..1021a8a1bd --- /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 6b696ae1af..4903e2c3b9 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 a9260acdba..47bf842b7b 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 3594bf58f8..71021b8a6c 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 c6cfea25ea..300149d384 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 22cbf150fe..69dfd403f3 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 6ac74d1895..8c8e2fb445 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/gallium') 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 0000000000..239a5bb98c --- /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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 47bf842b7b..f79cc72a5d 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 239a5bb98c..39e41f19e5 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 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_fs.c b/src/gallium/auxiliary/draw/draw_fs.c new file mode 100644 index 0000000000..1543bd86f1 --- /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 0000000000..44995b8277 --- /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/gallium') diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README index 8b5539d2c5..ec30d4d708 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index fb673db6d0..4277c47eeb 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index a123eb62e0..8879efca79 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 5269e6db91..36a3376033 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 b3d618748d..e32071b0e4 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 85aea89c70..4471d3ca42 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 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/gallium') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 4c1f47ac67..9e02d43ab7 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index f79cc72a5d..ab195f1af8 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/gallium') 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 69ddbc5a0c..41c8f29847 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 69dfd403f3..46a3905d8f 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 a8573cdf68..032cb0ea84 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 ad6b28fceb..b7542fd30e 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index ab195f1af8..19ac53e6bd 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 36a3376033..f29aa0fdea 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/docs/Makefile b/src/gallium/state_trackers/d3d1x/docs/Makefile index ca1e3ce05d..7f38fa73fb 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index f86d0553c7..91fab18e4e 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 79d9516ad9..1be5136f0e 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 8879efca79..6d87220db2 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 f29aa0fdea..0343704a90 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 d02562f17f..6023f215bb 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 e32071b0e4..d02a5a3895 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 3d10095919..6ad350b7d3 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 271bd1ac50..13abd172d6 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 cd1c31e82d..5d56910645 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 0343704a90..b93bdd3022 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 f60fe9f316..4aabae1fae 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 0506e8280a..e1f226cbdd 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 f1aa49c0f7..56fba19a70 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index e1f226cbdd..8db3de0c4f 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/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 4aabae1fae..37822903e8 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/gallium') 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 41c8f29847..c9db7b6664 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/gallium') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index d97cab8db1..23fdb0820a 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/gallium') diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c index c07ebb7ef6..c919b79eac 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 30999c899a..adfd3d1f7c 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 911298b37c..88bb8b8176 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 b453e6dbd0..324b5a65c1 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/gallium') diff --git a/src/gallium/winsys/sw/Makefile b/src/gallium/winsys/sw/Makefile index e9182ea5b1..094e811d57 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/Makefile b/src/gallium/state_trackers/d3d1x/Makefile index 6d55376be1..75076eed72 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 19ac53e6bd..55cbd4a719 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/Makefile.inc b/src/gallium/state_trackers/d3d1x/Makefile.inc index 1b9423b9d6..303915d5bf 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/gallium') 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 a100ee5c3f..a381564ada 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/gallium') 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 676c939aa0..4d7c296bb6 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 55cbd4a719..6c13a9ccb4 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/gallium') diff --git a/src/gallium/tests/unit/u_format_test.c b/src/gallium/tests/unit/u_format_test.c index cfde6af75e..ba0dd17957 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index dce3c3745b..ff0c7f7ca8 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c index b5924cbb7d..d1c9b88f9b 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 b9c7a6ceed..30d261e979 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 d0389f0cb0..8b6b5e1298 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 7bbbc61d4c..7a0d06ae2c 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 4277c47eeb..f0a15e11b9 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index d02a5a3895..32c7171b51 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 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 774a3c80da..2c354d1d0e 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index b93bdd3022..4ad9e4c6eb 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 32c7171b51..cde4ec37f9 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 7a63d966eb..18ff793689 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 4ad9e4c6eb..5182b26fcf 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/gallium') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index ff83ff145e..5351a2ba4a 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 856029091a..083f796f43 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 596309bfbd..135f66c61d 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 0a542a7303..6d66a25ca1 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/gallium') 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 c9db7b6664..24a812ff4c 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 6c13a9ccb4..83cf0f2c3e 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/gallium') 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 24a812ff4c..3cbe056e7b 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 39e41f19e5..0d515e3f47 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 9fbe5d01a7..e6f5147209 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 4ce3dcf1c5..ddba68518a 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 9dcb32537e..7e1edeb635 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index 0d515e3f47..f31b54ba8f 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 83cf0f2c3e..7627720148 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 ddba68518a..0fcef0d7b6 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 7e1edeb635..7055da941b 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/winedlls/Makefile b/src/gallium/state_trackers/d3d1x/winedlls/Makefile new file mode 100644 index 0000000000..c7e51b2fdd --- /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 0000000000..c9a06876c4 --- /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 0000000000..0ea5ffea0d --- /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 0000000000..4a68ab58db --- /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 0000000000..0575ab8b57 --- /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 0000000000..60cdca1af9 --- /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 0000000000..993e4bbe01 --- /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 0000000000..0575ab8b57 --- /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 0000000000..b8d992e243 --- /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 0000000000..1d2e0c5b93 --- /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 0000000000..a398678333 --- /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 0000000000..650bdc84d5 --- /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 0000000000..65a91a4583 --- /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 0000000000..5a900046df --- /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 0000000000..3653281fbc --- /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 0000000000..096d119fa3 --- /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 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/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 67deffbd11..086d983a73 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 8db3de0c4f..a27696ac3b 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index a27696ac3b..40422042d3 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 13abd172d6..13b1124d90 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/gallium') diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h index 518e05fefb..d87109fb80 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/gallium') diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 3ffda87520..413da59e55 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/gallium') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 5351a2ba4a..9ee039bd90 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 083f796f43..9c4ff560b1 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 8ea1554568..21e2165ed9 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 ffe9eba13c..beb59c6f68 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 475a96d196..7e4b11d83f 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 849f399b2f..d4eb8f454f 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 135f66c61d..116afccb19 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 f07c3da4bb..d46f622d57 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 5096d22cad..785beacd81 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 2693b5fa72..363a5c0242 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 7d33df3599..b1ed7ee5e7 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/gallium') 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 3cbe056e7b..2149d83a9c 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/gallium') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f93ef26ae7..c160716e6a 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 e33d2e283f..f9f96f25c7 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 6ad350b7d3..42b49002c3 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 40422042d3..0b22f03701 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 18ff793689..b9abff9dc1 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 3107f189c7..8778f23a81 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 13b1124d90..f3cb3b1ae0 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 5d56910645..a24197c3c2 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 502444f03a..4105bb7cf6 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 37822903e8..b0d3b28c72 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/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index b0d3b28c72..16468c9b1a 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 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 032cb0ea84..7e49c3a2c5 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 7e49c3a2c5..3c789d3af0 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 8a3d499feb..50acc6caed 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 50acc6caed..a10d8e9edc 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 7627720148..974518a5ce 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 8c8e2fb445..866762e1bb 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 0000000000..c44a46beed --- /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 0000000000..4e52eec34f --- /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 0000000000..46ff28d6f9 --- /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 0000000000..887df2b141 --- /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 0000000000..f1ce172aaf --- /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 0000000000..4088957e98 --- /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 0000000000..9e2d303ccd --- /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 0000000000..c7148ec301 --- /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 0000000000..d3bc186c54 --- /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 0000000000..e8fd70c480 --- /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 0000000000..891fcafa67 --- /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 0000000000..558794f1d2 --- /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 0000000000..b31e16e19c --- /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 2761b794d5..6ab9b820e8 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 a4f6cc6b66..2dfb88e5be 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 94192c9279..0000000000 --- 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 866762e1bb..4f67145b6f 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 558794f1d2..fcda13f907 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 b31e16e19c..4663f635d4 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 0000000000..07f84f0c73 --- /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 6ab9b820e8..0000000000 --- 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 0000000000..848db1bdbb --- /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 0000000000..746d7c8927 --- /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 0000000000..2c0f8269af --- /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 a381564ada..0000000000 --- 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 2e6e0949a8..0000000000 --- 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 2dfb88e5be..0000000000 --- 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 721f95fc8a..20a7cbd1c3 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 50039e388d..0c8d3ed943 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 6756b2112d..0274a1baf6 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 0000000000..995059e15b --- /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 0000000000..5722b277fb --- /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 2e5062f2ca..d210f8acad 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 4d7c296bb6..0000000000 --- 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 68a30d2d2e..0000000000 --- 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h index 06a078af6e..5c7c87e5e8 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 07f84f0c73..c8404d9691 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 848db1bdbb..7903d547f1 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 974518a5ce..eebabaa9af 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 2149d83a9c..bf820e9b21 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 dd00226134..3ab8cda191 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 86bb24baef..66f69bb730 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 46a3905d8f..3d3990a63e 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 3c789d3af0..04d5b86496 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 f31b54ba8f..f5cfd0cfab 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 b7542fd30e..0cf2cf3cf7 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 0c8d3ed943..eea0e21f20 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 7932e438c9..37113a6ec9 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 995059e15b..4b43a3325c 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 c42e10cb66..96faf1c070 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 e6f5147209..92fda3385b 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 0fcef0d7b6..a8f24ae303 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 4e92f0a544..06ad811dec 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 3b0644a573..e67fa09606 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 7055da941b..8eb51d3638 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 32a63ae6dd..de9946c67e 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 5622074e19..30c2ffa5cc 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/sm4.h index c8404d9691..d3ca2742a9 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 eebabaa9af..313aa10a37 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 3ab8cda191..98ed6ac66a 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 66f69bb730..2fc3b7f411 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 3d3990a63e..962bea5ce9 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 04d5b86496..c2b3bf4570 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 f5cfd0cfab..9ad293b7fc 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 0cf2cf3cf7..1a559494dc 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 eea0e21f20..9ea38c3f2a 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl index 94da622b32..7efcae5f43 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 d916c20f19..e23c2f8352 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index c2b3bf4570..d7c1c921b7 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 9ea38c3f2a..61b1ba2bd3 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h index 9ad293b7fc..357f51bcb9 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 1a559494dc..836603eccc 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/gallium') 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 98ea972b65..89be7f5b17 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 98ed6ac66a..96073d4ebc 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 2fc3b7f411..1b1cb907d3 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl index 7efcae5f43..7edeff94f7 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 d3f8b75db8..6088a8894a 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 e23c2f8352..cac046fac7 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 cf4ae1b68e..bb20d91053 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 d95a351eaf..dd90143168 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 247a7ddd11..86ef261f67 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h index 0274a1baf6..d4b6a8fc95 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/gallium') 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 89be7f5b17..99d80eae31 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/gallium') 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 30a6932635..187a0f986a 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/gallium') 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 99d80eae31..74bce598ae 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/gallium') 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 0000000000..ec45035b82 --- /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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/dxgi/Makefile b/src/gallium/state_trackers/d3d1x/dxgi/Makefile index 323f6f7bbe..6cdc33b8c4 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 4f67145b6f..3754c23983 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl index c371bbea13..91b1abc24a 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index b9abff9dc1..e8eb814209 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/gallium') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 3cdb963f97..433b7044e5 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 0000000000..7ac505c525 --- /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 77cd8f1588..1973da3647 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 6d87220db2..65b029b065 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 0000000000..c64ca40490 --- /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 5182b26fcf..6ce82648c1 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 9d8dc8dc59..8a84ceec69 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 0000000000..d383194211 --- /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 cde4ec37f9..16950bd72d 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/gallium') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 8ccb63964e..d6cded927a 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 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/gallium') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index 728bc40a5b..66d900ebb5 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 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/gallium') diff --git a/src/gallium/auxiliary/util/u_simple_list.h b/src/gallium/auxiliary/util/u_simple_list.h index f5f43b0faa..fe59771371 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/gallium') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c index cf665241c4..075ab5cb32 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/gallium') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c index 075ab5cb32..78723948d4 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/gallium') diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 112282a0a6..20d1fdab42 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/gallium') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 7f655dbfd2..8f4e2de02d 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 d6cded927a..ad3282a4e6 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 f9a516825d..566a828871 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 283f1e59b3..3a2c08da0b 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 42b49002c3..77ac444fe2 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 0a42abcdf2..d9897e020e 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 1973da3647..9bd7434866 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 51c9b06549..0fa48ae23a 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 f3cb3b1ae0..9e54c6a921 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 3a2c08da0b..1337d8ec81 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 56fba19a70..47ab1eb965 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/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index d9897e020e..4723aee5a5 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 1337d8ec81..663529faaf 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index 8778f23a81..c15e64329d 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 0fa48ae23a..4978a3cab2 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 9e54c6a921..1e9c5ffbfc 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/gallium') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 4978a3cab2..5b389462e7 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/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 4723aee5a5..251e64a67a 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 663529faaf..3be5248cd3 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 77ac444fe2..47c15b8dcc 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 c15e64329d..aec0dab338 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 1e9c5ffbfc..9cbf12008b 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 e18c6ce605..3274f3be71 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/gallium') diff --git a/src/gallium/drivers/r600/r700_asm.c b/src/gallium/drivers/r600/r700_asm.c index a78cf0ce95..9c731f2dbb 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 9cbf12008b..892666b00b 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/gallium') diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 892666b00b..b4d73a0fb1 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 3be5248cd3..a9e7619bf3 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 962bea5ce9..42678fab4d 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 61b1ba2bd3..c41117080a 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 313aa10a37..2b613b82d1 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 0000000000..410a56c248 --- /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 d4b6a8fc95..977f0cd2ce 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 37113a6ec9..853d11410d 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 4b43a3325c..7d03cecafc 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/gallium') 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 7d03cecafc..66b686687c 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index c41117080a..528d32c4b1 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/gallium') 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 74bce598ae..ef256a80c7 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile index 924b2f17c5..a1ab425f1a 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/gallium') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index dcb1b4fccc..fcdcad3edf 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/gallium') diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index b767846a99..54619037d8 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/gallium') diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 3f177b7ed0..8024800bd0 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 4ffc4de452..30e48c8073 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 42678fab4d..27cfebc1b9 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 d7c1c921b7..4abb4ac6b0 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 528d32c4b1..1ecd67ca47 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/gallium') 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 ef256a80c7..a75a953abf 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index 4766d3684d..bb37012a3d 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 a8f24ae303..efbe322fe6 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 8eb51d3638..1271499c4d 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h index c27e66ed54..59fe338f56 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 ac4798a108..94680977eb 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 efbe322fe6..8f07380056 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 06ad811dec..90b97f8a5d 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 3502d9f729..bc55cf8a47 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 5c941d8a9f..7204281ea8 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 9eb69d6f5d..53de10ab3e 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 d034c87222..5823b4c976 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 8e884d9248..5d9acd20f1 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 e67fa09606..1e0ce04ca6 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 76903e57f0..8e71ec367e 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 1271499c4d..2fadf4eecd 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 de9946c67e..0edf1f2ef1 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 890b1af276..e83b5bb5a8 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 3170d3a0b6..ee931091c2 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 31af95ca2c..54ca08f23c 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 4ec1f6b87e..45045e5c61 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 316bcdfedd..d37502a5a8 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 df0ad05288..9af2071371 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 15a4663c0d..c71b0c3ae0 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 db3742e2f1..19c669be9c 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 722ed9afd0..29795a9909 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 0e3ebcd66d..3aae79441a 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 30c2ffa5cc..524b7d1c01 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 21f6141f38..68eaee5cb2 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 edf18e01f7..43e2a18275 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h index c5d5fe9ddf..3c60e5c11a 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index 4471d3ca42..e780cfd96a 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7ac505c525..ed0daab25a 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 9bd7434866..db9b5656df 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 6ce82648c1..075b5f0319 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 d383194211..5781d448ed 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 6023f215bb..92b2eb1dff 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 16950bd72d..c29616c9cb 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 47c15b8dcc..6e82368984 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index e89ee7c230..caf1c7e865 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 8b042d5242..661f35f6de 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 7e064900e7..000d4938a0 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 91fab18e4e..cbae1188a5 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 8e6dfb293d..4c7089892e 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 c94189413a..e94d758e20 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 ea7002aafc..28d202bd65 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 81ff43f8ad..868bd3ad2f 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 edd723f65f..d2be22d7fc 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 4e026cc8ff..151fe93cfb 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index caf1c7e865..19e380a8dc 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 661f35f6de..9a19e87571 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 cbae1188a5..db2a6a0b22 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 4c7089892e..04b12dedcc 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 e94d758e20..16e04fce0c 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 28d202bd65..eade400087 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 151fe93cfb..f417fc8a9e 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 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 6e82368984..f37208f362 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 db9b5656df..2359c78383 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index ed0daab25a..15588fed93 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 075b5f0319..2c55f073f0 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 5781d448ed..96e2105cd1 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 c29616c9cb..edd1d13a7b 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/gallium') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 2359c78383..0a0a91eea2 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index f37208f362..d545db2629 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 15588fed93..3170ec773e 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 96e2105cd1..f2038638d6 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3170ec773e..4b7c251e5e 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 c64ca40490..e05a14f4e9 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 2c55f073f0..482ec0de81 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 edd1d13a7b..e1f32da91b 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 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/gallium') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index aae8b8bdf1..c90b0fdbc3 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 566a828871..0c3fa200c8 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 0b22f03701..c30a7c187c 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index ea370782fd..1621b2ab63 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 482ec0de81..40038f0732 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index d545db2629..7ba53fefb5 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index a9e7619bf3..81ce1bb190 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 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 7ba53fefb5..998d74bd3e 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 251e64a67a..497865a66d 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index db2a6a0b22..e3e8548d93 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 19e380a8dc..44f44ff1aa 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c index 0a5038bc98..2bce289555 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 8759c38cab..5154c1f3c5 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 6196b2f983..b881ef6113 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 e9811010db..ac1fbb179c 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 44f44ff1aa..d9fbc0f305 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 9a19e87571..43ed24bdc6 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 829eb8a5a0..156bd63375 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 2c354d1d0e..a95c15751c 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 5090f82ab5..9016bb8e24 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 43ed24bdc6..bb485784ef 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 000d4938a0..9a1c693d5e 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 998d74bd3e..272972d418 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 272972d418..889eedadef 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 9f8007c8e9..1379c11291 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 d87109fb80..ced7f147c0 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 4b7c251e5e..c54b78aa6f 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 e05a14f4e9..19cfbccf4f 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 40038f0732..c4e06a5f52 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_formats.c b/src/gallium/drivers/nv50/nv50_formats.c index 3be39d5337..4282809454 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 3e61203adf..623024ce77 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_reg.h b/src/gallium/drivers/nv50/nv50_reg.h index 365576fdd0..949838b33f 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 7c9342b747..c5115372ed 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 623024ce77..3f3166261b 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index c5115372ed..c6bd62df1d 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/gallium') diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c index d280a45bab..be8a78ca3d 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/gallium') diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index 5b389462e7..afc3b7bba1 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index e8eb814209..ec1f44639a 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 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index e654bb77c2..96ccf1da98 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 9a1c693d5e..49a6eed615 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 e3e8548d93..f53ad91594 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 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/gallium') diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 7e4b11d83f..b3b09b605f 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/gallium') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 35d426aa3e..28953582f0 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 be5917a688..d5f4d28aef 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 50bc2eea5f..0000000000 --- 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 0000000000..50bc2eea5f --- /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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index a7c9959b3e..a280879cc4 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 c5d61f840f..69243573f7 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 50bc2eea5f..7fff338cce 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index a280879cc4..e8daa81d11 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 69243573f7..1326f49fe9 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 2a203f44e5..12863824b8 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e8daa81d11..e7b6fc445d 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 1326f49fe9..8d4efb1c66 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 1be5136f0e..aedb5bb19b 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e7b6fc445d..ad8975a59d 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 8d4efb1c66..62a9aaa46a 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 b650fcaea5..7d8055f2ba 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index ad8975a59d..346b56aab4 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 62a9aaa46a..8c539ca25f 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 c9ede09f26..3cd4acd743 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 346b56aab4..c2b3594202 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 8c539ca25f..d6a435d2de 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 cfe23f9e84..ddfa3ef765 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index c2b3594202..36aa8546ef 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 d6a435d2de..a7dcde28a8 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 4946c776e3..f3a4c234e2 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 36aa8546ef..b5d30bc6fc 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 a7dcde28a8..525bf23734 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 897938c2ca..aac3d7b604 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/gallium') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 8f4e2de02d..1927370325 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 b2b34c3efc..db783ff0ad 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 ad3282a4e6..cfb0a85243 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 0c3fa200c8..7b7f59a9a6 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/gallium') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index cfb0a85243..f2479a994c 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c index b237b39c2b..c7aa73c8d4 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index c3d345fef9..f7e3e354de 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c index daaf2cbc51..4a64be23a2 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 65b029b065..17d34409dc 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 f2038638d6..860c836e85 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 92b2eb1dff..25a65c6a10 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 e1f32da91b..d60c37fc90 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 3c60e5c11a..fcce2934d3 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index c4e06a5f52..986ede3f39 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index c54b78aa6f..7031e4cc77 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/gallium') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index c160716e6a..a163f93cb8 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/gallium') diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index 5840098642..420522f5c1 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index c30a7c187c..52326534e6 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 aec0dab338..d104531d36 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 424f7a8913..791b39a001 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/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 19cfbccf4f..4ca83a42d7 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 986ede3f39..e5b2dc9927 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/gallium') diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 20d1fdab42..6a1030f8ee 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 3274f3be71..0c27bb7d87 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7031e4cc77..b0b0f5ce77 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 17d34409dc..44fae4bcef 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 860c836e85..b9d333060f 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/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 52326534e6..357776c55e 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/gallium') diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template index bff399ec64..036c11986e 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile index 3754c23983..f132518ccc 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 a1ab425f1a..32d29563ec 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/.gitignore b/src/gallium/state_trackers/d3d1x/.gitignore new file mode 100644 index 0000000000..f23bac7176 --- /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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index bb37012a3d..2f54079a44 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index 2f54079a44..938c77cc66 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index b0b0f5ce77..89f7c7f53a 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 e5b2dc9927..8bf8d24549 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/gallium') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 0a0a91eea2..486cb29005 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 44fae4bcef..b8c74675e6 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 b9d333060f..c2455e3a49 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 d60c37fc90..c4b45e565c 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 89f7c7f53a..1553088aa2 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 8bf8d24549..06a6f0d80c 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 c2455e3a49..1cc22a98fd 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 c4b45e565c..97aecc7a42 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 1553088aa2..71c4a4b9d8 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 4ca83a42d7..5abf910c81 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 06a6f0d80c..a88426fc9a 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h index 2b613b82d1..af355f0227 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 1ecd67ca47..b7c6a44ab8 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile b/src/gallium/state_trackers/d3d1x/progs/Makefile index 938c77cc66..143e531662 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/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 3cf6893a9b..7d13a17bdb 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 07fb01ab7b..acc463200a 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/gallium') 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 66b686687c..615ce8c255 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index b7c6a44ab8..9852dafa35 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl index d2b72f56a1..40a0d6a886 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 640cbfa881..4dca1bcf91 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/gallium') 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 a75a953abf..e1c34611d1 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 4abb4ac6b0..36110595c2 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index bf33fd9417..aa76b8aa1e 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 e03d53eb24..031c7c1ea5 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 25a65c6a10..189644f31c 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index f53ad91594..33740f9759 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 96ccf1da98..088e48f81f 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 eb74f14a7b..e817c0c8cf 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 0794ffa0c5..05f25133da 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 9852dafa35..95ea4e00fc 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/gallium') diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl index 40a0d6a886..dddb3431b6 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 4dca1bcf91..76f8a7f7f6 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index b8dab88ef0..3f89987897 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 f76676fae8..53cc1bd77e 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 ddce590ee6..7ce5fb8639 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 1927370325..b59bc00261 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 db783ff0ad..3a1085d2dc 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 3f89987897..d9d4a9304d 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 34105aa4bc..a7911c6fcc 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 6a1030f8ee..a49029e1e9 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 53cc1bd77e..2dd9c5e4bd 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 de988b7c10..530afa5e08 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/gallium') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 7b7f59a9a6..904736ef06 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 791b39a001..86f9825b52 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 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/gallium') diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 889eedadef..ebbc9c3f37 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 71c4a4b9d8..de1b3b2b54 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index 1a2fe758a8..6c41e8f456 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 3afce06557..f42fa2d4d2 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index ec1f44639a..091751e93a 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 a24197c3c2..b0026e9578 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 a88426fc9a..32a11d8522 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 16468c9b1a..c24aaeefa7 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index de1b3b2b54..0803a5768c 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 32a11d8522..153780594e 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/gallium') diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index eb268d5bc0..2c1b2f5be4 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index b8c74675e6..adc35afc02 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 153780594e..72d04534e6 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 97aecc7a42..779138656a 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/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 5abf910c81..e161dc5066 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 72d04534e6..796442f5a4 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 1621b2ab63..d734e2349f 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 afc3b7bba1..c41156f15f 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 796442f5a4..bbbf2790cc 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index bbbf2790cc..9e37af8fec 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 0803a5768c..b9fadabd15 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 189644f31c..710c66bcfd 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 779138656a..1241bca244 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 e780cfd96a..4cb3fc79d4 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 091751e93a..cff15c57d2 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 d104531d36..ae32194318 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 c41156f15f..ed1b20f7b9 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 86f9825b52..1cadeea2fd 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 9e37af8fec..5bd38726e7 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index cff15c57d2..091751e93a 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 ae32194318..d104531d36 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 ed1b20f7b9..c41156f15f 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 1cadeea2fd..86f9825b52 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 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index eade400087..5ff11a3363 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 868bd3ad2f..25dab78f64 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 d2be22d7fc..bb059d0459 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index b07de76a49..032fcbbc70 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 5154c1f3c5..4749bb57a5 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 b881ef6113..d0a68ae412 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 adc35afc02..58d753ef5e 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 5bd38726e7..38cd9acf45 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 1cc22a98fd..3165bcd678 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 fdcadffc53..496547ca99 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 710c66bcfd..92dadf8d1c 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 1241bca244..87f33e0526 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 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/gallium') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 433b7044e5..83be293579 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 769f550874..dd9eda18d1 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 ebbc9c3f37..0000000000 --- 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 58d753ef5e..f0b74ad874 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 fcdcad3edf..dc8dc9fe43 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 357776c55e..0000000000 --- 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 d734e2349f..69caba2fbc 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 091751e93a..0000000000 --- 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 d104531d36..0000000000 --- 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 c41156f15f..0000000000 --- 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 5e0e0aab57..7e13109306 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 b4d73a0fb1..0000000000 --- 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 e161dc5066..b1e76b692c 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 6e50701de6..0000000000 --- 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 05707740da..ee6013e865 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 b0026e9578..ae1ad24bfd 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 be8a78ca3d..0000000000 --- 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 4105bb7cf6..0000000000 --- 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 0c27bb7d87..97e1d5ee12 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 86f9825b52..0000000000 --- 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 c24aaeefa7..7979f85603 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 9c731f2dbb..892dee86ba 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 8a84ceec69..41e736c9cd 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 ced7f147c0..0000000000 --- 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 b2e5b2203a..0000000000 --- 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 9bd5ab2082..0000000000 --- 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 7a1a762f54..a7ad96f5a2 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 25dd8fe7d8..0000000000 --- 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 76e185ac03..0000000000 --- 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 f7e3e354de..0000000000 --- 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 7ccb524590..0000000000 --- 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 a126901495..0000000000 --- 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 c7aa73c8d4..0000000000 --- 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 03ec127ff7..7e501221b1 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 a7911c6fcc..2d8431dbb8 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/gallium') diff --git a/src/gallium/drivers/r600/SConscript b/src/gallium/drivers/r600/SConscript index 99c8644e02..3f3740a554 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/gallium') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 83be293579..213534198a 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 74e2373b19..fc517f13ad 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 69caba2fbc..3900b3779f 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 0000000000..0613cd1eca --- /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 b1e76b692c..ab31180df7 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 0000000000..7385a6f1e1 --- /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 ee6013e865..b8f490c344 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 97e1d5ee12..718754b104 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 0000000000..911d4835b4 --- /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 38cd9acf45..0000000000 --- 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 a7e7982c19..0000000000 --- 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 3165bcd678..7ba778e9f4 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 a7ad96f5a2..31fb7d4e0f 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 92dadf8d1c..f836e607c0 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 87f33e0526..416fcebc9f 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 51ce864974..d16e38d4e0 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 aac3d7b604..33964814a0 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 dd6156d585..08cc1c41e3 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 4cb3fc79d4..0000000000 --- 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 4a64be23a2..ed3b4e72bf 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 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/gallium') diff --git a/src/gallium/drivers/r600/SConscript b/src/gallium/drivers/r600/SConscript index 3f3740a554..b6d9b7d8d2 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index 2f20d9f895..55b88fa0d9 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/gallium') diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile index 213534198a..ede0bb2ec4 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 fc517f13ad..a30025642d 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 6aadf72957..cf67ca2d68 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 0000000000..a19f494ea0 --- /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 0613cd1eca..3c4424039b 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 ab31180df7..98ed8b7c69 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 1d89c9f9f6..f1970201e8 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 7385a6f1e1..726668260c 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 718754b104..a0cd830d26 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 911d4835b4..f5ec5cde37 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 2c1b2f5be4..8753e2bab1 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 41e736c9cd..f407817a8e 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 0000000000..7ba778e9f4 --- /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 7ba778e9f4..0000000000 --- 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 84f2dce437..cfce8df9c2 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 0000000000..416fcebc9f --- /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 416fcebc9f..0000000000 --- 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index 55b88fa0d9..88ee90862b 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 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/gallium') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 271cd4aff5..04f30f82c3 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 bd9a9bfaf1..8f81606032 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 2e70f4e1c7..078d208610 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/gallium') diff --git a/src/gallium/tests/python/retrace/interpreter.py b/src/gallium/tests/python/retrace/interpreter.py index 37d7fd6415..16132abb06 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index ff0c7f7ca8..e65c13e64b 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 7979f85603..f03d6fcfd6 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 81ce1bb190..f41b6a0d7f 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index a30025642d..64fadb16e0 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 a19f494ea0..4bf44a171a 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 3c4424039b..cf3d58e506 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 98ed8b7c69..a3b8f66c09 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 b8f490c344..59edab0e24 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 a0cd830d26..8d40079353 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 f5ec5cde37..23323f1ea2 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 416fcebc9f..d1cf9e93f8 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 f836e607c0..7106bb6bcb 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/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index cf3d58e506..a25674b183 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 5b0121ce9e..5f34fcb274 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 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/gallium') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index ce2b1f7bb9..bfbb431058 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 1be1e42468..1169e273c3 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 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/gallium') diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 65d5ce795b..fbde1d191a 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/gallium') diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index 87959ab0aa..03198c91da 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/gallium') diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c index 7bb7893d93..bd059d5716 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index a95c15751c..3b217f9544 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/gallium') diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index aedb5bb19b..b59fbc33ed 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/gallium') diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index dce24bc17d..29813456b5 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 547508f815..c36b3d2f3c 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/gallium') diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c index 7bd4407e9f..258084a1f1 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 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/gallium') 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 05cdb0d421..0affe632cf 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d9fbc0f305..d9fbbbe70f 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 bb485784ef..9fc9a38a49 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 33740f9759..36a77d3aff 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d9fbbbe70f..6e53bca269 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/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 23323f1ea2..23c2e5964a 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 47ab1eb965..169cda5295 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 d1cf9e93f8..f363b698bc 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 fcce2934d3..5c08c5a04d 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 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/gallium') diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index a156823390..8434491a42 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/gallium') diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index 8434491a42..4ae6def495 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 8d40079353..a2091db460 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/gallium') diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index 4ae6def495..8434491a42 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 7ba778e9f4..7d6bd504a6 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 f363b698bc..6cb0b940da 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 7106bb6bcb..125fb4f76e 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 125fb4f76e..f39778da62 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 d16e38d4e0..bb93ce6c9e 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 6e53bca269..aee94c1b86 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 9fc9a38a49..4d2eeaa5eb 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/gallium') diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 4749bb57a5..7fb86d7cb2 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index e3390fd461..a92c32e7df 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 6cb0b940da..53783e8f50 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 64fadb16e0..5775b04cc7 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 486cb29005..54b26f6fb6 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 a25674b183..1c23995123 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 a3b8f66c09..18ebb0eb22 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 23c2e5964a..83eedd2040 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 5775b04cc7..21d3394ca6 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 54b26f6fb6..ce2b667868 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 83eedd2040..c86bad7ff5 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 169cda5295..02e3734fcc 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 a92c32e7df..225027b8a3 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 53783e8f50..88a86d2cf2 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 5c08c5a04d..ccc9ffaf8e 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 21d3394ca6..7337839a32 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7337839a32..55eede98d5 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 225027b8a3..3af299c180 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 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 55eede98d5..06dc8407a1 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index dc8dc9fe43..f07af8126c 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 cf67ca2d68..cbf46a8b64 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 a2091db460..d35a99085d 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/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 497865a66d..c93b9d94c5 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 06dc8407a1..2f5f1bff28 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 ce2b667868..f9328c6198 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 c86bad7ff5..8ed87180d5 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 f41b6a0d7f..81f285027e 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 02e3734fcc..3d1c5dbfd8 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 3af299c180..1b2c2655b5 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/gallium') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index f9328c6198..3cb9e634f7 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 1b2c2655b5..88db69c4f7 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 88a86d2cf2..4d7547c975 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/gallium') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 3cb9e634f7..e265348a19 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 88db69c4f7..557751efac 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 557751efac..129f571a04 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 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 2f5f1bff28..4fa94e31e7 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 d35a99085d..66cc035e7d 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 4fa94e31e7..70799f6378 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 e265348a19..9971dded78 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 66cc035e7d..41c01d4a7b 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 3d1c5dbfd8..a96d2ce26c 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 129f571a04..c3569e60e8 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 4d7547c975..2ca5a45e03 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/gallium') diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c index dd9eda18d1..52b7189e9e 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 c93b9d94c5..8109490448 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 cbf46a8b64..dba60afc52 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 3900b3779f..1bbcb310eb 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 59edab0e24..207642ccfa 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 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/gallium') diff --git a/src/gallium/drivers/i965/intel_decode.c b/src/gallium/drivers/i965/intel_decode.c index bd8b9174a8..36c04a3165 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 41c01d4a7b..5709426ea7 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/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 1c23995123..0589652f70 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 8ed87180d5..2814ecc239 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 2d8431dbb8..a084bdff11 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/gallium') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index a084bdff11..cee56bccdc 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 2ca5a45e03..c67c93541a 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 5709426ea7..21b9180582 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index f39778da62..fdca6f01e8 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index c67c93541a..0a1b3a9419 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/gallium') diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 23fdb0820a..13e8beed47 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 70799f6378..6fcb2ae6f3 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 f0b74ad874..dd3c4e3006 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 1bbcb310eb..2bfa4e22fe 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 18ebb0eb22..c46029a561 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 ae1ad24bfd..f6377ea802 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 21b9180582..e9d4ee13b9 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 2814ecc239..326e3aa141 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 f03d6fcfd6..c46bfa66ba 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 c3569e60e8..fadfe28692 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 0a1b3a9419..48727b9e6b 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 fdca6f01e8..4bd2c278bc 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 ed3b4e72bf..a502c7e252 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 6fcb2ae6f3..06cdd5ffdf 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 dd3c4e3006..8a2e5c514d 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 e9d4ee13b9..d7edf6a44f 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 326e3aa141..f7c77cde94 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 fadfe28692..f51b14e48e 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 48727b9e6b..61e3fbcc9a 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index f51b14e48e..ff2c48e770 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 61e3fbcc9a..7a908b3ca4 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 4bd2c278bc..5c954ea621 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 a502c7e252..8089c91640 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/gallium') diff --git a/src/gallium/winsys/r600/drm/Makefile b/src/gallium/winsys/r600/drm/Makefile index f407817a8e..a396205f89 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 0000000000..8089c91640 --- /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 8089c91640..0000000000 --- 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index bb93ce6c9e..14af3ec97e 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/gallium') diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index 88ee90862b..cc053c06dd 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 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/gallium') diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index a49029e1e9..543d0fdc15 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 7a908b3ca4..822b65facf 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 5c954ea621..76a7ba9ec2 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 14af3ec97e..97138f9f9e 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/gallium') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index b4d8107372..52e626cb44 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 76a7ba9ec2..285a192e74 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 97138f9f9e..42a23f0ab8 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c index 8089c91640..9498f3a82e 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 31fb7d4e0f..5f175a4df9 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 285a192e74..07e734268d 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 06cdd5ffdf..147d4f372e 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 f07af8126c..d13da0ef63 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 dba60afc52..bebc7c15b0 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 d7edf6a44f..016e75bd52 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 06dd65038d..6e2620f201 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 f7c77cde94..b55c345005 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 ff2c48e770..e51725abb8 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 822b65facf..bee0446d58 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 07e734268d..ee48754625 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/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 33964814a0..a3452027f2 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/gallium') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index 52e626cb44..a6eb403962 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/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index bee0446d58..40c612c4ea 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 ee48754625..4619207432 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 8a2e5c514d..59a255d2fa 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 e51725abb8..96769add90 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 40c612c4ea..84539d1439 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 4619207432..f6ceb0adc3 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/gallium') diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c index 921ed15691..27eb3817bf 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 59a255d2fa..acacec0c41 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 96769add90..1355b07945 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 84539d1439..5019c26df0 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 f6ceb0adc3..9a38cc51f7 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index acacec0c41..630177d6ad 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 5019c26df0..b379499f06 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 9a38cc51f7..ea2cf34778 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 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/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 630177d6ad..24e25cec0d 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 1355b07945..2093a2d09c 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 b379499f06..7d81d73457 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 ea2cf34778..a693a5b5ab 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 ccc9ffaf8e..d91f7737af 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 42a23f0ab8..836d5d77e0 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/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 8109490448..d7a880f5d3 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 147d4f372e..603a8a7b91 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/gallium') diff --git a/src/gallium/tests/python/retrace/interpreter.py b/src/gallium/tests/python/retrace/interpreter.py index 16132abb06..954a701a53 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index f0a15e11b9..5a561f9abd 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 5a561f9abd..e50768445f 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 3b217f9544..c91e85f915 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index c91e85f915..1295aeecd8 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 2093a2d09c..9617035c93 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 7d81d73457..72bfb357b3 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 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/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 9617035c93..9b39c0c4f0 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 72bfb357b3..86bddccbbb 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 a693a5b5ab..e3868d3cb9 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 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index e65c13e64b..3f9c250ad5 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 3f9c250ad5..ff94f498ac 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 31efa9921c..3ed4fec233 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 aee94c1b86..9dee653eee 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index ff94f498ac..15b7441018 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 3ed4fec233..f36197479f 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 15b7441018..64c468c14d 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 f36197479f..8424384f8f 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 9dee653eee..acd99741f1 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 36a77d3aff..d464147371 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index acd99741f1..2227a062d0 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 4d2eeaa5eb..bb1c8c8dce 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 2227a062d0..c1c98bf859 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 bb1c8c8dce..bb83ede931 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 e50768445f..3ce8be5a0a 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index c1c98bf859..3287cf7c37 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 bb83ede931..b019c3fa5e 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 49a6eed615..8a55681166 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 d464147371..4f9bf6763e 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/gallium') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index c90b0fdbc3..5378f2d782 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/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index d7e6415e13..790d88a745 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 c55b97a9d1..0f62377c07 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 5ff11a3363..e72ead0def 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 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/gallium') diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 47c24cefe5..38e60dbafb 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/gallium') diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index e7996741d1..232deefa16 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 016e75bd52..1f79c15a2b 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/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 603a8a7b91..0fd1d39951 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 b55c345005..7ceedf6363 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/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1f79c15a2b..366d5d9c35 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/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 3287cf7c37..a6a64f38c8 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 b019c3fa5e..1dd78a07a2 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 4f9bf6763e..74362abf45 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 1ae5cc2e67a02b3105b5539b5dbc6a69cbb57889 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 09:35:17 +1000 Subject: r600g: add some RG texture format support. --- src/gallium/drivers/r600/eg_state_inlines.h | 16 ++++++++++++++++ src/gallium/drivers/r600/r600_state_inlines.h | 12 ++++++++++++ 2 files changed, 28 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index d7a880f5d3..5a4e00aac3 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -309,6 +309,12 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_Z16_UNORM: return V_028C70_SWAP_STD; + + case PIPE_FORMAT_R8G8_UNORM: + return V_028C70_SWAP_STD; + + case PIPE_FORMAT_R16_UNORM: + return V_028C70_SWAP_STD; /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: @@ -346,6 +352,9 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_R10SG10SB10SA2U_NORM: return V_028C70_SWAP_STD_REV; + case PIPE_FORMAT_R16G16_UNORM: + return V_028C70_SWAP_STD; + /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: @@ -390,6 +399,12 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_Z16_UNORM: return V_028C70_COLOR_16; + case PIPE_FORMAT_R8G8_UNORM: + return V_028C70_COLOR_8_8; + + case PIPE_FORMAT_R16_UNORM: + return V_028C70_COLOR_16; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: case PIPE_FORMAT_A8B8G8R8_UNORM: @@ -427,6 +442,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) return V_028C70_COLOR_16_16_FLOAT; case PIPE_FORMAT_R16G16_SSCALED: + case PIPE_FORMAT_R16G16_UNORM: return V_028C70_COLOR_16_16; /* 64-bit buffers. */ diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 81f285027e..29a29d87cd 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -303,6 +303,10 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) return V_0280A0_SWAP_STD; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_R8G8_UNORM: + return V_0280A0_SWAP_STD; + + case PIPE_FORMAT_R16_UNORM: return V_0280A0_SWAP_STD; /* 32-bit buffers. */ @@ -342,6 +346,9 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_R10SG10SB10SA2U_NORM: return V_0280A0_SWAP_STD_REV; + case PIPE_FORMAT_R16G16_UNORM: + return V_0280A0_SWAP_STD; + /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: @@ -387,8 +394,12 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) return V_0280A0_COLOR_16; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_R8G8_UNORM: return V_0280A0_COLOR_8_8; + case PIPE_FORMAT_R16_UNORM: + return V_0280A0_COLOR_16; + /* 32-bit buffers. */ case PIPE_FORMAT_A8B8G8R8_SRGB: case PIPE_FORMAT_A8B8G8R8_UNORM: @@ -426,6 +437,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format) return V_0280A0_COLOR_16_16_FLOAT; case PIPE_FORMAT_R16G16_SSCALED: + case PIPE_FORMAT_R16G16_UNORM: return V_0280A0_COLOR_16_16; -- cgit v1.2.3 From 8d6a38d7b3ea85bd2199f2797e3580d76cca2f6f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 19:55:05 +1000 Subject: r600g: drop width/height per level storage. these aren't used anywhere, so just waste memory. --- src/gallium/drivers/r600/r600_resource.h | 2 -- src/gallium/drivers/r600/r600_texture.c | 4 ---- 2 files changed, 6 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index f6377ea802..323960960d 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -51,8 +51,6 @@ struct r600_resource_texture { struct r600_resource resource; unsigned long offset[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long width[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long height[PIPE_MAX_TEXTURE_LEVELS]; unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch_override; unsigned long bpt; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index c46bfa66ba..db88346afb 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -99,8 +99,6 @@ static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_cla rtex->offset[i] = offset; rtex->layer_size[i] = layer_size; rtex->pitch[i] = pitch; - rtex->width[i] = w; - rtex->height[i] = h; offset += size; } rtex->size = offset; @@ -217,8 +215,6 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, rtex->pitch_override = whandle->stride; rtex->bpt = util_format_get_blocksize(templ->format); rtex->pitch[0] = whandle->stride; - rtex->width[0] = templ->width0; - rtex->height[0] = templ->height0; rtex->offset[0] = 0; rtex->size = align(rtex->pitch[0] * templ->height0, 64); -- cgit v1.2.3 From 1f01f5cfcf6bb30d8c1d616019cbeb9700cd1e80 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 8 Oct 2010 04:56:49 -0700 Subject: r600g: Remove unnecessary header. --- src/gallium/winsys/r600/drm/radeon_bo.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index 836d5d77e0..14a00161c8 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -32,7 +32,6 @@ #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) { -- cgit v1.2.3 From 4eb222a3e654812ac1466b438a7d43f07ca6a508 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 10:54:23 +0100 Subject: gallivm: Do not do mipfiltering when magnifying. If lod < 0, then invariably follows that ilevel0 == ilevel1 == 0. --- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 16 ++++++++-------- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 8a55681166..d42b5f6127 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -1071,14 +1071,14 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, lp_build_else(&if_ctx); { /* Use the magnification filter */ - lp_build_sample_mipmap(bld, mag_filter, mip_filter, - s, t, r, lod_fpart, - width0_vec, width1_vec, - height0_vec, height1_vec, - depth0_vec, depth1_vec, - row_stride0_vec, row_stride1_vec, - img_stride0_vec, img_stride1_vec, - data_ptr0, data_ptr1, + lp_build_sample_mipmap(bld, mag_filter, PIPE_TEX_MIPFILTER_NONE, + s, t, r, NULL, + width_vec, NULL, + height_vec, NULL, + depth_vec, NULL, + row_stride0_vec, NULL, + img_stride0_vec, NULL, + data_ptr0, NULL, &packed_lo, &packed_hi); } lp_build_endif(&if_ctx); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 74362abf45..c7947f06e8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1044,14 +1044,14 @@ lp_build_sample_general(struct lp_build_sample_context *bld, { /* Use the magnification filter */ lp_build_sample_mipmap(bld, unit, - mag_filter, mip_filter, - s, t, r, lod_fpart, - width0_vec, width1_vec, - height0_vec, height1_vec, - depth0_vec, depth1_vec, - row_stride0_vec, row_stride1_vec, - img_stride0_vec, img_stride1_vec, - data_ptr0, data_ptr1, + mag_filter, PIPE_TEX_MIPFILTER_NONE, + s, t, r, NULL, + width_vec, NULL, + height_vec, NULL, + depth_vec, NULL, + row_stride0_vec, NULL, + img_stride0_vec, NULL, + data_ptr0, NULL, colors_out); } lp_build_endif(&if_ctx); -- cgit v1.2.3 From 05fe33b71cd913876184d1aa4086e4e3f8636eb1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 13:24:39 +0100 Subject: gallivm: Simplify lp_build_mipmap_level_sizes' interface. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 59 ++++++----------------- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 18 +++---- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 16 +++--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 16 +++--- 4 files changed, 42 insertions(+), 67 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index a6a64f38c8..c4ed79e0e7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -513,61 +513,34 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, LLVMValueRef width_vec, LLVMValueRef height_vec, LLVMValueRef depth_vec, - LLVMValueRef ilevel0, - LLVMValueRef ilevel1, + LLVMValueRef ilevel, LLVMValueRef row_stride_array, LLVMValueRef img_stride_array, - LLVMValueRef *width0_vec, - LLVMValueRef *width1_vec, - LLVMValueRef *height0_vec, - LLVMValueRef *height1_vec, - LLVMValueRef *depth0_vec, - LLVMValueRef *depth1_vec, - LLVMValueRef *row_stride0_vec, - LLVMValueRef *row_stride1_vec, - LLVMValueRef *img_stride0_vec, - LLVMValueRef *img_stride1_vec) + LLVMValueRef *out_width_vec, + LLVMValueRef *out_height_vec, + LLVMValueRef *out_depth_vec, + LLVMValueRef *row_stride_vec, + LLVMValueRef *img_stride_vec) { - const unsigned mip_filter = bld->static_state->min_mip_filter; - LLVMValueRef ilevel0_vec, ilevel1_vec; + LLVMValueRef ilevel_vec; - ilevel0_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel0); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) - ilevel1_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel1); + ilevel_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel); /* - * Compute width, height, depth at mipmap level 'ilevel0' + * Compute width, height, depth at mipmap level 'ilevel' */ - *width0_vec = lp_build_minify(bld, width_vec, ilevel0_vec); + *out_width_vec = lp_build_minify(bld, width_vec, ilevel_vec); if (dims >= 2) { - *height0_vec = lp_build_minify(bld, height_vec, ilevel0_vec); - *row_stride0_vec = lp_build_get_level_stride_vec(bld, + *out_height_vec = lp_build_minify(bld, height_vec, ilevel_vec); + *row_stride_vec = lp_build_get_level_stride_vec(bld, row_stride_array, - ilevel0); + ilevel); if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) { - *img_stride0_vec = lp_build_get_level_stride_vec(bld, + *img_stride_vec = lp_build_get_level_stride_vec(bld, img_stride_array, - ilevel0); + ilevel); if (dims == 3) { - *depth0_vec = lp_build_minify(bld, depth_vec, ilevel0_vec); - } - } - } - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - /* compute width, height, depth for second mipmap level at 'ilevel1' */ - *width1_vec = lp_build_minify(bld, width_vec, ilevel1_vec); - if (dims >= 2) { - *height1_vec = lp_build_minify(bld, height_vec, ilevel1_vec); - *row_stride1_vec = lp_build_get_level_stride_vec(bld, - row_stride_array, - ilevel1); - if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) { - *img_stride1_vec = lp_build_get_level_stride_vec(bld, - img_stride_array, - ilevel1); - if (dims == 3) { - *depth1_vec = lp_build_minify(bld, depth_vec, ilevel1_vec); - } + *out_depth_vec = lp_build_minify(bld, depth_vec, ilevel_vec); } } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 1dd78a07a2..76f428d4be 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -327,20 +327,14 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, LLVMValueRef width_vec, LLVMValueRef height_vec, LLVMValueRef depth_vec, - LLVMValueRef ilevel0, - LLVMValueRef ilevel1, + LLVMValueRef ilevel, LLVMValueRef row_stride_array, LLVMValueRef img_stride_array, - LLVMValueRef *width0_vec, - LLVMValueRef *width1_vec, - LLVMValueRef *height0_vec, - LLVMValueRef *height1_vec, - LLVMValueRef *depth0_vec, - LLVMValueRef *depth1_vec, - LLVMValueRef *row_stride0_vec, - LLVMValueRef *row_stride1_vec, - LLVMValueRef *img_stride0_vec, - LLVMValueRef *img_stride1_vec); + LLVMValueRef *out_width_vec, + LLVMValueRef *out_height_vec, + LLVMValueRef *out_depth_vec, + LLVMValueRef *row_stride_vec, + LLVMValueRef *img_stride_vec); void diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index d42b5f6127..5c5669bb8b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -1002,13 +1002,17 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* compute image size(s) of source mipmap level(s) */ lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, - ilevel0, ilevel1, + ilevel0, row_stride_array, img_stride_array, - &width0_vec, &width1_vec, - &height0_vec, &height1_vec, - &depth0_vec, &depth1_vec, - &row_stride0_vec, &row_stride1_vec, - &img_stride0_vec, &img_stride1_vec); + &width0_vec, &height0_vec, &depth0_vec, + &row_stride0_vec, &img_stride0_vec); + if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { + lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, + ilevel1, + row_stride_array, img_stride_array, + &width1_vec, &height1_vec, &depth1_vec, + &row_stride1_vec, &img_stride1_vec); + } /* * Get pointer(s) to image data for mipmap level(s). diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index c7947f06e8..1883c198e5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -975,13 +975,17 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* compute image size(s) of source mipmap level(s) */ lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, - ilevel0, ilevel1, + ilevel0, row_stride_array, img_stride_array, - &width0_vec, &width1_vec, - &height0_vec, &height1_vec, - &depth0_vec, &depth1_vec, - &row_stride0_vec, &row_stride1_vec, - &img_stride0_vec, &img_stride1_vec); + &width0_vec, &height0_vec, &depth0_vec, + &row_stride0_vec, &img_stride0_vec); + if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { + lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, + ilevel1, + row_stride_array, img_stride_array, + &width1_vec, &height1_vec, &depth1_vec, + &row_stride1_vec, &img_stride1_vec); + } /* * Get pointer(s) to image data for mipmap level(s). -- cgit v1.2.3 From 4f2e2ca4e39a4c6fe11739832203a36877bdf0d8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 13:26:37 +0100 Subject: gallivm: Don't compute the second mipmap level when frac(lod) == 0 --- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 167 +++++++++++----------- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 147 +++++++++++-------- 2 files changed, 175 insertions(+), 139 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 5c5669bb8b..511090ed14 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -794,63 +794,89 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMValueRef img_stride1_vec, LLVMValueRef data_ptr0, LLVMValueRef data_ptr1, - LLVMValueRef *colors_lo, - LLVMValueRef *colors_hi) + LLVMValueRef colors_lo_var, + LLVMValueRef colors_hi_var) { + LLVMBuilderRef builder = bld->builder; LLVMValueRef colors0_lo, colors0_hi; LLVMValueRef colors1_lo, colors1_hi; + /* sample the first mipmap level */ if (img_filter == PIPE_TEX_FILTER_NEAREST) { - /* sample the first mipmap level */ lp_build_sample_image_nearest(bld, width0_vec, height0_vec, depth0_vec, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, &colors0_lo, &colors0_hi); - - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - /* sample the second mipmap level */ - lp_build_sample_image_nearest(bld, - width1_vec, height1_vec, depth1_vec, - row_stride1_vec, img_stride1_vec, - data_ptr1, s, t, r, - &colors1_lo, &colors1_hi); - } } else { assert(img_filter == PIPE_TEX_FILTER_LINEAR); - - /* sample the first mipmap level */ lp_build_sample_image_linear(bld, width0_vec, height0_vec, depth0_vec, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, &colors0_lo, &colors0_hi); + } + + /* Store the first level's colors in the output variables */ + LLVMBuildStore(builder, colors0_lo, colors_lo_var); + LLVMBuildStore(builder, colors0_hi, colors_hi_var); + + if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { + LLVMValueRef h16_scale = LLVMConstReal(LLVMFloatType(), 256.0); + LLVMTypeRef i32_type = LLVMIntType(32); + struct lp_build_flow_context *flow_ctx; + struct lp_build_if_state if_ctx; + LLVMValueRef need_lerp; + + flow_ctx = lp_build_flow_create(builder); + + lod_fpart = LLVMBuildFMul(builder, lod_fpart, h16_scale, ""); + lod_fpart = LLVMBuildFPToSI(builder, lod_fpart, i32_type, "lod_fpart.fixed16"); + + /* need_lerp = lod_fpart > 0 */ + need_lerp = LLVMBuildICmp(builder, LLVMIntSGT, + lod_fpart, LLVMConstNull(i32_type), + "need_lerp"); + + lp_build_if(&if_ctx, flow_ctx, builder, need_lerp); + { + struct lp_build_context h16_bld; + + lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16)); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { /* sample the second mipmap level */ - lp_build_sample_image_linear(bld, - width1_vec, height1_vec, depth1_vec, - row_stride1_vec, img_stride1_vec, - data_ptr1, s, t, r, - &colors1_lo, &colors1_hi); + if (img_filter == PIPE_TEX_FILTER_NEAREST) { + lp_build_sample_image_nearest(bld, + width1_vec, height1_vec, depth1_vec, + row_stride1_vec, img_stride1_vec, + data_ptr1, s, t, r, + &colors1_lo, &colors1_hi); + } + else { + lp_build_sample_image_linear(bld, + width1_vec, height1_vec, depth1_vec, + row_stride1_vec, img_stride1_vec, + data_ptr1, s, t, r, + &colors1_lo, &colors1_hi); + } + + /* interpolate samples from the two mipmap levels */ + + lod_fpart = LLVMBuildTrunc(builder, lod_fpart, h16_bld.elem_type, ""); + lod_fpart = lp_build_broadcast_scalar(&h16_bld, lod_fpart); + + colors0_lo = lp_build_lerp(&h16_bld, lod_fpart, + colors0_lo, colors1_lo); + colors0_hi = lp_build_lerp(&h16_bld, lod_fpart, + colors0_hi, colors1_hi); + + LLVMBuildStore(builder, colors0_lo, colors_lo_var); + LLVMBuildStore(builder, colors0_hi, colors_hi_var); } - } + lp_build_endif(&if_ctx); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - /* interpolate samples from the two mipmap levels */ - struct lp_build_context h16; - lp_build_context_init(&h16, bld->builder, lp_type_ufixed(16)); - - *colors_lo = lp_build_lerp(&h16, lod_fpart, - colors0_lo, colors1_lo); - *colors_hi = lp_build_lerp(&h16, lod_fpart, - colors0_hi, colors1_hi); - } - else { - /* use first/only level's colors */ - *colors_lo = colors0_lo; - *colors_hi = colors0_hi; + lp_build_flow_destroy(flow_ctx); } } @@ -898,8 +924,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, LLVMValueRef packed, packed_lo, packed_hi; LLVMValueRef unswizzled[4]; LLVMValueRef face_ddx[4], face_ddy[4]; - struct lp_build_context h16; - LLVMTypeRef h16_vec_type; + struct lp_build_context h16_bld; /* we only support the common/simple wrap modes at this time */ assert(lp_is_simple_wrap_mode(bld->static_state->wrap_s)); @@ -910,9 +935,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* make 16-bit fixed-pt builder context */ - lp_build_context_init(&h16, builder, lp_type_ufixed(16)); - h16_vec_type = lp_build_vec_type(h16.type); - + lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16)); /* cube face selection, compute pre-face coords, etc. */ if (bld->static_state->target == PIPE_TEXTURE_CUBE) { @@ -955,8 +978,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* * Compute integer mipmap level(s) to fetch texels from: ilevel0, ilevel1 - * If mipfilter=linear, also compute the weight between the two - * mipmap levels: lod_fpart */ switch (mip_filter) { default: @@ -981,22 +1002,9 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); break; case PIPE_TEX_MIPFILTER_LINEAR: - { - LLVMValueRef f256 = LLVMConstReal(LLVMFloatType(), 256.0); - LLVMTypeRef i32_type = LLVMIntType(32); - LLVMTypeRef i16_type = LLVMIntType(16); - - assert(lod_fpart); - - lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); - - lod_fpart = LLVMBuildFMul(builder, lod_fpart, f256, ""); - 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); - - /* the lod_fpart values will be fixed pt values in [0,1) */ - } + assert(lod_ipart); + assert(lod_fpart); + lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); break; } @@ -1022,13 +1030,17 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, data_ptr1 = lp_build_get_mipmap_level(bld, data_array, ilevel1); } - /* * Get/interpolate texture colors. */ + + packed_lo = lp_build_alloca(builder, h16_bld.vec_type, "packed_lo"); + packed_hi = lp_build_alloca(builder, h16_bld.vec_type, "packed_hi"); + if (min_filter == mag_filter) { /* no need to distinquish between minification and magnification */ - lp_build_sample_mipmap(bld, min_filter, mip_filter, + lp_build_sample_mipmap(bld, + min_filter, mip_filter, s, t, r, lod_fpart, width0_vec, width1_vec, height0_vec, height1_vec, @@ -1036,7 +1048,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, row_stride0_vec, row_stride1_vec, img_stride0_vec, img_stride1_vec, data_ptr0, data_ptr1, - &packed_lo, &packed_hi); + packed_lo, packed_hi); } else { /* Emit conditional to choose min image filter or mag image filter @@ -1047,13 +1059,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, LLVMValueRef minify; flow_ctx = lp_build_flow_create(builder); - lp_build_flow_scope_begin(flow_ctx); - - packed_lo = LLVMGetUndef(h16_vec_type); - packed_hi = LLVMGetUndef(h16_vec_type); - - lp_build_flow_scope_declare(flow_ctx, &packed_lo); - lp_build_flow_scope_declare(flow_ctx, &packed_hi); /* minify = lod >= 0.0 */ minify = LLVMBuildICmp(builder, LLVMIntSGE, @@ -1070,12 +1075,13 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, row_stride0_vec, row_stride1_vec, img_stride0_vec, img_stride1_vec, data_ptr0, data_ptr1, - &packed_lo, &packed_hi); + packed_lo, packed_hi); } lp_build_else(&if_ctx); { /* Use the magnification filter */ - lp_build_sample_mipmap(bld, mag_filter, PIPE_TEX_MIPFILTER_NONE, + lp_build_sample_mipmap(bld, + mag_filter, PIPE_TEX_MIPFILTER_NONE, s, t, r, NULL, width_vec, NULL, height_vec, NULL, @@ -1083,24 +1089,21 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, row_stride0_vec, NULL, img_stride0_vec, NULL, data_ptr0, NULL, - &packed_lo, &packed_hi); + packed_lo, packed_hi); } lp_build_endif(&if_ctx); - lp_build_flow_scope_end(flow_ctx); lp_build_flow_destroy(flow_ctx); } - /* combine 'packed_lo', 'packed_hi' into 'packed' */ - { - struct lp_build_context h16, u8n; - - lp_build_context_init(&h16, builder, lp_type_ufixed(16)); - lp_build_context_init(&u8n, builder, lp_type_unorm(8)); - - packed = lp_build_pack2(builder, h16.type, u8n.type, - packed_lo, packed_hi); - } + /* + * combine the values stored in 'packed_lo' and 'packed_hi' variables + * into 'packed' + */ + packed = lp_build_pack2(builder, + h16_bld.type, lp_type_unorm(8), + LLVMBuildLoad(builder, packed_lo, ""), + LLVMBuildLoad(builder, packed_hi, "")); /* * Convert to SoA and swizzle. diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 1883c198e5..4adce4e8b3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -805,54 +805,76 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMValueRef data_ptr1, LLVMValueRef *colors_out) { + LLVMBuilderRef builder = bld->builder; LLVMValueRef colors0[4], colors1[4]; - int chan; + unsigned chan; + /* sample the first mipmap level */ if (img_filter == PIPE_TEX_FILTER_NEAREST) { - /* sample the first mipmap level */ 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, unit, - width1_vec, height1_vec, depth1_vec, - row_stride1_vec, img_stride1_vec, - data_ptr1, s, t, r, colors1); - } + data_ptr0, s, t, r, + colors0); } else { assert(img_filter == PIPE_TEX_FILTER_LINEAR); - - /* sample the first mipmap level */ 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); + data_ptr0, s, t, r, + colors0); + } - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - /* sample the second mipmap level */ - 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); - } + /* Store the first level's colors in the output variables */ + for (chan = 0; chan < 4; chan++) { + LLVMBuildStore(builder, colors0[chan], colors_out[chan]); } if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - /* interpolate samples from the two mipmap levels */ - for (chan = 0; chan < 4; chan++) { - colors_out[chan] = lp_build_lerp(&bld->texel_bld, lod_fpart, + struct lp_build_flow_context *flow_ctx; + struct lp_build_if_state if_ctx; + LLVMValueRef need_lerp; + + flow_ctx = lp_build_flow_create(builder); + + /* need_lerp = lod_fpart > 0 */ + need_lerp = LLVMBuildFCmp(builder, LLVMRealUGT, + lod_fpart, + bld->float_bld.zero, + "need_lerp"); + + lp_build_if(&if_ctx, flow_ctx, builder, need_lerp); + { + /* sample the second mipmap level */ + if (img_filter == PIPE_TEX_FILTER_NEAREST) { + 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); + } + else { + 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); + } + + /* interpolate samples from the two mipmap levels */ + + lod_fpart = lp_build_broadcast_scalar(&bld->texel_bld, lod_fpart); + + for (chan = 0; chan < 4; chan++) { + colors0[chan] = lp_build_lerp(&bld->texel_bld, lod_fpart, colors0[chan], colors1[chan]); + LLVMBuildStore(builder, colors0[chan], colors_out[chan]); + } } - } - else { - /* use first/only level's colors */ - for (chan = 0; chan < 4; chan++) { - colors_out[chan] = colors0[chan]; - } + lp_build_endif(&if_ctx); + + lp_build_flow_destroy(flow_ctx); } } @@ -885,6 +907,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, LLVMValueRef *colors_out) { 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; @@ -897,6 +920,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, LLVMValueRef img_stride0_vec = NULL, img_stride1_vec = NULL; LLVMValueRef data_ptr0, data_ptr1 = NULL; LLVMValueRef face_ddx[4], face_ddy[4]; + LLVMValueRef texels[4]; + unsigned chan; /* printf("%s mip %d min %d mag %d\n", __FUNCTION__, @@ -945,9 +970,13 @@ lp_build_sample_general(struct lp_build_sample_context *bld, } /* - * Compute integer mipmap level(s) to fetch texels from. + * Compute integer mipmap level(s) to fetch texels from: ilevel0, ilevel1 */ - if (mip_filter == PIPE_TEX_MIPFILTER_NONE) { + switch (mip_filter) { + default: + assert(0 && "bad mip_filter value in lp_build_sample_soa()"); + /* fall-through */ + case PIPE_TEX_MIPFILTER_NONE: /* always use mip level 0 */ if (bld->static_state->target == PIPE_TEXTURE_CUBE) { /* XXX this is a work-around for an apparent bug in LLVM 2.7. @@ -960,17 +989,16 @@ lp_build_sample_general(struct lp_build_sample_context *bld, else { ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0); } - } - else { + break; + case PIPE_TEX_MIPFILTER_NEAREST: assert(lod_ipart); - if (mip_filter == PIPE_TEX_MIPFILTER_NEAREST) { - 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_ipart, &ilevel0, &ilevel1); - lod_fpart = lp_build_broadcast_scalar(&bld->coord_bld, lod_fpart); - } + lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); + break; + case PIPE_TEX_MIPFILTER_LINEAR: + assert(lod_ipart); + assert(lod_fpart); + lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); + break; } /* compute image size(s) of source mipmap level(s) */ @@ -998,39 +1026,40 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* * Get/interpolate texture colors. */ + + for (chan = 0; chan < 4; ++chan) { + texels[chan] = lp_build_alloca(builder, bld->texel_bld.vec_type, ""); + lp_build_name(texels[chan], "sampler%u_texel_%c_var", unit, "xyzw"[chan]); + } + if (min_filter == mag_filter) { /* no need to distinquish between minification and magnification */ lp_build_sample_mipmap(bld, unit, - min_filter, mip_filter, s, t, r, lod_fpart, + min_filter, mip_filter, + s, t, r, lod_fpart, width0_vec, width1_vec, height0_vec, height1_vec, depth0_vec, depth1_vec, row_stride0_vec, row_stride1_vec, img_stride0_vec, img_stride1_vec, data_ptr0, data_ptr1, - colors_out); + texels); } else { /* Emit conditional to choose min image filter or mag image filter - * depending on the lod being >0 or <= 0, respectively. + * depending on the lod being > 0 or <= 0, respectively. */ struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; LLVMValueRef minify; - flow_ctx = lp_build_flow_create(bld->builder); - lp_build_flow_scope_begin(flow_ctx); - - lp_build_flow_scope_declare(flow_ctx, &colors_out[0]); - lp_build_flow_scope_declare(flow_ctx, &colors_out[1]); - lp_build_flow_scope_declare(flow_ctx, &colors_out[2]); - lp_build_flow_scope_declare(flow_ctx, &colors_out[3]); + flow_ctx = lp_build_flow_create(builder); /* minify = lod >= 0.0 */ - minify = LLVMBuildICmp(bld->builder, LLVMIntSGE, + minify = LLVMBuildICmp(builder, LLVMIntSGE, lod_ipart, int_bld->zero, ""); - lp_build_if(&if_ctx, flow_ctx, bld->builder, minify); + lp_build_if(&if_ctx, flow_ctx, builder, minify); { /* Use the minification filter */ lp_build_sample_mipmap(bld, unit, @@ -1042,7 +1071,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, row_stride0_vec, row_stride1_vec, img_stride0_vec, img_stride1_vec, data_ptr0, data_ptr1, - colors_out); + texels); } lp_build_else(&if_ctx); { @@ -1056,13 +1085,17 @@ lp_build_sample_general(struct lp_build_sample_context *bld, row_stride0_vec, NULL, img_stride0_vec, NULL, data_ptr0, NULL, - colors_out); + texels); } lp_build_endif(&if_ctx); - lp_build_flow_scope_end(flow_ctx); lp_build_flow_destroy(flow_ctx); } + + for (chan = 0; chan < 4; ++chan) { + colors_out[chan] = LLVMBuildLoad(builder, texels[chan], ""); + lp_build_name(colors_out[chan], "sampler%u_texel_%c", unit, "xyzw"[chan]); + } } -- cgit v1.2.3 From 0d84b64a4f4cf4dd9c884b5d47cc9d1df9bf8e79 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 13:36:18 +0100 Subject: gallivm: Use lp_build_ifloor_fract for lod computation. Forgot this one before. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index c4ed79e0e7..d6b50fbe5f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -359,11 +359,9 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, } 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"); + lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, out_lod_fpart); + lp_build_name(*out_lod_ipart, "lod_ipart"); + lp_build_name(*out_lod_fpart, "lod_fpart"); } else { *out_lod_ipart = lp_build_iround(float_bld, lod); -- cgit v1.2.3 From df7a2451b1a7b9ce8cc389b20bb707cf951f8d4e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 14:05:50 +0100 Subject: gallivm: Clamp mipmap level and zero mip weight simultaneously. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 57 ++++++++++++++++++----- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 1 + src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 4 +- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 +- 4 files changed, 52 insertions(+), 14 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d6b50fbe5f..cf6da2c278 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -409,27 +409,60 @@ void lp_build_linear_mip_levels(struct lp_build_sample_context *bld, unsigned unit, LLVMValueRef lod_ipart, + LLVMValueRef *lod_fpart_inout, LLVMValueRef *level0_out, LLVMValueRef *level1_out) { + LLVMBuilderRef builder = bld->builder; struct lp_build_context *int_bld = &bld->int_bld; - LLVMValueRef last_level, level; + struct lp_build_context *float_bld = &bld->float_bld; + LLVMValueRef last_level; + LLVMValueRef clamp_min; + LLVMValueRef clamp_max; + + *level0_out = lod_ipart; + *level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one); last_level = bld->dynamic_state->last_level(bld->dynamic_state, bld->builder, unit); - /* convert float lod to integer */ - level = lod_ipart; + /* + * Clamp both lod_ipart and lod_ipart + 1 to [0, last_level], with the + * minimum number of comparisons, and zeroing lod_fpart in the extreme + * ends in the process. + */ + + /* lod_ipart < 0 */ + clamp_min = LLVMBuildICmp(builder, LLVMIntSLT, + lod_ipart, int_bld->zero, + "clamp_lod_to_zero"); + + *level0_out = LLVMBuildSelect(builder, clamp_min, + int_bld->zero, *level0_out, ""); + + *level1_out = LLVMBuildSelect(builder, clamp_min, + int_bld->zero, *level1_out, ""); + + *lod_fpart_inout = LLVMBuildSelect(builder, clamp_min, + float_bld->zero, *lod_fpart_inout, ""); + + /* lod_ipart >= last_level */ + clamp_max = LLVMBuildICmp(builder, LLVMIntSGE, + lod_ipart, last_level, + "clamp_lod_to_last"); + + *level0_out = LLVMBuildSelect(builder, clamp_max, + int_bld->zero, *level0_out, ""); + + *level1_out = LLVMBuildSelect(builder, clamp_max, + int_bld->zero, *level1_out, ""); + + *lod_fpart_inout = LLVMBuildSelect(builder, clamp_max, + float_bld->zero, *lod_fpart_inout, ""); - /* compute level 0 and clamp to legal range of levels */ - *level0_out = lp_build_clamp(int_bld, level, - int_bld->zero, - last_level); - /* compute level 1 and clamp to legal range of levels */ - level = lp_build_add(int_bld, level, int_bld->one); - *level1_out = lp_build_clamp(int_bld, level, - int_bld->zero, - last_level); + lp_build_name(*level0_out, "sampler%u_miplevel0", unit); + lp_build_name(*level1_out, "sampler%u_miplevel1", unit); + lp_build_name(*lod_fpart_inout, "sampler%u_mipweight", unit); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 76f428d4be..e5d7f10778 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -309,6 +309,7 @@ void lp_build_linear_mip_levels(struct lp_build_sample_context *bld, unsigned unit, LLVMValueRef lod_ipart, + LLVMValueRef *lod_fpart_inout, LLVMValueRef *level0_out, LLVMValueRef *level1_out); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 511090ed14..293237c5b1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -1004,7 +1004,9 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, case PIPE_TEX_MIPFILTER_LINEAR: assert(lod_ipart); assert(lod_fpart); - lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); + lp_build_linear_mip_levels(bld, unit, + lod_ipart, &lod_fpart, + &ilevel0, &ilevel1); break; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 4adce4e8b3..886df7c29c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -997,7 +997,9 @@ lp_build_sample_general(struct lp_build_sample_context *bld, case PIPE_TEX_MIPFILTER_LINEAR: assert(lod_ipart); assert(lod_fpart); - lp_build_linear_mip_levels(bld, unit, lod_ipart, &ilevel0, &ilevel1); + lp_build_linear_mip_levels(bld, unit, + lod_ipart, &lod_fpart, + &ilevel0, &ilevel1); break; } -- cgit v1.2.3 From c8179ef5e8db46afd4efdf5cbb4d9c9d37e488f8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 14:09:22 +0100 Subject: gallivm: Fix copy'n'paste typo in previous commit. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index cf6da2c278..754902891b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -452,10 +452,10 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, "clamp_lod_to_last"); *level0_out = LLVMBuildSelect(builder, clamp_max, - int_bld->zero, *level0_out, ""); + last_level, *level0_out, ""); *level1_out = LLVMBuildSelect(builder, clamp_max, - int_bld->zero, *level1_out, ""); + last_level, *level1_out, ""); *lod_fpart_inout = LLVMBuildSelect(builder, clamp_max, float_bld->zero, *lod_fpart_inout, ""); -- cgit v1.2.3 From eb605701aa4af9ea44004008256a5707e470738c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 15:50:28 +0100 Subject: gallivm: Implement brilinear filtering. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 90 ++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 754902891b..f23ede3319 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -39,12 +39,20 @@ #include "lp_bld_arit.h" #include "lp_bld_const.h" #include "lp_bld_debug.h" +#include "lp_bld_printf.h" #include "lp_bld_flow.h" #include "lp_bld_sample.h" #include "lp_bld_swizzle.h" #include "lp_bld_type.h" +/* + * Bri-linear factor. Use zero or any other number less than one to force + * tri-linear filtering. + */ +#define BRILINEAR_FACTOR 2 + + /** * Does the given texture wrap mode allow sampling the texture border color? * XXX maybe move this into gallium util code. @@ -254,6 +262,79 @@ lp_build_rho(struct lp_build_sample_context *bld, } +/* + * Bri-linear lod computation + * + * Use a piece-wise linear approximation of log2 such that: + * - round to nearest, for values in the neighborhood of -1, 0, 1, 2, etc. + * - linear approximation for values in the neighborhood of 0.5, 1.5., etc, + * with the steepness specified in 'factor' + * - exact result for 0.5, 1.5, etc. + * + * + * 1.0 - /----* + * / + * / + * / + * 0.5 - * + * / + * / + * / + * 0.0 - *----/ + * + * | | + * 2^0 2^1 + * + * This is a technique also commonly used in hardware: + * - http://ixbtlabs.com/articles2/gffx/nv40-rx800-3.html + * + * TODO: For correctness, this should only be applied when texture is known to + * have regular mipmaps, i.e., mipmaps derived from the base level. + * + * TODO: This could be done in fixed point, where applicable. + */ +static void +lp_build_brilinear_lod(struct lp_build_sample_context *bld, + LLVMValueRef lod, + double factor, + LLVMValueRef *out_lod_ipart, + LLVMValueRef *out_lod_fpart) +{ + struct lp_build_context *float_bld = &bld->float_bld; + LLVMValueRef lod_fpart; + float pre_offset = (factor - 0.5)/factor - 0.5; + float post_offset = 1 - factor; + + if (0) { + lp_build_printf(bld->builder, "lod = %f\n", lod); + } + + lod = lp_build_add(float_bld, lod, + lp_build_const_vec(float_bld->type, pre_offset)); + + lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, &lod_fpart); + + lod_fpart = lp_build_mul(float_bld, lod_fpart, + lp_build_const_vec(float_bld->type, factor)); + + lod_fpart = lp_build_add(float_bld, lod_fpart, + lp_build_const_vec(float_bld->type, post_offset)); + + /* + * It's not necessary to clamp lod_fpart since: + * - the above expression will never produce numbers greater than one. + * - the mip filtering branch is only taken if lod_fpart is positive + */ + + *out_lod_fpart = lod_fpart; + + if (0) { + lp_build_printf(bld->builder, "lod_ipart = %i\n", *out_lod_ipart); + lp_build_printf(bld->builder, "lod_fpart = %f\n\n", *out_lod_fpart); + } +} + + /** * Generate code to compute texture level of detail (lambda). * \param ddx partial derivatives of (s, t, r, q) with respect to X @@ -359,7 +440,14 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, } if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, out_lod_fpart); + if (BRILINEAR_FACTOR > 1.0) { + lp_build_brilinear_lod(bld, lod, BRILINEAR_FACTOR, + out_lod_ipart, out_lod_fpart); + } + else { + lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, out_lod_fpart); + } + lp_build_name(*out_lod_ipart, "lod_ipart"); lp_build_name(*out_lod_fpart, "lod_fpart"); } -- cgit v1.2.3 From ad6730fadbbeacea96322e31064ede9ea7ebad6f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 8 Oct 2010 17:01:16 +0100 Subject: llvmpipe: fail gracefully on oom in scene creation --- src/gallium/drivers/llvmpipe/lp_setup.c | 97 ++++++++++++++++++------- src/gallium/drivers/llvmpipe/lp_setup_context.h | 6 +- src/gallium/drivers/llvmpipe/lp_setup_line.c | 5 +- src/gallium/drivers/llvmpipe/lp_setup_point.c | 5 +- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 15 ++-- src/gallium/drivers/llvmpipe/lp_setup_vbuf.c | 6 +- 6 files changed, 92 insertions(+), 42 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index e72ead0def..e96f012f1b 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -56,7 +56,7 @@ #include "draw/draw_vbuf.h" -static void set_scene_state( struct lp_setup_context *, enum setup_state, +static boolean set_scene_state( struct lp_setup_context *, enum setup_state, const char *reason); static boolean try_update_scene_state( struct lp_setup_context *setup ); @@ -167,7 +167,7 @@ lp_setup_rasterize_scene( struct lp_setup_context *setup ) -static void +static boolean begin_binning( struct lp_setup_context *setup ) { struct lp_scene *scene = setup->scene; @@ -181,6 +181,8 @@ begin_binning( struct lp_setup_context *setup ) /* Always create a fence: */ scene->fence = lp_fence_create(MAX2(1, setup->num_threads)); + if (!scene->fence) + return FALSE; /* Initialize the bin flags and x/y coords: */ @@ -192,7 +194,8 @@ begin_binning( struct lp_setup_context *setup ) } ok = try_update_scene_state(setup); - assert(ok); + if (!ok) + return FALSE; if (setup->fb.zsbuf && ((setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) && @@ -208,7 +211,8 @@ begin_binning( struct lp_setup_context *setup ) ok = lp_scene_bin_everywhere( scene, LP_RAST_OP_CLEAR_COLOR, setup->clear.color ); - assert(ok); + if (!ok) + return FALSE; } } @@ -216,12 +220,14 @@ begin_binning( struct lp_setup_context *setup ) if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) { if (!need_zsload) scene->has_depthstencil_clear = TRUE; + ok = lp_scene_bin_everywhere( scene, LP_RAST_OP_CLEAR_ZSTENCIL, lp_rast_arg_clearzs( setup->clear.zsvalue, setup->clear.zsmask)); - assert(ok); + if (!ok) + return FALSE; } } @@ -229,15 +235,16 @@ begin_binning( struct lp_setup_context *setup ) ok = lp_scene_bin_everywhere( scene, LP_RAST_OP_BEGIN_QUERY, lp_rast_arg_query(setup->active_query) ); - assert(ok); + if (!ok) + return FALSE; } - setup->clear.flags = 0; setup->clear.zsmask = 0; setup->clear.zsvalue = 0; LP_DBG(DEBUG_SETUP, "%s done\n", __FUNCTION__); + return TRUE; } @@ -246,12 +253,12 @@ begin_binning( struct lp_setup_context *setup ) * * TODO: fast path for fullscreen clears and no triangles. */ -static void +static boolean execute_clears( struct lp_setup_context *setup ) { LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); - begin_binning( setup ); + return begin_binning( setup ); } const char *states[] = { @@ -262,7 +269,7 @@ const char *states[] = { }; -static void +static boolean set_scene_state( struct lp_setup_context *setup, enum setup_state new_state, const char *reason) @@ -270,7 +277,7 @@ set_scene_state( struct lp_setup_context *setup, unsigned old_state = setup->state; if (old_state == new_state) - return; + return TRUE; if (LP_DEBUG & DEBUG_SCENE) { debug_printf("%s old %s new %s%s%s\n", @@ -294,12 +301,14 @@ set_scene_state( struct lp_setup_context *setup, break; case SETUP_ACTIVE: - begin_binning( setup ); + if (!begin_binning( setup )) + goto fail; break; case SETUP_FLUSHED: if (old_state == SETUP_CLEARED) - execute_clears( setup ); + if (!execute_clears( setup )) + goto fail; lp_setup_rasterize_scene( setup ); assert(setup->scene == NULL); @@ -307,9 +316,21 @@ set_scene_state( struct lp_setup_context *setup, default: assert(0 && "invalid setup state mode"); + goto fail; } setup->state = new_state; + return TRUE; + +fail: + if (setup->scene) { + lp_scene_end_rasterization(setup->scene); + setup->scene = NULL; + } + + setup->state = SETUP_FLUSHED; + lp_setup_reset( setup ); + return FALSE; } @@ -878,7 +899,7 @@ try_update_scene_state( struct lp_setup_context *setup ) return TRUE; } -void +boolean lp_setup_update_state( struct lp_setup_context *setup, boolean update_scene ) { @@ -902,20 +923,38 @@ lp_setup_update_state( struct lp_setup_context *setup, assert(lp->dirty == 0); } - if (update_scene) - set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ ); + if (update_scene) { + if (!set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ )) + return FALSE; + } /* Only call into update_scene_state() if we already have a * scene: */ if (update_scene && setup->scene) { assert(setup->state == SETUP_ACTIVE); - if (!try_update_scene_state(setup)) { - lp_setup_flush_and_restart(setup); - if (!try_update_scene_state(setup)) - assert(0); - } + + if (try_update_scene_state(setup)) + return TRUE; + + /* Update failed, try to restart the scene. + * + * Cannot call lp_setup_flush_and_restart() directly here + * because of potential recursion. + */ + if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) + return FALSE; + + if (!set_scene_state(setup, SETUP_ACTIVE, __FUNCTION__)) + return FALSE; + + if (!setup->scene) + return FALSE; + + return try_update_scene_state(setup); } + + return TRUE; } @@ -1019,12 +1058,12 @@ lp_setup_begin_query(struct lp_setup_context *setup, LP_RAST_OP_BEGIN_QUERY, lp_rast_arg_query(pq))) { - lp_setup_flush_and_restart(setup); + if (!lp_setup_flush_and_restart(setup)) + return; if (!lp_scene_bin_everywhere(setup->scene, LP_RAST_OP_BEGIN_QUERY, lp_rast_arg_query(pq))) { - assert(0); return; } } @@ -1068,14 +1107,20 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) } -void +boolean lp_setup_flush_and_restart(struct lp_setup_context *setup) { if (0) debug_printf("%s\n", __FUNCTION__); assert(setup->state == SETUP_ACTIVE); - set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__); - lp_setup_update_state(setup, TRUE); + + if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) + return FALSE; + + if (!lp_setup_update_state(setup, TRUE)) + return FALSE; + + return TRUE; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 8506ed2dc9..e7b425ebcb 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -160,12 +160,12 @@ void lp_setup_choose_point( struct lp_setup_context *setup ); void lp_setup_init_vbuf(struct lp_setup_context *setup); -void lp_setup_update_state( struct lp_setup_context *setup, +boolean lp_setup_update_state( struct lp_setup_context *setup, boolean update_scene); void lp_setup_destroy( struct lp_setup_context *setup ); -void lp_setup_flush_and_restart(struct lp_setup_context *setup); +boolean lp_setup_flush_and_restart(struct lp_setup_context *setup); void lp_setup_print_triangle(struct lp_setup_context *setup, @@ -191,6 +191,4 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, const struct u_rect *bbox, int nr_planes ); -void lp_setup_flush_and_restart(struct lp_setup_context *setup); - #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 156bd63375..4d7d6235b0 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -712,10 +712,11 @@ static void lp_setup_line( struct lp_setup_context *setup, { if (!try_setup_line( setup, v0, v1 )) { - lp_setup_flush_and_restart(setup); + if (!lp_setup_flush_and_restart(setup)) + return; if (!try_setup_line( setup, v0, v1 )) - assert(0); + return; } } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 1295aeecd8..31d85f43c2 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -414,10 +414,11 @@ lp_setup_point(struct lp_setup_context *setup, { if (!try_setup_point( setup, v0 )) { - lp_setup_flush_and_restart(setup); + if (!lp_setup_flush_and_restart(setup)) + return; if (!try_setup_point( setup, v0 )) - assert(0); + return; } } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 9016bb8e24..eeffbb5fee 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -644,27 +644,30 @@ static void triangle_cw( struct lp_setup_context *setup, { if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface )) { - lp_setup_flush_and_restart(setup); + if (!lp_setup_flush_and_restart(setup)) + return; if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface )) - assert(0); + return; } } /** - * Draw triangle if it's CCW, cull otherwise. + * Draw triangle if it's CW, cull otherwise. */ -static void triangle_ccw( struct lp_setup_context *setup, +static void triangle_cw( struct lp_setup_context *setup, const float (*v0)[4], const float (*v1)[4], const float (*v2)[4] ) { if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface )) { - lp_setup_flush_and_restart(setup); + if (!lp_setup_flush_and_restart(setup)) + return; + if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface )) - assert(0); + return; } } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c index 6308561f24..9c1f0fe793 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c @@ -141,7 +141,8 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr) const boolean flatshade_first = setup->flatshade_first; unsigned i; - lp_setup_update_state(setup, TRUE); + if (!lp_setup_update_state(setup, TRUE)) + return; switch (setup->prim) { case PIPE_PRIM_POINTS: @@ -338,7 +339,8 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) const boolean flatshade_first = setup->flatshade_first; unsigned i; - lp_setup_update_state(setup, TRUE); + if (!lp_setup_update_state(setup, TRUE)) + return; switch (setup->prim) { case PIPE_PRIM_POINTS: -- cgit v1.2.3 From 29d6a1483d6c4ecb9c34989423e025b3784ec019 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 8 Oct 2010 17:06:05 +0100 Subject: llvmpipe: avoid overflow in triangle culling Avoid multiplying fixed-point values. Calculate triangle area in floating point use that for culling. Lift area calculations up a level as we are already doing this in the triangle_both() case. Would like to share the calculated area with attribute interpolation, but the way the code is structured makes this difficult. --- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 79 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 40 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index eeffbb5fee..0d57f13f61 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -228,7 +228,6 @@ do_triangle_ccw(struct lp_setup_context *setup, struct lp_rast_triangle *tri; int x[3]; int y[3]; - int area; struct u_rect bbox; unsigned tri_bytes; int i; @@ -312,21 +311,8 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->plane[1].dcdx = y[1] - y[2]; tri->plane[2].dcdx = y[2] - y[0]; - area = (tri->plane[0].dcdy * tri->plane[2].dcdx - - tri->plane[2].dcdy * tri->plane[0].dcdx); - LP_COUNT(nr_tris); - /* Cull non-ccw and zero-sized triangles. - * - * XXX: subject to overflow?? - */ - if (area <= 0) { - lp_scene_putback_data( scene, tri_bytes ); - LP_COUNT(nr_culled_tris); - return TRUE; - } - /* Setup parameter interpolants: */ lp_setup_tri_coef( setup, &tri->inputs, v0, v1, v2, frontfacing ); @@ -635,23 +621,36 @@ fail: /** - * Draw triangle if it's CW, cull otherwise. + * Try to draw the triangle, restart the scene on failure. */ -static void triangle_cw( struct lp_setup_context *setup, - const float (*v0)[4], - const float (*v1)[4], - const float (*v2)[4] ) +static void retry_triangle_ccw( struct lp_setup_context *setup, + const float (*v0)[4], + const float (*v1)[4], + const float (*v2)[4], + boolean front) { - if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface )) + if (!do_triangle_ccw( setup, v0, v1, v2, front )) { if (!lp_setup_flush_and_restart(setup)) return; - if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface )) + if (!do_triangle_ccw( setup, v0, v1, v2, front )) return; } } +static INLINE float +calc_area(const float (*v0)[4], + const float (*v1)[4], + const float (*v2)[4]) +{ + float dx01 = v0[0][0] - v1[0][0]; + float dy01 = v0[0][1] - v1[0][1]; + float dx20 = v2[0][0] - v0[0][0]; + float dy20 = v2[0][1] - v0[0][1]; + return dx01 * dy20 - dx20 * dy01; +} + /** * Draw triangle if it's CW, cull otherwise. @@ -661,17 +660,23 @@ static void triangle_cw( struct lp_setup_context *setup, const float (*v1)[4], const float (*v2)[4] ) { - if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface )) - { - if (!lp_setup_flush_and_restart(setup)) - return; + float area = calc_area(v0, v1, v2); - if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface )) - return; - } + if (area < 0.0f) + retry_triangle_ccw(setup, v0, v2, v1, !setup->ccw_is_frontface); } +static void triangle_ccw( struct lp_setup_context *setup, + const float (*v0)[4], + const float (*v1)[4], + const float (*v2)[4]) +{ + float area = calc_area(v0, v1, v2); + + if (area > 0.0f) + retry_triangle_ccw(setup, v0, v1, v2, setup->ccw_is_frontface); +} /** * Draw triangle whether it's CW or CCW. @@ -681,18 +686,12 @@ static void triangle_both( struct lp_setup_context *setup, const float (*v1)[4], const float (*v2)[4] ) { - /* edge vectors e = v0 - v2, f = v1 - v2 */ - const float ex = v0[0][0] - v2[0][0]; - const float ey = v0[0][1] - v2[0][1]; - const float fx = v1[0][0] - v2[0][0]; - const float fy = v1[0][1] - v2[0][1]; - - /* det = cross(e,f).z */ - const float det = ex * fy - ey * fx; - if (det < 0.0f) - triangle_ccw( setup, v0, v1, v2 ); - else if (det > 0.0f) - triangle_cw( setup, v0, v1, v2 ); + float area = calc_area(v0, v1, v2); + + if (area > 0.0f) + retry_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface ); + else if (area < 0.0f) + retry_triangle_ccw( setup, v0, v2, v1, !setup->ccw_is_frontface ); } -- cgit v1.2.3 From 607e3c542cedd645da91c96abfe6698623acf503 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 4 Oct 2010 15:00:34 +0100 Subject: gallivm: special case conversion 4x4f to 1x16ub Nice reduction in the number of operations required for final color output in many shaders. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 84 +++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 8b477313d4..605eb043c7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -69,6 +69,7 @@ #include "lp_bld_arit.h" #include "lp_bld_pack.h" #include "lp_bld_conv.h" +#include "lp_bld_intr.h" /** @@ -241,6 +242,89 @@ lp_build_conv(LLVMBuilderRef builder, } num_tmps = num_srcs; + + /* Special case 4x4f --> 1x16ub + */ + if (src_type.floating == 1 && + src_type.fixed == 0 && + src_type.sign == 1 && + src_type.norm == 0 && + src_type.width == 32 && + src_type.length == 4 && + + dst_type.floating == 0 && + dst_type.fixed == 0 && + dst_type.sign == 0 && + dst_type.norm == 1 && + dst_type.width == 8 && + dst_type.length == 16) + { + int i; + + for (i = 0; i < num_dsts; i++, src += 4) { + struct lp_type int16_type = dst_type; + struct lp_type int32_type = dst_type; + LLVMValueRef lo, hi; + LLVMValueRef src_int0; + LLVMValueRef src_int1; + LLVMValueRef src_int2; + LLVMValueRef src_int3; + LLVMTypeRef int16_vec_type; + LLVMTypeRef int32_vec_type; + LLVMTypeRef src_vec_type; + LLVMTypeRef dst_vec_type; + LLVMValueRef const_255f; + + int16_type.width *= 2; + int16_type.length /= 2; + int16_type.sign = 1; + + int32_type.width *= 4; + int32_type.length /= 4; + int32_type.sign = 1; + + src_vec_type = lp_build_vec_type(src_type); + dst_vec_type = lp_build_vec_type(dst_type); + int16_vec_type = lp_build_vec_type(int16_type); + int32_vec_type = lp_build_vec_type(int32_type); + + const_255f = lp_build_const_vec(src_type, 255.0); + + src_int0 = LLVMBuildFPToSI(builder, + LLVMBuildFMul(builder, src[0], const_255f, ""), + int32_vec_type, ""); + + src_int1 = LLVMBuildFPToSI(builder, + LLVMBuildFMul(builder, src[1], const_255f, ""), + int32_vec_type, ""); + + src_int2 = LLVMBuildFPToSI(builder, + LLVMBuildFMul(builder, src[2], const_255f, ""), + int32_vec_type, ""); + + src_int3 = LLVMBuildFPToSI(builder, + LLVMBuildFMul(builder, src[3], const_255f, ""), + int32_vec_type, ""); + +#if HAVE_LLVM >= 0x0207 + lo = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", + int16_vec_type, src_int0, src_int1); + hi = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", + int16_vec_type, src_int2, src_int3); + dst[i] = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", + dst_vec_type, lo, hi); +#else + lo = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", + int32_vec_type, src_int0, src_int1); + hi = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", + int32_vec_type, src_int2, src_int3); + dst[i] = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", + int16_vec_type, lo, hi); +#endif + } + return; + } + /* * Clamp if necessary */ -- cgit v1.2.3 From f91b4266c6ca950b267bc8968091c85de8cae032 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 4 Oct 2010 17:42:18 +0100 Subject: gallivm: Use the wrappers for SSE pack intrinsics. Fixes assertion failures on LLVM 2.6. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 605eb043c7..40c6618752 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -306,21 +306,9 @@ lp_build_conv(LLVMBuilderRef builder, LLVMBuildFMul(builder, src[3], const_255f, ""), int32_vec_type, ""); -#if HAVE_LLVM >= 0x0207 - lo = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", - int16_vec_type, src_int0, src_int1); - hi = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", - int16_vec_type, src_int2, src_int3); - dst[i] = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", - dst_vec_type, lo, hi); -#else - lo = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", - int32_vec_type, src_int0, src_int1); - hi = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", - int32_vec_type, src_int2, src_int3); - dst[i] = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", - int16_vec_type, lo, hi); -#endif + lo = lp_build_pack2(builder, int32_type, int16_type, src_int0, src_int1); + hi = lp_build_pack2(builder, int32_type, int16_type, src_int2, src_int3); + dst[i] = lp_build_pack2(builder, int16_type, dst_type, lo, hi); } return; } -- cgit v1.2.3 From e191bf4a8591c8bbccda606a72ed5b90a9db8f72 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 Oct 2010 11:48:10 +0100 Subject: gallivm: round rather than truncate in new 4x4f->1x16ub conversion path --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 59 ++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 17 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 40c6618752..b5ed4c2d9b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -63,6 +63,7 @@ #include "util/u_debug.h" #include "util/u_math.h" +#include "util/u_cpu_detect.h" #include "lp_bld_type.h" #include "lp_bld_const.h" @@ -274,6 +275,7 @@ lp_build_conv(LLVMBuilderRef builder, LLVMTypeRef src_vec_type; LLVMTypeRef dst_vec_type; LLVMValueRef const_255f; + LLVMValueRef a, b, c, d; int16_type.width *= 2; int16_type.length /= 2; @@ -288,23 +290,46 @@ lp_build_conv(LLVMBuilderRef builder, int16_vec_type = lp_build_vec_type(int16_type); int32_vec_type = lp_build_vec_type(int32_type); - const_255f = lp_build_const_vec(src_type, 255.0); - - src_int0 = LLVMBuildFPToSI(builder, - LLVMBuildFMul(builder, src[0], const_255f, ""), - int32_vec_type, ""); - - src_int1 = LLVMBuildFPToSI(builder, - LLVMBuildFMul(builder, src[1], const_255f, ""), - int32_vec_type, ""); - - src_int2 = LLVMBuildFPToSI(builder, - LLVMBuildFMul(builder, src[2], const_255f, ""), - int32_vec_type, ""); - - src_int3 = LLVMBuildFPToSI(builder, - LLVMBuildFMul(builder, src[3], const_255f, ""), - int32_vec_type, ""); + const_255f = lp_build_const_vec(src_type, 255.0f); + + a = LLVMBuildFMul(builder, src[0], const_255f, ""); + b = LLVMBuildFMul(builder, src[1], const_255f, ""); + c = LLVMBuildFMul(builder, src[2], const_255f, ""); + d = LLVMBuildFMul(builder, src[3], const_255f, ""); + + /* lp_build_round generates excessively general code without + * sse4, so do rounding manually. + */ + if (!util_cpu_caps.has_sse4_1) { + LLVMValueRef const_half = lp_build_const_vec(src_type, 0.5f); + + a = LLVMBuildFAdd(builder, a, const_half, ""); + b = LLVMBuildFAdd(builder, b, const_half, ""); + c = LLVMBuildFAdd(builder, c, const_half, ""); + d = LLVMBuildFAdd(builder, d, const_half, ""); + + src_int0 = LLVMBuildFPToSI(builder, a, int32_vec_type, ""); + src_int1 = LLVMBuildFPToSI(builder, b, int32_vec_type, ""); + src_int2 = LLVMBuildFPToSI(builder, c, int32_vec_type, ""); + src_int3 = LLVMBuildFPToSI(builder, d, int32_vec_type, ""); + } + else { + struct lp_build_context bld; + + bld.builder = builder; + bld.type = src_type; + bld.vec_type = src_vec_type; + bld.int_elem_type = lp_build_elem_type(int32_type); + bld.int_vec_type = int32_vec_type; + bld.undef = lp_build_undef(src_type); + bld.zero = lp_build_zero(src_type); + bld.one = lp_build_one(src_type); + + src_int0 = lp_build_iround(&bld, a); + src_int1 = lp_build_iround(&bld, b); + src_int2 = lp_build_iround(&bld, c); + src_int3 = lp_build_iround(&bld, d); + } lo = lp_build_pack2(builder, int32_type, int16_type, src_int0, src_int1); hi = lp_build_pack2(builder, int32_type, int16_type, src_int2, src_int3); -- cgit v1.2.3 From eeb13e2352d7a44881b011cb3232bb80aee0c826 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 23 Sep 2010 19:56:48 +0100 Subject: llvmpipe: clean up setup_tri a little --- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 53 ++++++++++++++--------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 0d57f13f61..9f871011d8 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -473,33 +473,6 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, int sz = floor_pot((bbox->x1 - (bbox->x0 & ~3)) | (bbox->y1 - (bbox->y0 & ~3))); - if (nr_planes == 3) { - if (sz < 4 && dx < 64) - { - /* Triangle is contained in a single 4x4 stamp: - */ - int mask = (bbox->x0 & 63 & ~3) | ((bbox->y0 & 63 & ~3) << 8); - - return lp_scene_bin_command( scene, - bbox->x0/64, bbox->y0/64, - LP_RAST_OP_TRIANGLE_3_4, - lp_rast_arg_triangle(tri, mask) ); - } - - if (sz < 16 && dx < 64) - { - int mask = (bbox->x0 & 63 & ~3) | ((bbox->y0 & 63 & ~3) << 8); - - /* Triangle is contained in a single 16x16 block: - */ - return lp_scene_bin_command( scene, - bbox->x0/64, bbox->y0/64, - LP_RAST_OP_TRIANGLE_3_16, - lp_rast_arg_triangle(tri, mask) ); - } - } - - /* Determine which tile(s) intersect the triangle's bounding box */ if (dx < TILE_SIZE) @@ -510,6 +483,32 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, assert(iy0 == bbox->y1 / TILE_SIZE && ix0 == bbox->x1 / TILE_SIZE); + if (nr_planes == 3) { + int px = bbox->x0 & 63 & ~3; + int py = bbox->y0 & 63 & ~3; + int mask = px | (py << 8); + + if (sz < 4) + { + /* Triangle is contained in a single 4x4 stamp: + */ + + return lp_scene_bin_command( scene, ix0, iy0, + LP_RAST_OP_TRIANGLE_3_4, + lp_rast_arg_triangle(tri, mask) ); + } + + if (sz < 16) + { + /* Triangle is contained in a single 16x16 block: + */ + return lp_scene_bin_command( scene, ix0, iy0, + LP_RAST_OP_TRIANGLE_3_16, + lp_rast_arg_triangle(tri, mask) ); + } + } + + /* Triangle is contained in a single tile: */ return lp_scene_bin_command( scene, ix0, iy0, -- cgit v1.2.3 From 0ff132e5a633170afaed0aea54d01438c895b8ab Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 8 Oct 2010 17:21:03 +0100 Subject: llvmpipe: add rast_tri_4_16 for small lines and points --- src/gallium/drivers/llvmpipe/lp_rast.c | 1 + src/gallium/drivers/llvmpipe/lp_rast.h | 11 +- src/gallium/drivers/llvmpipe/lp_rast_debug.c | 1 + src/gallium/drivers/llvmpipe/lp_rast_priv.h | 4 + src/gallium/drivers/llvmpipe/lp_rast_tri.c | 152 +++---------------------- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 127 +++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_setup_tri.c | 13 ++- 7 files changed, 161 insertions(+), 148 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 790d88a745..db9b2f9b12 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -597,6 +597,7 @@ static lp_rast_cmd_func dispatch[LP_RAST_OP_MAX] = lp_rast_triangle_8, lp_rast_triangle_3_4, lp_rast_triangle_3_16, + lp_rast_triangle_4_16, lp_rast_shade_tile, lp_rast_shade_tile_opaque, lp_rast_begin_query, diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 0f62377c07..df0bea04b9 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -238,12 +238,13 @@ lp_rast_arg_null( void ) #define LP_RAST_OP_TRIANGLE_8 0x9 #define LP_RAST_OP_TRIANGLE_3_4 0xa #define LP_RAST_OP_TRIANGLE_3_16 0xb -#define LP_RAST_OP_SHADE_TILE 0xc -#define LP_RAST_OP_SHADE_TILE_OPAQUE 0xd -#define LP_RAST_OP_BEGIN_QUERY 0xe -#define LP_RAST_OP_END_QUERY 0xf +#define LP_RAST_OP_TRIANGLE_4_16 0xc +#define LP_RAST_OP_SHADE_TILE 0xd +#define LP_RAST_OP_SHADE_TILE_OPAQUE 0xe +#define LP_RAST_OP_BEGIN_QUERY 0xf +#define LP_RAST_OP_END_QUERY 0x10 -#define LP_RAST_OP_MAX 0x10 +#define LP_RAST_OP_MAX 0x11 #define LP_RAST_OP_MASK 0xff void diff --git a/src/gallium/drivers/llvmpipe/lp_rast_debug.c b/src/gallium/drivers/llvmpipe/lp_rast_debug.c index 9fc78645a3..6f4ba1c6fe 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_debug.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_debug.c @@ -42,6 +42,7 @@ static const char *cmd_names[LP_RAST_OP_MAX] = "triangle_8", "triangle_3_4", "triangle_3_16", + "triangle_4_16", "shade_tile", "shade_tile_opaque", "begin_query", diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 7370119e96..104000a040 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -293,6 +293,10 @@ void lp_rast_triangle_3_4(struct lp_rasterizer_task *, void lp_rast_triangle_3_16( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); + +void lp_rast_triangle_4_16( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + void lp_debug_bin( const struct cmd_bin *bin ); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index a1f309d4b0..f870a187db 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -122,6 +122,16 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task, lp_rast_triangle_3(task, arg2); } +void +lp_rast_triangle_4_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + union lp_rast_cmd_arg arg2; + arg2.triangle.tri = arg.triangle.tri; + arg2.triangle.plane_mask = (1<<4)-1; + lp_rast_triangle_3(task, arg2); +} + void lp_rast_triangle_3_4(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg) @@ -229,145 +239,6 @@ sign_bits4(const __m128i *cstep, int cdiff) return _mm_movemask_epi8(result); } - -/* Special case for 3 plane triangle which is contained entirely - * within a 16x16 block. - */ -void -lp_rast_triangle_3_16(struct lp_rasterizer_task *task, - const union lp_rast_cmd_arg arg) -{ - const struct lp_rast_triangle *tri = arg.triangle.tri; - const struct lp_rast_plane *plane = tri->plane; - unsigned mask = arg.triangle.plane_mask; - const int x = task->x + (mask & 0xff); - const int y = task->y + (mask >> 8); - unsigned outmask, inmask, partmask, partial_mask; - unsigned j; - __m128i cstep4[3][4]; - - outmask = 0; /* outside one or more trivial reject planes */ - partmask = 0; /* outside one or more trivial accept planes */ - - for (j = 0; j < 3; j++) { - const int dcdx = -plane[j].dcdx * 4; - const int dcdy = plane[j].dcdy * 4; - __m128i xdcdy = _mm_set1_epi32(dcdy); - - cstep4[j][0] = _mm_setr_epi32(0, dcdx, dcdx*2, dcdx*3); - cstep4[j][1] = _mm_add_epi32(cstep4[j][0], xdcdy); - cstep4[j][2] = _mm_add_epi32(cstep4[j][1], xdcdy); - cstep4[j][3] = _mm_add_epi32(cstep4[j][2], xdcdy); - - { - const int c = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x; - const int cox = plane[j].eo * 4; - const int cio = plane[j].ei * 4 - 1; - - outmask |= sign_bits4(cstep4[j], c + cox); - partmask |= sign_bits4(cstep4[j], c + cio); - } - } - - if (outmask == 0xffff) - return; - - /* Mask of sub-blocks which are inside all trivial accept planes: - */ - inmask = ~partmask & 0xffff; - - /* Mask of sub-blocks which are inside all trivial reject planes, - * but outside at least one trivial accept plane: - */ - partial_mask = partmask & ~outmask; - - assert((partial_mask & inmask) == 0); - - /* Iterate over partials: - */ - while (partial_mask) { - int i = ffs(partial_mask) - 1; - int ix = (i & 3) * 4; - int iy = (i >> 2) * 4; - int px = x + ix; - int py = y + iy; - unsigned mask = 0xffff; - - partial_mask &= ~(1 << i); - - for (j = 0; j < 3; j++) { - const int cx = (plane[j].c - - plane[j].dcdx * px - + plane[j].dcdy * py) * 4; - - mask &= ~sign_bits4(cstep4[j], cx); - } - - if (mask) - lp_rast_shade_quads_mask(task, &tri->inputs, px, py, mask); - } - - /* Iterate over fulls: - */ - while (inmask) { - int i = ffs(inmask) - 1; - int ix = (i & 3) * 4; - int iy = (i >> 2) * 4; - int px = x + ix; - int py = y + iy; - - inmask &= ~(1 << i); - - block_full_4(task, tri, px, py); - } -} - - -void -lp_rast_triangle_3_4(struct lp_rasterizer_task *task, - const union lp_rast_cmd_arg arg) -{ - const struct lp_rast_triangle *tri = arg.triangle.tri; - const struct lp_rast_plane *plane = tri->plane; - unsigned mask = arg.triangle.plane_mask; - const int x = task->x + (mask & 0xff); - const int y = task->y + (mask >> 8); - unsigned j; - - /* Iterate over partials: - */ - { - unsigned mask = 0xffff; - - for (j = 0; j < 3; j++) { - const int cx = (plane[j].c - - plane[j].dcdx * x - + plane[j].dcdy * y); - - const int dcdx = -plane[j].dcdx; - const int dcdy = plane[j].dcdy; - __m128i xdcdy = _mm_set1_epi32(dcdy); - - __m128i cstep0 = _mm_setr_epi32(cx, cx + dcdx, cx + dcdx*2, cx + dcdx*3); - __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy); - __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy); - __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy); - - __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1); - __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3); - __m128i result = _mm_packs_epi16(cstep01, cstep23); - - /* Extract the sign bits - */ - mask &= ~_mm_movemask_epi8(result); - } - - if (mask) - lp_rast_shade_quads_mask(task, &tri->inputs, x, y, mask); - } -} - - #endif @@ -383,10 +254,13 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, #define TAG(x) x##_3 #define NR_PLANES 3 +#define TRI_4 lp_rast_triangle_3_4 +#define TRI_16 lp_rast_triangle_3_16 #include "lp_rast_tri_tmp.h" #define TAG(x) x##_4 #define NR_PLANES 4 +#define TRI_16 lp_rast_triangle_4_16 #include "lp_rast_tri_tmp.h" #define TAG(x) x##_5 diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 9830a43ba5..c8f9956fda 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -245,6 +245,133 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, } } +#if defined(PIPE_ARCH_SSE) && defined(TRI_16) +/* XXX: special case this when intersection is not required. + * - tile completely within bbox, + * - bbox completely within tile. + */ +void +TRI_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + const struct lp_rast_triangle *tri = arg.triangle.tri; + const struct lp_rast_plane *plane = tri->plane; + unsigned mask = arg.triangle.plane_mask; + unsigned outmask, partial_mask; + unsigned j; + __m128i cstep4[NR_PLANES][4]; + + int x = (mask & 0xff); + int y = (mask >> 8); + + outmask = 0; /* outside one or more trivial reject planes */ + + x += task->x; + y += task->y; + + for (j = 0; j < NR_PLANES; j++) { + const int dcdx = -plane[j].dcdx * 4; + const int dcdy = plane[j].dcdy * 4; + __m128i xdcdy = _mm_set1_epi32(dcdy); + + cstep4[j][0] = _mm_setr_epi32(0, dcdx, dcdx*2, dcdx*3); + cstep4[j][1] = _mm_add_epi32(cstep4[j][0], xdcdy); + cstep4[j][2] = _mm_add_epi32(cstep4[j][1], xdcdy); + cstep4[j][3] = _mm_add_epi32(cstep4[j][2], xdcdy); + + { + const int c = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x; + const int cox = plane[j].eo * 4; + + outmask |= sign_bits4(cstep4[j], c + cox); + } + } + + if (outmask == 0xffff) + return; + + + /* Mask of sub-blocks which are inside all trivial reject planes, + * but outside at least one trivial accept plane: + */ + partial_mask = 0xffff & ~outmask; + + /* Iterate over partials: + */ + while (partial_mask) { + int i = ffs(partial_mask) - 1; + int ix = (i & 3) * 4; + int iy = (i >> 2) * 4; + int px = x + ix; + int py = y + iy; + unsigned mask = 0xffff; + + partial_mask &= ~(1 << i); + + for (j = 0; j < NR_PLANES; j++) { + const int cx = (plane[j].c + - plane[j].dcdx * px + + plane[j].dcdy * py) * 4; + + mask &= ~sign_bits4(cstep4[j], cx); + } + + if (mask) + lp_rast_shade_quads_mask(task, &tri->inputs, px, py, mask); + } +} +#endif + +#if defined(PIPE_ARCH_SSE) && defined(TRI_4) +void +TRI_4(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + const struct lp_rast_triangle *tri = arg.triangle.tri; + const struct lp_rast_plane *plane = tri->plane; + unsigned mask = arg.triangle.plane_mask; + const int x = task->x + (mask & 0xff); + const int y = task->y + (mask >> 8); + unsigned j; + + /* Iterate over partials: + */ + { + unsigned mask = 0xffff; + + for (j = 0; j < NR_PLANES; j++) { + const int cx = (plane[j].c + - plane[j].dcdx * x + + plane[j].dcdy * y); + + const int dcdx = -plane[j].dcdx; + const int dcdy = plane[j].dcdy; + __m128i xdcdy = _mm_set1_epi32(dcdy); + + __m128i cstep0 = _mm_setr_epi32(cx, cx + dcdx, cx + dcdx*2, cx + dcdx*3); + __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy); + __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy); + __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy); + + __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1); + __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3); + __m128i result = _mm_packs_epi16(cstep01, cstep23); + + /* Extract the sign bits + */ + mask &= ~_mm_movemask_epi8(result); + } + + if (mask) + lp_rast_shade_quads_mask(task, &tri->inputs, x, y, mask); + } +} +#endif + + + #undef TAG +#undef TRI_4 +#undef TRI_16 #undef NR_PLANES diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 9f871011d8..8fd034666c 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -479,15 +479,14 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, { int ix0 = bbox->x0 / TILE_SIZE; int iy0 = bbox->y0 / TILE_SIZE; + int px = bbox->x0 & 63 & ~3; + int py = bbox->y0 & 63 & ~3; + int mask = px | (py << 8); assert(iy0 == bbox->y1 / TILE_SIZE && ix0 == bbox->x1 / TILE_SIZE); if (nr_planes == 3) { - int px = bbox->x0 & 63 & ~3; - int py = bbox->y0 & 63 & ~3; - int mask = px | (py << 8); - if (sz < 4) { /* Triangle is contained in a single 4x4 stamp: @@ -507,6 +506,12 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, lp_rast_arg_triangle(tri, mask) ); } } + else if (nr_planes == 4 && sz < 16) + { + return lp_scene_bin_command( scene, ix0, iy0, + LP_RAST_OP_TRIANGLE_4_16, + lp_rast_arg_triangle(tri, mask) ); + } /* Triangle is contained in a single tile: -- cgit v1.2.3 From ef3407672ed4c2c6d070384ea763e73b3da2240a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 5 Oct 2010 16:50:22 +0100 Subject: llvmpipe: fix off-by-one in tri_16 --- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index c8f9956fda..2f03229512 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -309,7 +309,7 @@ TRI_16(struct lp_rasterizer_task *task, partial_mask &= ~(1 << i); for (j = 0; j < NR_PLANES; j++) { - const int cx = (plane[j].c + const int cx = (plane[j].c - 1 - plane[j].dcdx * px + plane[j].dcdy * py) * 4; -- cgit v1.2.3 From d5ef59d8b0ce2ea8f0ad983951e696d1679e3eb7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 16:56:45 +0100 Subject: gallivm: Avoid control flow for two-sided stencil test. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 150 +++++++++++----------------- 1 file changed, 58 insertions(+), 92 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 7561899a74..7eabe0508d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -128,57 +128,32 @@ lp_build_stencil_test_single(struct lp_build_context *bld, /** * Do the one or two-sided stencil test comparison. * \sa lp_build_stencil_test_single - * \param face an integer indicating front (+) or back (-) facing polygon. - * If NULL, assume front-facing. + * \param front_facing an integer vector mask, indicating front (~0) or back + * (0) facing polygon. If NULL, assume front-facing. */ static LLVMValueRef lp_build_stencil_test(struct lp_build_context *bld, const struct pipe_stencil_state stencil[2], LLVMValueRef stencilRefs[2], LLVMValueRef stencilVals, - LLVMValueRef face) + LLVMValueRef front_facing) { LLVMValueRef res; assert(stencil[0].enabled); - if (stencil[1].enabled && face) { - /* do two-sided test */ - struct lp_build_flow_context *flow_ctx; - struct lp_build_if_state if_ctx; - LLVMValueRef front_facing; - LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0); - LLVMValueRef result = bld->undef; + /* do front face test */ + res = lp_build_stencil_test_single(bld, &stencil[0], + stencilRefs[0], stencilVals); - flow_ctx = lp_build_flow_create(bld->builder); - lp_build_flow_scope_begin(flow_ctx); + if (stencil[1].enabled && front_facing) { + /* do back face test */ + LLVMValueRef back_res; - lp_build_flow_scope_declare(flow_ctx, &result); + back_res = lp_build_stencil_test_single(bld, &stencil[1], + stencilRefs[1], stencilVals); - /* front_facing = face > 0.0 */ - front_facing = LLVMBuildFCmp(bld->builder, LLVMRealUGT, face, zero, ""); - - lp_build_if(&if_ctx, flow_ctx, bld->builder, front_facing); - { - result = lp_build_stencil_test_single(bld, &stencil[0], - stencilRefs[0], stencilVals); - } - lp_build_else(&if_ctx); - { - result = lp_build_stencil_test_single(bld, &stencil[1], - stencilRefs[1], stencilVals); - } - lp_build_endif(&if_ctx); - - lp_build_flow_scope_end(flow_ctx); - lp_build_flow_destroy(flow_ctx); - - res = result; - } - else { - /* do single-side test */ - res = lp_build_stencil_test_single(bld, &stencil[0], - stencilRefs[0], stencilVals); + res = lp_build_select(bld, front_facing, res, back_res); } return res; @@ -195,14 +170,12 @@ lp_build_stencil_op_single(struct lp_build_context *bld, const struct pipe_stencil_state *stencil, enum stencil_op op, LLVMValueRef stencilRef, - LLVMValueRef stencilVals, - LLVMValueRef mask) + LLVMValueRef stencilVals) { - const unsigned stencilMax = 255; /* XXX fix */ struct lp_type type = bld->type; LLVMValueRef res; - LLVMValueRef max = lp_build_const_int_vec(type, stencilMax); + LLVMValueRef max = lp_build_const_int_vec(type, 0xff); unsigned stencil_op; assert(type.sign); @@ -255,19 +228,7 @@ lp_build_stencil_op_single(struct lp_build_context *bld, break; default: assert(0 && "bad stencil op mode"); - res = NULL; - } - - if (stencil->writemask != stencilMax) { - /* mask &= stencil->writemask */ - LLVMValueRef writemask = lp_build_const_int_vec(type, stencil->writemask); - mask = LLVMBuildAnd(bld->builder, mask, writemask, ""); - /* res = (res & mask) | (stencilVals & ~mask) */ - res = lp_build_select_bitwise(bld, writemask, res, stencilVals); - } - else { - /* res = mask ? res : stencilVals */ - res = lp_build_select(bld, mask, res, stencilVals); + res = bld->undef; } return res; @@ -284,49 +245,40 @@ lp_build_stencil_op(struct lp_build_context *bld, LLVMValueRef stencilRefs[2], LLVMValueRef stencilVals, LLVMValueRef mask, - LLVMValueRef face) + LLVMValueRef front_facing) { - assert(stencil[0].enabled); + LLVMValueRef res; - if (stencil[1].enabled && face) { - /* do two-sided op */ - struct lp_build_flow_context *flow_ctx; - struct lp_build_if_state if_ctx; - LLVMValueRef front_facing; - LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0); - LLVMValueRef result = bld->undef; + assert(stencil[0].enabled); - flow_ctx = lp_build_flow_create(bld->builder); - lp_build_flow_scope_begin(flow_ctx); + /* do front face op */ + res = lp_build_stencil_op_single(bld, &stencil[0], op, + stencilRefs[0], stencilVals); - lp_build_flow_scope_declare(flow_ctx, &result); + if (stencil[1].enabled && front_facing) { + /* do back face op */ + LLVMValueRef back_res; - /* front_facing = face > 0.0 */ - front_facing = LLVMBuildFCmp(bld->builder, LLVMRealUGT, face, zero, ""); + back_res = lp_build_stencil_op_single(bld, &stencil[1], op, + stencilRefs[1], stencilVals); - lp_build_if(&if_ctx, flow_ctx, bld->builder, front_facing); - { - result = lp_build_stencil_op_single(bld, &stencil[0], op, - stencilRefs[0], stencilVals, mask); - } - lp_build_else(&if_ctx); - { - result = lp_build_stencil_op_single(bld, &stencil[1], op, - stencilRefs[1], stencilVals, mask); - } - lp_build_endif(&if_ctx); - - lp_build_flow_scope_end(flow_ctx); - lp_build_flow_destroy(flow_ctx); + res = lp_build_select(bld, front_facing, res, back_res); + } - return result; + if (stencil->writemask != 0xff) { + /* mask &= stencil->writemask */ + LLVMValueRef writemask = lp_build_const_int_vec(bld->type, stencil->writemask); + mask = LLVMBuildAnd(bld->builder, mask, writemask, ""); + /* res = (res & mask) | (stencilVals & ~mask) */ + res = lp_build_select_bitwise(bld, writemask, res, stencilVals); } else { - /* do single-sided op */ - return lp_build_stencil_op_single(bld, &stencil[0], op, - stencilRefs[0], stencilVals, mask); + /* res = mask ? res : stencilVals */ + res = lp_build_select(bld, mask, res, stencilVals); } + + return res; } @@ -519,6 +471,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef z_bitmask = NULL, stencil_shift = NULL; LLVMValueRef z_pass = NULL, s_pass_mask = NULL; LLVMValueRef orig_mask = mask->value; + LLVMValueRef front_facing = NULL; /* Sanity checking */ { @@ -616,21 +569,34 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } } - if (stencil[0].enabled) { + + if (face) { + LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0); + + /* front_facing = face > 0.0 ? ~0 : 0 */ + front_facing = LLVMBuildFCmp(builder, LLVMRealUGT, face, zero, ""); + front_facing = LLVMBuildSExt(builder, front_facing, + LLVMIntType(bld.type.length*bld.type.width), + ""); + front_facing = LLVMBuildBitCast(builder, front_facing, + bld.int_vec_type, ""); + } + /* convert scalar stencil refs into vectors */ stencil_refs[0] = lp_build_broadcast_scalar(&bld, stencil_refs[0]); stencil_refs[1] = lp_build_broadcast_scalar(&bld, stencil_refs[1]); s_pass_mask = lp_build_stencil_test(&sbld, stencil, - stencil_refs, stencil_vals, face); + stencil_refs, stencil_vals, + front_facing); /* apply stencil-fail operator */ { LLVMValueRef s_fail_mask = lp_build_andnot(&bld, orig_mask, s_pass_mask); stencil_vals = lp_build_stencil_op(&sbld, stencil, S_FAIL_OP, stencil_refs, stencil_vals, - s_fail_mask, face); + s_fail_mask, front_facing); } } @@ -676,13 +642,13 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, z_fail_mask = lp_build_andnot(&bld, orig_mask, z_pass); stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_FAIL_OP, stencil_refs, stencil_vals, - z_fail_mask, face); + z_fail_mask, front_facing); /* apply Z-pass operator */ z_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, z_pass, ""); stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP, stencil_refs, stencil_vals, - z_pass_mask, face); + z_pass_mask, front_facing); } } else { @@ -692,7 +658,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, s_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, s_pass_mask, ""); stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP, stencil_refs, stencil_vals, - s_pass_mask, face); + s_pass_mask, front_facing); } /* The Z bits are already in the right place but we may need to shift the -- cgit v1.2.3 From 6b0c79e058d4d008cad32c0ff06de9757ccd6fa0 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 17:37:18 +0100 Subject: gallivm: Warn when doing inefficient integer comparisons. --- src/gallium/auxiliary/gallivm/lp_bld_logic.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c index d5c62a3f73..ce5d0214b4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c @@ -92,9 +92,23 @@ lp_build_compare(LLVMBuilderRef builder, if(func == PIPE_FUNC_ALWAYS) return ones; - /* TODO: optimize the constant case */ +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + /* + * There are no unsigned integer comparison instructions in SSE. + */ - /* XXX: It is not clear if we should use the ordered or unordered operators */ + if (!type.floating && !type.sign && + type.width * type.length == 128 && + util_cpu_caps.has_sse2 && + (func == PIPE_FUNC_LESS || + func == PIPE_FUNC_LEQUAL || + func == PIPE_FUNC_GREATER || + func == PIPE_FUNC_GEQUAL) && + (gallivm_debug & GALLIVM_DEBUG_PERF)) { + debug_printf("%s: inefficient <%u x i%u> unsigned comparison\n", + __FUNCTION__, type.length, type.width); + } +#endif #if HAVE_LLVM < 0x0207 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) @@ -225,6 +239,8 @@ lp_build_compare(LLVMBuilderRef builder, #endif #endif /* HAVE_LLVM < 0x0207 */ + /* XXX: It is not clear if we should use the ordered or unordered operators */ + if(type.floating) { LLVMRealPredicate op; switch(func) { -- cgit v1.2.3 From f5b5fb32d3a9eb8667f91907bcf065fe8bd4988d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 18:24:54 +0100 Subject: gallivm: Move into the as much of the second level code as possible. Also, pass more stuff trhough the sample build context, instead of arguments. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 34 ++--- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 29 ++-- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 114 ++++++---------- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h | 9 -- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 153 ++++++++-------------- 5 files changed, 120 insertions(+), 219 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index f23ede3319..f01a878777 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -190,7 +190,7 @@ lp_build_rho(struct lp_build_sample_context *bld, { 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); + const unsigned dims = bld->dims; LLVMTypeRef i32t = LLVMInt32Type(); LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0); LLVMValueRef index1 = LLVMConstInt(i32t, 1, 0); @@ -355,9 +355,6 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, const LLVMValueRef ddy[4], LLVMValueRef lod_bias, /* optional */ LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef width, - LLVMValueRef height, - LLVMValueRef depth, unsigned mip_filter, LLVMValueRef *out_lod_ipart, LLVMValueRef *out_lod_fpart) @@ -561,12 +558,12 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, */ LLVMValueRef lp_build_get_mipmap_level(struct lp_build_sample_context *bld, - LLVMValueRef data_array, LLVMValueRef level) + LLVMValueRef level) { LLVMValueRef indexes[2], data_ptr; indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0); indexes[1] = level; - data_ptr = LLVMBuildGEP(bld->builder, data_array, indexes, 2, ""); + data_ptr = LLVMBuildGEP(bld->builder, bld->data_array, indexes, 2, ""); data_ptr = LLVMBuildLoad(bld->builder, data_ptr, ""); return data_ptr; } @@ -574,10 +571,10 @@ lp_build_get_mipmap_level(struct lp_build_sample_context *bld, LLVMValueRef lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld, - LLVMValueRef data_array, int level) + int level) { LLVMValueRef lvl = LLVMConstInt(LLVMInt32Type(), level, 0); - return lp_build_get_mipmap_level(bld, data_array, lvl); + return lp_build_get_mipmap_level(bld, lvl); } @@ -628,19 +625,14 @@ lp_build_get_level_stride_vec(struct lp_build_sample_context *bld, */ void lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, - unsigned dims, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, LLVMValueRef ilevel, - LLVMValueRef row_stride_array, - LLVMValueRef img_stride_array, LLVMValueRef *out_width_vec, LLVMValueRef *out_height_vec, LLVMValueRef *out_depth_vec, LLVMValueRef *row_stride_vec, LLVMValueRef *img_stride_vec) { + const unsigned dims = bld->dims; LLVMValueRef ilevel_vec; ilevel_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel); @@ -648,18 +640,18 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, /* * Compute width, height, depth at mipmap level 'ilevel' */ - *out_width_vec = lp_build_minify(bld, width_vec, ilevel_vec); + *out_width_vec = lp_build_minify(bld, bld->width_vec, ilevel_vec); if (dims >= 2) { - *out_height_vec = lp_build_minify(bld, height_vec, ilevel_vec); + *out_height_vec = lp_build_minify(bld, bld->height_vec, ilevel_vec); *row_stride_vec = lp_build_get_level_stride_vec(bld, - row_stride_array, - ilevel); + bld->row_stride_array, + ilevel); if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) { *img_stride_vec = lp_build_get_level_stride_vec(bld, - img_stride_array, - ilevel); + bld->img_stride_array, + ilevel); if (dims == 3) { - *out_depth_vec = lp_build_minify(bld, depth_vec, ilevel_vec); + *out_depth_vec = lp_build_minify(bld, bld->depth_vec, ilevel_vec); } } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index e5d7f10778..44c8fc5764 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -179,6 +179,9 @@ struct lp_build_sample_context const struct util_format_description *format_desc; + /* See texture_dims() */ + unsigned dims; + /** regular scalar float type */ struct lp_type float_type; struct lp_build_context float_bld; @@ -214,8 +217,21 @@ struct lp_build_sample_context struct lp_type texel_type; struct lp_build_context texel_bld; + /* Common dynamic state values */ + LLVMValueRef width; + LLVMValueRef height; + LLVMValueRef depth; + LLVMValueRef row_stride_array; + LLVMValueRef img_stride_array; + LLVMValueRef data_array; + /** Unsigned vector with texture width, height, depth */ LLVMValueRef uint_size; + + /* width, height, depth as uint vectors */ + LLVMValueRef width_vec; + LLVMValueRef height_vec; + LLVMValueRef depth_vec; }; @@ -292,9 +308,6 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, const LLVMValueRef ddy[4], LLVMValueRef lod_bias, /* optional */ LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef width, - LLVMValueRef height, - LLVMValueRef depth, unsigned mip_filter, LLVMValueRef *out_lod_ipart, LLVMValueRef *out_lod_fpart); @@ -315,22 +328,16 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld, LLVMValueRef lp_build_get_mipmap_level(struct lp_build_sample_context *bld, - LLVMValueRef data_array, LLVMValueRef level); + LLVMValueRef level); LLVMValueRef lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld, - LLVMValueRef data_array, int level); + int level); void lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, - unsigned dims, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, LLVMValueRef ilevel, - LLVMValueRef row_stride_array, - LLVMValueRef img_stride_array, LLVMValueRef *out_width_vec, LLVMValueRef *out_height_vec, LLVMValueRef *out_depth_vec, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 293237c5b1..e7410448c0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -265,7 +265,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, LLVMValueRef *colors_lo, LLVMValueRef *colors_hi) { - const int dims = texture_dims(bld->static_state->target); + const unsigned dims = bld->dims; LLVMBuilderRef builder = bld->builder; struct lp_build_context i32, h16, u8n; LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; @@ -429,7 +429,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef *colors_lo, LLVMValueRef *colors_hi) { - const int dims = texture_dims(bld->static_state->target); + const unsigned dims = bld->dims; LLVMBuilderRef builder = bld->builder; struct lp_build_context i32, h16, u8n; LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; @@ -781,27 +781,34 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, + LLVMValueRef ilevel0, + LLVMValueRef ilevel1, LLVMValueRef lod_fpart, - LLVMValueRef width0_vec, - LLVMValueRef width1_vec, - LLVMValueRef height0_vec, - LLVMValueRef height1_vec, - LLVMValueRef depth0_vec, - LLVMValueRef depth1_vec, - LLVMValueRef row_stride0_vec, - LLVMValueRef row_stride1_vec, - LLVMValueRef img_stride0_vec, - LLVMValueRef img_stride1_vec, - LLVMValueRef data_ptr0, - LLVMValueRef data_ptr1, LLVMValueRef colors_lo_var, LLVMValueRef colors_hi_var) { LLVMBuilderRef builder = bld->builder; + LLVMValueRef width0_vec; + LLVMValueRef width1_vec; + LLVMValueRef height0_vec; + LLVMValueRef height1_vec; + LLVMValueRef depth0_vec; + LLVMValueRef depth1_vec; + LLVMValueRef row_stride0_vec; + LLVMValueRef row_stride1_vec; + LLVMValueRef img_stride0_vec; + LLVMValueRef img_stride1_vec; + LLVMValueRef data_ptr0; + LLVMValueRef data_ptr1; LLVMValueRef colors0_lo, colors0_hi; LLVMValueRef colors1_lo, colors1_hi; + /* sample the first mipmap level */ + lp_build_mipmap_level_sizes(bld, ilevel0, + &width0_vec, &height0_vec, &depth0_vec, + &row_stride0_vec, &img_stride0_vec); + data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, width0_vec, height0_vec, depth0_vec, @@ -846,6 +853,10 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16)); /* sample the second mipmap level */ + lp_build_mipmap_level_sizes(bld, ilevel1, + &width1_vec, &height1_vec, &depth1_vec, + &row_stride1_vec, &img_stride1_vec); + data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, width1_vec, height1_vec, depth1_vec, @@ -897,15 +908,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, const LLVMValueRef *ddy, LLVMValueRef lod_bias, /* optional */ LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef width, - LLVMValueRef height, - LLVMValueRef depth, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, - LLVMValueRef row_stride_array, - LLVMValueRef img_stride_array, - LLVMValueRef data_array, LLVMValueRef texel_out[4]) { struct lp_build_context *int_bld = &bld->int_bld; @@ -913,18 +915,15 @@ lp_build_sample_aos(struct lp_build_sample_context *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); + const unsigned dims = bld->dims; 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; - LLVMValueRef row_stride0_vec = NULL, row_stride1_vec = NULL; - LLVMValueRef img_stride0_vec = NULL, img_stride1_vec = NULL; - LLVMValueRef data_ptr0, data_ptr1 = NULL; LLVMValueRef packed, packed_lo, packed_hi; LLVMValueRef unswizzled[4]; LLVMValueRef face_ddx[4], face_ddy[4]; struct lp_build_context h16_bld; + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef i32t_zero = LLVMConstInt(i32t, 0, 0); /* we only support the common/simple wrap modes at this time */ assert(lp_is_simple_wrap_mode(bld->static_state->wrap_s)); @@ -969,11 +968,10 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, */ 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); + lod_ipart = i32t_zero; } /* @@ -994,7 +992,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); } else { - ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0); + ilevel0 = i32t_zero; } break; case PIPE_TEX_MIPFILTER_NEAREST: @@ -1010,28 +1008,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, break; } - /* compute image size(s) of source mipmap level(s) */ - lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, - ilevel0, - row_stride_array, img_stride_array, - &width0_vec, &height0_vec, &depth0_vec, - &row_stride0_vec, &img_stride0_vec); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, - ilevel1, - row_stride_array, img_stride_array, - &width1_vec, &height1_vec, &depth1_vec, - &row_stride1_vec, &img_stride1_vec); - } - - /* - * Get pointer(s) to image data for mipmap level(s). - */ - data_ptr0 = lp_build_get_mipmap_level(bld, data_array, ilevel0); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - data_ptr1 = lp_build_get_mipmap_level(bld, data_array, ilevel1); - } - /* * Get/interpolate texture colors. */ @@ -1043,13 +1019,8 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* no need to distinquish between minification and magnification */ lp_build_sample_mipmap(bld, min_filter, mip_filter, - s, t, r, lod_fpart, - width0_vec, width1_vec, - height0_vec, height1_vec, - depth0_vec, depth1_vec, - row_stride0_vec, row_stride1_vec, - img_stride0_vec, img_stride1_vec, - data_ptr0, data_ptr1, + s, t, r, + ilevel0, ilevel1, lod_fpart, packed_lo, packed_hi); } else { @@ -1069,14 +1040,10 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, lp_build_if(&if_ctx, flow_ctx, builder, minify); { /* Use the minification filter */ - lp_build_sample_mipmap(bld, min_filter, mip_filter, - s, t, r, lod_fpart, - width0_vec, width1_vec, - height0_vec, height1_vec, - depth0_vec, depth1_vec, - row_stride0_vec, row_stride1_vec, - img_stride0_vec, img_stride1_vec, - data_ptr0, data_ptr1, + lp_build_sample_mipmap(bld, + min_filter, mip_filter, + s, t, r, + ilevel0, ilevel1, lod_fpart, packed_lo, packed_hi); } lp_build_else(&if_ctx); @@ -1084,13 +1051,8 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* Use the magnification filter */ lp_build_sample_mipmap(bld, mag_filter, PIPE_TEX_MIPFILTER_NONE, - s, t, r, NULL, - width_vec, NULL, - height_vec, NULL, - depth_vec, NULL, - row_stride0_vec, NULL, - img_stride0_vec, NULL, - data_ptr0, NULL, + s, t, r, + i32t_zero, NULL, NULL, packed_lo, packed_hi); } lp_build_endif(&if_ctx); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h index e1045bbbc2..5d9ecac4d5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.h @@ -50,15 +50,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, const LLVMValueRef *ddy, LLVMValueRef lod_bias, /* optional */ LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef width, - LLVMValueRef height, - LLVMValueRef depth, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, - LLVMValueRef row_stride_array, - LLVMValueRef img_stride_array, - LLVMValueRef data_array, LLVMValueRef texel_out[4]); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 886df7c29c..158c6e6a79 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -82,7 +82,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, LLVMValueRef texel_out[4]) { const struct lp_sampler_static_state *static_state = bld->static_state; - const int dims = texture_dims(static_state->target); + const unsigned dims = bld->dims; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; LLVMValueRef offset; LLVMValueRef i, j; @@ -565,7 +565,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, LLVMValueRef r, LLVMValueRef colors_out[4]) { - const int dims = texture_dims(bld->static_state->target); + const unsigned dims = bld->dims; LLVMValueRef x, y, z; /* @@ -628,7 +628,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef r, LLVMValueRef colors_out[4]) { - const int dims = texture_dims(bld->static_state->target); + const unsigned dims = bld->dims; LLVMValueRef x0, y0, z0, x1, y1, z1; LLVMValueRef s_fpart, t_fpart, r_fpart; LLVMValueRef neighbors[2][2][4]; @@ -790,26 +790,32 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, + LLVMValueRef ilevel0, + LLVMValueRef ilevel1, LLVMValueRef lod_fpart, - LLVMValueRef width0_vec, - LLVMValueRef width1_vec, - LLVMValueRef height0_vec, - LLVMValueRef height1_vec, - LLVMValueRef depth0_vec, - LLVMValueRef depth1_vec, - LLVMValueRef row_stride0_vec, - LLVMValueRef row_stride1_vec, - LLVMValueRef img_stride0_vec, - LLVMValueRef img_stride1_vec, - LLVMValueRef data_ptr0, - LLVMValueRef data_ptr1, LLVMValueRef *colors_out) { LLVMBuilderRef builder = bld->builder; + LLVMValueRef width0_vec; + LLVMValueRef width1_vec; + LLVMValueRef height0_vec; + LLVMValueRef height1_vec; + LLVMValueRef depth0_vec; + LLVMValueRef depth1_vec; + LLVMValueRef row_stride0_vec; + LLVMValueRef row_stride1_vec; + LLVMValueRef img_stride0_vec; + LLVMValueRef img_stride1_vec; + LLVMValueRef data_ptr0; + LLVMValueRef data_ptr1; LLVMValueRef colors0[4], colors1[4]; unsigned chan; /* sample the first mipmap level */ + lp_build_mipmap_level_sizes(bld, ilevel0, + &width0_vec, &height0_vec, &depth0_vec, + &row_stride0_vec, &img_stride0_vec); + data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, unit, width0_vec, height0_vec, depth0_vec, @@ -847,6 +853,10 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, lp_build_if(&if_ctx, flow_ctx, builder, need_lerp); { /* sample the second mipmap level */ + lp_build_mipmap_level_sizes(bld, ilevel1, + &width1_vec, &height1_vec, &depth1_vec, + &row_stride1_vec, &img_stride1_vec); + data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, unit, width1_vec, height1_vec, depth1_vec, @@ -895,15 +905,6 @@ lp_build_sample_general(struct lp_build_sample_context *bld, const LLVMValueRef *ddy, LLVMValueRef lod_bias, /* optional */ LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef width, - LLVMValueRef height, - LLVMValueRef depth, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, - LLVMValueRef row_stride_array, - LLVMValueRef img_stride_array, - LLVMValueRef data_array, LLVMValueRef *colors_out) { struct lp_build_context *int_bld = &bld->int_bld; @@ -911,16 +912,12 @@ lp_build_sample_general(struct lp_build_sample_context *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_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; - LLVMValueRef row_stride0_vec = NULL, row_stride1_vec = NULL; - LLVMValueRef img_stride0_vec = NULL, img_stride1_vec = NULL; - LLVMValueRef data_ptr0, data_ptr1 = NULL; LLVMValueRef face_ddx[4], face_ddy[4]; LLVMValueRef texels[4]; + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef i32t_zero = LLVMConstInt(i32t, 0, 0); unsigned chan; /* @@ -962,11 +959,10 @@ lp_build_sample_general(struct lp_build_sample_context *bld, */ 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); + lod_ipart = i32t_zero; } /* @@ -987,7 +983,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld, lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0); } else { - ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0); + ilevel0 = i32t_zero; } break; case PIPE_TEX_MIPFILTER_NEAREST: @@ -1003,28 +999,6 @@ lp_build_sample_general(struct lp_build_sample_context *bld, break; } - /* compute image size(s) of source mipmap level(s) */ - lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, - ilevel0, - row_stride_array, img_stride_array, - &width0_vec, &height0_vec, &depth0_vec, - &row_stride0_vec, &img_stride0_vec); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec, - ilevel1, - row_stride_array, img_stride_array, - &width1_vec, &height1_vec, &depth1_vec, - &row_stride1_vec, &img_stride1_vec); - } - - /* - * Get pointer(s) to image data for mipmap level(s). - */ - data_ptr0 = lp_build_get_mipmap_level(bld, data_array, ilevel0); - if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - data_ptr1 = lp_build_get_mipmap_level(bld, data_array, ilevel1); - } - /* * Get/interpolate texture colors. */ @@ -1038,13 +1012,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* no need to distinquish between minification and magnification */ 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, - row_stride0_vec, row_stride1_vec, - img_stride0_vec, img_stride1_vec, - data_ptr0, data_ptr1, + s, t, r, + ilevel0, ilevel1, lod_fpart, texels); } else { @@ -1066,13 +1035,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* Use the minification filter */ 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, - row_stride0_vec, row_stride1_vec, - img_stride0_vec, img_stride1_vec, - data_ptr0, data_ptr1, + s, t, r, + ilevel0, ilevel1, lod_fpart, texels); } lp_build_else(&if_ctx); @@ -1080,13 +1044,8 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* Use the magnification filter */ lp_build_sample_mipmap(bld, unit, mag_filter, PIPE_TEX_MIPFILTER_NONE, - s, t, r, NULL, - width_vec, NULL, - height_vec, NULL, - depth_vec, NULL, - row_stride0_vec, NULL, - img_stride0_vec, NULL, - data_ptr0, NULL, + s, t, r, + i32t_zero, NULL, NULL, texels); } lp_build_endif(&if_ctx); @@ -1183,11 +1142,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, 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; - LLVMValueRef row_stride_array, img_stride_array; - LLVMValueRef data_array; + LLVMValueRef s; LLVMValueRef t; LLVMValueRef r; @@ -1206,6 +1161,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, bld.static_state = static_state; bld.dynamic_state = dynamic_state; bld.format_desc = util_format_description(static_state->format); + bld.dims = dims; bld.float_type = lp_type_float(32); bld.int_type = lp_type_int(32); @@ -1230,12 +1186,12 @@ lp_build_sample_soa(LLVMBuilderRef builder, lp_build_context_init(&bld.texel_bld, builder, bld.texel_type); /* Get the dynamic state */ - width = dynamic_state->width(dynamic_state, builder, unit); - height = dynamic_state->height(dynamic_state, builder, unit); - depth = dynamic_state->depth(dynamic_state, builder, unit); - row_stride_array = dynamic_state->row_stride(dynamic_state, builder, unit); - img_stride_array = dynamic_state->img_stride(dynamic_state, builder, unit); - data_array = dynamic_state->data_ptr(dynamic_state, builder, unit); + bld.width = dynamic_state->width(dynamic_state, builder, unit); + bld.height = dynamic_state->height(dynamic_state, builder, unit); + bld.depth = dynamic_state->depth(dynamic_state, builder, unit); + bld.row_stride_array = dynamic_state->row_stride(dynamic_state, builder, unit); + bld.img_stride_array = dynamic_state->img_stride(dynamic_state, builder, unit); + bld.data_array = dynamic_state->data_ptr(dynamic_state, builder, unit); /* Note that data_array is an array[level] of pointers to texture images */ s = coords[0]; @@ -1244,25 +1200,25 @@ lp_build_sample_soa(LLVMBuilderRef builder, /* width, height, depth as single uint vector */ if (dims <= 1) { - bld.uint_size = width; + bld.uint_size = bld.width; } else { bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size_bld.undef, - width, LLVMConstInt(i32t, 0, 0), ""); + bld.width, LLVMConstInt(i32t, 0, 0), ""); if (dims >= 2) { bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size, - height, LLVMConstInt(i32t, 1, 0), ""); + bld.height, LLVMConstInt(i32t, 1, 0), ""); if (dims >= 3) { bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size, - depth, LLVMConstInt(i32t, 2, 0), ""); + bld.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); - depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, depth); + bld.width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, bld.width); + bld.height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, bld.height); + bld.depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, bld.depth); if (0) { /* For debug: no-op texture sampling */ @@ -1274,10 +1230,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, /* do sampling/filtering with fixed pt arithmetic */ lp_build_sample_aos(&bld, unit, s, t, r, ddx, ddy, lod_bias, explicit_lod, - width, height, depth, - width_vec, height_vec, depth_vec, - row_stride_array, img_stride_array, - data_array, texel_out); + texel_out); } else { @@ -1295,10 +1248,6 @@ lp_build_sample_soa(LLVMBuilderRef builder, lp_build_sample_general(&bld, unit, s, t, r, ddx, ddy, lod_bias, explicit_lod, - width, height, depth, - width_vec, height_vec, depth_vec, - row_stride_array, img_stride_array, - data_array, texel_out); } -- cgit v1.2.3 From 438390418d27838bcfcb5bbb4c486db45dbaa44d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 19:11:32 +0100 Subject: llvmpipe: First minify the texture size, then broadcast. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 36 ++++++++++++++++++----- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 13 +++----- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 25 +++++++--------- 3 files changed, 42 insertions(+), 32 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index f01a878777..6a684a9a0b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -235,7 +235,7 @@ lp_build_rho(struct lp_build_sample_context *bld, 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); + float_size = lp_build_int_to_float(float_size_bld, bld->int_size); rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size); @@ -583,18 +583,22 @@ lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld, * Return max(1, base_size >> level); */ static LLVMValueRef -lp_build_minify(struct lp_build_sample_context *bld, +lp_build_minify(struct lp_build_context *bld, LLVMValueRef base_size, LLVMValueRef level) { - if (level == bld->int_coord_bld.zero) { + assert(lp_check_value(bld->type, base_size)); + assert(lp_check_value(bld->type, level)); + + if (level == 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); + assert(bld->type.sign); + size = lp_build_max(bld, size, bld->one); return size; } } @@ -634,15 +638,29 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, { const unsigned dims = bld->dims; LLVMValueRef ilevel_vec; + LLVMValueRef size_vec; + LLVMValueRef width, height, depth; + LLVMTypeRef i32t = LLVMInt32Type(); - ilevel_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel); + ilevel_vec = lp_build_broadcast_scalar(&bld->int_size_bld, ilevel); /* * Compute width, height, depth at mipmap level 'ilevel' */ - *out_width_vec = lp_build_minify(bld, bld->width_vec, ilevel_vec); + size_vec = lp_build_minify(&bld->int_size_bld, bld->int_size, ilevel_vec); + + if (dims <= 1) { + width = size_vec; + } + else { + width = LLVMBuildExtractElement(bld->builder, size_vec, + LLVMConstInt(i32t, 0, 0), ""); + } + *out_width_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, width); if (dims >= 2) { - *out_height_vec = lp_build_minify(bld, bld->height_vec, ilevel_vec); + height = LLVMBuildExtractElement(bld->builder, size_vec, + LLVMConstInt(i32t, 1, 0), ""); + *out_height_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, height); *row_stride_vec = lp_build_get_level_stride_vec(bld, bld->row_stride_array, ilevel); @@ -651,7 +669,9 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, bld->img_stride_array, ilevel); if (dims == 3) { - *out_depth_vec = lp_build_minify(bld, bld->depth_vec, ilevel_vec); + depth = LLVMBuildExtractElement(bld->builder, size_vec, + LLVMConstInt(i32t, 2, 0), ""); + *out_depth_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, depth); } } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 44c8fc5764..d1a1aa143d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -206,8 +206,8 @@ struct lp_build_sample_context struct lp_build_context int_coord_bld; /** Unsigned integer texture size */ - struct lp_type uint_size_type; - struct lp_build_context uint_size_bld; + struct lp_type int_size_type; + struct lp_build_context int_size_bld; /** Unsigned integer texture size */ struct lp_type float_size_type; @@ -225,13 +225,8 @@ struct lp_build_sample_context LLVMValueRef img_stride_array; LLVMValueRef data_array; - /** Unsigned vector with texture width, height, depth */ - LLVMValueRef uint_size; - - /* width, height, depth as uint vectors */ - LLVMValueRef width_vec; - LLVMValueRef height_vec; - LLVMValueRef depth_vec; + /** Integer vector with texture width, height, depth */ + LLVMValueRef int_size; }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 158c6e6a79..b8cf938acf 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1170,7 +1170,7 @@ lp_build_sample_soa(LLVMBuilderRef builder, 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.int_size_type = lp_int_type(bld.float_size_type); bld.texel_type = type; float_vec_type = lp_type_float_vec(32); @@ -1181,7 +1181,7 @@ 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.int_size_bld, builder, bld.int_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); @@ -1198,28 +1198,23 @@ lp_build_sample_soa(LLVMBuilderRef builder, t = coords[1]; r = coords[2]; - /* width, height, depth as single uint vector */ + /* width, height, depth as single int vector */ if (dims <= 1) { - bld.uint_size = bld.width; + bld.int_size = bld.width; } else { - bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size_bld.undef, - bld.width, LLVMConstInt(i32t, 0, 0), ""); + bld.int_size = LLVMBuildInsertElement(builder, bld.int_size_bld.undef, + bld.width, LLVMConstInt(i32t, 0, 0), ""); if (dims >= 2) { - bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size, - bld.height, LLVMConstInt(i32t, 1, 0), ""); + bld.int_size = LLVMBuildInsertElement(builder, bld.int_size, + bld.height, LLVMConstInt(i32t, 1, 0), ""); if (dims >= 3) { - bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size, - bld.depth, LLVMConstInt(i32t, 2, 0), ""); + bld.int_size = LLVMBuildInsertElement(builder, bld.int_size, + bld.depth, LLVMConstInt(i32t, 2, 0), ""); } } } - /* width, height, depth as uint vectors */ - bld.width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, bld.width); - bld.height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, bld.height); - bld.depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, bld.depth); - if (0) { /* For debug: no-op texture sampling */ lp_build_sample_nop(bld.texel_type, texel_out); -- cgit v1.2.3 From 3fde8167a5d9c1e845053ae4e6a9cd49628adc71 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 Oct 2010 19:48:16 +0100 Subject: gallivm: Help for combined extraction and broadcasting. Doesn't change generated code quality, but saves some typing. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 32 ++++++----- src/gallium/auxiliary/gallivm/lp_bld_swizzle.c | 77 ++++++++++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_swizzle.h | 8 +++ 3 files changed, 102 insertions(+), 15 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 6a684a9a0b..7a64392d3c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -639,7 +639,6 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, const unsigned dims = bld->dims; LLVMValueRef ilevel_vec; LLVMValueRef size_vec; - LLVMValueRef width, height, depth; LLVMTypeRef i32t = LLVMInt32Type(); ilevel_vec = lp_build_broadcast_scalar(&bld->int_size_bld, ilevel); @@ -649,18 +648,19 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, */ size_vec = lp_build_minify(&bld->int_size_bld, bld->int_size, ilevel_vec); - if (dims <= 1) { - width = size_vec; - } - else { - width = LLVMBuildExtractElement(bld->builder, size_vec, - LLVMConstInt(i32t, 0, 0), ""); - } - *out_width_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, width); + *out_width_vec = lp_build_extract_broadcast(bld->builder, + bld->int_size_type, + bld->int_coord_type, + size_vec, + LLVMConstInt(i32t, 0, 0)); if (dims >= 2) { - height = LLVMBuildExtractElement(bld->builder, size_vec, - LLVMConstInt(i32t, 1, 0), ""); - *out_height_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, height); + + *out_height_vec = lp_build_extract_broadcast(bld->builder, + bld->int_size_type, + bld->int_coord_type, + size_vec, + LLVMConstInt(i32t, 1, 0)); + *row_stride_vec = lp_build_get_level_stride_vec(bld, bld->row_stride_array, ilevel); @@ -669,9 +669,11 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, bld->img_stride_array, ilevel); if (dims == 3) { - depth = LLVMBuildExtractElement(bld->builder, size_vec, - LLVMConstInt(i32t, 2, 0), ""); - *out_depth_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, depth); + *out_depth_vec = lp_build_extract_broadcast(bld->builder, + bld->int_size_type, + bld->int_coord_type, + size_vec, + LLVMConstInt(i32t, 2, 0)); } } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c index 2e9e8386de..4685a90e41 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c @@ -100,6 +100,83 @@ lp_build_broadcast_scalar(struct lp_build_context *bld, } +/** + * Combined extract and broadcast (or a mere shuffle when the two types match) + */ +LLVMValueRef +lp_build_extract_broadcast(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef vector, + LLVMValueRef index) +{ + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef res; + + assert(src_type.floating == dst_type.floating); + assert(src_type.width == dst_type.width); + + assert(lp_check_value(src_type, vector)); + assert(LLVMTypeOf(index) == i32t); + + if (src_type.length == 1) { + if (dst_type.length == 1) { + /* + * Trivial scalar -> scalar. + */ + + res = vector; + } + else { + /* + * Broadcast scalar -> vector. + */ + + res = lp_build_broadcast(builder, + lp_build_vec_type(dst_type), + vector); + } + } + else { + if (dst_type.length == src_type.length) { + /* + * Special shuffle of the same size. + */ + + LLVMValueRef shuffle; + shuffle = lp_build_broadcast(builder, + LLVMVectorType(i32t, dst_type.length), + index); + res = LLVMBuildShuffleVector(builder, vector, + LLVMGetUndef(lp_build_vec_type(dst_type)), + shuffle, ""); + } + else { + LLVMValueRef scalar; + scalar = LLVMBuildExtractElement(builder, vector, index, ""); + if (dst_type.length == 1) { + /* + * Trivial extract scalar from vector. + */ + + res = scalar; + } + else { + /* + * General case of different sized vectors. + */ + + res = lp_build_broadcast(builder, + lp_build_vec_type(dst_type), + vector); + } + } + } + + return res; +} + + /** * Swizzle one channel into all other three channels. */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h index f9b6a5e725..fdea8442ae 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h @@ -55,6 +55,14 @@ lp_build_broadcast_scalar(struct lp_build_context *bld, LLVMValueRef scalar); +LLVMValueRef +lp_build_extract_broadcast(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef vector, + LLVMValueRef index); + + /** * Broadcast one channel of a vector composed of arrays of XYZW structures into * all four channel. -- cgit v1.2.3 From 5e90971475a7057022b63ee032eb4b6adba2d455 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 8 Oct 2010 14:03:10 -0700 Subject: gallivm: Remove unnecessary header. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index b5ed4c2d9b..127b13bc28 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -70,7 +70,6 @@ #include "lp_bld_arit.h" #include "lp_bld_pack.h" #include "lp_bld_conv.h" -#include "lp_bld_intr.h" /** -- cgit v1.2.3 From 131485efae3e919c2ba619eb087931f402c219f1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 8 Oct 2010 14:08:50 -0700 Subject: r600g: Silence uninitialized variable warning. --- src/gallium/winsys/r600/drm/r600_hw_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 86bddccbbb..fa005379b5 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -67,7 +67,8 @@ static void INLINE r600_context_update_fenced_list(struct r600_context *ctx) static void INLINE r600_context_fence_wraparound(struct r600_context *ctx, unsigned fence) { - struct radeon_bo *bo, *tmp; + struct radeon_bo *bo = NULL; + struct radeon_bo *tmp; LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &ctx->fenced_bo, fencedlist) { if (bo->fence <= *ctx->cfence) { -- cgit v1.2.3 From 36b65a373adc88650e4a2ad8d99642a569b7662a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 8 Oct 2010 14:14:16 -0700 Subject: r600g: Silence uninitialized variable warning. --- src/gallium/winsys/r600/drm/r600_hw_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index fa005379b5..2521ff9647 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -968,7 +968,8 @@ 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, *next_block; + struct r600_block *dirty_block = NULL; + struct r600_block *next_block; if (draw->indices) { ndwords = 13; -- cgit v1.2.3 From 3b16c591a4b0b8477874290bbe19333f9524b8c2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 8 Oct 2010 14:17:14 -0700 Subject: r600g: Silence uninitialized variable warning. --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 9b39c0c4f0..7f21b53ace 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -762,7 +762,8 @@ 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, *next_block; + struct r600_block *dirty_block = NULL; + struct r600_block *next_block; if (draw->indices) { ndwords = 13; -- cgit v1.2.3 From 0ed8c56bfe4ff5e3d451ec4791ee2cd64fb3daf2 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Oct 2010 18:31:38 +0200 Subject: gallivm: fix trunc/itrunc comment trunc of -1.5 is -1.0 not 1.0... --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 64c468c14d..4f108f6e81 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1054,9 +1054,9 @@ lp_build_round_sse41(struct lp_build_context *bld, /** - * Return the integer part of a float (vector) value. The returned value is - * a float (vector). - * Ex: trunc(-1.5) = 1.0 + * Return the integer part of a float (vector) value (== round toward zero). + * The returned value is a float (vector). + * Ex: trunc(-1.5) = -1.0 */ LLVMValueRef lp_build_trunc(struct lp_build_context *bld, @@ -1181,9 +1181,9 @@ lp_build_fract(struct lp_build_context *bld, /** - * Return the integer part of a float (vector) value. The returned value is - * an integer (vector). - * Ex: itrunc(-1.5) = 1 + * Return the integer part of a float (vector) value (== round toward zero). + * The returned value is an integer (vector). + * Ex: itrunc(-1.5) = -1 */ LLVMValueRef lp_build_itrunc(struct lp_build_context *bld, -- cgit v1.2.3 From cb3af2b43439088fc0be0085df8b1ee1a91f33c7 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Oct 2010 18:38:25 +0200 Subject: gallivm: faster iround implementation for sse2 sse2 supports round to nearest directly (or rather, assuming default nearest rounding mode in MXCSR). Use intrinsic to use this rather than round (sse41) or bit manipulation whenever possible. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 54 ++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 4f108f6e81..6ab13506e1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1053,6 +1053,54 @@ lp_build_round_sse41(struct lp_build_context *bld, } +static INLINE LLVMValueRef +lp_build_iround_nearest_sse2(struct lp_build_context *bld, + LLVMValueRef a) +{ + const struct lp_type type = bld->type; + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMTypeRef ret_type = lp_build_int_vec_type(type); + const char *intrinsic; + LLVMValueRef res; + + assert(type.floating); + /* using the double precision conversions is a bit more complicated */ + assert(type.width == 32); + + assert(lp_check_value(type, a)); + assert(util_cpu_caps.has_sse2); + + /* This is relying on MXCSR rounding mode, which should always be nearest. */ + if (type.length == 1) { + LLVMTypeRef vec_type; + LLVMValueRef undef; + LLVMValueRef arg; + LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0); + + vec_type = LLVMVectorType(bld->elem_type, 4); + + intrinsic = "llvm.x86.sse.cvtss2si"; + + undef = LLVMGetUndef(vec_type); + + arg = LLVMBuildInsertElement(bld->builder, undef, a, index0, ""); + + res = lp_build_intrinsic_unary(bld->builder, intrinsic, + ret_type, arg); + } + else { + assert(type.width*type.length == 128); + + intrinsic = "llvm.x86.sse2.cvtps2dq"; + + res = lp_build_intrinsic_unary(bld->builder, intrinsic, + ret_type, a); + } + + return res; +} + + /** * Return the integer part of a float (vector) value (== round toward zero). * The returned value is a float (vector). @@ -1217,7 +1265,11 @@ lp_build_iround(struct lp_build_context *bld, assert(lp_check_value(type, a)); - if (util_cpu_caps.has_sse4_1 && + if (util_cpu_caps.has_sse2 && + ((type.width == 32) && (type.length == 1 || type.length == 4))) { + return lp_build_iround_nearest_sse2(bld, a); + } + else 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); } -- cgit v1.2.3 From 1e17e0c4ffc0f1d1b9170c5574606172998c8917 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Oct 2010 18:43:49 +0200 Subject: gallivm: replace sub/floor/ifloor combo with ifloor_fract --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index b8cf938acf..90fd99067b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -202,11 +202,7 @@ lp_build_coord_mirror(struct lp_build_sample_context *bld, struct lp_build_context *int_coord_bld = &bld->int_coord_bld; LLVMValueRef fract, flr, isOdd; - /* fract = coord - floor(coord) */ - fract = lp_build_sub(coord_bld, coord, lp_build_floor(coord_bld, coord)); - - /* flr = ifloor(coord); */ - flr = lp_build_ifloor(coord_bld, coord); + lp_build_ifloor_fract(coord_bld, coord, &flr, &fract); /* isOdd = flr & 1 */ isOdd = LLVMBuildAnd(bld->builder, flr, int_coord_bld->one, ""); -- cgit v1.2.3 From 99ade19e6e0dc9f5a4507bdcd7fb9704ca6c1df5 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Oct 2010 20:57:50 +0200 Subject: gallivm: optimize some tex wrap mode calculations a bit Sometimes coords are clamped to positive numbers before doing conversion to int, or clamped to 0 afterwards, in this case can use itrunc instead of ifloor which is easier. This is only the case for nearest calculations unfortunately, except linear MIRROR_CLAMP_TO_EDGE which for the same reason can use a unsigned float build context so the ifloor_fract helper can reduce this to itrunc in the ifloor helper itself. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 90fd99067b..29adb57928 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -364,7 +364,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: { LLVMValueRef min, max; - + struct lp_build_context abs_coord_bld = bld->coord_bld; + abs_coord_bld.type.sign = FALSE; coord = lp_build_abs(coord_bld, coord); if (bld->static_state->normalized_coords) { @@ -380,7 +381,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_sub(coord_bld, coord, half); /* convert to int, compute lerp weight */ - lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); + lp_build_ifloor_fract(&abs_coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); } break; @@ -465,7 +466,8 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, } /* floor */ - icoord = lp_build_ifloor(coord_bld, coord); + /* use itrunc instead since we clamp to 0 anyway */ + icoord = lp_build_itrunc(coord_bld, coord); /* clamp to [0, length - 1]. */ icoord = lp_build_clamp(int_coord_bld, icoord, int_coord_bld->zero, @@ -499,7 +501,8 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, assert(bld->static_state->normalized_coords); coord = lp_build_mul(coord_bld, coord, length_f); - icoord = lp_build_ifloor(coord_bld, coord); + /* itrunc == ifloor here */ + icoord = lp_build_itrunc(coord_bld, coord); /* clamp to [0, length - 1] */ icoord = lp_build_min(int_coord_bld, icoord, length_minus_one); @@ -514,7 +517,8 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, coord = lp_build_mul(coord_bld, coord, length_f); } - icoord = lp_build_ifloor(coord_bld, coord); + /* itrunc == ifloor here */ + icoord = lp_build_itrunc(coord_bld, coord); /* clamp to [0, length - 1] */ icoord = lp_build_min(int_coord_bld, icoord, length_minus_one); @@ -528,7 +532,8 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, coord = lp_build_mul(coord_bld, coord, length_f); } - icoord = lp_build_ifloor(coord_bld, coord); + /* itrunc == ifloor here */ + icoord = lp_build_itrunc(coord_bld, coord); /* clamp to [0, length] */ icoord = lp_build_min(int_coord_bld, icoord, length); -- cgit v1.2.3 From 318bb080b04c961141a962d440d0e1296f8adda6 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Oct 2010 21:06:04 +0200 Subject: gallivm: more linear tex wrap mode calculation simplification Rearrange order of operations a bit to make some clamps easier. All calculations should be equivalent. Note there seems to be some inconsistency in the clamp to edge case wrt normalized/non-normalized coords, could potentially simplify this too. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 29adb57928..242e8d3d50 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -291,6 +291,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); } + /* XXX this is odd normalized ranges from -0.5 to length-0.5 after denorm + but non-normalized ranges from to 0.5 to length-0.5 after clamp */ else { LLVMValueRef min, max; /* clamp to [0.5, length - 0.5] */ @@ -309,16 +311,15 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, case PIPE_TEX_WRAP_CLAMP_TO_BORDER: { - LLVMValueRef min, max; + LLVMValueRef min; if (bld->static_state->normalized_coords) { /* scale coord to length */ coord = lp_build_mul(coord_bld, coord, length_f); } - /* clamp to [-0.5, length + 0.5] */ - min = lp_build_const_vec(coord_bld->type, -0.5F); - max = lp_build_sub(coord_bld, length_f, min); - coord = lp_build_clamp(coord_bld, coord, min, max); + /* was: clamp to [-0.5, length + 0.5], then sub 0.5 */ coord = lp_build_sub(coord_bld, coord, half); + min = lp_build_const_vec(coord_bld->type, -1.0F); + coord = lp_build_clamp(coord_bld, coord, min, length_f); /* 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); @@ -388,8 +389,6 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: { - LLVMValueRef min, max; - coord = lp_build_abs(coord_bld, coord); if (bld->static_state->normalized_coords) { @@ -397,12 +396,10 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_mul(coord_bld, coord, length_f); } - /* clamp to [-0.5, length + 0.5] */ - min = lp_build_negate(coord_bld, half); - max = lp_build_sub(coord_bld, length_f, min); - coord = lp_build_clamp(coord_bld, coord, min, max); - + /* was: clamp to [-0.5, length + 0.5] then sub 0.5 */ + /* skip -0.5 clamp (always positive), do sub first */ coord = lp_build_sub(coord_bld, coord, half); + coord = lp_build_min(coord_bld, coord, length_f); /* convert to int, compute lerp weight */ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); -- cgit v1.2.3 From 2cc6da85d6e60e80d0b5b86fe42f8f82073b5d51 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 8 Oct 2010 21:08:49 +0200 Subject: gallivm: avoid unnecessary URem in linear wrap repeat case Haven't looked at what code this exactly generates but URem can't be fast. Instead of using two URem only use one and replace the second one with select/add (this is what the corresponding aos code already does). --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 242e8d3d50..b0207820ba 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -251,19 +251,23 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, coord = lp_build_sub(coord_bld, coord, half); /* 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); /* repeat wrap */ if (is_pot) { + coord1 = lp_build_add(uint_coord_bld, coord0, uint_coord_bld->one); coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, ""); coord1 = LLVMBuildAnd(bld->builder, coord1, length_minus_one, ""); } else { /* Add a bias to the texcoord to handle negative coords */ LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + LLVMValueRef mask; coord0 = LLVMBuildAdd(bld->builder, coord0, bias, ""); - coord1 = LLVMBuildAdd(bld->builder, coord1, bias, ""); coord0 = LLVMBuildURem(bld->builder, coord0, length, ""); - coord1 = LLVMBuildURem(bld->builder, coord1, length, ""); + mask = lp_build_compare(bld->builder, int_coord_bld->type, + PIPE_FUNC_NOTEQUAL, coord0, length_minus_one); + coord1 = LLVMBuildAnd(bld->builder, + lp_build_add(uint_coord_bld, coord0, uint_coord_bld->one), + mask, ""); } break; -- cgit v1.2.3 From 175cdfd49100b9c9d248dda911181afae6f492f4 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 9 Oct 2010 00:14:11 +0200 Subject: gallivm: optimize soa linear clamp to edge wrap mode a bit Clamp against 0 instead of -0.5, which simplifies things. The former version would have resulted in both int coords being zero (in case of coord being smaller than 0) and some "unused" weight value, whereas now the int coords will be 0 and 1, but weight will be 0, hence the lerp should produce the same value. Still not happy about differences between normalized and non-normalized... --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 53 +++++++++++++---------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index b0207820ba..f3c4b6a7c8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -288,30 +288,37 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, break; case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - if (bld->static_state->normalized_coords) { - /* clamp to [0,1] */ - coord = lp_build_clamp(coord_bld, coord, coord_bld->zero, coord_bld->one); - /* mul by tex size and subtract 0.5 */ - coord = lp_build_mul(coord_bld, coord, length_f); - coord = lp_build_sub(coord_bld, coord, half); - } - /* XXX this is odd normalized ranges from -0.5 to length-0.5 after denorm - but non-normalized ranges from to 0.5 to length-0.5 after clamp */ - else { - LLVMValueRef min, max; - /* clamp to [0.5, length - 0.5] */ - min = half; - max = lp_build_sub(coord_bld, length_f, min); - coord = lp_build_clamp(coord_bld, coord, min, max); + { + struct lp_build_context abs_coord_bld = bld->coord_bld; + abs_coord_bld.type.sign = FALSE; + + if (bld->static_state->normalized_coords) { + /* mul by tex size */ + coord = lp_build_mul(coord_bld, coord, length_f); + /* clamp to length max */ + coord = lp_build_min(coord_bld, coord, length_f); + /* subtract 0.5 */ + coord = lp_build_sub(coord_bld, coord, half); + /* clamp to [0, length - 0.5] */ + coord = lp_build_max(coord_bld, coord, coord_bld->zero); + } + /* XXX this is odd normalized ranges from 0 to length-0.5 after denorm + but non-normalized ranges from to 0.5 to length-0.5 after clamp. + Is this missing the sub 0.5? */ + else { + LLVMValueRef min, max; + /* clamp to [0.5, length - 0.5] */ + min = half; + max = lp_build_sub(coord_bld, length_f, min); + coord = lp_build_clamp(coord_bld, coord, min, max); + } + /* convert to int, compute lerp weight */ + lp_build_ifloor_fract(&abs_coord_bld, coord, &coord0, &weight); + coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); + /* coord1 = min(coord1, length-1) */ + coord1 = lp_build_min(int_coord_bld, coord1, length_minus_one); + break; } - /* 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); - /* coord1 = min(coord1, length-1) */ - coord1 = lp_build_min(int_coord_bld, coord1, length_minus_one); - break; case PIPE_TEX_WRAP_CLAMP_TO_BORDER: { -- cgit v1.2.3 From ff72c799242f2bea19bb0fa8283bf78d76c86d15 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 9 Oct 2010 00:35:58 +0200 Subject: gallivm: make use of new iround code in lp_bld_conv. Only requires sse2 now. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 127b13bc28..3abb19272b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -297,16 +297,16 @@ lp_build_conv(LLVMBuilderRef builder, d = LLVMBuildFMul(builder, src[3], const_255f, ""); /* lp_build_round generates excessively general code without - * sse4, so do rounding manually. + * sse2, so do rounding manually. */ - if (!util_cpu_caps.has_sse4_1) { + if (!util_cpu_caps.has_sse2) { LLVMValueRef const_half = lp_build_const_vec(src_type, 0.5f); a = LLVMBuildFAdd(builder, a, const_half, ""); b = LLVMBuildFAdd(builder, b, const_half, ""); c = LLVMBuildFAdd(builder, c, const_half, ""); d = LLVMBuildFAdd(builder, d, const_half, ""); - + src_int0 = LLVMBuildFPToSI(builder, a, int32_vec_type, ""); src_int1 = LLVMBuildFPToSI(builder, b, int32_vec_type, ""); src_int2 = LLVMBuildFPToSI(builder, c, int32_vec_type, ""); @@ -323,7 +323,7 @@ lp_build_conv(LLVMBuilderRef builder, bld.undef = lp_build_undef(src_type); bld.zero = lp_build_zero(src_type); bld.one = lp_build_one(src_type); - + src_int0 = lp_build_iround(&bld, a); src_int1 = lp_build_iround(&bld, b); src_int2 = lp_build_iround(&bld, c); -- cgit v1.2.3 From 6316d540564d116460bfd1382e3eee98480e28ff Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 7 Oct 2010 16:26:17 -0400 Subject: llvmpipe: fix rasterization of vertical lines on pixel boundaries --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 4d7d6235b0..693ac28175 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -475,7 +475,7 @@ try_setup_line( struct lp_setup_context *setup, else { /* do intersection test */ float xintersect = fracf(v2[0][0]) + y2diff * dxdy; - draw_end = (xintersect < 1.0 && xintersect > 0.0); + draw_end = (xintersect < 1.0 && xintersect >= 0.0); } /* Are we already drawing start/end? @@ -513,7 +513,7 @@ try_setup_line( struct lp_setup_context *setup, x_offset_end = y_offset_end * dxdy; } } - + /* x/y positions in fixed point */ x[0] = subpixel_snap(v1[0][0] + x_offset - setup->pixel_offset) - fixed_width/2; x[1] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset) - fixed_width/2; -- cgit v1.2.3 From 34c11c87e4e3b5639764abee413c45e918749477 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 09:34:31 +0100 Subject: gallivm: Do size computations simultanously for all dimensions (AoS). Operate simultanouesly on vector as much as possible, instead of doing the operations on vectors with broadcasted scalars. Also do the 24.8 fixed point scalar with integer shift of the texture size, for unnormalized coordinates. AoS path only for now -- the same thing can be done for SoA. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 106 +++++++++++++----- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 22 +++- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 125 +++++++++++----------- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 16 ++- 4 files changed, 177 insertions(+), 92 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 7a64392d3c..5bc3c263a0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -630,37 +630,21 @@ lp_build_get_level_stride_vec(struct lp_build_sample_context *bld, void lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, LLVMValueRef ilevel, - LLVMValueRef *out_width_vec, - LLVMValueRef *out_height_vec, - LLVMValueRef *out_depth_vec, + LLVMValueRef *out_size, LLVMValueRef *row_stride_vec, LLVMValueRef *img_stride_vec) { const unsigned dims = bld->dims; LLVMValueRef ilevel_vec; - LLVMValueRef size_vec; - LLVMTypeRef i32t = LLVMInt32Type(); ilevel_vec = lp_build_broadcast_scalar(&bld->int_size_bld, ilevel); /* * Compute width, height, depth at mipmap level 'ilevel' */ - size_vec = lp_build_minify(&bld->int_size_bld, bld->int_size, ilevel_vec); + *out_size = lp_build_minify(&bld->int_size_bld, bld->int_size, ilevel_vec); - *out_width_vec = lp_build_extract_broadcast(bld->builder, - bld->int_size_type, - bld->int_coord_type, - size_vec, - LLVMConstInt(i32t, 0, 0)); if (dims >= 2) { - - *out_height_vec = lp_build_extract_broadcast(bld->builder, - bld->int_size_type, - bld->int_coord_type, - size_vec, - LLVMConstInt(i32t, 1, 0)); - *row_stride_vec = lp_build_get_level_stride_vec(bld, bld->row_stride_array, ilevel); @@ -668,18 +652,90 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, *img_stride_vec = lp_build_get_level_stride_vec(bld, bld->img_stride_array, ilevel); - if (dims == 3) { - *out_depth_vec = lp_build_extract_broadcast(bld->builder, - bld->int_size_type, - bld->int_coord_type, - size_vec, - LLVMConstInt(i32t, 2, 0)); - } } } } +/** + * Extract and broadcast texture size. + * + * @param size_type type of the texture size vector (either + * bld->int_size_type or bld->float_size_type) + * @param coord_type type of the texture size vector (either + * bld->int_coord_type or bld->coord_type) + * @param int_size vector with the integer texture size (width, height, + * depth) + */ +void +lp_build_extract_image_sizes(struct lp_build_sample_context *bld, + struct lp_type size_type, + struct lp_type coord_type, + LLVMValueRef size, + LLVMValueRef *out_width, + LLVMValueRef *out_height, + LLVMValueRef *out_depth) +{ + const unsigned dims = bld->dims; + LLVMTypeRef i32t = LLVMInt32Type(); + + *out_width = lp_build_extract_broadcast(bld->builder, + size_type, + coord_type, + size, + LLVMConstInt(i32t, 0, 0)); + if (dims >= 2) { + *out_height = lp_build_extract_broadcast(bld->builder, + size_type, + coord_type, + size, + LLVMConstInt(i32t, 1, 0)); + if (dims == 3) { + *out_depth = lp_build_extract_broadcast(bld->builder, + size_type, + coord_type, + size, + LLVMConstInt(i32t, 2, 0)); + } + } +} + + +/** + * Unnormalize coords. + * + * @param int_size vector with the integer texture size (width, height, depth) + */ +void +lp_build_unnormalized_coords(struct lp_build_sample_context *bld, + LLVMValueRef flt_size, + LLVMValueRef *s, + LLVMValueRef *t, + LLVMValueRef *r) +{ + const unsigned dims = bld->dims; + LLVMValueRef width; + LLVMValueRef height; + LLVMValueRef depth; + + lp_build_extract_image_sizes(bld, + bld->float_size_type, + bld->coord_type, + flt_size, + &width, + &height, + &depth); + + /* s = s * width, t = t * height */ + *s = lp_build_mul(&bld->coord_bld, *s, width); + if (dims >= 2) { + *t = lp_build_mul(&bld->coord_bld, *t, height); + if (dims >= 3) { + *r = lp_build_mul(&bld->coord_bld, *r, depth); + } + } +} + /** Helper used by lp_build_cube_lookup() */ static LLVMValueRef diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index d1a1aa143d..ce2285446a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -333,13 +333,29 @@ lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld, void lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld, LLVMValueRef ilevel, - LLVMValueRef *out_width_vec, - LLVMValueRef *out_height_vec, - LLVMValueRef *out_depth_vec, + LLVMValueRef *out_size_vec, LLVMValueRef *row_stride_vec, LLVMValueRef *img_stride_vec); +void +lp_build_extract_image_sizes(struct lp_build_sample_context *bld, + struct lp_type size_type, + struct lp_type coord_type, + LLVMValueRef size, + LLVMValueRef *out_width, + LLVMValueRef *out_height, + LLVMValueRef *out_depth); + + +void +lp_build_unnormalized_coords(struct lp_build_sample_context *bld, + LLVMValueRef flt_size, + LLVMValueRef *s, + LLVMValueRef *t, + LLVMValueRef *r); + + void lp_build_cube_lookup(struct lp_build_sample_context *bld, LLVMValueRef s, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index e7410448c0..1e1e3591ca 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -45,6 +45,7 @@ #include "lp_bld_const.h" #include "lp_bld_conv.h" #include "lp_bld_arit.h" +#include "lp_bld_bitarit.h" #include "lp_bld_logic.h" #include "lp_bld_swizzle.h" #include "lp_bld_pack.h" @@ -253,9 +254,7 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, */ static void lp_build_sample_image_nearest(struct lp_build_sample_context *bld, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, + LLVMValueRef int_size, LLVMValueRef row_stride_vec, LLVMValueRef img_stride_vec, LLVMValueRef data_ptr, @@ -270,6 +269,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, struct lp_build_context i32, h16, u8n; LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; LLVMValueRef i32_c8; + LLVMValueRef width_vec, height_vec, depth_vec; LLVMValueRef s_ipart, t_ipart, r_ipart; LLVMValueRef x_stride; LLVMValueRef x_offset, offset; @@ -283,30 +283,33 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, h16_vec_type = lp_build_vec_type(h16.type); u8n_vec_type = lp_build_vec_type(u8n.type); + lp_build_extract_image_sizes(bld, + bld->int_size_type, + bld->int_coord_type, + int_size, + &width_vec, + &height_vec, + &depth_vec); + if (bld->static_state->normalized_coords) { - /* s = s * width, t = t * height */ - LLVMTypeRef coord_vec_type = lp_build_vec_type(bld->coord_type); - LLVMValueRef fp_width = LLVMBuildSIToFP(bld->builder, width_vec, - coord_vec_type, ""); - s = lp_build_mul(&bld->coord_bld, s, fp_width); - if (dims >= 2) { - LLVMValueRef fp_height = LLVMBuildSIToFP(bld->builder, height_vec, - coord_vec_type, ""); - t = lp_build_mul(&bld->coord_bld, t, fp_height); - if (dims >= 3) { - LLVMValueRef fp_depth = LLVMBuildSIToFP(bld->builder, depth_vec, - coord_vec_type, ""); - r = lp_build_mul(&bld->coord_bld, r, fp_depth); - } - } - } + LLVMValueRef scaled_size; + LLVMValueRef flt_size; - /* scale coords by 256 (8 fractional bits) */ - s = lp_build_mul_imm(&bld->coord_bld, s, 256); - if (dims >= 2) - t = lp_build_mul_imm(&bld->coord_bld, t, 256); - if (dims >= 3) - r = lp_build_mul_imm(&bld->coord_bld, r, 256); + /* scale size by 256 (8 fractional bits) */ + scaled_size = lp_build_shl_imm(&bld->int_size_bld, int_size, 8); + + flt_size = lp_build_int_to_float(&bld->float_size_bld, scaled_size); + + lp_build_unnormalized_coords(bld, flt_size, &s, &t, &r); + } + else { + /* scale coords by 256 (8 fractional bits) */ + s = lp_build_mul_imm(&bld->coord_bld, s, 256); + if (dims >= 2) + t = lp_build_mul_imm(&bld->coord_bld, t, 256); + if (dims >= 3) + r = lp_build_mul_imm(&bld->coord_bld, r, 256); + } /* convert float to int */ s = LLVMBuildFPToSI(builder, s, i32_vec_type, ""); @@ -417,9 +420,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, - LLVMValueRef width_vec, - LLVMValueRef height_vec, - LLVMValueRef depth_vec, + LLVMValueRef int_size, LLVMValueRef row_stride_vec, LLVMValueRef img_stride_vec, LLVMValueRef data_ptr, @@ -434,6 +435,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, struct lp_build_context i32, h16, u8n; LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; LLVMValueRef i32_c8, i32_c128, i32_c255; + LLVMValueRef width_vec, height_vec, depth_vec; LLVMValueRef s_ipart, s_fpart, s_fpart_lo, s_fpart_hi; LLVMValueRef t_ipart, t_fpart, t_fpart_lo, t_fpart_hi; LLVMValueRef r_ipart, r_fpart, r_fpart_lo, r_fpart_hi; @@ -458,30 +460,33 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, h16_vec_type = lp_build_vec_type(h16.type); u8n_vec_type = lp_build_vec_type(u8n.type); + lp_build_extract_image_sizes(bld, + bld->int_size_type, + bld->int_coord_type, + int_size, + &width_vec, + &height_vec, + &depth_vec); + if (bld->static_state->normalized_coords) { - /* s = s * width, t = t * height */ - LLVMTypeRef coord_vec_type = lp_build_vec_type(bld->coord_type); - LLVMValueRef fp_width = LLVMBuildSIToFP(bld->builder, width_vec, - coord_vec_type, ""); - s = lp_build_mul(&bld->coord_bld, s, fp_width); - if (dims >= 2) { - LLVMValueRef fp_height = LLVMBuildSIToFP(bld->builder, height_vec, - coord_vec_type, ""); - t = lp_build_mul(&bld->coord_bld, t, fp_height); - } - if (dims >= 3) { - LLVMValueRef fp_depth = LLVMBuildSIToFP(bld->builder, depth_vec, - coord_vec_type, ""); - r = lp_build_mul(&bld->coord_bld, r, fp_depth); - } - } + LLVMValueRef scaled_size; + LLVMValueRef flt_size; - /* scale coords by 256 (8 fractional bits) */ - s = lp_build_mul_imm(&bld->coord_bld, s, 256); - if (dims >= 2) - t = lp_build_mul_imm(&bld->coord_bld, t, 256); - if (dims >= 3) - r = lp_build_mul_imm(&bld->coord_bld, r, 256); + /* scale size by 256 (8 fractional bits) */ + scaled_size = lp_build_shl_imm(&bld->int_size_bld, int_size, 8); + + flt_size = lp_build_int_to_float(&bld->float_size_bld, scaled_size); + + lp_build_unnormalized_coords(bld, flt_size, &s, &t, &r); + } + else { + /* scale coords by 256 (8 fractional bits) */ + s = lp_build_mul_imm(&bld->coord_bld, s, 256); + if (dims >= 2) + t = lp_build_mul_imm(&bld->coord_bld, t, 256); + if (dims >= 3) + r = lp_build_mul_imm(&bld->coord_bld, r, 256); + } /* convert float to int */ s = LLVMBuildFPToSI(builder, s, i32_vec_type, ""); @@ -788,12 +793,8 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMValueRef colors_hi_var) { LLVMBuilderRef builder = bld->builder; - LLVMValueRef width0_vec; - LLVMValueRef width1_vec; - LLVMValueRef height0_vec; - LLVMValueRef height1_vec; - LLVMValueRef depth0_vec; - LLVMValueRef depth1_vec; + LLVMValueRef size0; + LLVMValueRef size1; LLVMValueRef row_stride0_vec; LLVMValueRef row_stride1_vec; LLVMValueRef img_stride0_vec; @@ -806,12 +807,12 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, /* sample the first mipmap level */ lp_build_mipmap_level_sizes(bld, ilevel0, - &width0_vec, &height0_vec, &depth0_vec, + &size0, &row_stride0_vec, &img_stride0_vec); data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, - width0_vec, height0_vec, depth0_vec, + size0, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, &colors0_lo, &colors0_hi); @@ -819,7 +820,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, else { assert(img_filter == PIPE_TEX_FILTER_LINEAR); lp_build_sample_image_linear(bld, - width0_vec, height0_vec, depth0_vec, + size0, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, &colors0_lo, &colors0_hi); @@ -854,19 +855,19 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, /* sample the second mipmap level */ lp_build_mipmap_level_sizes(bld, ilevel1, - &width1_vec, &height1_vec, &depth1_vec, + &size1, &row_stride1_vec, &img_stride1_vec); data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, - width1_vec, height1_vec, depth1_vec, + size1, row_stride1_vec, img_stride1_vec, data_ptr1, s, t, r, &colors1_lo, &colors1_hi); } else { lp_build_sample_image_linear(bld, - width1_vec, height1_vec, depth1_vec, + size1, row_stride1_vec, img_stride1_vec, data_ptr1, s, t, r, &colors1_lo, &colors1_hi); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index f3c4b6a7c8..1af0318e8e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -805,6 +805,8 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMValueRef *colors_out) { LLVMBuilderRef builder = bld->builder; + LLVMValueRef size0; + LLVMValueRef size1; LLVMValueRef width0_vec; LLVMValueRef width1_vec; LLVMValueRef height0_vec; @@ -822,8 +824,13 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, /* sample the first mipmap level */ lp_build_mipmap_level_sizes(bld, ilevel0, - &width0_vec, &height0_vec, &depth0_vec, + &size0, &row_stride0_vec, &img_stride0_vec); + lp_build_extract_image_sizes(bld, + bld->int_size_type, + bld->int_coord_type, + size0, + &width0_vec, &height0_vec, &depth0_vec); data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, unit, @@ -863,8 +870,13 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, { /* sample the second mipmap level */ lp_build_mipmap_level_sizes(bld, ilevel1, - &width1_vec, &height1_vec, &depth1_vec, + &size1, &row_stride1_vec, &img_stride1_vec); + lp_build_extract_image_sizes(bld, + bld->int_size_type, + bld->int_coord_type, + size1, + &width1_vec, &height1_vec, &depth1_vec); data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, unit, -- cgit v1.2.3 From d0bfb3c5144a9434efd4d53ced149d42016b5bdc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 20:42:30 +0100 Subject: llvmpipe: Prevent z > 1.0 The current interpolation schemes causes precision loss. Changing the operation order helps, but does not completely avoid the problem. The only short term solution is to clamp z to 1.0. This is unfortunate, but probably unavoidable until interpolation is improved. --- src/gallium/drivers/llvmpipe/lp_bld_interp.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c index 2a374f8c39..ee92ce3cdc 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c @@ -206,7 +206,7 @@ coeffs_init(struct lp_build_interp_soa_context *bld, dadq2 = LLVMBuildFAdd(builder, dadq, dadq, ""); /* - * a = a0 + x * dadx + y * dady + * a = a0 + (x * dadx + y * dady) */ if (attrib == 0 && chan == 0) { @@ -219,11 +219,11 @@ coeffs_init(struct lp_build_interp_soa_context *bld, a = a0; if (interp != LP_INTERP_CONSTANT && interp != LP_INTERP_FACING) { - LLVMValueRef tmp; - tmp = LLVMBuildFMul(builder, bld->x, dadx, ""); - a = LLVMBuildFAdd(builder, a, tmp, ""); - tmp = LLVMBuildFMul(builder, bld->y, dady, ""); - a = LLVMBuildFAdd(builder, a, tmp, ""); + LLVMValueRef ax, ay, axy; + ax = LLVMBuildFMul(builder, bld->x, dadx, ""); + ay = LLVMBuildFMul(builder, bld->y, dady, ""); + axy = LLVMBuildFAdd(builder, ax, ay, ""); + a = LLVMBuildFAdd(builder, a, axy, ""); } } @@ -350,6 +350,14 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index) } #endif + if (attrib == 0 && chan == 2) { + /* FIXME: Depth values can exceed 1.0, due to the fact that + * setup interpolation coefficients refer to (0,0) which causes + * precision loss. So we must clamp to 1.0 here to avoid artifacts + */ + a = lp_build_min(coeff_bld, a, coeff_bld->one); + } + attrib_name(a, attrib, chan, ""); } bld->attribs[attrib][chan] = a; -- cgit v1.2.3 From 8009886b0092df2783472deaac1bcaad4a802c19 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 Oct 2010 22:25:48 +0100 Subject: llvmpipe: defer attribute interpolation until after mask and ztest Don't calculate 1/w for quads which aren't visible... --- src/gallium/drivers/llvmpipe/lp_bld_interp.c | 25 ++++++++++++++++++------- src/gallium/drivers/llvmpipe/lp_bld_interp.h | 6 +++++- src/gallium/drivers/llvmpipe/lp_state_fs.c | 17 +++++++++++------ 3 files changed, 34 insertions(+), 14 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c index ee92ce3cdc..c9da8900d0 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c @@ -272,7 +272,10 @@ coeffs_init(struct lp_build_interp_soa_context *bld, * This is called when we move from one quad to the next. */ static void -attribs_update(struct lp_build_interp_soa_context *bld, int quad_index) +attribs_update(struct lp_build_interp_soa_context *bld, + int quad_index, + int start, + int end) { struct lp_build_context *coeff_bld = &bld->coeff_bld; LLVMValueRef shuffle = lp_build_const_int_vec(coeff_bld->type, quad_index); @@ -282,7 +285,7 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index) assert(quad_index < 4); - for(attrib = 0; attrib < bld->num_attribs; ++attrib) { + for(attrib = start; attrib < end; ++attrib) { const unsigned mask = bld->mask[attrib]; const unsigned interp = bld->interp[attrib]; for(chan = 0; chan < NUM_CHANNELS; ++chan) { @@ -442,8 +445,6 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld, pos_init(bld, x0, y0); coeffs_init(bld, a0_ptr, dadx_ptr, dady_ptr); - - attribs_update(bld, 0); } @@ -451,10 +452,20 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld, * Advance the position and inputs to the given quad within the block. */ void -lp_build_interp_soa_update(struct lp_build_interp_soa_context *bld, - int quad_index) +lp_build_interp_soa_update_inputs(struct lp_build_interp_soa_context *bld, + int quad_index) +{ + assert(quad_index < 4); + + attribs_update(bld, quad_index, 1, bld->num_attribs); +} + +void +lp_build_interp_soa_update_pos(struct lp_build_interp_soa_context *bld, + int quad_index) { assert(quad_index < 4); - attribs_update(bld, quad_index); + attribs_update(bld, quad_index, 0, 1); } + diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.h b/src/gallium/drivers/llvmpipe/lp_bld_interp.h index 3054030f73..6588f7f275 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_interp.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.h @@ -89,7 +89,11 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld, LLVMValueRef y); void -lp_build_interp_soa_update(struct lp_build_interp_soa_context *bld, +lp_build_interp_soa_update_inputs(struct lp_build_interp_soa_context *bld, + int quad_index); + +void +lp_build_interp_soa_update_pos(struct lp_build_interp_soa_context *bld, int quad_index); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 3ce8be5a0a..0530c61323 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -262,7 +262,7 @@ generate_fs(struct llvmpipe_context *lp, struct lp_type type, LLVMValueRef context_ptr, unsigned i, - const struct lp_build_interp_soa_context *interp, + struct lp_build_interp_soa_context *interp, struct lp_build_sampler_soa *sampler, LLVMValueRef *pmask, LLVMValueRef (*color)[4], @@ -276,7 +276,7 @@ generate_fs(struct llvmpipe_context *lp, LLVMTypeRef vec_type; LLVMValueRef consts_ptr; LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS]; - LLVMValueRef z = interp->pos[2]; + LLVMValueRef z; LLVMValueRef stencil_refs[2]; struct lp_build_flow_context *flow; struct lp_build_mask_context mask; @@ -307,7 +307,6 @@ generate_fs(struct llvmpipe_context *lp, lp_build_flow_scope_declare(flow, &color[cbuf][chan]); } } - lp_build_flow_scope_declare(flow, &z); /* do triangle edge testing */ if (partial_mask) { @@ -321,6 +320,13 @@ generate_fs(struct llvmpipe_context *lp, /* 'mask' will control execution based on quad's pixel alive/killed state */ lp_build_mask_begin(&mask, flow, type, *pmask); + lp_build_interp_soa_update_pos(interp, i); + + /* Try to avoid the 1/w for quads where mask is zero. TODO: avoid + * this for depth-fail quads also. + */ + z = interp->pos[2]; + early_depth_stencil_test = (key->depth.enabled || key->stencil[0].enabled) && !key->alpha.enabled && @@ -332,6 +338,8 @@ generate_fs(struct llvmpipe_context *lp, type, &mask, stencil_refs, z, depth_ptr, facing, counter); + lp_build_interp_soa_update_inputs(interp, i); + lp_build_tgsi_soa(builder, tokens, type, &mask, consts_ptr, interp->pos, interp->inputs, outputs, sampler, &shader->info); @@ -621,9 +629,6 @@ generate_fragment(struct llvmpipe_context *lp, LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS]; LLVMValueRef depth_ptr_i; - if(i != 0) - lp_build_interp_soa_update(&interp, i); - depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &index, 1, ""); generate_fs(lp, shader, key, -- cgit v1.2.3 From 40d7be52619fbff2479dcdf56929e3e0c5b12e72 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 Oct 2010 18:59:54 +0100 Subject: llvmpipe: use alloca for fs color outputs Don't try to emit our own phi's, let llvm mem2reg do it for us. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 0530c61323..f75ae284cb 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -303,8 +303,7 @@ generate_fs(struct llvmpipe_context *lp, /* Declare the color and z variables */ for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) { for(chan = 0; chan < NUM_CHANNELS; ++chan) { - color[cbuf][chan] = LLVMGetUndef(vec_type); - lp_build_flow_scope_declare(flow, &color[cbuf][chan]); + color[cbuf][chan] = lp_build_alloca(builder, vec_type, "color"); } } @@ -369,7 +368,7 @@ generate_fs(struct llvmpipe_context *lp, &mask, alpha, alpha_ref_value); } - color[cbuf][chan] = out; + LLVMBuildStore(builder, out, color[cbuf][chan]); break; } @@ -665,9 +664,18 @@ generate_fragment(struct llvmpipe_context *lp, * Convert the fs's output color and mask to fit to the blending type. */ for(chan = 0; chan < NUM_CHANNELS; ++chan) { + LLVMValueRef fs_color_vals[LP_MAX_VECTOR_LENGTH]; + + for (i = 0; i < num_fs; i++) { + fs_color_vals[i] = + LLVMBuildLoad(builder, fs_out_color[cbuf][chan][i], "fs_color_vals"); + } + lp_build_conv(builder, fs_type, blend_type, - fs_out_color[cbuf][chan], num_fs, + fs_color_vals, + num_fs, &blend_in_color[chan], 1); + lp_build_name(blend_in_color[chan], "color%d.%c", cbuf, "rgba"[chan]); } -- cgit v1.2.3 From 6da29f36111edc821a4aa10128e9681fc75a43d7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 Oct 2010 19:49:20 +0100 Subject: llvmpipe: store zero into all alloca'd values Fixes slowdown in isosurf with earlier versions of llvm. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index 5bc9c741a8..cd5fbc2463 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -830,6 +830,7 @@ lp_build_alloca(LLVMBuilderRef builder, } res = LLVMBuildAlloca(first_builder, type, name); + LLVMBuildStore(builder, LLVMConstNull(type), res); LLVMDisposeBuilder(first_builder); -- cgit v1.2.3 From 954965366fee3fa2eec8a11b6663d4cf218e1d5d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 Oct 2010 19:01:12 +0100 Subject: llvmpipe: dump fragment shader ir and asm when LP_DEBUG=fs Better than GALLIVM_DEBUG if you're only interested in fragment shaders. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index f75ae284cb..07b4f74dbc 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -730,7 +730,7 @@ generate_fragment(struct llvmpipe_context *lp, /* Apply optimizations to LLVM IR */ LLVMRunFunctionPassManager(screen->pass, function); - if (gallivm_debug & GALLIVM_DEBUG_IR) { + if ((gallivm_debug & GALLIVM_DEBUG_IR) || (LP_DEBUG & DEBUG_FS)) { /* Print the LLVM IR to stderr */ lp_debug_dump_value(function); debug_printf("\n"); @@ -744,7 +744,7 @@ generate_fragment(struct llvmpipe_context *lp, variant->jit_function[partial_mask] = (lp_jit_frag_func)pointer_to_func(f); - if (gallivm_debug & GALLIVM_DEBUG_ASM) { + if ((gallivm_debug & GALLIVM_DEBUG_ASM) || (LP_DEBUG & DEBUG_FS)) { lp_disassemble(f); } lp_func_delete_body(function); -- cgit v1.2.3 From d2cf757f44f4ee5554243f3279483a25886d9927 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 Oct 2010 18:21:56 +0100 Subject: gallivm: specialized x8z24 depthtest path Avoid unnecessary masking of non-existant stencil component. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 95 ++++++++++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_state_fs.c | 30 +-------- 2 files changed, 94 insertions(+), 31 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 7eabe0508d..09b82fbe9b 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -71,6 +71,7 @@ #include "gallivm/lp_bld_arit.h" #include "gallivm/lp_bld_bitarit.h" #include "gallivm/lp_bld_const.h" +#include "gallivm/lp_bld_conv.h" #include "gallivm/lp_bld_logic.h" #include "gallivm/lp_bld_flow.h" #include "gallivm/lp_bld_intr.h" @@ -446,7 +447,7 @@ lp_build_occlusion_count(LLVMBuilderRef builder, * \param format_desc description of the depth/stencil surface * \param mask the alive/dead pixel mask for the quad (vector) * \param stencil_refs the front/back stencil ref values (scalar) - * \param z_src the incoming depth/stencil values (a 2x2 quad) + * \param z_src the incoming depth/stencil values (a 2x2 quad, float32) * \param zs_dst_ptr pointer to depth/stencil values in framebuffer * \param facing contains float value indicating front/back facing polygon */ @@ -454,7 +455,7 @@ void lp_build_depth_stencil_test(LLVMBuilderRef builder, const struct pipe_depth_state *depth, const struct pipe_stencil_state stencil[2], - struct lp_type type, + struct lp_type z_src_type, const struct util_format_description *format_desc, struct lp_build_mask_context *mask, LLVMValueRef stencil_refs[2], @@ -463,6 +464,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef face, LLVMValueRef counter) { + struct lp_type type; struct lp_build_context bld; struct lp_build_context sbld; struct lp_type s_type; @@ -473,6 +475,95 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef orig_mask = mask->value; LLVMValueRef front_facing = NULL; + /* Prototype a simpler path: + */ + if (z_src_type.floating && + format_desc->format == PIPE_FORMAT_X8Z24_UNORM && + depth->enabled) + { + LLVMValueRef zscaled; + LLVMValueRef const_ffffff_float; + LLVMValueRef const_8_int; + LLVMTypeRef int32_vec_type; + + /* We know the values in z_dst are all >= 0, so allow + * lp_build_compare to use signed compare intrinsics: + */ + type.floating = 0; + type.fixed = 0; + type.sign = 1; + type.norm = 1; + type.width = 32; + type.length = z_src_type.length; + + int32_vec_type = LLVMVectorType(LLVMInt32Type(), z_src_type.length); + + const_8_int = lp_build_const_int_vec(type, 8); + const_ffffff_float = lp_build_const_vec(z_src_type, (float)0xffffff); + + zscaled = LLVMBuildFMul(builder, z_src, const_ffffff_float, "zscaled"); + z_src = LLVMBuildFPToSI(builder, zscaled, int32_vec_type, "z_src"); + + /* Load current z/stencil value from z/stencil buffer */ + z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval"); + z_dst = LLVMBuildLShr(builder, z_dst, const_8_int, "z_dst"); + + /* compare src Z to dst Z, returning 'pass' mask */ + z_pass = lp_build_compare(builder, + type, + depth->func, z_src, z_dst); + + lp_build_mask_update(mask, z_pass); + + /* No need to worry about old stencil contents, just blend the + * old and new values and shift into the correct position for + * storage. + */ + if (depth->writemask) { + type.sign = 0; + lp_build_context_init(&bld, builder, type); + + z_dst = lp_build_select(&bld, mask->value, z_src, z_dst); + z_dst = LLVMBuildShl(builder, z_dst, const_8_int, "z_dst"); + LLVMBuildStore(builder, z_dst, zs_dst_ptr); + } + + if (counter) + lp_build_occlusion_count(builder, type, mask->value, counter); + + return; + } + + /* + * Depths are expected to be between 0 and 1, even if they are stored in + * floats. Setting these bits here will ensure that the lp_build_conv() call + * below won't try to unnecessarily clamp the incoming values. + */ + if(z_src_type.floating) { + z_src_type.sign = FALSE; + z_src_type.norm = TRUE; + } + else { + assert(!z_src_type.sign); + assert(z_src_type.norm); + } + + /* Pick the depth type. */ + type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length); + + /* FIXME: Cope with a depth test type with a different bit width. */ + assert(type.width == z_src_type.width); + assert(type.length == z_src_type.length); + + /* Convert fragment Z from float to integer */ + lp_build_conv(builder, z_src_type, type, &z_src, 1, &z_src, 1); + + zs_dst_ptr = LLVMBuildBitCast(builder, + zs_dst_ptr, + LLVMPointerType(lp_build_vec_type(type), 0), ""); + + + /* Sanity checking */ { const unsigned z_swizzle = format_desc->swizzle[0]; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 07b4f74dbc..b7a51cd667 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -119,7 +119,6 @@ generate_depth_stencil(LLVMBuilderRef builder, LLVMValueRef counter) { const struct util_format_description *format_desc; - struct lp_type dst_type; if (!key->depth.enabled && !key->stencil[0].enabled && !key->stencil[1].enabled) return; @@ -127,37 +126,10 @@ generate_depth_stencil(LLVMBuilderRef builder, format_desc = util_format_description(key->zsbuf_format); assert(format_desc); - /* - * Depths are expected to be between 0 and 1, even if they are stored in - * floats. Setting these bits here will ensure that the lp_build_conv() call - * below won't try to unnecessarily clamp the incoming values. - */ - if(src_type.floating) { - src_type.sign = FALSE; - src_type.norm = TRUE; - } - else { - assert(!src_type.sign); - assert(src_type.norm); - } - - /* Pick the depth type. */ - dst_type = lp_depth_type(format_desc, src_type.width*src_type.length); - - /* FIXME: Cope with a depth test type with a different bit width. */ - assert(dst_type.width == src_type.width); - assert(dst_type.length == src_type.length); - - /* Convert fragment Z from float to integer */ - lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1); - - dst_ptr = LLVMBuildBitCast(builder, - dst_ptr, - LLVMPointerType(lp_build_vec_type(dst_type), 0), ""); lp_build_depth_stencil_test(builder, &key->depth, key->stencil, - dst_type, + src_type, format_desc, mask, stencil_refs, -- cgit v1.2.3 From c79f162367b99d9438bd1589ecfdeba69baa9d3d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 Oct 2010 19:10:30 +0100 Subject: gallivm: prefer blendvb for integer arguments --- src/gallium/auxiliary/gallivm/lp_bld_logic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c index ce5d0214b4..026b60ac36 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c @@ -462,10 +462,12 @@ lp_build_select(struct lp_build_context *bld, LLVMTypeRef arg_type; LLVMValueRef args[3]; - if (type.width == 64) { + if (type.floating && + type.width == 64) { intrinsic = "llvm.x86.sse41.blendvpd"; arg_type = LLVMVectorType(LLVMDoubleType(), 2); - } else if (type.width == 32) { + } else if (type.floating && + type.width == 32) { intrinsic = "llvm.x86.sse41.blendvps"; arg_type = LLVMVectorType(LLVMFloatType(), 4); } else { -- cgit v1.2.3 From 2ef6f75ab410bb188e028024e18891d7877febad Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 Oct 2010 19:09:03 +0100 Subject: gallivm: simpler uint8->float conversions LLVM seems to finds it easier to reason about these than our mantissa-manipulation code. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 3abb19272b..20aa257783 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -178,6 +178,16 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder, assert(dst_type.floating); + /* Special-case int8->float, though most cases could be handled + * this way: + */ + if (src_width == 8) { + scale = 1.0/255.0; + res = LLVMBuildSIToFP(builder, src, vec_type, ""); + res = LLVMBuildFMul(builder, res, lp_build_const_vec(dst_type, scale), ""); + return res; + } + mantissa = lp_mantissa(dst_type); n = MIN2(mantissa, src_width); -- cgit v1.2.3 From aa4cb5e2d8d48c7dcc9653c61a9e25494e3e7b2a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 Oct 2010 15:01:07 +0100 Subject: llvmpipe: try to be sensible about whether to branch after mask updates Don't branch more than once in quick succession. Don't branch at the end of the shader. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 6 +-- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 3 ++ src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 11 +++- src/gallium/drivers/llvmpipe/lp_bld_alpha.c | 6 ++- src/gallium/drivers/llvmpipe/lp_bld_alpha.h | 3 +- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 14 ++++- src/gallium/drivers/llvmpipe/lp_bld_depth.h | 3 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 69 ++++++++++++++++--------- 8 files changed, 80 insertions(+), 35 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index cd5fbc2463..1ec33c742e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -450,7 +450,7 @@ lp_build_flow_skip_end(struct lp_build_flow_context *flow) /** * Check if the mask predicate is zero. If so, jump to the end of the block. */ -static void +void lp_build_mask_check(struct lp_build_mask_context *mask) { LLVMBuilderRef builder = mask->flow->builder; @@ -490,8 +490,6 @@ lp_build_mask_begin(struct lp_build_mask_context *mask, lp_build_flow_scope_begin(flow); lp_build_flow_scope_declare(flow, &mask->value); lp_build_flow_skip_begin(flow); - - lp_build_mask_check(mask); } @@ -505,8 +503,6 @@ lp_build_mask_update(struct lp_build_mask_context *mask, LLVMValueRef value) { mask->value = LLVMBuildAnd( mask->flow->builder, mask->value, value, ""); - - lp_build_mask_check(mask); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index fffb493a93..095c781ec5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -94,6 +94,9 @@ void lp_build_mask_update(struct lp_build_mask_context *mask, LLVMValueRef value); +void +lp_build_mask_check(struct lp_build_mask_context *mask); + LLVMValueRef lp_build_mask_end(struct lp_build_mask_context *mask); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 441aebae29..03020a62f8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -959,8 +959,13 @@ emit_kil( } } - if(mask) + if(mask) { lp_build_mask_update(bld->mask, mask); + + /* XXX: figure out if we are at the end of the shader and skip this: + */ + lp_build_mask_check(bld->mask); + } } @@ -987,6 +992,10 @@ emit_kilp(struct lp_build_tgsi_soa_context *bld, } lp_build_mask_update(bld->mask, mask); + + /* XXX: figure out if we are at the end of the shader and skip this: + */ + lp_build_mask_check(bld->mask); } static void diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c index e28efe778f..e50643790c 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c @@ -48,7 +48,8 @@ lp_build_alpha_test(LLVMBuilderRef builder, struct lp_type type, struct lp_build_mask_context *mask, LLVMValueRef alpha, - LLVMValueRef ref) + LLVMValueRef ref, + boolean do_branch) { struct lp_build_context bld; LLVMValueRef test; @@ -60,4 +61,7 @@ lp_build_alpha_test(LLVMBuilderRef builder, lp_build_name(test, "alpha_mask"); lp_build_mask_update(mask, test); + + if (do_branch) + lp_build_mask_check(mask); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h index 44603b418c..27ca8aad4d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h @@ -48,7 +48,8 @@ lp_build_alpha_test(LLVMBuilderRef builder, struct lp_type type, struct lp_build_mask_context *mask, LLVMValueRef alpha, - LLVMValueRef ref); + LLVMValueRef ref, + boolean do_branch); #endif /* !LP_BLD_ALPHA_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 09b82fbe9b..6b8ffb6ca2 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -462,7 +462,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef z_src, LLVMValueRef zs_dst_ptr, LLVMValueRef face, - LLVMValueRef counter) + LLVMValueRef counter, + boolean do_branch) { struct lp_type type; struct lp_build_context bld; @@ -515,6 +516,9 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, lp_build_mask_update(mask, z_pass); + if (do_branch) + lp_build_mask_check(mask); + /* No need to worry about old stencil contents, just blend the * old and new values and shift into the correct position for * storage. @@ -701,6 +705,11 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, * buffer values. Don't need to update Z buffer values. */ lp_build_mask_update(mask, z_pass); + + if (do_branch) { + lp_build_mask_check(mask); + do_branch = FALSE; + } } if (depth->writemask) { @@ -779,6 +788,9 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, if (depth->enabled && stencil[0].enabled) lp_build_mask_update(mask, z_pass); + if (do_branch) + lp_build_mask_check(mask); + if (counter) lp_build_occlusion_count(builder, type, mask->value, counter); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.h b/src/gallium/drivers/llvmpipe/lp_bld_depth.h index e257a5bd7d..2a63bb9378 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.h @@ -61,7 +61,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef zs_src, LLVMValueRef zs_dst_ptr, LLVMValueRef facing, - LLVMValueRef counter); + LLVMValueRef counter, + boolean do_branch); #endif /* !LP_BLD_DEPTH_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index b7a51cd667..df5dd83c87 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -116,7 +116,8 @@ generate_depth_stencil(LLVMBuilderRef builder, LLVMValueRef src, LLVMValueRef dst_ptr, LLVMValueRef facing, - LLVMValueRef counter) + LLVMValueRef counter, + boolean do_branch) { const struct util_format_description *format_desc; @@ -136,7 +137,8 @@ generate_depth_stencil(LLVMBuilderRef builder, src, dst_ptr, facing, - counter); + counter, + do_branch); } @@ -253,6 +255,9 @@ generate_fs(struct llvmpipe_context *lp, struct lp_build_flow_context *flow; struct lp_build_mask_context mask; boolean early_depth_stencil_test; + boolean simple_shader = (shader->info.file_count[TGSI_FILE_SAMPLER] == 0 && + shader->info.num_inputs < 3 && + shader->info.num_instructions < 8); unsigned attrib; unsigned chan; unsigned cbuf; @@ -288,15 +293,6 @@ generate_fs(struct llvmpipe_context *lp, *pmask = lp_build_const_int_vec(type, ~0); } - /* 'mask' will control execution based on quad's pixel alive/killed state */ - lp_build_mask_begin(&mask, flow, type, *pmask); - - lp_build_interp_soa_update_pos(interp, i); - - /* Try to avoid the 1/w for quads where mask is zero. TODO: avoid - * this for depth-fail quads also. - */ - z = interp->pos[2]; early_depth_stencil_test = (key->depth.enabled || key->stencil[0].enabled) && @@ -304,10 +300,22 @@ generate_fs(struct llvmpipe_context *lp, !shader->info.uses_kill && !shader->info.writes_z; + /* 'mask' will control execution based on quad's pixel alive/killed state */ + lp_build_mask_begin(&mask, flow, type, *pmask); + + if (!early_depth_stencil_test && !simple_shader) + lp_build_mask_check(&mask); + + lp_build_interp_soa_update_pos(interp, i); + z = interp->pos[2]; + if (early_depth_stencil_test) generate_depth_stencil(builder, key, type, &mask, - stencil_refs, z, depth_ptr, facing, counter); + stencil_refs, + z, depth_ptr, + facing, counter, + !simple_shader); lp_build_interp_soa_update_inputs(interp, i); @@ -337,7 +345,7 @@ generate_fs(struct llvmpipe_context *lp, alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr); alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value); lp_build_alpha_test(builder, key->alpha.func, type, - &mask, alpha, alpha_ref_value); + &mask, alpha, alpha_ref_value, FALSE); } LLVMBuildStore(builder, out, color[cbuf][chan]); @@ -356,7 +364,8 @@ generate_fs(struct llvmpipe_context *lp, if (!early_depth_stencil_test) generate_depth_stencil(builder, key, type, &mask, - stencil_refs, z, depth_ptr, facing, counter); + stencil_refs, z, depth_ptr, + facing, counter, FALSE); lp_build_mask_end(&mask); @@ -386,7 +395,8 @@ generate_blend(const struct pipe_blend_state *blend, LLVMValueRef context_ptr, LLVMValueRef mask, LLVMValueRef *src, - LLVMValueRef dst_ptr) + LLVMValueRef dst_ptr, + boolean do_branch) { struct lp_build_context bld; struct lp_build_flow_context *flow; @@ -401,9 +411,9 @@ generate_blend(const struct pipe_blend_state *blend, lp_build_context_init(&bld, builder, type); flow = lp_build_flow_create(builder); - - /* we'll use this mask context to skip blending if all pixels are dead */ lp_build_mask_begin(&mask_ctx, flow, type, mask); + if (do_branch) + lp_build_mask_check(&mask_ctx); vec_type = lp_build_vec_type(type); @@ -670,14 +680,23 @@ generate_fragment(struct llvmpipe_context *lp, /* * Blending. */ - generate_blend(&key->blend, - rt, - builder, - blend_type, - context_ptr, - blend_mask, - blend_in_color, - color_ptr); + { + /* Could the 4x4 have been killed? + */ + boolean do_branch = ((key->depth.enabled || key->stencil[0].enabled) && + !key->alpha.enabled && + !shader->info.uses_kill); + + generate_blend(&key->blend, + rt, + builder, + blend_type, + context_ptr, + blend_mask, + blend_in_color, + color_ptr, + do_branch); + } } #ifdef PIPE_ARCH_X86 -- cgit v1.2.3 From 5b7eb868fde98388d80601d8dea39e679828f42f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 9 Oct 2010 11:28:00 +0100 Subject: llvmpipe: clean up shader pre/postamble, try to catch more early-z Specifically, can do early-depth-test even when alpahtest or kill-pixel are active, providing we defer the actual z write until the final mask is avaialable. Improves demos/fire.c especially in the case where you get close to the trees. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 40 +++-- src/gallium/drivers/llvmpipe/lp_bld_depth.h | 15 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 241 +++++++++++++++++----------- 3 files changed, 193 insertions(+), 103 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 6b8ffb6ca2..8d9be2ebbb 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -410,7 +410,7 @@ get_s_shift_and_mask(const struct util_format_description *format_desc, * \param maskvalue is the depth test mask. * \param counter is a pointer of the uint32 counter. */ -static void +void lp_build_occlusion_count(LLVMBuilderRef builder, struct lp_type type, LLVMValueRef maskvalue, @@ -462,7 +462,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef z_src, LLVMValueRef zs_dst_ptr, LLVMValueRef face, - LLVMValueRef counter, + LLVMValueRef *zs_value, boolean do_branch) { struct lp_type type; @@ -524,17 +524,14 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, * storage. */ if (depth->writemask) { - type.sign = 0; + type.sign = 1; lp_build_context_init(&bld, builder, type); z_dst = lp_build_select(&bld, mask->value, z_src, z_dst); z_dst = LLVMBuildShl(builder, z_dst, const_8_int, "z_dst"); - LLVMBuildStore(builder, z_dst, zs_dst_ptr); + *zs_value = z_dst; } - if (counter) - lp_build_occlusion_count(builder, type, mask->value, counter); - return; } @@ -779,7 +776,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, else zs_dst = stencil_vals; - LLVMBuildStore(builder, zs_dst, zs_dst_ptr); + *zs_value = zs_dst; } if (s_pass_mask) @@ -791,6 +788,29 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, if (do_branch) lp_build_mask_check(mask); - if (counter) - lp_build_occlusion_count(builder, type, mask->value, counter); +} + + + +void +lp_build_deferred_depth_write(LLVMBuilderRef builder, + struct lp_type z_src_type, + const struct util_format_description *format_desc, + struct lp_build_mask_context *mask, + LLVMValueRef zs_dst_ptr, + LLVMValueRef zs_value) +{ + struct lp_type type; + struct lp_build_context bld; + LLVMValueRef z_dst; + + /* XXX: pointlessly redo type logic: + */ + type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length); + lp_build_context_init(&bld, builder, type); + + z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval"); + z_dst = lp_build_select(&bld, mask->value, zs_value, z_dst); + + LLVMBuildStore(builder, z_dst, zs_dst_ptr); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.h b/src/gallium/drivers/llvmpipe/lp_bld_depth.h index 2a63bb9378..0f89668123 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.h @@ -61,8 +61,21 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef zs_src, LLVMValueRef zs_dst_ptr, LLVMValueRef facing, - LLVMValueRef counter, + LLVMValueRef *zs_value, boolean do_branch); +void +lp_build_deferred_depth_write(LLVMBuilderRef builder, + struct lp_type z_src_type, + const struct util_format_description *format_desc, + struct lp_build_mask_context *mask, + LLVMValueRef zs_dst_ptr, + LLVMValueRef zs_value); + +void +lp_build_occlusion_count(LLVMBuilderRef builder, + struct lp_type type, + LLVMValueRef maskvalue, + LLVMValueRef counter); #endif /* !LP_BLD_DEPTH_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index df5dd83c87..f45f36f633 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -104,43 +104,6 @@ static unsigned fs_no = 0; -/** - * Generate the depth /stencil test code. - */ -static void -generate_depth_stencil(LLVMBuilderRef builder, - const struct lp_fragment_shader_variant_key *key, - struct lp_type src_type, - struct lp_build_mask_context *mask, - LLVMValueRef stencil_refs[2], - LLVMValueRef src, - LLVMValueRef dst_ptr, - LLVMValueRef facing, - LLVMValueRef counter, - boolean do_branch) -{ - const struct util_format_description *format_desc; - - if (!key->depth.enabled && !key->stencil[0].enabled && !key->stencil[1].enabled) - return; - - format_desc = util_format_description(key->zsbuf_format); - assert(format_desc); - - lp_build_depth_stencil_test(builder, - &key->depth, - key->stencil, - src_type, - format_desc, - mask, - stencil_refs, - src, - dst_ptr, - facing, - counter, - do_branch); -} - /** * Expand the relevent bits of mask_input to a 4-dword mask for the @@ -222,6 +185,26 @@ generate_quad_mask(LLVMBuilderRef builder, } +#define EARLY_DEPTH_TEST 0x1 +#define LATE_DEPTH_TEST 0x2 +#define EARLY_DEPTH_WRITE 0x4 +#define LATE_DEPTH_WRITE 0x8 + +static int +find_output_by_semantic( const struct tgsi_shader_info *info, + unsigned semantic, + unsigned index ) +{ + int i; + + for (i = 0; i < info->num_outputs; i++) + if (info->output_semantic_name[i] == semantic && + info->output_semantic_index[i] == index) + return i; + + return -1; +} + /** * Generate the fragment shader, depth/stencil test, and alpha tests. @@ -246,21 +229,53 @@ generate_fs(struct llvmpipe_context *lp, LLVMValueRef mask_input, LLVMValueRef counter) { + const struct util_format_description *zs_format_desc = NULL; const struct tgsi_token *tokens = shader->base.tokens; LLVMTypeRef vec_type; LLVMValueRef consts_ptr; LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS]; LLVMValueRef z; + LLVMValueRef zs_value = NULL; LLVMValueRef stencil_refs[2]; struct lp_build_flow_context *flow; struct lp_build_mask_context mask; - boolean early_depth_stencil_test; boolean simple_shader = (shader->info.file_count[TGSI_FILE_SAMPLER] == 0 && shader->info.num_inputs < 3 && shader->info.num_instructions < 8); unsigned attrib; unsigned chan; unsigned cbuf; + unsigned depth_mode; + + if (key->depth.enabled || + key->stencil[0].enabled || + key->stencil[1].enabled) { + + zs_format_desc = util_format_description(key->zsbuf_format); + assert(zs_format_desc); + + if (!shader->info.writes_z) { + if (key->alpha.enabled || shader->info.uses_kill) + /* With alpha test and kill, can do the depth test early + * and hopefully eliminate some quads. But need to do a + * special deferred depth write once the final mask value + * is known. + */ + depth_mode = EARLY_DEPTH_TEST | LATE_DEPTH_WRITE; + else + depth_mode = EARLY_DEPTH_TEST | EARLY_DEPTH_WRITE; + } + else { + depth_mode = LATE_DEPTH_TEST | LATE_DEPTH_WRITE; + } + + if (!(key->depth.enabled && key->depth.writemask) && + !(key->stencil[0].enabled && key->stencil[0].writemask)) + depth_mode &= ~(LATE_DEPTH_WRITE | EARLY_DEPTH_WRITE); + } + else { + depth_mode = 0; + } assert(i < 4); @@ -293,79 +308,121 @@ generate_fs(struct llvmpipe_context *lp, *pmask = lp_build_const_int_vec(type, ~0); } - - early_depth_stencil_test = - (key->depth.enabled || key->stencil[0].enabled) && - !key->alpha.enabled && - !shader->info.uses_kill && - !shader->info.writes_z; - /* 'mask' will control execution based on quad's pixel alive/killed state */ lp_build_mask_begin(&mask, flow, type, *pmask); - if (!early_depth_stencil_test && !simple_shader) + if (!(depth_mode & EARLY_DEPTH_TEST) && !simple_shader) lp_build_mask_check(&mask); lp_build_interp_soa_update_pos(interp, i); z = interp->pos[2]; - if (early_depth_stencil_test) - generate_depth_stencil(builder, key, - type, &mask, - stencil_refs, - z, depth_ptr, - facing, counter, - !simple_shader); + if (depth_mode & EARLY_DEPTH_TEST) { + lp_build_depth_stencil_test(builder, + &key->depth, + key->stencil, + type, + zs_format_desc, + &mask, + stencil_refs, + z, + depth_ptr, facing, + &zs_value, + !simple_shader); + + if (depth_mode & EARLY_DEPTH_WRITE) + LLVMBuildStore(builder, zs_value, depth_ptr); + } lp_build_interp_soa_update_inputs(interp, i); - + + /* Build the actual shader */ lp_build_tgsi_soa(builder, tokens, type, &mask, consts_ptr, interp->pos, interp->inputs, outputs, sampler, &shader->info); - /* loop over fragment shader outputs/results */ - for (attrib = 0; attrib < shader->info.num_outputs; ++attrib) { - for(chan = 0; chan < NUM_CHANNELS; ++chan) { - if(outputs[attrib][chan]) { + + /* Alpha test */ + if (key->alpha.enabled) { + int color0 = find_output_by_semantic(&shader->info, + TGSI_SEMANTIC_COLOR, + 0); + + if (color0 != -1) { + LLVMValueRef alpha = LLVMBuildLoad(builder, outputs[color0][3], "alpha"); + LLVMValueRef alpha_ref_value; + + alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr); + alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value); + + lp_build_alpha_test(builder, key->alpha.func, type, + &mask, alpha, alpha_ref_value, + (depth_mode & LATE_DEPTH_TEST) != 0); + } + } + + /* Late Z test */ + if (depth_mode & LATE_DEPTH_TEST) { + int pos0 = find_output_by_semantic(&shader->info, + TGSI_SEMANTIC_POSITION, + 0); + + if (pos0 != -1) { + z = LLVMBuildLoad(builder, outputs[pos0][2], "z"); + lp_build_name(z, "output%u.%u.%c", i, pos0, "xyzw"[chan]); + } + + lp_build_depth_stencil_test(builder, + &key->depth, + key->stencil, + type, + zs_format_desc, + &mask, + stencil_refs, + z, + depth_ptr, facing, + &zs_value, + !simple_shader); + /* Late Z write */ + if (depth_mode & LATE_DEPTH_WRITE) + LLVMBuildStore(builder, zs_value, depth_ptr); + } + else if ((depth_mode & EARLY_DEPTH_TEST) && + (depth_mode & LATE_DEPTH_WRITE)) + { + /* Need to apply a reduced mask to the depth write. Reload the + * depth value, update from zs_value with the new mask value and + * write that out. + */ + lp_build_deferred_depth_write(builder, + type, + zs_format_desc, + &mask, + depth_ptr, + zs_value); + } + + + /* Color write */ + for (attrib = 0; attrib < shader->info.num_outputs; ++attrib) + { + if (shader->info.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) + { + unsigned cbuf = shader->info.output_semantic_index[attrib]; + for(chan = 0; chan < NUM_CHANNELS; ++chan) + { + /* XXX: just initialize outputs to point at colors[] and + * skip this. + */ LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], ""); - lp_build_name(out, "output%u.%u.%c", i, attrib, "xyzw"[chan]); - - switch (shader->info.output_semantic_name[attrib]) { - case TGSI_SEMANTIC_COLOR: - { - unsigned cbuf = shader->info.output_semantic_index[attrib]; - - lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]); - - /* Alpha test */ - /* XXX: should only test the final assignment to alpha */ - if (cbuf == 0 && chan == 3 && key->alpha.enabled) { - LLVMValueRef alpha = out; - LLVMValueRef alpha_ref_value; - alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr); - alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value); - lp_build_alpha_test(builder, key->alpha.func, type, - &mask, alpha, alpha_ref_value, FALSE); - } - - LLVMBuildStore(builder, out, color[cbuf][chan]); - break; - } - - case TGSI_SEMANTIC_POSITION: - if(chan == 2) - z = out; - break; - } + lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]); + LLVMBuildStore(builder, out, color[cbuf][chan]); } } } - if (!early_depth_stencil_test) - generate_depth_stencil(builder, key, - type, &mask, - stencil_refs, z, depth_ptr, - facing, counter, FALSE); + if (counter) + lp_build_occlusion_count(builder, type, mask.value, counter); lp_build_mask_end(&mask); -- cgit v1.2.3 From 2de720dc8ff89676aa7bb5eb74aeb6d44e028fa2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 1 Oct 2010 15:13:51 +0100 Subject: llvmpipe: simplified SSE2 swz/unswz routines We've been using these in the linear path for a while now. Based on Chris's SSSE3 code, but using only sse2 opcodes. Speed seems to be identical, but code is simpler & removes dependency on SSE3. Should be easier to extend to other rgba8 formats. --- src/gallium/drivers/llvmpipe/SConscript | 8 +- src/gallium/drivers/llvmpipe/lp_tile_soa.py | 245 ++++++++++++---------------- 2 files changed, 107 insertions(+), 146 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 650435f0f1..774ad91a07 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -27,13 +27,7 @@ env.Depends('lp_tile_soa.c', [ ]) -# Only enable SSSE3 for lp_tile_soa_sse3.c -ssse3_env = env.Clone() -if env['gcc'] \ - and distutils.version.LooseVersion(env['CCVERSION']) >= distutils.version.LooseVersion('4.3') \ - and env['machine'] in ('x86', 'x86_64') : - ssse3_env.Append(CCFLAGS = ['-mssse3']) -lp_tile_soa_os = ssse3_env.SharedObject('lp_tile_soa.c') +lp_tile_soa_os = env.SharedObject('lp_tile_soa.c') llvmpipe = env.ConvenienceLibrary( diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py index 2ba39052ab..c76549cdad 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py +++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py @@ -295,87 +295,98 @@ def generate_ssse3(): #include "util/u_sse.h" +static INLINE void swz4( __m128i x, + __m128i y, + __m128i z, + __m128i w, + __m128i *a, + __m128i *b, + __m128i *c, + __m128i *d) +{ + __m128i i, j, k, l; + __m128i m, n, o, p; + __m128i e, f, g, h; + + m = _mm_unpacklo_epi8(x,y); + n = _mm_unpackhi_epi8(x,y); + o = _mm_unpacklo_epi8(z,w); + p = _mm_unpackhi_epi8(z,w); + + i = _mm_unpacklo_epi16(m,n); + j = _mm_unpackhi_epi16(m,n); + k = _mm_unpacklo_epi16(o,p); + l = _mm_unpackhi_epi16(o,p); + + e = _mm_unpacklo_epi8(i,j); + f = _mm_unpackhi_epi8(i,j); + g = _mm_unpacklo_epi8(k,l); + h = _mm_unpackhi_epi8(k,l); + + *a = _mm_unpacklo_epi64(e,g); + *b = _mm_unpackhi_epi64(e,g); + *c = _mm_unpacklo_epi64(f,h); + *d = _mm_unpackhi_epi64(f,h); +} + +static INLINE void unswz4( __m128i a, + __m128i b, + __m128i c, + __m128i d, + __m128i *x, + __m128i *y, + __m128i *z, + __m128i *w) +{ + __m128i i, j, k, l; + __m128i m, n, o, p; + + i = _mm_unpacklo_epi8(a,b); + j = _mm_unpackhi_epi8(a,b); + k = _mm_unpacklo_epi8(c,d); + l = _mm_unpackhi_epi8(c,d); + + m = _mm_unpacklo_epi16(i,k); + n = _mm_unpackhi_epi16(i,k); + o = _mm_unpacklo_epi16(j,l); + p = _mm_unpackhi_epi16(j,l); + + *x = _mm_unpacklo_epi64(m,n); + *y = _mm_unpackhi_epi64(m,n); + *z = _mm_unpacklo_epi64(o,p); + *w = _mm_unpackhi_epi64(o,p); +} + static void lp_tile_b8g8r8a8_unorm_swizzle_4ub_ssse3(uint8_t *dst, const uint8_t *src, unsigned src_stride, unsigned x0, unsigned y0) { - + __m128i *dst128 = (__m128i *) dst; unsigned x, y; - __m128i *pdst = (__m128i*) dst; - const uint8_t *ysrc0 = src + y0*src_stride + x0*sizeof(uint32_t); - unsigned int tile_stridex = src_stride*(TILE_VECTOR_HEIGHT - 1) - sizeof(uint32_t)*TILE_VECTOR_WIDTH; - unsigned int tile_stridey = src_stride*TILE_VECTOR_HEIGHT; - - const __m128i shuffle00 = _mm_setr_epi8(0x02,0x06,0xff,0xff,0x0a,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - const __m128i shuffle01 = _mm_setr_epi8(0x01,0x05,0xff,0xff,0x09,0x0d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - const __m128i shuffle02 = _mm_setr_epi8(0x00,0x04,0xff,0xff,0x08,0x0c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - const __m128i shuffle03 = _mm_setr_epi8(0x03,0x07,0xff,0xff,0x0b,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - - const __m128i shuffle10 = _mm_setr_epi8(0xff,0xff,0x02,0x06,0xff,0xff,0x0a,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - const __m128i shuffle11 = _mm_setr_epi8(0xff,0xff,0x01,0x05,0xff,0xff,0x09,0x0d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - const __m128i shuffle12 = _mm_setr_epi8(0xff,0xff,0x00,0x04,0xff,0xff,0x08,0x0c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - const __m128i shuffle13 = _mm_setr_epi8(0xff,0xff,0x03,0x07,0xff,0xff,0x0b,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff); - - const __m128i shuffle20 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x02,0x06,0xff,0xff,0x0a,0x0e,0xff,0xff); - const __m128i shuffle21 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x05,0xff,0xff,0x09,0x0d,0xff,0xff); - const __m128i shuffle22 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x04,0xff,0xff,0x08,0x0c,0xff,0xff); - const __m128i shuffle23 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x07,0xff,0xff,0x0b,0x0f,0xff,0xff); - - const __m128i shuffle30 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x02,0x06,0xff,0xff,0x0a,0x0e); - const __m128i shuffle31 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x05,0xff,0xff,0x09,0x0d); - const __m128i shuffle32 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x04,0xff,0xff,0x08,0x0c); - const __m128i shuffle33 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x07,0xff,0xff,0x0b,0x0f); - - for (y = 0; y < TILE_SIZE; y += TILE_VECTOR_HEIGHT) { - __m128i line0 = *(__m128i*)ysrc0; - const uint8_t *ysrc = ysrc0 + src_stride; - ysrc0 += tile_stridey; - - for (x = 0; x < TILE_SIZE; x += TILE_VECTOR_WIDTH) { - __m128i r, g, b, a, line1; - line1 = *(__m128i*)ysrc; - PIPE_READ_WRITE_BARRIER(); - ysrc += src_stride; - r = _mm_shuffle_epi8(line0, shuffle00); - g = _mm_shuffle_epi8(line0, shuffle01); - b = _mm_shuffle_epi8(line0, shuffle02); - a = _mm_shuffle_epi8(line0, shuffle03); - - line0 = *(__m128i*)ysrc; - PIPE_READ_WRITE_BARRIER(); - ysrc += src_stride; - r = _mm_or_si128(r, _mm_shuffle_epi8(line1, shuffle10)); - g = _mm_or_si128(g, _mm_shuffle_epi8(line1, shuffle11)); - b = _mm_or_si128(b, _mm_shuffle_epi8(line1, shuffle12)); - a = _mm_or_si128(a, _mm_shuffle_epi8(line1, shuffle13)); - - line1 = *(__m128i*)ysrc; - PIPE_READ_WRITE_BARRIER(); - ysrc -= tile_stridex; - r = _mm_or_si128(r, _mm_shuffle_epi8(line0, shuffle20)); - g = _mm_or_si128(g, _mm_shuffle_epi8(line0, shuffle21)); - b = _mm_or_si128(b, _mm_shuffle_epi8(line0, shuffle22)); - a = _mm_or_si128(a, _mm_shuffle_epi8(line0, shuffle23)); - - if (x + 1 < TILE_SIZE) { - line0 = *(__m128i*)ysrc; - ysrc += src_stride; - } - - PIPE_READ_WRITE_BARRIER(); - r = _mm_or_si128(r, _mm_shuffle_epi8(line1, shuffle30)); - g = _mm_or_si128(g, _mm_shuffle_epi8(line1, shuffle31)); - b = _mm_or_si128(b, _mm_shuffle_epi8(line1, shuffle32)); - a = _mm_or_si128(a, _mm_shuffle_epi8(line1, shuffle33)); - - *pdst++ = r; - *pdst++ = g; - *pdst++ = b; - *pdst++ = a; + + src += y0 * src_stride; + src += x0 * sizeof(uint32_t); + + for (y = 0; y < TILE_SIZE; y += 4) { + const uint8_t *src_row = src; + + for (x = 0; x < TILE_SIZE; x += 4) { + swz4(*(__m128i *) (src_row + 0 * src_stride), + *(__m128i *) (src_row + 1 * src_stride), + *(__m128i *) (src_row + 2 * src_stride), + *(__m128i *) (src_row + 3 * src_stride), + dst128 + 2, /* b */ + dst128 + 1, /* g */ + dst128 + 0, /* r */ + dst128 + 3); /* a */ + + dst128 += 4; + src_row += sizeof(__m128i); } - } + src += 4 * src_stride; + } } static void @@ -384,73 +395,29 @@ lp_tile_b8g8r8a8_unorm_unswizzle_4ub_ssse3(const uint8_t *src, unsigned x0, unsigned y0) { unsigned int x, y; - const __m128i *psrc = (__m128i*) src; - const __m128i *end = (__m128i*) (src + (y0 + TILE_SIZE - 1)*dst_stride + (x0 + TILE_SIZE - 1)*sizeof(uint32_t)); - uint8_t *pdst = dst + y0 * dst_stride + x0 * sizeof(uint32_t); - __m128i c0 = *psrc++; - __m128i c1; - - const __m128i shuffle00 = _mm_setr_epi8(0xff,0xff,0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05,0xff); - const __m128i shuffle01 = _mm_setr_epi8(0xff,0xff,0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07,0xff); - const __m128i shuffle02 = _mm_setr_epi8(0xff,0xff,0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d,0xff); - const __m128i shuffle03 = _mm_setr_epi8(0xff,0xff,0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f,0xff); - - const __m128i shuffle10 = _mm_setr_epi8(0xff,0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05,0xff,0xff); - const __m128i shuffle11 = _mm_setr_epi8(0xff,0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07,0xff,0xff); - const __m128i shuffle12 = _mm_setr_epi8(0xff,0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d,0xff,0xff); - const __m128i shuffle13 = _mm_setr_epi8(0xff,0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f,0xff,0xff); - - const __m128i shuffle20 = _mm_setr_epi8(0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05,0xff,0xff,0xff); - const __m128i shuffle21 = _mm_setr_epi8(0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07,0xff,0xff,0xff); - const __m128i shuffle22 = _mm_setr_epi8(0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d,0xff,0xff,0xff); - const __m128i shuffle23 = _mm_setr_epi8(0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f,0xff,0xff,0xff); - - const __m128i shuffle30 = _mm_setr_epi8(0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05); - const __m128i shuffle31 = _mm_setr_epi8(0xff,0xff,0xff,0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07); - const __m128i shuffle32 = _mm_setr_epi8(0xff,0xff,0xff,0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d); - const __m128i shuffle33 = _mm_setr_epi8(0xff,0xff,0xff,0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f); - - for (y = 0; y < TILE_SIZE; y += TILE_VECTOR_HEIGHT) { - __m128i *tile = (__m128i*) pdst; - pdst += dst_stride * TILE_VECTOR_HEIGHT; - for (x = 0; x < TILE_SIZE; x += TILE_VECTOR_WIDTH) { - uint8_t *linep = (uint8_t*) (tile++); - __m128i line0, line1, line2, line3; - - c1 = *psrc++; /* r */ - PIPE_READ_WRITE_BARRIER(); - line0 = _mm_shuffle_epi8(c0, shuffle00); - line1 = _mm_shuffle_epi8(c0, shuffle01); - line2 = _mm_shuffle_epi8(c0, shuffle02); - line3 = _mm_shuffle_epi8(c0, shuffle03); - - c0 = *psrc++; /* g */ - PIPE_READ_WRITE_BARRIER(); - line0 = _mm_or_si128(line0, _mm_shuffle_epi8(c1, shuffle10)); - line1 = _mm_or_si128(line1, _mm_shuffle_epi8(c1, shuffle11)); - line2 = _mm_or_si128(line2, _mm_shuffle_epi8(c1, shuffle12)); - line3 = _mm_or_si128(line3, _mm_shuffle_epi8(c1, shuffle13)); - - c1 = *psrc++; /* b */ - PIPE_READ_WRITE_BARRIER(); - line0 = _mm_or_si128(line0, _mm_shuffle_epi8(c0, shuffle20)); - line1 = _mm_or_si128(line1, _mm_shuffle_epi8(c0, shuffle21)); - line2 = _mm_or_si128(line2, _mm_shuffle_epi8(c0, shuffle22)); - line3 = _mm_or_si128(line3, _mm_shuffle_epi8(c0, shuffle23)); - - if (psrc != end) - c0 = *psrc++; /* a */ - PIPE_READ_WRITE_BARRIER(); - line0 = _mm_or_si128(line0, _mm_shuffle_epi8(c1, shuffle30)); - line1 = _mm_or_si128(line1, _mm_shuffle_epi8(c1, shuffle31)); - line2 = _mm_or_si128(line2, _mm_shuffle_epi8(c1, shuffle32)); - line3 = _mm_or_si128(line3, _mm_shuffle_epi8(c1, shuffle33)); - - *(__m128i*) (linep) = line0; - *(__m128i*) (((char*)linep) + dst_stride) = line1; - *(__m128i*) (((char*)linep) + 2 * dst_stride) = line2; - *(__m128i*) (((char*)linep) + 3 * dst_stride) = line3; + const __m128i *src128 = (const __m128i *) src; + + dst += y0 * dst_stride; + dst += x0 * sizeof(uint32_t); + + for (y = 0; y < TILE_SIZE; y += 4) { + const uint8_t *dst_row = dst; + + for (x = 0; x < TILE_SIZE; x += 4) { + unswz4( src128[2], /* b */ + src128[1], /* g */ + src128[0], /* r */ + src128[3], /* a */ + (__m128i *) (dst_row + 0 * dst_stride), + (__m128i *) (dst_row + 1 * dst_stride), + (__m128i *) (dst_row + 2 * dst_stride), + (__m128i *) (dst_row + 3 * dst_stride)); + + src128 += 4; + dst_row += sizeof(__m128i);; } + + dst += 4 * dst_stride; } } -- cgit v1.2.3 From edba53024f85a27fcbca7cbe139ceda172406653 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 Oct 2010 21:01:38 +0100 Subject: llvmpipe: Fix MSVC build. Enable the new SSE2 code on non SSE3 systems. --- src/gallium/drivers/llvmpipe/lp_tile_soa.py | 86 +++++++++++++++-------------- 1 file changed, 44 insertions(+), 42 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py index c76549cdad..e49f9c62fe 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py +++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py @@ -289,29 +289,30 @@ def generate_format_write(format, src_channel, src_native_type, src_suffix): print -def generate_ssse3(): +def generate_sse2(): print ''' #if defined(PIPE_ARCH_SSE) #include "util/u_sse.h" -static INLINE void swz4( __m128i x, - __m128i y, - __m128i z, - __m128i w, - __m128i *a, - __m128i *b, - __m128i *c, - __m128i *d) +static ALWAYS_INLINE void +swz4( const __m128i * restrict x, + const __m128i * restrict y, + const __m128i * restrict z, + const __m128i * restrict w, + __m128i * restrict a, + __m128i * restrict b, + __m128i * restrict c, + __m128i * restrict d) { __m128i i, j, k, l; __m128i m, n, o, p; __m128i e, f, g, h; - m = _mm_unpacklo_epi8(x,y); - n = _mm_unpackhi_epi8(x,y); - o = _mm_unpacklo_epi8(z,w); - p = _mm_unpackhi_epi8(z,w); + m = _mm_unpacklo_epi8(*x,*y); + n = _mm_unpackhi_epi8(*x,*y); + o = _mm_unpacklo_epi8(*z,*w); + p = _mm_unpackhi_epi8(*z,*w); i = _mm_unpacklo_epi16(m,n); j = _mm_unpackhi_epi16(m,n); @@ -329,22 +330,23 @@ static INLINE void swz4( __m128i x, *d = _mm_unpackhi_epi64(f,h); } -static INLINE void unswz4( __m128i a, - __m128i b, - __m128i c, - __m128i d, - __m128i *x, - __m128i *y, - __m128i *z, - __m128i *w) +static ALWAYS_INLINE void +unswz4( const __m128i * restrict a, + const __m128i * restrict b, + const __m128i * restrict c, + const __m128i * restrict d, + __m128i * restrict x, + __m128i * restrict y, + __m128i * restrict z, + __m128i * restrict w) { __m128i i, j, k, l; __m128i m, n, o, p; - i = _mm_unpacklo_epi8(a,b); - j = _mm_unpackhi_epi8(a,b); - k = _mm_unpacklo_epi8(c,d); - l = _mm_unpackhi_epi8(c,d); + i = _mm_unpacklo_epi8(*a,*b); + j = _mm_unpackhi_epi8(*a,*b); + k = _mm_unpacklo_epi8(*c,*d); + l = _mm_unpackhi_epi8(*c,*d); m = _mm_unpacklo_epi16(i,k); n = _mm_unpackhi_epi16(i,k); @@ -358,9 +360,9 @@ static INLINE void unswz4( __m128i a, } static void -lp_tile_b8g8r8a8_unorm_swizzle_4ub_ssse3(uint8_t *dst, - const uint8_t *src, unsigned src_stride, - unsigned x0, unsigned y0) +lp_tile_b8g8r8a8_unorm_swizzle_4ub_sse2(uint8_t * restrict dst, + const uint8_t * restrict src, unsigned src_stride, + unsigned x0, unsigned y0) { __m128i *dst128 = (__m128i *) dst; unsigned x, y; @@ -372,10 +374,10 @@ lp_tile_b8g8r8a8_unorm_swizzle_4ub_ssse3(uint8_t *dst, const uint8_t *src_row = src; for (x = 0; x < TILE_SIZE; x += 4) { - swz4(*(__m128i *) (src_row + 0 * src_stride), - *(__m128i *) (src_row + 1 * src_stride), - *(__m128i *) (src_row + 2 * src_stride), - *(__m128i *) (src_row + 3 * src_stride), + swz4((const __m128i *) (src_row + 0 * src_stride), + (const __m128i *) (src_row + 1 * src_stride), + (const __m128i *) (src_row + 2 * src_stride), + (const __m128i *) (src_row + 3 * src_stride), dst128 + 2, /* b */ dst128 + 1, /* g */ dst128 + 0, /* r */ @@ -390,8 +392,8 @@ lp_tile_b8g8r8a8_unorm_swizzle_4ub_ssse3(uint8_t *dst, } static void -lp_tile_b8g8r8a8_unorm_unswizzle_4ub_ssse3(const uint8_t *src, - uint8_t *dst, unsigned dst_stride, +lp_tile_b8g8r8a8_unorm_unswizzle_4ub_sse2(const uint8_t * restrict src, + uint8_t * restrict dst, unsigned dst_stride, unsigned x0, unsigned y0) { unsigned int x, y; @@ -404,10 +406,10 @@ lp_tile_b8g8r8a8_unorm_unswizzle_4ub_ssse3(const uint8_t *src, const uint8_t *dst_row = dst; for (x = 0; x < TILE_SIZE; x += 4) { - unswz4( src128[2], /* b */ - src128[1], /* g */ - src128[0], /* r */ - src128[3], /* a */ + unswz4( &src128[2], /* b */ + &src128[1], /* g */ + &src128[0], /* r */ + &src128[3], /* a */ (__m128i *) (dst_row + 0 * dst_stride), (__m128i *) (dst_row + 1 * dst_stride), (__m128i *) (dst_row + 2 * dst_stride), @@ -421,7 +423,7 @@ lp_tile_b8g8r8a8_unorm_unswizzle_4ub_ssse3(const uint8_t *src, } } -#endif /* PIPE_ARCH_SSSE3 */ +#endif /* PIPE_ARCH_SSE */ ''' @@ -446,7 +448,7 @@ def generate_swizzle(formats, dst_channel, dst_native_type, dst_suffix): func_name = 'lp_tile_%s_swizzle_%s' % (format.short_name(), dst_suffix) if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM': print '#ifdef PIPE_ARCH_SSE' - print ' func = util_cpu_caps.has_ssse3 ? %s_ssse3 : %s;' % (func_name, func_name) + print ' func = util_cpu_caps.has_sse2 ? %s_sse2 : %s;' % (func_name, func_name) print '#else' print ' func = %s;' % (func_name,) print '#endif' @@ -484,7 +486,7 @@ def generate_unswizzle(formats, src_channel, src_native_type, src_suffix): func_name = 'lp_tile_%s_unswizzle_%s' % (format.short_name(), src_suffix) if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM': print '#ifdef PIPE_ARCH_SSE' - print ' func = util_cpu_caps.has_ssse3 ? %s_ssse3 : %s;' % (func_name, func_name) + print ' func = util_cpu_caps.has_sse2 ? %s_sse2 : %s;' % (func_name, func_name) print '#else' print ' func = %s;' % (func_name,) print '#endif' @@ -544,7 +546,7 @@ def main(): print '};' print - generate_ssse3() + generate_sse2() channel = Channel(UNSIGNED, True, 8) native_type = 'uint8_t' -- cgit v1.2.3 From 53d7f5e107b82550024a57232f3333d2f76e39de Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 12:08:25 +0100 Subject: gallivm: Handle code have ret correctly. Stop disassembling on unconditional backwards jumps. --- src/gallium/auxiliary/gallivm/lp_bld_debug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.c b/src/gallium/auxiliary/gallivm/lp_bld_debug.c index d3a5afff8c..8c1df0d8e3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.c @@ -115,8 +115,10 @@ lp_disassemble(const void* func) } } - if ((ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret) || - ud_obj.mnemonic == UD_Iinvalid) + if (ud_obj.mnemonic == UD_Iinvalid || + (ud_insn_off(&ud_obj) >= max_jmp_pc && + (ud_obj.mnemonic == UD_Iret || + ud_obj.mnemonic == UD_Ijmp))) break; } -- cgit v1.2.3 From 52427f0ba703f933b70d669ae565c7aeb733236d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 12:10:07 +0100 Subject: util: Defined M_SQRT2 when not available. --- src/gallium/auxiliary/util/u_math.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 69a7681494..37294b7203 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -118,6 +118,11 @@ __inline double __cdecl atan2(double val) #endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 +#endif + + #if defined(_MSC_VER) #if _MSC_VER < 1400 && !defined(__cplusplus) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) -- cgit v1.2.3 From 81a09c8a975ec1e727a7863823e39549c5096746 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 12:11:20 +0100 Subject: gallivm: Less code duplication in log computation. --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 113 +++++++++++++++++++--------- src/gallium/auxiliary/gallivm/lp_bld_arit.h | 10 ++- 2 files changed, 88 insertions(+), 35 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 6ab13506e1..2c049d0293 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -2261,6 +2261,71 @@ lp_build_exp2(struct lp_build_context *bld, } +/** + * Extract the exponent of a IEEE-754 floating point value. + * + * Optionally apply an integer bias. + * + * Result is an integer value with + * + * ifloor(log2(x)) + bias + */ +LLVMValueRef +lp_build_extract_exponent(struct lp_build_context *bld, + LLVMValueRef x, + int bias) +{ + const struct lp_type type = bld->type; + unsigned mantissa = lp_mantissa(type); + LLVMValueRef res; + + assert(type.floating); + + assert(lp_check_value(bld->type, x)); + + x = LLVMBuildBitCast(bld->builder, x, bld->int_vec_type, ""); + + res = LLVMBuildLShr(bld->builder, x, lp_build_const_int_vec(type, mantissa), ""); + res = LLVMBuildAnd(bld->builder, res, lp_build_const_int_vec(type, 255), ""); + res = LLVMBuildSub(bld->builder, res, lp_build_const_int_vec(type, 127 - bias), ""); + + return res; +} + + +/** + * Extract the mantissa of the a floating. + * + * Result is a floating point value with + * + * x / floor(log2(x)) + */ +LLVMValueRef +lp_build_extract_mantissa(struct lp_build_context *bld, + LLVMValueRef x) +{ + const struct lp_type type = bld->type; + unsigned mantissa = lp_mantissa(type); + LLVMValueRef mantmask = lp_build_const_int_vec(type, (1ULL << mantissa) - 1); + LLVMValueRef one = LLVMConstBitCast(bld->one, bld->int_vec_type); + LLVMValueRef res; + + assert(lp_check_value(bld->type, x)); + + assert(type.floating); + + x = LLVMBuildBitCast(bld->builder, x, bld->int_vec_type, ""); + + /* res = x / 2**ipart */ + res = LLVMBuildAnd(bld->builder, x, mantmask, ""); + res = LLVMBuildOr(bld->builder, res, one, ""); + res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, ""); + + return res; +} + + + /** * Minimax polynomial fit of log2(x)/(x - 1), for x in range [1, 2[ * These coefficients can be generate with @@ -2385,7 +2450,10 @@ lp_build_log2(struct lp_build_context *bld, /** * Faster (and less accurate) log2. * - * log2(x) = floor(log2(x)) + frac(x) + * log2(x) = floor(log2(x)) - 1 + x / 2**floor(log2(x)) + * + * Piece-wise linear approximation, with exact results when x is a + * power of two. * * See http://www.flipcode.com/archives/Fast_log_Function.shtml */ @@ -2393,35 +2461,21 @@ 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, ""); + assert(bld->type.floating); /* 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, ""); + ipart = lp_build_extract_exponent(bld, x, -1); + ipart = LLVMBuildSIToFP(bld->builder, ipart, bld->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, ""); + /* fpart = x / 2**ipart */ + fpart = lp_build_extract_mantissa(bld, x); - /* floor(log2(x)) + frac(x) */ + /* ipart + fpart */ return LLVMBuildFAdd(bld->builder, ipart, fpart, ""); } @@ -2435,27 +2489,18 @@ 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 sqrt2 = lp_build_const_vec(bld->type, M_SQRT2); LLVMValueRef ipart; - assert(lp_check_value(bld->type, x)); + assert(bld->type.floating); - assert(type.floating); + assert(lp_check_value(bld->type, x)); /* 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), ""); + ipart = lp_build_extract_exponent(bld, x, 0); return ipart; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index 8424384f8f..c78b61decf 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -214,6 +214,15 @@ LLVMValueRef lp_build_exp2(struct lp_build_context *bld, LLVMValueRef a); +LLVMValueRef +lp_build_extract_exponent(struct lp_build_context *bld, + LLVMValueRef x, + int bias); + +LLVMValueRef +lp_build_extract_mantissa(struct lp_build_context *bld, + LLVMValueRef x); + LLVMValueRef lp_build_log2(struct lp_build_context *bld, LLVMValueRef a); @@ -226,7 +235,6 @@ LLVMValueRef lp_build_ilog2(struct lp_build_context *bld, LLVMValueRef x); - void lp_build_exp2_approx(struct lp_build_context *bld, LLVMValueRef x, -- cgit v1.2.3 From 679dd26623a53b5a052845bf4c6aef224cfdd5a2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 12:12:03 +0100 Subject: gallivm: Special bri-linear computation path for unmodified rho. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 111 +++++++++++++++++++++----- 1 file changed, 91 insertions(+), 20 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 5bc3c263a0..43ea8b1a14 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -294,31 +294,30 @@ lp_build_rho(struct lp_build_sample_context *bld, * TODO: This could be done in fixed point, where applicable. */ static void -lp_build_brilinear_lod(struct lp_build_sample_context *bld, +lp_build_brilinear_lod(struct lp_build_context *bld, LLVMValueRef lod, double factor, LLVMValueRef *out_lod_ipart, LLVMValueRef *out_lod_fpart) { - struct lp_build_context *float_bld = &bld->float_bld; LLVMValueRef lod_fpart; - float pre_offset = (factor - 0.5)/factor - 0.5; - float post_offset = 1 - factor; + double pre_offset = (factor - 0.5)/factor - 0.5; + double post_offset = 1 - factor; if (0) { lp_build_printf(bld->builder, "lod = %f\n", lod); } - lod = lp_build_add(float_bld, lod, - lp_build_const_vec(float_bld->type, pre_offset)); + lod = lp_build_add(bld, lod, + lp_build_const_vec(bld->type, pre_offset)); - lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, &lod_fpart); + lp_build_ifloor_fract(bld, lod, out_lod_ipart, &lod_fpart); - lod_fpart = lp_build_mul(float_bld, lod_fpart, - lp_build_const_vec(float_bld->type, factor)); + lod_fpart = lp_build_mul(bld, lod_fpart, + lp_build_const_vec(bld->type, factor)); - lod_fpart = lp_build_add(float_bld, lod_fpart, - lp_build_const_vec(float_bld->type, post_offset)); + lod_fpart = lp_build_add(bld, lod_fpart, + lp_build_const_vec(bld->type, post_offset)); /* * It's not necessary to clamp lod_fpart since: @@ -335,6 +334,61 @@ lp_build_brilinear_lod(struct lp_build_sample_context *bld, } +/* + * Combined log2 and brilinear lod computation. + * + * It's in all identical to calling lp_build_fast_log2() and + * lp_build_brilinear_lod() above, but by combining we can compute the interger + * and fractional part independently. + */ +static void +lp_build_brilinear_rho(struct lp_build_context *bld, + LLVMValueRef rho, + double factor, + LLVMValueRef *out_lod_ipart, + LLVMValueRef *out_lod_fpart) +{ + LLVMValueRef lod_ipart; + LLVMValueRef lod_fpart; + + const double pre_factor = (2*factor - 0.5)/(M_SQRT2*factor); + const double post_offset = 1 - 2*factor; + + assert(bld->type.floating); + + assert(lp_check_value(bld->type, rho)); + + /* + * The pre factor will make the intersections with the exact powers of two + * happen precisely where we want then to be, which means that the integer + * part will not need any post adjustments. + */ + rho = lp_build_mul(bld, rho, + lp_build_const_vec(bld->type, pre_factor)); + + /* ipart = ifloor(log2(rho)) */ + lod_ipart = lp_build_extract_exponent(bld, rho, 0); + + /* fpart = rho / 2**ipart */ + lod_fpart = lp_build_extract_mantissa(bld, rho); + + lod_fpart = lp_build_mul(bld, lod_fpart, + lp_build_const_vec(bld->type, factor)); + + lod_fpart = lp_build_add(bld, lod_fpart, + lp_build_const_vec(bld->type, post_offset)); + + /* + * Like lp_build_brilinear_lod, it's not necessary to clamp lod_fpart since: + * - the above expression will never produce numbers greater than one. + * - the mip filtering branch is only taken if lod_fpart is positive + */ + + *out_lod_ipart = lod_ipart; + *out_lod_fpart = lod_fpart; +} + + /** * Generate code to compute texture level of detail (lambda). * \param ddx partial derivatives of (s, t, r, q) with respect to X @@ -389,16 +443,32 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, rho = lp_build_rho(bld, ddx, ddy); - /* compute lod = log2(rho) */ - if ((mip_filter == PIPE_TEX_MIPFILTER_NONE || - mip_filter == PIPE_TEX_MIPFILTER_NEAREST) && - !lod_bias && + /* + * Compute lod = log2(rho) + */ + + if (!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; + /* + * Special case when there are no post-log2 adjustments, which + * saves instructions but keeping the integer and fractional lod + * computations separate from the start. + */ + + if (mip_filter == PIPE_TEX_MIPFILTER_NONE || + mip_filter == PIPE_TEX_MIPFILTER_NEAREST) { + *out_lod_ipart = lp_build_ilog2(float_bld, rho); + *out_lod_fpart = bld->float_bld.zero; + return; + } + if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR && + BRILINEAR_FACTOR > 1.0) { + lp_build_brilinear_rho(float_bld, rho, BRILINEAR_FACTOR, + out_lod_ipart, out_lod_fpart); + return; + } } if (0) { @@ -438,20 +508,21 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { if (BRILINEAR_FACTOR > 1.0) { - lp_build_brilinear_lod(bld, lod, BRILINEAR_FACTOR, + lp_build_brilinear_lod(float_bld, lod, BRILINEAR_FACTOR, out_lod_ipart, out_lod_fpart); } else { lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, out_lod_fpart); } - lp_build_name(*out_lod_ipart, "lod_ipart"); lp_build_name(*out_lod_fpart, "lod_fpart"); } else { *out_lod_ipart = lp_build_iround(float_bld, lod); } + lp_build_name(*out_lod_ipart, "lod_ipart"); + return; } -- cgit v1.2.3 From cc40abad519cc0f765c6d8f6fad4154bed8dd9c2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 12:55:31 +0100 Subject: gallivm: Don't generate Phis for execution mask. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 28 +++++++++++++++++++++------- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 5 ++++- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 8 ++++---- src/gallium/drivers/llvmpipe/lp_state_fs.c | 8 +++----- 4 files changed, 32 insertions(+), 17 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index 1ec33c742e..a5d65e9b39 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -454,12 +454,15 @@ void lp_build_mask_check(struct lp_build_mask_context *mask) { LLVMBuilderRef builder = mask->flow->builder; + LLVMValueRef value; LLVMValueRef cond; + value = lp_build_mask_value(mask); + /* cond = (mask == 0) */ cond = LLVMBuildICmp(builder, LLVMIntEQ, - LLVMBuildBitCast(builder, mask->value, mask->reg_type, ""), + LLVMBuildBitCast(builder, value, mask->reg_type, ""), LLVMConstNull(mask->reg_type), ""); @@ -485,14 +488,23 @@ lp_build_mask_begin(struct lp_build_mask_context *mask, mask->flow = flow; mask->reg_type = LLVMIntType(type.width * type.length); - mask->value = value; + mask->var = lp_build_alloca(flow->builder, + lp_build_int_vec_type(type), + "execution_mask"); + + LLVMBuildStore(flow->builder, value, mask->var); - lp_build_flow_scope_begin(flow); - lp_build_flow_scope_declare(flow, &mask->value); lp_build_flow_skip_begin(flow); } +LLVMValueRef +lp_build_mask_value(struct lp_build_mask_context *mask) +{ + return LLVMBuildLoad(mask->flow->builder, mask->var, ""); +} + + /** * Update boolean mask with given value (bitwise AND). * Typically used to update the quad's pixel alive/killed mask @@ -502,7 +514,10 @@ void lp_build_mask_update(struct lp_build_mask_context *mask, LLVMValueRef value) { - mask->value = LLVMBuildAnd( mask->flow->builder, mask->value, value, ""); + value = LLVMBuildAnd(mask->flow->builder, + lp_build_mask_value(mask), + value, ""); + LLVMBuildStore(mask->flow->builder, value, mask->var); } @@ -513,8 +528,7 @@ LLVMValueRef lp_build_mask_end(struct lp_build_mask_context *mask) { lp_build_flow_skip_end(mask->flow); - lp_build_flow_scope_end(mask->flow); - return mask->value; + return lp_build_mask_value(mask); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index 095c781ec5..0fc6317b33 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -77,7 +77,7 @@ struct lp_build_mask_context LLVMTypeRef reg_type; - LLVMValueRef value; + LLVMValueRef var; }; @@ -87,6 +87,9 @@ lp_build_mask_begin(struct lp_build_mask_context *mask, struct lp_type type, LLVMValueRef value); +LLVMValueRef +lp_build_mask_value(struct lp_build_mask_context *mask); + /** * Bitwise AND the mask with the given value, if a previous mask was set. */ diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 8d9be2ebbb..e768493103 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -473,7 +473,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef stencil_vals = NULL; LLVMValueRef z_bitmask = NULL, stencil_shift = NULL; LLVMValueRef z_pass = NULL, s_pass_mask = NULL; - LLVMValueRef orig_mask = mask->value; + LLVMValueRef orig_mask = lp_build_mask_value(mask); LLVMValueRef front_facing = NULL; /* Prototype a simpler path: @@ -527,7 +527,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, type.sign = 1; lp_build_context_init(&bld, builder, type); - z_dst = lp_build_select(&bld, mask->value, z_src, z_dst); + z_dst = lp_build_select(&bld, lp_build_mask_value(mask), z_src, z_dst); z_dst = LLVMBuildShl(builder, z_dst, const_8_int, "z_dst"); *zs_value = z_dst; } @@ -710,7 +710,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } if (depth->writemask) { - LLVMValueRef zselectmask = mask->value; + LLVMValueRef zselectmask = lp_build_mask_value(mask); /* mask off bits that failed Z test */ zselectmask = LLVMBuildAnd(builder, zselectmask, z_pass, ""); @@ -810,7 +810,7 @@ lp_build_deferred_depth_write(LLVMBuilderRef builder, lp_build_context_init(&bld, builder, type); z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval"); - z_dst = lp_build_select(&bld, mask->value, zs_value, z_dst); + z_dst = lp_build_select(&bld, lp_build_mask_value(mask), zs_value, z_dst); LLVMBuildStore(builder, z_dst, zs_dst_ptr); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index f45f36f633..cf07cb4976 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -422,16 +422,14 @@ generate_fs(struct llvmpipe_context *lp, } if (counter) - lp_build_occlusion_count(builder, type, mask.value, counter); + lp_build_occlusion_count(builder, type, + lp_build_mask_value(&mask), counter); - lp_build_mask_end(&mask); + *pmask = lp_build_mask_end(&mask); lp_build_flow_scope_end(flow); lp_build_flow_destroy(flow); - - *pmask = mask.value; - } -- cgit v1.2.3 From ea7b49028b15364a32988ec77ec88f2a6a591437 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 19:53:21 +0100 Subject: gallivm: Use varilables instead of Phis for cubemap selection. --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 62 +++++++++++---------------- 1 file changed, 26 insertions(+), 36 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 43ea8b1a14..acceae2bad 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -927,21 +927,15 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, { struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; + LLVMValueRef face_s_var; + LLVMValueRef face_t_var; + LLVMValueRef face_var; flow_ctx = lp_build_flow_create(bld->builder); - lp_build_flow_scope_begin(flow_ctx); - *face_s = bld->coord_bld.undef; - *face_t = bld->coord_bld.undef; - *face = bld->int_bld.undef; - - lp_build_name(*face_s, "face_s"); - lp_build_name(*face_t, "face_t"); - lp_build_name(*face, "face"); - - lp_build_flow_scope_declare(flow_ctx, face_s); - lp_build_flow_scope_declare(flow_ctx, face_t); - lp_build_flow_scope_declare(flow_ctx, face); + face_s_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_s_var"); + face_t_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_t_var"); + face_var = lp_build_alloca(bld->builder, bld->int_bld.vec_type, "face_var"); lp_build_if(&if_ctx, flow_ctx, bld->builder, arx_ge_ary_arz); { @@ -953,57 +947,53 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, *face = lp_build_cube_face(bld, rx, PIPE_TEX_FACE_POS_X, PIPE_TEX_FACE_NEG_X); + LLVMBuildStore(bld->builder, *face_s, face_s_var); + LLVMBuildStore(bld->builder, *face_t, face_t_var); + LLVMBuildStore(bld->builder, *face, face_var); } lp_build_else(&if_ctx); { - struct lp_build_flow_context *flow_ctx2; struct lp_build_if_state if_ctx2; - LLVMValueRef face_s2 = bld->coord_bld.undef; - LLVMValueRef face_t2 = bld->coord_bld.undef; - LLVMValueRef face2 = bld->int_bld.undef; - - flow_ctx2 = lp_build_flow_create(bld->builder); - lp_build_flow_scope_begin(flow_ctx2); - lp_build_flow_scope_declare(flow_ctx2, &face_s2); - lp_build_flow_scope_declare(flow_ctx2, &face_t2); - lp_build_flow_scope_declare(flow_ctx2, &face2); - ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, ""); - lp_build_if(&if_ctx2, flow_ctx2, bld->builder, ary_ge_arx_arz); + lp_build_if(&if_ctx2, flow_ctx, bld->builder, ary_ge_arx_arz); { /* +/- Y face */ LLVMValueRef sign = lp_build_sgn(float_bld, ry); LLVMValueRef ima = lp_build_cube_ima(coord_bld, t); - face_s2 = lp_build_cube_coord(coord_bld, NULL, -1, s, ima); - face_t2 = lp_build_cube_coord(coord_bld, sign, -1, r, ima); - face2 = lp_build_cube_face(bld, ry, + *face_s = lp_build_cube_coord(coord_bld, NULL, -1, s, ima); + *face_t = lp_build_cube_coord(coord_bld, sign, -1, r, ima); + *face = lp_build_cube_face(bld, ry, PIPE_TEX_FACE_POS_Y, PIPE_TEX_FACE_NEG_Y); + LLVMBuildStore(bld->builder, *face_s, face_s_var); + LLVMBuildStore(bld->builder, *face_t, face_t_var); + LLVMBuildStore(bld->builder, *face, face_var); } lp_build_else(&if_ctx2); { /* +/- Z face */ LLVMValueRef sign = lp_build_sgn(float_bld, rz); LLVMValueRef ima = lp_build_cube_ima(coord_bld, r); - face_s2 = lp_build_cube_coord(coord_bld, sign, -1, s, ima); - face_t2 = lp_build_cube_coord(coord_bld, NULL, +1, t, ima); - face2 = lp_build_cube_face(bld, rz, + *face_s = lp_build_cube_coord(coord_bld, sign, -1, s, ima); + *face_t = lp_build_cube_coord(coord_bld, NULL, +1, t, ima); + *face = lp_build_cube_face(bld, rz, PIPE_TEX_FACE_POS_Z, PIPE_TEX_FACE_NEG_Z); + LLVMBuildStore(bld->builder, *face_s, face_s_var); + LLVMBuildStore(bld->builder, *face_t, face_t_var); + LLVMBuildStore(bld->builder, *face, face_var); } lp_build_endif(&if_ctx2); - lp_build_flow_scope_end(flow_ctx2); - lp_build_flow_destroy(flow_ctx2); - *face_s = face_s2; - *face_t = face_t2; - *face = face2; } lp_build_endif(&if_ctx); - lp_build_flow_scope_end(flow_ctx); lp_build_flow_destroy(flow_ctx); + + *face_s = LLVMBuildLoad(bld->builder, face_s_var, "face_s"); + *face_t = LLVMBuildLoad(bld->builder, face_t_var, "face_t"); + *face = LLVMBuildLoad(bld->builder, face_var, "face"); } } -- cgit v1.2.3 From d45c379027054e563c4f4379fb69fc9f68612f75 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 20:14:03 +0100 Subject: gallivm: Remove support for Phi generation. Simply rely on mem2reg pass. It's easier and more reliable. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 211 ---------------------------- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 10 -- src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 - 3 files changed, 225 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index a5d65e9b39..22c2db8c44 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -45,22 +45,11 @@ * Enumeration of all possible flow constructs. */ enum lp_build_flow_construct_kind { - LP_BUILD_FLOW_SCOPE, LP_BUILD_FLOW_SKIP, LP_BUILD_FLOW_IF }; -/** - * Variable declaration scope. - */ -struct lp_build_flow_scope -{ - /** Number of variables declared in this scope */ - unsigned num_variables; -}; - - /** * Early exit. Useful to skip to the end of a function or block when * the execution mask becomes zero or when there is an error condition. @@ -69,11 +58,6 @@ struct lp_build_flow_skip { /** Block to skip to */ LLVMBasicBlockRef block; - - /** Number of variables declared at the beginning */ - unsigned num_variables; - - LLVMValueRef *phi; /**< array [num_variables] */ }; @@ -82,10 +66,6 @@ struct lp_build_flow_skip */ struct lp_build_flow_if { - unsigned num_variables; - - LLVMValueRef *phi; /**< array [num_variables] */ - LLVMValueRef condition; LLVMBasicBlockRef entry_block, true_block, false_block, merge_block; }; @@ -96,7 +76,6 @@ struct lp_build_flow_if */ union lp_build_flow_construct_data { - struct lp_build_flow_scope scope; struct lp_build_flow_skip skip; struct lp_build_flow_if ifthen; }; @@ -127,12 +106,6 @@ struct lp_build_flow_context */ struct lp_build_flow_construct constructs[LP_BUILD_FLOW_MAX_DEPTH]; unsigned num_constructs; - - /** - * Variable stack - */ - LLVMValueRef *variables[LP_BUILD_FLOW_MAX_VARIABLES]; - unsigned num_variables; }; @@ -155,7 +128,6 @@ void lp_build_flow_destroy(struct lp_build_flow_context *flow) { assert(flow->num_constructs == 0); - assert(flow->num_variables == 0); FREE(flow); } @@ -217,93 +189,6 @@ lp_build_flow_pop(struct lp_build_flow_context *flow, } -/** - * Begin a variable scope. - * - * - */ -void -lp_build_flow_scope_begin(struct lp_build_flow_context *flow) -{ - struct lp_build_flow_scope *scope; - - scope = &lp_build_flow_push(flow, LP_BUILD_FLOW_SCOPE)->scope; - if(!scope) - return; - - scope->num_variables = 0; -} - - -/** - * Declare a variable. - * - * A variable is a named entity which can have different LLVMValueRef's at - * different points of the program. This is relevant for control flow because - * when there are multiple branches to a same location we need to replace - * the variable's value with a Phi function as explained in - * http://en.wikipedia.org/wiki/Static_single_assignment_form . - * - * We keep track of variables by keeping around a pointer to where they're - * current. - * - * There are a few cautions to observe: - * - * - Variable's value must not be NULL. If there is no initial value then - * LLVMGetUndef() should be used. - * - * - Variable's value must be kept up-to-date. If the variable is going to be - * modified by a function then a pointer should be passed so that its value - * is accurate. Failure to do this will cause some of the variables' - * transient values to be lost, leading to wrong results. - * - * - A program should be written from top to bottom, by always appending - * instructions to the bottom with a single LLVMBuilderRef. Inserting and/or - * modifying existing statements will most likely lead to wrong results. - * - */ -void -lp_build_flow_scope_declare(struct lp_build_flow_context *flow, - LLVMValueRef *variable) -{ - struct lp_build_flow_scope *scope; - - scope = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SCOPE)->scope; - if(!scope) - return; - - assert(*variable); - if(!*variable) - return; - - assert(flow->num_variables < LP_BUILD_FLOW_MAX_VARIABLES); - if(flow->num_variables >= LP_BUILD_FLOW_MAX_VARIABLES) - return; - - flow->variables[flow->num_variables++] = variable; - ++scope->num_variables; -} - - -void -lp_build_flow_scope_end(struct lp_build_flow_context *flow) -{ - struct lp_build_flow_scope *scope; - - scope = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SCOPE)->scope; - if(!scope) - return; - - assert(flow->num_variables >= scope->num_variables); - if(flow->num_variables < scope->num_variables) { - flow->num_variables = 0; - return; - } - - flow->num_variables -= scope->num_variables; -} - - /** * Note: this function has no dependencies on the flow code and could * be used elsewhere. @@ -350,7 +235,6 @@ lp_build_flow_skip_begin(struct lp_build_flow_context *flow) { struct lp_build_flow_skip *skip; LLVMBuilderRef builder; - unsigned i; skip = &lp_build_flow_push(flow, LP_BUILD_FLOW_SKIP)->skip; if(!skip) @@ -359,26 +243,9 @@ lp_build_flow_skip_begin(struct lp_build_flow_context *flow) /* create new basic block */ skip->block = lp_build_flow_insert_block(flow); - skip->num_variables = flow->num_variables; - if(!skip->num_variables) { - skip->phi = NULL; - return; - } - - /* Allocate a Phi node for each variable in this skip scope */ - skip->phi = MALLOC(skip->num_variables * sizeof *skip->phi); - if(!skip->phi) { - skip->num_variables = 0; - return; - } - builder = LLVMCreateBuilder(); LLVMPositionBuilderAtEnd(builder, skip->block); - /* create a Phi node for each variable */ - for(i = 0; i < skip->num_variables; ++i) - skip->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), ""); - LLVMDisposeBuilder(builder); } @@ -392,25 +259,14 @@ lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow, LLVMValueRef cond) { struct lp_build_flow_skip *skip; - LLVMBasicBlockRef current_block; LLVMBasicBlockRef new_block; - unsigned i; skip = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SKIP)->skip; if(!skip) return; - current_block = LLVMGetInsertBlock(flow->builder); - new_block = lp_build_flow_insert_block(flow); - /* for each variable, update the Phi node with a (variable, block) pair */ - for(i = 0; i < skip->num_variables; ++i) { - assert(*flow->variables[i]); - assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i])); - LLVMAddIncoming(skip->phi[i], flow->variables[i], ¤t_block, 1); - } - /* if cond is true, goto skip->block, else goto new_block */ LLVMBuildCondBr(flow->builder, cond, skip->block, new_block); @@ -422,28 +278,14 @@ void lp_build_flow_skip_end(struct lp_build_flow_context *flow) { struct lp_build_flow_skip *skip; - LLVMBasicBlockRef current_block; - unsigned i; skip = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SKIP)->skip; if(!skip) return; - current_block = LLVMGetInsertBlock(flow->builder); - - /* add (variable, block) tuples to the phi nodes */ - for(i = 0; i < skip->num_variables; ++i) { - assert(*flow->variables[i]); - assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i])); - LLVMAddIncoming(skip->phi[i], flow->variables[i], ¤t_block, 1); - *flow->variables[i] = skip->phi[i]; - } - /* goto block */ LLVMBuildBr(flow->builder, skip->block); LLVMPositionBuilderAtEnd(flow->builder, skip->block); - - FREE(skip->phi); } @@ -659,7 +501,6 @@ lp_build_if(struct lp_build_if_state *ctx, { LLVMBasicBlockRef block = LLVMGetInsertBlock(builder); struct lp_build_flow_if *ifthen; - unsigned i; memset(ctx, 0, sizeof(*ctx)); ctx->builder = builder; @@ -669,31 +510,13 @@ lp_build_if(struct lp_build_if_state *ctx, ifthen = &lp_build_flow_push(flow, LP_BUILD_FLOW_IF)->ifthen; assert(ifthen); - ifthen->num_variables = flow->num_variables; ifthen->condition = condition; ifthen->entry_block = block; - /* create a Phi node for each variable in this flow scope */ - ifthen->phi = MALLOC(ifthen->num_variables * sizeof(*ifthen->phi)); - if (!ifthen->phi) { - ifthen->num_variables = 0; - return; - } - /* create endif/merge basic block for the phi functions */ ifthen->merge_block = lp_build_insert_new_block(builder, "endif-block"); LLVMPositionBuilderAtEnd(builder, ifthen->merge_block); - /* create a phi node for each variable */ - for (i = 0; i < flow->num_variables; i++) { - ifthen->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), ""); - - /* add add the initial value of the var from the entry block */ - if (!LLVMIsUndef(*flow->variables[i])) - LLVMAddIncoming(ifthen->phi[i], flow->variables[i], - &ifthen->entry_block, 1); - } - /* create/insert true_block before merge_block */ ifthen->true_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-true-block"); @@ -710,18 +533,10 @@ lp_build_else(struct lp_build_if_state *ctx) { struct lp_build_flow_context *flow = ctx->flow; struct lp_build_flow_if *ifthen; - unsigned i; ifthen = &lp_build_flow_peek(flow, LP_BUILD_FLOW_IF)->ifthen; assert(ifthen); - /* for each variable, update the Phi node with a (variable, block) pair */ - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block); - for (i = 0; i < flow->num_variables; i++) { - assert(*flow->variables[i]); - LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->true_block, 1); - } - /* create/insert false_block before the merge block */ ifthen->false_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-false-block"); @@ -738,8 +553,6 @@ lp_build_endif(struct lp_build_if_state *ctx) { struct lp_build_flow_context *flow = ctx->flow; struct lp_build_flow_if *ifthen; - LLVMBasicBlockRef curBlock = LLVMGetInsertBlock(ctx->builder); - unsigned i; ifthen = &lp_build_flow_pop(flow, LP_BUILD_FLOW_IF)->ifthen; assert(ifthen); @@ -747,30 +560,6 @@ lp_build_endif(struct lp_build_if_state *ctx) /* Insert branch to the merge block from current block */ LLVMBuildBr(ctx->builder, ifthen->merge_block); - if (ifthen->false_block) { - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block); - /* for each variable, update the Phi node with a (variable, block) pair */ - for (i = 0; i < flow->num_variables; i++) { - assert(*flow->variables[i]); - LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &curBlock, 1); - /* replace the variable ref with the phi function */ - *flow->variables[i] = ifthen->phi[i]; - } - } - else { - /* no else clause */ - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block); - for (i = 0; i < flow->num_variables; i++) { - assert(*flow->variables[i]); - LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->true_block, 1); - - /* replace the variable ref with the phi function */ - *flow->variables[i] = ifthen->phi[i]; - } - } - - FREE(ifthen->phi); - /*** *** Now patch in the various branch instructions. ***/ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index 0fc6317b33..403e46e52e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -50,16 +50,6 @@ lp_build_flow_create(LLVMBuilderRef builder); void lp_build_flow_destroy(struct lp_build_flow_context *flow); -void -lp_build_flow_scope_begin(struct lp_build_flow_context *flow); - -void -lp_build_flow_scope_declare(struct lp_build_flow_context *flow, - LLVMValueRef *variable); - -void -lp_build_flow_scope_end(struct lp_build_flow_context *flow); - void lp_build_flow_skip_begin(struct lp_build_flow_context *flow); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index cf07cb4976..3b0706e3ec 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -290,8 +290,6 @@ generate_fs(struct llvmpipe_context *lp, memset(outputs, 0, sizeof outputs); - lp_build_flow_scope_begin(flow); - /* Declare the color and z variables */ for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) { for(chan = 0; chan < NUM_CHANNELS; ++chan) { @@ -427,8 +425,6 @@ generate_fs(struct llvmpipe_context *lp, *pmask = lp_build_mask_end(&mask); - lp_build_flow_scope_end(flow); - lp_build_flow_destroy(flow); } -- cgit v1.2.3 From 1949f8c31507ed4a8774c380e6b604c328f4ec98 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 20:26:11 +0100 Subject: gallivm: Factor out the SI->FP texture size conversion for SoA path too --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 90 ++++++++++++++--------- 1 file changed, 56 insertions(+), 34 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 1af0318e8e..3b63ac6f62 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -230,6 +230,7 @@ static void lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, LLVMValueRef coord, LLVMValueRef length, + LLVMValueRef length_f, boolean is_pot, unsigned wrap_mode, LLVMValueRef *x0_out, @@ -240,7 +241,6 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, struct lp_build_context *int_coord_bld = &bld->int_coord_bld; struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5); - LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length); LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one); LLVMValueRef coord0, coord1, weight; @@ -442,13 +442,13 @@ static LLVMValueRef lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, LLVMValueRef coord, LLVMValueRef length, + LLVMValueRef length_f, boolean is_pot, unsigned wrap_mode) { struct lp_build_context *coord_bld = &bld->coord_bld; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; - LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length); LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one); LLVMValueRef icoord; @@ -563,9 +563,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, + LLVMValueRef size, LLVMValueRef row_stride_vec, LLVMValueRef img_stride_vec, LLVMValueRef data_ptr, @@ -575,24 +573,45 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, LLVMValueRef colors_out[4]) { const unsigned dims = bld->dims; + LLVMValueRef width_vec; + LLVMValueRef height_vec; + LLVMValueRef depth_vec; + LLVMValueRef flt_size; + LLVMValueRef flt_width_vec; + LLVMValueRef flt_height_vec; + LLVMValueRef flt_depth_vec; LLVMValueRef x, y, z; + lp_build_extract_image_sizes(bld, + bld->int_size_type, + bld->int_coord_type, + size, + &width_vec, &height_vec, &depth_vec); + + flt_size = lp_build_int_to_float(&bld->float_size_bld, size); + + lp_build_extract_image_sizes(bld, + bld->float_size_type, + bld->coord_type, + flt_size, + &flt_width_vec, &flt_height_vec, &flt_depth_vec); + /* * Compute integer texcoords. */ - x = lp_build_sample_wrap_nearest(bld, s, width_vec, + x = lp_build_sample_wrap_nearest(bld, s, width_vec, flt_width_vec, bld->static_state->pot_width, bld->static_state->wrap_s); lp_build_name(x, "tex.x.wrapped"); if (dims >= 2) { - y = lp_build_sample_wrap_nearest(bld, t, height_vec, + y = lp_build_sample_wrap_nearest(bld, t, height_vec, flt_height_vec, bld->static_state->pot_height, bld->static_state->wrap_t); lp_build_name(y, "tex.y.wrapped"); if (dims == 3) { - z = lp_build_sample_wrap_nearest(bld, r, depth_vec, + z = lp_build_sample_wrap_nearest(bld, r, depth_vec, flt_depth_vec, bld->static_state->pot_depth, bld->static_state->wrap_r); lp_build_name(z, "tex.z.wrapped"); @@ -626,9 +645,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, + LLVMValueRef size, LLVMValueRef row_stride_vec, LLVMValueRef img_stride_vec, LLVMValueRef data_ptr, @@ -638,15 +655,36 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, LLVMValueRef colors_out[4]) { const unsigned dims = bld->dims; + LLVMValueRef width_vec; + LLVMValueRef height_vec; + LLVMValueRef depth_vec; + LLVMValueRef flt_size; + LLVMValueRef flt_width_vec; + LLVMValueRef flt_height_vec; + LLVMValueRef flt_depth_vec; LLVMValueRef x0, y0, z0, x1, y1, z1; LLVMValueRef s_fpart, t_fpart, r_fpart; LLVMValueRef neighbors[2][2][4]; int chan; + lp_build_extract_image_sizes(bld, + bld->int_size_type, + bld->int_coord_type, + size, + &width_vec, &height_vec, &depth_vec); + + flt_size = lp_build_int_to_float(&bld->float_size_bld, size); + + lp_build_extract_image_sizes(bld, + bld->float_size_type, + bld->coord_type, + flt_size, + &flt_width_vec, &flt_height_vec, &flt_depth_vec); + /* * Compute integer texcoords. */ - lp_build_sample_wrap_linear(bld, s, width_vec, + lp_build_sample_wrap_linear(bld, s, width_vec, flt_width_vec, bld->static_state->pot_width, bld->static_state->wrap_s, &x0, &x1, &s_fpart); @@ -654,7 +692,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, lp_build_name(x1, "tex.x1.wrapped"); if (dims >= 2) { - lp_build_sample_wrap_linear(bld, t, height_vec, + lp_build_sample_wrap_linear(bld, t, height_vec, flt_height_vec, bld->static_state->pot_height, bld->static_state->wrap_t, &y0, &y1, &t_fpart); @@ -662,7 +700,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, lp_build_name(y1, "tex.y1.wrapped"); if (dims == 3) { - lp_build_sample_wrap_linear(bld, r, depth_vec, + lp_build_sample_wrap_linear(bld, r, depth_vec, flt_depth_vec, bld->static_state->pot_depth, bld->static_state->wrap_r, &z0, &z1, &r_fpart); @@ -807,12 +845,6 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMBuilderRef builder = bld->builder; LLVMValueRef size0; LLVMValueRef size1; - LLVMValueRef width0_vec; - LLVMValueRef width1_vec; - LLVMValueRef height0_vec; - LLVMValueRef height1_vec; - LLVMValueRef depth0_vec; - LLVMValueRef depth1_vec; LLVMValueRef row_stride0_vec; LLVMValueRef row_stride1_vec; LLVMValueRef img_stride0_vec; @@ -826,15 +858,10 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, lp_build_mipmap_level_sizes(bld, ilevel0, &size0, &row_stride0_vec, &img_stride0_vec); - lp_build_extract_image_sizes(bld, - bld->int_size_type, - bld->int_coord_type, - size0, - &width0_vec, &height0_vec, &depth0_vec); data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, unit, - width0_vec, height0_vec, depth0_vec, + size0, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, colors0); @@ -842,7 +869,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, else { assert(img_filter == PIPE_TEX_FILTER_LINEAR); lp_build_sample_image_linear(bld, unit, - width0_vec, height0_vec, depth0_vec, + size0, row_stride0_vec, img_stride0_vec, data_ptr0, s, t, r, colors0); @@ -872,22 +899,17 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, lp_build_mipmap_level_sizes(bld, ilevel1, &size1, &row_stride1_vec, &img_stride1_vec); - lp_build_extract_image_sizes(bld, - bld->int_size_type, - bld->int_coord_type, - size1, - &width1_vec, &height1_vec, &depth1_vec); data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1); if (img_filter == PIPE_TEX_FILTER_NEAREST) { lp_build_sample_image_nearest(bld, unit, - width1_vec, height1_vec, depth1_vec, + size1, row_stride1_vec, img_stride1_vec, data_ptr1, s, t, r, colors1); } else { lp_build_sample_image_linear(bld, unit, - width1_vec, height1_vec, depth1_vec, + size1, row_stride1_vec, img_stride1_vec, data_ptr1, s, t, r, colors1); -- cgit v1.2.3 From d0ea4641597d23df2198fd76ed7430c06cef8c5d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 21:14:05 +0100 Subject: gallivm: Simplify if/then/else implementation. No need for for a flow stack anymore. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 79 ++++++----------------- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 10 ++- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 8 +-- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 14 +--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 14 +--- 5 files changed, 34 insertions(+), 91 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index 22c2db8c44..ac63bd544f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -61,23 +61,12 @@ struct lp_build_flow_skip }; -/** - * if/else/endif. - */ -struct lp_build_flow_if -{ - LLVMValueRef condition; - LLVMBasicBlockRef entry_block, true_block, false_block, merge_block; -}; - - /** * Union of all possible flow constructs' data */ union lp_build_flow_construct_data { struct lp_build_flow_skip skip; - struct lp_build_flow_if ifthen; }; @@ -468,24 +457,16 @@ lp_build_loop_end_cond(LLVMBuilderRef builder, Is built with: - LLVMValueRef x = LLVMGetUndef(); // or something else - - flow = lp_build_flow_create(builder); - - lp_build_flow_scope_begin(flow); + // x needs an alloca variable + x = lp_build_alloca(builder, type, "x"); - // x needs a phi node - lp_build_flow_scope_declare(flow, &x); - lp_build_if(ctx, flow, builder, cond); - x = LLVMAdd(1, 2); - lp_build_else(ctx); - x = LLVMAdd(2, 3); - lp_build_endif(ctx); + lp_build_if(ctx, builder, cond); + LLVMBuildStore(LLVMBuildAdd(1, 2), x); + lp_build_else(ctx); + LLVMBuildStore(LLVMBuildAdd(2, 3). x); + lp_build_endif(ctx); - lp_build_flow_scope_end(flow); - - lp_build_flow_destroy(flow); */ @@ -494,22 +475,14 @@ lp_build_loop_end_cond(LLVMBuilderRef builder, * Begin an if/else/endif construct. */ void -lp_build_if(struct lp_build_if_state *ctx, - struct lp_build_flow_context *flow, +lp_build_if(struct lp_build_if_state *ifthen, LLVMBuilderRef builder, LLVMValueRef condition) { LLVMBasicBlockRef block = LLVMGetInsertBlock(builder); - struct lp_build_flow_if *ifthen; - - memset(ctx, 0, sizeof(*ctx)); - ctx->builder = builder; - ctx->flow = flow; - - /* push/create new scope */ - ifthen = &lp_build_flow_push(flow, LP_BUILD_FLOW_IF)->ifthen; - assert(ifthen); + memset(ifthen, 0, sizeof *ifthen); + ifthen->builder = builder; ifthen->condition = condition; ifthen->entry_block = block; @@ -529,19 +502,13 @@ lp_build_if(struct lp_build_if_state *ctx, * Begin else-part of a conditional */ void -lp_build_else(struct lp_build_if_state *ctx) +lp_build_else(struct lp_build_if_state *ifthen) { - struct lp_build_flow_context *flow = ctx->flow; - struct lp_build_flow_if *ifthen; - - ifthen = &lp_build_flow_peek(flow, LP_BUILD_FLOW_IF)->ifthen; - assert(ifthen); - /* create/insert false_block before the merge block */ ifthen->false_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-false-block"); /* successive code goes into the else block */ - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->false_block); + LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->false_block); } @@ -549,39 +516,33 @@ lp_build_else(struct lp_build_if_state *ctx) * End a conditional. */ void -lp_build_endif(struct lp_build_if_state *ctx) +lp_build_endif(struct lp_build_if_state *ifthen) { - struct lp_build_flow_context *flow = ctx->flow; - struct lp_build_flow_if *ifthen; - - ifthen = &lp_build_flow_pop(flow, LP_BUILD_FLOW_IF)->ifthen; - assert(ifthen); - /* Insert branch to the merge block from current block */ - LLVMBuildBr(ctx->builder, ifthen->merge_block); + LLVMBuildBr(ifthen->builder, ifthen->merge_block); /*** *** Now patch in the various branch instructions. ***/ /* Insert the conditional branch instruction at the end of entry_block */ - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->entry_block); + LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->entry_block); if (ifthen->false_block) { /* we have an else clause */ - LLVMBuildCondBr(ctx->builder, ifthen->condition, + LLVMBuildCondBr(ifthen->builder, ifthen->condition, ifthen->true_block, ifthen->false_block); } else { /* no else clause */ - LLVMBuildCondBr(ctx->builder, ifthen->condition, + LLVMBuildCondBr(ifthen->builder, ifthen->condition, ifthen->true_block, ifthen->merge_block); } /* Insert branch from end of true_block to merge_block */ if (ifthen->false_block) { /* Append an unconditional Br(anch) instruction on the true_block */ - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block); - LLVMBuildBr(ctx->builder, ifthen->merge_block); + LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->true_block); + LLVMBuildBr(ifthen->builder, ifthen->merge_block); } else { /* No else clause. @@ -591,7 +552,7 @@ lp_build_endif(struct lp_build_if_state *ctx) } /* Resume building code at end of the ifthen->merge_block */ - LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block); + LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->merge_block); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index 403e46e52e..a4fc8d1955 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -130,16 +130,22 @@ lp_build_loop_end_cond(LLVMBuilderRef builder, +/** + * if/else/endif. + */ struct lp_build_if_state { LLVMBuilderRef builder; - struct lp_build_flow_context *flow; + LLVMValueRef condition; + LLVMBasicBlockRef entry_block; + LLVMBasicBlockRef true_block; + LLVMBasicBlockRef false_block; + LLVMBasicBlockRef merge_block; }; void lp_build_if(struct lp_build_if_state *ctx, - struct lp_build_flow_context *flow, LLVMBuilderRef builder, LLVMValueRef condition); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index acceae2bad..1a27a24118 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -925,19 +925,16 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, rz_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, rz, float_bld->zero, ""); { - struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; LLVMValueRef face_s_var; LLVMValueRef face_t_var; LLVMValueRef face_var; - flow_ctx = lp_build_flow_create(bld->builder); - face_s_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_s_var"); face_t_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_t_var"); face_var = lp_build_alloca(bld->builder, bld->int_bld.vec_type, "face_var"); - lp_build_if(&if_ctx, flow_ctx, bld->builder, arx_ge_ary_arz); + lp_build_if(&if_ctx, bld->builder, arx_ge_ary_arz); { /* +/- X face */ LLVMValueRef sign = lp_build_sgn(float_bld, rx); @@ -957,7 +954,7 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, ""); - lp_build_if(&if_ctx2, flow_ctx, bld->builder, ary_ge_arx_arz); + lp_build_if(&if_ctx2, bld->builder, ary_ge_arx_arz); { /* +/- Y face */ LLVMValueRef sign = lp_build_sgn(float_bld, ry); @@ -989,7 +986,6 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, } lp_build_endif(&if_ctx); - lp_build_flow_destroy(flow_ctx); *face_s = LLVMBuildLoad(bld->builder, face_s_var, "face_s"); *face_t = LLVMBuildLoad(bld->builder, face_t_var, "face_t"); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 1e1e3591ca..69d81ad971 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -833,12 +833,9 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { LLVMValueRef h16_scale = LLVMConstReal(LLVMFloatType(), 256.0); LLVMTypeRef i32_type = LLVMIntType(32); - struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; LLVMValueRef need_lerp; - flow_ctx = lp_build_flow_create(builder); - lod_fpart = LLVMBuildFMul(builder, lod_fpart, h16_scale, ""); lod_fpart = LLVMBuildFPToSI(builder, lod_fpart, i32_type, "lod_fpart.fixed16"); @@ -847,7 +844,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, lod_fpart, LLVMConstNull(i32_type), "need_lerp"); - lp_build_if(&if_ctx, flow_ctx, builder, need_lerp); + lp_build_if(&if_ctx, builder, need_lerp); { struct lp_build_context h16_bld; @@ -887,8 +884,6 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, LLVMBuildStore(builder, colors0_hi, colors_hi_var); } lp_build_endif(&if_ctx); - - lp_build_flow_destroy(flow_ctx); } } @@ -1028,17 +1023,14 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, /* Emit conditional to choose min image filter or mag image filter * depending on the lod being > 0 or <= 0, respectively. */ - struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; LLVMValueRef minify; - flow_ctx = lp_build_flow_create(builder); - /* minify = lod >= 0.0 */ minify = LLVMBuildICmp(builder, LLVMIntSGE, lod_ipart, int_bld->zero, ""); - lp_build_if(&if_ctx, flow_ctx, builder, minify); + lp_build_if(&if_ctx, builder, minify); { /* Use the minification filter */ lp_build_sample_mipmap(bld, @@ -1057,8 +1049,6 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, packed_lo, packed_hi); } lp_build_endif(&if_ctx); - - lp_build_flow_destroy(flow_ctx); } /* diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 3b63ac6f62..75130e1c54 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -881,19 +881,16 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, } if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; LLVMValueRef need_lerp; - flow_ctx = lp_build_flow_create(builder); - /* need_lerp = lod_fpart > 0 */ need_lerp = LLVMBuildFCmp(builder, LLVMRealUGT, lod_fpart, bld->float_bld.zero, "need_lerp"); - lp_build_if(&if_ctx, flow_ctx, builder, need_lerp); + lp_build_if(&if_ctx, builder, need_lerp); { /* sample the second mipmap level */ lp_build_mipmap_level_sizes(bld, ilevel1, @@ -926,8 +923,6 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, } } lp_build_endif(&if_ctx); - - lp_build_flow_destroy(flow_ctx); } } @@ -1063,17 +1058,14 @@ lp_build_sample_general(struct lp_build_sample_context *bld, /* Emit conditional to choose min image filter or mag image filter * depending on the lod being > 0 or <= 0, respectively. */ - struct lp_build_flow_context *flow_ctx; struct lp_build_if_state if_ctx; LLVMValueRef minify; - flow_ctx = lp_build_flow_create(builder); - /* minify = lod >= 0.0 */ minify = LLVMBuildICmp(builder, LLVMIntSGE, lod_ipart, int_bld->zero, ""); - lp_build_if(&if_ctx, flow_ctx, builder, minify); + lp_build_if(&if_ctx, builder, minify); { /* Use the minification filter */ lp_build_sample_mipmap(bld, unit, @@ -1092,8 +1084,6 @@ lp_build_sample_general(struct lp_build_sample_context *bld, texels); } lp_build_endif(&if_ctx); - - lp_build_flow_destroy(flow_ctx); } for (chan = 0; chan < 4; ++chan) { -- cgit v1.2.3 From 307df6a858dcab1bc10f3f52d9968acb3ea6d74f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 9 Oct 2010 21:39:14 +0100 Subject: gallivm: Cleanup the rest of the flow module. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 210 +++------------------------- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 28 ++-- src/gallium/drivers/llvmpipe/lp_state_fs.c | 12 +- 3 files changed, 39 insertions(+), 211 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index ac63bd544f..99a49df317 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -38,146 +38,6 @@ #include "lp_bld_flow.h" -#define LP_BUILD_FLOW_MAX_VARIABLES 64 -#define LP_BUILD_FLOW_MAX_DEPTH 32 - -/** - * Enumeration of all possible flow constructs. - */ -enum lp_build_flow_construct_kind { - LP_BUILD_FLOW_SKIP, - LP_BUILD_FLOW_IF -}; - - -/** - * Early exit. Useful to skip to the end of a function or block when - * the execution mask becomes zero or when there is an error condition. - */ -struct lp_build_flow_skip -{ - /** Block to skip to */ - LLVMBasicBlockRef block; -}; - - -/** - * Union of all possible flow constructs' data - */ -union lp_build_flow_construct_data -{ - struct lp_build_flow_skip skip; -}; - - -/** - * Element of the flow construct stack. - */ -struct lp_build_flow_construct -{ - enum lp_build_flow_construct_kind kind; - union lp_build_flow_construct_data data; -}; - - -/** - * All necessary data to generate LLVM control flow constructs. - * - * Besides keeping track of the control flow construct themselves we also - * need to keep track of variables in order to generate SSA Phi values. - */ -struct lp_build_flow_context -{ - LLVMBuilderRef builder; - - /** - * Control flow stack. - */ - struct lp_build_flow_construct constructs[LP_BUILD_FLOW_MAX_DEPTH]; - unsigned num_constructs; -}; - - -struct lp_build_flow_context * -lp_build_flow_create(LLVMBuilderRef builder) -{ - struct lp_build_flow_context *flow; - - flow = CALLOC_STRUCT(lp_build_flow_context); - if(!flow) - return NULL; - - flow->builder = builder; - - return flow; -} - - -void -lp_build_flow_destroy(struct lp_build_flow_context *flow) -{ - assert(flow->num_constructs == 0); - FREE(flow); -} - - -/** - * Begin/push a new flow control construct, such as a loop, skip block - * or variable scope. - */ -static union lp_build_flow_construct_data * -lp_build_flow_push(struct lp_build_flow_context *flow, - enum lp_build_flow_construct_kind kind) -{ - assert(flow->num_constructs < LP_BUILD_FLOW_MAX_DEPTH); - if(flow->num_constructs >= LP_BUILD_FLOW_MAX_DEPTH) - return NULL; - - flow->constructs[flow->num_constructs].kind = kind; - return &flow->constructs[flow->num_constructs++].data; -} - - -/** - * Return the current/top flow control construct on the stack. - * \param kind the expected type of the top-most construct - */ -static union lp_build_flow_construct_data * -lp_build_flow_peek(struct lp_build_flow_context *flow, - enum lp_build_flow_construct_kind kind) -{ - assert(flow->num_constructs); - if(!flow->num_constructs) - return NULL; - - assert(flow->constructs[flow->num_constructs - 1].kind == kind); - if(flow->constructs[flow->num_constructs - 1].kind != kind) - return NULL; - - return &flow->constructs[flow->num_constructs - 1].data; -} - - -/** - * End/pop the current/top flow control construct on the stack. - * \param kind the expected type of the top-most construct - */ -static union lp_build_flow_construct_data * -lp_build_flow_pop(struct lp_build_flow_context *flow, - enum lp_build_flow_construct_kind kind) -{ - assert(flow->num_constructs); - if(!flow->num_constructs) - return NULL; - - assert(flow->constructs[flow->num_constructs - 1].kind == kind); - if(flow->constructs[flow->num_constructs - 1].kind != kind) - return NULL; - - return &flow->constructs[--flow->num_constructs].data; -} - - /** * Note: this function has no dependencies on the flow code and could * be used elsewhere. @@ -208,34 +68,18 @@ lp_build_insert_new_block(LLVMBuilderRef builder, const char *name) } -static LLVMBasicBlockRef -lp_build_flow_insert_block(struct lp_build_flow_context *flow) -{ - return lp_build_insert_new_block(flow->builder, ""); -} - - /** * Begin a "skip" block. Inside this block we can test a condition and * skip to the end of the block if the condition is false. */ void -lp_build_flow_skip_begin(struct lp_build_flow_context *flow) +lp_build_flow_skip_begin(struct lp_build_skip_context *skip, + LLVMBuilderRef builder) { - struct lp_build_flow_skip *skip; - LLVMBuilderRef builder; - - skip = &lp_build_flow_push(flow, LP_BUILD_FLOW_SKIP)->skip; - if(!skip) - return; + skip->builder = builder; /* create new basic block */ - skip->block = lp_build_flow_insert_block(flow); - - builder = LLVMCreateBuilder(); - LLVMPositionBuilderAtEnd(builder, skip->block); - - LLVMDisposeBuilder(builder); + skip->block = lp_build_insert_new_block(skip->builder, "skip"); } @@ -244,37 +88,26 @@ lp_build_flow_skip_begin(struct lp_build_flow_context *flow) * skip block if the condition is true. */ void -lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow, +lp_build_flow_skip_cond_break(struct lp_build_skip_context *skip, LLVMValueRef cond) { - struct lp_build_flow_skip *skip; LLVMBasicBlockRef new_block; - skip = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SKIP)->skip; - if(!skip) - return; - - new_block = lp_build_flow_insert_block(flow); + new_block = lp_build_insert_new_block(skip->builder, ""); /* if cond is true, goto skip->block, else goto new_block */ - LLVMBuildCondBr(flow->builder, cond, skip->block, new_block); + LLVMBuildCondBr(skip->builder, cond, skip->block, new_block); - LLVMPositionBuilderAtEnd(flow->builder, new_block); + LLVMPositionBuilderAtEnd(skip->builder, new_block); } void -lp_build_flow_skip_end(struct lp_build_flow_context *flow) +lp_build_flow_skip_end(struct lp_build_skip_context *skip) { - struct lp_build_flow_skip *skip; - - skip = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SKIP)->skip; - if(!skip) - return; - /* goto block */ - LLVMBuildBr(flow->builder, skip->block); - LLVMPositionBuilderAtEnd(flow->builder, skip->block); + LLVMBuildBr(skip->builder, skip->block); + LLVMPositionBuilderAtEnd(skip->builder, skip->block); } @@ -284,7 +117,7 @@ lp_build_flow_skip_end(struct lp_build_flow_context *flow) void lp_build_mask_check(struct lp_build_mask_context *mask) { - LLVMBuilderRef builder = mask->flow->builder; + LLVMBuilderRef builder = mask->skip.builder; LLVMValueRef value; LLVMValueRef cond; @@ -298,7 +131,7 @@ lp_build_mask_check(struct lp_build_mask_context *mask) ""); /* if cond, goto end of block */ - lp_build_flow_skip_cond_break(mask->flow, cond); + lp_build_flow_skip_cond_break(&mask->skip, cond); } @@ -311,28 +144,27 @@ lp_build_mask_check(struct lp_build_mask_context *mask) */ void lp_build_mask_begin(struct lp_build_mask_context *mask, - struct lp_build_flow_context *flow, + LLVMBuilderRef builder, struct lp_type type, LLVMValueRef value) { memset(mask, 0, sizeof *mask); - mask->flow = flow; mask->reg_type = LLVMIntType(type.width * type.length); - mask->var = lp_build_alloca(flow->builder, + mask->var = lp_build_alloca(builder, lp_build_int_vec_type(type), "execution_mask"); - LLVMBuildStore(flow->builder, value, mask->var); + LLVMBuildStore(builder, value, mask->var); - lp_build_flow_skip_begin(flow); + lp_build_flow_skip_begin(&mask->skip, builder); } LLVMValueRef lp_build_mask_value(struct lp_build_mask_context *mask) { - return LLVMBuildLoad(mask->flow->builder, mask->var, ""); + return LLVMBuildLoad(mask->skip.builder, mask->var, ""); } @@ -345,10 +177,10 @@ void lp_build_mask_update(struct lp_build_mask_context *mask, LLVMValueRef value) { - value = LLVMBuildAnd(mask->flow->builder, + value = LLVMBuildAnd(mask->skip.builder, lp_build_mask_value(mask), value, ""); - LLVMBuildStore(mask->flow->builder, value, mask->var); + LLVMBuildStore(mask->skip.builder, value, mask->var); } @@ -358,7 +190,7 @@ lp_build_mask_update(struct lp_build_mask_context *mask, LLVMValueRef lp_build_mask_end(struct lp_build_mask_context *mask) { - lp_build_flow_skip_end(mask->flow); + lp_build_flow_skip_end(&mask->skip); return lp_build_mask_value(mask); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index a4fc8d1955..e21d9de280 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -41,29 +41,33 @@ struct lp_type; -struct lp_build_flow_context; - - -struct lp_build_flow_context * -lp_build_flow_create(LLVMBuilderRef builder); +/** + * Early exit. Useful to skip to the end of a function or block when + * the execution mask becomes zero or when there is an error condition. + */ +struct lp_build_skip_context +{ + LLVMBuilderRef builder; -void -lp_build_flow_destroy(struct lp_build_flow_context *flow); + /** Block to skip to */ + LLVMBasicBlockRef block; +}; void -lp_build_flow_skip_begin(struct lp_build_flow_context *flow); +lp_build_flow_skip_begin(struct lp_build_skip_context *ctx, + LLVMBuilderRef builder); void -lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow, +lp_build_flow_skip_cond_break(struct lp_build_skip_context *ctx, LLVMValueRef cond); void -lp_build_flow_skip_end(struct lp_build_flow_context *flow); +lp_build_flow_skip_end(struct lp_build_skip_context *ctx); struct lp_build_mask_context { - struct lp_build_flow_context *flow; + struct lp_build_skip_context skip; LLVMTypeRef reg_type; @@ -73,7 +77,7 @@ struct lp_build_mask_context void lp_build_mask_begin(struct lp_build_mask_context *mask, - struct lp_build_flow_context *flow, + LLVMBuilderRef builder, struct lp_type type, LLVMValueRef value); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 3b0706e3ec..6bfd02061d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -237,7 +237,6 @@ generate_fs(struct llvmpipe_context *lp, LLVMValueRef z; LLVMValueRef zs_value = NULL; LLVMValueRef stencil_refs[2]; - struct lp_build_flow_context *flow; struct lp_build_mask_context mask; boolean simple_shader = (shader->info.file_count[TGSI_FILE_SAMPLER] == 0 && shader->info.num_inputs < 3 && @@ -286,8 +285,6 @@ generate_fs(struct llvmpipe_context *lp, consts_ptr = lp_jit_context_constants(builder, context_ptr); - flow = lp_build_flow_create(builder); - memset(outputs, 0, sizeof outputs); /* Declare the color and z variables */ @@ -307,7 +304,7 @@ generate_fs(struct llvmpipe_context *lp, } /* 'mask' will control execution based on quad's pixel alive/killed state */ - lp_build_mask_begin(&mask, flow, type, *pmask); + lp_build_mask_begin(&mask, builder, type, *pmask); if (!(depth_mode & EARLY_DEPTH_TEST) && !simple_shader) lp_build_mask_check(&mask); @@ -424,8 +421,6 @@ generate_fs(struct llvmpipe_context *lp, lp_build_mask_value(&mask), counter); *pmask = lp_build_mask_end(&mask); - - lp_build_flow_destroy(flow); } @@ -450,7 +445,6 @@ generate_blend(const struct pipe_blend_state *blend, boolean do_branch) { struct lp_build_context bld; - struct lp_build_flow_context *flow; struct lp_build_mask_context mask_ctx; LLVMTypeRef vec_type; LLVMValueRef const_ptr; @@ -461,8 +455,7 @@ generate_blend(const struct pipe_blend_state *blend, lp_build_context_init(&bld, builder, type); - flow = lp_build_flow_create(builder); - lp_build_mask_begin(&mask_ctx, flow, type, mask); + lp_build_mask_begin(&mask_ctx, builder, type, mask); if (do_branch) lp_build_mask_check(&mask_ctx); @@ -497,7 +490,6 @@ generate_blend(const struct pipe_blend_state *blend, } lp_build_mask_end(&mask_ctx); - lp_build_flow_destroy(flow); } -- cgit v1.2.3 From 124adf253c5cd4940088ca2f10bc12da30375683 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 10 Oct 2010 18:45:14 +0100 Subject: gallivm: Fix a long standing bug with nested if-then-else emission. We can't patch true-block at end-if time, as there is no guarantee that the block at the beginning of the true stanza is the same at the end of the true stanza -- other control flow elements may have been emitted half way the true stanza. Although this bug surfaced recently with the commit to skip mip filtering when lod is an integer the bug was always there, although probably it was avoided until now: e.g., cubemap selection nests if-then-else on the else stanza, which does not suffer from the same problem. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index 99a49df317..9d1a74f5d1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -320,7 +320,6 @@ lp_build_if(struct lp_build_if_state *ifthen, /* create endif/merge basic block for the phi functions */ ifthen->merge_block = lp_build_insert_new_block(builder, "endif-block"); - LLVMPositionBuilderAtEnd(builder, ifthen->merge_block); /* create/insert true_block before merge_block */ ifthen->true_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-true-block"); @@ -336,6 +335,9 @@ lp_build_if(struct lp_build_if_state *ifthen, void lp_build_else(struct lp_build_if_state *ifthen) { + /* Append an unconditional Br(anch) instruction on the true_block */ + LLVMBuildBr(ifthen->builder, ifthen->merge_block); + /* create/insert false_block before the merge block */ ifthen->false_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-false-block"); @@ -353,9 +355,9 @@ lp_build_endif(struct lp_build_if_state *ifthen) /* Insert branch to the merge block from current block */ LLVMBuildBr(ifthen->builder, ifthen->merge_block); - /*** - *** Now patch in the various branch instructions. - ***/ + /* + * Now patch in the various branch instructions. + */ /* Insert the conditional branch instruction at the end of entry_block */ LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->entry_block); @@ -370,19 +372,6 @@ lp_build_endif(struct lp_build_if_state *ifthen) ifthen->true_block, ifthen->merge_block); } - /* Insert branch from end of true_block to merge_block */ - if (ifthen->false_block) { - /* Append an unconditional Br(anch) instruction on the true_block */ - LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->true_block); - LLVMBuildBr(ifthen->builder, ifthen->merge_block); - } - else { - /* No else clause. - * Note that we've already inserted the branch at the end of - * true_block. See the very first LLVMBuildBr() call in this function. - */ - } - /* Resume building code at end of the ifthen->merge_block */ LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->merge_block); } -- cgit v1.2.3 From 48003f3567d2732cfab08186934c4261c0447c9c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 10 Oct 2010 18:47:24 +0100 Subject: gallivm: Allow to disable bri-linear filtering with GALLIVM_DEBUG=no_brilinear runtime option --- src/gallium/auxiliary/gallivm/lp_bld_debug.h | 11 ++++++----- src/gallium/auxiliary/gallivm/lp_bld_init.c | 1 + src/gallium/auxiliary/gallivm/lp_bld_sample.c | 7 +++---- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h index 369c1bbf09..eb11dcd4ef 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h @@ -36,11 +36,12 @@ #include "util/u_string.h" -#define GALLIVM_DEBUG_TGSI 0x1 -#define GALLIVM_DEBUG_IR 0x2 -#define GALLIVM_DEBUG_ASM 0x4 -#define GALLIVM_DEBUG_NO_OPT 0x8 -#define GALLIVM_DEBUG_PERF 0x10 +#define GALLIVM_DEBUG_TGSI (1 << 0) +#define GALLIVM_DEBUG_IR (1 << 1) +#define GALLIVM_DEBUG_ASM (1 << 2) +#define GALLIVM_DEBUG_NO_OPT (1 << 3) +#define GALLIVM_DEBUG_PERF (1 << 4) +#define GALLIVM_DEBUG_NO_BRILINEAR (1 << 5) #ifdef DEBUG diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 761f33b578..5598ca5c48 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -44,6 +44,7 @@ static const struct debug_named_value lp_bld_debug_flags[] = { { "asm", GALLIVM_DEBUG_ASM, NULL }, { "nopt", GALLIVM_DEBUG_NO_OPT, NULL }, { "perf", GALLIVM_DEBUG_PERF, NULL }, + { "no_brilinear", GALLIVM_DEBUG_NO_BRILINEAR, NULL }, DEBUG_NAMED_VALUE_END }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 1a27a24118..9d15a6f4da 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -47,8 +47,7 @@ /* - * Bri-linear factor. Use zero or any other number less than one to force - * tri-linear filtering. + * Bri-linear factor. Should be greater than one. */ #define BRILINEAR_FACTOR 2 @@ -464,7 +463,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, return; } if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR && - BRILINEAR_FACTOR > 1.0) { + !(gallivm_debug & GALLIVM_DEBUG_NO_BRILINEAR)) { lp_build_brilinear_rho(float_bld, rho, BRILINEAR_FACTOR, out_lod_ipart, out_lod_fpart); return; @@ -507,7 +506,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld, } if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - if (BRILINEAR_FACTOR > 1.0) { + if (!(gallivm_debug & GALLIVM_DEBUG_NO_BRILINEAR)) { lp_build_brilinear_lod(float_bld, lod, BRILINEAR_FACTOR, out_lod_ipart, out_lod_fpart); } -- cgit v1.2.3 From 693667bf88abcb60332a6f94c8f06a9fe7d62613 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 10 Oct 2010 19:05:05 +0100 Subject: gallivm: Use variables instead of Phis in loops. With this commit all explicit Phi emission is now gone. --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 62 ++++++++++------------------- src/gallium/auxiliary/gallivm/lp_bld_flow.h | 3 +- 2 files changed, 23 insertions(+), 42 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index 9d1a74f5d1..f9d061fcb4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -201,59 +201,27 @@ lp_build_loop_begin(LLVMBuilderRef builder, LLVMValueRef start, struct lp_build_loop_state *state) { - LLVMBasicBlockRef block = LLVMGetInsertBlock(builder); - LLVMValueRef function = LLVMGetBasicBlockParent(block); + state->block = lp_build_insert_new_block(builder, "loop_begin"); + + state->counter_var = lp_build_alloca(builder, LLVMTypeOf(start), "loop_counter"); - state->block = LLVMAppendBasicBlock(function, "loop"); + LLVMBuildStore(builder, start, state->counter_var); LLVMBuildBr(builder, state->block); LLVMPositionBuilderAtEnd(builder, state->block); - state->counter = LLVMBuildPhi(builder, LLVMTypeOf(start), ""); - - LLVMAddIncoming(state->counter, &start, &block, 1); - + state->counter = LLVMBuildLoad(builder, state->counter_var, ""); } -void -lp_build_loop_end(LLVMBuilderRef builder, - LLVMValueRef end, - LLVMValueRef step, - struct lp_build_loop_state *state) -{ - LLVMBasicBlockRef block = LLVMGetInsertBlock(builder); - LLVMValueRef function = LLVMGetBasicBlockParent(block); - LLVMValueRef next; - LLVMValueRef cond; - LLVMBasicBlockRef after_block; - - if (!step) - step = LLVMConstInt(LLVMTypeOf(end), 1, 0); - - next = LLVMBuildAdd(builder, state->counter, step, ""); - - cond = LLVMBuildICmp(builder, LLVMIntNE, next, end, ""); - - after_block = LLVMAppendBasicBlock(function, ""); - - LLVMBuildCondBr(builder, cond, after_block, state->block); - - LLVMAddIncoming(state->counter, &next, &block, 1); - - LLVMPositionBuilderAtEnd(builder, after_block); -} - void lp_build_loop_end_cond(LLVMBuilderRef builder, LLVMValueRef end, LLVMValueRef step, - int llvm_cond, + LLVMIntPredicate llvm_cond, struct lp_build_loop_state *state) { - LLVMBasicBlockRef block = LLVMGetInsertBlock(builder); - LLVMValueRef function = LLVMGetBasicBlockParent(block); LLVMValueRef next; LLVMValueRef cond; LLVMBasicBlockRef after_block; @@ -263,15 +231,27 @@ lp_build_loop_end_cond(LLVMBuilderRef builder, next = LLVMBuildAdd(builder, state->counter, step, ""); + LLVMBuildStore(builder, next, state->counter_var); + cond = LLVMBuildICmp(builder, llvm_cond, next, end, ""); - after_block = LLVMAppendBasicBlock(function, ""); + after_block = lp_build_insert_new_block(builder, "loop_end"); LLVMBuildCondBr(builder, cond, after_block, state->block); - LLVMAddIncoming(state->counter, &next, &block, 1); - LLVMPositionBuilderAtEnd(builder, after_block); + + state->counter = LLVMBuildLoad(builder, state->counter_var, ""); +} + + +void +lp_build_loop_end(LLVMBuilderRef builder, + LLVMValueRef end, + LLVMValueRef step, + struct lp_build_loop_state *state) +{ + lp_build_loop_end_cond(builder, end, step, LLVMIntNE, state); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index e21d9de280..e729ee6eaa 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -108,6 +108,7 @@ lp_build_mask_end(struct lp_build_mask_context *mask); struct lp_build_loop_state { LLVMBasicBlockRef block; + LLVMValueRef counter_var; LLVMValueRef counter; }; @@ -128,7 +129,7 @@ void lp_build_loop_end_cond(LLVMBuilderRef builder, LLVMValueRef end, LLVMValueRef step, - int cond, /* LLVM condition */ + LLVMIntPredicate cond, struct lp_build_loop_state *state); -- cgit v1.2.3 From 17dbd41cf23e7e7de2f27e5e9252d7f792d932f3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 10 Oct 2010 19:51:35 +0100 Subject: gallivm: Pass texture coords derivates as scalars. We end up treating them as scalars in the end, and it saves some instructions. --- src/gallium/auxiliary/gallivm/lp_bld_quad.c | 28 +++++++++++++++-------- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 12 +++++----- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 8 +++---- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 16 ++++++++----- 4 files changed, 38 insertions(+), 26 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_quad.c b/src/gallium/auxiliary/gallivm/lp_bld_quad.c index 7b1088939b..c18c8b4710 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_quad.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_quad.c @@ -81,11 +81,15 @@ LLVMValueRef lp_build_scalar_ddx(struct lp_build_context *bld, LLVMValueRef a) { - LLVMValueRef idx_left = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_TOP_LEFT, 0); - LLVMValueRef idx_right = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_TOP_RIGHT, 0); - LLVMValueRef a_left = LLVMBuildExtractElement(bld->builder, a, idx_left, ""); - LLVMValueRef a_right = LLVMBuildExtractElement(bld->builder, a, idx_right, ""); - return lp_build_sub(bld, a_right, a_left); + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef idx_left = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_LEFT, 0); + LLVMValueRef idx_right = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_RIGHT, 0); + LLVMValueRef a_left = LLVMBuildExtractElement(bld->builder, a, idx_left, "left"); + LLVMValueRef a_right = LLVMBuildExtractElement(bld->builder, a, idx_right, "right"); + if (bld->type.floating) + return LLVMBuildFSub(bld->builder, a_right, a_left, "ddx"); + else + return LLVMBuildSub(bld->builder, a_right, a_left, "ddx"); } @@ -93,9 +97,13 @@ LLVMValueRef lp_build_scalar_ddy(struct lp_build_context *bld, LLVMValueRef a) { - LLVMValueRef idx_top = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_TOP_LEFT, 0); - LLVMValueRef idx_bottom = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_BOTTOM_LEFT, 0); - LLVMValueRef a_top = LLVMBuildExtractElement(bld->builder, a, idx_top, ""); - LLVMValueRef a_bottom = LLVMBuildExtractElement(bld->builder, a, idx_bottom, ""); - return lp_build_sub(bld, a_bottom, a_top); + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef idx_top = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_LEFT, 0); + LLVMValueRef idx_bottom = LLVMConstInt(i32t, LP_BLD_QUAD_BOTTOM_LEFT, 0); + LLVMValueRef a_top = LLVMBuildExtractElement(bld->builder, a, idx_top, "top"); + LLVMValueRef a_bottom = LLVMBuildExtractElement(bld->builder, a, idx_bottom, "bottom"); + if (bld->type.floating) + return LLVMBuildFSub(bld->builder, a_bottom, a_top, "ddy"); + else + return LLVMBuildSub(bld->builder, a_bottom, a_top, "ddy"); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 9d15a6f4da..844d1d935b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -200,8 +200,8 @@ lp_build_rho(struct lp_build_sample_context *bld, LLVMValueRef float_size; LLVMValueRef rho; - dsdx = LLVMBuildExtractElement(bld->builder, ddx[0], index0, "dsdx"); - dsdy = LLVMBuildExtractElement(bld->builder, ddy[0], index0, "dsdy"); + dsdx = ddx[0]; + dsdy = ddy[0]; if (dims <= 1) { rho_x = dsdx; @@ -214,15 +214,15 @@ lp_build_rho(struct lp_build_sample_context *bld, 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"); - dtdy = LLVMBuildExtractElement(bld->builder, ddy[1], index0, "dtdy"); + dtdx = ddx[1]; + dtdy = ddy[1]; 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"); - drdy = LLVMBuildExtractElement(bld->builder, ddy[2], index0, "drdy"); + drdx = ddx[2]; + drdy = ddy[2]; rho_x = LLVMBuildInsertElement(bld->builder, rho_x, drdx, index2, ""); rho_y = LLVMBuildInsertElement(bld->builder, rho_y, drdy, index2, ""); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 69d81ad971..be5d9a261a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -942,12 +942,12 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, r = lp_build_broadcast_scalar(&bld->int_coord_bld, face); /* vec */ /* recompute ddx, ddy using the new (s,t) face texcoords */ - face_ddx[0] = lp_build_ddx(&bld->coord_bld, s); - face_ddx[1] = lp_build_ddx(&bld->coord_bld, t); + face_ddx[0] = lp_build_scalar_ddx(&bld->coord_bld, s); + face_ddx[1] = lp_build_scalar_ddx(&bld->coord_bld, t); face_ddx[2] = NULL; face_ddx[3] = NULL; - face_ddy[0] = lp_build_ddy(&bld->coord_bld, s); - face_ddy[1] = lp_build_ddy(&bld->coord_bld, t); + face_ddy[0] = lp_build_scalar_ddy(&bld->coord_bld, s); + face_ddy[1] = lp_build_scalar_ddy(&bld->coord_bld, t); face_ddy[2] = NULL; face_ddy[3] = NULL; ddx = face_ddx; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 03020a62f8..2d4eb9a925 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -887,21 +887,25 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, } if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) { + LLVMTypeRef i32t = LLVMInt32Type(); + LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0); for (i = 0; i < num_coords; i++) { - ddx[i] = emit_fetch( bld, inst, 1, i ); - ddy[i] = emit_fetch( bld, inst, 2, i ); + LLVMValueRef src1 = emit_fetch( bld, inst, 1, i ); + LLVMValueRef src2 = emit_fetch( bld, inst, 2, i ); + ddx[i] = LLVMBuildExtractElement(bld->base.builder, src1, index0, ""); + ddy[i] = LLVMBuildExtractElement(bld->base.builder, src2, index0, ""); } unit = inst->Src[3].Register.Index; } else { for (i = 0; i < num_coords; i++) { - ddx[i] = lp_build_ddx( &bld->base, coords[i] ); - ddy[i] = lp_build_ddy( &bld->base, coords[i] ); + ddx[i] = lp_build_scalar_ddx( &bld->base, coords[i] ); + ddy[i] = lp_build_scalar_ddy( &bld->base, coords[i] ); } unit = inst->Src[1].Register.Index; } for (i = num_coords; i < 3; i++) { - ddx[i] = bld->base.undef; - ddy[i] = bld->base.undef; + ddx[i] = LLVMGetUndef(bld->base.elem_type); + ddy[i] = LLVMGetUndef(bld->base.elem_type); } bld->sampler->emit_fetch_texel(bld->sampler, -- cgit v1.2.3 From bd89da79a1acc8b896a7f5afc71435befe2ff7e4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 09:51:09 +1000 Subject: r600g: fix input/output Z export mixup for evergreen. --- src/gallium/drivers/r600/evergreen_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 0fd1d39951..81db2e25e8 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1546,7 +1546,7 @@ 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++) { - 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 2c47f302af48fe2a464230efb63dfe543740d1fb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 10:17:51 +1000 Subject: r600g: evergreen has no request size bit in texture word4 --- src/gallium/drivers/r600/evergreen_state.c | 1 - src/gallium/drivers/r600/evergreend.h | 3 --- 2 files changed, 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 81db2e25e8..bdd54811fb 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -464,7 +464,6 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte 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, R_030014_RESOURCE0_WORD5, S_030014_LAST_LEVEL(state->last_level) | diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 9971dded78..eb36a35165 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -984,9 +984,6 @@ #define S_030010_ENDIAN_SWAP(x) (((x) & 0x3) << 12) #define G_030010_ENDIAN_SWAP(x) (((x) >> 12) & 0x3) #define C_030010_ENDIAN_SWAP 0xFFFFCFFF -#define S_030010_REQUEST_SIZE(x) (((x) & 0x3) << 14) -#define G_030010_REQUEST_SIZE(x) (((x) >> 14) & 0x3) -#define C_030010_REQUEST_SIZE 0xFFFF3FFF #define S_030010_DST_SEL_X(x) (((x) & 0x7) << 16) #define G_030010_DST_SEL_X(x) (((x) >> 16) & 0x7) #define C_030010_DST_SEL_X 0xFFF8FFFF -- cgit v1.2.3 From ea1d818b58d6ff9e4cd0c40eb865beabde8f268c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 11 Oct 2010 11:58:27 +1000 Subject: r600g: enable vertex samplers. We need to move the texture sampler resources out of the range of the vertex attribs. We could probably improve this using an allocator but this is the simple answer for now. makes mesa-demos/src/glsl/vert-tex work. --- src/gallium/drivers/r600/evergreen_state.c | 11 ++++++++--- src/gallium/drivers/r600/r600_pipe.c | 2 +- src/gallium/drivers/r600/r600_shader.c | 6 ++++-- src/gallium/drivers/r600/r600_state.c | 11 ++++++++--- 4 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index bdd54811fb..323509f640 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -480,8 +480,14 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { - /* TODO */ - assert(1); + 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]) { + evergreen_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, i + PIPE_MAX_ATTRIBS); + } + } } static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, @@ -523,7 +529,6 @@ static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned count, 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++) { evergreen_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); } diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 0589652f70..832a2b2b60 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -257,7 +257,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 14; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: /* FIXME allow this once infrastructure is there */ - return 0; + return 16; case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: case PIPE_CAP_MAX_COMBINED_SAMPLERS: return 16; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 366d5d9c35..d22325e8b7 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1866,8 +1866,10 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) memset(&tex, 0, sizeof(struct r600_bc_tex)); tex.inst = opcode; - tex.resource_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index; - tex.sampler_id = tex.resource_id; + tex.sampler_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index; + tex.resource_id = tex.sampler_id; + if (ctx->shader->processor_type == TGSI_PROCESSOR_VERTEX) + tex.resource_id += PIPE_MAX_ATTRIBS; 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 = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 7ceedf6363..29d9d154a2 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -683,8 +683,14 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { - /* TODO */ - assert(1); + 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 + PIPE_MAX_ATTRIBS); + } + } } static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, @@ -726,7 +732,6 @@ static void r600_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void 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); } -- cgit v1.2.3 From ef2702fb2003944998ab1578119fb44fe16d1c82 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 11 Oct 2010 12:18:05 +1000 Subject: r600g: add TXL opcode support. fixes glsl1-2D Texture lookup with explicit lod (Vertex shader) --- src/gallium/drivers/r600/r600_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d22325e8b7..341800306d 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -2926,7 +2926,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_NRM, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DIV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DP2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, - {TGSI_OPCODE_TXL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_TXL, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex}, {TGSI_OPCODE_BRK, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK, tgsi_loop_brk_cont}, {TGSI_OPCODE_IF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if}, /* gap */ @@ -3084,7 +3084,7 @@ static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = { {TGSI_OPCODE_NRM, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DIV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, {TGSI_OPCODE_DP2, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp}, - {TGSI_OPCODE_TXL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_TXL, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex}, {TGSI_OPCODE_BRK, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK, tgsi_loop_brk_cont}, {TGSI_OPCODE_IF, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if}, /* gap */ -- cgit v1.2.3 From 3322416de44f27974edaba2aee8b2d2d21de6a8f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 11 Oct 2010 16:20:56 +1000 Subject: r600g: don't run with scissors. This could probably be done much nicer, I've spent a day chasing a coherency problem in the kernel, that turned out to be incorrect scissor setup. --- src/gallium/drivers/r600/evergreen_state.c | 45 ++++++++++++++++++++++++++++ src/gallium/drivers/r600/r600_state.c | 47 ++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 323509f640..99085647a7 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -899,6 +899,51 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_028254_PA_SC_VPORT_SCISSOR_0_BR, br, 0xFFFFFFFF, NULL); + 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); + r600_pipe_state_add_reg(rstate, + R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, + 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK, 0x00000000, target_mask, NULL); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 29d9d154a2..a2a76cdeb7 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1074,6 +1074,18 @@ 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, + 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_028240_PA_SC_GENERIC_SCISSOR_TL, tl, 0xFFFFFFFF, NULL); @@ -1086,6 +1098,41 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_028254_PA_SC_VPORT_SCISSOR_0_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); + } r600_pipe_state_add_reg(rstate, R_0287A0_CB_SHADER_CONTROL, shader_control, 0xFFFFFFFF, NULL); -- cgit v1.2.3 From b18fecbd0ea33c9db7e3fd676ed7b5877ebb1bd5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 10 Oct 2010 23:36:14 +0100 Subject: llvmpipe: Remove outdated comment about stencil testing. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index e768493103..264fce8d6a 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.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 @@ -53,15 +53,8 @@ * ... ... ... ... ... ... ... ... ... * * - * Stencil test: - * Two-sided stencil test is supported but probably not as efficient as - * it could be. Currently, we use if/then/else constructs to do the - * operations for front vs. back-facing polygons. We could probably do - * both the front and back arithmetic then use a Select() instruction to - * choose the result depending on polyon orientation. We'd have to - * measure performance both ways and see which is better. - * * @author Jose Fonseca + * @author Brian Paul */ #include "pipe/p_state.h" -- cgit v1.2.3 From e1003336f0dcd9248c0127fbdc173522e35c5bdb Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 10 Oct 2010 23:55:24 +0100 Subject: gallivm: Eliminate unsigned integer arithmetic from texture coordinates. SSE support for 32bit and 16bit unsigned arithmetic is not complete, and can easily result in inefficient code. In most cases signed/unsigned doesn't make a difference, such as for integer texture coordinates. So remove uint_coord_type and uint_coord_bld to avoid inefficient operations to sneak in the future. --- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 4 -- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 50 +++++++++++------------ src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 20 ++++----- 3 files changed, 32 insertions(+), 42 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index ce2285446a..ffed27cee8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -197,10 +197,6 @@ struct lp_build_sample_context struct lp_type coord_type; struct lp_build_context coord_bld; - /** Unsigned integer coordinates */ - struct lp_type uint_coord_type; - struct lp_build_context uint_coord_bld; - /** Signed integer coordinates */ struct lp_type int_coord_type; struct lp_build_context int_coord_bld; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index be5d9a261a..641d24b5b6 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -81,11 +81,10 @@ lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld, LLVMValueRef *out_offset, LLVMValueRef *out_i) { - struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; LLVMValueRef length_minus_one; - length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one); + length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one); switch(wrap_mode) { case PIPE_TEX_WRAP_REPEAT: @@ -93,7 +92,7 @@ lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld, coord = LLVMBuildAnd(bld->builder, coord, length_minus_one, ""); else { /* Add a bias to the texcoord to handle negative coords */ - LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024); coord = LLVMBuildAdd(bld->builder, coord, bias, ""); coord = LLVMBuildURem(bld->builder, coord, length, ""); } @@ -114,7 +113,7 @@ lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld, assert(0); } - lp_build_sample_partial_offset(uint_coord_bld, block_length, coord, stride, + lp_build_sample_partial_offset(int_coord_bld, block_length, coord, stride, out_offset, out_i); } @@ -147,7 +146,6 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, LLVMValueRef *i0, LLVMValueRef *i1) { - struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; LLVMValueRef length_minus_one; LLVMValueRef lmask, umask, mask; @@ -189,8 +187,8 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, * multiplication. */ - *i0 = uint_coord_bld->zero; - *i1 = uint_coord_bld->zero; + *i0 = int_coord_bld->zero; + *i1 = int_coord_bld->zero; length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one); @@ -201,7 +199,7 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, } else { /* Add a bias to the texcoord to handle negative coords */ - LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024); coord0 = LLVMBuildAdd(bld->builder, coord0, bias, ""); coord0 = LLVMBuildURem(bld->builder, coord0, length, ""); } @@ -209,9 +207,9 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, mask = lp_build_compare(bld->builder, int_coord_bld->type, PIPE_FUNC_NOTEQUAL, coord0, length_minus_one); - *offset0 = lp_build_mul(uint_coord_bld, coord0, stride); + *offset0 = lp_build_mul(int_coord_bld, coord0, stride); *offset1 = LLVMBuildAnd(bld->builder, - lp_build_add(uint_coord_bld, *offset0, stride), + lp_build_add(int_coord_bld, *offset0, stride), mask, ""); break; @@ -226,8 +224,8 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, mask = LLVMBuildAnd(bld->builder, lmask, umask, ""); - *offset0 = lp_build_mul(uint_coord_bld, coord0, stride); - *offset1 = lp_build_add(uint_coord_bld, + *offset0 = lp_build_mul(int_coord_bld, coord0, stride); + *offset1 = lp_build_add(int_coord_bld, *offset0, LLVMBuildAnd(bld->builder, stride, mask, "")); break; @@ -240,8 +238,8 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld, case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: default: assert(0); - *offset0 = uint_coord_bld->zero; - *offset1 = uint_coord_bld->zero; + *offset0 = int_coord_bld->zero; + *offset1 = int_coord_bld->zero; break; } } @@ -327,7 +325,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, r_ipart = LLVMBuildAShr(builder, r, i32_c8, ""); /* get pixel, row, image strides */ - x_stride = lp_build_const_vec(bld->uint_coord_bld.type, + x_stride = lp_build_const_vec(bld->int_coord_bld.type, bld->format_desc->block.bits/8); /* Do texcoord wrapping, compute texel offset */ @@ -346,7 +344,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, bld->static_state->pot_height, bld->static_state->wrap_t, &y_offset, &y_subcoord); - offset = lp_build_add(&bld->uint_coord_bld, offset, y_offset); + offset = lp_build_add(&bld->int_coord_bld, offset, y_offset); if (dims >= 3) { LLVMValueRef z_offset; lp_build_sample_wrap_nearest_int(bld, @@ -355,13 +353,13 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, bld->static_state->pot_height, bld->static_state->wrap_r, &z_offset, &z_subcoord); - offset = lp_build_add(&bld->uint_coord_bld, offset, z_offset); + offset = lp_build_add(&bld->int_coord_bld, offset, z_offset); } else if (bld->static_state->target == PIPE_TEXTURE_CUBE) { LLVMValueRef z_offset; /* The r coord is the cube face in [0,5] */ - z_offset = lp_build_mul(&bld->uint_coord_bld, r, img_stride_vec); - offset = lp_build_add(&bld->uint_coord_bld, offset, z_offset); + z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec); + offset = lp_build_add(&bld->int_coord_bld, offset, z_offset); } } @@ -522,7 +520,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, r_fpart = LLVMBuildAnd(builder, r, i32_c255, ""); /* get pixel, row and image strides */ - x_stride = lp_build_const_vec(bld->uint_coord_bld.type, + x_stride = lp_build_const_vec(bld->int_coord_bld.type, bld->format_desc->block.bits/8); y_stride = row_stride_vec; z_stride = img_stride_vec; @@ -553,9 +551,9 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, for (z = 0; z < 2; z++) { for (x = 0; x < 2; x++) { - offset[z][0][x] = lp_build_add(&bld->uint_coord_bld, + offset[z][0][x] = lp_build_add(&bld->int_coord_bld, offset[z][0][x], y_offset0); - offset[z][1][x] = lp_build_add(&bld->uint_coord_bld, + offset[z][1][x] = lp_build_add(&bld->int_coord_bld, offset[z][1][x], y_offset1); } } @@ -571,20 +569,20 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld, &z_subcoord[0], &z_subcoord[1]); for (y = 0; y < 2; y++) { for (x = 0; x < 2; x++) { - offset[0][y][x] = lp_build_add(&bld->uint_coord_bld, + offset[0][y][x] = lp_build_add(&bld->int_coord_bld, offset[0][y][x], z_offset0); - offset[1][y][x] = lp_build_add(&bld->uint_coord_bld, + offset[1][y][x] = lp_build_add(&bld->int_coord_bld, offset[1][y][x], z_offset1); } } } else if (bld->static_state->target == PIPE_TEXTURE_CUBE) { LLVMValueRef z_offset; - z_offset = lp_build_mul(&bld->uint_coord_bld, r, img_stride_vec); + z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec); for (y = 0; y < 2; y++) { for (x = 0; x < 2; x++) { /* The r coord is the cube face in [0,5] */ - offset[0][y][x] = lp_build_add(&bld->uint_coord_bld, + offset[0][y][x] = lp_build_add(&bld->int_coord_bld, offset[0][y][x], z_offset); } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 75130e1c54..af3f4688ed 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -131,7 +131,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, } /* convert x,y,z coords to linear offset from start of texture, in bytes */ - lp_build_sample_offset(&bld->uint_coord_bld, + lp_build_sample_offset(&bld->int_coord_bld, bld->format_desc, x, y, z, y_stride, z_stride, &offset, &i, &j); @@ -145,7 +145,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, * coords which are out of bounds to become zero. Zero's guaranteed * to be inside the texture image. */ - offset = lp_build_andnot(&bld->uint_coord_bld, offset, use_border); + offset = lp_build_andnot(&bld->int_coord_bld, offset, use_border); } lp_build_fetch_rgba_soa(bld->builder, @@ -239,9 +239,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, { struct lp_build_context *coord_bld = &bld->coord_bld; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; - struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5); - LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one); + LLVMValueRef length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one); LLVMValueRef coord0, coord1, weight; switch(wrap_mode) { @@ -253,20 +252,20 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight); /* repeat wrap */ if (is_pot) { - coord1 = lp_build_add(uint_coord_bld, coord0, uint_coord_bld->one); + coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, ""); coord1 = LLVMBuildAnd(bld->builder, coord1, length_minus_one, ""); } else { /* Add a bias to the texcoord to handle negative coords */ - LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024); LLVMValueRef mask; coord0 = LLVMBuildAdd(bld->builder, coord0, bias, ""); coord0 = LLVMBuildURem(bld->builder, coord0, length, ""); mask = lp_build_compare(bld->builder, int_coord_bld->type, PIPE_FUNC_NOTEQUAL, coord0, length_minus_one); coord1 = LLVMBuildAnd(bld->builder, - lp_build_add(uint_coord_bld, coord0, uint_coord_bld->one), + lp_build_add(int_coord_bld, coord0, int_coord_bld->one), mask, ""); } break; @@ -448,8 +447,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, { struct lp_build_context *coord_bld = &bld->coord_bld; struct lp_build_context *int_coord_bld = &bld->int_coord_bld; - struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld; - LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one); + LLVMValueRef length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one); LLVMValueRef icoord; switch(wrap_mode) { @@ -460,7 +458,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld, icoord = LLVMBuildAnd(bld->builder, icoord, length_minus_one, ""); else { /* Add a bias to the texcoord to handle negative coords */ - LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024); + LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024); icoord = LLVMBuildAdd(bld->builder, icoord, bias, ""); icoord = LLVMBuildURem(bld->builder, icoord, length, ""); } @@ -1199,7 +1197,6 @@ lp_build_sample_soa(LLVMBuilderRef builder, bld.float_type = lp_type_float(32); bld.int_type = lp_type_int(32); 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; @@ -1212,7 +1209,6 @@ lp_build_sample_soa(LLVMBuilderRef builder, 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); lp_build_context_init(&bld.int_coord_bld, builder, bld.int_coord_type); lp_build_context_init(&bld.int_size_bld, builder, bld.int_size_type); lp_build_context_init(&bld.float_size_bld, builder, bld.float_size_type); -- cgit v1.2.3 From 6c1aa4fd49dab7af21902726d274e0a5a7fea8df Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 22 Aug 2010 17:27:56 +0100 Subject: gallium: Define C99 restrict keyword where absent. --- src/gallium/include/pipe/p_compiler.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index 5020599591..3d6b5b5c81 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -122,6 +122,27 @@ typedef unsigned char boolean; # endif #endif +/* + * Define the C99 restrict keyword. + * + * See also: + * - http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html + */ +#ifndef restrict +# if (__STDC_VERSION__ >= 199901L) + /* C99 */ +# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) + /* C99 */ +# elif defined(__GNUC__) +# define restrict __restrict__ +# elif defined(_MSC_VER) +# define restrict __restrict +# else +# define restrict /* */ +# endif +#endif + + /* Function visibility */ #ifndef PUBLIC # if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) -- cgit v1.2.3 From 11dad217186a4c177cb41aa526531d6cd46ae5b0 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 2 Sep 2010 15:52:44 +0100 Subject: tgsi: Export some names for some tgsi enums. Useful to give human legible names in other cases. --- src/gallium/auxiliary/tgsi/tgsi_dump.c | 49 ++++++++++++++++++---------------- src/gallium/auxiliary/tgsi/tgsi_dump.h | 9 +++++++ 2 files changed, 35 insertions(+), 23 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index f71ffb7030..9b61797ace 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -90,7 +90,8 @@ static const char *processor_type_names[] = "GEOM" }; -static const char *file_names[TGSI_FILE_COUNT] = +const char * +tgsi_file_names[TGSI_FILE_COUNT] = { "NULL", "CONST", @@ -135,7 +136,8 @@ static const char *immediate_type_names[] = "INT32" }; -static const char *swizzle_names[] = +const char * +tgsi_swizzle_names[] = { "x", "y", @@ -143,7 +145,8 @@ static const char *swizzle_names[] = "w" }; -static const char *texture_names[] = +const char * +tgsi_texture_names[] = { "UNKNOWN", "1D", @@ -201,15 +204,15 @@ _dump_register_src( struct dump_ctx *ctx, const struct tgsi_full_src_register *src ) { - ENM(src->Register.File, file_names); + ENM(src->Register.File, tgsi_file_names); if (src->Register.Dimension) { if (src->Dimension.Indirect) { CHR( '[' ); - ENM( src->DimIndirect.File, file_names ); + ENM( src->DimIndirect.File, tgsi_file_names ); CHR( '[' ); SID( src->DimIndirect.Index ); TXT( "]." ); - ENM( src->DimIndirect.SwizzleX, swizzle_names ); + ENM( src->DimIndirect.SwizzleX, tgsi_swizzle_names ); if (src->Dimension.Index != 0) { if (src->Dimension.Index > 0) CHR( '+' ); @@ -224,11 +227,11 @@ _dump_register_src( } if (src->Register.Indirect) { CHR( '[' ); - ENM( src->Indirect.File, file_names ); + ENM( src->Indirect.File, tgsi_file_names ); CHR( '[' ); SID( src->Indirect.Index ); TXT( "]." ); - ENM( src->Indirect.SwizzleX, swizzle_names ); + ENM( src->Indirect.SwizzleX, tgsi_swizzle_names ); if (src->Register.Index != 0) { if (src->Register.Index > 0) CHR( '+' ); @@ -248,15 +251,15 @@ _dump_register_dst( struct dump_ctx *ctx, const struct tgsi_full_dst_register *dst ) { - ENM(dst->Register.File, file_names); + ENM(dst->Register.File, tgsi_file_names); if (dst->Register.Dimension) { if (dst->Dimension.Indirect) { CHR( '[' ); - ENM( dst->DimIndirect.File, file_names ); + ENM( dst->DimIndirect.File, tgsi_file_names ); CHR( '[' ); SID( dst->DimIndirect.Index ); TXT( "]." ); - ENM( dst->DimIndirect.SwizzleX, swizzle_names ); + ENM( dst->DimIndirect.SwizzleX, tgsi_swizzle_names ); if (dst->Dimension.Index != 0) { if (dst->Dimension.Index > 0) CHR( '+' ); @@ -271,11 +274,11 @@ _dump_register_dst( } if (dst->Register.Indirect) { CHR( '[' ); - ENM( dst->Indirect.File, file_names ); + ENM( dst->Indirect.File, tgsi_file_names ); CHR( '[' ); SID( dst->Indirect.Index ); TXT( "]." ); - ENM( dst->Indirect.SwizzleX, swizzle_names ); + ENM( dst->Indirect.SwizzleX, tgsi_swizzle_names ); if (dst->Register.Index != 0) { if (dst->Register.Index > 0) CHR( '+' ); @@ -351,7 +354,7 @@ iter_declaration( TXT( "DCL " ); - ENM(decl->Declaration.File, file_names); + ENM(decl->Declaration.File, tgsi_file_names); /* all geometry shader inputs are two dimensional */ if (decl->Declaration.File == TGSI_FILE_INPUT && @@ -585,10 +588,10 @@ iter_instruction( inst->Predicate.SwizzleZ != TGSI_SWIZZLE_Z || inst->Predicate.SwizzleW != TGSI_SWIZZLE_W) { CHR( '.' ); - ENM( inst->Predicate.SwizzleX, swizzle_names ); - ENM( inst->Predicate.SwizzleY, swizzle_names ); - ENM( inst->Predicate.SwizzleZ, swizzle_names ); - ENM( inst->Predicate.SwizzleW, swizzle_names ); + ENM( inst->Predicate.SwizzleX, tgsi_swizzle_names ); + ENM( inst->Predicate.SwizzleY, tgsi_swizzle_names ); + ENM( inst->Predicate.SwizzleZ, tgsi_swizzle_names ); + ENM( inst->Predicate.SwizzleW, tgsi_swizzle_names ); } TXT( ") " ); @@ -641,10 +644,10 @@ iter_instruction( src->Register.SwizzleZ != TGSI_SWIZZLE_Z || src->Register.SwizzleW != TGSI_SWIZZLE_W) { CHR( '.' ); - ENM( src->Register.SwizzleX, swizzle_names ); - ENM( src->Register.SwizzleY, swizzle_names ); - ENM( src->Register.SwizzleZ, swizzle_names ); - ENM( src->Register.SwizzleW, swizzle_names ); + ENM( src->Register.SwizzleX, tgsi_swizzle_names ); + ENM( src->Register.SwizzleY, tgsi_swizzle_names ); + ENM( src->Register.SwizzleZ, tgsi_swizzle_names ); + ENM( src->Register.SwizzleW, tgsi_swizzle_names ); } if (src->Register.Absolute) @@ -655,7 +658,7 @@ iter_instruction( if (inst->Instruction.Texture) { TXT( ", " ); - ENM( inst->Texture.Texture, texture_names ); + ENM( inst->Texture.Texture, tgsi_texture_names ); } switch (inst->Instruction.Opcode) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.h b/src/gallium/auxiliary/tgsi/tgsi_dump.h index dd78b36100..fc0429ad8d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.h +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.h @@ -35,6 +35,15 @@ extern "C" { #endif +extern const char * +tgsi_file_names[TGSI_FILE_COUNT]; + +extern const char * +tgsi_swizzle_names[]; + +extern const char * +tgsi_texture_names[]; + void tgsi_dump_str( const struct tgsi_token *tokens, -- cgit v1.2.3 From 7c1b5772a81c4f701ae9a6208c9e34792c05d4ab Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 2 Sep 2010 15:54:07 +0100 Subject: gallivm: More detailed analysis of tgsi shaders. To allow more optimizations, in particular for direct textures. --- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 77 ++++ src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c | 480 +++++++++++++++++++++++ 4 files changed, 559 insertions(+) create mode 100644 src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 02af4d9280..abd33f6eef 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -176,6 +176,7 @@ GALLIVM_SOURCES = \ gallivm/lp_bld_struct.c \ gallivm/lp_bld_swizzle.c \ gallivm/lp_bld_tgsi_aos.c \ + gallivm/lp_bld_tgsi_info.c \ gallivm/lp_bld_tgsi_soa.c \ gallivm/lp_bld_type.c \ draw/draw_llvm.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 48547c4b2c..94cd74424a 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -227,6 +227,7 @@ if env['llvm']: 'gallivm/lp_bld_struct.c', 'gallivm/lp_bld_swizzle.c', 'gallivm/lp_bld_tgsi_aos.c', + 'gallivm/lp_bld_tgsi_info.c', 'gallivm/lp_bld_tgsi_soa.c', 'gallivm/lp_bld_type.c', 'draw/draw_llvm.c', diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index 97318b3456..0173bc4a7f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -36,6 +36,9 @@ #define LP_BLD_TGSI_H #include "gallivm/lp_bld.h" +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" +#include "tgsi/tgsi_scan.h" struct tgsi_token; @@ -54,6 +57,75 @@ enum lp_build_tex_modifier { }; +/** + * Describe a channel of a register. + * + * The value can be a: + * - immediate value (i.e. derived from a IMM register) + * - CONST[n].x/y/z/w + * - IN[n].x/y/z/w + * - undetermined (when .file == TGSI_FILE_NULL) + * + * This is one of the analysis results, and is used to described + * the output color in terms of inputs. + */ +struct lp_tgsi_channel_info +{ + unsigned file:4; /* TGSI_FILE_* */ + unsigned swizzle:3; /* PIPE_SWIZZLE_x */ + union { + uint32_t index; + float value; /* for TGSI_FILE_IMMEDIATE */ + }; +}; + + +/** + * Describe a texture sampler interpolator. + * + * The interpolation is described in terms of regular inputs. + */ +struct lp_tgsi_texture_info +{ + struct lp_tgsi_channel_info coord[4]; + unsigned target:8; /* TGSI_TEXTURE_* */ + unsigned unit:8; /* Sampler unit */ + unsigned modifier:8; /* LP_BLD_TEX_MODIFIER_* */ +}; + + +struct lp_tgsi_info +{ + struct tgsi_shader_info base; + + /* + * Whether any of the texture opcodes access a register file other than + * TGSI_FILE_INPUT. + * + * We could also handle TGSI_FILE_CONST/IMMEDIATE here, but there is little + * benefit. + */ + unsigned indirect_textures:1; + + /* + * Texture opcode description. Aimed at detecting and described direct + * texture opcodes. + */ + unsigned num_texs; + struct lp_tgsi_texture_info tex[PIPE_MAX_SAMPLERS]; + + /* + * Output description. Aimed at detecting and describing simple blit + * shaders. + */ + struct lp_tgsi_channel_info output[PIPE_MAX_SHADER_OUTPUTS][4]; + + /* + * Shortcut pointers into the above (for fragment shaders). + */ + const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS]; +}; + /** * Sampler code generation interface. * @@ -96,6 +168,11 @@ struct lp_build_sampler_aos }; +void +lp_build_tgsi_info(const struct tgsi_token *tokens, + struct lp_tgsi_info *info); + + void lp_build_tgsi_soa(LLVMBuilderRef builder, const struct tgsi_token *tokens, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c new file mode 100644 index 0000000000..eab72b8eb7 --- /dev/null +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c @@ -0,0 +1,480 @@ +/************************************************************************** + * + * 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 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 COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#include "util/u_memory.h" +#include "util/u_math.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_text.h" +#include "tgsi/tgsi_util.h" +#include "tgsi/tgsi_dump.h" +#include "lp_bld_debug.h" +#include "lp_bld_tgsi.h" + + +/** + * Analysis context. + * + * This is where we keep store the value of each channel of the IMM/TEMP/OUT + * register values, as we walk the shader. + */ +struct analysis_context +{ + struct lp_tgsi_info *info; + + unsigned num_imms; + float imm[32][4]; + + struct lp_tgsi_channel_info temp[32][4]; +}; + + +/** + * Describe the specified channel of the src register. + */ +static void +analyse_src(struct analysis_context *ctx, + struct lp_tgsi_channel_info *chan_info, + const struct tgsi_src_register *src, + unsigned chan) +{ + chan_info->file = TGSI_FILE_NULL; + if (!src->Indirect && !src->Absolute && !src->Negate) { + unsigned swizzle = tgsi_util_get_src_register_swizzle(src, chan); + if (src->File == TGSI_FILE_TEMPORARY) { + if (src->Index < Elements(ctx->temp)) { + *chan_info = ctx->temp[src->Index][swizzle]; + } + } else { + chan_info->file = src->File; + if (src->File == TGSI_FILE_IMMEDIATE) { + assert(src->Index < Elements(ctx->imm)); + if (src->Index < Elements(ctx->imm)) { + chan_info->value = ctx->imm[src->Index][swizzle]; + } + } else { + chan_info->index = src->Index; + chan_info->swizzle = swizzle; + } + } + } +} + + +/** + * Whether this register channel refers to a specific immediate value. + */ +static boolean +is_immediate(const struct lp_tgsi_channel_info *chan_info, float value) +{ + return chan_info->file == TGSI_FILE_IMMEDIATE && + chan_info->value == value; +} + + +static void +analyse_tex(struct analysis_context *ctx, + const struct tgsi_full_instruction *inst, + enum lp_build_tex_modifier modifier) +{ + struct lp_tgsi_info *info = ctx->info; + unsigned chan; + + if (info->num_texs < Elements(info->tex)) { + struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs]; + bool indirect = FALSE; + unsigned readmask = 0; + + tex_info->target = inst->Texture.Texture; + switch (inst->Texture.Texture) { + case TGSI_TEXTURE_1D: + readmask = TGSI_WRITEMASK_X; + break; + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_RECT: + readmask = TGSI_WRITEMASK_XY; + break; + case TGSI_TEXTURE_SHADOW1D: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_SHADOWRECT: + case TGSI_TEXTURE_3D: + case TGSI_TEXTURE_CUBE: + readmask = TGSI_WRITEMASK_XYZ; + break; + default: + assert(0); + return; + } + + if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) { + /* We don't track explicit derivatives, although we could */ + indirect = TRUE; + tex_info->unit = inst->Src[3].Register.Index; + } else { + if (modifier == LP_BLD_TEX_MODIFIER_PROJECTED || + modifier == LP_BLD_TEX_MODIFIER_LOD_BIAS || + modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_LOD) { + readmask |= TGSI_WRITEMASK_W; + } + tex_info->unit = inst->Src[1].Register.Index; + } + + for (chan = 0; chan < 4; ++chan) { + struct lp_tgsi_channel_info *chan_info = &tex_info->coord[chan]; + if (readmask & (1 << chan)) { + analyse_src(ctx, chan_info, &inst->Src[0].Register, chan); + if (chan_info->file != TGSI_FILE_INPUT) { + indirect = TRUE; + } + } else { + memset(chan_info, 0, sizeof *chan_info); + } + } + + if (indirect) { + info->indirect_textures = TRUE; + } + + ++info->num_texs; + } else { + info->indirect_textures = TRUE; + } +} + + +/** + * Process an instruction, and update the register values accordingly. + */ +static void +analyse_instruction(struct analysis_context *ctx, + struct tgsi_full_instruction *inst) +{ + struct lp_tgsi_info *info = ctx->info; + struct lp_tgsi_channel_info (*regs)[4]; + unsigned max_regs; + unsigned i; + unsigned index; + unsigned chan; + + for (i = 0; i < inst->Instruction.NumDstRegs; ++i) { + const struct tgsi_dst_register *dst = &inst->Dst[i].Register; + + /* + * Get the lp_tgsi_channel_info array corresponding to the destination + * register file. + */ + + if (dst->File == TGSI_FILE_TEMPORARY) { + regs = ctx->temp; + max_regs = Elements(ctx->temp); + } else if (dst->File == TGSI_FILE_OUTPUT) { + regs = info->output; + max_regs = Elements(info->output); + } else if (dst->File == TGSI_FILE_ADDRESS || + dst->File == TGSI_FILE_PREDICATE) { + continue; + } else { + assert(0); + continue; + } + + /* + * Detect direct TEX instructions + */ + + switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_TEX: + analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_NONE); + break; + case TGSI_OPCODE_TXD: + analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV); + break; + case TGSI_OPCODE_TXB: + analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS); + break; + case TGSI_OPCODE_TXL: + analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD); + break; + case TGSI_OPCODE_TXP: + analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_PROJECTED); + break; + default: + break; + } + + /* + * Keep track of assignments and writes + */ + + if (dst->Indirect) { + /* + * It could be any register index so clear all register indices. + */ + + for (chan = 0; chan < 4; ++chan) { + if (dst->WriteMask & (1 << chan)) { + for (index = 0; index < max_regs; ++index) { + regs[index][chan].file = TGSI_FILE_NULL; + } + } + } + } else if (dst->Index < max_regs) { + /* + * Update this destination register value. + */ + + struct lp_tgsi_channel_info res[4]; + + memset(res, 0, sizeof res); + + if (!inst->Instruction.Predicate && + !inst->Instruction.Saturate) { + for (chan = 0; chan < 4; ++chan) { + if (dst->WriteMask & (1 << chan)) { + if (inst->Instruction.Opcode == TGSI_OPCODE_MOV) { + analyse_src(ctx, &res[chan], + &inst->Src[0].Register, chan); + } else if (inst->Instruction.Opcode == TGSI_OPCODE_MUL) { + /* + * Propagate values across 1.0 and 0.0 multiplications. + */ + + struct lp_tgsi_channel_info src0; + struct lp_tgsi_channel_info src1; + + analyse_src(ctx, &src0, &inst->Src[0].Register, chan); + analyse_src(ctx, &src1, &inst->Src[1].Register, chan); + + if (is_immediate(&src0, 0.0f)) { + res[chan] = src0; + } else if (is_immediate(&src1, 0.0f)) { + res[chan] = src1; + } else if (is_immediate(&src0, 1.0f)) { + res[chan] = src1; + } else if (is_immediate(&src1, 1.0f)) { + res[chan] = src0; + } + } + } + } + } + + for (chan = 0; chan < 4; ++chan) { + if (dst->WriteMask & (1 << chan)) { + regs[dst->Index][chan] = res[chan]; + } + } + } + } + + /* + * Clear all temporaries information in presence of a control flow opcode. + */ + + switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_IF: + case TGSI_OPCODE_IFC: + case TGSI_OPCODE_ELSE: + case TGSI_OPCODE_ENDIF: + case TGSI_OPCODE_BGNLOOP: + case TGSI_OPCODE_BRK: + case TGSI_OPCODE_BREAKC: + case TGSI_OPCODE_CONT: + case TGSI_OPCODE_ENDLOOP: + case TGSI_OPCODE_CALLNZ: + case TGSI_OPCODE_CAL: + case TGSI_OPCODE_BGNSUB: + case TGSI_OPCODE_ENDSUB: + case TGSI_OPCODE_SWITCH: + case TGSI_OPCODE_CASE: + case TGSI_OPCODE_DEFAULT: + case TGSI_OPCODE_ENDSWITCH: + case TGSI_OPCODE_RET: + case TGSI_OPCODE_END: + /* XXX: Are there more cases? */ + memset(&ctx->temp, 0, sizeof ctx->temp); + memset(&info->output, 0, sizeof info->output); + default: + break; + } +} + + +static INLINE void +dump_info(const struct tgsi_token *tokens, + struct lp_tgsi_info *info) +{ + unsigned index; + unsigned chan; + + tgsi_dump(tokens, 0); + + for (index = 0; index < info->num_texs; ++index) { + const struct lp_tgsi_texture_info *tex_info = &info->tex[index]; + debug_printf("TEX[%u] =", index); + for (chan = 0; chan < 4; ++chan) { + const struct lp_tgsi_channel_info *chan_info = + &tex_info->coord[chan]; + if (chan_info->file != TGSI_FILE_NULL) { + debug_printf(" %s[%u].%c", + tgsi_file_names[chan_info->file], + chan_info->index, + "xyzw01"[chan_info->swizzle]); + } else { + debug_printf(" _"); + } + } + debug_printf(", SAMP[%u], %s\n", + tex_info->unit, + tgsi_texture_names[tex_info->target]); + } + + for (index = 0; index < PIPE_MAX_SHADER_OUTPUTS; ++index) { + for (chan = 0; chan < 4; ++chan) { + const struct lp_tgsi_channel_info *chan_info = + &info->output[index][chan]; + if (chan_info->file != TGSI_FILE_NULL) { + debug_printf("OUT[%u].%c = ", index, "xyzw"[chan]); + if (chan_info->file == TGSI_FILE_IMMEDIATE) { + debug_printf("%f", chan_info->value); + } else { + const char *file_name; + switch (chan_info->file) { + case TGSI_FILE_CONSTANT: + file_name = "CONST"; + break; + case TGSI_FILE_INPUT: + file_name = "IN"; + break; + default: + file_name = "???"; + break; + } + debug_printf("%s[%u].%c", + file_name, + chan_info->index, + "xyzw01"[chan_info->swizzle]); + } + debug_printf("\n"); + } + } + } +} + + +/** + * Detect any direct relationship between the output color + */ +void +lp_build_tgsi_info(const struct tgsi_token *tokens, + struct lp_tgsi_info *info) +{ + struct tgsi_parse_context parse; + struct analysis_context ctx; + unsigned index; + unsigned chan; + + memset(info, 0, sizeof *info); + + tgsi_scan_shader(tokens, &info->base); + + memset(&ctx, 0, sizeof ctx); + ctx.info = info; + + tgsi_parse_init(&parse, tokens); + + while (!tgsi_parse_end_of_tokens(&parse)) { + tgsi_parse_token(&parse); + + switch (parse.FullToken.Token.Type) { + case TGSI_TOKEN_TYPE_DECLARATION: + break; + + case TGSI_TOKEN_TYPE_INSTRUCTION: + { + struct tgsi_full_instruction *inst = + &parse.FullToken.FullInstruction; + + if (inst->Instruction.Opcode == TGSI_OPCODE_END || + inst->Instruction.Opcode == TGSI_OPCODE_BGNSUB) { + /* We reached the end of main function body. */ + goto finished; + } + + analyse_instruction(&ctx, inst); + } + break; + + case TGSI_TOKEN_TYPE_IMMEDIATE: + { + const unsigned size = + parse.FullToken.FullImmediate.Immediate.NrTokens - 1; + assert(size <= 4); + if (ctx.num_imms < Elements(ctx.imm)) { + for (chan = 0; chan < size; ++chan) { + ctx.imm[ctx.num_imms][chan] = + parse.FullToken.FullImmediate.u[chan].Float; + } + ++ctx.num_imms; + } + } + break; + + case TGSI_TOKEN_TYPE_PROPERTY: + break; + + default: + assert(0); + } + } +finished: + + tgsi_parse_free(&parse); + + + /* + * Link the output color values. + */ + + for (index = 0; index < PIPE_MAX_COLOR_BUFS; ++index) { + const struct lp_tgsi_channel_info null_output[4]; + info->cbuf[index] = null_output; + } + + for (index = 0; index < info->base.num_outputs; ++index) { + unsigned semantic_name = info->base.output_semantic_name[index]; + unsigned semantic_index = info->base.output_semantic_index[index]; + if (semantic_name == TGSI_SEMANTIC_COLOR && + semantic_index < PIPE_MAX_COLOR_BUFS) { + info->cbuf[semantic_index] = info->output[index]; + } + } + + if (gallivm_debug & GALLIVM_DEBUG_TGSI) { + dump_info(tokens, info); + } +} -- cgit v1.2.3 From 986cb9d5cf60bc11c7facc19017b5432b17240f7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 2 Sep 2010 16:30:23 +0100 Subject: llvmpipe: Use lp_tgsi_info. --- src/gallium/drivers/llvmpipe/lp_setup_point.c | 4 +-- src/gallium/drivers/llvmpipe/lp_state_derived.c | 16 +++++------ src/gallium/drivers/llvmpipe/lp_state_fs.c | 38 ++++++++++++------------- src/gallium/drivers/llvmpipe/lp_state_fs.h | 3 +- 4 files changed, 31 insertions(+), 30 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 31d85f43c2..64b24a88d5 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -239,8 +239,8 @@ setup_point_coefficients( struct lp_setup_context *setup, /* 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) { - unsigned semantic_index = shader->info.input_semantic_index[slot]; + if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { + unsigned semantic_index = shader->info.base.input_semantic_index[slot]; /* Note that sprite_coord enable is a bitfield of * PIPE_MAX_SHADER_OUTPUTS bits. */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index bb059d0459..7f68818ab4 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -66,14 +66,14 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index); - for (i = 0; i < lpfs->info.num_inputs; i++) { + for (i = 0; i < lpfs->info.base.num_inputs; i++) { /* * Search for each input in current vs output: */ vs_index = draw_find_shader_output(llvmpipe->draw, - lpfs->info.input_semantic_name[i], - lpfs->info.input_semantic_index[i]); + lpfs->info.base.input_semantic_name[i], + lpfs->info.base.input_semantic_index[i]); if (vs_index < 0) { /* * This can happen with sprite coordinates - the vertex @@ -86,9 +86,9 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) /* This can be pre-computed, except for flatshade: */ - inputs[i].usage_mask = lpfs->info.input_usage_mask[i]; + inputs[i].usage_mask = lpfs->info.base.input_usage_mask[i]; - switch (lpfs->info.input_interpolate[i]) { + switch (lpfs->info.base.input_interpolate[i]) { case TGSI_INTERPOLATE_CONSTANT: inputs[i].interp = LP_INTERP_CONSTANT; break; @@ -103,7 +103,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) break; } - switch (lpfs->info.input_semantic_name[i]) { + switch (lpfs->info.base.input_semantic_name[i]) { case TGSI_SEMANTIC_FACE: inputs[i].interp = LP_INTERP_FACING; break; @@ -145,7 +145,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index); } - llvmpipe->num_inputs = lpfs->info.num_inputs; + llvmpipe->num_inputs = lpfs->info.base.num_inputs; draw_compute_vertex_size(vinfo); @@ -153,7 +153,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe) lp_setup_set_fs_inputs(llvmpipe->setup, inputs, - lpfs->info.num_inputs); + lpfs->info.base.num_inputs); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 6bfd02061d..6872f2d3c6 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -238,9 +238,9 @@ generate_fs(struct llvmpipe_context *lp, LLVMValueRef zs_value = NULL; LLVMValueRef stencil_refs[2]; struct lp_build_mask_context mask; - boolean simple_shader = (shader->info.file_count[TGSI_FILE_SAMPLER] == 0 && - shader->info.num_inputs < 3 && - shader->info.num_instructions < 8); + boolean simple_shader = (shader->info.base.file_count[TGSI_FILE_SAMPLER] == 0 && + shader->info.base.num_inputs < 3 && + shader->info.base.num_instructions < 8); unsigned attrib; unsigned chan; unsigned cbuf; @@ -253,8 +253,8 @@ generate_fs(struct llvmpipe_context *lp, zs_format_desc = util_format_description(key->zsbuf_format); assert(zs_format_desc); - if (!shader->info.writes_z) { - if (key->alpha.enabled || shader->info.uses_kill) + if (!shader->info.base.writes_z) { + if (key->alpha.enabled || shader->info.base.uses_kill) /* With alpha test and kill, can do the depth test early * and hopefully eliminate some quads. But need to do a * special deferred depth write once the final mask value @@ -334,12 +334,12 @@ generate_fs(struct llvmpipe_context *lp, /* Build the actual shader */ lp_build_tgsi_soa(builder, tokens, type, &mask, consts_ptr, interp->pos, interp->inputs, - outputs, sampler, &shader->info); + outputs, sampler, &shader->info.base); /* Alpha test */ if (key->alpha.enabled) { - int color0 = find_output_by_semantic(&shader->info, + int color0 = find_output_by_semantic(&shader->info.base, TGSI_SEMANTIC_COLOR, 0); @@ -358,7 +358,7 @@ generate_fs(struct llvmpipe_context *lp, /* Late Z test */ if (depth_mode & LATE_DEPTH_TEST) { - int pos0 = find_output_by_semantic(&shader->info, + int pos0 = find_output_by_semantic(&shader->info.base, TGSI_SEMANTIC_POSITION, 0); @@ -399,11 +399,11 @@ generate_fs(struct llvmpipe_context *lp, /* Color write */ - for (attrib = 0; attrib < shader->info.num_outputs; ++attrib) + for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib) { - if (shader->info.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) + if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) { - unsigned cbuf = shader->info.output_semantic_index[attrib]; + unsigned cbuf = shader->info.base.output_semantic_index[attrib]; for(chan = 0; chan < NUM_CHANNELS; ++chan) { /* XXX: just initialize outputs to point at colors[] and @@ -728,7 +728,7 @@ generate_fragment(struct llvmpipe_context *lp, */ boolean do_branch = ((key->depth.enabled || key->stencil[0].enabled) && !key->alpha.enabled && - !shader->info.uses_kill); + !shader->info.base.uses_kill); generate_blend(&key->blend, rt, @@ -917,7 +917,7 @@ generate_variant(struct llvmpipe_context *lp, !key->stencil[0].enabled && !key->alpha.enabled && !key->depth.enabled && - !shader->info.uses_kill + !shader->info.base.uses_kill ? TRUE : FALSE; @@ -954,7 +954,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, make_empty_list(&shader->variants); /* get/save the summary info for this shader */ - tgsi_scan_shader(templ->tokens, &shader->info); + lp_build_tgsi_info(templ->tokens, &shader->info); /* we need to keep a local copy of the tokens */ shader->base.tokens = tgsi_dup_tokens(templ->tokens); @@ -966,7 +966,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, return NULL; } - nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1; + nr_samplers = shader->info.base.file_max[TGSI_FILE_SAMPLER] + 1; shader->variant_key_size = Offset(struct lp_fragment_shader_variant_key, sampler[nr_samplers]); @@ -976,8 +976,8 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, debug_printf("llvmpipe: Create fragment shader #%u %p:\n", shader->no, (void *) shader); tgsi_dump(templ->tokens, 0); debug_printf("usage masks:\n"); - for (attrib = 0; attrib < shader->info.num_inputs; ++attrib) { - unsigned usage_mask = shader->info.input_usage_mask[attrib]; + for (attrib = 0; attrib < shader->info.base.num_inputs; ++attrib) { + unsigned usage_mask = shader->info.base.input_usage_mask[attrib]; debug_printf(" IN[%u].%s%s%s%s\n", attrib, usage_mask & TGSI_WRITEMASK_X ? "x" : "", @@ -1206,10 +1206,10 @@ make_variant_key(struct llvmpipe_context *lp, /* This value will be the same for all the variants of a given shader: */ - key->nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1; + key->nr_samplers = shader->info.base.file_max[TGSI_FILE_SAMPLER] + 1; for(i = 0; i < key->nr_samplers; ++i) { - if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) { + if(shader->info.base.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) { lp_sampler_static_state(&key->sampler[i], lp->fragment_sampler_views[i], lp->sampler[i]); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index 4999b8dca1..ddad117aca 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -34,6 +34,7 @@ #include "pipe/p_state.h" #include "tgsi/tgsi_scan.h" /* for tgsi_shader_info */ #include "gallivm/lp_bld_sample.h" /* for struct lp_sampler_static_state */ +#include "gallivm/lp_bld_tgsi.h" /* for lp_tgsi_info */ struct tgsi_token; @@ -96,7 +97,7 @@ struct lp_fragment_shader { struct pipe_shader_state base; - struct tgsi_shader_info info; + struct lp_tgsi_info info; struct lp_fs_variant_list_item variants; -- cgit v1.2.3 From 965f69cb0c51ca5a5c332e207cc86367fa31e6b1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 12 Oct 2010 09:41:02 +1000 Subject: r600g: fix typo in vertex sampling on r600 fixes https://bugs.freedesktop.org/show_bug.cgi?id=30771 Reported-by: Kevin DeKorte --- src/gallium/drivers/r600/r600_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index a2a76cdeb7..70461d24ea 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -688,7 +688,7 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, for (int i = 0; i < count; i++) { if (resource[i]) { - r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i + PIPE_MAX_ATTRIBS); + r600_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, i + PIPE_MAX_ATTRIBS); } } } -- cgit v1.2.3 From c25fcf5aa5beccd7731706b8f85682170a2eca56 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 28 Sep 2010 22:51:28 +0200 Subject: nouveau: Get larger push buffers. Useful to amortize the command submission/reloc overhead (e.g. etracer goes from 72 to 109 FPS on nv4b). --- src/gallium/drivers/nouveau/nouveau_screen.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index ebb21a6e5a..a9426df686 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -236,7 +236,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) int ret; ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202, - &screen->channel); + 512*1024, &screen->channel); if (ret) return ret; screen->device = dev; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 6369e8d7b1..1c7f600d2b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -128,7 +128,7 @@ nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, /* Allocate a hardware channel. */ ret = nouveau_channel_alloc(context_dev(ctx), 0xbeef0201, 0xbeef0202, - &nctx->hw.chan); + 512*1024, &nctx->hw.chan); if (ret) { nouveau_error("Error initializing the FIFO.\n"); return GL_FALSE; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index e4415cbedb..9373b936ab 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -32,7 +32,7 @@ /* Arbitrary pushbuf length we can assume we can get with a single * WAIT_RING. */ -#define PUSHBUF_DWORDS 2048 +#define PUSHBUF_DWORDS 65536 /* Functions to set up struct nouveau_array_state from something like * a GL array or index buffer. */ -- cgit v1.2.3 From 4cb3b4ced80891ce8760cf5a0c06db9dbee36b76 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 11 Oct 2010 19:45:52 +0100 Subject: llvmpipe: Do not dispose the execution engine. The engine is a global owned by gallivm module. --- src/gallium/drivers/llvmpipe/lp_jit.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 04b12dedcc..e09ec504ab 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -162,9 +162,6 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) void lp_jit_screen_cleanup(struct llvmpipe_screen *screen) { - if(screen->engine) - LLVMDisposeExecutionEngine(screen->engine); - if(screen->pass) LLVMDisposePassManager(screen->pass); } -- cgit v1.2.3 From 2cf98d5a6dccba3fd69b8469e67f66dfb5fc9651 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 11 Oct 2010 16:30:14 +0100 Subject: llvmpipe: try to do more of rast_tri_3_16 with intrinsics There was actually a large quantity of scalar code in these functions previously. This tries to move more into intrinsics. Introduce an sse2 mm_mullo_epi32 replacement to avoid sse4 dependency in the new rasterization code. --- src/gallium/drivers/llvmpipe/lp_rast.h | 16 +- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 264 ++++++++++++++++++++++++++++- 2 files changed, 271 insertions(+), 9 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index df0bea04b9..e2bcc45016 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -89,19 +89,21 @@ struct lp_rast_shader_inputs { const struct lp_rast_state *state; }; - +/* Note: the order of these values is important as they are loaded by + * sse code in rasterization: + */ struct lp_rast_plane { - /* one-pixel sized trivial accept offsets for each plane */ - int ei; - - /* one-pixel sized trivial reject offsets for each plane */ - int eo; - /* edge function values at minx,miny ?? */ int c; int dcdx; int dcdy; + + /* one-pixel sized trivial reject offsets for each plane */ + int eo; + + /* one-pixel sized trivial accept offsets for each plane */ + int ei; }; /** diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index f870a187db..7a6cbb8b63 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -32,6 +32,7 @@ #include #include "util/u_math.h" #include "lp_debug.h" +#include "lp_debug_intrin.h" #include "lp_perf.h" #include "lp_rast_priv.h" #include "lp_tile_soa.h" @@ -254,8 +255,8 @@ sign_bits4(const __m128i *cstep, int cdiff) #define TAG(x) x##_3 #define NR_PLANES 3 -#define TRI_4 lp_rast_triangle_3_4 -#define TRI_16 lp_rast_triangle_3_16 +/*#define TRI_4 lp_rast_triangle_3_4*/ +/*#define TRI_16 lp_rast_triangle_3_16*/ #include "lp_rast_tri_tmp.h" #define TAG(x) x##_4 @@ -279,3 +280,262 @@ sign_bits4(const __m128i *cstep, int cdiff) #define NR_PLANES 8 #include "lp_rast_tri_tmp.h" + +static INLINE void +transpose4_epi32(__m128i a, + __m128i b, + __m128i c, + __m128i d, + __m128i *o, + __m128i *p, + __m128i *q, + __m128i *r) +{ + __m128i t0 = _mm_unpacklo_epi32(a, b); + __m128i t1 = _mm_unpacklo_epi32(c, d); + __m128i t2 = _mm_unpackhi_epi32(a, b); + __m128i t3 = _mm_unpackhi_epi32(c, d); + + *o = _mm_unpacklo_epi64(t0, t1); + *p = _mm_unpackhi_epi64(t0, t1); + *q = _mm_unpacklo_epi64(t2, t3); + *r = _mm_unpackhi_epi64(t2, t3); +} + + +#define SCALAR_EPI32(m, i) _mm_shuffle_epi32((m), _MM_SHUFFLE(i,i,i,i)) + +#define NR_PLANES 3 + + + +/* Provide an SSE2 implementation of _mm_mullo_epi32() in terms of + * _mm_mul_epu32(). + * + * I suspect this works fine for us because one of our operands is + * always positive, but not sure that this can be used for general + * signed integer multiplication. + * + * This seems close enough to the speed of SSE4 and the real + * _mm_mullo_epi32() intrinsic as to not justify adding an sse4 + * dependency at this point. + */ +static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) +{ + __m128i a4 = _mm_srli_si128(a, 4); /* shift by one dword */ + __m128i b4 = _mm_srli_si128(b, 4); /* shift by one dword */ + __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */ + __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */ + + /* Interleave the results, either with shuffles or (slightly + * faster) direct bit operations: + */ +#if 0 + __m128i ba8 = _mm_shuffle_epi32(ba, 8); + __m128i b4a48 = _mm_shuffle_epi32(b4a4, 8); + __m128i result = _mm_unpacklo_epi32(ba8, b4a48); +#else + __m128i mask = _mm_setr_epi32(~0,0,~0,0); + __m128i ba_mask = _mm_and_si128(ba, mask); + __m128i b4a4_mask = _mm_and_si128(b4a4, mask); + __m128i b4a4_mask_shift = _mm_slli_si128(b4a4_mask, 4); + __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift); +#endif + + return result; +} + + + + +void +lp_rast_triangle_3_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + const struct lp_rast_triangle *tri = arg.triangle.tri; + const struct lp_rast_plane *plane = tri->plane; + int x = (arg.triangle.plane_mask & 0xff) + task->x; + int y = (arg.triangle.plane_mask >> 8) + task->y; + unsigned i, j; + + struct { unsigned mask:16; unsigned i:8; unsigned j:8; } out[16]; + unsigned nr = 0; + + __m128i p0 = _mm_loadu_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */ + __m128i p1 = _mm_loadu_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */ + __m128i p2 = _mm_loadu_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */ + __m128i zero = _mm_setzero_si128(); + + __m128i c; + __m128i dcdx; + __m128i dcdy; + __m128i rej4; + + __m128i dcdx2; + __m128i dcdx3; + + __m128i span_0; /* 0,dcdx,2dcdx,3dcdx for plane 0 */ + __m128i span_1; /* 0,dcdx,2dcdx,3dcdx for plane 1 */ + __m128i span_2; /* 0,dcdx,2dcdx,3dcdx for plane 2 */ + __m128i unused; + + transpose4_epi32(p0, p1, p2, zero, + &c, &dcdx, &dcdy, &rej4); + + /* Adjust dcdx; + */ + dcdx = _mm_sub_epi32(zero, dcdx); + + c = _mm_add_epi32(c, mm_mullo_epi32(dcdx, _mm_set1_epi32(x))); + c = _mm_add_epi32(c, mm_mullo_epi32(dcdy, _mm_set1_epi32(y))); + rej4 = _mm_slli_epi32(rej4, 2); + + dcdx2 = _mm_add_epi32(dcdx, dcdx); + dcdx3 = _mm_add_epi32(dcdx2, dcdx); + + transpose4_epi32(zero, dcdx, dcdx2, dcdx3, + &span_0, &span_1, &span_2, &unused); + + for (i = 0; i < 4; i++) { + __m128i cx = c; + + for (j = 0; j < 4; j++) { + __m128i c4rej = _mm_add_epi32(cx, rej4); + __m128i rej_masks = _mm_srai_epi32(c4rej, 31); + + /* if (is_zero(rej_masks)) */ + if (_mm_movemask_epi8(rej_masks) == 0) { + __m128i c0_0 = _mm_add_epi32(SCALAR_EPI32(cx, 0), span_0); + __m128i c1_0 = _mm_add_epi32(SCALAR_EPI32(cx, 1), span_1); + __m128i c2_0 = _mm_add_epi32(SCALAR_EPI32(cx, 2), span_2); + + __m128i c_0 = _mm_or_si128(_mm_or_si128(c0_0, c1_0), c2_0); + + __m128i c0_1 = _mm_add_epi32(c0_0, SCALAR_EPI32(dcdy, 0)); + __m128i c1_1 = _mm_add_epi32(c1_0, SCALAR_EPI32(dcdy, 1)); + __m128i c2_1 = _mm_add_epi32(c2_0, SCALAR_EPI32(dcdy, 2)); + + __m128i c_1 = _mm_or_si128(_mm_or_si128(c0_1, c1_1), c2_1); + __m128i c_01 = _mm_packs_epi32(c_0, c_1); + + __m128i c0_2 = _mm_add_epi32(c0_1, SCALAR_EPI32(dcdy, 0)); + __m128i c1_2 = _mm_add_epi32(c1_1, SCALAR_EPI32(dcdy, 1)); + __m128i c2_2 = _mm_add_epi32(c2_1, SCALAR_EPI32(dcdy, 2)); + + __m128i c_2 = _mm_or_si128(_mm_or_si128(c0_2, c1_2), c2_2); + + __m128i c0_3 = _mm_add_epi32(c0_2, SCALAR_EPI32(dcdy, 0)); + __m128i c1_3 = _mm_add_epi32(c1_2, SCALAR_EPI32(dcdy, 1)); + __m128i c2_3 = _mm_add_epi32(c2_2, SCALAR_EPI32(dcdy, 2)); + + __m128i c_3 = _mm_or_si128(_mm_or_si128(c0_3, c1_3), c2_3); + __m128i c_23 = _mm_packs_epi32(c_2, c_3); + __m128i c_0123 = _mm_packs_epi16(c_01, c_23); + + unsigned mask = _mm_movemask_epi8(c_0123); + + out[nr].i = i; + out[nr].j = j; + out[nr].mask = mask; + if (mask != 0xffff) + nr++; + } + cx = _mm_add_epi32(cx, _mm_slli_epi32(dcdx, 2)); + } + + c = _mm_add_epi32(c, _mm_slli_epi32(dcdy, 2)); + } + + for (i = 0; i < nr; i++) + lp_rast_shade_quads_mask(task, + &tri->inputs, + x + 4 * out[i].j, + y + 4 * out[i].i, + 0xffff & ~out[i].mask); +} + + + + + +void +lp_rast_triangle_3_4(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + const struct lp_rast_triangle *tri = arg.triangle.tri; + const struct lp_rast_plane *plane = tri->plane; + int x = (arg.triangle.plane_mask & 0xff) + task->x; + int y = (arg.triangle.plane_mask >> 8) + task->y; + + __m128i p0 = _mm_loadu_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */ + __m128i p1 = _mm_loadu_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */ + __m128i p2 = _mm_loadu_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */ + __m128i zero = _mm_setzero_si128(); + + __m128i c; + __m128i dcdx; + __m128i dcdy; + + __m128i dcdx2; + __m128i dcdx3; + + __m128i span_0; /* 0,dcdx,2dcdx,3dcdx for plane 0 */ + __m128i span_1; /* 0,dcdx,2dcdx,3dcdx for plane 1 */ + __m128i span_2; /* 0,dcdx,2dcdx,3dcdx for plane 2 */ + __m128i unused; + + transpose4_epi32(p0, p1, p2, zero, + &c, &dcdx, &dcdy, &unused); + + /* Adjust dcdx; + */ + dcdx = _mm_sub_epi32(zero, dcdx); + + c = _mm_add_epi32(c, _mm_mullo_epi32(dcdx, _mm_set1_epi32(x))); + c = _mm_add_epi32(c, _mm_mullo_epi32(dcdy, _mm_set1_epi32(y))); + + dcdx2 = _mm_add_epi32(dcdx, dcdx); + dcdx3 = _mm_add_epi32(dcdx2, dcdx); + + transpose4_epi32(zero, dcdx, dcdx2, dcdx3, + &span_0, &span_1, &span_2, &unused); + + + { + __m128i c0_0 = _mm_add_epi32(SCALAR_EPI32(c, 0), span_0); + __m128i c1_0 = _mm_add_epi32(SCALAR_EPI32(c, 1), span_1); + __m128i c2_0 = _mm_add_epi32(SCALAR_EPI32(c, 2), span_2); + + __m128i c_0 = _mm_or_si128(_mm_or_si128(c0_0, c1_0), c2_0); + + __m128i c0_1 = _mm_add_epi32(c0_0, SCALAR_EPI32(dcdy, 0)); + __m128i c1_1 = _mm_add_epi32(c1_0, SCALAR_EPI32(dcdy, 1)); + __m128i c2_1 = _mm_add_epi32(c2_0, SCALAR_EPI32(dcdy, 2)); + + __m128i c_1 = _mm_or_si128(_mm_or_si128(c0_1, c1_1), c2_1); + __m128i c_01 = _mm_packs_epi32(c_0, c_1); + + __m128i c0_2 = _mm_add_epi32(c0_1, SCALAR_EPI32(dcdy, 0)); + __m128i c1_2 = _mm_add_epi32(c1_1, SCALAR_EPI32(dcdy, 1)); + __m128i c2_2 = _mm_add_epi32(c2_1, SCALAR_EPI32(dcdy, 2)); + + __m128i c_2 = _mm_or_si128(_mm_or_si128(c0_2, c1_2), c2_2); + + __m128i c0_3 = _mm_add_epi32(c0_2, SCALAR_EPI32(dcdy, 0)); + __m128i c1_3 = _mm_add_epi32(c1_2, SCALAR_EPI32(dcdy, 1)); + __m128i c2_3 = _mm_add_epi32(c2_2, SCALAR_EPI32(dcdy, 2)); + + __m128i c_3 = _mm_or_si128(_mm_or_si128(c0_3, c1_3), c2_3); + __m128i c_23 = _mm_packs_epi32(c_2, c_3); + __m128i c_0123 = _mm_packs_epi16(c_01, c_23); + + unsigned mask = _mm_movemask_epi8(c_0123); + + if (mask != 0xffff) + lp_rast_shade_quads_mask(task, + &tri->inputs, + x, + y, + 0xffff & ~mask); + } +} -- cgit v1.2.3 From 9d59e148f86c1de2c69639d389398d7435cc193e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 11 Oct 2010 18:20:02 +0100 Subject: llvmpipe: add debug helpers for epi32 etc --- src/gallium/drivers/llvmpipe/lp_debug_intrin.h | 115 +++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/gallium/drivers/llvmpipe/lp_debug_intrin.h (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_debug_intrin.h b/src/gallium/drivers/llvmpipe/lp_debug_intrin.h new file mode 100644 index 0000000000..5237e7893b --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_debug_intrin.h @@ -0,0 +1,115 @@ +/************************************************************************** + * + * 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 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 COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +#ifndef _LP_DEBUG_INTRIN_H_ +#define _LP_DEBUG_INTRIN_H_ + +#include "pipe/p_config.h" + +#if defined(PIPE_ARCH_SSE) + +#include + +static INLINE void print_epi8(const char *name, __m128i r) +{ + union { __m128i m; ubyte ub[16]; } u; + u.m = r; + + debug_printf("%s: " + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x\n", + name, + u.ub[0], u.ub[1], u.ub[2], u.ub[3], + u.ub[4], u.ub[5], u.ub[6], u.ub[7], + u.ub[8], u.ub[9], u.ub[10], u.ub[11], + u.ub[12], u.ub[13], u.ub[14], u.ub[15]); +} + +static INLINE void print_epi16(const char *name, __m128i r) +{ + union { __m128i m; ushort us[8]; } u; + u.m = r; + + debug_printf("%s: " + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x\n", + name, + u.us[0], u.us[1], u.us[2], u.us[3], + u.us[4], u.us[5], u.us[6], u.us[7]); +} + +static INLINE void print_epi32(const char *name, __m128i r) +{ + union { __m128i m; uint ui[4]; } u; + u.m = r; + + debug_printf("%s: " + "%08x/" + "%08x/" + "%08x/" + "%08x\n", + name, + u.ui[0], u.ui[1], u.ui[2], u.ui[3]); +} + +static INLINE void print_ps(const char *name, __m128 r) +{ + union { __m128 m; float f[4]; } u; + u.m = r; + + debug_printf("%s: " + "%f/" + "%f/" + "%f/" + "%f\n", + name, + u.f[0], u.f[1], u.f[2], u.f[3]); +} + + +#endif +#endif -- cgit v1.2.3 From 9773722c2b09d5f0615a47cecf4347859474dc56 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 11:02:19 +0100 Subject: llvmpipe: try to keep plane c values small Avoid accumulating more and more fixed point bits. --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 3 +-- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 38 +++++++++++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 693ac28175..c940860850 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -640,8 +640,7 @@ try_setup_line( struct lp_setup_context *setup, } } - plane->dcdx *= FIXED_ONE; - plane->dcdy *= FIXED_ONE; + plane->c = (plane->c + (FIXED_ONE-1)) / FIXED_ONE; /* find trivial reject offsets for each edge for a single-pixel * sized block. These will be scaled up at each recursive level to diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 8fd034666c..dfe1bd11ea 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -343,26 +343,34 @@ do_triangle_ccw(struct lp_setup_context *setup, * Also, sometimes (in FBO cases) GL will render upside down * to its usual method, in which case it will probably want * to use the opposite, top-left convention. + * + * XXX: Chances are this will get stripped away. In fact this + * is only meaningful if: + * + * (plane->c & (FIXED_ONE-1)) == 0 + * */ - if (plane->dcdx < 0) { - /* both fill conventions want this - adjust for left edges */ - plane->c++; - } - else if (plane->dcdx == 0) { - if (setup->pixel_offset == 0) { - /* correct for top-left fill convention: - */ - if (plane->dcdy > 0) plane->c++; + if ((plane->c & (FIXED_ONE-1)) == 0) { + if (plane->dcdx < 0) { + /* both fill conventions want this - adjust for left edges */ + plane->c++; } - else { - /* correct for bottom-left fill convention: - */ - if (plane->dcdy < 0) plane->c++; + else if (plane->dcdx == 0) { + if (setup->pixel_offset == 0) { + /* correct for top-left fill convention: + */ + if (plane->dcdy > 0) plane->c++; + } + else { + /* correct for bottom-left fill convention: + */ + if (plane->dcdy < 0) plane->c++; + } } } - plane->dcdx *= FIXED_ONE; - plane->dcdy *= FIXED_ONE; + plane->c = (plane->c + (FIXED_ONE-1)) / FIXED_ONE; + /* find trivial reject offsets for each edge for a single-pixel * sized block. These will be scaled up at each recursive level to -- cgit v1.2.3 From b4277bc5843aca7f9e0ecc7e956733f1becd6ad6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 11:51:28 +0100 Subject: llvmpipe: fix typo in last commit --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 7a6cbb8b63..854fd5cc1e 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -491,8 +491,8 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, */ dcdx = _mm_sub_epi32(zero, dcdx); - c = _mm_add_epi32(c, _mm_mullo_epi32(dcdx, _mm_set1_epi32(x))); - c = _mm_add_epi32(c, _mm_mullo_epi32(dcdy, _mm_set1_epi32(y))); + c = _mm_add_epi32(c, mm_mullo_epi32(dcdx, _mm_set1_epi32(x))); + c = _mm_add_epi32(c, mm_mullo_epi32(dcdy, _mm_set1_epi32(y))); dcdx2 = _mm_add_epi32(dcdx, dcdx); dcdx3 = _mm_add_epi32(dcdx2, dcdx); -- cgit v1.2.3 From 39331be44efc5b5ae749df3f6987626837c7b8ff Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 12 Oct 2010 12:27:55 +0100 Subject: llvmpipe: Fix MSVC build. MSVC doesn't accept more than 3 __m128i arguments. --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 854fd5cc1e..5e8918b1d8 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -282,19 +282,19 @@ sign_bits4(const __m128i *cstep, int cdiff) static INLINE void -transpose4_epi32(__m128i a, - __m128i b, - __m128i c, - __m128i d, - __m128i *o, - __m128i *p, - __m128i *q, - __m128i *r) +transpose4_epi32(const __m128i * restrict a, + const __m128i * restrict b, + const __m128i * restrict c, + const __m128i * restrict d, + __m128i * restrict o, + __m128i * restrict p, + __m128i * restrict q, + __m128i * restrict r) { - __m128i t0 = _mm_unpacklo_epi32(a, b); - __m128i t1 = _mm_unpacklo_epi32(c, d); - __m128i t2 = _mm_unpackhi_epi32(a, b); - __m128i t3 = _mm_unpackhi_epi32(c, d); + __m128i t0 = _mm_unpacklo_epi32(*a, *b); + __m128i t1 = _mm_unpacklo_epi32(*c, *d); + __m128i t2 = _mm_unpackhi_epi32(*a, *b); + __m128i t3 = _mm_unpackhi_epi32(*c, *d); *o = _mm_unpacklo_epi64(t0, t1); *p = _mm_unpackhi_epi64(t0, t1); @@ -379,8 +379,8 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task, __m128i span_2; /* 0,dcdx,2dcdx,3dcdx for plane 2 */ __m128i unused; - transpose4_epi32(p0, p1, p2, zero, - &c, &dcdx, &dcdy, &rej4); + transpose4_epi32(&p0, &p1, &p2, &zero, + &c, &dcdx, &dcdy, &rej4); /* Adjust dcdx; */ @@ -393,8 +393,8 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task, dcdx2 = _mm_add_epi32(dcdx, dcdx); dcdx3 = _mm_add_epi32(dcdx2, dcdx); - transpose4_epi32(zero, dcdx, dcdx2, dcdx3, - &span_0, &span_1, &span_2, &unused); + transpose4_epi32(&zero, &dcdx, &dcdx2, &dcdx3, + &span_0, &span_1, &span_2, &unused); for (i = 0; i < 4; i++) { __m128i cx = c; @@ -484,7 +484,7 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, __m128i span_2; /* 0,dcdx,2dcdx,3dcdx for plane 2 */ __m128i unused; - transpose4_epi32(p0, p1, p2, zero, + transpose4_epi32(&p0, &p1, &p2, &zero, &c, &dcdx, &dcdy, &unused); /* Adjust dcdx; @@ -497,7 +497,7 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, dcdx2 = _mm_add_epi32(dcdx, dcdx); dcdx3 = _mm_add_epi32(dcdx2, dcdx); - transpose4_epi32(zero, dcdx, dcdx2, dcdx3, + transpose4_epi32(&zero, &dcdx, &dcdx2, &dcdx3, &span_0, &span_1, &span_2, &unused); -- cgit v1.2.3 From 1a574afabc8840da82e68ac643ec3a7b05afb631 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 13:02:28 +0100 Subject: gallium: move sse intrinsics debug helpers to u_sse.h --- src/gallium/auxiliary/util/u_sse.h | 80 ++++++++++++++++- src/gallium/drivers/llvmpipe/lp_debug_intrin.h | 115 ------------------------- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 1 - 3 files changed, 79 insertions(+), 117 deletions(-) delete mode 100644 src/gallium/drivers/llvmpipe/lp_debug_intrin.h (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index 03198c91da..8fd0e52a3a 100644 --- a/src/gallium/auxiliary/util/u_sse.h +++ b/src/gallium/auxiliary/util/u_sse.h @@ -72,6 +72,84 @@ _mm_castps_si128(__m128 a) #endif /* defined(_MSC_VER) && _MSC_VER < 1500 */ +static INLINE void u_print_epi8(const char *name, __m128i r) +{ + union { __m128i m; ubyte ub[16]; } u; + u.m = r; + + debug_printf("%s: " + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x\n", + name, + u.ub[0], u.ub[1], u.ub[2], u.ub[3], + u.ub[4], u.ub[5], u.ub[6], u.ub[7], + u.ub[8], u.ub[9], u.ub[10], u.ub[11], + u.ub[12], u.ub[13], u.ub[14], u.ub[15]); +} + +static INLINE void u_print_epi16(const char *name, __m128i r) +{ + union { __m128i m; ushort us[8]; } u; + u.m = r; + + debug_printf("%s: " + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x\n", + name, + u.us[0], u.us[1], u.us[2], u.us[3], + u.us[4], u.us[5], u.us[6], u.us[7]); +} + +static INLINE void u_print_epi32(const char *name, __m128i r) +{ + union { __m128i m; uint ui[4]; } u; + u.m = r; + + debug_printf("%s: " + "%08x/" + "%08x/" + "%08x/" + "%08x\n", + name, + u.ui[0], u.ui[1], u.ui[2], u.ui[3]); +} + +static INLINE void u_print_ps(const char *name, __m128 r) +{ + union { __m128 m; float f[4]; } u; + u.m = r; + + debug_printf("%s: " + "%f/" + "%f/" + "%f/" + "%f\n", + name, + u.f[0], u.f[1], u.f[2], u.f[3]); +} + + + #if defined(PIPE_ARCH_SSSE3) #include @@ -98,6 +176,6 @@ _mm_shuffle_epi8(__m128i a, __m128i mask) #endif /* !PIPE_ARCH_SSSE3 */ -#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */ +#endif /* PIPE_ARCH_SSE */ #endif /* U_SSE_H_ */ diff --git a/src/gallium/drivers/llvmpipe/lp_debug_intrin.h b/src/gallium/drivers/llvmpipe/lp_debug_intrin.h deleted file mode 100644 index 5237e7893b..0000000000 --- a/src/gallium/drivers/llvmpipe/lp_debug_intrin.h +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************** - * - * 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 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 COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - -#ifndef _LP_DEBUG_INTRIN_H_ -#define _LP_DEBUG_INTRIN_H_ - -#include "pipe/p_config.h" - -#if defined(PIPE_ARCH_SSE) - -#include - -static INLINE void print_epi8(const char *name, __m128i r) -{ - union { __m128i m; ubyte ub[16]; } u; - u.m = r; - - debug_printf("%s: " - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x\n", - name, - u.ub[0], u.ub[1], u.ub[2], u.ub[3], - u.ub[4], u.ub[5], u.ub[6], u.ub[7], - u.ub[8], u.ub[9], u.ub[10], u.ub[11], - u.ub[12], u.ub[13], u.ub[14], u.ub[15]); -} - -static INLINE void print_epi16(const char *name, __m128i r) -{ - union { __m128i m; ushort us[8]; } u; - u.m = r; - - debug_printf("%s: " - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x\n", - name, - u.us[0], u.us[1], u.us[2], u.us[3], - u.us[4], u.us[5], u.us[6], u.us[7]); -} - -static INLINE void print_epi32(const char *name, __m128i r) -{ - union { __m128i m; uint ui[4]; } u; - u.m = r; - - debug_printf("%s: " - "%08x/" - "%08x/" - "%08x/" - "%08x\n", - name, - u.ui[0], u.ui[1], u.ui[2], u.ui[3]); -} - -static INLINE void print_ps(const char *name, __m128 r) -{ - union { __m128 m; float f[4]; } u; - u.m = r; - - debug_printf("%s: " - "%f/" - "%f/" - "%f/" - "%f\n", - name, - u.f[0], u.f[1], u.f[2], u.f[3]); -} - - -#endif -#endif diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 5e8918b1d8..19b0bd686a 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -32,7 +32,6 @@ #include #include "util/u_math.h" #include "lp_debug.h" -#include "lp_debug_intrin.h" #include "lp_perf.h" #include "lp_rast_priv.h" #include "lp_tile_soa.h" -- cgit v1.2.3 From d0eb854f58ffb7d01fb37c0939078d8d117e7386 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 5 Oct 2010 23:15:44 +0100 Subject: r600g: add missing file to sconscript --- src/gallium/drivers/r600/SConscript | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/SConscript b/src/gallium/drivers/r600/SConscript index b6d9b7d8d2..bf0ad8571b 100644 --- a/src/gallium/drivers/r600/SConscript +++ b/src/gallium/drivers/r600/SConscript @@ -18,6 +18,7 @@ r600 = env.ConvenienceLibrary( source = [ 'r600_asm.c', 'r600_buffer.c', + 'r600_blit.c', 'r600_helper.c', 'r600_pipe.c', 'r600_query.c', -- cgit v1.2.3 From 22ec25e2bf5c9309610b68e8e40472a8ea695ba9 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 10 Oct 2010 08:39:48 +0100 Subject: gallivm: don't branch on KILLs near end of shader --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 57 ++++++++++++++++++++----- 1 file changed, 47 insertions(+), 10 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 2d4eb9a925..2bc90579a2 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -917,6 +917,43 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, texel); } +static boolean +near_end_of_shader(struct lp_build_tgsi_soa_context *bld, + int pc) +{ + int i; + + for (i = 0; i < 5; i++) { + unsigned opcode; + + if (pc + i >= bld->info->num_instructions) + return TRUE; + + opcode = bld->instructions[pc + i].Instruction.Opcode; + + if (opcode == TGSI_OPCODE_END) + return TRUE; + + if (opcode == TGSI_OPCODE_TEX || + opcode == TGSI_OPCODE_TXP || + opcode == TGSI_OPCODE_TXD || + opcode == TGSI_OPCODE_TXB || + opcode == TGSI_OPCODE_TXL || + opcode == TGSI_OPCODE_TXF || + opcode == TGSI_OPCODE_TXQ || + opcode == TGSI_OPCODE_CAL || + opcode == TGSI_OPCODE_CALLNZ || + opcode == TGSI_OPCODE_IF || + opcode == TGSI_OPCODE_IFC || + opcode == TGSI_OPCODE_BGNLOOP || + opcode == TGSI_OPCODE_SWITCH) + return FALSE; + } + + return TRUE; +} + + /** * Kill fragment if any of the src register values are negative. @@ -924,7 +961,8 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, static void emit_kil( struct lp_build_tgsi_soa_context *bld, - const struct tgsi_full_instruction *inst ) + const struct tgsi_full_instruction *inst, + int pc) { const struct tgsi_full_src_register *reg = &inst->Src[0]; LLVMValueRef terms[NUM_CHANNELS]; @@ -966,9 +1004,8 @@ emit_kil( if(mask) { lp_build_mask_update(bld->mask, mask); - /* XXX: figure out if we are at the end of the shader and skip this: - */ - lp_build_mask_check(bld->mask); + if (!near_end_of_shader(bld, pc)) + lp_build_mask_check(bld->mask); } } @@ -981,7 +1018,8 @@ emit_kil( */ static void emit_kilp(struct lp_build_tgsi_soa_context *bld, - const struct tgsi_full_instruction *inst) + const struct tgsi_full_instruction *inst, + int pc) { LLVMValueRef mask; @@ -997,9 +1035,8 @@ emit_kilp(struct lp_build_tgsi_soa_context *bld, lp_build_mask_update(bld->mask, mask); - /* XXX: figure out if we are at the end of the shader and skip this: - */ - lp_build_mask_check(bld->mask); + if (!near_end_of_shader(bld, pc)) + lp_build_mask_check(bld->mask); } static void @@ -1548,12 +1585,12 @@ emit_instruction( case TGSI_OPCODE_KILP: /* predicated kill */ - emit_kilp( bld, inst ); + emit_kilp( bld, inst, (*pc)-1 ); break; case TGSI_OPCODE_KIL: /* conditional kill */ - emit_kil( bld, inst ); + emit_kil( bld, inst, (*pc)-1 ); break; case TGSI_OPCODE_PK2H: -- cgit v1.2.3 From 0ca0382d1bfd1e9128fa4b588ce1411f7b8a85df Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 13:20:39 +0100 Subject: Revert "llvmpipe: try to keep plane c values small" This reverts commit 9773722c2b09d5f0615a47cecf4347859474dc56. Looks like there are some floor/rounding issues here that need to be better understood. --- src/gallium/drivers/llvmpipe/lp_setup_line.c | 3 ++- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 38 +++++++++++----------------- 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index c940860850..693ac28175 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -640,7 +640,8 @@ try_setup_line( struct lp_setup_context *setup, } } - plane->c = (plane->c + (FIXED_ONE-1)) / FIXED_ONE; + plane->dcdx *= FIXED_ONE; + plane->dcdy *= FIXED_ONE; /* find trivial reject offsets for each edge for a single-pixel * sized block. These will be scaled up at each recursive level to diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index dfe1bd11ea..8fd034666c 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -343,34 +343,26 @@ do_triangle_ccw(struct lp_setup_context *setup, * Also, sometimes (in FBO cases) GL will render upside down * to its usual method, in which case it will probably want * to use the opposite, top-left convention. - * - * XXX: Chances are this will get stripped away. In fact this - * is only meaningful if: - * - * (plane->c & (FIXED_ONE-1)) == 0 - * */ - if ((plane->c & (FIXED_ONE-1)) == 0) { - if (plane->dcdx < 0) { - /* both fill conventions want this - adjust for left edges */ - plane->c++; + if (plane->dcdx < 0) { + /* both fill conventions want this - adjust for left edges */ + plane->c++; + } + else if (plane->dcdx == 0) { + if (setup->pixel_offset == 0) { + /* correct for top-left fill convention: + */ + if (plane->dcdy > 0) plane->c++; } - else if (plane->dcdx == 0) { - if (setup->pixel_offset == 0) { - /* correct for top-left fill convention: - */ - if (plane->dcdy > 0) plane->c++; - } - else { - /* correct for bottom-left fill convention: - */ - if (plane->dcdy < 0) plane->c++; - } + else { + /* correct for bottom-left fill convention: + */ + if (plane->dcdy < 0) plane->c++; } } - plane->c = (plane->c + (FIXED_ONE-1)) / FIXED_ONE; - + plane->dcdx *= FIXED_ONE; + plane->dcdy *= FIXED_ONE; /* find trivial reject offsets for each edge for a single-pixel * sized block. These will be scaled up at each recursive level to -- cgit v1.2.3 From ec08047a801e430ab4db002aa68e5d412bf40b7e Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Oct 2010 10:26:07 +0200 Subject: st/xorg: Don't try to use option values before processing options Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/xorg/xorg_driver.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index e10ff2f950..835f06a73b 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -402,19 +402,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) if (!drv_init_drm(pScrn)) return FALSE; - use3D = cust ? !cust->no_3d : TRUE; - ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL, - &use3D) ? - X_CONFIG : X_PROBED; - - ms->no3D = !use3D; - - if (!drv_init_resource_management(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init " - "Gallium3D or libKMS."); - return FALSE; - } - pScrn->monitor = pScrn->confScreen->monitor; pScrn->progClock = TRUE; pScrn->rgbBits = 8; @@ -449,6 +436,19 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) memcpy(ms->Options, drv_options, sizeof(drv_options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options); + use3D = cust ? !cust->no_3d : TRUE; + ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL, + &use3D) ? + X_CONFIG : X_PROBED; + + ms->no3D = !use3D; + + if (!drv_init_resource_management(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init " + "Gallium3D or libKMS."); + return FALSE; + } + /* Allocate an xf86CrtcConfig */ xf86CrtcConfigInit(pScrn, &crtc_config_funcs); xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); -- cgit v1.2.3 From f0bbf130f944b98cc44df4cd865fea1e4b296a5b Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Oct 2010 11:07:38 +0200 Subject: xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers Signed-off-by: Thomas Hellstrom --- src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium') diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c index 237b308ae3..9c075b5597 100644 --- a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c +++ b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c @@ -32,6 +32,7 @@ * allows X clients to communicate with the driver. */ +#include #include "dixstruct.h" #include "extnsionst.h" #include -- cgit v1.2.3 From bfd065c71ed6df1e1ce1a2a7e6bcf6bdacac38d4 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Oct 2010 11:59:45 +0200 Subject: st/xorg: Add a customizer option to get rid of annoying cursor update flicker Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/xorg/xorg_crtc.c | 8 ++++++++ src/gallium/state_trackers/xorg/xorg_driver.c | 4 +++- src/gallium/state_trackers/xorg/xorg_tracker.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 26a907f205..c65da71cdb 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -234,6 +234,10 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) 64, 64, (void*)image, 64 * 4, 0, 0); ms->ctx->transfer_unmap(ms->ctx, transfer); ms->ctx->transfer_destroy(ms->ctx, transfer); + + if (crtc->cursor_shown) + drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, + crtcp->cursor_handle, 64, 64); } #if HAVE_LIBKMS @@ -271,6 +275,10 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image) memcpy(ptr, image, 64*64*4); kms_bo_unmap(crtcp->cursor_bo); + if (crtc->cursor_shown) + drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, + crtcp->cursor_handle, 64, 64); + return; err_bo_destroy: diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 835f06a73b..f7b3ad3505 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -791,7 +791,9 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!ms->SWCursor) xf86_cursors_init(pScreen, 64, 64, HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | - HARDWARE_CURSOR_ARGB); + HARDWARE_CURSOR_ARGB | + ((cust && cust->unhidden_hw_cursor_update) ? + HARDWARE_CURSOR_UPDATE_UNHIDDEN : 0)); /* Must force it before EnterVT, so we are in control of VT and * later memory should be bound when allocating, e.g rotate_mem */ diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index be1a9fda48..a3fb5e5dad 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -76,6 +76,7 @@ typedef struct _CustomizerRec Bool dirty_throttling; Bool swap_throttling; Bool no_3d; + Bool unhidden_hw_cursor_update; Bool (*winsys_pre_init) (struct _CustomizerRec *cust, int fd); Bool (*winsys_screen_init)(struct _CustomizerRec *cust); Bool (*winsys_screen_close)(struct _CustomizerRec *cust); -- cgit v1.2.3 From 201c3d36697fccfee6b6dacf9529d1951f77651c Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Oct 2010 14:10:50 +0200 Subject: xorg/vmwgfx: Don't hide HW cursors when updating them Gets rid of annoying cursor flicker Signed-off-by: Thomas Hellstrom --- src/gallium/targets/xorg-vmwgfx/vmw_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium') diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c index 8173908f55..7662203165 100644 --- a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c +++ b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c @@ -245,6 +245,7 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags) cust->winsys_enter_vt = vmw_screen_enter_vt; cust->winsys_leave_vt = vmw_screen_leave_vt; cust->no_3d = TRUE; + cust->unhidden_hw_cursor_update = TRUE; vmw->pScrn = pScrn; pScrn->driverPrivate = cust; -- cgit v1.2.3 From b6b7ce84e517cfb7d1c02ef2f389c8f2e5fea04c Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Oct 2010 11:10:59 +0200 Subject: st/xorg: Don't try to remove invalid fbs Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/xorg/xorg_driver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index f7b3ad3505..ca745393a9 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -369,6 +369,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) ms = modesettingPTR(pScrn); ms->pEnt = pEnt; ms->cust = cust; + ms->fb_id = 1; pScrn->displayWidth = 640; /* default it */ @@ -864,8 +865,10 @@ drv_leave_vt(int scrnIndex, int flags) } } - drmModeRmFB(ms->fd, ms->fb_id); - ms->fb_id = -1; + if (ms->fb_id != -1) { + drmModeRmFB(ms->fd, ms->fb_id); + ms->fb_id = -1; + } /* idle hardware */ if (!ms->kms) @@ -946,7 +949,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) } #endif - drmModeRmFB(ms->fd, ms->fb_id); ms->destroy_front_buffer(pScrn); if (ms->exa) -- cgit v1.2.3 From e3ec0fdd546259005c9ed2bf7b05cead2ab95b43 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 12 Oct 2010 14:15:59 +0100 Subject: llmvpipe: improve mm_mullo_epi32 Apply Jose's suggestions for a small but measurable improvement in isosurf. --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 19b0bd686a..c3eefb724c 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -321,8 +321,8 @@ transpose4_epi32(const __m128i * restrict a, */ static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) { - __m128i a4 = _mm_srli_si128(a, 4); /* shift by one dword */ - __m128i b4 = _mm_srli_si128(b, 4); /* shift by one dword */ + __m128i a4 = _mm_srli_epi64(a, 32); /* shift by one dword */ + __m128i b4 = _mm_srli_epi64(b, 32); /* shift by one dword */ __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */ __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */ @@ -336,8 +336,7 @@ static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) #else __m128i mask = _mm_setr_epi32(~0,0,~0,0); __m128i ba_mask = _mm_and_si128(ba, mask); - __m128i b4a4_mask = _mm_and_si128(b4a4, mask); - __m128i b4a4_mask_shift = _mm_slli_si128(b4a4_mask, 4); + __m128i b4a4_mask_shift = _mm_slli_epi64(b4a4, 32); __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift); #endif -- cgit v1.2.3 From 0ad9d8b5384c64ed57eed986af42508be5467e69 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 Oct 2010 08:54:54 -0600 Subject: st/xlib: add some comments --- src/gallium/state_trackers/glx/xlib/xm_st.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index 4d0f5e6625..e7466bdbee 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -196,7 +196,13 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi, /** + * Check that a framebuffer's attachments match the window's size. + * * Called via st_framebuffer_iface::validate() + * + * \param statts array of framebuffer attachments + * \param count number of framebuffer attachments in statts[] + * \param out returns resources for each of the attachments */ static boolean xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, @@ -209,9 +215,11 @@ xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, boolean resized; boolean ret; + /* build mask of ST_ATTACHMENT bits */ statt_mask = 0x0; for (i = 0; i < count; i++) statt_mask |= 1 << statts[i]; + /* record newly allocated textures */ new_mask = statt_mask & ~xstfb->texture_mask; -- cgit v1.2.3 From 6fbd4faf971a0091815211c4d1385c9a4fb0adc6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 12 Oct 2010 16:07:38 +0100 Subject: gallivm: Name anonymous union. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index 0173bc4a7f..a4d3b750c3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -76,7 +76,7 @@ struct lp_tgsi_channel_info union { uint32_t index; float value; /* for TGSI_FILE_IMMEDIATE */ - }; + } u; }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c index eab72b8eb7..d1f8261002 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c @@ -74,10 +74,10 @@ analyse_src(struct analysis_context *ctx, if (src->File == TGSI_FILE_IMMEDIATE) { assert(src->Index < Elements(ctx->imm)); if (src->Index < Elements(ctx->imm)) { - chan_info->value = ctx->imm[src->Index][swizzle]; + chan_info->u.value = ctx->imm[src->Index][swizzle]; } } else { - chan_info->index = src->Index; + chan_info->u.index = src->Index; chan_info->swizzle = swizzle; } } @@ -92,7 +92,7 @@ static boolean is_immediate(const struct lp_tgsi_channel_info *chan_info, float value) { return chan_info->file == TGSI_FILE_IMMEDIATE && - chan_info->value == value; + chan_info->u.value == value; } @@ -342,7 +342,7 @@ dump_info(const struct tgsi_token *tokens, if (chan_info->file != TGSI_FILE_NULL) { debug_printf(" %s[%u].%c", tgsi_file_names[chan_info->file], - chan_info->index, + chan_info->u.index, "xyzw01"[chan_info->swizzle]); } else { debug_printf(" _"); @@ -360,7 +360,7 @@ dump_info(const struct tgsi_token *tokens, if (chan_info->file != TGSI_FILE_NULL) { debug_printf("OUT[%u].%c = ", index, "xyzw"[chan]); if (chan_info->file == TGSI_FILE_IMMEDIATE) { - debug_printf("%f", chan_info->value); + debug_printf("%f", chan_info->u.value); } else { const char *file_name; switch (chan_info->file) { @@ -376,7 +376,7 @@ dump_info(const struct tgsi_token *tokens, } debug_printf("%s[%u].%c", file_name, - chan_info->index, + chan_info->u.index, "xyzw01"[chan_info->swizzle]); } debug_printf("\n"); -- cgit v1.2.3 From 893620e52ea2b6ffc2e50f6bd9b7def76c405424 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Oct 2010 18:22:36 +0200 Subject: st/xorg: Fix typo Pointed out by Jakob Bornecrantz. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/xorg/xorg_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index ca745393a9..3a5db9856d 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -369,7 +369,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) ms = modesettingPTR(pScrn); ms->pEnt = pEnt; ms->cust = cust; - ms->fb_id = 1; + ms->fb_id = -1; pScrn->displayWidth = 640; /* default it */ -- cgit v1.2.3 From 7533c374570b333b5e0d626d36d18c41d4611cb5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 18:26:41 +0100 Subject: llvmpipe: make sure intrinsics code is guarded with PIPE_ARCH_SSE --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 82 +++++++++++++++--------------- 1 file changed, 42 insertions(+), 40 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index c3eefb724c..bae772b9c5 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -239,46 +239,6 @@ sign_bits4(const __m128i *cstep, int cdiff) return _mm_movemask_epi8(result); } -#endif - - - - -#define TAG(x) x##_1 -#define NR_PLANES 1 -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_2 -#define NR_PLANES 2 -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_3 -#define NR_PLANES 3 -/*#define TRI_4 lp_rast_triangle_3_4*/ -/*#define TRI_16 lp_rast_triangle_3_16*/ -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_4 -#define NR_PLANES 4 -#define TRI_16 lp_rast_triangle_4_16 -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_5 -#define NR_PLANES 5 -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_6 -#define NR_PLANES 6 -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_7 -#define NR_PLANES 7 -#include "lp_rast_tri_tmp.h" - -#define TAG(x) x##_8 -#define NR_PLANES 8 -#include "lp_rast_tri_tmp.h" - static INLINE void transpose4_epi32(const __m128i * restrict a, @@ -537,3 +497,45 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, 0xffff & ~mask); } } + +#undef NR_PLANES +#endif + + + + +#define TAG(x) x##_1 +#define NR_PLANES 1 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_2 +#define NR_PLANES 2 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_3 +#define NR_PLANES 3 +/*#define TRI_4 lp_rast_triangle_3_4*/ +/*#define TRI_16 lp_rast_triangle_3_16*/ +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_4 +#define NR_PLANES 4 +#define TRI_16 lp_rast_triangle_4_16 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_5 +#define NR_PLANES 5 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_6 +#define NR_PLANES 6 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_7 +#define NR_PLANES 7 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_8 +#define NR_PLANES 8 +#include "lp_rast_tri_tmp.h" + -- cgit v1.2.3 From 4ecb2c105da590abf79421a06234b636cd1afcd6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 09:28:46 +1000 Subject: gallium/tgsi: add support for stencil writes. this adds the capability + a stencil semantic id, + tgsi scan support. Signed-off-by: Dave Airlie --- src/gallium/auxiliary/tgsi/tgsi_dump.c | 3 ++- src/gallium/auxiliary/tgsi/tgsi_scan.c | 8 +++++--- src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 + src/gallium/docs/source/tgsi.rst | 6 ++++++ src/gallium/drivers/softpipe/sp_fs_exec.c | 12 ++++++++++-- src/gallium/include/pipe/p_defines.h | 3 ++- src/gallium/include/pipe/p_shader_tokens.h | 3 ++- 7 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 9b61797ace..77bde86684 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -126,7 +126,8 @@ static const char *semantic_names[] = "FACE", "EDGEFLAG", "PRIM_ID", - "INSTANCEID" + "INSTANCEID", + "STENCIL" }; static const char *immediate_type_names[] = diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 90198a4f60..538274887b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -157,9 +157,11 @@ tgsi_scan_shader(const struct tgsi_token *tokens, /* extra info for special outputs */ if (procType == TGSI_PROCESSOR_FRAGMENT && - fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) { - info->writes_z = TRUE; - } + fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) + info->writes_z = TRUE; + if (procType == TGSI_PROCESSOR_FRAGMENT && + fulldecl->Semantic.Name == TGSI_SEMANTIC_STENCIL) + info->writes_stencil = TRUE; if (procType == TGSI_PROCESSOR_VERTEX && fulldecl->Semantic.Name == TGSI_SEMANTIC_EDGEFLAG) { info->writes_edgeflag = TRUE; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index f8aa90cf06..374c7ed551 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -60,6 +60,7 @@ struct tgsi_shader_info uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */ boolean writes_z; /**< does fragment shader write Z value? */ + boolean writes_stencil; /**< does fragment shader write stencil value? */ boolean writes_edgeflag; /**< vertex shader outputs edgeflag */ boolean uses_kill; /**< KIL or KILP instruction used? */ diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 9e02d43ab7..c767680c62 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1415,6 +1415,12 @@ Edge flags are used to control which lines or points are actually drawn when the polygon mode converts triangles/quads/polygons into points or lines. +TGSI_SEMANTIC_STENCIL +"""""""""""""""""""""" + +For fragment shaders, this semantic label indicates than an output +is a writable stencil reference value. Only the Y component is writable. +This allows the fragment shader to change the fragments stencilref value. Properties diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index 67e2c8f8bc..346e1b402b 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -158,9 +158,17 @@ exec_run( const struct sp_fragment_shader *base, case TGSI_SEMANTIC_POSITION: { uint j; - for (j = 0; j < 4; j++) { + + for (j = 0; j < 4; j++) quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j]; - } + } + break; + case TGSI_SEMANTIC_STENCIL: + { + uint j; + + for (j = 0; j < 4; j++) + quad->output.stencil[j] = (unsigned)machine->Outputs[i].xyzw[1].f[j]; } break; } diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 8b4663742f..b6894c09e8 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -464,7 +464,8 @@ enum pipe_cap { PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER, - PIPE_CAP_DEPTH_CLAMP + PIPE_CAP_DEPTH_CLAMP, + PIPE_CAP_SHADER_STENCIL_EXPORT, }; /* Shader caps not specific to any single stage */ diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 74488de17e..ba433b2bd2 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -143,7 +143,8 @@ struct tgsi_declaration_dimension #define TGSI_SEMANTIC_EDGEFLAG 8 #define TGSI_SEMANTIC_PRIMID 9 #define TGSI_SEMANTIC_INSTANCEID 10 -#define TGSI_SEMANTIC_COUNT 11 /**< number of semantic values */ +#define TGSI_SEMANTIC_STENCIL 11 +#define TGSI_SEMANTIC_COUNT 12 /**< number of semantic values */ struct tgsi_declaration_semantic { -- cgit v1.2.3 From 66a0d1e4b930902810a5825193c4057626a51558 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 09:30:17 +1000 Subject: gallium/format: add support for X24S8 and S8X24 formats. these formats are needed for hw that can sample and write stencil values. Signed-off-by: Dave Airlie --- src/gallium/auxiliary/util/u_format.csv | 2 ++ src/gallium/auxiliary/util/u_format_zs.c | 32 ++++++++++++++++++ src/gallium/auxiliary/util/u_format_zs.h | 11 ++++++ src/gallium/auxiliary/util/u_tile.c | 57 ++++++++++++++++++++++++++++++++ src/gallium/docs/source/tgsi.rst | 2 ++ src/gallium/include/pipe/p_format.h | 3 ++ 6 files changed, 107 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index 016e73c4a1..5c0f8db1b2 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -109,6 +109,8 @@ PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs PIPE_FORMAT_Z24_UNORM_S8_USCALED , plain, 1, 1, un24, u8 , , , xy__, zs PIPE_FORMAT_S8_USCALED_Z24_UNORM , plain, 1, 1, u8 , un24, , , yx__, zs +PIPE_FORMAT_X24S8_USCALED , plain, 1, 1, x24, u8 , , , _y__, zs +PIPE_FORMAT_S8X24_USCALED , plain, 1, 1, u8 , x24 , , , _x__, zs PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32, u8 , x24 , , xy__, zs diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c index 792d69c214..fdadcec984 100644 --- a/src/gallium/auxiliary/util/u_format_zs.c +++ b/src/gallium/auxiliary/util/u_format_zs.c @@ -918,3 +918,35 @@ util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned d } } + +void +util_format_x24s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +{ + util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(dst_row, dst_stride, + src_row, src_stride, + width, height); +} + +void +util_format_x24s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +{ + util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(dst_row, dst_stride, + src_row, src_stride, + width, height); +} + +void +util_format_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +{ + util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(dst_row, dst_stride, + src_row, src_stride, + width, height); +} + +void +util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +{ + util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(dst_row, dst_stride, + src_row, src_stride, + width, height); +} diff --git a/src/gallium/auxiliary/util/u_format_zs.h b/src/gallium/auxiliary/util/u_format_zs.h index 650db4b95f..d412ca4c11 100644 --- a/src/gallium/auxiliary/util/u_format_zs.h +++ b/src/gallium/auxiliary/util/u_format_zs.h @@ -192,5 +192,16 @@ util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned void util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +void +util_format_x24s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_x24s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); #endif /* U_FORMAT_ZS_H_ */ diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index f7aa1403d0..3099bc6f48 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -217,6 +217,57 @@ z24s8_get_tile_rgba(const unsigned *src, } } +/*** PIPE_FORMAT_S8X24_USCALED ***/ + +/** + * Return S component as four uint32_t in [0..255]. Z part ignored. + */ +static void +s8x24_get_tile_rgba(const unsigned *src, + unsigned w, unsigned h, + float *p, + unsigned dst_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + float *pRow = p; + + for (j = 0; j < w; j++, pRow += 4) { + pRow[0] = + pRow[1] = + pRow[2] = + pRow[3] = (float)((*src++ >> 24) & 0xff); + } + + p += dst_stride; + } +} + +/*** PIPE_FORMAT_X24S8_USCALED ***/ + +/** + * Return S component as four uint32_t in [0..255]. Z part ignored. + */ +static void +x24s8_get_tile_rgba(const unsigned *src, + unsigned w, unsigned h, + float *p, + unsigned dst_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + float *pRow = p; + for (j = 0; j < w; j++, pRow += 4) { + pRow[0] = + pRow[1] = + pRow[2] = + pRow[3] = (float)(*src++ & 0xff); + } + p += dst_stride; + } +} /*** PIPE_FORMAT_Z32_FLOAT ***/ @@ -261,10 +312,16 @@ pipe_tile_raw_to_rgba(enum pipe_format format, case PIPE_FORMAT_Z24X8_UNORM: s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; + case PIPE_FORMAT_X24S8_USCALED: + s8x24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); + break; case PIPE_FORMAT_S8_USCALED_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; + case PIPE_FORMAT_S8X24_USCALED: + x24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); + break; case PIPE_FORMAT_Z32_FLOAT: z32f_get_tile_rgba((float *) src, w, h, dst, dst_stride); break; diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index c767680c62..d99ed7c6d6 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1499,6 +1499,8 @@ well. | Z | XXX TBD | (z, z, z, 1) | (0, z, 0, 1) | | | | [#depth-tex-mode]_ | | +--------------------+--------------+--------------------+--------------+ +| S | (s, s, s, s) | unknown | unknown | ++--------------------+--------------+--------------------+--------------+ .. [#envmap-bumpmap] http://www.opengl.org/registry/specs/ATI/envmap_bumpmap.txt .. [#depth-tex-mode] the default is (z, z, z, 1) but may also be (0, 0, 0, z) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 06412f4894..9978e5236f 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -186,6 +186,9 @@ enum pipe_format { PIPE_FORMAT_R8G8B8X8_UNORM = 134, PIPE_FORMAT_B4G4R4X4_UNORM = 135, + /* some stencil samplers formats */ + PIPE_FORMAT_X24S8_USCALED = 136, + PIPE_FORMAT_S8X24_USCALED = 137, PIPE_FORMAT_COUNT }; -- cgit v1.2.3 From 67e71429f13aedf1cc8bf444708a7aa65223ac0a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Oct 2010 16:14:59 +1000 Subject: gallium/format: add X32_S8X24_USCALED format. Has similiar use cases to the S8X24 and X24S8 formats. --- src/gallium/auxiliary/util/u_format.csv | 1 + src/gallium/auxiliary/util/u_format_zs.c | 21 +++++++++++++++++++++ src/gallium/auxiliary/util/u_format_zs.h | 5 +++++ src/gallium/include/pipe/p_format.h | 1 + 4 files changed, 28 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index 5c0f8db1b2..1fbd83841c 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -114,6 +114,7 @@ PIPE_FORMAT_S8X24_USCALED , plain, 1, 1, u8 , x24 , , , _x__, PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32, u8 , x24 , , xy__, zs +PIPE_FORMAT_X32_S8X24_USCALED , plain, 1, 1, x32, u8 , x24 , , _y__, zs # YUV formats # http://www.fourcc.org/yuv.php#UYVY diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c index fdadcec984..80081e22f7 100644 --- a/src/gallium/auxiliary/util/u_format_zs.c +++ b/src/gallium/auxiliary/util/u_format_zs.c @@ -950,3 +950,24 @@ util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, src_row, src_stride, width, height); } + +void +util_format_x32_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(dst_row, dst_stride, + src_row, src_stride, + width, height); + +} + +void +util_format_x32_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(dst_row, dst_stride, + src_row, src_stride, + width, height); +} diff --git a/src/gallium/auxiliary/util/u_format_zs.h b/src/gallium/auxiliary/util/u_format_zs.h index d412ca4c11..1604cc3eee 100644 --- a/src/gallium/auxiliary/util/u_format_zs.h +++ b/src/gallium/auxiliary/util/u_format_zs.h @@ -204,4 +204,9 @@ util_format_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_strid void util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +void +util_format_x32_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_x32_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_sride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); #endif /* U_FORMAT_ZS_H_ */ diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 9978e5236f..22cc7aa18a 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -189,6 +189,7 @@ enum pipe_format { /* some stencil samplers formats */ PIPE_FORMAT_X24S8_USCALED = 136, PIPE_FORMAT_S8X24_USCALED = 137, + PIPE_FORMAT_X32_S8X24_USCALED = 138, PIPE_FORMAT_COUNT }; -- cgit v1.2.3 From d02993c9dcdf8171a733a4da06236accf4e7d78f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Oct 2010 15:34:31 +1000 Subject: gallium/util: add S8 tile sampling support. --- src/gallium/auxiliary/util/u_tile.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 3099bc6f48..44cadbfcdd 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -269,6 +269,30 @@ x24s8_get_tile_rgba(const unsigned *src, } } + +/** + * Return S component as four uint32_t in [0..255]. Z part ignored. + */ +static void +s8_get_tile_rgba(const unsigned char *src, + unsigned w, unsigned h, + float *p, + unsigned dst_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + float *pRow = p; + for (j = 0; j < w; j++, pRow += 4) { + pRow[0] = + pRow[1] = + pRow[2] = + pRow[3] = (float)(*src++ & 0xff); + } + p += dst_stride; + } +} + /*** PIPE_FORMAT_Z32_FLOAT ***/ /** @@ -312,6 +336,9 @@ pipe_tile_raw_to_rgba(enum pipe_format format, case PIPE_FORMAT_Z24X8_UNORM: s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; + case PIPE_FORMAT_S8_USCALED: + s8_get_tile_rgba((unsigned char *) src, w, h, dst, dst_stride); + break; case PIPE_FORMAT_X24S8_USCALED: s8x24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; -- cgit v1.2.3 From d8f6ef456581644ab9444a1ed23542c2b0fff9e4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 09:32:32 +1000 Subject: softpipe: add support for shader stencil export capability this allows softpipe to be used to test shader stencil ref exporting. Signed-off-by: Dave Airlie --- src/gallium/drivers/softpipe/sp_fs_sse.c | 12 +++-- src/gallium/drivers/softpipe/sp_quad.h | 1 + src/gallium/drivers/softpipe/sp_quad_depth_test.c | 61 ++++++++++++++++++++--- src/gallium/drivers/softpipe/sp_quad_pipe.c | 3 +- src/gallium/drivers/softpipe/sp_screen.c | 2 + 5 files changed, 67 insertions(+), 12 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index daa158df7c..5b18cd035e 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -169,9 +169,15 @@ fs_sse_run( const struct sp_fragment_shader *base, case TGSI_SEMANTIC_POSITION: { uint j; - for (j = 0; j < 4; j++) { - quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j]; - } + for (j = 0; j < 4; j++) + quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j]; + } + break; + case TGSI_SEMANTIC_STENCIL: + { + uint j; + for (j = 0; j < 4; j++) + quad->output.stencil[j] = machine->Outputs[i].xyzw[1].f[j]; } break; } diff --git a/src/gallium/drivers/softpipe/sp_quad.h b/src/gallium/drivers/softpipe/sp_quad.h index a3236bd116..e745aa8061 100644 --- a/src/gallium/drivers/softpipe/sp_quad.h +++ b/src/gallium/drivers/softpipe/sp_quad.h @@ -85,6 +85,7 @@ struct quad_header_output /** colors in SOA format (rrrr, gggg, bbbb, aaaa) */ float color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS][QUAD_SIZE]; float depth[QUAD_SIZE]; + uint8_t stencil[QUAD_SIZE]; }; diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index e9b9262617..c8f5f89568 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -47,6 +47,8 @@ struct depth_data { unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */ unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */ ubyte stencilVals[QUAD_SIZE]; + boolean use_shader_stencil_refs; + ubyte shader_stencil_refs[QUAD_SIZE]; struct softpipe_cached_tile *tile; }; @@ -186,6 +188,33 @@ convert_quad_depth( struct depth_data *data, } +/** + * Compute the depth_data::shader_stencil_refs[] values from the float fragment stencil values. + */ +static void +convert_quad_stencil( struct depth_data *data, + const struct quad_header *quad ) +{ + unsigned j; + + data->use_shader_stencil_refs = TRUE; + /* Copy quads stencil values + */ + switch (data->format) { + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + { + for (j = 0; j < QUAD_SIZE; j++) { + data->shader_stencil_refs[j] = ((unsigned)(quad->output.stencil[j])); + } + } + break; + default: + assert(0); + } +} /** * Write data->bzzzz[] values and data->stencilVals into the Z/stencil buffer. @@ -272,8 +301,14 @@ do_stencil_test(struct depth_data *data, { unsigned passMask = 0x0; unsigned j; + ubyte refs[QUAD_SIZE]; - ref &= valMask; + for (j = 0; j < QUAD_SIZE; j++) { + if (data->use_shader_stencil_refs) + refs[j] = data->shader_stencil_refs[j] & valMask; + else + refs[j] = ref & valMask; + } switch (func) { case PIPE_FUNC_NEVER: @@ -281,42 +316,42 @@ do_stencil_test(struct depth_data *data, break; case PIPE_FUNC_LESS: for (j = 0; j < QUAD_SIZE; j++) { - if (ref < (data->stencilVals[j] & valMask)) { + if (refs[j] < (data->stencilVals[j] & valMask)) { passMask |= (1 << j); } } break; case PIPE_FUNC_EQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (ref == (data->stencilVals[j] & valMask)) { + if (refs[j] == (data->stencilVals[j] & valMask)) { passMask |= (1 << j); } } break; case PIPE_FUNC_LEQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (ref <= (data->stencilVals[j] & valMask)) { + if (refs[j] <= (data->stencilVals[j] & valMask)) { passMask |= (1 << j); } } break; case PIPE_FUNC_GREATER: for (j = 0; j < QUAD_SIZE; j++) { - if (ref > (data->stencilVals[j] & valMask)) { + if (refs[j] > (data->stencilVals[j] & valMask)) { passMask |= (1 << j); } } break; case PIPE_FUNC_NOTEQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (ref != (data->stencilVals[j] & valMask)) { + if (refs[j] != (data->stencilVals[j] & valMask)) { passMask |= (1 << j); } } break; case PIPE_FUNC_GEQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (ref >= (data->stencilVals[j] & valMask)) { + if (refs[j] >= (data->stencilVals[j] & valMask)) { passMask |= (1 << j); } } @@ -348,9 +383,14 @@ apply_stencil_op(struct depth_data *data, { unsigned j; ubyte newstencil[QUAD_SIZE]; + ubyte refs[QUAD_SIZE]; for (j = 0; j < QUAD_SIZE; j++) { newstencil[j] = data->stencilVals[j]; + if (data->use_shader_stencil_refs) + refs[j] = data->shader_stencil_refs[j]; + else + refs[j] = ref; } switch (op) { @@ -367,7 +407,7 @@ apply_stencil_op(struct depth_data *data, case PIPE_STENCIL_OP_REPLACE: for (j = 0; j < QUAD_SIZE; j++) { if (mask & (1 << j)) { - newstencil[j] = ref; + newstencil[j] = refs[j]; } } break; @@ -688,8 +728,10 @@ depth_test_quads_fallback(struct quad_stage *qs, unsigned i, pass = 0; const struct sp_fragment_shader *fs = qs->softpipe->fs; boolean interp_depth = !fs->info.writes_z; + boolean shader_stencil_ref = fs->info.writes_stencil; struct depth_data data; + data.use_shader_stencil_refs = FALSE; if (qs->softpipe->depth_stencil->alpha.enabled) { nr = alpha_test_quads(qs, quads, nr); @@ -716,6 +758,9 @@ depth_test_quads_fallback(struct quad_stage *qs, } if (qs->softpipe->depth_stencil->stencil[0].enabled) { + if (shader_stencil_ref) + convert_quad_stencil(&data, quads[i]); + depth_stencil_test_quad(qs, &data, quads[i]); write_depth_stencil_values(&data, quads[i]); } diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index 43b8e88e33..2cfd02a22c 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -47,7 +47,8 @@ sp_build_quad_pipeline(struct softpipe_context *sp) sp->framebuffer.zsbuf && !sp->depth_stencil->alpha.enabled && !sp->fs->info.uses_kill && - !sp->fs->info.writes_z; + !sp->fs->info.writes_z && + !sp->fs->info.writes_stencil; sp->quad.first = sp->quad.blend; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 2053d02f62..37557d1194 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -114,6 +114,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 1; case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: return 0; + case PIPE_CAP_SHADER_STENCIL_EXPORT: + return 1; default: return 0; } -- cgit v1.2.3 From 40acb109de61ba445b9247f7d53eaf1c2b9b1245 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Oct 2010 13:01:37 +1000 Subject: r600g: add support for S8, X24S8 and S8X24 sampler formats. --- src/gallium/drivers/r600/r600_texture.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index db88346afb..496b28a3b9 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -498,14 +498,22 @@ uint32_t r600_translate_texformat(enum pipe_format format, case PIPE_FORMAT_Z16_UNORM: result = V_0280A0_COLOR_16; goto out_word4; + case PIPE_FORMAT_X24S8_USCALED: + word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT); case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24_UNORM_S8_USCALED: result = V_0280A0_COLOR_8_24; goto out_word4; + case PIPE_FORMAT_S8X24_USCALED: + word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT); case PIPE_FORMAT_X8Z24_UNORM: case PIPE_FORMAT_S8_USCALED_Z24_UNORM: result = V_0280A0_COLOR_24_8; goto out_word4; + case PIPE_FORMAT_S8_USCALED: + result = V_0280A0_COLOR_8; + word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT); + goto out_word4; default: goto out_unknown; } -- cgit v1.2.3 From 39d1feb51e9dac794751e72f48faf26409a84b1c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 10:14:33 +1000 Subject: r600g: add shader stencil export support. --- src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/r600/r600_shader.c | 16 ++++++++++++++-- src/gallium/drivers/r600/r600d.h | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 832a2b2b60..52fe3c777b 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -242,6 +242,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_INDEP_BLEND_ENABLE: case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: case PIPE_CAP_DEPTH_CLAMP: + case PIPE_CAP_SHADER_STENCIL_EXPORT: return 1; /* Unsupported features (boolean caps). */ diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 341800306d..8930d4e183 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -137,12 +137,17 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade R_02880C_DB_SHADER_CONTROL, S_02880C_Z_EXPORT_ENABLE(1), S_02880C_Z_EXPORT_ENABLE(1), NULL); + if (rshader->output[i].name == TGSI_SEMANTIC_STENCIL) + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + S_02880C_STENCIL_REF_EXPORT_ENABLE(1), + S_02880C_STENCIL_REF_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) + if (rshader->output[i].name == TGSI_SEMANTIC_POSITION || rshader->output[i].name == TGSI_SEMANTIC_STENCIL) exports_ps |= 1; else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { num_cout++; @@ -628,7 +633,14 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s } else if (shader->output[i].name == TGSI_SEMANTIC_POSITION) { output[i].array_base = 61; output[i].swizzle_x = 2; - output[i].swizzle_y = output[i].swizzle_z = output[i].swizzle_w = 7; + output[i].swizzle_y = 7; + output[i].swizzle_z = output[i].swizzle_w = 7; + output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL; + } else if (shader->output[i].name == TGSI_SEMANTIC_STENCIL) { + output[i].array_base = 61; + output[i].swizzle_x = 7; + output[i].swizzle_y = 1; + output[i].swizzle_z = output[i].swizzle_w = 7; output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL; } else { R600_ERR("unsupported fragment output name %d\n", shader->output[i].name); diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index a96d2ce26c..f32f5286c9 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -667,6 +667,9 @@ #define S_02880C_Z_EXPORT_ENABLE(x) (((x) & 0x1) << 0) #define G_02880C_Z_EXPORT_ENABLE(x) (((x) >> 0) & 0x1) #define C_02880C_Z_EXPORT_ENABLE 0xFFFFFFFE +#define S_02880C_STENCIL_REF_EXPORT_ENABLE(x) (((x) & 0x1) << 1) +#define G_02880C_STENCIL_REF_EXPORT_ENABLE(x) (((x) >> 1) & 0x1) +#define C_02880C_STENCIL_REF_EXPORT_ENABLE 0xFFFFFFFD #define S_02880C_Z_ORDER(x) (((x) & 0x3) << 4) #define G_02880C_Z_ORDER(x) (((x) >> 4) & 0x3) #define C_02880C_Z_ORDER 0xFFFFFCFF -- cgit v1.2.3 From c1549729ce5243fb7fec7b589278656b8b1ab4fb Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 13 Oct 2010 02:34:08 +0200 Subject: gallivm: fix different handling of [non]normalized coords in linear soa path There seems to be no reason for it, so do same math for both (except the scale mul, of course). --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index af3f4688ed..8c03284621 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -294,23 +294,13 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld, if (bld->static_state->normalized_coords) { /* mul by tex size */ coord = lp_build_mul(coord_bld, coord, length_f); - /* clamp to length max */ - coord = lp_build_min(coord_bld, coord, length_f); - /* subtract 0.5 */ - coord = lp_build_sub(coord_bld, coord, half); - /* clamp to [0, length - 0.5] */ - coord = lp_build_max(coord_bld, coord, coord_bld->zero); - } - /* XXX this is odd normalized ranges from 0 to length-0.5 after denorm - but non-normalized ranges from to 0.5 to length-0.5 after clamp. - Is this missing the sub 0.5? */ - else { - LLVMValueRef min, max; - /* clamp to [0.5, length - 0.5] */ - min = half; - max = lp_build_sub(coord_bld, length_f, min); - coord = lp_build_clamp(coord_bld, coord, min, max); } + /* clamp to length max */ + coord = lp_build_min(coord_bld, coord, length_f); + /* subtract 0.5 */ + coord = lp_build_sub(coord_bld, coord, half); + /* clamp to [0, length - 0.5] */ + coord = lp_build_max(coord_bld, coord, coord_bld->zero); /* convert to int, compute lerp weight */ lp_build_ifloor_fract(&abs_coord_bld, coord, &coord0, &weight); coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one); -- cgit v1.2.3 From 50f221a01b45cc1e00ed3462b8084d5b6a8a46aa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 Oct 2010 18:37:30 -0600 Subject: gallivm: remove newlines --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 2c049d0293..00f419a486 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1423,8 +1423,6 @@ lp_build_ifloor_fract(struct lp_build_context *bld, LLVMValueRef *out_ipart, LLVMValueRef *out_fpart) { - - const struct lp_type type = bld->type; LLVMValueRef ipart; -- cgit v1.2.3 From 048a90c1cb926fdeae47392582cb91b0a689905f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 Oct 2010 18:38:22 -0600 Subject: draw/llvmpipe: replace DRAW_MAX_TEXTURE_LEVELS with PIPE_MAX_TEXTURE_LEVELS There's no apparent reason for the former to exist. And they didn't even have the same value. --- src/gallium/auxiliary/draw/draw_context.c | 6 +++--- src/gallium/auxiliary/draw/draw_context.h | 7 +++---- src/gallium/auxiliary/draw/draw_llvm.c | 12 ++++++------ src/gallium/auxiliary/draw/draw_llvm.h | 13 ++++++------- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 6 +++--- 5 files changed, 21 insertions(+), 23 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 032fcbbc70..40f654643b 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -721,9 +721,9 @@ draw_set_mapped_texture(struct draw_context *draw, unsigned sampler_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t last_level, - uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS], - uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS], - const void *data[DRAW_MAX_TEXTURE_LEVELS]) + uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS], + uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS], + const void *data[PIPE_MAX_TEXTURE_LEVELS]) { #ifdef HAVE_LLVM if(draw->llvm) diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 1f27cbf488..ff4f753604 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -49,7 +49,6 @@ struct draw_geometry_shader; struct draw_fragment_shader; struct tgsi_sampler; -#define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */ struct draw_context *draw_create( struct pipe_context *pipe ); @@ -120,9 +119,9 @@ draw_set_mapped_texture(struct draw_context *draw, unsigned sampler_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t last_level, - uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS], - uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS], - const void *data[DRAW_MAX_TEXTURE_LEVELS]); + uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS], + uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS], + const void *data[PIPE_MAX_TEXTURE_LEVELS]); /* diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 7fb86d7cb2..d94340367c 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -72,12 +72,12 @@ init_globals(struct draw_llvm *llvm) elem_types[DRAW_JIT_TEXTURE_DEPTH] = LLVMInt32Type(); elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type(); elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] = - LLVMArrayType(LLVMInt32Type(), DRAW_MAX_TEXTURE_LEVELS); + LLVMArrayType(LLVMInt32Type(), PIPE_MAX_TEXTURE_LEVELS); elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] = - LLVMArrayType(LLVMInt32Type(), DRAW_MAX_TEXTURE_LEVELS); + LLVMArrayType(LLVMInt32Type(), PIPE_MAX_TEXTURE_LEVELS); elem_types[DRAW_JIT_TEXTURE_DATA] = LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0), - DRAW_MAX_TEXTURE_LEVELS); + PIPE_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(); @@ -1066,9 +1066,9 @@ draw_llvm_set_mapped_texture(struct draw_context *draw, unsigned sampler_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t last_level, - uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS], - uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS], - const void *data[DRAW_MAX_TEXTURE_LEVELS]) + uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS], + uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS], + const void *data[PIPE_MAX_TEXTURE_LEVELS]) { unsigned j; struct draw_jit_texture *jit_tex; diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index d0a68ae412..de89b657f3 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -41,7 +41,6 @@ #include #include -#define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */ struct draw_llvm; struct llvm_vertex_shader; @@ -52,9 +51,9 @@ struct draw_jit_texture uint32_t height; uint32_t depth; uint32_t last_level; - uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS]; - uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS]; - const void *data[DRAW_MAX_TEXTURE_LEVELS]; + uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS]; + uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS]; + const void *data[PIPE_MAX_TEXTURE_LEVELS]; float min_lod; float max_lod; float lod_bias; @@ -290,8 +289,8 @@ draw_llvm_set_mapped_texture(struct draw_context *draw, unsigned sampler_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t last_level, - uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS], - uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS], - const void *data[DRAW_MAX_TEXTURE_LEVELS]); + uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS], + uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS], + const void *data[PIPE_MAX_TEXTURE_LEVELS]); #endif diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 17a4a0ed02..1dd866195d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -246,9 +246,9 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp, struct pipe_sampler_view **views) { unsigned i; - uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS]; - uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS]; - const void *data[DRAW_MAX_TEXTURE_LEVELS]; + uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS]; + uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS]; + const void *data[PIPE_MAX_TEXTURE_LEVELS]; assert(num <= PIPE_MAX_VERTEX_SAMPLERS); if (!num) -- cgit v1.2.3 From 833b4fc11e0fcac36490b036135298232310568a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 12 Oct 2010 14:43:44 +1000 Subject: r600g: fix depth0 setting --- src/gallium/drivers/r600/r600_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 496b28a3b9..1eaf40fdf0 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -244,7 +244,7 @@ int r600_texture_depth_flush(struct pipe_context *ctx, resource.format = texture->format; resource.width0 = texture->width0; resource.height0 = texture->height0; - resource.depth0 = 0; + resource.depth0 = 1; resource.last_level = 0; resource.nr_samples = 0; resource.usage = PIPE_USAGE_DYNAMIC; @@ -297,7 +297,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, resource.format = texture->format; resource.width0 = box->width; resource.height0 = box->height; - resource.depth0 = 0; + resource.depth0 = 1; resource.last_level = 0; resource.nr_samples = 0; resource.usage = PIPE_USAGE_DYNAMIC; -- cgit v1.2.3 From a8d1d7253ed281fd5c3a8a86658998eb5b9af847 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 14:23:36 +1000 Subject: r600g: fix scissor/cliprect confusion gallium calls them scissors, but r600 hw like r300 is better off using cliprects to implement them as we can turn them on/off a lot easier. --- src/gallium/drivers/r600/evergreen_state.c | 52 +++------------------------ src/gallium/drivers/r600/r600_state.c | 58 ++++-------------------------- 2 files changed, 10 insertions(+), 100 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 99085647a7..a5298e3fdf 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -241,6 +241,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, struct r600_pipe_state *rstate; unsigned tmp; unsigned prov_vtx = 1, polygon_dual_mode; + unsigned clip_rule; if (rs == NULL) { return NULL; @@ -250,6 +251,8 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, rs->flatshade = state->flatshade; rs->sprite_coord_enable = state->sprite_coord_enable; + clip_rule = state->scissor ? 0xAAAA : 0xFFFF; + /* offset */ rs->offset_units = state->offset_units; rs->offset_scale = state->offset_scale * 12.0f; @@ -299,6 +302,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, 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); + r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL); return rstate; } @@ -629,18 +633,6 @@ 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, - 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); @@ -665,15 +657,6 @@ static void evergreen_set_scissor_state(struct pipe_context *ctx, 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); - 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; @@ -911,36 +894,9 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, 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); r600_pipe_state_add_reg(rstate, R_028230_PA_SC_EDGERULE, 0xAAAAAAAA, 0xFFFFFFFF, NULL); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 70461d24ea..25310eeda4 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -446,6 +446,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, struct r600_pipe_state *rstate; unsigned tmp; unsigned prov_vtx = 1, polygon_dual_mode; + unsigned clip_rule; if (rs == NULL) { return NULL; @@ -455,6 +456,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, rs->flatshade = state->flatshade; rs->sprite_coord_enable = state->sprite_coord_enable; + clip_rule = state->scissor ? 0xAAAA : 0xFFFF; /* offset */ rs->offset_units = state->offset_units; rs->offset_scale = state->offset_scale * 12.0f; @@ -505,6 +507,8 @@ static void *r600_create_rs_state(struct pipe_context *ctx, 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); + r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL); + return rstate; } @@ -832,18 +836,6 @@ 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, - 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); @@ -868,17 +860,6 @@ static void r600_set_scissor_state(struct pipe_context *ctx, 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; @@ -1098,36 +1079,9 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_028254_PA_SC_VPORT_SCISSOR_0_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, @@ -1532,14 +1486,14 @@ void r600_init_config(struct r600_pipe_context *rctx) 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); + r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00514002, 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_028A4C_PA_SC_MODE_CNTL, 0x00004012, 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); -- cgit v1.2.3 From c8d4108fbee679735a1cc3f405d848d01bfb23f6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 12 Oct 2010 13:24:01 +1000 Subject: r600g: store samplers/views across blit when we need to modify them also fixup framebuffer state copies to avoid bad state. --- src/gallium/drivers/r600/evergreen_state.c | 18 ++++++----- src/gallium/drivers/r600/r600_blit.c | 51 +++++++++++++++++++++--------- src/gallium/drivers/r600/r600_pipe.h | 10 ++++++ src/gallium/drivers/r600/r600_state.c | 18 ++++++----- 4 files changed, 66 insertions(+), 31 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index a5298e3fdf..4e95d4c490 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "r600.h" #include "evergreend.h" @@ -500,6 +501,9 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; + rctx->ps_samplers.views = resource; + rctx->ps_samplers.n_views = count; + for (int i = 0; i < count; i++) { if (resource[i]) { evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); @@ -523,6 +527,9 @@ static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count, struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; + rctx->ps_samplers.samplers = states; + rctx->ps_samplers.n_samplers = count; + for (int i = 0; i < count; i++) { evergreen_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); } @@ -842,14 +849,9 @@ static void evergreen_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); - rctx->framebuffer = *state; + + util_copy_framebuffer_state(&rctx->framebuffer, state); + rctx->pframebuffer = &rctx->framebuffer; /* build states */ diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 4bf44a171a..aecc87f7da 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -24,10 +24,19 @@ #include #include "r600_pipe.h" -static void r600_blitter_save_states(struct pipe_context *ctx) +enum r600_blitter_op /* bitmask */ +{ + R600_CLEAR = 1, + R600_CLEAR_SURFACE = 2, + R600_COPY = 4 +}; + +static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + r600_context_queries_suspend(&rctx->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]) { @@ -47,7 +56,25 @@ static void r600_blitter_save_states(struct pipe_context *ctx) rctx->vertex_elements = NULL; - /* TODO queries */ + if (op & (R600_CLEAR_SURFACE | R600_COPY)) + util_blitter_save_framebuffer(rctx->blitter, &rctx->framebuffer); + + if (op & R600_COPY) { + util_blitter_save_fragment_sampler_states( + rctx->blitter, rctx->ps_samplers.n_samplers, + (void**)rctx->ps_samplers.samplers); + + util_blitter_save_fragment_sampler_views( + rctx->blitter, rctx->ps_samplers.n_views, + (struct pipe_sampler_view**)rctx->ps_samplers.views); + } + +} + +static void r600_blitter_end(struct pipe_context *ctx) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + r600_context_queries_resume(&rctx->ctx); } int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) @@ -73,9 +100,8 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te (struct pipe_resource*)texture->flushed_depth_texture, 0, level, 0, PIPE_BIND_RENDER_TARGET); - r600_blitter_save_states(ctx); + r600_blitter_begin(ctx, R600_CLEAR); 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; @@ -99,12 +125,11 @@ 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); + r600_blitter_begin(ctx, R600_CLEAR); util_blitter_clear(rctx->blitter, fb->width, fb->height, fb->nr_cbufs, buffers, rgba, depth, stencil); - r600_context_queries_resume(&rctx->ctx); + r600_blitter_end(ctx); } static void r600_clear_render_target(struct pipe_context *ctx, @@ -114,13 +139,11 @@ static void r600_clear_render_target(struct pipe_context *ctx, 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); + r600_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_clear_render_target(rctx->blitter, dst, rgba, dstx, dsty, width, height); - r600_context_queries_resume(&rctx->ctx); + r600_blitter_end(ctx); } static void r600_clear_depth_stencil(struct pipe_context *ctx, @@ -132,13 +155,11 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, 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); + r600_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height); - r600_context_queries_resume(&rctx->ctx); + r600_blitter_end(ctx); } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index c46029a561..34a59646d5 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -92,6 +92,14 @@ struct r600_pipe_shader { struct r600_vertex_element vertex_elements; }; +/* needed for blitter save */ +struct r600_textures_info { + struct r600_pipe_sampler_view **views; + unsigned n_views; + void **samplers; + unsigned n_samplers; +}; + struct r600_pipe_context { struct pipe_context context; struct blitter_context *blitter; @@ -130,6 +138,8 @@ struct r600_pipe_context { struct u_upload_mgr *upload_vb; struct u_upload_mgr *upload_ib; unsigned any_user_vbs; + struct r600_textures_info ps_samplers; + }; struct r600_drawl { diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 25310eeda4..b2e7c282e2 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "r600.h" #include "r600d.h" @@ -703,6 +704,9 @@ static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; + rctx->ps_samplers.views = resource; + rctx->ps_samplers.n_views = count; + for (int i = 0; i < count; i++) { if (resource[i]) { r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i); @@ -726,6 +730,9 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; + rctx->ps_samplers.samplers = states; + rctx->ps_samplers.n_samplers = count; + for (int i = 0; i < count; i++) { r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); } @@ -1025,14 +1032,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); - rctx->framebuffer = *state; + + util_copy_framebuffer_state(&rctx->framebuffer, state); + rctx->pframebuffer = &rctx->framebuffer; /* build states */ -- cgit v1.2.3 From d59498b78041b8a7a046ac2c892e7a1896f59ca2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 15:22:04 +1000 Subject: r600g: reduce size of context structure. this thing will be in the cache a lot, so having massive big struct arrays inside it won't be helping anyone. --- src/gallium/drivers/r600/r600_pipe.c | 28 ++++++++++++++++++++++++++++ src/gallium/drivers/r600/r600_pipe.h | 11 +++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 52fe3c777b..69bfb2a1a4 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -85,6 +85,10 @@ static void r600_destroy_context(struct pipe_context *context) u_upload_destroy(rctx->upload_vb); u_upload_destroy(rctx->upload_ib); + FREE(rctx->ps_resource); + FREE(rctx->vs_resource); + FREE(rctx->vs_const); + FREE(rctx->ps_const); FREE(rctx); } @@ -171,6 +175,30 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void return NULL; } + rctx->vs_const = CALLOC(R600_CONSTANT_ARRAY_SIZE, sizeof(struct r600_pipe_state)); + if (!rctx->vs_const) { + FREE(rctx); + return NULL; + } + + rctx->ps_const = CALLOC(R600_CONSTANT_ARRAY_SIZE, sizeof(struct r600_pipe_state)); + if (!rctx->vs_const) { + FREE(rctx); + return NULL; + } + + rctx->vs_resource = CALLOC(R600_RESOURCE_ARRAY_SIZE, sizeof(struct r600_pipe_state)); + if (!rctx->vs_resource) { + FREE(rctx); + return NULL; + } + + rctx->ps_resource = CALLOC(R600_RESOURCE_ARRAY_SIZE, sizeof(struct r600_pipe_state)); + if (!rctx->ps_resource) { + FREE(rctx); + return NULL; + } + class = r600_get_family_class(rctx->radeon); if (class == R600 || class == R700) rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 34a59646d5..6ce1f96952 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -100,6 +100,9 @@ struct r600_textures_info { unsigned n_samplers; }; +#define R600_CONSTANT_ARRAY_SIZE 256 +#define R600_RESOURCE_ARRAY_SIZE 160 + struct r600_pipe_context { struct pipe_context context; struct blitter_context *blitter; @@ -122,10 +125,10 @@ struct r600_pipe_context { 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 *vs_const; + struct r600_pipe_state *ps_const; + struct r600_pipe_state *vs_resource; + struct r600_pipe_state *ps_resource; struct r600_pipe_state config; struct r600_pipe_shader *ps_shader; struct r600_pipe_shader *vs_shader; -- cgit v1.2.3 From 560427667006f01ad9146fa07185924d4f3a08d6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 15:56:12 +1000 Subject: r600g: the vs/ps const arrays weren't actually being used. completely removed them. --- src/gallium/drivers/r600/r600_pipe.c | 14 -------------- src/gallium/drivers/r600/r600_pipe.h | 2 -- 2 files changed, 16 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 69bfb2a1a4..8eb9799323 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -87,8 +87,6 @@ static void r600_destroy_context(struct pipe_context *context) FREE(rctx->ps_resource); FREE(rctx->vs_resource); - FREE(rctx->vs_const); - FREE(rctx->ps_const); FREE(rctx); } @@ -175,18 +173,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void return NULL; } - rctx->vs_const = CALLOC(R600_CONSTANT_ARRAY_SIZE, sizeof(struct r600_pipe_state)); - if (!rctx->vs_const) { - FREE(rctx); - return NULL; - } - - rctx->ps_const = CALLOC(R600_CONSTANT_ARRAY_SIZE, sizeof(struct r600_pipe_state)); - if (!rctx->vs_const) { - FREE(rctx); - return NULL; - } - rctx->vs_resource = CALLOC(R600_RESOURCE_ARRAY_SIZE, sizeof(struct r600_pipe_state)); if (!rctx->vs_resource) { FREE(rctx); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 6ce1f96952..8731786769 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -125,8 +125,6 @@ struct r600_pipe_context { struct pipe_clip_state clip; unsigned vs_nconst; unsigned ps_nconst; - struct r600_pipe_state *vs_const; - struct r600_pipe_state *ps_const; struct r600_pipe_state *vs_resource; struct r600_pipe_state *ps_resource; struct r600_pipe_state config; -- cgit v1.2.3 From 9979d60c0e2e4152bce19c2c4128ff2941b9191b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 12 Oct 2010 11:54:16 +1000 Subject: r600g: add copy into tiled texture --- src/gallium/drivers/r600/r600_texture.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 1eaf40fdf0..f770a35dab 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -53,6 +53,25 @@ static void r600_copy_from_tiled_texture(struct pipe_context *ctx, struct r600_t transfer->box.width, transfer->box.height); } + +/* Copy from a detiled texture to a tiled one. */ +static void r600_copy_into_tiled_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) +{ + struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; + struct pipe_resource *texture = transfer->resource; + struct pipe_subresource subsrc; + + subsrc.face = 0; + subsrc.level = 0; + ctx->resource_copy_region(ctx, texture, transfer->sr, + transfer->box.x, transfer->box.y, transfer->box.z, + rtransfer->linear_texture, subsrc, + 0, 0, 0, + transfer->box.width, transfer->box.height); + + ctx->flush(ctx, 0, NULL); +} + static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex, unsigned level, unsigned zslice, unsigned face) @@ -339,12 +358,12 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx, struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; if (rtransfer->linear_texture) { + if (transfer->usage & PIPE_TRANSFER_WRITE) { + r600_copy_into_tiled_texture(ctx, rtransfer); + } pipe_resource_reference(&rtransfer->linear_texture, NULL); } if (rtex->flushed_depth_texture) { - if (transfer->usage & PIPE_TRANSFER_WRITE) { - // TODO - } pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL); } pipe_resource_reference(&transfer->resource, NULL); -- cgit v1.2.3 From 771dd89881791e38c076230497023ad7522602b3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 12 Oct 2010 09:53:17 +1000 Subject: r600g: split out miptree setup like r300g just a cleanup step towards tiling --- src/gallium/drivers/r600/r600_texture.c | 55 ++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index f770a35dab..048339e120 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -91,22 +91,53 @@ static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex, } } -static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_class chipc) +static unsigned r600_texture_get_stride(struct pipe_screen *screen, + struct r600_resource_texture *rtex, + unsigned level) { struct pipe_resource *ptex = &rtex->resource.base.b; - unsigned long w, h, pitch, size, layer_size, i, offset; + struct radeon *radeon = (struct radeon *)screen->winsys; + enum chip_class chipc = r600_get_family_class(radeon); + unsigned width, stride; + + width = u_minify(ptex->width0, level); + + stride = util_format_get_stride(ptex->format, align(width, 64)); + if (chipc == EVERGREEN) + stride = align(stride, 512); + else + stride = align(stride, 256); + return stride; +} + +static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen, + struct r600_resource_texture *rtex, + unsigned level) +{ + struct pipe_resource *ptex = &rtex->resource.base.b; + unsigned height; + + height = u_minify(ptex->height0, level); + height = util_next_power_of_two(height); + return util_format_get_nblocksy(ptex->format, height); +} + +static void r600_setup_miptree(struct pipe_screen *screen, + struct r600_resource_texture *rtex) +{ + struct pipe_resource *ptex = &rtex->resource.base.b; + struct radeon *radeon = (struct radeon *)screen->winsys; + enum chip_class chipc = r600_get_family_class(radeon); + unsigned long pitch, size, layer_size, i, offset; + unsigned nblocksy; rtex->bpt = util_format_get_blocksize(ptex->format); for (i = 0, offset = 0; i <= ptex->last_level; i++) { - w = u_minify(ptex->width0, i); - h = u_minify(ptex->height0, i); - h = util_next_power_of_two(h); - pitch = util_format_get_stride(ptex->format, align(w, 64)); - if (chipc == EVERGREEN) - pitch = align(pitch, 512); - else - pitch = align(pitch, 256); - layer_size = pitch * h; + pitch = r600_texture_get_stride(screen, rtex, i); + nblocksy = r600_texture_get_nblocksy(screen, rtex, i); + + layer_size = pitch * nblocksy; + if (ptex->target == PIPE_TEXTURE_CUBE) { if (chipc >= R700) size = layer_size * 8; @@ -139,7 +170,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_get_family_class(radeon)); + r600_setup_miptree(screen, rtex); /* FIXME alignment 4096 enought ? too much ? */ resource->domain = r600_domain_from_usage(resource->base.b.bind); -- cgit v1.2.3 From 6a0066a69f6873a53d45684205926e8f5b73ddb2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 12 Oct 2010 10:51:03 +1000 Subject: r600g: use common texture object create function --- src/gallium/drivers/r600/r600_texture.c | 74 ++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 33 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 048339e120..e825aeee35 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -100,6 +100,9 @@ static unsigned r600_texture_get_stride(struct pipe_screen *screen, enum chip_class chipc = r600_get_family_class(radeon); unsigned width, stride; + if (rtex->pitch_override) + return rtex->pitch_override; + width = u_minify(ptex->width0, level); stride = util_format_get_stride(ptex->format, align(width, 64)); @@ -154,33 +157,54 @@ static void r600_setup_miptree(struct pipe_screen *screen, rtex->size = offset; } -struct pipe_resource *r600_texture_create(struct pipe_screen *screen, - const struct pipe_resource *templ) +static struct r600_resource_texture * +r600_texture_create_object(struct pipe_screen *screen, + const struct pipe_resource *base, + unsigned array_mode, + unsigned pitch_in_bytes_override, + unsigned max_buffer_size, + struct r600_bo *bo) { struct r600_resource_texture *rtex; struct r600_resource *resource; struct radeon *radeon = (struct radeon *)screen->winsys; rtex = CALLOC_STRUCT(r600_resource_texture); - if (!rtex) { + if (rtex == NULL) return NULL; - } + resource = &rtex->resource; - resource->base.b = *templ; + resource->base.b = *base; resource->base.vtbl = &r600_texture_vtbl; pipe_reference_init(&resource->base.b.reference, 1); resource->base.b.screen = screen; + resource->bo = bo; + resource->domain = r600_domain_from_usage(resource->base.b.bind); + rtex->pitch_override = pitch_in_bytes_override; + rtex->array_mode = array_mode; + r600_setup_miptree(screen, rtex); - /* FIXME alignment 4096 enought ? too much ? */ - resource->domain = r600_domain_from_usage(resource->base.b.bind); resource->size = rtex->size; - resource->bo = r600_bo(radeon, rtex->size, 4096, 0); - if (resource->bo == NULL) { - FREE(rtex); - return NULL; + + if (!resource->bo) { + resource->bo = r600_bo(radeon, rtex->size, 4096, 0); + if (!resource->bo) { + FREE(rtex); + return NULL; + } } - return &resource->base.b; + return rtex; +} + +struct pipe_resource *r600_texture_create(struct pipe_screen *screen, + const struct pipe_resource *templ) +{ + unsigned array_mode = 0; + + return (struct pipe_resource *)r600_texture_create_object(screen, templ, array_mode, + 0, 0, NULL); + } static void r600_texture_destroy(struct pipe_screen *screen, @@ -231,13 +255,12 @@ static void r600_tex_surface_destroy(struct pipe_surface *surface) FREE(surface); } + struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, const struct pipe_resource *templ, struct winsys_handle *whandle) { struct radeon *rw = (struct radeon*)screen->winsys; - struct r600_resource_texture *rtex; - struct r600_resource *resource; struct r600_bo *bo = NULL; /* Support only 2D textures without mipmaps */ @@ -245,30 +268,15 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, templ->depth0 != 1 || templ->last_level != 0) return NULL; - rtex = CALLOC_STRUCT(r600_resource_texture); - if (rtex == NULL) - return NULL; - bo = r600_bo_handle(rw, whandle->handle); if (bo == NULL) { - FREE(rtex); return NULL; } - resource = &rtex->resource; - resource->base.b = *templ; - resource->base.vtbl = &r600_texture_vtbl; - pipe_reference_init(&resource->base.b.reference, 1); - resource->base.b.screen = screen; - resource->bo = bo; - rtex->depth = 0; - rtex->pitch_override = whandle->stride; - rtex->bpt = util_format_get_blocksize(templ->format); - rtex->pitch[0] = whandle->stride; - rtex->offset[0] = 0; - rtex->size = align(rtex->pitch[0] * templ->height0, 64); - - return &resource->base.b; + return (struct pipe_resource *)r600_texture_create_object(screen, templ, 0, + whandle->stride, + 0, + bo); } static unsigned int r600_texture_is_referenced(struct pipe_context *context, -- cgit v1.2.3 From fa797f12b3e1e82020eb7bc8fd0181baa7515efe Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 11:02:52 +1000 Subject: r600g: rename pitch in texture to pitch_in_bytes --- src/gallium/drivers/r600/evergreen_state.c | 12 ++++++------ src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_state.c | 10 +++++----- src/gallium/drivers/r600/r600_texture.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 4e95d4c490..54d2233467 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -451,7 +451,7 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte bo[0] = rbuffer->bo; bo[1] = rbuffer->bo; } - pitch = align(tmp->pitch[0] / tmp->bpt, 8); + pitch = align(tmp->pitch_in_bytes[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, @@ -740,8 +740,8 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state 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; + pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch_in_bytes[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) @@ -802,8 +802,8 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state 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; + pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch_in_bytes[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); @@ -815,7 +815,7 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state if (stencil_format) { uint32_t stencil_offset; - stencil_offset = ((state->zsbuf->height * rtex->pitch[level]) + 255) & ~255; + stencil_offset = ((state->zsbuf->height * rtex->pitch_in_bytes[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, diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 323960960d..04b31ddf89 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -50,7 +50,7 @@ struct r600_resource { struct r600_resource_texture { struct r600_resource resource; unsigned long offset[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long pitch[PIPE_MAX_TEXTURE_LEVELS]; + unsigned long pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS]; unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch_override; unsigned long bpt; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index b2e7c282e2..8c8e798652 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -653,7 +653,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c bo[0] = rbuffer->bo; bo[1] = rbuffer->bo; } - pitch = align(tmp->pitch[0] / tmp->bpt, 8); + pitch = align(tmp->pitch_in_bytes[0] / tmp->bpt, 8); /* FIXME properly handle first level != 0 */ r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, @@ -943,8 +943,8 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta 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; + pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch_in_bytes[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) @@ -1003,8 +1003,8 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta 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; + pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; + slice = (rtex->pitch_in_bytes[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, diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index e825aeee35..5bdfd49939 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -151,7 +151,7 @@ static void r600_setup_miptree(struct pipe_screen *screen, size = layer_size * u_minify(ptex->depth0, i); rtex->offset[i] = offset; rtex->layer_size[i] = layer_size; - rtex->pitch[i] = pitch; + rtex->pitch_in_bytes[i] = pitch; offset += size; } rtex->size = offset; @@ -340,7 +340,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, trans->transfer.sr = sr; trans->transfer.usage = usage; trans->transfer.box = *box; - trans->transfer.stride = rtex->pitch[sr.level]; + trans->transfer.stride = rtex->pitch_in_bytes[sr.level]; trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face); if (rtex->depth) { r = r600_texture_depth_flush(ctx, texture); -- cgit v1.2.3 From e3b089126c63c7178d725fbe245ca09d3f9edba1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 11:03:18 +1000 Subject: r600g: remove bpt and start using pitch_in_bytes/pixels. this mirror changes in r300g, bpt is kinda useless when it comes to some of the non-simple texture formats. --- src/gallium/drivers/r600/evergreen_state.c | 10 +++++----- src/gallium/drivers/r600/r600_resource.h | 2 +- src/gallium/drivers/r600/r600_state.c | 10 +++++----- src/gallium/drivers/r600/r600_texture.c | 10 +++++++++- 4 files changed, 20 insertions(+), 12 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 54d2233467..49a888abe3 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -451,7 +451,7 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte bo[0] = rbuffer->bo; bo[1] = rbuffer->bo; } - pitch = align(tmp->pitch_in_bytes[0] / tmp->bpt, 8); + pitch = align(tmp->pitch_in_pixels[0], 8); /* FIXME properly handle first level != 0 */ r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, @@ -740,8 +740,8 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state bo[1] = rbuffer->bo; bo[2] = rbuffer->bo; - pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; + pitch = rtex->pitch_in_pixels[level] / 8 - 1; + slice = rtex->pitch_in_pixels[level] * state->cbufs[cb]->height / 64 - 1; ntype = 0; desc = util_format_description(rtex->resource.base.b.format); if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) @@ -802,8 +802,8 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state rbuffer = &rtex->resource; level = state->zsbuf->level; - pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; + pitch = rtex->pitch_in_pixels[level] / 8 - 1; + slice = rtex->pitch_in_pixels[level] * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); stencil_format = r600_translate_stencilformat(state->zsbuf->texture->format); diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 04b31ddf89..2d7495e0fb 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -51,9 +51,9 @@ struct r600_resource_texture { struct r600_resource resource; unsigned long offset[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS]; + unsigned long pitch_in_pixels[PIPE_MAX_TEXTURE_LEVELS]; unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS]; unsigned long pitch_override; - unsigned long bpt; unsigned long size; unsigned tiled; unsigned array_mode; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 8c8e798652..7b0aaef770 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -653,7 +653,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c bo[0] = rbuffer->bo; bo[1] = rbuffer->bo; } - pitch = align(tmp->pitch_in_bytes[0] / tmp->bpt, 8); + pitch = align(tmp->pitch_in_pixels[0], 8); /* FIXME properly handle first level != 0 */ r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, @@ -943,8 +943,8 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta bo[1] = rbuffer->bo; bo[2] = rbuffer->bo; - pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1; + pitch = rtex->pitch_in_pixels[level] / 8 - 1; + slice = rtex->pitch_in_pixels[level] * state->cbufs[cb]->height / 64 - 1; ntype = 0; desc = util_format_description(rtex->resource.base.b.format); if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) @@ -1003,8 +1003,8 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta rbuffer = &rtex->resource; level = state->zsbuf->level; - pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1; - slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->zsbuf->height / 64 - 1; + pitch = rtex->pitch_in_pixels[level] / 8 - 1; + slice = rtex->pitch_in_pixels[level] * state->zsbuf->height / 64 - 1; format = r600_translate_dbformat(state->zsbuf->texture->format); r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE, diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 5bdfd49939..d1339f69e7 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -125,6 +125,14 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen, return util_format_get_nblocksy(ptex->format, height); } +/* Get a width in pixels from a stride in bytes. */ +static unsigned pitch_to_width(enum pipe_format format, + unsigned pitch_in_bytes) +{ + return (pitch_in_bytes / util_format_get_blocksize(format)) * + util_format_get_blockwidth(format); +} + static void r600_setup_miptree(struct pipe_screen *screen, struct r600_resource_texture *rtex) { @@ -134,7 +142,6 @@ static void r600_setup_miptree(struct pipe_screen *screen, unsigned long pitch, size, layer_size, i, offset; unsigned nblocksy; - rtex->bpt = util_format_get_blocksize(ptex->format); for (i = 0, offset = 0; i <= ptex->last_level; i++) { pitch = r600_texture_get_stride(screen, rtex, i); nblocksy = r600_texture_get_nblocksy(screen, rtex, i); @@ -152,6 +159,7 @@ static void r600_setup_miptree(struct pipe_screen *screen, rtex->offset[i] = offset; rtex->layer_size[i] = layer_size; rtex->pitch_in_bytes[i] = pitch; + rtex->pitch_in_pixels[i] = pitch_to_width(ptex->format, pitch); offset += size; } rtex->size = offset; -- cgit v1.2.3 From e9acf9a3bb45caea7b0fba197aa9ab01f24bb63f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 10:14:55 +1000 Subject: r600g: fix transfer stride. fixes segfaults --- src/gallium/drivers/r600/r600_texture.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index d1339f69e7..94886acc38 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -387,6 +387,9 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, FREE(trans); return NULL; } + + trans->transfer.stride = + ((struct r600_resource_texture *)trans->linear_texture)->pitch_in_bytes[0]; if (usage & PIPE_TRANSFER_READ) { /* We cannot map a tiled texture directly because the data is * in a different order, therefore we do detiling using a blit. */ -- cgit v1.2.3 From f8778eeb40daf355f8dbcfeb1a9b492c57ce6a35 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 11:08:44 +1000 Subject: r600g: drop all use of unsigned long this changes size on 32/64 bit so is definitely no what you want to use here. --- src/gallium/drivers/r600/r600_resource.h | 12 ++++++------ src/gallium/drivers/r600/r600_texture.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 2d7495e0fb..ef484aba4a 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -49,12 +49,12 @@ struct r600_resource { struct r600_resource_texture { struct r600_resource resource; - unsigned long offset[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long pitch_in_pixels[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS]; - unsigned long pitch_override; - unsigned long size; + unsigned offset[PIPE_MAX_TEXTURE_LEVELS]; + unsigned pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS]; + unsigned pitch_in_pixels[PIPE_MAX_TEXTURE_LEVELS]; + unsigned layer_size[PIPE_MAX_TEXTURE_LEVELS]; + unsigned pitch_override; + unsigned size; unsigned tiled; unsigned array_mode; unsigned tile_type; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 94886acc38..22fe8bf0f3 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -72,11 +72,11 @@ static void r600_copy_into_tiled_texture(struct pipe_context *ctx, struct r600_t ctx->flush(ctx, 0, NULL); } -static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex, +static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex, unsigned level, unsigned zslice, unsigned face) { - unsigned long offset = rtex->offset[level]; + unsigned offset = rtex->offset[level]; switch (rtex->resource.base.b.target) { case PIPE_TEXTURE_3D: @@ -139,7 +139,7 @@ static void r600_setup_miptree(struct pipe_screen *screen, struct pipe_resource *ptex = &rtex->resource.base.b; struct radeon *radeon = (struct radeon *)screen->winsys; enum chip_class chipc = r600_get_family_class(radeon); - unsigned long pitch, size, layer_size, i, offset; + unsigned pitch, size, layer_size, i, offset; unsigned nblocksy; for (i = 0, offset = 0; i <= ptex->last_level; i++) { @@ -238,7 +238,7 @@ static struct pipe_surface *r600_get_tex_surface(struct pipe_screen *screen, { struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface); - unsigned long offset; + unsigned offset; if (surface == NULL) return NULL; @@ -427,7 +427,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, struct r600_bo *bo; enum pipe_format format = transfer->resource->format; struct radeon *radeon = (struct radeon *)ctx->screen->winsys; - unsigned long offset = 0; + unsigned offset = 0; char *map; if (rtransfer->linear_texture) { -- cgit v1.2.3 From 88c1b32c62427c24ea276f20ac5ef260385a98d4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 11:17:44 +1000 Subject: r600g: use blitter for hw copy region at the moment depth copies are failing (piglit depth-level-clamp) so use the fallback for now until get some time to investigate. --- src/gallium/drivers/r600/r600_blit.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index aecc87f7da..cae05aab28 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -22,6 +22,7 @@ */ #include #include +#include #include "r600_pipe.h" enum r600_blitter_op /* bitmask */ @@ -163,6 +164,26 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, } + +/* Copy a block of pixels from one surface to another using HW. */ +static void r600_hw_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) +{ + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + + r600_blitter_begin(ctx, R600_COPY); + util_blitter_copy_region(rctx->blitter, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height, + TRUE); + r600_blitter_end(ctx); +} + static void r600_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst, struct pipe_subresource subdst, @@ -172,8 +193,16 @@ static void r600_resource_copy_region(struct pipe_context *ctx, 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); + boolean is_depth; + /* there is something wrong with depth resource copies at the moment so avoid them for now */ + is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0; + if (is_depth) + util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height); + else + r600_hw_copy_region(ctx, dst, subdst, dstx, dsty, dstz, + src, subsrc, srcx, srcy, srcz, width, height); + } void r600_init_blit_functions(struct r600_pipe_context *rctx) -- cgit v1.2.3 From 92e729bba5aab9958f5ba1339c27f6bfe743ef2e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 17:40:32 +1000 Subject: r600g: evergreen add stencil export bit --- src/gallium/drivers/r600/evergreen_state.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 49a888abe3..379d66f48c 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1558,6 +1558,11 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader R_02880C_DB_SHADER_CONTROL, S_02880C_Z_EXPORT_ENABLE(1), S_02880C_Z_EXPORT_ENABLE(1), NULL); + if (rshader->output[i].name == TGSI_SEMANTIC_STENCIL) + r600_pipe_state_add_reg(rstate, + R_02880C_DB_SHADER_CONTROL, + S_02880C_STENCIL_EXPORT_ENABLE(1), + S_02880C_STENCIL_EXPORT_ENABLE(1), NULL); } exports_ps = 0; -- cgit v1.2.3 From 6da8129b3c25be1da6d6f6a0e56b8f70b1e2f054 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 17:45:10 +1000 Subject: r600g: add missing eg reg definition --- src/gallium/drivers/r600/evergreend.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index eb36a35165..94661fdd1f 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -686,6 +686,9 @@ #define S_02880C_Z_EXPORT_ENABLE(x) (((x) & 0x1) << 0) #define G_02880C_Z_EXPORT_ENABLE(x) (((x) >> 0) & 0x1) #define C_02880C_Z_EXPORT_ENABLE 0xFFFFFFFE +#define S_02880C_STENCIL_EXPORT_ENABLE(x) (((x) & 0x2) << 0) +#define G_02880C_STENCIL_EXPORT_ENABLE(x) (((x) >> 0) & 0x2) +#define C_02880C_STENCIL_EXPORT_ENABLE 0xFFFFFFFD #define S_02880C_Z_ORDER(x) (((x) & 0x3) << 4) #define G_02880C_Z_ORDER(x) (((x) >> 4) & 0x3) #define C_02880C_Z_ORDER 0xFFFFFCFF -- cgit v1.2.3 From 40cc5bfcd70e412289dbb32a1ebca91bf109e1bd Mon Sep 17 00:00:00 2001 From: Stephan Schmid Date: Mon, 11 Oct 2010 15:49:56 +0200 Subject: r600g: fix relative addressing when splitting constant accesses Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 8930d4e183..470f355cde 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -808,6 +808,7 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV); alu.src[0].sel = r600_src[i].sel; alu.src[0].chan = k; + alu.src[0].rel = r600_src[i].rel; alu.dst.sel = treg; alu.dst.chan = k; alu.dst.write = 1; @@ -818,6 +819,7 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s return r; } r600_src[i].sel = treg; + r600_src[i].rel =0; j--; } } -- cgit v1.2.3 From ff4b397517a374ac3d4bf437f85ae6a96171a714 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Oct 2010 18:50:37 +1000 Subject: r600g: fix stencil export for evergreen harder --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/evergreend.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 379d66f48c..542df11db6 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1568,7 +1568,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader exports_ps = 0; num_cout = 0; for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION) + if (rshader->output[i].name == TGSI_SEMANTIC_POSITION || rshader->output[i].name == TGSI_SEMANTIC_STENCIL) exports_ps |= 1; else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { num_cout++; diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 94661fdd1f..5d07f532f0 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -686,8 +686,8 @@ #define S_02880C_Z_EXPORT_ENABLE(x) (((x) & 0x1) << 0) #define G_02880C_Z_EXPORT_ENABLE(x) (((x) >> 0) & 0x1) #define C_02880C_Z_EXPORT_ENABLE 0xFFFFFFFE -#define S_02880C_STENCIL_EXPORT_ENABLE(x) (((x) & 0x2) << 0) -#define G_02880C_STENCIL_EXPORT_ENABLE(x) (((x) >> 0) & 0x2) +#define S_02880C_STENCIL_EXPORT_ENABLE(x) (((x) & 0x1) << 1) +#define G_02880C_STENCIL_EXPORT_ENABLE(x) (((x) >> 1) & 0x1) #define C_02880C_STENCIL_EXPORT_ENABLE 0xFFFFFFFD #define S_02880C_Z_ORDER(x) (((x) & 0x3) << 4) #define G_02880C_Z_ORDER(x) (((x) >> 4) & 0x3) -- cgit v1.2.3 From d838e4f66d585baf3577f1298dd97d1b7c444ac2 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 13 Oct 2010 15:26:37 +0200 Subject: gallivm: only use lp_build_conv 4x4f -> 1x16 ub fastpath with sse2 This is relying on lp_build_pack2 using the sse2 pack intrinsics which handle clamping. (Alternatively could have make it use lp_build_packs2 but it might not even produce more efficient code than not using the fastpath in the first place.) --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 20aa257783..20aa93e778 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -267,7 +267,9 @@ lp_build_conv(LLVMBuilderRef builder, dst_type.sign == 0 && dst_type.norm == 1 && dst_type.width == 8 && - dst_type.length == 16) + dst_type.length == 16 && + + util_cpu_caps.has_sse2) { int i; @@ -306,23 +308,7 @@ lp_build_conv(LLVMBuilderRef builder, c = LLVMBuildFMul(builder, src[2], const_255f, ""); d = LLVMBuildFMul(builder, src[3], const_255f, ""); - /* lp_build_round generates excessively general code without - * sse2, so do rounding manually. - */ - if (!util_cpu_caps.has_sse2) { - LLVMValueRef const_half = lp_build_const_vec(src_type, 0.5f); - - a = LLVMBuildFAdd(builder, a, const_half, ""); - b = LLVMBuildFAdd(builder, b, const_half, ""); - c = LLVMBuildFAdd(builder, c, const_half, ""); - d = LLVMBuildFAdd(builder, d, const_half, ""); - - src_int0 = LLVMBuildFPToSI(builder, a, int32_vec_type, ""); - src_int1 = LLVMBuildFPToSI(builder, b, int32_vec_type, ""); - src_int2 = LLVMBuildFPToSI(builder, c, int32_vec_type, ""); - src_int3 = LLVMBuildFPToSI(builder, d, int32_vec_type, ""); - } - else { + { struct lp_build_context bld; bld.builder = builder; @@ -339,7 +325,7 @@ lp_build_conv(LLVMBuilderRef builder, src_int2 = lp_build_iround(&bld, c); src_int3 = lp_build_iround(&bld, d); } - + /* relying on clamping behavior of sse2 intrinsics here */ lo = lp_build_pack2(builder, int32_type, int16_type, src_int0, src_int1); hi = lp_build_pack2(builder, int32_type, int16_type, src_int2, src_int3); dst[i] = lp_build_pack2(builder, int16_type, dst_type, lo, hi); -- cgit v1.2.3 From e3c1c5377c7fcd17085bfb22fbc1cf30646751ba Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 12 Oct 2010 10:34:03 -0400 Subject: Get rid of GL/internal/glcore.h __GLcontextModes is always only used as an implementation internal struct at this point and we shouldn't install glcore.h anymore. Anything that needs __GLcontextModes should just include the struct in its headers files directly. --- include/GL/internal/glcore.h | 181 ------------------------ src/gallium/state_trackers/egl/x11/glcore.h | 181 ++++++++++++++++++++++++ src/gallium/state_trackers/egl/x11/glxinit.c | 2 +- src/gallium/state_trackers/egl/x11/x11_screen.h | 2 +- src/mesa/drivers/dri/common/dri_util.h | 1 - src/mesa/drivers/dri/common/drisw_util.h | 1 - src/mesa/main/context.c | 2 +- src/mesa/main/context.h | 2 +- src/mesa/main/glheader.h | 38 ++++- src/mesa/main/imports.h | 10 +- src/mesa/main/mtypes.h | 87 ++++++++++++ 11 files changed, 314 insertions(+), 193 deletions(-) delete mode 100644 include/GL/internal/glcore.h create mode 100644 src/gallium/state_trackers/egl/x11/glcore.h (limited to 'src/gallium') diff --git a/include/GL/internal/glcore.h b/include/GL/internal/glcore.h deleted file mode 100644 index 547b111370..0000000000 --- a/include/GL/internal/glcore.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef __gl_core_h_ -#define __gl_core_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, 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, 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 including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. 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. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#if !defined(_WIN32_WCE) -#include -#endif - -#define GL_CORE_SGI 1 -#define GL_CORE_MESA 2 -#define GL_CORE_APPLE 4 -#define GL_CORE_WINDOWS 8 - -typedef struct __GLcontextRec __GLcontext; - -/* -** This file defines the interface between the GL core and the surrounding -** "operating system" that supports it (currently the GLX or WGL extensions). -** -** Members (data and function pointers) are documented as imported or -** exported according to how they are used by the core rendering functions. -** Imported members are initialized by the "operating system" and used by -** the core functions. Exported members are initialized by the core functions -** and used by the "operating system". -*/ - -/** - * Mode and limit information for a context. This information is - * kept around in the context so that values can be used during - * command execution, and for returning information about the - * context to the application. - * - * Instances of this structure are shared by the driver and the loader. To - * maintain binary compatability, new fields \b must be added only to the - * end of the structure. - * - * \sa _gl_context_modes_create - */ -typedef struct __GLcontextModesRec { - struct __GLcontextModesRec * next; - - GLboolean rgbMode; - GLboolean floatMode; - GLboolean colorIndexMode; - GLuint doubleBufferMode; - GLuint stereoMode; - - GLboolean haveAccumBuffer; - GLboolean haveDepthBuffer; - GLboolean haveStencilBuffer; - - GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ - GLuint redMask, greenMask, blueMask, alphaMask; - GLint rgbBits; /* total bits for rgb */ - GLint indexBits; /* total bits for colorindex */ - - GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; - GLint depthBits; - GLint stencilBits; - - GLint numAuxBuffers; - - GLint level; - - GLint pixmapMode; - - /* GLX */ - GLint visualID; - GLint visualType; /**< One of the GLX X visual types. (i.e., - * \c GLX_TRUE_COLOR, etc.) - */ - - /* EXT_visual_rating / GLX 1.2 */ - GLint visualRating; - - /* EXT_visual_info / GLX 1.2 */ - GLint transparentPixel; - /* colors are floats scaled to ints */ - GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; - GLint transparentIndex; - - /* ARB_multisample / SGIS_multisample */ - GLint sampleBuffers; - GLint samples; - - /* SGIX_fbconfig / GLX 1.3 */ - GLint drawableType; - GLint renderType; - GLint xRenderable; - GLint fbconfigID; - - /* SGIX_pbuffer / GLX 1.3 */ - GLint maxPbufferWidth; - GLint maxPbufferHeight; - GLint maxPbufferPixels; - GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ - GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ - - /* SGIX_visual_select_group */ - GLint visualSelectGroup; - - /* OML_swap_method */ - GLint swapMethod; - - GLint screen; - - /* EXT_texture_from_pixmap */ - GLint bindToTextureRgb; - GLint bindToTextureRgba; - GLint bindToMipmapTexture; - GLint bindToTextureTargets; - GLint yInverted; -} __GLcontextModes; - -/* Several fields of __GLcontextModes can take these as values. Since - * GLX header files may not be available everywhere they need to be used, - * redefine them here. - */ -#define GLX_NONE 0x8000 -#define GLX_SLOW_CONFIG 0x8001 -#define GLX_TRUE_COLOR 0x8002 -#define GLX_DIRECT_COLOR 0x8003 -#define GLX_PSEUDO_COLOR 0x8004 -#define GLX_STATIC_COLOR 0x8005 -#define GLX_GRAY_SCALE 0x8006 -#define GLX_STATIC_GRAY 0x8007 -#define GLX_TRANSPARENT_RGB 0x8008 -#define GLX_TRANSPARENT_INDEX 0x8009 -#define GLX_NON_CONFORMANT_CONFIG 0x800D -#define GLX_SWAP_EXCHANGE_OML 0x8061 -#define GLX_SWAP_COPY_OML 0x8062 -#define GLX_SWAP_UNDEFINED_OML 0x8063 - -#define GLX_DONT_CARE 0xFFFFFFFF - -#define GLX_RGBA_BIT 0x00000001 -#define GLX_COLOR_INDEX_BIT 0x00000002 -#define GLX_WINDOW_BIT 0x00000001 -#define GLX_PIXMAP_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 - -#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 -#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 -#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 -#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 -#define GLX_Y_INVERTED_EXT 0x20D4 - -#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 -#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 -#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 - -#endif /* __gl_core_h_ */ diff --git a/src/gallium/state_trackers/egl/x11/glcore.h b/src/gallium/state_trackers/egl/x11/glcore.h new file mode 100644 index 0000000000..547b111370 --- /dev/null +++ b/src/gallium/state_trackers/egl/x11/glcore.h @@ -0,0 +1,181 @@ +#ifndef __gl_core_h_ +#define __gl_core_h_ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, 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, 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#if !defined(_WIN32_WCE) +#include +#endif + +#define GL_CORE_SGI 1 +#define GL_CORE_MESA 2 +#define GL_CORE_APPLE 4 +#define GL_CORE_WINDOWS 8 + +typedef struct __GLcontextRec __GLcontext; + +/* +** This file defines the interface between the GL core and the surrounding +** "operating system" that supports it (currently the GLX or WGL extensions). +** +** Members (data and function pointers) are documented as imported or +** exported according to how they are used by the core rendering functions. +** Imported members are initialized by the "operating system" and used by +** the core functions. Exported members are initialized by the core functions +** and used by the "operating system". +*/ + +/** + * Mode and limit information for a context. This information is + * kept around in the context so that values can be used during + * command execution, and for returning information about the + * context to the application. + * + * Instances of this structure are shared by the driver and the loader. To + * maintain binary compatability, new fields \b must be added only to the + * end of the structure. + * + * \sa _gl_context_modes_create + */ +typedef struct __GLcontextModesRec { + struct __GLcontextModesRec * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; + + /* EXT_texture_from_pixmap */ + GLint bindToTextureRgb; + GLint bindToTextureRgba; + GLint bindToMipmapTexture; + GLint bindToTextureTargets; + GLint yInverted; +} __GLcontextModes; + +/* Several fields of __GLcontextModes can take these as values. Since + * GLX header files may not be available everywhere they need to be used, + * redefine them here. + */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLX_DONT_CARE 0xFFFFFFFF + +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 + +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 + +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 + +#endif /* __gl_core_h_ */ diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c index 57c6aaff86..df8370f8d7 100644 --- a/src/gallium/state_trackers/egl/x11/glxinit.c +++ b/src/gallium/state_trackers/egl/x11/glxinit.c @@ -18,7 +18,7 @@ #include "GL/glxproto.h" #include "GL/glxtokens.h" #include "GL/gl.h" /* for GL types needed by __GLcontextModes */ -#include "GL/internal/glcore.h" /* for __GLcontextModes */ +#include "glcore.h" /* for __GLcontextModes */ #include "glxinit.h" diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.h b/src/gallium/state_trackers/egl/x11/x11_screen.h index bc0ef69ec6..2e313e0148 100644 --- a/src/gallium/state_trackers/egl/x11/x11_screen.h +++ b/src/gallium/state_trackers/egl/x11/x11_screen.h @@ -30,7 +30,7 @@ #include #include #include "GL/gl.h" /* for GL types needed by __GLcontextModes */ -#include "GL/internal/glcore.h" /* for __GLcontextModes */ +#include "glcore.h" /* for __GLcontextModes */ #include "pipe/p_compiler.h" #include "common/native.h" diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 785beacd81..9fc797b666 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -54,7 +54,6 @@ #include "xmlconfig.h" #include "main/glheader.h" #include "main/mtypes.h" -#include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" #define GLX_BAD_CONTEXT 5 diff --git a/src/mesa/drivers/dri/common/drisw_util.h b/src/mesa/drivers/dri/common/drisw_util.h index 9c3d01c99c..2444f28573 100644 --- a/src/mesa/drivers/dri/common/drisw_util.h +++ b/src/mesa/drivers/dri/common/drisw_util.h @@ -39,7 +39,6 @@ #include "main/mtypes.h" #include -#include #include typedef struct _drmLock drmLock; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 284c8b1d37..0a527040d9 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -163,7 +163,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256]; * We have to finish any pending rendering. */ void -_mesa_notifySwapBuffers(__GLcontext *ctx) +_mesa_notifySwapBuffers(GLcontext *ctx) { if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS) _mesa_debug(ctx, "SwapBuffers\n"); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index c61da62826..b130bbb066 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -157,7 +157,7 @@ extern void _mesa_init_get_hash(GLcontext *ctx); extern void -_mesa_notifySwapBuffers(__GLcontext *gc); +_mesa_notifySwapBuffers(GLcontext *gc); extern struct _glapi_table * diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 45f7b55ad2..1fe8c99f0f 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -52,7 +52,6 @@ #define GL_GLEXT_PROTOTYPES #include "GL/gl.h" #include "GL/glext.h" -#include "GL/internal/glcore.h" /** @@ -140,6 +139,41 @@ typedef void *GLeglImageOES; */ #define MESA_GEOMETRY_PROGRAM 0x8c26 - +/* Several fields of __GLcontextModes can take these as values. Since + * GLX header files may not be available everywhere they need to be used, + * redefine them here. + */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLX_DONT_CARE 0xFFFFFFFF + +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 + +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 + +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 #endif /* GLHEADER_H */ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 751f206501..a56e0af9b5 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -568,17 +568,19 @@ _mesa_str_checksum(const char *str); extern int _mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4); +struct __GLcontextRec; + extern void -_mesa_warning( __GLcontext *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); +_mesa_warning( struct __GLcontextRec *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); +_mesa_problem( const struct __GLcontextRec *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4); +_mesa_error( struct __GLcontextRec *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4); extern void -_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); +_mesa_debug( const struct __GLcontextRec *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); #if defined(_MSC_VER) && !defined(snprintf) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4851f0460c..f428922814 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -549,6 +549,93 @@ struct gl_shine_tab GLuint refcount; }; +/** + * Mode and limit information for a context. This information is + * kept around in the context so that values can be used during + * command execution, and for returning information about the + * context to the application. + * + * Instances of this structure are shared by the driver and the loader. To + * maintain binary compatability, new fields \b must be added only to the + * end of the structure. + * + * \sa _gl_context_modes_create + */ +typedef struct __GLcontextModesRec { + struct __GLcontextModesRec * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; + + /* EXT_texture_from_pixmap */ + GLint bindToTextureRgb; + GLint bindToTextureRgba; + GLint bindToMipmapTexture; + GLint bindToTextureTargets; + GLint yInverted; +} __GLcontextModes; /** * Light source state. -- cgit v1.2.3 From 705e142dda047f24b563fc2bea0f922173e91d1b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 12 Oct 2010 11:40:05 -0400 Subject: gl: Remove unused GLcontextModes fields --- src/gallium/state_trackers/glx/xlib/xm_api.c | 13 ++++++------- src/gallium/state_trackers/glx/xlib/xm_api.h | 1 + src/mesa/drivers/dri/common/dri_util.c | 3 +-- src/mesa/drivers/dri/common/utils.c | 3 --- src/mesa/drivers/x11/xm_api.c | 8 ++++---- src/mesa/drivers/x11/xmesaP.h | 1 + src/mesa/drivers/x11/xmesa_x.h | 2 +- src/mesa/main/context.c | 1 - src/mesa/main/glheader.h | 16 ---------------- src/mesa/main/mtypes.h | 21 --------------------- 10 files changed, 14 insertions(+), 55 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index f950c8858b..2edeab0d74 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -569,7 +569,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, /* RGB WINDOW: * We support RGB rendering into almost any kind of visual. */ - const int xclass = v->mesa_visual.visualType; + const int xclass = v->visualType; if (xclass != GLX_TRUE_COLOR && xclass == !GLX_DIRECT_COLOR) { _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.\n"); @@ -716,13 +716,13 @@ XMesaVisual XMesaCreateVisual( Display *display, v->mesa_visual.redMask = visinfo->red_mask; v->mesa_visual.greenMask = visinfo->green_mask; v->mesa_visual.blueMask = visinfo->blue_mask; - v->mesa_visual.visualID = visinfo->visualid; - v->mesa_visual.screen = visinfo->screen; + v->visualID = visinfo->visualid; + v->screen = visinfo->screen; #if !(defined(__cplusplus) || defined(c_plusplus)) - v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->class); + v->visualType = xmesa_convert_from_x_visual_type(visinfo->class); #else - v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->c_class); + v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class); #endif v->mesa_visual.visualRating = visualCaveat; @@ -733,7 +733,7 @@ XMesaVisual XMesaCreateVisual( Display *display, (void) initialize_visual_and_buffer( v, NULL, rgb_flag, 0, 0 ); { - const int xclass = v->mesa_visual.visualType; + const int xclass = v->visualType; if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) { red_bits = _mesa_bitcount(GET_REDMASK(v)); green_bits = _mesa_bitcount(GET_GREENMASK(v)); @@ -783,7 +783,6 @@ XMesaVisual XMesaCreateVisual( Display *display, vis->numAuxBuffers = 0; vis->level = 0; - vis->pixmapMode = 0; vis->sampleBuffers = 0; vis->samples = 0; } diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h index fedf2b2d5a..3306283296 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.h +++ b/src/gallium/state_trackers/glx/xlib/xm_api.h @@ -281,6 +281,7 @@ XMesaCopyContext(XMesaContext src, XMesaContext dst, unsigned long mask); */ struct xmesa_visual { GLvisual mesa_visual; /* Device independent visual parameters */ + int screen, visualID, visualType; Display *display; /* The X11 display */ XVisualInfo * visinfo; /* X's visual info (pointer to private copy) */ XVisualInfo *vishandle; /* Only used in fakeglx.c */ diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index d46f622d57..87b475f203 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -444,8 +444,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, pdp->driScreenPriv = psp; - if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, - renderType == GLX_PIXMAP_BIT)) { + if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, 0)) { free(pdp); return NULL; } diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 0685d2f0e6..87bf5662b0 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -620,9 +620,6 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, modes->transparentBlue = GLX_DONT_CARE; modes->transparentAlpha = GLX_DONT_CARE; modes->transparentIndex = GLX_DONT_CARE; - modes->visualType = GLX_DONT_CARE; - modes->renderType = GLX_RGBA_BIT; - modes->drawableType = GLX_WINDOW_BIT; modes->rgbMode = GL_TRUE; if ( db_modes[i] == GLX_NONE ) { diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index dac1668cfe..984caa4f0a 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1397,14 +1397,14 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, v->mesa_visual.redMask = visinfo->redMask; v->mesa_visual.greenMask = visinfo->greenMask; v->mesa_visual.blueMask = visinfo->blueMask; - v->mesa_visual.visualID = visinfo->vid; - v->mesa_visual.screen = 0; /* FIXME: What should be done here? */ + v->visualID = visinfo->vid; + v->screen = 0; /* FIXME: What should be done here? */ #else v->mesa_visual.redMask = visinfo->red_mask; v->mesa_visual.greenMask = visinfo->green_mask; v->mesa_visual.blueMask = visinfo->blue_mask; - v->mesa_visual.visualID = visinfo->visualid; - v->mesa_visual.screen = visinfo->screen; + v->visualID = visinfo->visualid; + v->screen = visinfo->screen; #endif #if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus)) diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index e0a6908228..939b7a7c50 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -86,6 +86,7 @@ enum pixel_format { struct xmesa_visual { GLvisual mesa_visual; /* Device independent visual parameters */ XMesaDisplay *display; /* The X11 display */ + int screen, visualID; #ifdef XFree86Server GLint ColormapEntries; GLint nplanes; diff --git a/src/mesa/drivers/x11/xmesa_x.h b/src/mesa/drivers/x11/xmesa_x.h index 865bab4313..ea6cb3f24e 100644 --- a/src/mesa/drivers/x11/xmesa_x.h +++ b/src/mesa/drivers/x11/xmesa_x.h @@ -79,7 +79,7 @@ typedef XColor XMesaColor; #define GET_GREENMASK(__v) __v->mesa_visual.greenMask #define GET_BLUEMASK(__v) __v->mesa_visual.blueMask #define GET_VISUAL_DEPTH(__v) __v->visinfo->depth -#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen) +#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->screen) #define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display) #define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0a527040d9..a3479f1f7d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -296,7 +296,6 @@ _mesa_initialize_visual( GLvisual *vis, vis->numAuxBuffers = 0; vis->level = 0; - vis->pixmapMode = 0; vis->sampleBuffers = numSamples > 0 ? 1 : 0; vis->samples = numSamples; diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 1fe8c99f0f..0c9013de66 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -160,20 +160,4 @@ typedef void *GLeglImageOES; #define GLX_DONT_CARE 0xFFFFFFFF -#define GLX_RGBA_BIT 0x00000001 -#define GLX_COLOR_INDEX_BIT 0x00000002 -#define GLX_WINDOW_BIT 0x00000001 -#define GLX_PIXMAP_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 - -#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 -#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 -#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 -#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 -#define GLX_Y_INVERTED_EXT 0x20D4 - -#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 -#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 -#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 - #endif /* GLHEADER_H */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f428922814..8eae64b62a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -562,8 +562,6 @@ struct gl_shine_tab * \sa _gl_context_modes_create */ typedef struct __GLcontextModesRec { - struct __GLcontextModesRec * next; - GLboolean rgbMode; GLboolean floatMode; GLboolean colorIndexMode; @@ -587,14 +585,6 @@ typedef struct __GLcontextModesRec { GLint level; - GLint pixmapMode; - - /* GLX */ - GLint visualID; - GLint visualType; /**< One of the GLX X visual types. (i.e., - * \c GLX_TRUE_COLOR, etc.) - */ - /* EXT_visual_rating / GLX 1.2 */ GLint visualRating; @@ -608,12 +598,6 @@ typedef struct __GLcontextModesRec { GLint sampleBuffers; GLint samples; - /* SGIX_fbconfig / GLX 1.3 */ - GLint drawableType; - GLint renderType; - GLint xRenderable; - GLint fbconfigID; - /* SGIX_pbuffer / GLX 1.3 */ GLint maxPbufferWidth; GLint maxPbufferHeight; @@ -621,14 +605,9 @@ typedef struct __GLcontextModesRec { GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ - /* SGIX_visual_select_group */ - GLint visualSelectGroup; - /* OML_swap_method */ GLint swapMethod; - GLint screen; - /* EXT_texture_from_pixmap */ GLint bindToTextureRgb; GLint bindToTextureRgba; -- cgit v1.2.3 From d3491e775fb07f891463b2185d74bbad62f3ed24 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 12 Oct 2010 11:58:47 -0400 Subject: Rename GLvisual and __GLcontextModes to struct gl_config --- .../state_trackers/dri/common/dri_context.c | 2 +- .../state_trackers/dri/common/dri_context.h | 2 +- .../state_trackers/dri/common/dri_drawable.c | 2 +- .../state_trackers/dri/common/dri_drawable.h | 2 +- src/gallium/state_trackers/dri/common/dri_screen.c | 2 +- src/gallium/state_trackers/dri/common/dri_screen.h | 2 +- src/gallium/state_trackers/dri/drm/dri2.c | 6 ++--- src/gallium/state_trackers/dri/sw/drisw.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.h | 2 +- src/mesa/drivers/beos/GLView.cpp | 8 +++--- src/mesa/drivers/dri/common/dri_util.c | 4 +-- src/mesa/drivers/dri/common/dri_util.h | 4 +-- src/mesa/drivers/dri/common/drisw_util.h | 4 +-- src/mesa/drivers/dri/common/utils.c | 14 +++++----- src/mesa/drivers/dri/common/utils.h | 2 +- src/mesa/drivers/dri/i810/i810context.c | 2 +- src/mesa/drivers/dri/i810/i810screen.c | 4 +-- src/mesa/drivers/dri/i810/i810screen.h | 2 +- src/mesa/drivers/dri/i810/i810span.c | 2 +- src/mesa/drivers/dri/i810/i810span.h | 2 +- src/mesa/drivers/dri/i915/i830_context.c | 2 +- src/mesa/drivers/dri/i915/i830_context.h | 2 +- src/mesa/drivers/dri/i915/i915_context.c | 2 +- src/mesa/drivers/dri/i915/i915_context.h | 2 +- src/mesa/drivers/dri/i965/brw_context.c | 2 +- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/intel/intel_context.c | 4 +-- src/mesa/drivers/dri/intel/intel_context.h | 2 +- src/mesa/drivers/dri/intel/intel_screen.c | 12 ++++----- src/mesa/drivers/dri/mach64/mach64_context.c | 2 +- src/mesa/drivers/dri/mach64/mach64_context.h | 2 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 6 ++--- src/mesa/drivers/dri/mach64/mach64_span.c | 2 +- src/mesa/drivers/dri/mach64/mach64_span.h | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 8 +++--- src/mesa/drivers/dri/mga/mgaspan.c | 2 +- src/mesa/drivers/dri/mga/mgaspan.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_context.c | 4 +-- src/mesa/drivers/dri/nouveau/nouveau_context.h | 4 +-- src/mesa/drivers/dri/nouveau/nouveau_driver.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_fbo.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_fbo.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 +- src/mesa/drivers/dri/nouveau/nv04_context.c | 2 +- src/mesa/drivers/dri/nouveau/nv10_context.c | 2 +- src/mesa/drivers/dri/nouveau/nv20_context.c | 2 +- src/mesa/drivers/dri/r128/r128_context.c | 2 +- src/mesa/drivers/dri/r128/r128_context.h | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 6 ++--- src/mesa/drivers/dri/r128/r128_span.c | 2 +- src/mesa/drivers/dri/r128/r128_span.h | 2 +- src/mesa/drivers/dri/r200/r200_context.c | 2 +- src/mesa/drivers/dri/r200/r200_context.h | 2 +- src/mesa/drivers/dri/r300/r300_context.c | 2 +- src/mesa/drivers/dri/r300/r300_context.h | 2 +- src/mesa/drivers/dri/r600/r600_context.c | 2 +- src/mesa/drivers/dri/r600/r600_context.h | 2 +- .../drivers/dri/radeon/radeon_common_context.c | 2 +- .../drivers/dri/radeon/radeon_common_context.h | 2 +- src/mesa/drivers/dri/radeon/radeon_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_context.h | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 8 +++--- src/mesa/drivers/dri/savage/savage_xmesa.c | 8 +++--- src/mesa/drivers/dri/savage/savagespan.c | 2 +- src/mesa/drivers/dri/savage/savagespan.h | 2 +- src/mesa/drivers/dri/sis/sis_context.c | 2 +- src/mesa/drivers/dri/sis/sis_context.h | 2 +- src/mesa/drivers/dri/sis/sis_screen.c | 4 +-- src/mesa/drivers/dri/sis/sis_span.c | 2 +- src/mesa/drivers/dri/sis/sis_span.h | 2 +- src/mesa/drivers/dri/swrast/swrast.c | 8 +++--- src/mesa/drivers/dri/tdfx/tdfx_context.c | 2 +- src/mesa/drivers/dri/tdfx/tdfx_context.h | 2 +- src/mesa/drivers/dri/tdfx/tdfx_dd.c | 2 +- src/mesa/drivers/dri/tdfx/tdfx_dd.h | 2 +- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 4 +-- src/mesa/drivers/dri/tdfx/tdfx_span.c | 2 +- src/mesa/drivers/dri/tdfx/tdfx_span.h | 2 +- src/mesa/drivers/dri/unichrome/via_context.c | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 4 +-- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- src/mesa/drivers/dri/unichrome/via_span.c | 2 +- src/mesa/drivers/dri/unichrome/via_span.h | 2 +- src/mesa/drivers/fbdev/glfbdev.c | 4 +-- src/mesa/drivers/osmesa/osmesa.c | 2 +- src/mesa/drivers/windows/gdi/wmesa.c | 6 ++--- src/mesa/drivers/windows/gldirect/dglcontext.h | 4 +-- src/mesa/drivers/x11/xm_buffer.c | 2 +- src/mesa/drivers/x11/xmesaP.h | 6 ++--- src/mesa/main/context.c | 30 +++++++++++----------- src/mesa/main/context.h | 18 ++++++------- src/mesa/main/framebuffer.c | 4 +-- src/mesa/main/framebuffer.h | 4 +-- src/mesa/main/glheader.h | 2 +- src/mesa/main/mtypes.h | 21 +++------------ src/mesa/state_tracker/st_context.c | 2 +- src/mesa/state_tracker/st_context.h | 2 +- src/mesa/state_tracker/st_manager.c | 8 +++--- 99 files changed, 177 insertions(+), 190 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index 22e1b6dd70..770b37037f 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -49,7 +49,7 @@ dri_init_extensions(struct dri_context *ctx) } GLboolean -dri_create_context(gl_api api, const __GLcontextModes * visual, +dri_create_context(gl_api api, const struct gl_config * visual, __DRIcontext * cPriv, void *sharedContextPrivate) { __DRIscreen *sPriv = cPriv->driScreenPriv; diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h index beb59c6f68..35105e861f 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.h +++ b/src/gallium/state_trackers/dri/common/dri_context.h @@ -88,7 +88,7 @@ dri_get_current(__DRIscreen * driScreenPriv); boolean dri_create_context(gl_api api, - const __GLcontextModes * visual, + const struct gl_config * visual, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index 1bdfdccf43..5fd6e7863c 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -112,7 +112,7 @@ dri_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, boolean dri_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const __GLcontextModes * visual, boolean isPixmap) + const struct gl_config * visual, boolean isPixmap) { struct dri_screen *screen = sPriv->private; struct dri_drawable *drawable = NULL; diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h index 74e662d36c..837d398374 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.h +++ b/src/gallium/state_trackers/dri/common/dri_drawable.h @@ -79,7 +79,7 @@ dri_drawable(__DRIdrawable * driDrawPriv) boolean dri_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const __GLcontextModes * visual, boolean isPixmap); + const struct gl_config * visual, boolean isPixmap); void dri_destroy_buffer(__DRIdrawable * dPriv); diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index b3b09b605f..252ad1768d 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -227,7 +227,7 @@ dri_fill_in_modes(struct dri_screen *screen, */ void dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, - const __GLcontextModes *mode) + const struct gl_config *mode) { memset(stvis, 0, sizeof(*stvis)); diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index d4eb8f454f..0da9b5510f 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -114,7 +114,7 @@ dri_with_format(__DRIscreen * sPriv) void dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, - const __GLcontextModes *mode); + const struct gl_config *mode); const __DRIconfig ** dri_init_screen_helper(struct dri_screen *screen, diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 116afccb19..3c5b075617 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -502,7 +502,7 @@ static const __DRIextension *dri_screen_extensions[] = { /** * This is the driver specific part of the createNewScreen entry point. * - * Returns the __GLcontextModes supported by this driver. + * Returns the struct gl_config supported by this driver. */ static const __DRIconfig ** dri2_init_screen(__DRIscreen * sPriv) @@ -548,7 +548,7 @@ fail: } static boolean -dri2_create_context(gl_api api, const __GLcontextModes * visual, +dri2_create_context(gl_api api, const struct gl_config * visual, __DRIcontext * cPriv, void *sharedContextPrivate) { struct dri_context *ctx = NULL; @@ -564,7 +564,7 @@ dri2_create_context(gl_api api, const __GLcontextModes * visual, static boolean dri2_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const __GLcontextModes * visual, boolean isPixmap) + const struct gl_config * visual, boolean isPixmap) { struct dri_drawable *drawable = NULL; diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 04bba631ae..c48cc44036 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -298,7 +298,7 @@ fail: static boolean drisw_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const __GLcontextModes * visual, boolean isPixmap) + const struct gl_config * visual, boolean isPixmap) { struct dri_drawable *drawable = NULL; diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 2edeab0d74..6ce386008a 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -756,7 +756,7 @@ XMesaVisual XMesaCreateVisual( Display *display, /* initialize visual */ { - __GLcontextModes *vis = &v->mesa_visual; + struct gl_config *vis = &v->mesa_visual; vis->rgbMode = GL_TRUE; vis->doubleBufferMode = db_flag; diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h index 3306283296..b8ac979edc 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.h +++ b/src/gallium/state_trackers/glx/xlib/xm_api.h @@ -280,7 +280,7 @@ XMesaCopyContext(XMesaContext src, XMesaContext dst, unsigned long mask); * Basically corresponds to an XVisualInfo. */ struct xmesa_visual { - GLvisual mesa_visual; /* Device independent visual parameters */ + struct gl_config mesa_visual;/* Device independent visual parameters */ int screen, visualID, visualType; Display *display; /* The X11 display */ XVisualInfo * visinfo; /* X's visual info (pointer to private copy) */ diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp index a029f6b200..44082e47cf 100644 --- a/src/mesa/drivers/beos/GLView.cpp +++ b/src/mesa/drivers/beos/GLView.cpp @@ -105,7 +105,7 @@ public: MesaDriver(); ~MesaDriver(); - void Init(BGLView * bglview, GLcontext * c, GLvisual * v, GLframebuffer * b); + void Init(BGLView * bglview, GLcontext * c, struct gl_config * v, GLframebuffer * b); void LockGL(); void UnlockGL(); @@ -121,7 +121,7 @@ private: MesaDriver &operator=(const MesaDriver &rhs); // assignment oper. illegal GLcontext * m_glcontext; - GLvisual * m_glvisual; + struct gl_config * m_glvisual; GLframebuffer * m_glframebuffer; BGLView * m_bglview; @@ -297,7 +297,7 @@ BGLView::BGLView(BRect rect, char *name, MesaDriver * md = new MesaDriver(); // examine option flags and create gl_context struct - GLvisual * visual = _mesa_create_visual( dblFlag, + struct gl_config * visual = _mesa_create_visual( dblFlag, stereoFlag, red, green, blue, alpha, depth, @@ -668,7 +668,7 @@ MesaDriver::~MesaDriver() } -void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, GLvisual * visual, GLframebuffer * framebuffer) +void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, struct gl_config * visual, GLframebuffer * framebuffer) { m_bglview = bglview; m_glcontext = ctx; diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 87b475f203..a5b71bd40a 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -634,7 +634,7 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api, __DRIcontext *shared, void *data) { __DRIcontext *context; - const __GLcontextModes *modes = (config != NULL) ? &config->modes : NULL; + const struct gl_config *modes = (config != NULL) ? &config->modes : NULL; void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; gl_api mesa_api; @@ -754,7 +754,7 @@ setupLoaderExtensions(__DRIscreen *psp, * This is the bootstrap function for the driver. libGL supplies all of the * requisite information about the system, and the driver initializes itself. * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or + * with the \c struct gl_config that the driver can support for windows or * pbuffers. * * For legacy DRI. diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 9fc797b666..ffffb99b30 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -148,7 +148,7 @@ struct __DriverAPIRec { * Context creation callback */ GLboolean (*CreateContext)(gl_api api, - const __GLcontextModes *glVis, + const struct gl_config *glVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); @@ -162,7 +162,7 @@ struct __DriverAPIRec { */ GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *glVis, + const struct gl_config *glVis, GLboolean pixmapBuffer); /** diff --git a/src/mesa/drivers/dri/common/drisw_util.h b/src/mesa/drivers/dri/common/drisw_util.h index 2444f28573..d43f5235aa 100644 --- a/src/mesa/drivers/dri/common/drisw_util.h +++ b/src/mesa/drivers/dri/common/drisw_util.h @@ -59,7 +59,7 @@ struct __DriverAPIRec { void (*DestroyScreen)(__DRIscreen *driScrnPriv); GLboolean (*CreateContext)(gl_api glapi, - const __GLcontextModes *glVis, + const struct gl_config *glVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); @@ -67,7 +67,7 @@ struct __DriverAPIRec { GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *glVis, + const struct gl_config *glVis, GLboolean pixmapBuffer); void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 87bf5662b0..3cc496c671 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -371,14 +371,14 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, } /** - * Creates a set of \c __GLcontextModes that a driver will expose. + * Creates a set of \c struct gl_config that a driver will expose. * - * A set of \c __GLcontextModes will be created based on the supplied + * A set of \c struct gl_config will be created based on the supplied * parameters. The number of modes processed will be 2 * * \c num_depth_stencil_bits * \c num_db_modes. * * For the most part, data is just copied from \c depth_bits, \c stencil_bits, - * \c db_modes, and \c visType into each \c __GLcontextModes element. + * \c db_modes, and \c visType into each \c struct gl_config element. * However, the meanings of \c fb_format and \c fb_type require further * explanation. The \c fb_format specifies which color components are in * each pixel and what the default order is. For example, \c GL_RGB specifies @@ -391,7 +391,7 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the - * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or + * \c struct gl_config structure is \b identical to the \c GL_RGBA or * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8 * still uses 32-bits. @@ -399,7 +399,7 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * If in doubt, look at the tables used in the function. * * \param ptr_to_modes Pointer to a pointer to a linked list of - * \c __GLcontextModes. Upon completion, a pointer to + * \c struct gl_config. Upon completion, a pointer to * the next element to be process will be stored here. * If the function fails and returns \c GL_FALSE, this * value will be unmodified, but some elements in the @@ -505,7 +505,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const uint32_t * masks; int index; __DRIconfig **configs, **c; - __GLcontextModes *modes; + struct gl_config *modes; unsigned i, j, k, h; unsigned num_modes; unsigned num_accum_bits = (enable_accum) ? 2 : 1; @@ -685,7 +685,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a, } #define __ATTRIB(attrib, field) \ - { attrib, offsetof(__GLcontextModes, field) } + { attrib, offsetof(struct gl_config, field) } static const struct { unsigned int attrib, offset; } attribMap[] = { __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index de6070c398..01930d784e 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -99,7 +99,7 @@ extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, GLsizei *width, GLsizei *height ); struct __DRIconfigRec { - __GLcontextModes modes; + struct gl_config modes; }; extern __DRIconfig ** diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 8f52c20c2d..aaa97f017a 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -166,7 +166,7 @@ static const struct dri_debug_control debug_control[] = GLboolean i810CreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 56708c97cb..098d027771 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -55,7 +55,7 @@ i810FillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; unsigned i; @@ -272,7 +272,7 @@ i810DestroyScreen(__DRIscreen *sPriv) static GLboolean i810CreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { i810ScreenPrivate *screen = (i810ScreenPrivate *) driScrnPriv->private; diff --git a/src/mesa/drivers/dri/i810/i810screen.h b/src/mesa/drivers/dri/i810/i810screen.h index fe6db7e6e1..25c1072ce0 100644 --- a/src/mesa/drivers/dri/i810/i810screen.h +++ b/src/mesa/drivers/dri/i810/i810screen.h @@ -79,7 +79,7 @@ typedef struct { extern GLboolean i810CreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c index 6576f6745e..b4cae4e4e0 100644 --- a/src/mesa/drivers/dri/i810/i810span.c +++ b/src/mesa/drivers/dri/i810/i810span.c @@ -109,7 +109,7 @@ void i810InitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +i810SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.InternalFormat == GL_RGBA) { /* always 565 RGB */ diff --git a/src/mesa/drivers/dri/i810/i810span.h b/src/mesa/drivers/dri/i810/i810span.h index 9aed253bd5..c01a2f94ae 100644 --- a/src/mesa/drivers/dri/i810/i810span.h +++ b/src/mesa/drivers/dri/i810/i810span.h @@ -9,6 +9,6 @@ extern void i810SpanRenderFinish( GLcontext *ctx ); extern void i810SpanRenderStart( GLcontext *ctx ); extern void -i810SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +i810SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 8ddce6d82a..7783de964f 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -48,7 +48,7 @@ i830InitDriverFunctions(struct dd_function_table *functions) extern const struct tnl_pipeline_stage *intel_pipeline[]; GLboolean -i830CreateContext(const __GLcontextModes * mesaVis, +i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/i915/i830_context.h b/src/mesa/drivers/dri/i915/i830_context.h index 2100ffe6d9..87cfa8ff0b 100644 --- a/src/mesa/drivers/dri/i915/i830_context.h +++ b/src/mesa/drivers/dri/i915/i830_context.h @@ -178,7 +178,7 @@ i830_state_draw_region(struct intel_context *intel, /* i830_context.c */ extern GLboolean -i830CreateContext(const __GLcontextModes * mesaVis, +i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 412714ada8..6688bd8536 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -94,7 +94,7 @@ extern const struct tnl_pipeline_stage *intel_pipeline[]; GLboolean i915CreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index 33dad9a195..5f3adb3db7 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -320,7 +320,7 @@ do { \ * i915_context.c */ extern GLboolean i915CreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index fa82dfda8f..d59ba0e5e8 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -57,7 +57,7 @@ static void brwInitDriverFunctions( struct dd_function_table *functions ) } GLboolean brwCreateContext( int api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 71e6d8ef89..700d201f49 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -719,7 +719,7 @@ void brwInitVtbl( struct brw_context *brw ); * brw_context.c */ GLboolean brwCreateContext( int api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 039ac6d4c1..c3b5148fe7 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -616,7 +616,7 @@ intelInitDriverFunctions(struct dd_function_table *functions) GLboolean intelInitContext(struct intel_context *intel, int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, struct dd_function_table *functions) @@ -626,7 +626,7 @@ intelInitContext(struct intel_context *intel, __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct intel_screen *intelScreen = sPriv->private; int bo_reuse_mode; - __GLcontextModes visual; + struct gl_config visual; /* we can't do anything without a connection to the device */ if (intelScreen->bufmgr == NULL) diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 28d53284fd..e94ba94df2 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -383,7 +383,7 @@ extern int INTEL_DEBUG; extern GLboolean intelInitContext(struct intel_context *intel, int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index d200dc1f4a..061f0d278d 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -339,7 +339,7 @@ intelDestroyScreen(__DRIscreen * sPriv) static GLboolean intelCreateBuffer(__DRIscreen * driScrnPriv, __DRIdrawable * driDrawPriv, - const __GLcontextModes * mesaVis, GLboolean isPixmap) + const struct gl_config * mesaVis, GLboolean isPixmap) { struct intel_renderbuffer *rb; @@ -415,22 +415,22 @@ intelDestroyBuffer(__DRIdrawable * driDrawPriv) * init-designated function to register chipids and createcontext * functions. */ -extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis, +extern GLboolean i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); extern GLboolean i915CreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); extern GLboolean brwCreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); static GLboolean intelCreateContext(gl_api api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { @@ -488,7 +488,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen) * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **intelInitScreen2(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index a20a1c9655..9d89cb8a48 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -86,7 +86,7 @@ static const struct dri_extension card_extensions[] = /* Create the device specific context. */ GLboolean mach64CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index 893fc8daee..3d7943db01 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -274,7 +274,7 @@ struct mach64_context { extern GLboolean mach64CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 239e8bc8fd..762ffe5e43 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -71,7 +71,7 @@ mach64FillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; GLenum fb_format; GLenum fb_type; unsigned depth_buffer_factor; @@ -298,7 +298,7 @@ mach64DestroyScreen( __DRIscreen *driScreen ) static GLboolean mach64CreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { mach64ScreenPtr screen = (mach64ScreenPtr) driScrnPriv->private; @@ -414,7 +414,7 @@ mach64InitDriver( __DRIscreen *driScreen ) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** mach64InitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c index 0c52c0c88c..aff938debf 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.c +++ b/src/mesa/drivers/dri/mach64/mach64_span.c @@ -154,7 +154,7 @@ void mach64DDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +mach64SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.Format == MESA_FORMAT_RGB565) { mach64InitPointers_RGB565(&drb->Base); diff --git a/src/mesa/drivers/dri/mach64/mach64_span.h b/src/mesa/drivers/dri/mach64/mach64_span.h index 65141d05c3..c0120ce9b0 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.h +++ b/src/mesa/drivers/dri/mach64/mach64_span.h @@ -36,6 +36,6 @@ extern void mach64DDInitSpanFuncs( GLcontext *ctx ); extern void -mach64SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +mach64SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 13f73a83e9..6daeb6a6bf 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -110,7 +110,7 @@ mgaFillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -421,7 +421,7 @@ static const struct dri_debug_control debug_control[] = static GLboolean mgaCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { @@ -695,7 +695,7 @@ mgaDestroyContext(__DRIcontext *driContextPriv) static GLboolean mgaCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private; @@ -925,7 +925,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) { diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 10606c152c..1f2fb0c39a 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -204,7 +204,7 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +mgaSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.Format == MESA_FORMAT_RGB565) { mgaInitPointers_565(&drb->Base); diff --git a/src/mesa/drivers/dri/mga/mgaspan.h b/src/mesa/drivers/dri/mga/mgaspan.h index f5e2e49b8a..a35a9b8479 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.h +++ b/src/mesa/drivers/dri/mga/mgaspan.h @@ -33,7 +33,7 @@ extern void mgaDDInitSpanFuncs( GLcontext *ctx ); extern void -mgaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +mgaSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 1c7f600d2b..fed0b7a34f 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -77,7 +77,7 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan) GLboolean nouveau_context_create(gl_api api, - const __GLcontextModes *visual, __DRIcontext *dri_ctx, + const struct gl_config *visual, __DRIcontext *dri_ctx, void *share_ctx) { __DRIscreen *dri_screen = dri_ctx->driScreenPriv; @@ -98,7 +98,7 @@ nouveau_context_create(gl_api api, GLboolean nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, - const GLvisual *visual, GLcontext *share_ctx) + const struct gl_config *visual, GLcontext *share_ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct dd_function_table functions; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 5f00327119..8cbfefe85a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -95,12 +95,12 @@ struct nouveau_context { GLboolean nouveau_context_create(gl_api api, - const __GLcontextModes *visual, __DRIcontext *dri_ctx, + const struct gl_config *visual, __DRIcontext *dri_ctx, void *share_ctx); GLboolean nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, - const GLvisual *visual, GLcontext *share_ctx); + const struct gl_config *visual, GLcontext *share_ctx); void nouveau_context_deinit(GLcontext *ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h index 283f6eac2c..fa2bc7abd1 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h @@ -52,7 +52,7 @@ struct nouveau_driver { GLcontext *(*context_create)(struct nouveau_screen *screen, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_ctx); void (*context_destroy)(GLcontext *ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index f0caf4c629..397d4ad1eb 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -180,7 +180,7 @@ nouveau_framebuffer_new(GLcontext *ctx, GLuint name) } struct gl_framebuffer * -nouveau_framebuffer_dri_new(const GLvisual *visual) +nouveau_framebuffer_dri_new(const struct gl_config *visual) { struct nouveau_framebuffer *nfb; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h index 05ea03a075..b1d5d8da45 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h @@ -45,7 +45,7 @@ struct nouveau_renderbuffer { #define to_nouveau_renderbuffer(x) ((struct nouveau_renderbuffer *)(x)) struct gl_framebuffer * -nouveau_framebuffer_dri_new(const GLvisual *visual); +nouveau_framebuffer_dri_new(const struct gl_config *visual); struct gl_renderbuffer * nouveau_renderbuffer_dri_new(GLenum format, __DRIdrawable *drawable); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 4330c8d947..a6e2186cf4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -153,7 +153,7 @@ nouveau_destroy_screen(__DRIscreen *dri_screen) static GLboolean nouveau_create_buffer(__DRIscreen *dri_screen, __DRIdrawable *drawable, - const __GLcontextModes *visual, + const struct gl_config *visual, GLboolean is_pixmap) { struct gl_renderbuffer *rb; diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 94422f559d..9906cac07a 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -167,7 +167,7 @@ nv04_context_destroy(GLcontext *ctx) } static GLcontext * -nv04_context_create(struct nouveau_screen *screen, const GLvisual *visual, +nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual, GLcontext *share_ctx) { struct nv04_context *nctx; diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 3d898fd94d..04b0fc37a8 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -416,7 +416,7 @@ nv10_context_destroy(GLcontext *ctx) } static GLcontext * -nv10_context_create(struct nouveau_screen *screen, const GLvisual *visual, +nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual, GLcontext *share_ctx) { struct nouveau_context *nctx; diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index b9c221e716..bc424f8b28 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_context.c +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c @@ -385,7 +385,7 @@ nv20_context_destroy(GLcontext *ctx) } static GLcontext * -nv20_context_create(struct nouveau_screen *screen, const GLvisual *visual, +nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visual, GLcontext *share_ctx) { struct nouveau_context *nctx; diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index b917e0e0dc..bc25d7e8ca 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -99,7 +99,7 @@ static const struct dri_debug_control debug_control[] = /* Create the device specific context. */ GLboolean r128CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 65ddb3bd23..e9ff2fe9de 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -225,7 +225,7 @@ struct r128_context { extern GLboolean r128CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 7626a159d6..29a4f74156 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -262,7 +262,7 @@ r128DestroyScreen( __DRIscreen *sPriv ) static GLboolean r128CreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { r128ScreenPtr screen = (r128ScreenPtr) driScrnPriv->private; @@ -400,7 +400,7 @@ r128FillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -473,7 +473,7 @@ r128FillInModes( __DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** r128InitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c index 2fbe93c590..d9d109c17e 100644 --- a/src/mesa/drivers/dri/r128/r128_span.c +++ b/src/mesa/drivers/dri/r128/r128_span.c @@ -429,7 +429,7 @@ void r128DDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +r128SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.Format == MESA_FORMAT_RGB565) { r128InitPointers_RGB565(&drb->Base); diff --git a/src/mesa/drivers/dri/r128/r128_span.h b/src/mesa/drivers/dri/r128/r128_span.h index 9af4058129..259810ee79 100644 --- a/src/mesa/drivers/dri/r128/r128_span.h +++ b/src/mesa/drivers/dri/r128/r128_span.h @@ -40,6 +40,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r128DDInitSpanFuncs( GLcontext *ctx ); extern void -r128SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +r128SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 3b85e84d90..2a35e2d6e4 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -271,7 +271,7 @@ static void r200_init_vtbl(radeonContextPtr radeon) /* Create the device specific rendering context. */ GLboolean r200CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 305958f5d7..657902fcaa 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -638,7 +638,7 @@ struct r200_context { extern void r200DestroyContext( __DRIcontext *driContextPriv ); extern GLboolean r200CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate); extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv, diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index ef495aabb9..f3f1a59e6a 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -477,7 +477,7 @@ static void r300InitIoctlFuncs(struct dd_function_table *functions) /* Create the device specific rendering context. */ GLboolean r300CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 99540e3354..90933e0af6 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -544,7 +544,7 @@ struct r300_context { extern void r300DestroyContext(__DRIcontext * driContextPriv); extern GLboolean r300CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index cd34e6208d..103f33d39e 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -380,7 +380,7 @@ static void r600InitGLExtensions(GLcontext *ctx) /* Create the device specific rendering context. */ GLboolean r600CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 6a83196648..1954d3429a 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -193,7 +193,7 @@ struct r600_context { #define GET_EVERGREEN_CHIP(context) ((EVERGREEN_CHIP_CONTEXT*)(context->pChip)) extern GLboolean r600CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 8804b9ce0f..68aacd7f16 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -180,7 +180,7 @@ static void radeonInitDriverFuncs(struct dd_function_table *functions) */ GLboolean radeonInitContext(radeonContextPtr radeon, struct dd_function_table* functions, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 024e31f8ec..5c3299f597 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -611,7 +611,7 @@ static INLINE uint32_t radeonPackFloat24(float f) GLboolean radeonInitContext(radeonContextPtr radeon, struct dd_function_table* functions, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 0b92c51466..c0b9a222c4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -206,7 +206,7 @@ static void r100_init_vtbl(radeonContextPtr radeon) */ GLboolean r100CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index c4bfbfdaeb..de71aa2c6d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -451,7 +451,7 @@ struct r100_context { #define RADEON_OLD_PACKETS 1 extern GLboolean r100CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 2ea77e56c7..f5b55ad970 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -258,7 +258,7 @@ radeonFillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes *m; + struct gl_config *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; int i; @@ -1583,7 +1583,7 @@ radeonInitDriver( __DRIscreen *sPriv ) static GLboolean radeonCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private; @@ -1700,7 +1700,7 @@ radeonDestroyBuffer(__DRIdrawable *driDrawPriv) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** radeonInitScreen(__DRIscreen *psp) @@ -1750,7 +1750,7 @@ radeonInitScreen(__DRIscreen *psp) * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **radeonInitScreen2(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 45c1e56fe0..ab05fc8eb1 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -287,7 +287,7 @@ savageDestroyScreen(__DRIscreen *sPriv) static GLboolean savageCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { @@ -586,7 +586,7 @@ savageDestroyContext(__DRIcontext *driContextPriv) static GLboolean savageCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap) { savageScreenPrivate *screen = (savageScreenPrivate *) driScrnPriv->private; @@ -892,7 +892,7 @@ savageFillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -968,7 +968,7 @@ savageFillInModes( __DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** savageInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c index 0913dd1278..735aac50fd 100644 --- a/src/mesa/drivers/dri/savage/savagespan.c +++ b/src/mesa/drivers/dri/savage/savagespan.c @@ -251,7 +251,7 @@ void savageDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis, +savageSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis, GLboolean float_depth) { if (drb->Base.Format == MESA_FORMAT_RGB565) { diff --git a/src/mesa/drivers/dri/savage/savagespan.h b/src/mesa/drivers/dri/savage/savagespan.h index 53a7f8b97c..00094e255e 100644 --- a/src/mesa/drivers/dri/savage/savagespan.h +++ b/src/mesa/drivers/dri/savage/savagespan.h @@ -31,7 +31,7 @@ extern void savageDDInitSpanFuncs( GLcontext *ctx ); extern void -savageSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis, +savageSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis, GLboolean float_depth); diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index 85f26a08b7..f460e89a56 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -159,7 +159,7 @@ void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLboolean sisCreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 132cee33ee..2ccfe1b54b 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -439,7 +439,7 @@ enum _sis_verbose { }; extern GLboolean sisCreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ); extern void sisDestroyContext( __DRIcontext * ); diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 80fb455ec7..1ce52a2d67 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -193,7 +193,7 @@ sisDestroyScreen( __DRIscreen *sPriv ) static GLboolean sisCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { /*sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private;*/ @@ -280,7 +280,7 @@ sisSwapBuffers(__DRIdrawable *dPriv) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** sisInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c index 008b00160e..ba7f6d0932 100644 --- a/src/mesa/drivers/dri/sis/sis_span.c +++ b/src/mesa/drivers/dri/sis/sis_span.c @@ -174,7 +174,7 @@ sisDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis) +sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis) { if (srb->Base.Format == MESA_FORMAT_RGB565) { sisInitPointers_RGB565( &srb->Base ); diff --git a/src/mesa/drivers/dri/sis/sis_span.h b/src/mesa/drivers/dri/sis/sis_span.h index a1f817c44c..eca72027d5 100644 --- a/src/mesa/drivers/dri/sis/sis_span.h +++ b/src/mesa/drivers/dri/sis/sis_span.h @@ -40,6 +40,6 @@ extern void sisSpanRenderFinish( GLcontext *ctx ); extern void sisDDInitSpanFuncs( GLcontext *ctx ); extern void -sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis); +sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index ff53ffd0de..8585250eb0 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -225,7 +225,7 @@ dri_destroy_screen(__DRIscreen * sPriv) */ static GLuint -choose_pixel_format(const GLvisual *v) +choose_pixel_format(const struct gl_config *v) { int depth = v->rgbBits; @@ -307,7 +307,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, } static struct swrast_renderbuffer * -swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) +swrast_new_renderbuffer(const struct gl_config *visual, GLboolean front) { struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb); GLuint pixel_format; @@ -370,7 +370,7 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) static GLboolean dri_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const __GLcontextModes * visual, GLboolean isPixmap) + const struct gl_config * visual, GLboolean isPixmap) { struct dri_drawable *drawable = NULL; GLframebuffer *fb; @@ -570,7 +570,7 @@ swrast_init_driver_functions(struct dd_function_table *driver) static GLboolean dri_create_context(gl_api api, - const __GLcontextModes * visual, + const struct gl_config * visual, __DRIcontext * cPriv, void *sharedContextPrivate) { struct dri_context *ctx = NULL; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 6f1e8bfc49..18c626c454 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -163,7 +163,7 @@ static const struct dri_debug_control debug_control[] = }; GLboolean tdfxCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.h b/src/mesa/drivers/dri/tdfx/tdfx_context.h index 29b0876f9f..2b2807903b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.h @@ -938,7 +938,7 @@ struct tdfx_context { extern GLboolean tdfxCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/src/mesa/drivers/dri/tdfx/tdfx_dd.c index 2cbbeb8114..101b6da687 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.c @@ -157,7 +157,7 @@ tdfxEndQuery(GLcontext *ctx, struct gl_query_object *q) (vis->blueBits == b) && \ (vis->alphaBits == a)) -void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, +void tdfxDDInitDriverFuncs( const struct gl_config *visual, struct dd_function_table *functions ) { if ( MESA_VERBOSE & VERBOSE_DRIVER ) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.h b/src/mesa/drivers/dri/tdfx/tdfx_dd.h index f419c8426a..d68e1ece1b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.h @@ -38,7 +38,7 @@ #include "main/context.h" -extern void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, +extern void tdfxDDInitDriverFuncs( const struct gl_config *visual, struct dd_function_table *functions ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 26de09503a..c9ca4fc637 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -155,7 +155,7 @@ tdfxInitDriver( __DRIscreen *sPriv ) static GLboolean tdfxCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { tdfxScreenPrivate *screen = (tdfxScreenPrivate *) driScrnPriv->private; @@ -394,7 +394,7 @@ tdfxFillInModes(__DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** tdfxInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c index 3879d506ee..5af4a4602e 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c @@ -1348,7 +1348,7 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +tdfxSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.InternalFormat == GL_RGBA) { if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.h b/src/mesa/drivers/dri/tdfx/tdfx_span.h index 6973f8d140..cd39191959 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.h @@ -43,6 +43,6 @@ extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); extern void -tdfxSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +tdfxSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 4298c94855..3305e934a5 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -457,7 +457,7 @@ FreeBuffer(struct via_context *vmesa) GLboolean viaCreateContext(gl_api api, - const __GLcontextModes *visual, + const struct gl_config *visual, __DRIcontext *driContextPriv, void *sharedContextPrivate) { diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 4b3e9d5a38..e6aa7b6b83 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -200,7 +200,7 @@ viaDestroyScreen(__DRIscreen *sPriv) static GLboolean viaCreateBuffer(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap) { #if 0 @@ -369,7 +369,7 @@ viaFillInModes( __DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** viaInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 51df0ce4eb..292646dabd 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -77,7 +77,7 @@ typedef struct { extern GLboolean viaCreateContext(gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index fa3cbf7a79..31f794ffc8 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -176,7 +176,7 @@ void viaInitSpanFuncs(GLcontext *ctx) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis) +viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis) { if (vrb->Base.Format == MESA_FORMAT_RGB565) { viaInitPointers_565(&vrb->Base); diff --git a/src/mesa/drivers/dri/unichrome/via_span.h b/src/mesa/drivers/dri/unichrome/via_span.h index 3dca0d5661..8830075bff 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.h +++ b/src/mesa/drivers/dri/unichrome/via_span.h @@ -30,6 +30,6 @@ extern void viaSpanRenderStart( GLcontext *ctx ); extern void viaSpanRenderFinish( GLcontext *ctx ); extern void -viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis); +viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index 2ad52d89fc..b3bb71525e 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -73,10 +73,10 @@ /** - * Derived from Mesa's GLvisual class. + * Derived from Mesa's struct gl_config class. */ struct GLFBDevVisualRec { - GLvisual glvisual; /* base class */ + struct gl_config glvisual; /* base class */ struct fb_fix_screeninfo fix; struct fb_var_screeninfo var; int pixelFormat; diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 93d0e8568a..a04dc6d8a9 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -62,7 +62,7 @@ struct osmesa_context { GLcontext mesa; /*< Base class - this must be first */ - GLvisual *gl_visual; /*< Describes the buffers */ + struct gl_config *gl_visual; /*< Describes the buffers */ struct gl_renderbuffer *rb; /*< The user's colorbuffer */ GLframebuffer *gl_buffer; /*< The framebuffer, containing user's rb */ GLenum format; /*< User-specified context format */ diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 22b0c46b4f..1a71ef4559 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -30,7 +30,7 @@ static WMesaFramebuffer FirstFramebuffer = NULL; * given HDC (Window handle). */ WMesaFramebuffer -wmesa_new_framebuffer(HDC hdc, GLvisual *visual) +wmesa_new_framebuffer(HDC hdc, struct gl_config *visual) { WMesaFramebuffer pwfb = (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer)); @@ -1404,7 +1404,7 @@ WMesaContext WMesaCreateContext(HDC hDC, struct dd_function_table functions; GLint red_bits, green_bits, blue_bits, alpha_bits; GLcontext *ctx; - GLvisual *visual; + struct gl_config *visual; (void) Pal; @@ -1586,7 +1586,7 @@ void WMesaMakeCurrent(WMesaContext c, HDC hdc) /* Lazy creation of framebuffers */ if (c && !pwfb && hdc) { struct gl_renderbuffer *rb; - GLvisual *visual = &c->gl_ctx.Visual; + struct gl_config *visual = &c->gl_ctx.Visual; GLuint width, height; get_window_size(hdc, &width, &height); diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.h b/src/mesa/drivers/windows/gldirect/dglcontext.h index 5c433b857e..c92169bd9f 100644 --- a/src/mesa/drivers/windows/gldirect/dglcontext.h +++ b/src/mesa/drivers/windows/gldirect/dglcontext.h @@ -88,7 +88,7 @@ typedef struct { // Mesa vars: GLcontext *glCtx; // The core Mesa context - GLvisual *glVis; // Describes the color buffer + struct gl_config *glVis; // Describes the color buffer GLframebuffer *glBuffer; // Ancillary buffers GLuint ClearIndex; @@ -136,7 +136,7 @@ typedef struct { // Mesa context vars: // GLcontext *glCtx; // The core Mesa context - GLvisual *glVis; // Describes the color buffer + struct gl_config *glVis; // Describes the color buffer GLframebuffer *glBuffer; // Ancillary buffers GLuint ClearIndex; diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index e47949750a..3a696f7106 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -323,7 +323,7 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, struct xmesa_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, +xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const struct gl_config *visual, GLboolean backBuffer) { struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 939b7a7c50..8b75f99e8d 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -80,11 +80,11 @@ enum pixel_format { /** - * Visual inforation, derived from GLvisual. + * Visual inforation, derived from struct gl_config. * Basically corresponds to an XVisualInfo. */ struct xmesa_visual { - GLvisual mesa_visual; /* Device independent visual parameters */ + struct gl_config mesa_visual; /* Device independent visual parameters */ XMesaDisplay *display; /* The X11 display */ int screen, visualID; #ifdef XFree86Server @@ -495,7 +495,7 @@ extern const int xmesa_kernel1[16]; */ extern struct xmesa_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, +xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const struct gl_config *visual, GLboolean backBuffer); extern void diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index a3479f1f7d..f8ffdc25db 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -180,7 +180,7 @@ _mesa_notifySwapBuffers(GLcontext *ctx) /*@{*/ /** - * Allocates a GLvisual structure and initializes it via + * Allocates a struct gl_config structure and initializes it via * _mesa_initialize_visual(). * * \param dbFlag double buffering @@ -198,12 +198,12 @@ _mesa_notifySwapBuffers(GLcontext *ctx) * \param alphaBits same as above. * \param numSamples not really used. * - * \return pointer to new GLvisual or NULL if requested parameters can't be + * \return pointer to new struct gl_config or NULL if requested parameters can't be * met. * * \note Need to add params for level and numAuxBuffers (at least) */ -GLvisual * +struct gl_config * _mesa_create_visual( GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, @@ -218,7 +218,7 @@ _mesa_create_visual( GLboolean dbFlag, GLint accumAlphaBits, GLint numSamples ) { - GLvisual *vis = (GLvisual *) calloc(1, sizeof(GLvisual)); + struct gl_config *vis = (struct gl_config *) calloc(1, sizeof(struct gl_config)); if (vis) { if (!_mesa_initialize_visual(vis, dbFlag, stereoFlag, redBits, greenBits, blueBits, alphaBits, @@ -235,15 +235,15 @@ _mesa_create_visual( GLboolean dbFlag, /** * Makes some sanity checks and fills in the fields of the - * GLvisual object with the given parameters. If the caller needs - * to set additional fields, he should just probably init the whole GLvisual + * struct gl_config object with the given parameters. If the caller needs + * to set additional fields, he should just probably init the whole struct gl_config * object himself. * \return GL_TRUE on success, or GL_FALSE on failure. * * \sa _mesa_create_visual() above for the parameter description. */ GLboolean -_mesa_initialize_visual( GLvisual *vis, +_mesa_initialize_visual( struct gl_config *vis, GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, @@ -311,7 +311,7 @@ _mesa_initialize_visual( GLvisual *vis, * Frees the visual structure. */ void -_mesa_destroy_visual( GLvisual *vis ) +_mesa_destroy_visual( struct gl_config *vis ) { free(vis); } @@ -856,7 +856,7 @@ _mesa_alloc_dispatch_table(int size) GLboolean _mesa_initialize_context_for_api(GLcontext *ctx, gl_api api, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext) @@ -994,7 +994,7 @@ _mesa_initialize_context_for_api(GLcontext *ctx, GLboolean _mesa_initialize_context(GLcontext *ctx, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext) @@ -1014,7 +1014,7 @@ _mesa_initialize_context(GLcontext *ctx, * the rendering context. * * \param api the GL API type to create the context for - * \param visual a GLvisual pointer (we copy the struct contents) + * \param visual a struct gl_config pointer (we copy the struct contents) * \param share_list another context to share display lists with or NULL * \param driverFunctions points to the dd_function_table into which the * driver has plugged in all its special functions. @@ -1024,7 +1024,7 @@ _mesa_initialize_context(GLcontext *ctx, */ GLcontext * _mesa_create_context_for_api(gl_api api, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext) @@ -1049,7 +1049,7 @@ _mesa_create_context_for_api(gl_api api, } GLcontext * -_mesa_create_context(const GLvisual *visual, +_mesa_create_context(const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext) @@ -1293,8 +1293,8 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) static GLboolean check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) { - const GLvisual *ctxvis = &ctx->Visual; - const GLvisual *bufvis = &buffer->Visual; + const struct gl_config *ctxvis = &ctx->Visual; + const struct gl_config *bufvis = &buffer->Visual; if (ctxvis == bufvis) return GL_TRUE; diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index b130bbb066..969c07e53c 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -30,7 +30,7 @@ * There are three large Mesa data types/classes which are meant to be * used by device drivers: * - GLcontext: this contains the Mesa rendering state - * - GLvisual: this describes the color buffer (RGB vs. ci), whether or not + * - struct gl_config: this describes the color buffer (RGB vs. ci), whether or not * there's a depth buffer, stencil buffer, etc. * - GLframebuffer: contains pointers to the depth buffer, stencil buffer, * accum buffer and alpha buffers. @@ -38,7 +38,7 @@ * These types should be encapsulated by corresponding device driver * data types. See xmesa.h and xmesaP.h for an example. * - * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes + * In OOP terms, GLcontext, struct gl_config, and GLframebuffer are base classes * which the device driver must derive from. * * The following functions create and destroy these data types. @@ -59,7 +59,7 @@ struct _glapi_table; /** \name Visual-related functions */ /*@{*/ -extern GLvisual * +extern struct gl_config * _mesa_create_visual( GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, @@ -75,7 +75,7 @@ _mesa_create_visual( GLboolean dbFlag, GLint numSamples ); extern GLboolean -_mesa_initialize_visual( GLvisual *v, +_mesa_initialize_visual( struct gl_config *v, GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, @@ -91,7 +91,7 @@ _mesa_initialize_visual( GLvisual *v, GLint numSamples ); extern void -_mesa_destroy_visual( GLvisual *vis ); +_mesa_destroy_visual( struct gl_config *vis ); /*@}*/ @@ -100,21 +100,21 @@ _mesa_destroy_visual( GLvisual *vis ); /*@{*/ extern GLcontext * -_mesa_create_context( const GLvisual *visual, +_mesa_create_context( const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext ); extern GLboolean _mesa_initialize_context( GLcontext *ctx, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext ); extern GLcontext * _mesa_create_context_for_api(gl_api api, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext); @@ -122,7 +122,7 @@ _mesa_create_context_for_api(gl_api api, extern GLboolean _mesa_initialize_context_for_api(GLcontext *ctx, gl_api api, - const GLvisual *visual, + const struct gl_config *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext); diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index a98c09cfbf..64da8ba84f 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -83,7 +83,7 @@ compute_depth_max(struct gl_framebuffer *fb) * \sa _mesa_new_framebuffer */ struct gl_framebuffer * -_mesa_create_framebuffer(const GLvisual *visual) +_mesa_create_framebuffer(const struct gl_config *visual) { struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer); assert(visual); @@ -122,7 +122,7 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name) */ void _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, - const GLvisual *visual) + const struct gl_config *visual) { assert(fb); assert(visual); diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 2e9844282f..0cf28424cf 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -29,14 +29,14 @@ #include "mtypes.h" extern struct gl_framebuffer * -_mesa_create_framebuffer(const GLvisual *visual); +_mesa_create_framebuffer(const struct gl_config *visual); extern struct gl_framebuffer * _mesa_new_framebuffer(GLcontext *ctx, GLuint name); extern void _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, - const GLvisual *visual); + const struct gl_config *visual); extern void _mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name); diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 0c9013de66..08ad5f3201 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -139,7 +139,7 @@ typedef void *GLeglImageOES; */ #define MESA_GEOMETRY_PROGRAM 0x8c26 -/* Several fields of __GLcontextModes can take these as values. Since +/* Several fields of struct gl_config can take these as values. Since * GLX header files may not be available everywhere they need to be used, * redefine them here. */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8eae64b62a..901607adcc 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -125,7 +125,6 @@ struct gl_texture_image; struct gl_texture_object; struct st_context; typedef struct __GLcontextRec GLcontext; -typedef struct __GLcontextModesRec GLvisual; typedef struct gl_framebuffer GLframebuffer; /*@}*/ @@ -549,19 +548,7 @@ struct gl_shine_tab GLuint refcount; }; -/** - * Mode and limit information for a context. This information is - * kept around in the context so that values can be used during - * command execution, and for returning information about the - * context to the application. - * - * Instances of this structure are shared by the driver and the loader. To - * maintain binary compatability, new fields \b must be added only to the - * end of the structure. - * - * \sa _gl_context_modes_create - */ -typedef struct __GLcontextModesRec { +struct gl_config { GLboolean rgbMode; GLboolean floatMode; GLboolean colorIndexMode; @@ -614,7 +601,7 @@ typedef struct __GLcontextModesRec { GLint bindToMipmapTexture; GLint bindToTextureTargets; GLint yInverted; -} __GLcontextModes; +}; /** * Light source state. @@ -2453,7 +2440,7 @@ struct gl_framebuffer * The framebuffer's visual. Immutable if this is a window system buffer. * Computed from attachments if user-made FBO. */ - GLvisual Visual; + struct gl_config Visual; GLboolean Initialized; @@ -3074,7 +3061,7 @@ struct __GLcontextRec struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ /*@}*/ - GLvisual Visual; + struct gl_config Visual; GLframebuffer *DrawBuffer; /**< buffer for writing */ GLframebuffer *ReadBuffer; /**< buffer for reading */ GLframebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 3b046962ef..b0ec198e24 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -163,7 +163,7 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, - const __GLcontextModes *visual, + const struct gl_config *visual, struct st_context *share) { GLcontext *ctx; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 991feee300..ef2338817c 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -260,7 +260,7 @@ st_get_msaa(void); extern struct st_context * st_create_context(gl_api api, struct pipe_context *pipe, - const __GLcontextModes *visual, + const struct gl_config *visual, struct st_context *share); extern void diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index cd418a0366..0592dd111d 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -296,11 +296,11 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb, } /** - * Intialize a __GLcontextModes from a visual. + * Intialize a struct gl_config from a visual. */ static void st_visual_to_context_mode(const struct st_visual *visual, - __GLcontextModes *mode) + struct gl_config *mode) { memset(mode, 0, sizeof(*mode)); @@ -420,7 +420,7 @@ static struct st_framebuffer * st_framebuffer_create(struct st_framebuffer_iface *stfbi) { struct st_framebuffer *stfb; - __GLcontextModes mode; + struct gl_config mode; gl_buffer_index idx; stfb = CALLOC_STRUCT(st_framebuffer); @@ -625,7 +625,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, struct st_context *shared_ctx = (struct st_context *) shared_stctxi; struct st_context *st; struct pipe_context *pipe; - __GLcontextModes mode; + struct gl_config mode; gl_api api; if (!(stapi->profile_mask & (1 << attribs->profile))) -- cgit v1.2.3 From 31aca27c08d6a385c595d34fe4ee06390bf5b0e8 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 12 Oct 2010 12:02:01 -0400 Subject: Drop GLframebuffer typedef and just use struct gl_framebuffer --- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/mesa/drivers/beos/GLView.cpp | 16 ++++++++-------- src/mesa/drivers/dri/common/utils.c | 2 +- src/mesa/drivers/dri/common/utils.h | 2 +- src/mesa/drivers/dri/i810/i810context.c | 6 +++--- src/mesa/drivers/dri/i810/i810context.h | 2 +- src/mesa/drivers/dri/i810/i810screen.c | 2 +- src/mesa/drivers/dri/mach64/mach64_context.c | 4 ++-- src/mesa/drivers/dri/mach64/mach64_dd.c | 2 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 6 +++--- src/mesa/drivers/dri/mga/mgapixel.c | 2 +- src/mesa/drivers/dri/r128/r128_context.c | 4 ++-- src/mesa/drivers/dri/r128/r128_dd.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 2 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 6 +++--- src/mesa/drivers/dri/savage/savagecontext.h | 2 +- src/mesa/drivers/dri/sis/sis_context.c | 6 +++--- src/mesa/drivers/dri/sis/sis_context.h | 2 +- src/mesa/drivers/dri/sis/sis_dd.c | 2 +- src/mesa/drivers/dri/sis/sis_screen.c | 2 +- src/mesa/drivers/dri/swrast/swrast.c | 18 +++++++++--------- src/mesa/drivers/dri/swrast/swrast_priv.h | 4 ++-- src/mesa/drivers/dri/tdfx/tdfx_context.c | 8 ++++---- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 6 +++--- src/mesa/drivers/dri/unichrome/via_context.c | 6 +++--- src/mesa/drivers/dri/unichrome/via_context.h | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 2 +- src/mesa/drivers/fbdev/glfbdev.c | 8 ++++---- src/mesa/drivers/osmesa/osmesa.c | 2 +- src/mesa/drivers/windows/gdi/wmesa.c | 8 ++++---- src/mesa/drivers/windows/gldirect/dglcontext.h | 4 ++-- src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c | 6 +++--- src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h | 2 +- src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c | 6 +++--- src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h | 2 +- src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c | 6 +++--- src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h | 2 +- .../drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c | 4 ++-- src/mesa/drivers/x11/xm_api.c | 4 ++-- src/mesa/drivers/x11/xmesaP.h | 6 +++--- src/mesa/main/context.c | 8 ++++---- src/mesa/main/context.h | 8 ++++---- src/mesa/main/dd.h | 4 ++-- src/mesa/main/framebuffer.c | 4 ++-- src/mesa/main/image.c | 4 ++-- src/mesa/main/mtypes.h | 9 ++++----- src/mesa/state_tracker/st_cb_fbo.c | 4 ++-- src/mesa/state_tracker/st_cb_flush.c | 4 ++-- src/mesa/state_tracker/st_cb_viewport.c | 6 +++--- src/mesa/state_tracker/st_context.h | 4 ++-- src/mesa/state_tracker/st_manager.c | 14 +++++++------- src/mesa/state_tracker/st_manager.h | 2 +- 54 files changed, 127 insertions(+), 128 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 6ce386008a..7206188a06 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -423,7 +423,7 @@ static XMesaBuffer XMesaBufferList = NULL; /** * Allocate a new XMesaBuffer object which corresponds to the given drawable. - * Note that XMesaBuffer is derived from GLframebuffer. + * Note that XMesaBuffer is derived from struct gl_framebuffer. * The new XMesaBuffer will not have any size (Width=Height=0). * * \param d the corresponding X drawable (window or pixmap) diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp index 44082e47cf..8ccb93d56b 100644 --- a/src/mesa/drivers/beos/GLView.cpp +++ b/src/mesa/drivers/beos/GLView.cpp @@ -105,7 +105,7 @@ public: MesaDriver(); ~MesaDriver(); - void Init(BGLView * bglview, GLcontext * c, struct gl_config * v, GLframebuffer * b); + void Init(BGLView * bglview, GLcontext * c, struct gl_config * v, struct gl_framebuffer * b); void LockGL(); void UnlockGL(); @@ -122,7 +122,7 @@ private: GLcontext * m_glcontext; struct gl_config * m_glvisual; - GLframebuffer * m_glframebuffer; + struct gl_framebuffer * m_glframebuffer; BGLView * m_bglview; BBitmap * m_bitmap; @@ -147,9 +147,9 @@ private: static void Index(GLcontext *ctx, GLuint index); static void Color(GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a); - static void SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer, + static void SetBuffer(GLcontext *ctx, struct gl_framebuffer *colorBuffer, GLenum mode); - static void GetBufferSize(GLframebuffer * framebuffer, GLuint *width, + static void GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width, GLuint *height); static void Error(GLcontext *ctx); static const GLubyte * GetString(GLcontext *ctx, GLenum name); @@ -332,7 +332,7 @@ BGLView::BGLView(BRect rect, char *name, // create core framebuffer - GLframebuffer * buffer = _mesa_create_framebuffer(visual, + struct gl_framebuffer * buffer = _mesa_create_framebuffer(visual, depth > 0 ? GL_TRUE : GL_FALSE, stencil > 0 ? GL_TRUE: GL_FALSE, accum > 0 ? GL_TRUE : GL_FALSE, @@ -668,7 +668,7 @@ MesaDriver::~MesaDriver() } -void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, struct gl_config * visual, GLframebuffer * framebuffer) +void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, struct gl_config * visual, struct gl_framebuffer * framebuffer) { m_bglview = bglview; m_glcontext = ctx; @@ -984,7 +984,7 @@ void MesaDriver::ClearBack(GLcontext *ctx, } -void MesaDriver::SetBuffer(GLcontext *ctx, GLframebuffer *buffer, +void MesaDriver::SetBuffer(GLcontext *ctx, struct gl_framebuffer *buffer, GLenum mode) { /* TODO */ @@ -993,7 +993,7 @@ void MesaDriver::SetBuffer(GLcontext *ctx, GLframebuffer *buffer, (void) mode; } -void MesaDriver::GetBufferSize(GLframebuffer * framebuffer, GLuint *width, +void MesaDriver::GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width, GLuint *height) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 3cc496c671..bb7f07d8f4 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -337,7 +337,7 @@ driCheckDriDdxDrmVersions2(const char * driver_name, drmActual, drmExpected); } -GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, +GLboolean driClipRectToFramebuffer( const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ) { diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 01930d784e..40344a1874 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -94,7 +94,7 @@ extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name, const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected, const __DRIversion * drmActual, const __DRIversion * drmExpected); -extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, +extern GLboolean driClipRectToFramebuffer( const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ); diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index aaa97f017a..35a4898aac 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -96,7 +96,7 @@ static const GLubyte *i810GetString( GLcontext *ctx, GLenum name ) } } -static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) +static void i810BufferSize(struct gl_framebuffer *buffer, GLuint *width, GLuint *height) { GET_CURRENT_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -453,8 +453,8 @@ i810MakeCurrent(__DRIcontext *driContextPriv, imesa->driDrawable = driDrawPriv; _mesa_make_current(imesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate); /* Are these necessary? */ diff --git a/src/mesa/drivers/dri/i810/i810context.h b/src/mesa/drivers/dri/i810/i810context.h index 19529db020..2a09cf88f5 100644 --- a/src/mesa/drivers/dri/i810/i810context.h +++ b/src/mesa/drivers/dri/i810/i810context.h @@ -146,7 +146,7 @@ struct i810_context_t { /* DRI stuff */ GLuint needClip; - GLframebuffer *glBuffer; + struct gl_framebuffer *glBuffer; GLboolean doPageFlip; /* These refer to the current draw (front vs. back) buffer: diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 098d027771..fc56b61b4e 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -333,7 +333,7 @@ i810CreateBuffer( __DRIscreen *driScrnPriv, static void i810DestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } const struct __DriverAPIRec driDriverAPI = { diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 9d89cb8a48..0d4f895dd4 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -334,8 +334,8 @@ mach64MakeCurrent( __DRIcontext *driContextPriv, } _mesa_make_current( newMach64Ctx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); newMach64Ctx->new_state |= MACH64_NEW_CLIP; diff --git a/src/mesa/drivers/dri/mach64/mach64_dd.c b/src/mesa/drivers/dri/mach64/mach64_dd.c index ca713e2de5..d464f6c518 100644 --- a/src/mesa/drivers/dri/mach64/mach64_dd.c +++ b/src/mesa/drivers/dri/mach64/mach64_dd.c @@ -41,7 +41,7 @@ /* Return the current color buffer size. */ -static void mach64DDGetBufferSize( GLframebuffer *buffer, +static void mach64DDGetBufferSize( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 762ffe5e43..b5ed03910c 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -369,7 +369,7 @@ mach64CreateBuffer( __DRIscreen *driScrnPriv, static void mach64DestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 6daeb6a6bf..7e92396370 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -812,7 +812,7 @@ mgaCreateBuffer( __DRIscreen *driScrnPriv, static void mgaDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static void @@ -875,8 +875,8 @@ mgaMakeCurrent(__DRIcontext *driContextPriv, mmesa->driReadable = driReadPriv; _mesa_make_current(mmesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate); } else { _mesa_make_current(NULL, NULL, NULL); diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c index 9cbdbe02c9..1b6fb7d6b3 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.c +++ b/src/mesa/drivers/dri/mga/mgapixel.c @@ -170,7 +170,7 @@ check_stencil_per_fragment_ops( const GLcontext *ctx ) static GLboolean clip_pixelrect( const GLcontext *ctx, - const GLframebuffer *buffer, + const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height, GLint *skipPixels, GLint *skipRows, diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index bc25d7e8ca..accd9a5ddb 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -348,8 +348,8 @@ r128MakeCurrent( __DRIcontext *driContextPriv, newR128Ctx->driDrawable = driDrawPriv; _mesa_make_current( newR128Ctx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); newR128Ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP; } else { diff --git a/src/mesa/drivers/dri/r128/r128_dd.c b/src/mesa/drivers/dri/r128/r128_dd.c index 64dec70cdd..7dcfa3b285 100644 --- a/src/mesa/drivers/dri/r128/r128_dd.c +++ b/src/mesa/drivers/dri/r128/r128_dd.c @@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Return the width and height of the current color buffer. */ -static void r128GetBufferSize( GLframebuffer *buffer, +static void r128GetBufferSize( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 29a4f74156..43ab0fc64d 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -349,7 +349,7 @@ r128CreateBuffer( __DRIscreen *driScrnPriv, static void r128DestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index f5b55ad970..43ebc81093 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1691,7 +1691,7 @@ radeonDestroyBuffer(__DRIdrawable *driDrawPriv) if (!rfb) return; radeon_cleanup_renderbuffers(rfb); - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index ab05fc8eb1..a8ba033411 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -681,7 +681,7 @@ savageCreateBuffer( __DRIscreen *driScrnPriv, static void savageDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } #if 0 @@ -789,9 +789,9 @@ savageMakeCurrent(__DRIcontext *driContextPriv, savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate; struct gl_framebuffer *drawBuffer - = (GLframebuffer *) driDrawPriv->driverPrivate; + = (struct gl_framebuffer *) driDrawPriv->driverPrivate; struct gl_framebuffer *readBuffer - = (GLframebuffer *) driReadPriv->driverPrivate; + = (struct gl_framebuffer *) driReadPriv->driverPrivate; driRenderbuffer *frontRb = (driRenderbuffer *) drawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; driRenderbuffer *backRb = (driRenderbuffer *) diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h index ba1e6e1e1a..6723456ec9 100644 --- a/src/mesa/drivers/dri/savage/savagecontext.h +++ b/src/mesa/drivers/dri/savage/savagecontext.h @@ -226,7 +226,7 @@ struct savage_context_t { /* DRI stuff */ GLuint bufferSize; - GLframebuffer *glBuffer; + struct gl_framebuffer *glBuffer; /* Two flags to keep track of fallbacks. */ GLuint Fallback; diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index f460e89a56..07b363826d 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -147,7 +147,7 @@ WaitingFor3dIdle(sisContextPtr smesa, int wLen) } } -void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, +void sisReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -381,8 +381,8 @@ sisMakeCurrent( __DRIcontext *driContextPriv, newSisCtx->driDrawable = driDrawPriv; - drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; - readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; + drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; + readBuffer = (struct gl_framebuffer *)driReadPriv->driverPrivate; _mesa_make_current( newSisCtx->glCtx, drawBuffer, readBuffer ); diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 2ccfe1b54b..54e98fd00a 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -444,7 +444,7 @@ extern GLboolean sisCreateContext( gl_api api, void *sharedContextPrivate ); extern void sisDestroyContext( __DRIcontext * ); -void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, +void sisReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); extern GLboolean sisMakeCurrent( __DRIcontext *driContextPriv, diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index fe4ade8592..af1d9ee0ad 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -50,7 +50,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Return the width and height of the given buffer. */ static void -sisGetBufferSize( GLframebuffer *buffer, +sisGetBufferSize( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 1ce52a2d67..7ca5031846 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -220,7 +220,7 @@ sisCreateBuffer( __DRIscreen *driScrnPriv, static void sisDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static void sisCopyBuffer( __DRIdrawable *dPriv ) diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 8585250eb0..5b52135627 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -373,7 +373,7 @@ dri_create_buffer(__DRIscreen * sPriv, const struct gl_config * visual, GLboolean isPixmap) { struct dri_drawable *drawable = NULL; - GLframebuffer *fb; + struct gl_framebuffer *fb; struct swrast_renderbuffer *frontrb, *backrb; TRACE; @@ -432,7 +432,7 @@ dri_destroy_buffer(__DRIdrawable * dPriv) if (dPriv) { struct dri_drawable *drawable = dri_drawable(dPriv); - GLframebuffer *fb; + struct gl_framebuffer *fb; free(drawable->row); @@ -451,7 +451,7 @@ dri_swap_buffers(__DRIdrawable * dPriv) GET_CURRENT_CONTEXT(ctx); struct dri_drawable *drawable = dri_drawable(dPriv); - GLframebuffer *fb; + struct gl_framebuffer *fb; struct swrast_renderbuffer *frontrb, *backrb; TRACE; @@ -487,7 +487,7 @@ dri_swap_buffers(__DRIdrawable * dPriv) */ static void -get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h ) +get_window_size( struct gl_framebuffer *fb, GLsizei *w, GLsizei *h ) { __DRIdrawable *dPriv = swrast_drawable(fb)->dPriv; __DRIscreen *sPriv = dPriv->driScreenPriv; @@ -499,7 +499,7 @@ get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h ) } static void -swrast_check_and_update_window_size( GLcontext *ctx, GLframebuffer *fb ) +swrast_check_and_update_window_size( GLcontext *ctx, struct gl_framebuffer *fb ) { GLsizei width, height; @@ -536,8 +536,8 @@ update_state( GLcontext *ctx, GLuint new_state ) static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { - GLframebuffer *draw = ctx->WinSysDrawBuffer; - GLframebuffer *read = ctx->WinSysReadBuffer; + struct gl_framebuffer *draw = ctx->WinSysDrawBuffer; + struct gl_framebuffer *read = ctx->WinSysReadBuffer; swrast_check_and_update_window_size(ctx, draw); swrast_check_and_update_window_size(ctx, read); @@ -665,8 +665,8 @@ dri_make_current(__DRIcontext * cPriv, __DRIdrawable * driReadPriv) { GLcontext *mesaCtx; - GLframebuffer *mesaDraw; - GLframebuffer *mesaRead; + struct gl_framebuffer *mesaDraw; + struct gl_framebuffer *mesaRead; TRACE; if (cPriv) { diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index 6679061a98..054bdba27b 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -79,7 +79,7 @@ swrast_context(GLcontext *ctx) struct dri_drawable { /* mesa, base class, must be first */ - GLframebuffer Base; + struct gl_framebuffer Base; /* dri */ __DRIdrawable *dPriv; @@ -95,7 +95,7 @@ dri_drawable(__DRIdrawable * driDrawPriv) } static INLINE struct dri_drawable * -swrast_drawable(GLframebuffer *fb) +swrast_drawable(struct gl_framebuffer *fb) { return (struct dri_drawable *) fb; } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 18c626c454..adefc1472a 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -651,8 +651,8 @@ tdfxMakeCurrent( __DRIcontext *driContextPriv, * dispatch is set correctly. */ _mesa_make_current( newCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); return GL_TRUE; } /* [dBorca] tunnel2 requires this */ @@ -689,8 +689,8 @@ tdfxMakeCurrent( __DRIcontext *driContextPriv, } _mesa_make_current( newCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); } else { _mesa_make_current( NULL, NULL, NULL ); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index c9ca4fc637..084560ff87 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -227,7 +227,7 @@ tdfxCreateBuffer( __DRIscreen *driScrnPriv, static void tdfxDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } @@ -237,13 +237,13 @@ tdfxSwapBuffers( __DRIdrawable *driDrawPriv ) { GET_CURRENT_CONTEXT(ctx); tdfxContextPtr fxMesa = 0; - GLframebuffer *mesaBuffer; + struct gl_framebuffer *mesaBuffer; if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driDrawPriv ); } - mesaBuffer = (GLframebuffer *) driDrawPriv->driverPrivate; + mesaBuffer = (struct gl_framebuffer *) driDrawPriv->driverPrivate; if ( !mesaBuffer->Visual.doubleBufferMode ) return; /* can't swap a single-buffered window */ diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 3305e934a5..5e6e271b45 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -352,7 +352,7 @@ calculate_buffer_parameters(struct via_context *vmesa, } -void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, +void viaReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -833,8 +833,8 @@ viaMakeCurrent(__DRIcontext *driContextPriv, GLcontext *ctx = vmesa->glCtx; struct gl_framebuffer *drawBuffer, *readBuffer; - drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; - readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; + drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; + readBuffer = (struct gl_framebuffer *)driReadPriv->driverPrivate; if ((vmesa->driDrawable != driDrawPriv) || (vmesa->driReadable != driReadPriv)) { diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 4e1ab3a6ca..4e3bed342d 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -394,7 +394,7 @@ extern void viaEmitHwStateLocked(struct via_context *vmesa); extern void viaEmitScissorValues(struct via_context *vmesa, int box_nr, int emit); extern void viaXMesaSetBackClipRects(struct via_context *vmesa); extern void viaXMesaSetFrontClipRects(struct via_context *vmesa); -extern void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLuint width, GLuint height); +extern void viaReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); extern void viaXMesaWindowMoved(struct via_context *vmesa); extern GLboolean viaTexCombineState(struct via_context *vmesa, diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index e6aa7b6b83..9ea656cf02 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -311,7 +311,7 @@ viaCreateBuffer(__DRIscreen *driScrnPriv, static void viaDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static const __DRIconfig ** diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index b3bb71525e..fd3432a983 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -83,10 +83,10 @@ struct GLFBDevVisualRec { }; /** - * Derived from Mesa's GLframebuffer class. + * Derived from Mesa's struct gl_framebuffer class. */ struct GLFBDevBufferRec { - GLframebuffer glframebuffer; /* base class */ + struct gl_framebuffer glframebuffer; /* base class */ GLFBDevVisualPtr visual; struct fb_fix_screeninfo fix; struct fb_var_screeninfo var; @@ -146,7 +146,7 @@ update_state( GLcontext *ctx, GLuint new_state ) static void -get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) +get_buffer_size( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { const GLFBDevBufferPtr fbdevbuffer = (GLFBDevBufferPtr) buffer; *width = fbdevbuffer->var.xres; @@ -162,7 +162,7 @@ static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { GLuint newWidth, newHeight; - GLframebuffer *buffer; + struct gl_framebuffer *buffer; buffer = ctx->WinSysDrawBuffer; get_buffer_size( buffer, &newWidth, &newHeight ); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index a04dc6d8a9..4b264539cb 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -64,7 +64,7 @@ struct osmesa_context GLcontext mesa; /*< Base class - this must be first */ struct gl_config *gl_visual; /*< Describes the buffers */ struct gl_renderbuffer *rb; /*< The user's colorbuffer */ - GLframebuffer *gl_buffer; /*< The framebuffer, containing user's rb */ + struct gl_framebuffer *gl_buffer; /*< The framebuffer, containing user's rb */ GLenum format; /*< User-specified context format */ GLint userRowLength; /*< user-specified number of pixels per row */ GLint rInd, gInd, bInd, aInd;/*< index offsets for RGBA formats */ diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 1a71ef4559..39d2704417 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -83,9 +83,9 @@ wmesa_lookup_framebuffer(HDC hdc) /** - * Given a GLframebuffer, return the corresponding WMesaFramebuffer. + * Given a struct gl_framebuffer, return the corresponding WMesaFramebuffer. */ -static WMesaFramebuffer wmesa_framebuffer(GLframebuffer *fb) +static WMesaFramebuffer wmesa_framebuffer(struct gl_framebuffer *fb) { return (WMesaFramebuffer) fb; } @@ -217,7 +217,7 @@ get_window_size(HDC hdc, GLuint *width, GLuint *height) static void -wmesa_get_buffer_size(GLframebuffer *buffer, GLuint *width, GLuint *height) +wmesa_get_buffer_size(struct gl_framebuffer *buffer, GLuint *width, GLuint *height) { WMesaFramebuffer pwfb = wmesa_framebuffer(buffer); get_window_size(pwfb->hDC, width, height); @@ -1320,7 +1320,7 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat, * Resize the front/back colorbuffers to match the latest window size. */ static void -wmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, +wmesa_resize_buffers(GLcontext *ctx, struct gl_framebuffer *buffer, GLuint width, GLuint height) { WMesaContext pwc = wmesa_context(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.h b/src/mesa/drivers/windows/gldirect/dglcontext.h index c92169bd9f..f46d83eab0 100644 --- a/src/mesa/drivers/windows/gldirect/dglcontext.h +++ b/src/mesa/drivers/windows/gldirect/dglcontext.h @@ -89,7 +89,7 @@ typedef struct { // Mesa vars: GLcontext *glCtx; // The core Mesa context struct gl_config *glVis; // Describes the color buffer - GLframebuffer *glBuffer; // Ancillary buffers + struct gl_framebuffer *glBuffer; // Ancillary buffers GLuint ClearIndex; GLuint CurrentIndex; @@ -137,7 +137,7 @@ typedef struct { // GLcontext *glCtx; // The core Mesa context struct gl_config *glVis; // Describes the color buffer - GLframebuffer *glBuffer; // Ancillary buffers + struct gl_framebuffer *glBuffer; // Ancillary buffers GLuint ClearIndex; GLuint CurrentIndex; diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c index 7b202dfda7..4a38b35adf 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c @@ -238,7 +238,7 @@ static GLboolean gld_set_draw_buffer_DX7( static void gld_set_read_buffer_DX7( GLcontext *ctx, - GLframebuffer *buffer, + struct gl_framebuffer *buffer, GLenum mode) { /* separate read buffer not supported */ @@ -343,7 +343,7 @@ void gld_Clear_DX7( // Mesa 5: Parameter change static void gld_buffer_size_DX7( // GLcontext *ctx, - GLframebuffer *fb, + struct gl_framebuffer *fb, GLuint *width, GLuint *height) { @@ -1058,7 +1058,7 @@ extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX7( // GLcontext *ctx) - GLframebuffer *fb) + struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); dglWglResizeBuffers(ctx, TRUE); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h index b5a491e41b..6f549c9d19 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h @@ -228,7 +228,7 @@ PROC gldGetProcAddress_DX7(LPCSTR a); void gldEnableExtensions_DX7(GLcontext *ctx); void gldInstallPipeline_DX7(GLcontext *ctx); void gldSetupDriverPointers_DX7(GLcontext *ctx); -void gldResizeBuffers_DX7(GLframebuffer *fb); +void gldResizeBuffers_DX7(struct gl_framebuffer *fb); // Texture functions diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c index 7eeb9db2d1..e2793ba557 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c @@ -238,7 +238,7 @@ static GLboolean gld_set_draw_buffer_DX8( static void gld_set_read_buffer_DX8( GLcontext *ctx, - GLframebuffer *buffer, + struct gl_framebuffer *buffer, GLenum mode) { /* separate read buffer not supported */ @@ -343,7 +343,7 @@ void gld_Clear_DX8( // Mesa 5: Parameter change static void gld_buffer_size_DX8( // GLcontext *ctx, - GLframebuffer *fb, + struct gl_framebuffer *fb, GLuint *width, GLuint *height) { @@ -1038,7 +1038,7 @@ extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX8( // GLcontext *ctx) - GLframebuffer *fb) + struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); dglWglResizeBuffers(ctx, TRUE); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h index 7efec7cae8..2446d90636 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h @@ -260,7 +260,7 @@ void gldEnableExtensions_DX8(GLcontext *ctx); void gldInstallPipeline_DX8(GLcontext *ctx); void gldSetupDriverPointers_DX8(GLcontext *ctx); //void gldResizeBuffers_DX8(GLcontext *ctx); -void gldResizeBuffers_DX8(GLframebuffer *fb); +void gldResizeBuffers_DX8(struct gl_framebuffer *fb); // Texture functions diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c index 0558462dea..0186b26832 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c @@ -238,7 +238,7 @@ static GLboolean gld_set_draw_buffer_DX9( static void gld_set_read_buffer_DX9( GLcontext *ctx, - GLframebuffer *buffer, + struct gl_framebuffer *buffer, GLenum mode) { /* separate read buffer not supported */ @@ -341,7 +341,7 @@ void gld_Clear_DX9( // Mesa 5: Parameter change static void gld_buffer_size_DX9( // GLcontext *ctx, - GLframebuffer *fb, + struct gl_framebuffer *fb, GLuint *width, GLuint *height) { @@ -1068,7 +1068,7 @@ extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX9( // GLcontext *ctx) - GLframebuffer *fb) + struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); dglWglResizeBuffers(ctx, TRUE); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h index aec40ac9dd..201595f724 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h @@ -263,7 +263,7 @@ void gldEnableExtensions_DX9(GLcontext *ctx); void gldInstallPipeline_DX9(GLcontext *ctx); void gldSetupDriverPointers_DX9(GLcontext *ctx); //void gldResizeBuffers_DX9(GLcontext *ctx); -void gldResizeBuffers_DX9(GLframebuffer *fb); +void gldResizeBuffers_DX9(struct gl_framebuffer *fb); // Texture functions diff --git a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c index f927abfa11..b3c2026475 100644 --- a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c +++ b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c @@ -828,7 +828,7 @@ static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode ) //--------------------------------------------------------------------------- -static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, +static void set_read_buffer(GLcontext *ctx, struct gl_framebuffer *colorBuffer, GLenum buffer ) { /* XXX todo */ @@ -843,7 +843,7 @@ static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, //static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height ) // Altered for Mesa 5.x. KeithH static void buffer_size( - GLframebuffer *buffer, + struct gl_framebuffer *buffer, GLuint *width, GLuint *height) { diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 984caa4f0a..f091c38bc4 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -349,7 +349,7 @@ XMesaBuffer XMesaBufferList = NULL; /** * Allocate a new XMesaBuffer object which corresponds to the given drawable. - * Note that XMesaBuffer is derived from GLframebuffer. + * Note that XMesaBuffer is derived from struct gl_framebuffer. * The new XMesaBuffer will not have any size (Width=Height=0). * * \param d the corresponding X drawable (window or pixmap) @@ -1788,7 +1788,7 @@ XMesaDestroyBuffer(XMesaBuffer b) /** - * Query the current window size and update the corresponding GLframebuffer + * Query the current window size and update the corresponding struct gl_framebuffer * and all attached renderbuffers. * Called when: * 1. the first time a buffer is bound to a context. diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 8b75f99e8d..37b7a587de 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -205,7 +205,7 @@ struct xmesa_renderbuffer * Basically corresponds to a GLXDrawable. */ struct xmesa_buffer { - GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */ + struct gl_framebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */ /* This MUST BE FIRST! */ GLboolean wasCurrent; /* was ever the current buffer? */ XMesaVisual xm_visual; /* the X/Mesa visual */ @@ -553,11 +553,11 @@ XMESA_CONTEXT(GLcontext *ctx) /** - * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. + * Return pointer to XMesaBuffer corresponding to a Mesa struct gl_framebuffer. * Since we're using structure containment, it's just a cast!. */ static INLINE XMesaBuffer -XMESA_BUFFER(GLframebuffer *b) +XMESA_BUFFER(struct gl_framebuffer *b) { return (XMesaBuffer) b; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f8ffdc25db..0ecbea2c51 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1291,7 +1291,7 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) * \return GL_TRUE if compatible, GL_FALSE otherwise. */ static GLboolean -check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) +check_compatible(const GLcontext *ctx, const struct gl_framebuffer *buffer) { const struct gl_config *ctxvis = &ctx->Visual; const struct gl_config *bufvis = &buffer->Visual; @@ -1340,7 +1340,7 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) * Really, the device driver should totally take care of this. */ static void -initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb) +initialize_framebuffer_size(GLcontext *ctx, struct gl_framebuffer *fb) { GLuint width, height; if (ctx->Driver.GetBufferSize) { @@ -1385,8 +1385,8 @@ _mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height) * \param readBuffer the reading framebuffer */ GLboolean -_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ) +_mesa_make_current( GLcontext *newCtx, struct gl_framebuffer *drawBuffer, + struct gl_framebuffer *readBuffer ) { if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(newCtx, "_mesa_make_current()\n"); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 969c07e53c..d89ae36a5c 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -32,13 +32,13 @@ * - GLcontext: this contains the Mesa rendering state * - struct gl_config: this describes the color buffer (RGB vs. ci), whether or not * there's a depth buffer, stencil buffer, etc. - * - GLframebuffer: contains pointers to the depth buffer, stencil buffer, + * - struct gl_framebuffer: contains pointers to the depth buffer, stencil buffer, * accum buffer and alpha buffers. * * These types should be encapsulated by corresponding device driver * data types. See xmesa.h and xmesaP.h for an example. * - * In OOP terms, GLcontext, struct gl_config, and GLframebuffer are base classes + * In OOP terms, GLcontext, struct gl_config, and struct gl_framebuffer are base classes * which the device driver must derive from. * * The following functions create and destroy these data types. @@ -142,8 +142,8 @@ extern void _mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height); extern GLboolean -_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ); +_mesa_make_current( GLcontext *ctx, struct gl_framebuffer *drawBuffer, + struct gl_framebuffer *readBuffer ); extern GLboolean _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 46d26cf901..01ad2903df 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -86,14 +86,14 @@ struct dd_function_table { * Mesa uses this to determine when the driver's window size has changed. * XXX OBSOLETE: this function will be removed in the future. */ - void (*GetBufferSize)( GLframebuffer *buffer, + void (*GetBufferSize)( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ); /** * Resize the given framebuffer to the given size. * XXX OBSOLETE: this function will be removed in the future. */ - void (*ResizeBuffers)( GLcontext *ctx, GLframebuffer *fb, + void (*ResizeBuffers)( GLcontext *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height); /** diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 64da8ba84f..0e9e6def9b 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -372,7 +372,7 @@ _mesa_resizebuffers( GLcontext *ctx ) if (ctx->WinSysDrawBuffer) { GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysDrawBuffer; + struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer; assert(buffer->Name == 0); @@ -389,7 +389,7 @@ _mesa_resizebuffers( GLcontext *ctx ) if (ctx->WinSysReadBuffer && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) { GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysReadBuffer; + struct gl_framebuffer *buffer = ctx->WinSysReadBuffer; assert(buffer->Name == 0); diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ce10b3b1f8..f83fcc725d 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -5678,7 +5678,7 @@ _mesa_clip_drawpixels(const GLcontext *ctx, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *unpack) { - const GLframebuffer *buffer = ctx->DrawBuffer; + const struct gl_framebuffer *buffer = ctx->DrawBuffer; if (unpack->RowLength == 0) { unpack->RowLength = *width; @@ -5749,7 +5749,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *pack) { - const GLframebuffer *buffer = ctx->ReadBuffer; + const struct gl_framebuffer *buffer = ctx->ReadBuffer; if (pack->RowLength == 0) { pack->RowLength = *width; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 901607adcc..806a19d02a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -125,7 +125,6 @@ struct gl_texture_image; struct gl_texture_object; struct st_context; typedef struct __GLcontextRec GLcontext; -typedef struct gl_framebuffer GLframebuffer; /*@}*/ @@ -3062,10 +3061,10 @@ struct __GLcontextRec /*@}*/ struct gl_config Visual; - GLframebuffer *DrawBuffer; /**< buffer for writing */ - GLframebuffer *ReadBuffer; /**< buffer for reading */ - GLframebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */ - GLframebuffer *WinSysReadBuffer; /**< set with MakeCurrent */ + struct gl_framebuffer *DrawBuffer; /**< buffer for writing */ + struct gl_framebuffer *ReadBuffer; /**< buffer for reading */ + struct gl_framebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */ + struct gl_framebuffer *WinSysReadBuffer; /**< set with MakeCurrent */ /** * Device driver function pointer table diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index ac1f6812b8..dd4e92e3c0 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -547,7 +547,7 @@ static void st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers) { struct st_context *st = st_context(ctx); - GLframebuffer *fb = ctx->DrawBuffer; + struct gl_framebuffer *fb = ctx->DrawBuffer; GLuint i; (void) count; @@ -568,7 +568,7 @@ static void st_ReadBuffer(GLcontext *ctx, GLenum buffer) { struct st_context *st = st_context(ctx); - GLframebuffer *fb = ctx->ReadBuffer; + struct gl_framebuffer *fb = ctx->ReadBuffer; (void) buffer; diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 8c9959f954..7b247e0a32 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -51,7 +51,7 @@ static INLINE GLboolean is_front_buffer_dirty(struct st_context *st) { - GLframebuffer *fb = st->ctx->DrawBuffer; + struct gl_framebuffer *fb = st->ctx->DrawBuffer; struct st_renderbuffer *strb = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); return strb && strb->defined; @@ -64,7 +64,7 @@ is_front_buffer_dirty(struct st_context *st) static void display_front_buffer(struct st_context *st) { - GLframebuffer *fb = st->ctx->DrawBuffer; + struct gl_framebuffer *fb = st->ctx->DrawBuffer; struct st_renderbuffer *strb = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c index a1fe45cac4..c4076b665c 100644 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ b/src/mesa/state_tracker/st_cb_viewport.c @@ -34,13 +34,13 @@ #include "util/u_atomic.h" /** - * Cast wrapper to convert a GLframebuffer to an st_framebuffer. - * Return NULL if the GLframebuffer is a user-created framebuffer. + * Cast wrapper to convert a struct gl_framebuffer to an st_framebuffer. + * Return NULL if the struct gl_framebuffer is a user-created framebuffer. * We'll only return non-null for window system framebuffers. * Note that this function may fail. */ static INLINE struct st_framebuffer * -st_ws_framebuffer(GLframebuffer *fb) +st_ws_framebuffer(struct gl_framebuffer *fb) { /* FBO cannot be casted. See st_new_framebuffer */ return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index ef2338817c..ef75c2c4b1 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -202,12 +202,12 @@ static INLINE struct st_context *st_context(GLcontext *ctx) /** - * Wrapper for GLframebuffer. + * Wrapper for struct gl_framebuffer. * This is an opaque type to the outside world. */ struct st_framebuffer { - GLframebuffer Base; + struct gl_framebuffer Base; void *Private; struct st_framebuffer_iface *iface; diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 0592dd111d..a307bb9dc1 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -54,13 +54,13 @@ #include "st_manager.h" /** - * Cast wrapper to convert a GLframebuffer to an st_framebuffer. - * Return NULL if the GLframebuffer is a user-created framebuffer. + * Cast wrapper to convert a struct gl_framebuffer to an st_framebuffer. + * Return NULL if the struct gl_framebuffer is a user-created framebuffer. * We'll only return non-null for window system framebuffers. * Note that this function may fail. */ static INLINE struct st_framebuffer * -st_ws_framebuffer(GLframebuffer *fb) +st_ws_framebuffer(struct gl_framebuffer *fb) { /* FBO cannot be casted. See st_new_framebuffer */ return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL); @@ -429,7 +429,7 @@ st_framebuffer_create(struct st_framebuffer_iface *stfbi) /* for FBO-only context */ if (!stfbi) { - GLframebuffer *base = _mesa_get_incomplete_framebuffer(); + struct gl_framebuffer *base = _mesa_get_incomplete_framebuffer(); stfb->Base = *base; @@ -471,8 +471,8 @@ static void st_framebuffer_reference(struct st_framebuffer **ptr, struct st_framebuffer *stfb) { - GLframebuffer *fb = &stfb->Base; - _mesa_reference_framebuffer((GLframebuffer **) ptr, fb); + struct gl_framebuffer *fb = &stfb->Base; + _mesa_reference_framebuffer((struct gl_framebuffer **) ptr, fb); } static void @@ -832,7 +832,7 @@ st_manager_validate_framebuffers(struct st_context *st) * Add a color renderbuffer on demand. */ boolean -st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb, +st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb, gl_buffer_index idx) { struct st_framebuffer *stfb = st_ws_framebuffer(fb); diff --git a/src/mesa/state_tracker/st_manager.h b/src/mesa/state_tracker/st_manager.h index 48a9d4d99a..6a94978390 100644 --- a/src/mesa/state_tracker/st_manager.h +++ b/src/mesa/state_tracker/st_manager.h @@ -46,7 +46,7 @@ void st_manager_validate_framebuffers(struct st_context *st); boolean -st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb, +st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb, gl_buffer_index idx); #endif /* ST_MANAGER_H */ -- cgit v1.2.3 From f9995b30756140724f41daf963fa06167912be7f Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 12 Oct 2010 12:26:10 -0400 Subject: Drop GLcontext typedef and use struct gl_context instead --- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/glsl/builtin_function.cpp | 4 +- src/glsl/builtins/tools/generate_builtins.py | 4 +- src/glsl/glsl_parser_extras.cpp | 4 +- src/glsl/glsl_parser_extras.h | 4 +- src/glsl/linker.cpp | 4 +- src/glsl/main.cpp | 12 +- src/glsl/program.h | 2 +- src/mapi/glapi/glapi.h | 6 +- src/mesa/drivers/beos/GLView.cpp | 164 +++++----- src/mesa/drivers/common/driverfuncs.c | 2 +- src/mesa/drivers/common/driverfuncs.h | 2 +- src/mesa/drivers/common/meta.c | 60 ++-- src/mesa/drivers/common/meta.h | 36 +-- src/mesa/drivers/dri/common/depthtmp.h | 12 +- src/mesa/drivers/dri/common/dri_metaops.c | 16 +- src/mesa/drivers/dri/common/dri_metaops.h | 4 +- src/mesa/drivers/dri/common/drirenderbuffer.c | 4 +- src/mesa/drivers/dri/common/drirenderbuffer.h | 2 +- src/mesa/drivers/dri/common/spantmp.h | 14 +- src/mesa/drivers/dri/common/spantmp2.h | 20 +- src/mesa/drivers/dri/common/stenciltmp.h | 12 +- src/mesa/drivers/dri/common/texmem.c | 4 +- src/mesa/drivers/dri/common/texmem.h | 4 +- src/mesa/drivers/dri/common/utils.c | 4 +- src/mesa/drivers/dri/common/utils.h | 4 +- src/mesa/drivers/dri/i810/i810context.c | 10 +- src/mesa/drivers/dri/i810/i810context.h | 2 +- src/mesa/drivers/dri/i810/i810ioctl.c | 6 +- src/mesa/drivers/dri/i810/i810render.c | 2 +- src/mesa/drivers/dri/i810/i810span.c | 6 +- src/mesa/drivers/dri/i810/i810span.h | 6 +- src/mesa/drivers/dri/i810/i810state.c | 54 ++-- src/mesa/drivers/dri/i810/i810state.h | 6 +- src/mesa/drivers/dri/i810/i810tex.c | 22 +- src/mesa/drivers/dri/i810/i810tex.h | 2 +- src/mesa/drivers/dri/i810/i810texstate.c | 14 +- src/mesa/drivers/dri/i810/i810tris.c | 30 +- src/mesa/drivers/dri/i810/i810tris.h | 4 +- src/mesa/drivers/dri/i810/i810vb.c | 16 +- src/mesa/drivers/dri/i810/i810vb.h | 14 +- src/mesa/drivers/dri/i915/i830_context.c | 2 +- src/mesa/drivers/dri/i915/i830_context.h | 4 +- src/mesa/drivers/dri/i915/i830_state.c | 54 ++-- src/mesa/drivers/dri/i915/i830_texblend.c | 2 +- src/mesa/drivers/dri/i915/i830_texstate.c | 2 +- src/mesa/drivers/dri/i915/i830_vtbl.c | 4 +- src/mesa/drivers/dri/i915/i915_context.c | 4 +- src/mesa/drivers/dri/i915/i915_context.h | 10 +- src/mesa/drivers/dri/i915/i915_fragprog.c | 14 +- src/mesa/drivers/dri/i915/i915_program.c | 2 +- src/mesa/drivers/dri/i915/i915_program.h | 2 +- src/mesa/drivers/dri/i915/i915_state.c | 64 ++-- src/mesa/drivers/dri/i915/i915_texstate.c | 2 +- src/mesa/drivers/dri/i915/i915_vtbl.c | 2 +- src/mesa/drivers/dri/i915/intel_render.c | 2 +- src/mesa/drivers/dri/i915/intel_tris.c | 34 +-- src/mesa/drivers/dri/i915/intel_tris.h | 4 +- src/mesa/drivers/dri/i965/brw_cc.c | 4 +- src/mesa/drivers/dri/i965/brw_clip.c | 2 +- src/mesa/drivers/dri/i965/brw_clip_state.c | 2 +- src/mesa/drivers/dri/i965/brw_context.c | 2 +- src/mesa/drivers/dri/i965/brw_context.h | 6 +- src/mesa/drivers/dri/i965/brw_curbe.c | 4 +- src/mesa/drivers/dri/i965/brw_draw.c | 10 +- src/mesa/drivers/dri/i965/brw_draw.h | 6 +- src/mesa/drivers/dri/i965/brw_draw_upload.c | 6 +- src/mesa/drivers/dri/i965/brw_fallback.c | 2 +- src/mesa/drivers/dri/i965/brw_fallback.h | 8 +- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +- src/mesa/drivers/dri/i965/brw_fs.h | 2 +- src/mesa/drivers/dri/i965/brw_gs.c | 2 +- src/mesa/drivers/dri/i965/brw_misc_state.c | 10 +- src/mesa/drivers/dri/i965/brw_program.c | 12 +- src/mesa/drivers/dri/i965/brw_queryobj.c | 12 +- src/mesa/drivers/dri/i965/brw_sf.c | 2 +- src/mesa/drivers/dri/i965/brw_sf_state.c | 4 +- src/mesa/drivers/dri/i965/brw_state.c | 4 +- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_tex.c | 2 +- src/mesa/drivers/dri/i965/brw_vs.c | 4 +- src/mesa/drivers/dri/i965/brw_vs_constval.c | 2 +- src/mesa/drivers/dri/i965/brw_vs_state.c | 2 +- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 6 +- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- src/mesa/drivers/dri/i965/brw_wm.h | 8 +- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 4 +- src/mesa/drivers/dri/i965/brw_wm_state.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 +- src/mesa/drivers/dri/i965/gen6_cc.c | 4 +- src/mesa/drivers/dri/i965/gen6_clip_state.c | 2 +- src/mesa/drivers/dri/i965/gen6_depthstencil.c | 2 +- src/mesa/drivers/dri/i965/gen6_scissor_state.c | 2 +- src/mesa/drivers/dri/i965/gen6_sf_state.c | 2 +- src/mesa/drivers/dri/i965/gen6_viewport_state.c | 2 +- src/mesa/drivers/dri/i965/gen6_vs_state.c | 2 +- src/mesa/drivers/dri/i965/gen6_wm_state.c | 4 +- src/mesa/drivers/dri/intel/intel_blit.c | 2 +- src/mesa/drivers/dri/intel/intel_blit.h | 2 +- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 38 +-- src/mesa/drivers/dri/intel/intel_buffers.c | 6 +- src/mesa/drivers/dri/intel/intel_buffers.h | 4 +- src/mesa/drivers/dri/intel/intel_clear.c | 2 +- src/mesa/drivers/dri/intel/intel_context.c | 20 +- src/mesa/drivers/dri/intel/intel_context.h | 12 +- src/mesa/drivers/dri/intel/intel_extensions.c | 2 +- src/mesa/drivers/dri/intel/intel_extensions.h | 4 +- src/mesa/drivers/dri/intel/intel_extensions_es2.c | 2 +- src/mesa/drivers/dri/intel/intel_fbo.c | 30 +- src/mesa/drivers/dri/intel/intel_pixel.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel.h | 10 +- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 6 +- src/mesa/drivers/dri/intel/intel_pixel_copy.c | 6 +- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel_read.c | 4 +- src/mesa/drivers/dri/intel/intel_span.c | 10 +- src/mesa/drivers/dri/intel/intel_span.h | 10 +- src/mesa/drivers/dri/intel/intel_state.c | 2 +- src/mesa/drivers/dri/intel/intel_syncobj.c | 12 +- src/mesa/drivers/dri/intel/intel_tex.c | 10 +- src/mesa/drivers/dri/intel/intel_tex.h | 2 +- src/mesa/drivers/dri/intel/intel_tex_copy.c | 10 +- src/mesa/drivers/dri/intel/intel_tex_format.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_image.c | 20 +- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 10 +- src/mesa/drivers/dri/mach64/mach64_context.c | 2 +- src/mesa/drivers/dri/mach64/mach64_context.h | 2 +- src/mesa/drivers/dri/mach64/mach64_dd.c | 6 +- src/mesa/drivers/dri/mach64/mach64_ioctl.c | 2 +- src/mesa/drivers/dri/mach64/mach64_native_vb.c | 8 +- src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 8 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 2 +- src/mesa/drivers/dri/mach64/mach64_span.c | 6 +- src/mesa/drivers/dri/mach64/mach64_span.h | 2 +- src/mesa/drivers/dri/mach64/mach64_state.c | 66 ++--- src/mesa/drivers/dri/mach64/mach64_state.h | 10 +- src/mesa/drivers/dri/mach64/mach64_tex.c | 20 +- src/mesa/drivers/dri/mach64/mach64_tex.h | 2 +- src/mesa/drivers/dri/mach64/mach64_texstate.c | 6 +- src/mesa/drivers/dri/mach64/mach64_tris.c | 42 +-- src/mesa/drivers/dri/mach64/mach64_tris.h | 4 +- src/mesa/drivers/dri/mach64/mach64_vb.c | 16 +- src/mesa/drivers/dri/mach64/mach64_vb.h | 18 +- src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 12 +- src/mesa/drivers/dri/mga/mga_texcombine.c | 2 +- src/mesa/drivers/dri/mga/mga_texstate.c | 16 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 4 +- src/mesa/drivers/dri/mga/mgacontext.h | 2 +- src/mesa/drivers/dri/mga/mgadd.c | 2 +- src/mesa/drivers/dri/mga/mgaioctl.c | 6 +- src/mesa/drivers/dri/mga/mgapixel.c | 26 +- src/mesa/drivers/dri/mga/mgapixel.h | 2 +- src/mesa/drivers/dri/mga/mgarender.c | 4 +- src/mesa/drivers/dri/mga/mgaspan.c | 6 +- src/mesa/drivers/dri/mga/mgaspan.h | 2 +- src/mesa/drivers/dri/mga/mgastate.c | 68 ++--- src/mesa/drivers/dri/mga/mgastate.h | 8 +- src/mesa/drivers/dri/mga/mgatex.c | 16 +- src/mesa/drivers/dri/mga/mgatex.h | 4 +- src/mesa/drivers/dri/mga/mgatris.c | 26 +- src/mesa/drivers/dri/mga/mgatris.h | 8 +- src/mesa/drivers/dri/mga/mgavb.c | 16 +- src/mesa/drivers/dri/mga/mgavb.h | 16 +- src/mesa/drivers/dri/nouveau/nouveau_bo_state.c | 8 +- src/mesa/drivers/dri/nouveau/nouveau_bo_state.h | 8 +- src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c | 16 +- src/mesa/drivers/dri/nouveau/nouveau_context.c | 22 +- src/mesa/drivers/dri/nouveau/nouveau_context.h | 12 +- src/mesa/drivers/dri/nouveau/nouveau_driver.c | 8 +- src/mesa/drivers/dri/nouveau/nouveau_driver.h | 14 +- src/mesa/drivers/dri/nouveau/nouveau_fbo.c | 16 +- src/mesa/drivers/dri/nouveau/nouveau_render.h | 4 +- src/mesa/drivers/dri/nouveau/nouveau_render_t.c | 24 +- src/mesa/drivers/dri/nouveau/nouveau_span.c | 10 +- src/mesa/drivers/dri/nouveau/nouveau_state.c | 80 ++--- src/mesa/drivers/dri/nouveau/nouveau_state.h | 10 +- src/mesa/drivers/dri/nouveau/nouveau_surface.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_surface.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c | 30 +- src/mesa/drivers/dri/nouveau/nouveau_texture.c | 52 ++-- src/mesa/drivers/dri/nouveau/nouveau_texture.h | 4 +- src/mesa/drivers/dri/nouveau/nouveau_util.h | 4 +- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 26 +- src/mesa/drivers/dri/nouveau/nv04_context.c | 16 +- src/mesa/drivers/dri/nouveau/nv04_context.h | 2 +- src/mesa/drivers/dri/nouveau/nv04_driver.h | 28 +- src/mesa/drivers/dri/nouveau/nv04_render.c | 26 +- src/mesa/drivers/dri/nouveau/nv04_state_fb.c | 4 +- src/mesa/drivers/dri/nouveau/nv04_state_frag.c | 4 +- src/mesa/drivers/dri/nouveau/nv04_state_raster.c | 8 +- src/mesa/drivers/dri/nouveau/nv04_state_tex.c | 2 +- src/mesa/drivers/dri/nouveau/nv04_surface.c | 14 +- src/mesa/drivers/dri/nouveau/nv10_context.c | 22 +- src/mesa/drivers/dri/nouveau/nv10_driver.h | 100 +++---- src/mesa/drivers/dri/nouveau/nv10_render.c | 6 +- src/mesa/drivers/dri/nouveau/nv10_state_fb.c | 12 +- src/mesa/drivers/dri/nouveau/nv10_state_frag.c | 10 +- src/mesa/drivers/dri/nouveau/nv10_state_polygon.c | 16 +- src/mesa/drivers/dri/nouveau/nv10_state_raster.c | 24 +- src/mesa/drivers/dri/nouveau/nv10_state_tex.c | 6 +- src/mesa/drivers/dri/nouveau/nv10_state_tnl.c | 28 +- src/mesa/drivers/dri/nouveau/nv20_context.c | 10 +- src/mesa/drivers/dri/nouveau/nv20_driver.h | 46 +-- src/mesa/drivers/dri/nouveau/nv20_render.c | 6 +- src/mesa/drivers/dri/nouveau/nv20_state_fb.c | 4 +- src/mesa/drivers/dri/nouveau/nv20_state_frag.c | 4 +- src/mesa/drivers/dri/nouveau/nv20_state_polygon.c | 2 +- src/mesa/drivers/dri/nouveau/nv20_state_raster.c | 2 +- src/mesa/drivers/dri/nouveau/nv20_state_tex.c | 8 +- src/mesa/drivers/dri/nouveau/nv20_state_tnl.c | 22 +- src/mesa/drivers/dri/r128/r128_context.c | 2 +- src/mesa/drivers/dri/r128/r128_context.h | 2 +- src/mesa/drivers/dri/r128/r128_dd.c | 6 +- src/mesa/drivers/dri/r128/r128_ioctl.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 2 +- src/mesa/drivers/dri/r128/r128_span.c | 6 +- src/mesa/drivers/dri/r128/r128_span.h | 2 +- src/mesa/drivers/dri/r128/r128_state.c | 76 ++--- src/mesa/drivers/dri/r128/r128_state.h | 6 +- src/mesa/drivers/dri/r128/r128_tex.c | 20 +- src/mesa/drivers/dri/r128/r128_tex.h | 2 +- src/mesa/drivers/dri/r128/r128_texstate.c | 12 +- src/mesa/drivers/dri/r128/r128_tris.c | 28 +- src/mesa/drivers/dri/r128/r128_tris.h | 6 +- src/mesa/drivers/dri/r200/r200_blit.c | 2 +- src/mesa/drivers/dri/r200/r200_blit.h | 2 +- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 2 +- src/mesa/drivers/dri/r200/r200_context.c | 4 +- src/mesa/drivers/dri/r200/r200_fragshader.c | 8 +- src/mesa/drivers/dri/r200/r200_ioctl.c | 4 +- src/mesa/drivers/dri/r200/r200_ioctl.h | 2 +- src/mesa/drivers/dri/r200/r200_maos.h | 2 +- src/mesa/drivers/dri/r200/r200_maos_arrays.c | 4 +- src/mesa/drivers/dri/r200/r200_state.c | 104 +++---- src/mesa/drivers/dri/r200/r200_state.h | 18 +- src/mesa/drivers/dri/r200/r200_state_init.c | 52 ++-- src/mesa/drivers/dri/r200/r200_swtcl.c | 32 +- src/mesa/drivers/dri/r200/r200_swtcl.h | 22 +- src/mesa/drivers/dri/r200/r200_tcl.c | 20 +- src/mesa/drivers/dri/r200/r200_tcl.h | 10 +- src/mesa/drivers/dri/r200/r200_tex.c | 10 +- src/mesa/drivers/dri/r200/r200_tex.h | 6 +- src/mesa/drivers/dri/r200/r200_texstate.c | 14 +- src/mesa/drivers/dri/r200/r200_vertprog.c | 16 +- src/mesa/drivers/dri/r200/r200_vertprog.h | 2 +- src/mesa/drivers/dri/r300/r300_blit.c | 2 +- src/mesa/drivers/dri/r300/r300_blit.h | 2 +- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 36 +-- src/mesa/drivers/dri/r300/r300_cmdbuf.h | 2 +- src/mesa/drivers/dri/r300/r300_context.c | 8 +- src/mesa/drivers/dri/r300/r300_context.h | 8 +- src/mesa/drivers/dri/r300/r300_draw.c | 24 +- src/mesa/drivers/dri/r300/r300_emit.c | 8 +- src/mesa/drivers/dri/r300/r300_emit.h | 8 +- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 4 +- src/mesa/drivers/dri/r300/r300_fragprog_common.h | 2 +- src/mesa/drivers/dri/r300/r300_render.c | 4 +- src/mesa/drivers/dri/r300/r300_render.h | 4 +- src/mesa/drivers/dri/r300/r300_shader.c | 12 +- src/mesa/drivers/dri/r300/r300_state.c | 106 +++---- src/mesa/drivers/dri/r300/r300_state.h | 6 +- src/mesa/drivers/dri/r300/r300_swtcl.c | 24 +- src/mesa/drivers/dri/r300/r300_swtcl.h | 16 +- src/mesa/drivers/dri/r300/r300_tex.c | 6 +- src/mesa/drivers/dri/r300/r300_tex.h | 2 +- src/mesa/drivers/dri/r300/r300_texstate.c | 4 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 8 +- src/mesa/drivers/dri/r300/r300_vertprog.h | 2 +- src/mesa/drivers/dri/r300/radeon_context.h | 2 +- src/mesa/drivers/dri/r600/evergreen_blit.c | 4 +- src/mesa/drivers/dri/r600/evergreen_blit.h | 2 +- src/mesa/drivers/dri/r600/evergreen_chip.c | 38 +-- src/mesa/drivers/dri/r600/evergreen_context.c | 2 +- src/mesa/drivers/dri/r600/evergreen_fragprog.c | 16 +- src/mesa/drivers/dri/r600/evergreen_fragprog.h | 16 +- src/mesa/drivers/dri/r600/evergreen_ioctl.c | 2 +- src/mesa/drivers/dri/r600/evergreen_ioctl.h | 2 +- src/mesa/drivers/dri/r600/evergreen_oglprog.c | 10 +- src/mesa/drivers/dri/r600/evergreen_render.c | 26 +- src/mesa/drivers/dri/r600/evergreen_state.c | 94 +++--- src/mesa/drivers/dri/r600/evergreen_state.h | 12 +- src/mesa/drivers/dri/r600/evergreen_tex.c | 14 +- src/mesa/drivers/dri/r600/evergreen_tex.h | 4 +- src/mesa/drivers/dri/r600/evergreen_vertprog.c | 20 +- src/mesa/drivers/dri/r600/evergreen_vertprog.h | 18 +- src/mesa/drivers/dri/r600/r600_blit.c | 4 +- src/mesa/drivers/dri/r600/r600_blit.h | 2 +- src/mesa/drivers/dri/r600/r600_context.c | 8 +- src/mesa/drivers/dri/r600/r600_context.h | 6 +- src/mesa/drivers/dri/r600/r600_emit.c | 8 +- src/mesa/drivers/dri/r600/r600_emit.h | 8 +- src/mesa/drivers/dri/r600/r600_tex.c | 6 +- src/mesa/drivers/dri/r600/r600_tex.h | 2 +- src/mesa/drivers/dri/r600/r600_texstate.c | 10 +- src/mesa/drivers/dri/r600/r700_chip.c | 82 ++--- src/mesa/drivers/dri/r600/r700_clear.c | 2 +- src/mesa/drivers/dri/r600/r700_clear.h | 2 +- src/mesa/drivers/dri/r600/r700_fragprog.c | 14 +- src/mesa/drivers/dri/r600/r700_fragprog.h | 14 +- src/mesa/drivers/dri/r600/r700_oglprog.c | 10 +- src/mesa/drivers/dri/r600/r700_render.c | 26 +- src/mesa/drivers/dri/r600/r700_shader.c | 2 +- src/mesa/drivers/dri/r600/r700_shader.h | 2 +- src/mesa/drivers/dri/r600/r700_state.c | 104 +++---- src/mesa/drivers/dri/r600/r700_state.h | 10 +- src/mesa/drivers/dri/r600/r700_vertprog.c | 18 +- src/mesa/drivers/dri/r600/r700_vertprog.h | 16 +- src/mesa/drivers/dri/radeon/radeon_blit.c | 2 +- src/mesa/drivers/dri/radeon/radeon_blit.h | 2 +- .../drivers/dri/radeon/radeon_buffer_objects.c | 14 +- src/mesa/drivers/dri/radeon/radeon_common.c | 28 +- src/mesa/drivers/dri/radeon/radeon_common.h | 24 +- .../drivers/dri/radeon/radeon_common_context.c | 6 +- .../drivers/dri/radeon/radeon_common_context.h | 20 +- src/mesa/drivers/dri/radeon/radeon_context.c | 4 +- src/mesa/drivers/dri/radeon/radeon_dma.c | 6 +- src/mesa/drivers/dri/radeon/radeon_dma.h | 6 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 28 +- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 8 +- src/mesa/drivers/dri/radeon/radeon_ioctl.h | 8 +- src/mesa/drivers/dri/radeon/radeon_maos.h | 2 +- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 6 +- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 2 +- src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 4 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 2 +- src/mesa/drivers/dri/radeon/radeon_pixel_read.c | 4 +- src/mesa/drivers/dri/radeon/radeon_queryobj.c | 20 +- src/mesa/drivers/dri/radeon/radeon_queryobj.h | 8 +- src/mesa/drivers/dri/radeon/radeon_span.c | 8 +- src/mesa/drivers/dri/radeon/radeon_span.h | 2 +- src/mesa/drivers/dri/radeon/radeon_state.c | 98 +++--- src/mesa/drivers/dri/radeon/radeon_state.h | 14 +- src/mesa/drivers/dri/radeon/radeon_state_init.c | 26 +- src/mesa/drivers/dri/radeon/radeon_swtcl.c | 30 +- src/mesa/drivers/dri/radeon/radeon_swtcl.h | 18 +- src/mesa/drivers/dri/radeon/radeon_tcl.c | 20 +- src/mesa/drivers/dri/radeon/radeon_tcl.h | 10 +- src/mesa/drivers/dri/radeon/radeon_tex.c | 10 +- src/mesa/drivers/dri/radeon/radeon_tex.h | 2 +- src/mesa/drivers/dri/radeon/radeon_tex_copy.c | 6 +- src/mesa/drivers/dri/radeon/radeon_tex_getimage.c | 6 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 10 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 44 +-- src/mesa/drivers/dri/radeon/radeon_texture.h | 40 +-- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 +- src/mesa/drivers/dri/savage/savagecontext.h | 2 +- src/mesa/drivers/dri/savage/savagedd.c | 6 +- src/mesa/drivers/dri/savage/savagedd.h | 2 +- src/mesa/drivers/dri/savage/savageioctl.c | 10 +- src/mesa/drivers/dri/savage/savageioctl.h | 2 +- src/mesa/drivers/dri/savage/savagerender.c | 8 +- src/mesa/drivers/dri/savage/savagespan.c | 10 +- src/mesa/drivers/dri/savage/savagespan.h | 2 +- src/mesa/drivers/dri/savage/savagestate.c | 82 ++--- src/mesa/drivers/dri/savage/savagestate.h | 10 +- src/mesa/drivers/dri/savage/savagetex.c | 36 +-- src/mesa/drivers/dri/savage/savagetex.h | 2 +- src/mesa/drivers/dri/savage/savagetris.c | 38 +-- src/mesa/drivers/dri/savage/savagetris.h | 4 +- src/mesa/drivers/dri/sis/sis6326_clear.c | 18 +- src/mesa/drivers/dri/sis/sis6326_state.c | 48 +-- src/mesa/drivers/dri/sis/sis_clear.c | 20 +- src/mesa/drivers/dri/sis/sis_context.c | 4 +- src/mesa/drivers/dri/sis/sis_context.h | 4 +- src/mesa/drivers/dri/sis/sis_dd.c | 8 +- src/mesa/drivers/dri/sis/sis_fog.c | 2 +- src/mesa/drivers/dri/sis/sis_screen.c | 2 +- src/mesa/drivers/dri/sis/sis_span.c | 6 +- src/mesa/drivers/dri/sis/sis_span.h | 6 +- src/mesa/drivers/dri/sis/sis_state.c | 46 +-- src/mesa/drivers/dri/sis/sis_state.h | 34 +-- src/mesa/drivers/dri/sis/sis_stencil.c | 8 +- src/mesa/drivers/dri/sis/sis_stencil.h | 2 +- src/mesa/drivers/dri/sis/sis_tex.c | 22 +- src/mesa/drivers/dri/sis/sis_tex.h | 2 +- src/mesa/drivers/dri/sis/sis_texstate.c | 12 +- src/mesa/drivers/dri/sis/sis_tris.c | 28 +- src/mesa/drivers/dri/sis/sis_tris.h | 4 +- src/mesa/drivers/dri/swrast/swrast.c | 22 +- src/mesa/drivers/dri/swrast/swrast_priv.h | 4 +- src/mesa/drivers/dri/swrast/swrast_spantemp.h | 22 +- src/mesa/drivers/dri/tdfx/tdfx_context.c | 6 +- src/mesa/drivers/dri/tdfx/tdfx_context.h | 6 +- src/mesa/drivers/dri/tdfx/tdfx_dd.c | 10 +- src/mesa/drivers/dri/tdfx/tdfx_pixels.c | 10 +- src/mesa/drivers/dri/tdfx/tdfx_pixels.h | 10 +- src/mesa/drivers/dri/tdfx/tdfx_render.c | 8 +- src/mesa/drivers/dri/tdfx/tdfx_span.c | 26 +- src/mesa/drivers/dri/tdfx/tdfx_span.h | 2 +- src/mesa/drivers/dri/tdfx/tdfx_state.c | 78 ++--- src/mesa/drivers/dri/tdfx/tdfx_state.h | 14 +- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 40 +-- src/mesa/drivers/dri/tdfx/tdfx_tex.h | 18 +- src/mesa/drivers/dri/tdfx/tdfx_texman.c | 4 +- src/mesa/drivers/dri/tdfx/tdfx_texman.h | 2 +- src/mesa/drivers/dri/tdfx/tdfx_texstate.c | 20 +- src/mesa/drivers/dri/tdfx/tdfx_texstate.h | 4 +- src/mesa/drivers/dri/tdfx/tdfx_tris.c | 62 ++-- src/mesa/drivers/dri/tdfx/tdfx_tris.h | 2 +- src/mesa/drivers/dri/tdfx/tdfx_vb.c | 20 +- src/mesa/drivers/dri/tdfx/tdfx_vb.h | 12 +- src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 6 +- src/mesa/drivers/dri/unichrome/via_context.c | 12 +- src/mesa/drivers/dri/unichrome/via_context.h | 6 +- src/mesa/drivers/dri/unichrome/via_ioctl.c | 10 +- src/mesa/drivers/dri/unichrome/via_ioctl.h | 2 +- src/mesa/drivers/dri/unichrome/via_render.c | 2 +- src/mesa/drivers/dri/unichrome/via_span.c | 6 +- src/mesa/drivers/dri/unichrome/via_span.h | 6 +- src/mesa/drivers/dri/unichrome/via_state.c | 50 ++-- src/mesa/drivers/dri/unichrome/via_state.h | 8 +- src/mesa/drivers/dri/unichrome/via_tex.c | 24 +- src/mesa/drivers/dri/unichrome/via_tex.h | 2 +- src/mesa/drivers/dri/unichrome/via_tris.c | 34 +-- src/mesa/drivers/dri/unichrome/via_tris.h | 6 +- src/mesa/drivers/fbdev/glfbdev.c | 18 +- src/mesa/drivers/osmesa/osmesa.c | 28 +- src/mesa/drivers/windows/gdi/wmesa.c | 80 ++--- src/mesa/drivers/windows/gdi/wmesadef.h | 4 +- src/mesa/drivers/windows/gldirect/dglcontext.c | 4 +- src/mesa/drivers/windows/gldirect/dglcontext.h | 4 +- src/mesa/drivers/windows/gldirect/dglwgl.c | 6 +- src/mesa/drivers/windows/gldirect/dglwgl.h | 2 +- .../drivers/windows/gldirect/dx7/gld_driver_dx7.c | 56 ++-- src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h | 92 +++--- .../drivers/windows/gldirect/dx7/gld_ext_dx7.c | 4 +- .../windows/gldirect/dx7/gld_pipeline_dx7.c | 2 +- .../windows/gldirect/dx7/gld_primitive_dx7.c | 54 ++-- .../drivers/windows/gldirect/dx7/gld_texture_dx7.c | 42 +-- .../windows/gldirect/dx7/gld_vb_d3d_render_dx7.c | 4 +- .../windows/gldirect/dx7/gld_vb_mesa_render_dx7.c | 8 +- .../drivers/windows/gldirect/dx7/gld_wgl_dx7.c | 6 +- .../drivers/windows/gldirect/dx8/gld_driver_dx8.c | 56 ++-- src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h | 94 +++--- .../drivers/windows/gldirect/dx8/gld_ext_dx8.c | 4 +- .../windows/gldirect/dx8/gld_pipeline_dx8.c | 2 +- .../windows/gldirect/dx8/gld_primitive_dx8.c | 54 ++-- .../drivers/windows/gldirect/dx8/gld_texture_dx8.c | 42 +-- .../windows/gldirect/dx8/gld_vb_d3d_render_dx8.c | 4 +- .../windows/gldirect/dx8/gld_vb_mesa_render_dx8.c | 8 +- .../drivers/windows/gldirect/dx8/gld_wgl_dx8.c | 6 +- .../drivers/windows/gldirect/dx9/gld_driver_dx9.c | 58 ++-- src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h | 94 +++--- .../drivers/windows/gldirect/dx9/gld_ext_dx9.c | 4 +- .../windows/gldirect/dx9/gld_pipeline_dx9.c | 2 +- .../windows/gldirect/dx9/gld_primitive_dx9.c | 54 ++-- .../drivers/windows/gldirect/dx9/gld_texture_dx9.c | 42 +-- .../windows/gldirect/dx9/gld_vb_d3d_render_dx9.c | 6 +- .../windows/gldirect/dx9/gld_vb_mesa_render_dx9.c | 8 +- .../drivers/windows/gldirect/dx9/gld_wgl_dx9.c | 6 +- src/mesa/drivers/windows/gldirect/gld_driver.c | 2 +- src/mesa/drivers/windows/gldirect/gld_driver.h | 2 +- .../windows/gldirect/mesasw/gld_wgl_mesasw.c | 60 ++-- src/mesa/drivers/x11/xm_api.c | 14 +- src/mesa/drivers/x11/xm_buffer.c | 6 +- src/mesa/drivers/x11/xm_dd.c | 58 ++-- src/mesa/drivers/x11/xm_line.c | 10 +- src/mesa/drivers/x11/xm_span.c | 20 +- src/mesa/drivers/x11/xm_tri.c | 4 +- src/mesa/drivers/x11/xmesaP.h | 24 +- src/mesa/main/accum.c | 2 +- src/mesa/main/accum.h | 2 +- src/mesa/main/api_arrayelt.c | 12 +- src/mesa/main/api_arrayelt.h | 16 +- src/mesa/main/api_validate.c | 16 +- src/mesa/main/api_validate.h | 12 +- src/mesa/main/arrayobj.c | 24 +- src/mesa/main/arrayobj.h | 10 +- src/mesa/main/atifragshader.c | 4 +- src/mesa/main/atifragshader.h | 8 +- src/mesa/main/attrib.c | 10 +- src/mesa/main/attrib.h | 4 +- src/mesa/main/blend.c | 6 +- src/mesa/main/blend.h | 2 +- src/mesa/main/bufferobj.c | 70 ++--- src/mesa/main/bufferobj.h | 22 +- src/mesa/main/buffers.c | 6 +- src/mesa/main/buffers.h | 4 +- src/mesa/main/clear.c | 4 +- src/mesa/main/colortab.c | 2 +- src/mesa/main/condrender.c | 2 +- src/mesa/main/condrender.h | 2 +- src/mesa/main/context.c | 80 ++--- src/mesa/main/context.h | 54 ++-- src/mesa/main/dd.h | 330 ++++++++++----------- src/mesa/main/debug.c | 4 +- src/mesa/main/debug.h | 4 +- src/mesa/main/depth.c | 2 +- src/mesa/main/depth.h | 2 +- src/mesa/main/depthstencil.c | 38 +-- src/mesa/main/depthstencil.h | 10 +- src/mesa/main/dlist.c | 50 ++-- src/mesa/main/dlist.h | 20 +- src/mesa/main/drawpix.c | 2 +- src/mesa/main/drawtex.c | 2 +- src/mesa/main/enable.c | 12 +- src/mesa/main/enable.h | 4 +- src/mesa/main/eval.c | 8 +- src/mesa/main/eval.h | 6 +- src/mesa/main/extensions.c | 44 +-- src/mesa/main/extensions.h | 28 +- src/mesa/main/fbobject.c | 32 +- src/mesa/main/fbobject.h | 20 +- src/mesa/main/feedback.c | 22 +- src/mesa/main/feedback.h | 14 +- src/mesa/main/ffvertex_prog.c | 6 +- src/mesa/main/ffvertex_prog.h | 2 +- src/mesa/main/fog.c | 2 +- src/mesa/main/fog.h | 2 +- src/mesa/main/framebuffer.c | 30 +- src/mesa/main/framebuffer.h | 22 +- src/mesa/main/get.c | 32 +- src/mesa/main/getstring.c | 4 +- src/mesa/main/hash.c | 4 +- src/mesa/main/hint.c | 2 +- src/mesa/main/hint.h | 2 +- src/mesa/main/image.c | 52 ++-- src/mesa/main/image.h | 50 ++-- src/mesa/main/imports.c | 10 +- src/mesa/main/imports.h | 10 +- src/mesa/main/light.c | 28 +- src/mesa/main/light.h | 22 +- src/mesa/main/lines.c | 6 +- src/mesa/main/lines.h | 2 +- src/mesa/main/matrix.c | 40 +-- src/mesa/main/matrix.h | 8 +- src/mesa/main/mipmap.c | 2 +- src/mesa/main/mipmap.h | 2 +- src/mesa/main/mtypes.h | 88 +++--- src/mesa/main/multisample.c | 2 +- src/mesa/main/multisample.h | 2 +- src/mesa/main/nvprogram.c | 4 +- src/mesa/main/nvprogram.h | 4 +- src/mesa/main/pixel.c | 12 +- src/mesa/main/pixel.h | 6 +- src/mesa/main/pixelstore.c | 2 +- src/mesa/main/pixelstore.h | 2 +- src/mesa/main/points.c | 6 +- src/mesa/main/points.h | 2 +- src/mesa/main/polygon.c | 6 +- src/mesa/main/polygon.h | 4 +- src/mesa/main/queryobj.c | 20 +- src/mesa/main/queryobj.h | 8 +- src/mesa/main/rastpos.c | 4 +- src/mesa/main/rastpos.h | 2 +- src/mesa/main/readpix.c | 2 +- src/mesa/main/readpix.h | 2 +- src/mesa/main/renderbuffer.c | 132 ++++----- src/mesa/main/renderbuffer.h | 22 +- src/mesa/main/scissor.c | 6 +- src/mesa/main/scissor.h | 4 +- src/mesa/main/shaderapi.c | 54 ++-- src/mesa/main/shaderapi.h | 2 +- src/mesa/main/shaderobj.c | 28 +- src/mesa/main/shaderobj.h | 30 +- src/mesa/main/shared.c | 20 +- src/mesa/main/shared.h | 4 +- src/mesa/main/state.c | 32 +- src/mesa/main/state.h | 8 +- src/mesa/main/stencil.c | 16 +- src/mesa/main/stencil.h | 4 +- src/mesa/main/syncobj.c | 18 +- src/mesa/main/syncobj.h | 16 +- src/mesa/main/texcompress.c | 4 +- src/mesa/main/texcompress.h | 4 +- src/mesa/main/texcompress_s3tc.c | 2 +- src/mesa/main/texcompress_s3tc.h | 4 +- src/mesa/main/texenv.c | 14 +- src/mesa/main/texenvprogram.c | 14 +- src/mesa/main/texenvprogram.h | 2 +- src/mesa/main/texformat.c | 2 +- src/mesa/main/texformat.h | 2 +- src/mesa/main/texgetimage.c | 24 +- src/mesa/main/texgetimage.h | 4 +- src/mesa/main/teximage.c | 62 ++-- src/mesa/main/teximage.h | 32 +- src/mesa/main/texobj.c | 24 +- src/mesa/main/texobj.h | 18 +- src/mesa/main/texparam.c | 10 +- src/mesa/main/texrender.c | 22 +- src/mesa/main/texrender.h | 4 +- src/mesa/main/texstate.c | 22 +- src/mesa/main/texstate.h | 14 +- src/mesa/main/texstore.c | 38 +-- src/mesa/main/texstore.h | 34 +-- src/mesa/main/transformfeedback.c | 36 +-- src/mesa/main/transformfeedback.h | 12 +- src/mesa/main/uniforms.c | 18 +- src/mesa/main/uniforms.h | 6 +- src/mesa/main/varray.c | 14 +- src/mesa/main/varray.h | 8 +- src/mesa/main/version.c | 8 +- src/mesa/main/version.h | 2 +- src/mesa/main/viewport.c | 6 +- src/mesa/main/viewport.h | 6 +- src/mesa/main/vtxfmt.c | 8 +- src/mesa/main/vtxfmt.h | 16 +- src/mesa/program/arbprogparse.c | 4 +- src/mesa/program/arbprogparse.h | 4 +- src/mesa/program/ir_to_mesa.cpp | 16 +- src/mesa/program/ir_to_mesa.h | 8 +- src/mesa/program/nvfragparse.c | 4 +- src/mesa/program/nvfragparse.h | 2 +- src/mesa/program/nvvertparse.c | 4 +- src/mesa/program/nvvertparse.h | 2 +- src/mesa/program/prog_cache.c | 6 +- src/mesa/program/prog_cache.h | 4 +- src/mesa/program/prog_execute.c | 6 +- src/mesa/program/prog_execute.h | 8 +- src/mesa/program/prog_optimize.c | 4 +- src/mesa/program/prog_optimize.h | 2 +- src/mesa/program/prog_print.c | 4 +- src/mesa/program/prog_print.h | 2 +- src/mesa/program/prog_statevars.c | 6 +- src/mesa/program/prog_statevars.h | 4 +- src/mesa/program/program.c | 30 +- src/mesa/program/program.h | 40 +-- src/mesa/program/program_parse.tab.c | 2 +- src/mesa/program/program_parse.y | 2 +- src/mesa/program/program_parser.h | 9 +- src/mesa/program/programopt.c | 12 +- src/mesa/program/programopt.h | 8 +- src/mesa/state_tracker/st_atom.c | 2 +- src/mesa/state_tracker/st_atom_blend.c | 4 +- src/mesa/state_tracker/st_atom_depth.c | 2 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 10 +- src/mesa/state_tracker/st_atom_rasterizer.c | 2 +- src/mesa/state_tracker/st_atom_viewport.c | 2 +- src/mesa/state_tracker/st_cb_accum.c | 8 +- src/mesa/state_tracker/st_cb_accum.h | 4 +- src/mesa/state_tracker/st_cb_bitmap.c | 10 +- src/mesa/state_tracker/st_cb_blit.c | 2 +- src/mesa/state_tracker/st_cb_bufferobjects.c | 20 +- src/mesa/state_tracker/st_cb_clear.c | 12 +- src/mesa/state_tracker/st_cb_condrender.c | 4 +- src/mesa/state_tracker/st_cb_drawpixels.c | 18 +- src/mesa/state_tracker/st_cb_drawtex.c | 2 +- src/mesa/state_tracker/st_cb_eglimage.c | 6 +- src/mesa/state_tracker/st_cb_fbo.c | 22 +- src/mesa/state_tracker/st_cb_feedback.c | 10 +- src/mesa/state_tracker/st_cb_flush.c | 4 +- src/mesa/state_tracker/st_cb_program.c | 12 +- src/mesa/state_tracker/st_cb_program.h | 2 +- src/mesa/state_tracker/st_cb_queryobj.c | 12 +- src/mesa/state_tracker/st_cb_rasterpos.c | 10 +- src/mesa/state_tracker/st_cb_readpixels.c | 8 +- src/mesa/state_tracker/st_cb_readpixels.h | 4 +- src/mesa/state_tracker/st_cb_strings.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 60 ++-- src/mesa/state_tracker/st_cb_texture.h | 2 +- src/mesa/state_tracker/st_cb_viewport.c | 2 +- src/mesa/state_tracker/st_cb_xformfb.c | 14 +- src/mesa/state_tracker/st_context.c | 10 +- src/mesa/state_tracker/st_context.h | 6 +- src/mesa/state_tracker/st_draw.c | 14 +- src/mesa/state_tracker/st_draw.h | 4 +- src/mesa/state_tracker/st_draw_feedback.c | 4 +- src/mesa/state_tracker/st_extensions.c | 2 +- src/mesa/state_tracker/st_format.c | 4 +- src/mesa/state_tracker/st_format.h | 4 +- src/mesa/state_tracker/st_gen_mipmap.c | 6 +- src/mesa/state_tracker/st_gen_mipmap.h | 2 +- src/mesa/state_tracker/st_manager.c | 2 +- src/mesa/state_tracker/st_mesa_to_tgsi.c | 2 +- src/mesa/state_tracker/st_mesa_to_tgsi.h | 2 +- src/mesa/state_tracker/st_program.c | 2 +- src/mesa/state_tracker/st_program.h | 2 +- src/mesa/swrast/NOTES | 12 +- src/mesa/swrast/s_aaline.c | 6 +- src/mesa/swrast/s_aaline.h | 2 +- src/mesa/swrast/s_aalinetemp.h | 4 +- src/mesa/swrast/s_aatriangle.c | 6 +- src/mesa/swrast/s_aatriangle.h | 2 +- src/mesa/swrast/s_aatritemp.h | 2 +- src/mesa/swrast/s_accum.c | 16 +- src/mesa/swrast/s_accum.h | 2 +- src/mesa/swrast/s_alpha.c | 2 +- src/mesa/swrast/s_alpha.h | 2 +- src/mesa/swrast/s_atifragshader.c | 10 +- src/mesa/swrast/s_atifragshader.h | 2 +- src/mesa/swrast/s_bitmap.c | 4 +- src/mesa/swrast/s_blend.c | 26 +- src/mesa/swrast/s_blend.h | 4 +- src/mesa/swrast/s_blit.c | 8 +- src/mesa/swrast/s_clear.c | 8 +- src/mesa/swrast/s_context.c | 72 ++--- src/mesa/swrast/s_context.h | 34 +-- src/mesa/swrast/s_copypix.c | 14 +- src/mesa/swrast/s_depth.c | 24 +- src/mesa/swrast/s_depth.h | 12 +- src/mesa/swrast/s_drawpix.c | 12 +- src/mesa/swrast/s_feedback.c | 14 +- src/mesa/swrast/s_feedback.h | 12 +- src/mesa/swrast/s_fog.c | 4 +- src/mesa/swrast/s_fog.h | 4 +- src/mesa/swrast/s_fragprog.c | 10 +- src/mesa/swrast/s_fragprog.h | 2 +- src/mesa/swrast/s_lines.c | 8 +- src/mesa/swrast/s_lines.h | 4 +- src/mesa/swrast/s_linetemp.h | 2 +- src/mesa/swrast/s_logic.c | 8 +- src/mesa/swrast/s_logic.h | 2 +- src/mesa/swrast/s_masking.c | 2 +- src/mesa/swrast/s_masking.h | 2 +- src/mesa/swrast/s_points.c | 14 +- src/mesa/swrast/s_points.h | 4 +- src/mesa/swrast/s_readpix.c | 12 +- src/mesa/swrast/s_span.c | 32 +- src/mesa/swrast/s_span.h | 16 +- src/mesa/swrast/s_spantemp.h | 14 +- src/mesa/swrast/s_stencil.c | 20 +- src/mesa/swrast/s_stencil.h | 8 +- src/mesa/swrast/s_texcombine.c | 4 +- src/mesa/swrast/s_texcombine.h | 2 +- src/mesa/swrast/s_texfilter.c | 124 ++++---- src/mesa/swrast/s_texfilter.h | 2 +- src/mesa/swrast/s_triangle.c | 12 +- src/mesa/swrast/s_triangle.h | 6 +- src/mesa/swrast/s_tritemp.h | 2 +- src/mesa/swrast/s_zoom.c | 14 +- src/mesa/swrast/s_zoom.h | 10 +- src/mesa/swrast/swrast.h | 54 ++-- src/mesa/swrast_setup/NOTES | 12 +- src/mesa/swrast_setup/ss_context.c | 18 +- src/mesa/swrast_setup/ss_triangle.c | 16 +- src/mesa/swrast_setup/ss_triangle.h | 4 +- src/mesa/swrast_setup/ss_tritmp.h | 4 +- src/mesa/swrast_setup/ss_vb.h | 4 +- src/mesa/swrast_setup/swrast_setup.h | 10 +- src/mesa/tnl/NOTES | 18 +- src/mesa/tnl/t_context.c | 14 +- src/mesa/tnl/t_context.h | 46 +-- src/mesa/tnl/t_draw.c | 20 +- src/mesa/tnl/t_pipeline.c | 10 +- src/mesa/tnl/t_pipeline.h | 10 +- src/mesa/tnl/t_rasterpos.c | 8 +- src/mesa/tnl/t_vb_cliptmp.h | 6 +- src/mesa/tnl/t_vb_fog.c | 6 +- src/mesa/tnl/t_vb_light.c | 12 +- src/mesa/tnl/t_vb_lighttmp.h | 8 +- src/mesa/tnl/t_vb_normals.c | 6 +- src/mesa/tnl/t_vb_points.c | 4 +- src/mesa/tnl/t_vb_program.c | 20 +- src/mesa/tnl/t_vb_render.c | 8 +- src/mesa/tnl/t_vb_rendertmp.h | 24 +- src/mesa/tnl/t_vb_texgen.c | 16 +- src/mesa/tnl/t_vb_texmat.c | 4 +- src/mesa/tnl/t_vb_vertex.c | 10 +- src/mesa/tnl/t_vertex.c | 40 +-- src/mesa/tnl/t_vertex.h | 42 +-- src/mesa/tnl/t_vertex_generic.c | 14 +- src/mesa/tnl/t_vertex_sse.c | 8 +- src/mesa/tnl/t_vp_build.c | 2 +- src/mesa/tnl/t_vp_build.h | 2 +- src/mesa/tnl/tnl.h | 24 +- src/mesa/tnl_dd/imm/t_dd_imm_primtmp.h | 112 +++---- src/mesa/tnl_dd/imm/t_dd_imm_vb.c | 8 +- src/mesa/tnl_dd/imm/t_dd_imm_vbtmp.h | 6 +- src/mesa/tnl_dd/t_dd.c | 6 +- src/mesa/tnl_dd/t_dd_dmatmp.h | 48 +-- src/mesa/tnl_dd/t_dd_dmatmp2.h | 46 +-- src/mesa/tnl_dd/t_dd_rendertmp.h | 24 +- src/mesa/tnl_dd/t_dd_triemit.h | 2 +- src/mesa/tnl_dd/t_dd_tritmp.h | 10 +- src/mesa/tnl_dd/t_dd_unfilled.h | 4 +- src/mesa/tnl_dd/t_dd_vb.c | 16 +- src/mesa/tnl_dd/t_dd_vbtmp.h | 10 +- src/mesa/vbo/vbo.h | 18 +- src/mesa/vbo/vbo_context.c | 14 +- src/mesa/vbo/vbo_context.h | 4 +- src/mesa/vbo/vbo_exec.c | 6 +- src/mesa/vbo/vbo_exec.h | 14 +- src/mesa/vbo/vbo_exec_api.c | 20 +- src/mesa/vbo/vbo_exec_array.c | 24 +- src/mesa/vbo/vbo_exec_draw.c | 8 +- src/mesa/vbo/vbo_exec_eval.c | 2 +- src/mesa/vbo/vbo_rebase.c | 2 +- src/mesa/vbo/vbo_save.c | 8 +- src/mesa/vbo/vbo_save.h | 28 +- src/mesa/vbo/vbo_save_api.c | 54 ++-- src/mesa/vbo/vbo_save_draw.c | 8 +- src/mesa/vbo/vbo_save_loopback.c | 16 +- src/mesa/vbo/vbo_split.c | 2 +- src/mesa/vbo/vbo_split.h | 4 +- src/mesa/vbo/vbo_split_copy.c | 10 +- src/mesa/vbo/vbo_split_inplace.c | 4 +- src/mesa/x86/gen_matypes.c | 26 +- src/mesa/x86/mmx.h | 10 +- src/mesa/x86/mmx_blendtmp.h | 2 +- 789 files changed, 5698 insertions(+), 5701 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 7206188a06..8332633f01 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -854,7 +854,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) if (!xmdpy) return NULL; - /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */ + /* Note: the XMesaContext contains a Mesa struct gl_context struct (inheritance) */ c = (XMesaContext) CALLOC_STRUCT(xmesa_context); if (!c) return NULL; diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 5f9bbec2f0..50720040a6 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -30,12 +30,12 @@ #include "ast.h" extern "C" struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); +_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); gl_shader * read_builtins(GLenum target, const char *protos, const char **functions, unsigned count) { - GLcontext fakeCtx; + struct gl_context fakeCtx; fakeCtx.API = API_OPENGL; gl_shader *sh = _mesa_new_shader(NULL, 0, target); struct _mesa_glsl_parse_state *st = diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 691a318c1c..e8191ee9fd 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -123,12 +123,12 @@ if __name__ == "__main__": #include "ast.h" extern "C" struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); +_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); gl_shader * read_builtins(GLenum target, const char *protos, const char **functions, unsigned count) { - GLcontext fakeCtx; + struct gl_context fakeCtx; fakeCtx.API = API_OPENGL; gl_shader *sh = _mesa_new_shader(NULL, 0, target); struct _mesa_glsl_parse_state *st = diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 1337bed2b4..3b9877ec0e 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -27,7 +27,7 @@ extern "C" { #include -#include "main/core.h" /* for struct __GLcontextRec */ +#include "main/core.h" /* for struct gl_context */ } #include "ast.h" @@ -36,7 +36,7 @@ extern "C" { #include "ir_optimization.h" #include "loop_analysis.h" -_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, +_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx, GLenum target, void *mem_ctx) { switch (target) { diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index fe71c7a990..1f039e9f1b 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -41,10 +41,10 @@ enum _mesa_glsl_parser_targets { ir_shader }; -struct __GLcontextRec; +struct gl_context; struct _mesa_glsl_parse_state { - _mesa_glsl_parse_state(struct __GLcontextRec *ctx, GLenum target, + _mesa_glsl_parse_state(struct gl_context *ctx, GLenum target, void *mem_ctx); /* Callers of this talloc-based new need not call delete. It's diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c612fe5466..2cbfd78ba0 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -719,7 +719,7 @@ get_main_function_signature(gl_shader *sh) * shader is returned. */ static struct gl_shader * -link_intrastage_shaders(GLcontext *ctx, +link_intrastage_shaders(struct gl_context *ctx, struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) @@ -1386,7 +1386,7 @@ assign_varying_locations(struct gl_shader_program *prog, void -link_shaders(GLcontext *ctx, struct gl_shader_program *prog) +link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) { prog->LinkStatus = false; prog->Validated = false; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 94c14a58a7..9350592196 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -38,12 +38,12 @@ #include "loop_analysis.h" extern "C" struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); +_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); /* Copied from shader_api.c for the stand-alone compiler. */ struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) +_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) { struct gl_shader *shader; @@ -60,7 +60,7 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) } static void -initialize_context(GLcontext *ctx, gl_api api) +initialize_context(struct gl_context *ctx, gl_api api) { memset(ctx, 0, sizeof(*ctx)); @@ -160,7 +160,7 @@ const struct option compiler_opts[] = { }; void -compile_shader(GLcontext *ctx, struct gl_shader *shader) +compile_shader(struct gl_context *ctx, struct gl_shader *shader) { struct _mesa_glsl_parse_state *state = new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader); @@ -252,8 +252,8 @@ int main(int argc, char **argv) { int status = EXIT_SUCCESS; - GLcontext local_ctx; - GLcontext *ctx = &local_ctx; + struct gl_context local_ctx; + struct gl_context *ctx = &local_ctx; int c; int idx = 0; diff --git a/src/glsl/program.h b/src/glsl/program.h index 893169b6cc..db602fa9ec 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -24,4 +24,4 @@ #include "main/core.h" extern void -link_shaders(GLcontext *ctx, struct gl_shader_program *prog); +link_shaders(struct gl_context *ctx, struct gl_shader_program *prog); diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index a0bb078106..8cca50487c 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -95,7 +95,7 @@ _GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; _GLAPI_EXPORT extern const void *_glapi_Context; # define GET_DISPATCH() _glapi_tls_Dispatch -# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context +# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context #else @@ -107,13 +107,13 @@ _GLAPI_EXPORT extern void *_glapi_Context; # define GET_DISPATCH() \ (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) -# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \ +# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \ (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context()) # else # define GET_DISPATCH() _glapi_Dispatch -# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context +# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_Context # endif diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp index 8ccb93d56b..ee3415b3d1 100644 --- a/src/mesa/drivers/beos/GLView.cpp +++ b/src/mesa/drivers/beos/GLView.cpp @@ -105,7 +105,7 @@ public: MesaDriver(); ~MesaDriver(); - void Init(BGLView * bglview, GLcontext * c, struct gl_config * v, struct gl_framebuffer * b); + void Init(BGLView * bglview, struct gl_context * c, struct gl_config * v, struct gl_framebuffer * b); void LockGL(); void UnlockGL(); @@ -120,7 +120,7 @@ private: MesaDriver(const MesaDriver &rhs); // copy constructor illegal MesaDriver &operator=(const MesaDriver &rhs); // assignment oper. illegal - GLcontext * m_glcontext; + struct gl_context * m_glcontext; struct gl_config * m_glvisual; struct gl_framebuffer * m_glframebuffer; @@ -134,119 +134,119 @@ private: GLuint m_height; // Mesa Device Driver callback functions - static void UpdateState(GLcontext *ctx, GLuint new_state); - static void ClearIndex(GLcontext *ctx, GLuint index); - static void ClearColor(GLcontext *ctx, const GLfloat color[4]); - static void Clear(GLcontext *ctx, GLbitfield mask, + static void UpdateState(struct gl_context *ctx, GLuint new_state); + static void ClearIndex(struct gl_context *ctx, GLuint index); + static void ClearColor(struct gl_context *ctx, const GLfloat color[4]); + static void Clear(struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height); - static void ClearFront(GLcontext *ctx, GLboolean all, GLint x, GLint y, + static void ClearFront(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height); - static void ClearBack(GLcontext *ctx, GLboolean all, GLint x, GLint y, + static void ClearBack(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height); - static void Index(GLcontext *ctx, GLuint index); - static void Color(GLcontext *ctx, GLubyte r, GLubyte g, + static void Index(struct gl_context *ctx, GLuint index); + static void Color(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a); - static void SetBuffer(GLcontext *ctx, struct gl_framebuffer *colorBuffer, + static void SetBuffer(struct gl_context *ctx, struct gl_framebuffer *colorBuffer, GLenum mode); static void GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width, GLuint *height); - static void Error(GLcontext *ctx); - static const GLubyte * GetString(GLcontext *ctx, GLenum name); - static void Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + static void Error(struct gl_context *ctx); + static const GLubyte * GetString(struct gl_context *ctx, GLenum name); + static void Viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); // Front-buffer functions - static void WriteRGBASpanFront(const GLcontext *ctx, GLuint n, + static void WriteRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteRGBSpanFront(const GLcontext *ctx, GLuint n, + static void WriteRGBSpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][3], const GLubyte mask[]); - static void WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); - static void WriteRGBAPixelsFront(const GLcontext *ctx, GLuint n, + static void WriteRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]); - static void WriteCI32SpanFront(const GLcontext *ctx, GLuint n, + static void WriteCI32SpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[]); - static void WriteCI8SpanFront(const GLcontext *ctx, GLuint n, + static void WriteCI8SpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[]); - static void WriteMonoCISpanFront(const GLcontext *ctx, GLuint n, + static void WriteMonoCISpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[]); - static void WriteCI32PixelsFront(const GLcontext *ctx, + static void WriteCI32PixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[]); - static void WriteMonoCIPixelsFront(const GLcontext *ctx, GLuint n, + static void WriteMonoCIPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[]); - static void ReadCI32SpanFront(const GLcontext *ctx, + static void ReadCI32SpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[]); - static void ReadRGBASpanFront(const GLcontext *ctx, GLuint n, + static void ReadRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]); - static void ReadCI32PixelsFront(const GLcontext *ctx, + static void ReadCI32PixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[]); - static void ReadRGBAPixelsFront(const GLcontext *ctx, + static void ReadRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[]); // Back buffer functions - static void WriteRGBASpanBack(const GLcontext *ctx, GLuint n, + static void WriteRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteRGBSpanBack(const GLcontext *ctx, GLuint n, + static void WriteRGBSpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][3], const GLubyte mask[]); - static void WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); - static void WriteRGBAPixelsBack(const GLcontext *ctx, GLuint n, + static void WriteRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]); - static void WriteCI32SpanBack(const GLcontext *ctx, GLuint n, + static void WriteCI32SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[]); - static void WriteCI8SpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y, + static void WriteCI8SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[]); - static void WriteMonoCISpanBack(const GLcontext *ctx, GLuint n, + static void WriteMonoCISpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[]); - static void WriteCI32PixelsBack(const GLcontext *ctx, + static void WriteCI32PixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[]); - static void WriteMonoCIPixelsBack(const GLcontext *ctx, + static void WriteMonoCIPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[]); - static void ReadCI32SpanBack(const GLcontext *ctx, + static void ReadCI32SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[]); - static void ReadRGBASpanBack(const GLcontext *ctx, GLuint n, + static void ReadRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]); - static void ReadCI32PixelsBack(const GLcontext *ctx, + static void ReadCI32PixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[]); - static void ReadRGBAPixelsBack(const GLcontext *ctx, + static void ReadRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[]); @@ -319,7 +319,7 @@ BGLView::BGLView(BRect rect, char *name, functions.Viewport = md->Viewport; // create core context - GLcontext *ctx = _mesa_create_context(visual, NULL, &functions, md); + struct gl_context *ctx = _mesa_create_context(visual, NULL, &functions, md); if (! ctx) { _mesa_destroy_visual(visual); delete md; @@ -668,7 +668,7 @@ MesaDriver::~MesaDriver() } -void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, struct gl_config * visual, struct gl_framebuffer * framebuffer) +void MesaDriver::Init(BGLView * bglview, struct gl_context * ctx, struct gl_config * visual, struct gl_framebuffer * framebuffer) { m_bglview = bglview; m_glcontext = ctx; @@ -815,14 +815,14 @@ void MesaDriver::Draw(BRect updateRect) const } -void MesaDriver::Error(GLcontext *ctx) +void MesaDriver::Error(struct gl_context *ctx) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; if (md && md->m_bglview) md->m_bglview->ErrorCallback((unsigned long) ctx->ErrorValue); } -void MesaDriver::UpdateState( GLcontext *ctx, GLuint new_state ) +void MesaDriver::UpdateState( struct gl_context *ctx, GLuint new_state ) { struct swrast_device_driver * swdd = _swrast_GetDeviceDriverReference( ctx ); @@ -868,14 +868,14 @@ void MesaDriver::UpdateState( GLcontext *ctx, GLuint new_state ) } -void MesaDriver::ClearIndex(GLcontext *ctx, GLuint index) +void MesaDriver::ClearIndex(struct gl_context *ctx, GLuint index) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; md->m_clear_index = index; } -void MesaDriver::ClearColor(GLcontext *ctx, const GLfloat color[4]) +void MesaDriver::ClearColor(struct gl_context *ctx, const GLfloat color[4]) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; CLAMPED_FLOAT_TO_CHAN(md->m_clear_color[BE_RCOMP], color[0]); @@ -886,7 +886,7 @@ void MesaDriver::ClearColor(GLcontext *ctx, const GLfloat color[4]) } -void MesaDriver::Clear(GLcontext *ctx, GLbitfield mask, +void MesaDriver::Clear(struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { @@ -903,7 +903,7 @@ void MesaDriver::Clear(GLcontext *ctx, GLbitfield mask, } -void MesaDriver::ClearFront(GLcontext *ctx, +void MesaDriver::ClearFront(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height) { @@ -947,7 +947,7 @@ void MesaDriver::ClearFront(GLcontext *ctx, } -void MesaDriver::ClearBack(GLcontext *ctx, +void MesaDriver::ClearBack(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height) { @@ -984,7 +984,7 @@ void MesaDriver::ClearBack(GLcontext *ctx, } -void MesaDriver::SetBuffer(GLcontext *ctx, struct gl_framebuffer *buffer, +void MesaDriver::SetBuffer(struct gl_context *ctx, struct gl_framebuffer *buffer, GLenum mode) { /* TODO */ @@ -1028,14 +1028,14 @@ void MesaDriver::GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *widt } -void MesaDriver::Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +void MesaDriver::Viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { /* poll for window size change and realloc software Z/stencil/etc if needed */ _mesa_ResizeBuffersMESA(); } -const GLubyte *MesaDriver::GetString(GLcontext *ctx, GLenum name) +const GLubyte *MesaDriver::GetString(struct gl_context *ctx, GLenum name) { switch (name) { case GL_RENDERER: @@ -1057,7 +1057,7 @@ inline void Plot(BGLView *bglview, int x, int y) } -void MesaDriver::WriteRGBASpanFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]) @@ -1082,7 +1082,7 @@ void MesaDriver::WriteRGBASpanFront(const GLcontext *ctx, GLuint n, } } -void MesaDriver::WriteRGBSpanFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBSpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][3], const GLubyte mask[]) @@ -1107,7 +1107,7 @@ void MesaDriver::WriteRGBSpanFront(const GLcontext *ctx, GLuint n, } } -void MesaDriver::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) @@ -1131,7 +1131,7 @@ void MesaDriver::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, } } -void MesaDriver::WriteRGBAPixelsFront(const GLcontext *ctx, +void MesaDriver::WriteRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[] ) @@ -1156,7 +1156,7 @@ void MesaDriver::WriteRGBAPixelsFront(const GLcontext *ctx, } -void MesaDriver::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]) @@ -1181,21 +1181,21 @@ void MesaDriver::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint y, +void MesaDriver::WriteCI32SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) { printf("WriteCI32SpanFront() not implemented yet!\n"); // TODO } -void MesaDriver::WriteCI8SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint y, +void MesaDriver::WriteCI8SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) { printf("WriteCI8SpanFront() not implemented yet!\n"); // TODO } -void MesaDriver::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCISpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ) { @@ -1204,7 +1204,7 @@ void MesaDriver::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32PixelsFront( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI32PixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { @@ -1212,7 +1212,7 @@ void MesaDriver::WriteCI32PixelsFront( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCIPixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ) { @@ -1221,7 +1221,7 @@ void MesaDriver::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32SpanFront( const GLcontext *ctx, +void MesaDriver::ReadCI32SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[] ) { printf("ReadCI32SpanFront() not implemented yet!\n"); @@ -1229,7 +1229,7 @@ void MesaDriver::ReadCI32SpanFront( const GLcontext *ctx, } -void MesaDriver::ReadRGBASpanFront( const GLcontext *ctx, GLuint n, +void MesaDriver::ReadRGBASpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { printf("ReadRGBASpanFront() not implemented yet!\n"); @@ -1237,7 +1237,7 @@ void MesaDriver::ReadRGBASpanFront( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32PixelsFront( const GLcontext *ctx, +void MesaDriver::ReadCI32PixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[] ) { @@ -1246,7 +1246,7 @@ void MesaDriver::ReadCI32PixelsFront( const GLcontext *ctx, } -void MesaDriver::ReadRGBAPixelsFront( const GLcontext *ctx, +void MesaDriver::ReadRGBAPixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { @@ -1257,7 +1257,7 @@ void MesaDriver::ReadRGBAPixelsFront( const GLcontext *ctx, -void MesaDriver::WriteRGBASpanBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]) @@ -1287,7 +1287,7 @@ void MesaDriver::WriteRGBASpanBack(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteRGBSpanBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBSpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgb[][3], const GLubyte mask[]) @@ -1319,7 +1319,7 @@ void MesaDriver::WriteRGBSpanBack(const GLcontext *ctx, GLuint n, -void MesaDriver::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) { @@ -1347,7 +1347,7 @@ void MesaDriver::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteRGBAPixelsBack(const GLcontext *ctx, +void MesaDriver::WriteRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[] ) @@ -1394,7 +1394,7 @@ void MesaDriver::WriteRGBAPixelsBack(const GLcontext *ctx, } -void MesaDriver::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]) @@ -1437,7 +1437,7 @@ void MesaDriver::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32SpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI32SpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) { @@ -1445,7 +1445,7 @@ void MesaDriver::WriteCI32SpanBack( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteCI8SpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI8SpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) { @@ -1453,7 +1453,7 @@ void MesaDriver::WriteCI8SpanBack( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCISpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ) { @@ -1462,7 +1462,7 @@ void MesaDriver::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32PixelsBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI32PixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { @@ -1470,7 +1470,7 @@ void MesaDriver::WriteCI32PixelsBack( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCIPixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ) { @@ -1479,7 +1479,7 @@ void MesaDriver::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32SpanBack( const GLcontext *ctx, +void MesaDriver::ReadCI32SpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[] ) { printf("ReadCI32SpanBack() not implemented yet!\n"); @@ -1487,7 +1487,7 @@ void MesaDriver::ReadCI32SpanBack( const GLcontext *ctx, } -void MesaDriver::ReadRGBASpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::ReadRGBASpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; @@ -1507,7 +1507,7 @@ void MesaDriver::ReadRGBASpanBack( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32PixelsBack( const GLcontext *ctx, +void MesaDriver::ReadCI32PixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[] ) { @@ -1516,7 +1516,7 @@ void MesaDriver::ReadCI32PixelsBack( const GLcontext *ctx, } -void MesaDriver::ReadRGBAPixelsBack( const GLcontext *ctx, +void MesaDriver::ReadRGBAPixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index aee73b53bb..fc67bee98c 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -224,7 +224,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) * Only the Intel drivers use this so far. */ void -_mesa_init_driver_state(GLcontext *ctx) +_mesa_init_driver_state(struct gl_context *ctx) { ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); diff --git a/src/mesa/drivers/common/driverfuncs.h b/src/mesa/drivers/common/driverfuncs.h index 4c90ed12f6..212f307424 100644 --- a/src/mesa/drivers/common/driverfuncs.h +++ b/src/mesa/drivers/common/driverfuncs.h @@ -31,7 +31,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver); extern void -_mesa_init_driver_state(GLcontext *ctx); +_mesa_init_driver_state(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 16ca42f7b5..9946bf1990 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -284,7 +284,7 @@ struct gl_meta_state * To be called once during context creation. */ void -_mesa_meta_init(GLcontext *ctx) +_mesa_meta_init(struct gl_context *ctx) { ASSERT(!ctx->Meta); @@ -297,7 +297,7 @@ _mesa_meta_init(GLcontext *ctx) * To be called once during context destruction. */ void -_mesa_meta_free(GLcontext *ctx) +_mesa_meta_free(struct gl_context *ctx) { /* Note: Any textures, VBOs, etc, that we allocate should get * freed by the normal context destruction code. But this would be @@ -316,7 +316,7 @@ _mesa_meta_free(GLcontext *ctx) * to save and reset to their defaults */ static void -_mesa_meta_begin(GLcontext *ctx, GLbitfield state) +_mesa_meta_begin(struct gl_context *ctx, GLbitfield state) { struct save_state *save = &ctx->Meta->Save; @@ -557,7 +557,7 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) * Leave meta state. This is like a light-weight version of glPopAttrib(). */ static void -_mesa_meta_end(GLcontext *ctx) +_mesa_meta_end(struct gl_context *ctx) { struct save_state *save = &ctx->Meta->Save; const GLbitfield state = save->SavedState; @@ -824,7 +824,7 @@ invert_z(GLfloat normZ) * Choose tex target, compute max tex size, etc. */ static void -init_temp_texture(GLcontext *ctx, struct temp_texture *tex) +init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) { /* prefer texture rectangle */ if (ctx->Extensions.NV_texture_rectangle) { @@ -850,7 +850,7 @@ init_temp_texture(GLcontext *ctx, struct temp_texture *tex) * This does some one-time init if needed. */ static struct temp_texture * -get_temp_texture(GLcontext *ctx) +get_temp_texture(struct gl_context *ctx) { struct temp_texture *tex = &ctx->Meta->TempTex; @@ -868,7 +868,7 @@ get_temp_texture(GLcontext *ctx) * allocation/deallocation. */ static struct temp_texture * -get_bitmap_temp_texture(GLcontext *ctx) +get_bitmap_temp_texture(struct gl_context *ctx) { struct temp_texture *tex = &ctx->Meta->Bitmap.Tex; @@ -984,7 +984,7 @@ setup_copypix_texture(struct temp_texture *tex, * Setup/load texture for glDrawPixels. */ static void -setup_drawpix_texture(GLcontext *ctx, +setup_drawpix_texture(struct gl_context *ctx, struct temp_texture *tex, GLboolean newTex, GLenum texIntFormat, @@ -1035,7 +1035,7 @@ setup_drawpix_texture(GLcontext *ctx, * One-time init for drawing depth pixels. */ static void -init_blit_depth_pixels(GLcontext *ctx) +init_blit_depth_pixels(struct gl_context *ctx) { static const char *program = "!!ARBfp1.0\n" @@ -1072,7 +1072,7 @@ init_blit_depth_pixels(GLcontext *ctx) * normal path. */ static GLbitfield -blitframebuffer_texture(GLcontext *ctx, +blitframebuffer_texture(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) @@ -1201,7 +1201,7 @@ blitframebuffer_texture(GLcontext *ctx, * of texture mapping and polygon rendering. */ void -_mesa_meta_BlitFramebuffer(GLcontext *ctx, +_mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) @@ -1362,7 +1362,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx, * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering. */ void -_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) +_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) { struct clear_state *clear = &ctx->Meta->Clear; struct vertex { @@ -1480,7 +1480,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) * of texture mapping and polygon rendering. */ void -_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY, +_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, GLsizei width, GLsizei height, GLint dstX, GLint dstY, GLenum type) { @@ -1594,7 +1594,7 @@ _mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY, * into tiles which fit into the max texture size. */ static void -tiled_draw_pixels(GLcontext *ctx, +tiled_draw_pixels(struct gl_context *ctx, GLint tileSize, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1630,7 +1630,7 @@ tiled_draw_pixels(GLcontext *ctx, * One-time init for drawing stencil pixels. */ static void -init_draw_stencil_pixels(GLcontext *ctx) +init_draw_stencil_pixels(struct gl_context *ctx) { /* This program is run eight times, once for each stencil bit. * The stencil values to draw are found in an 8-bit alpha texture. @@ -1694,7 +1694,7 @@ init_draw_stencil_pixels(GLcontext *ctx) * One-time init for drawing depth pixels. */ static void -init_draw_depth_pixels(GLcontext *ctx) +init_draw_depth_pixels(struct gl_context *ctx) { static const char *program = "!!ARBfp1.0\n" @@ -1729,7 +1729,7 @@ init_draw_depth_pixels(GLcontext *ctx) * of texture mapping and polygon rendering. */ void -_mesa_meta_DrawPixels(GLcontext *ctx, +_mesa_meta_DrawPixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1962,7 +1962,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx, * improve performance a lot. */ void -_mesa_meta_Bitmap(GLcontext *ctx, +_mesa_meta_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap1) @@ -2111,7 +2111,7 @@ _mesa_meta_Bitmap(GLcontext *ctx, * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise */ GLboolean -_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, +_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { const GLuint fboSave = ctx->DrawBuffer->Name; @@ -2177,7 +2177,7 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, * Note: texture borders and 3D texture support not yet complete. */ void -_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, +_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap; @@ -2494,7 +2494,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, * ReadPixels() and passed to Tex[Sub]Image(). */ static GLenum -get_temp_image_type(GLcontext *ctx, GLenum baseFormat) +get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) { switch (baseFormat) { case GL_RGBA: @@ -2525,7 +2525,7 @@ get_temp_image_type(GLcontext *ctx, GLenum baseFormat) * Have to be careful with locking and meta state for pixel transfer. */ static void -copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, +copy_tex_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { @@ -2603,7 +2603,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, void -_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { @@ -2613,7 +2613,7 @@ _mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { @@ -2628,7 +2628,7 @@ _mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, * Have to be careful with locking and meta state for pixel transfer. */ static void -copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, +copy_tex_sub_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -2699,7 +2699,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, void -_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { @@ -2709,7 +2709,7 @@ _mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -2720,7 +2720,7 @@ _mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -2731,7 +2731,7 @@ _mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyColorTable(GLcontext *ctx, +_mesa_meta_CopyColorTable(struct gl_context *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { @@ -2759,7 +2759,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx, void -_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, +_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { GLfloat *buf; diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 6225b94189..b0797d3d91 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -28,89 +28,89 @@ extern void -_mesa_meta_init(GLcontext *ctx); +_mesa_meta_init(struct gl_context *ctx); extern void -_mesa_meta_free(GLcontext *ctx); +_mesa_meta_free(struct gl_context *ctx); extern void -_mesa_meta_BlitFramebuffer(GLcontext *ctx, +_mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); extern void -_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers); +_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers); extern void -_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, +_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); extern void -_mesa_meta_DrawPixels(GLcontext *ctx, +_mesa_meta_DrawPixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); extern void -_mesa_meta_Bitmap(GLcontext *ctx, +_mesa_meta_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); extern GLboolean -_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, +_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); extern void -_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, +_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); extern void -_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); extern void -_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); extern void -_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void -_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void -_mesa_meta_CopyColorTable(GLcontext *ctx, +_mesa_meta_CopyColorTable(struct gl_context *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, +_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, +_mesa_meta_CopyConvolutionFilter1D(struct gl_context *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, +_mesa_meta_CopyConvolutionFilter2D(struct gl_context *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/mesa/drivers/dri/common/depthtmp.h b/src/mesa/drivers/dri/common/depthtmp.h index fd2dab3b42..81bec9c5ff 100644 --- a/src/mesa/drivers/dri/common/depthtmp.h +++ b/src/mesa/drivers/dri/common/depthtmp.h @@ -21,7 +21,7 @@ #define HAVE_HW_DEPTH_PIXELS 0 #endif -static void TAG(WriteDepthSpan)( GLcontext *ctx, +static void TAG(WriteDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, @@ -72,7 +72,7 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, #if HAVE_HW_DEPTH_SPANS /* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ static void -TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, +TAG(WriteMonoDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -84,7 +84,7 @@ TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask); } #else -static void TAG(WriteMonoDepthSpan)( GLcontext *ctx, +static void TAG(WriteMonoDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, @@ -124,7 +124,7 @@ static void TAG(WriteMonoDepthSpan)( GLcontext *ctx, #endif -static void TAG(WriteDepthPixels)( GLcontext *ctx, +static void TAG(WriteDepthPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], @@ -173,7 +173,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, /* Read depth spans and pixels */ -static void TAG(ReadDepthSpan)( GLcontext *ctx, +static void TAG(ReadDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values ) @@ -207,7 +207,7 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, HW_READ_UNLOCK(); } -static void TAG(ReadDepthPixels)( GLcontext *ctx, +static void TAG(ReadDepthPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], diff --git a/src/mesa/drivers/dri/common/dri_metaops.c b/src/mesa/drivers/dri/common/dri_metaops.c index a2f404b616..e0bc3b88ec 100644 --- a/src/mesa/drivers/dri/common/dri_metaops.c +++ b/src/mesa/drivers/dri/common/dri_metaops.c @@ -41,7 +41,7 @@ void meta_set_passthrough_transform(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; meta->saved_vp_x = ctx->Viewport.X; meta->saved_vp_y = ctx->Viewport.Y; @@ -87,7 +87,7 @@ meta_restore_transform(struct dri_metaops *meta) void meta_set_passthrough_vertex_program(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; static const char *vp = "!!ARBvp1.0\n" "TEMP vertexClip;\n" @@ -133,7 +133,7 @@ meta_set_passthrough_vertex_program(struct dri_metaops *meta) void meta_restore_vertex_program(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; FLUSH_VERTICES(ctx, _NEW_PROGRAM); _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, @@ -155,7 +155,7 @@ meta_set_fragment_program(struct dri_metaops *meta, struct gl_fragment_program **prog, const char *prog_string) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; assert(meta->saved_fp == NULL); _mesa_reference_fragprog(ctx, &meta->saved_fp, @@ -187,7 +187,7 @@ meta_set_fragment_program(struct dri_metaops *meta, void meta_restore_fragment_program(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; FLUSH_VERTICES(ctx, _NEW_PROGRAM); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, @@ -208,7 +208,7 @@ static const float default_texcoords[4][2] = { { 0.0, 0.0 }, void meta_set_default_texrect(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; struct gl_client_array *old_texcoord_array; meta->saved_active_texture = ctx->Texture.CurrentUnit; @@ -249,7 +249,7 @@ meta_set_default_texrect(struct dri_metaops *meta) void meta_restore_texcoords(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; /* Restore the old TexCoordPointer */ if (meta->saved_texcoord_vbo) { @@ -280,7 +280,7 @@ meta_restore_texcoords(struct dri_metaops *meta) } -void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta) +void meta_init_metaops(struct gl_context *ctx, struct dri_metaops *meta) { meta->ctx = ctx; } diff --git a/src/mesa/drivers/dri/common/dri_metaops.h b/src/mesa/drivers/dri/common/dri_metaops.h index 2487145326..aa7d4baa6e 100644 --- a/src/mesa/drivers/dri/common/dri_metaops.h +++ b/src/mesa/drivers/dri/common/dri_metaops.h @@ -31,7 +31,7 @@ struct dri_metaops { - GLcontext *ctx; + struct gl_context *ctx; GLboolean internal_viewport_call; struct gl_fragment_program *bitmap_fp; struct gl_vertex_program *passthrough_vp; @@ -75,7 +75,7 @@ void meta_set_default_texrect(struct dri_metaops *meta); void meta_restore_texcoords(struct dri_metaops *meta); -void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta); +void meta_init_metaops(struct gl_context *ctx, struct dri_metaops *meta); void meta_destroy_metaops(struct dri_metaops *meta); #endif diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index c9ce6e3cb6..7ac1ab169e 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -16,7 +16,7 @@ * be used. */ static GLboolean -driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, +driRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { rb->Width = width; @@ -187,7 +187,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped) * gl_framebuffer object. */ void -driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv) +driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv) { struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate; if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) { diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h index 677511334d..0cae7309df 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.h +++ b/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -73,7 +73,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped); extern void -driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv); +driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv); #endif /* DRIRENDERBUFFER_H */ diff --git a/src/mesa/drivers/dri/common/spantmp.h b/src/mesa/drivers/dri/common/spantmp.h index cdc4f422ce..f0af5b1c58 100644 --- a/src/mesa/drivers/dri/common/spantmp.h +++ b/src/mesa/drivers/dri/common/spantmp.h @@ -42,7 +42,7 @@ #endif -static void TAG(WriteRGBASpan)( GLcontext *ctx, +static void TAG(WriteRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -85,7 +85,7 @@ static void TAG(WriteRGBASpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBSpan)( GLcontext *ctx, +static void TAG(WriteRGBSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -124,7 +124,7 @@ static void TAG(WriteRGBSpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBAPixels)( GLcontext *ctx, +static void TAG(WriteRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) @@ -170,7 +170,7 @@ static void TAG(WriteRGBAPixels)( GLcontext *ctx, } -static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, +static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, @@ -210,7 +210,7 @@ static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, } -static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, +static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -252,7 +252,7 @@ static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, } -static void TAG(ReadRGBASpan)( GLcontext *ctx, +static void TAG(ReadRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -280,7 +280,7 @@ static void TAG(ReadRGBASpan)( GLcontext *ctx, } -static void TAG(ReadRGBAPixels)( GLcontext *ctx, +static void TAG(ReadRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ) diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index 1dab7336b9..abd79562f9 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -460,7 +460,7 @@ #include "x86/common_x86_asm.h" #endif -static void TAG(WriteRGBASpan)( GLcontext *ctx, +static void TAG(WriteRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -503,7 +503,7 @@ static void TAG(WriteRGBASpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBSpan)( GLcontext *ctx, +static void TAG(WriteRGBSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -542,7 +542,7 @@ static void TAG(WriteRGBSpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBAPixels)( GLcontext *ctx, +static void TAG(WriteRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) @@ -588,7 +588,7 @@ static void TAG(WriteRGBAPixels)( GLcontext *ctx, } -static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, +static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[] ) @@ -627,7 +627,7 @@ static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, } -static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, +static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -669,7 +669,7 @@ static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, } -static void TAG(ReadRGBASpan)( GLcontext *ctx, +static void TAG(ReadRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { @@ -702,7 +702,7 @@ static void TAG(ReadRGBASpan)( GLcontext *ctx, (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \ ((SPANTMP_PIXEL_FMT == GL_RGB) && \ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5))) -static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx, +static void TAG2(ReadRGBASpan,_MMX)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { @@ -752,7 +752,7 @@ static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx, defined(USE_SSE_ASM) && \ (SPANTMP_PIXEL_FMT == GL_BGRA) && \ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) -static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx, +static void TAG2(ReadRGBASpan,_SSE2)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -787,7 +787,7 @@ static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx, defined(USE_SSE_ASM) && \ (SPANTMP_PIXEL_FMT == GL_BGRA) && \ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) -static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx, +static void TAG2(ReadRGBASpan,_SSE)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -829,7 +829,7 @@ static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx, #endif -static void TAG(ReadRGBAPixels)( GLcontext *ctx, +static void TAG(ReadRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ) diff --git a/src/mesa/drivers/dri/common/stenciltmp.h b/src/mesa/drivers/dri/common/stenciltmp.h index 2b10b9ecfe..fef0972089 100644 --- a/src/mesa/drivers/dri/common/stenciltmp.h +++ b/src/mesa/drivers/dri/common/stenciltmp.h @@ -13,7 +13,7 @@ #define HAVE_HW_STENCIL_PIXELS 0 #endif -static void TAG(WriteStencilSpan)( GLcontext *ctx, +static void TAG(WriteStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -64,7 +64,7 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx, #if HAVE_HW_STENCIL_SPANS /* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ static void -TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, +TAG(WriteMonoStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -76,7 +76,7 @@ TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, TAG(WriteStencilSpan)(ctx, rb, n, x, y, stens, mask); } #else /* HAVE_HW_STENCIL_SPANS */ -static void TAG(WriteMonoStencilSpan)( GLcontext *ctx, +static void TAG(WriteMonoStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, @@ -118,7 +118,7 @@ static void TAG(WriteMonoStencilSpan)( GLcontext *ctx, #endif /* !HAVE_HW_STENCIL_SPANS */ -static void TAG(WriteStencilPixels)( GLcontext *ctx, +static void TAG(WriteStencilPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -157,7 +157,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, /* Read stencil spans and pixels */ -static void TAG(ReadStencilSpan)( GLcontext *ctx, +static void TAG(ReadStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -190,7 +190,7 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, HW_READ_UNLOCK(); } -static void TAG(ReadStencilPixels)( GLcontext *ctx, +static void TAG(ReadStencilPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ) diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index 895139b55b..8eec07d5bc 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -89,7 +89,7 @@ driLog2( GLuint n ) */ GLboolean -driIsTextureResident( GLcontext * ctx, +driIsTextureResident( struct gl_context * ctx, struct gl_texture_object * texObj ) { driTextureObject * t; @@ -1047,7 +1047,7 @@ driCalculateMaxTextureLevels( driTexHeap * const * heaps, * \param targets Bit-mask of value texture targets */ -void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, +void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped, GLuint targets ) { struct gl_texture_object *texObj; diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index 725ba2e119..6dd07b8a1d 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -277,7 +277,7 @@ void driDestroyTextureObject( driTextureObject * t ); int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps, driTextureObject * t ); -GLboolean driIsTextureResident( GLcontext * ctx, +GLboolean driIsTextureResident( struct gl_context * ctx, struct gl_texture_object * texObj ); driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context, @@ -309,7 +309,7 @@ driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ); #define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008 #define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010 -void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, +void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped, GLuint targets ); GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index bb7f07d8f4..c195c4fd8f 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -198,7 +198,7 @@ static const struct dri_extension all_mesa_extensions[] = { * we need to add entry-points (via \c driInitSingleExtension) for those * new functions here. */ -void driInitExtensions( GLcontext * ctx, +void driInitExtensions( struct gl_context * ctx, const struct dri_extension * extensions_to_enable, GLboolean enable_imaging ) { @@ -239,7 +239,7 @@ void driInitExtensions( GLcontext * ctx, * * \sa driInitExtensions, _mesa_enable_extension, _mesa_map_function_array */ -void driInitSingleExtension( GLcontext * ctx, +void driInitSingleExtension( struct gl_context * ctx, const struct dri_extension * ext ) { if ( ext->functions != NULL ) { diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 40344a1874..6349fb4b95 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -78,10 +78,10 @@ extern unsigned driParseDebugString( const char * debug, extern unsigned driGetRendererString( char * buffer, const char * hardware_name, const char * driver_date, GLuint agp_mode ); -extern void driInitExtensions( GLcontext * ctx, +extern void driInitExtensions( struct gl_context * ctx, const struct dri_extension * card_extensions, GLboolean enable_imaging ); -extern void driInitSingleExtension( GLcontext * ctx, +extern void driInitSingleExtension( struct gl_context * ctx, const struct dri_extension * ext ); extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name, diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 35a4898aac..dc58e91e8c 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -69,7 +69,7 @@ const GLuint __driNConfigOptions = 0; #define DRIVER_DATE "20050821" -static const GLubyte *i810GetString( GLcontext *ctx, GLenum name ) +static const GLubyte *i810GetString( struct gl_context *ctx, GLenum name ) { static char buffer[128]; @@ -170,7 +170,7 @@ i810CreateContext( gl_api api, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; i810ContextPtr imesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private; @@ -268,7 +268,7 @@ i810CreateContext( gl_api api, ctx->Const.PointSizeGranularity = 1.0; /* reinitialize the context point state. - * It depend on constants in __GLcontextRec::Const + * It depend on constants in __struct gl_contextRec::Const */ _mesa_init_point(ctx); @@ -470,7 +470,7 @@ i810MakeCurrent(__DRIcontext *driContextPriv, static void i810UpdatePageFlipping( i810ContextPtr imesa ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; int front = 0; /* Determine current color drawing buffer */ @@ -552,7 +552,7 @@ i810SwapBuffers( __DRIdrawable *dPriv ) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { i810ContextPtr imesa; - GLcontext *ctx; + struct gl_context *ctx; imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = imesa->glCtx; if (ctx->Visual.doubleBufferMode) { diff --git a/src/mesa/drivers/dri/i810/i810context.h b/src/mesa/drivers/dri/i810/i810context.h index 2a09cf88f5..93c7eda7b3 100644 --- a/src/mesa/drivers/dri/i810/i810context.h +++ b/src/mesa/drivers/dri/i810/i810context.h @@ -79,7 +79,7 @@ typedef void (*i810_point_func)( i810ContextPtr, i810Vertex * ); struct i810_context_t { GLint refcount; - GLcontext *glCtx; + struct gl_context *glCtx; /* Texture object bookkeeping */ diff --git a/src/mesa/drivers/dri/i810/i810ioctl.c b/src/mesa/drivers/dri/i810/i810ioctl.c index c631543d93..4b004d54c6 100644 --- a/src/mesa/drivers/dri/i810/i810ioctl.c +++ b/src/mesa/drivers/dri/i810/i810ioctl.c @@ -47,7 +47,7 @@ static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa ) #define DEPTH_SCALE ((1<<16)-1) -static void i810Clear( GLcontext *ctx, GLbitfield mask ) +static void i810Clear( struct gl_context *ctx, GLbitfield mask ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); __DRIdrawable *dPriv = imesa->driDrawable; @@ -499,13 +499,13 @@ int i810_check_copy(int fd) return(drmCommandNone(fd, DRM_I810_DOCOPY)); } -static void i810Flush( GLcontext *ctx ) +static void i810Flush( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); I810_FIREVERTICES( imesa ); } -static void i810Finish( GLcontext *ctx ) +static void i810Finish( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); i810DmaFinish( imesa ); diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c index 205f0cebc1..45f0954bbe 100644 --- a/src/mesa/drivers/dri/i810/i810render.c +++ b/src/mesa/drivers/dri/i810/i810render.c @@ -124,7 +124,7 @@ static const GLenum reduced_prim[GL_POLYGON+1] = { /**********************************************************************/ -static GLboolean i810_run_render( GLcontext *ctx, +static GLboolean i810_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { i810ContextPtr imesa = I810_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c index b4cae4e4e0..dddab8bb51 100644 --- a/src/mesa/drivers/dri/i810/i810span.c +++ b/src/mesa/drivers/dri/i810/i810span.c @@ -81,7 +81,7 @@ do { \ /* Move locking out to get reasonable span performance. */ -void i810SpanRenderStart( GLcontext *ctx ) +void i810SpanRenderStart( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); I810_FIREVERTICES(imesa); @@ -89,14 +89,14 @@ void i810SpanRenderStart( GLcontext *ctx ) i810RegetLockQuiescent( imesa ); } -void i810SpanRenderFinish( GLcontext *ctx ) +void i810SpanRenderFinish( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); _swrast_flush( ctx ); UNLOCK_HARDWARE( imesa ); } -void i810InitSpanFuncs( GLcontext *ctx ) +void i810InitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = i810SpanRenderStart; diff --git a/src/mesa/drivers/dri/i810/i810span.h b/src/mesa/drivers/dri/i810/i810span.h index c01a2f94ae..184a37a103 100644 --- a/src/mesa/drivers/dri/i810/i810span.h +++ b/src/mesa/drivers/dri/i810/i810span.h @@ -3,10 +3,10 @@ #include "drirenderbuffer.h" -extern void i810InitSpanFuncs( GLcontext *ctx ); +extern void i810InitSpanFuncs( struct gl_context *ctx ); -extern void i810SpanRenderFinish( GLcontext *ctx ); -extern void i810SpanRenderStart( GLcontext *ctx ); +extern void i810SpanRenderFinish( struct gl_context *ctx ); +extern void i810SpanRenderStart( struct gl_context *ctx ); extern void i810SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 0c68e120b0..7c3fbb1424 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -43,7 +43,7 @@ static INLINE GLuint i810PackColor(GLuint format, } -static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) +static void i810AlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF); @@ -70,7 +70,7 @@ static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) imesa->Setup[I810_CTXREG_ZA] |= a; } -static void i810BlendEquationSeparate(GLcontext *ctx, +static void i810BlendEquationSeparate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { assert( modeRGB == modeA ); @@ -87,7 +87,7 @@ static void i810BlendEquationSeparate(GLcontext *ctx, ctx->Color.LogicOp != GL_COPY)); } -static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, +static void i810BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -156,7 +156,7 @@ static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, -static void i810DepthFunc(GLcontext *ctx, GLenum func) +static void i810DepthFunc(struct gl_context *ctx, GLenum func) { i810ContextPtr imesa = I810_CONTEXT(ctx); int zmode; @@ -178,7 +178,7 @@ static void i810DepthFunc(GLcontext *ctx, GLenum func) imesa->Setup[I810_CTXREG_LCS] |= zmode; } -static void i810DepthMask(GLcontext *ctx, GLboolean flag) +static void i810DepthMask(struct gl_context *ctx, GLboolean flag) { i810ContextPtr imesa = I810_CONTEXT(ctx); I810_STATECHANGE(imesa, I810_UPLOAD_CTX); @@ -196,7 +196,7 @@ static void i810DepthMask(GLcontext *ctx, GLboolean flag) * The i810 supports a 4x4 stipple natively, GL wants 32x32. * Fortunately stipple is usually a repeating pattern. */ -static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void i810PolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { i810ContextPtr imesa = I810_CONTEXT(ctx); const GLubyte *m = mask; @@ -250,7 +250,7 @@ static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask ) */ -static void i810Scissor( GLcontext *ctx, GLint x, GLint y, +static void i810Scissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -267,7 +267,7 @@ static void i810Scissor( GLcontext *ctx, GLint x, GLint y, } -static void i810LogicOp( GLcontext *ctx, GLenum opcode ) +static void i810LogicOp( struct gl_context *ctx, GLenum opcode ) { i810ContextPtr imesa = I810_CONTEXT(ctx); FALLBACK( imesa, I810_FALLBACK_LOGICOP, @@ -276,14 +276,14 @@ static void i810LogicOp( GLcontext *ctx, GLenum opcode ) /* Fallback to swrast for select and feedback. */ -static void i810RenderMode( GLcontext *ctx, GLenum mode ) +static void i810RenderMode( struct gl_context *ctx, GLenum mode ) { i810ContextPtr imesa = I810_CONTEXT(ctx); FALLBACK( imesa, I810_FALLBACK_RENDERMODE, (mode != GL_RENDER) ); } -void i810DrawBuffer(GLcontext *ctx, GLenum mode ) +void i810DrawBuffer(struct gl_context *ctx, GLenum mode ) { i810ContextPtr imesa = I810_CONTEXT(ctx); int front = 0; @@ -328,13 +328,13 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode ) } -static void i810ReadBuffer(GLcontext *ctx, GLenum mode ) +static void i810ReadBuffer(struct gl_context *ctx, GLenum mode ) { /* XXX anything? */ } -static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] ) +static void i810ClearColor(struct gl_context *ctx, const GLfloat color[4] ) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLubyte c[4]; @@ -351,7 +351,7 @@ static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] ) * Culling - the i810 isn't quite as clean here as the rest of * its interfaces, but it's not bad. */ -static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused) +static void i810CullFaceFrontFace(struct gl_context *ctx, GLenum unused) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint mode = LCS_CULL_BOTH; @@ -375,7 +375,7 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused) } -static void i810LineWidth( GLcontext *ctx, GLfloat widthf ) +static void i810LineWidth( struct gl_context *ctx, GLfloat widthf ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); /* AA, non-AA limits are same */ @@ -394,7 +394,7 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf ) } } -static void i810PointSize( GLcontext *ctx, GLfloat sz ) +static void i810PointSize( struct gl_context *ctx, GLfloat sz ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); /* AA, non-AA limits are same */ @@ -417,7 +417,7 @@ static void i810PointSize( GLcontext *ctx, GLfloat sz ) * Color masks */ -static void i810ColorMask(GLcontext *ctx, +static void i810ColorMask(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -444,7 +444,7 @@ static void i810ColorMask(GLcontext *ctx, /* Seperate specular not fully implemented on the i810. */ -static void i810LightModelfv(GLcontext *ctx, GLenum pname, +static void i810LightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) @@ -458,7 +458,7 @@ static void i810LightModelfv(GLcontext *ctx, GLenum pname, /* But the 815 has it... */ -static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname, +static void i810LightModelfv_i815(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) @@ -475,7 +475,7 @@ static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname, /* In Mesa 3.5 we can reliably do native flatshading. */ -static void i810ShadeModel(GLcontext *ctx, GLenum mode) +static void i810ShadeModel(struct gl_context *ctx, GLenum mode) { i810ContextPtr imesa = I810_CONTEXT(ctx); I810_STATECHANGE(imesa, I810_UPLOAD_CTX); @@ -490,7 +490,7 @@ static void i810ShadeModel(GLcontext *ctx, GLenum mode) /* ============================================================= * Fog */ -static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void i810Fogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -508,7 +508,7 @@ static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) /* ============================================================= */ -static void i810Enable(GLcontext *ctx, GLenum cap, GLboolean state) +static void i810Enable(struct gl_context *ctx, GLenum cap, GLboolean state) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -672,7 +672,7 @@ void i810EmitDrawingRectangle( i810ContextPtr imesa ) -static void i810CalcViewport( GLcontext *ctx ) +static void i810CalcViewport( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -689,14 +689,14 @@ static void i810CalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * (1.0 / 0xffff); } -static void i810Viewport( GLcontext *ctx, +static void i810Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { i810CalcViewport( ctx ); } -static void i810DepthRange( GLcontext *ctx, +static void i810DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { i810CalcViewport( ctx ); @@ -718,7 +718,7 @@ void i810PrintDirty( const char *msg, GLuint state ) -void i810InitState( GLcontext *ctx ) +void i810InitState( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); i810ScreenPrivate *i810Screen = imesa->i810Screen; @@ -953,7 +953,7 @@ void i810InitState( GLcontext *ctx ) } -static void i810InvalidateState( GLcontext *ctx, GLuint new_state ) +static void i810InvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -963,7 +963,7 @@ static void i810InvalidateState( GLcontext *ctx, GLuint new_state ) } -void i810InitStateFuncs(GLcontext *ctx) +void i810InitStateFuncs(struct gl_context *ctx) { /* Callbacks for internal Mesa events. */ diff --git a/src/mesa/drivers/dri/i810/i810state.h b/src/mesa/drivers/dri/i810/i810state.h index 118b075491..96af123765 100644 --- a/src/mesa/drivers/dri/i810/i810state.h +++ b/src/mesa/drivers/dri/i810/i810state.h @@ -3,10 +3,10 @@ #include "i810context.h" -extern void i810InitState( GLcontext *ctx ); -extern void i810InitStateFuncs( GLcontext *ctx ); +extern void i810InitState( struct gl_context *ctx ); +extern void i810InitStateFuncs( struct gl_context *ctx ); extern void i810PrintDirty( const char *msg, GLuint state ); -extern void i810DrawBuffer(GLcontext *ctx, GLenum mode ); +extern void i810DrawBuffer(struct gl_context *ctx, GLenum mode ); extern void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode ); #define FALLBACK( imesa, bit, mode ) i810Fallback( imesa, bit, mode ) diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index 5c5c80d16d..49364aeb22 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -166,7 +166,7 @@ i810SetTexBorderColor( i810TextureObjectPtr t, const GLfloat color[4] ) static i810TextureObjectPtr -i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj ) +i810AllocTexObj( struct gl_context *ctx, struct gl_texture_object *texObj ) { i810TextureObjectPtr t; i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -214,7 +214,7 @@ i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj ) } -static void i810TexParameter( GLcontext *ctx, GLenum target, +static void i810TexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -285,7 +285,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target, * Determine whether or not \c param can be used instead of * \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case. */ -static void i810TexEnv( GLcontext *ctx, GLenum target, +static void i810TexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -333,7 +333,7 @@ static void i810TexEnv( GLcontext *ctx, GLenum target, #if 0 -static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void i810TexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, @@ -348,7 +348,7 @@ static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level, } } -static void i810TexSubImage1D( GLcontext *ctx, +static void i810TexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -363,7 +363,7 @@ static void i810TexSubImage1D( GLcontext *ctx, #endif -static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void i810TexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -388,7 +388,7 @@ static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level, pixels, packing, texObj, texImage ); } -static void i810TexSubImage2D( GLcontext *ctx, +static void i810TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -410,14 +410,14 @@ static void i810TexSubImage2D( GLcontext *ctx, } -static void i810BindTexture( GLcontext *ctx, GLenum target, +static void i810BindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) ); } -static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +static void i810DeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { driTextureObject * t = (driTextureObject *) tObj->DriverData; if (t) { @@ -437,7 +437,7 @@ static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) * makes this routine pretty simple. */ static gl_format -i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +i810ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch ( internalFormat ) { @@ -524,7 +524,7 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +i810NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/i810/i810tex.h b/src/mesa/drivers/dri/i810/i810tex.h index 28958dcb4b..b396848b79 100644 --- a/src/mesa/drivers/dri/i810/i810tex.h +++ b/src/mesa/drivers/dri/i810/i810tex.h @@ -68,7 +68,7 @@ struct i810_texture_object_t { }; -void i810UpdateTextureState( GLcontext *ctx ); +void i810UpdateTextureState( struct gl_context *ctx ); void i810InitTextureFuncs( struct dd_function_table *functions ); void i810DestroyTexObj( i810ContextPtr imesa, i810TextureObjectPtr t ); diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index bff28c11c8..5b505e71a4 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -191,7 +191,7 @@ static const unsigned operand_modifiers[] = { * a reasonable place to make note of it. */ static GLboolean -i810UpdateTexEnvCombine( GLcontext *ctx, GLuint unit, +i810UpdateTexEnvCombine( struct gl_context *ctx, GLuint unit, int * color_stage, int * alpha_stage ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -533,7 +533,7 @@ i810UpdateTexEnvCombine( GLcontext *ctx, GLuint unit, return GL_TRUE; } -static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) +static GLboolean enable_tex_common( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -570,7 +570,7 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit ) +static GLboolean enable_tex_rect( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -590,7 +590,7 @@ static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit ) +static GLboolean enable_tex_2d( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -610,7 +610,7 @@ static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -static void disable_tex( GLcontext *ctx, GLuint unit ) +static void disable_tex( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -627,7 +627,7 @@ static void disable_tex( GLcontext *ctx, GLuint unit ) * 1D textures should be supported! Just use a 2D texture with the second * texture coordinate value fixed at 0.0. */ -static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit, +static void i810UpdateTexUnit( struct gl_context *ctx, GLuint unit, int * next_color_stage, int * next_alpha_stage ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -664,7 +664,7 @@ static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit, } -void i810UpdateTextureState( GLcontext *ctx ) +void i810UpdateTextureState( struct gl_context *ctx ) { static const unsigned color_pass[3] = { GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | MC_DEST_CURRENT diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c index 1492f711c9..ec22a3deb3 100644 --- a/src/mesa/drivers/dri/i810/i810tris.c +++ b/src/mesa/drivers/dri/i810/i810tris.c @@ -49,7 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i810vb.h" #include "i810ioctl.h" -static void i810RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void i810RenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -407,7 +407,7 @@ i810_fallback_tri( i810ContextPtr imesa, i810Vertex *v1, i810Vertex *v2 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[3]; i810_translate_vertex( ctx, v0, &v[0] ); i810_translate_vertex( ctx, v1, &v[1] ); @@ -421,7 +421,7 @@ i810_fallback_line( i810ContextPtr imesa, i810Vertex *v0, i810Vertex *v1 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[2]; i810_translate_vertex( ctx, v0, &v[0] ); i810_translate_vertex( ctx, v1, &v[1] ); @@ -433,7 +433,7 @@ static void i810_fallback_point( i810ContextPtr imesa, i810Vertex *v0 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[1]; i810_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -478,7 +478,7 @@ i810_fallback_point( i810ContextPtr imesa, -static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void i810RenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -502,13 +502,13 @@ static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts, tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void i810RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void i810RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } -static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void i810FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -549,7 +549,7 @@ static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, DD_TRI_STIPPLE) #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) -static void i810ChooseRenderState(GLcontext *ctx) +static void i810ChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -640,7 +640,7 @@ static const GLenum reduced_prim[GL_POLYGON+1] = { * which renders strips as strips, the equivalent calculations are * performed in i810render.c. */ -static void i810RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void i810RenderPrimitive( struct gl_context *ctx, GLenum prim ) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -656,7 +656,7 @@ static void i810RenderPrimitive( GLcontext *ctx, GLenum prim ) } } -static void i810RunPipeline( GLcontext *ctx ) +static void i810RunPipeline( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -678,7 +678,7 @@ static void i810RunPipeline( GLcontext *ctx ) _tnl_run_pipeline( ctx ); } -static void i810RenderStart( GLcontext *ctx ) +static void i810RenderStart( struct gl_context *ctx ) { /* Check for projective textureing. Make sure all texcoord * pointers point to something. (fix in mesa?) @@ -686,7 +686,7 @@ static void i810RenderStart( GLcontext *ctx ) i810CheckTexSizes( ctx ); } -static void i810RenderFinish( GLcontext *ctx ) +static void i810RenderFinish( struct gl_context *ctx ) { if (I810_CONTEXT(ctx)->RenderIndex & I810_FALLBACK_BIT) _swrast_flush( ctx ); @@ -698,7 +698,7 @@ static void i810RenderFinish( GLcontext *ctx ) /* System to flush dma and emit state changes based on the rasterized * primitive. */ -void i810RasterPrimitive( GLcontext *ctx, +void i810RasterPrimitive( struct gl_context *ctx, GLenum rprim, GLuint hwprim ) { @@ -815,7 +815,7 @@ static char *getFallbackString(GLuint bit) void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldfallback = imesa->Fallback; @@ -853,7 +853,7 @@ void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode ) /**********************************************************************/ -void i810InitTriFuncs( GLcontext *ctx ) +void i810InitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/i810/i810tris.h b/src/mesa/drivers/dri/i810/i810tris.h index ab026be0a5..07a0ebf69f 100644 --- a/src/mesa/drivers/dri/i810/i810tris.h +++ b/src/mesa/drivers/dri/i810/i810tris.h @@ -29,7 +29,7 @@ #include "main/mtypes.h" extern void i810PrintRenderState( const char *msg, GLuint state ); -extern void i810InitTriFuncs( GLcontext *ctx ); -extern void i810RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim ); +extern void i810InitTriFuncs( struct gl_context *ctx ); +extern void i810RasterPrimitive( struct gl_context *ctx, GLenum rprim, GLuint hwprim ); #endif diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c index 70301a2d2e..333e07c0ea 100644 --- a/src/mesa/drivers/dri/i810/i810vb.c +++ b/src/mesa/drivers/dri/i810/i810vb.c @@ -51,10 +51,10 @@ #define I810_MAX_SETUP 0x80 static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); + void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_size; GLuint vertex_format; } setup_tab[I810_MAX_SETUP]; @@ -335,7 +335,7 @@ static void i810PrintSetupFlags(const char *msg, GLuint flags ) -void i810CheckTexSizes( GLcontext *ctx ) +void i810CheckTexSizes( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -357,7 +357,7 @@ void i810CheckTexSizes( GLcontext *ctx ) } } -void i810BuildVertices( GLcontext *ctx, +void i810BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ) @@ -405,7 +405,7 @@ void i810BuildVertices( GLcontext *ctx, } } -void i810ChooseVertexState( GLcontext *ctx ) +void i810ChooseVertexState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -446,7 +446,7 @@ void i810ChooseVertexState( GLcontext *ctx ) -void *i810_emit_contiguous_verts( GLcontext *ctx, +void *i810_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest ) @@ -459,7 +459,7 @@ void *i810_emit_contiguous_verts( GLcontext *ctx, -void i810InitVB( GLcontext *ctx ) +void i810InitVB( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -476,7 +476,7 @@ void i810InitVB( GLcontext *ctx ) } -void i810FreeVB( GLcontext *ctx ) +void i810FreeVB( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); if (imesa->verts) { diff --git a/src/mesa/drivers/dri/i810/i810vb.h b/src/mesa/drivers/dri/i810/i810vb.h index 1f704e4569..e321518507 100644 --- a/src/mesa/drivers/dri/i810/i810vb.h +++ b/src/mesa/drivers/dri/i810/i810vb.h @@ -36,24 +36,24 @@ _NEW_FOG) -extern void i810ChooseVertexState( GLcontext *ctx ); -extern void i810CheckTexSizes( GLcontext *ctx ); -extern void i810BuildVertices( GLcontext *ctx, +extern void i810ChooseVertexState( struct gl_context *ctx ); +extern void i810CheckTexSizes( struct gl_context *ctx ); +extern void i810BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); -extern void *i810_emit_contiguous_verts( GLcontext *ctx, +extern void *i810_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest ); -extern void i810_translate_vertex( GLcontext *ctx, +extern void i810_translate_vertex( struct gl_context *ctx, const i810Vertex *src, SWvertex *dst ); -extern void i810InitVB( GLcontext *ctx ); -extern void i810FreeVB( GLcontext *ctx ); +extern void i810InitVB( struct gl_context *ctx ); +extern void i810FreeVB( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 7783de964f..abfb32be3a 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -55,7 +55,7 @@ i830CreateContext(const struct gl_config * mesaVis, struct dd_function_table functions; struct i830_context *i830 = CALLOC_STRUCT(i830_context); struct intel_context *intel = &i830->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; if (!i830) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i915/i830_context.h b/src/mesa/drivers/dri/i915/i830_context.h index 87cfa8ff0b..4d568fc0f1 100644 --- a/src/mesa/drivers/dri/i915/i830_context.h +++ b/src/mesa/drivers/dri/i915/i830_context.h @@ -205,14 +205,14 @@ extern void i830InitStateFuncs(struct dd_function_table *functions); extern void i830EmitState(struct i830_context *i830); extern void i830InitState(struct i830_context *i830); -extern void i830_update_provoking_vertex(GLcontext *ctx); +extern void i830_update_provoking_vertex(struct gl_context *ctx); /*====================================================================== * Inline conversion functions. These are better-typed than the * macros used previously: */ static INLINE struct i830_context * -i830_context(GLcontext * ctx) +i830_context(struct gl_context * ctx) { return (struct i830_context *) ctx; } diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 38e524e183..147192adc7 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -47,7 +47,7 @@ #define FILE_DEBUG_FLAG DEBUG_STATE static void -i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, +i830StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { struct i830_context *i830 = i830_context(ctx); @@ -72,7 +72,7 @@ i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, } static void -i830StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) +i830StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) { struct i830_context *i830 = i830_context(ctx); @@ -87,7 +87,7 @@ i830StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) } static void -i830StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, +i830StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { struct i830_context *i830 = i830_context(ctx); @@ -199,7 +199,7 @@ i830StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, } static void -i830AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) +i830AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) { struct i830_context *i830 = i830_context(ctx); int test = intel_translate_compare_func(func); @@ -228,7 +228,7 @@ i830AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) * I'm not sure which is correct. */ static void -i830EvalLogicOpBlendState(GLcontext * ctx) +i830EvalLogicOpBlendState(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); @@ -255,7 +255,7 @@ i830EvalLogicOpBlendState(GLcontext * ctx) } static void -i830BlendColor(GLcontext * ctx, const GLfloat color[4]) +i830BlendColor(struct gl_context * ctx, const GLfloat color[4]) { struct i830_context *i830 = i830_context(ctx); GLubyte r, g, b, a; @@ -279,7 +279,7 @@ i830BlendColor(GLcontext * ctx, const GLfloat color[4]) * change the interpretation of the blend function. */ static void -i830_set_blend_state(GLcontext * ctx) +i830_set_blend_state(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); int funcA; @@ -385,7 +385,7 @@ i830_set_blend_state(GLcontext * ctx) static void -i830BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA) +i830BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) { DBG("%s -> %s, %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(modeRGB), @@ -398,7 +398,7 @@ i830BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA) static void -i830BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB, +i830BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { DBG("%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__, @@ -417,7 +417,7 @@ i830BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB, static void -i830DepthFunc(GLcontext * ctx, GLenum func) +i830DepthFunc(struct gl_context * ctx, GLenum func) { struct i830_context *i830 = i830_context(ctx); int test = intel_translate_compare_func(func); @@ -431,7 +431,7 @@ i830DepthFunc(GLcontext * ctx, GLenum func) } static void -i830DepthMask(GLcontext * ctx, GLboolean flag) +i830DepthMask(struct gl_context * ctx, GLboolean flag) { struct i830_context *i830 = i830_context(ctx); @@ -449,7 +449,7 @@ i830DepthMask(GLcontext * ctx, GLboolean flag) /** Called from ctx->Driver.Viewport() */ static void -i830Viewport(GLcontext * ctx, +i830Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); @@ -458,7 +458,7 @@ i830Viewport(GLcontext * ctx, /** Called from ctx->Driver.DepthRange() */ static void -i830DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +i830DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) { intelCalcViewport(ctx); } @@ -470,7 +470,7 @@ i830DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) * Fortunately stipple is usually a repeating pattern. */ static void -i830PolygonStipple(GLcontext * ctx, const GLubyte * mask) +i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask) { struct i830_context *i830 = i830_context(ctx); const GLubyte *m = mask; @@ -526,7 +526,7 @@ i830PolygonStipple(GLcontext * ctx, const GLubyte * mask) * Hardware clipping */ static void -i830Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct i830_context *i830 = i830_context(ctx); int x1, y1, x2, y2; @@ -566,7 +566,7 @@ i830Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) } static void -i830LogicOp(GLcontext * ctx, GLenum opcode) +i830LogicOp(struct gl_context * ctx, GLenum opcode) { struct i830_context *i830 = i830_context(ctx); int tmp = intel_translate_logic_op(opcode); @@ -581,7 +581,7 @@ i830LogicOp(GLcontext * ctx, GLenum opcode) static void -i830CullFaceFrontFace(GLcontext * ctx, GLenum unused) +i830CullFaceFrontFace(struct gl_context * ctx, GLenum unused) { struct i830_context *i830 = i830_context(ctx); GLuint mode; @@ -609,7 +609,7 @@ i830CullFaceFrontFace(GLcontext * ctx, GLenum unused) } static void -i830LineWidth(GLcontext * ctx, GLfloat widthf) +i830LineWidth(struct gl_context * ctx, GLfloat widthf) { struct i830_context *i830 = i830_context(ctx); int width; @@ -630,7 +630,7 @@ i830LineWidth(GLcontext * ctx, GLfloat widthf) } static void -i830PointSize(GLcontext * ctx, GLfloat size) +i830PointSize(struct gl_context * ctx, GLfloat size) { struct i830_context *i830 = i830_context(ctx); GLint point_size = (int) size; @@ -650,7 +650,7 @@ i830PointSize(GLcontext * ctx, GLfloat size) */ static void -i830ColorMask(GLcontext * ctx, +i830ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { struct i830_context *i830 = i830_context(ctx); @@ -672,7 +672,7 @@ i830ColorMask(GLcontext * ctx, } static void -update_specular(GLcontext * ctx) +update_specular(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); @@ -686,7 +686,7 @@ update_specular(GLcontext * ctx) } static void -i830LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i830LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { DBG("%s\n", __FUNCTION__); @@ -698,7 +698,7 @@ i830LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) /* In Mesa 3.5 we can reliably do native flatshading. */ static void -i830ShadeModel(GLcontext * ctx, GLenum mode) +i830ShadeModel(struct gl_context * ctx, GLenum mode) { struct i830_context *i830 = i830_context(ctx); I830_STATECHANGE(i830, I830_UPLOAD_CTX); @@ -727,7 +727,7 @@ i830ShadeModel(GLcontext * ctx, GLenum mode) * Fog */ static void -i830Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i830Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { struct i830_context *i830 = i830_context(ctx); @@ -748,7 +748,7 @@ i830Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) */ static void -i830Enable(GLcontext * ctx, GLenum cap, GLboolean state) +i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state) { struct i830_context *i830 = i830_context(ctx); @@ -1067,7 +1067,7 @@ i830_init_packets(struct i830_context *i830) } void -i830_update_provoking_vertex(GLcontext * ctx) +i830_update_provoking_vertex(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); @@ -1119,7 +1119,7 @@ i830InitStateFuncs(struct dd_function_table *functions) void i830InitState(struct i830_context *i830) { - GLcontext *ctx = &i830->intel.ctx; + struct gl_context *ctx = &i830->intel.ctx; i830_init_packets(i830); diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c index 3f64be8c96..fec86c56fd 100644 --- a/src/mesa/drivers/dri/i915/i830_texblend.c +++ b/src/mesa/drivers/dri/i915/i830_texblend.c @@ -440,7 +440,7 @@ emit_passthrough(struct i830_context *i830) void i830EmitTextureBlend(struct i830_context *i830) { - GLcontext *ctx = &i830->intel.ctx; + struct gl_context *ctx = &i830->intel.ctx; GLuint unit, last_stage = 0, blendunit = 0; I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, GL_FALSE); diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index ace44430d9..b3bb8837cc 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -113,7 +113,7 @@ translate_wrap_mode(GLenum wrap) static GLboolean i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct i830_context *i830 = i830_context(ctx); struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *tObj = tUnit->_Current; diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 9f07d7760a..f7fdb78d05 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -69,7 +69,7 @@ i830_render_prevalidate(struct intel_context *intel) static void i830_render_start(struct intel_context *intel) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct i830_context *i830 = i830_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -591,7 +591,7 @@ i830_set_draw_region(struct intel_context *intel, GLuint num_regions) { struct i830_context *i830 = i830_context(&intel->ctx); - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); GLuint value; diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 6688bd8536..f943f81dd0 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -49,7 +49,7 @@ /* Override intel default. */ static void -i915InvalidateState(GLcontext * ctx, GLuint new_state) +i915InvalidateState(struct gl_context * ctx, GLuint new_state) { _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); @@ -102,7 +102,7 @@ i915CreateContext(int api, struct i915_context *i915 = (struct i915_context *) CALLOC_STRUCT(i915_context); struct intel_context *intel = &i915->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; if (!i915) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index 5f3adb3db7..2c80ded075 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -158,7 +158,7 @@ struct i915_fragment_program /* TODO: split between the stored representation of a program and * the state used to build that representation. */ - GLcontext *ctx; + struct gl_context *ctx; /* declarations contains the packet header. */ GLuint declarations[I915_MAX_DECL_INSN * 3 + 1]; @@ -337,9 +337,9 @@ extern void i915_print_ureg(const char *msg, GLuint ureg); */ extern void i915InitStateFunctions(struct dd_function_table *functions); extern void i915InitState(struct i915_context *i915); -extern void i915_update_fog(GLcontext * ctx); -extern void i915_update_stencil(GLcontext * ctx); -extern void i915_update_provoking_vertex(GLcontext *ctx); +extern void i915_update_fog(struct gl_context * ctx); +extern void i915_update_stencil(struct gl_context * ctx); +extern void i915_update_provoking_vertex(struct gl_context *ctx); /*====================================================================== @@ -359,7 +359,7 @@ extern void i915InitFragProgFuncs(struct dd_function_table *functions); * macros used previously: */ static INLINE struct i915_context * -i915_context(GLcontext * ctx) +i915_context(struct gl_context * ctx) { return (struct i915_context *) ctx; } diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 31988f3d81..c00ee415b6 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1186,7 +1186,7 @@ track_params(struct i915_fragment_program *p) static void -i915BindProgram(GLcontext * ctx, GLenum target, struct gl_program *prog) +i915BindProgram(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1209,7 +1209,7 @@ i915BindProgram(GLcontext * ctx, GLenum target, struct gl_program *prog) } static struct gl_program * -i915NewProgram(GLcontext * ctx, GLenum target, GLuint id) +i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: @@ -1237,7 +1237,7 @@ i915NewProgram(GLcontext * ctx, GLenum target, GLuint id) } static void -i915DeleteProgram(GLcontext * ctx, struct gl_program *prog) +i915DeleteProgram(struct gl_context * ctx, struct gl_program *prog) { if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1252,7 +1252,7 @@ i915DeleteProgram(GLcontext * ctx, struct gl_program *prog) static GLboolean -i915IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +i915IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { struct i915_fragment_program *p = (struct i915_fragment_program *) prog; @@ -1267,7 +1267,7 @@ i915IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) } static GLboolean -i915ProgramStringNotify(GLcontext * ctx, +i915ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { @@ -1291,7 +1291,7 @@ i915ProgramStringNotify(GLcontext * ctx, } void -i915_update_program(GLcontext *ctx) +i915_update_program(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); struct i915_context *i915 = i915_context(&intel->ctx); @@ -1316,7 +1316,7 @@ i915_update_program(GLcontext *ctx) void i915ValidateFragmentProgram(struct i915_context *i915) { - GLcontext *ctx = &i915->intel.ctx; + struct gl_context *ctx = &i915->intel.ctx; struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index 670c713785..ca1949b223 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -457,7 +457,7 @@ i915_program_error(struct i915_fragment_program *p, const char *fmt, ...) void i915_init_program(struct i915_context *i915, struct i915_fragment_program *p) { - GLcontext *ctx = &i915->intel.ctx; + struct gl_context *ctx = &i915->intel.ctx; p->translated = 0; p->params_uptodate = 0; diff --git a/src/mesa/drivers/dri/i915/i915_program.h b/src/mesa/drivers/dri/i915/i915_program.h index 0d17d04865..20a1354a41 100644 --- a/src/mesa/drivers/dri/i915/i915_program.h +++ b/src/mesa/drivers/dri/i915/i915_program.h @@ -155,6 +155,6 @@ extern void i915_upload_program(struct i915_context *i915, extern void i915_fini_program(struct i915_fragment_program *p); -extern void i915_update_program(GLcontext *ctx); +extern void i915_update_program(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 26d387f383..9508fbaf94 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -49,7 +49,7 @@ #define FILE_DEBUG_FLAG DEBUG_STATE void -i915_update_stencil(GLcontext * ctx) +i915_update_stencil(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); GLuint front_ref, front_writemask, front_mask; @@ -147,24 +147,24 @@ i915_update_stencil(GLcontext * ctx) } static void -i915StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, +i915StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { } static void -i915StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) +i915StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) { } static void -i915StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, +i915StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { } static void -i915AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) +i915AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) { struct i915_context *i915 = I915_CONTEXT(ctx); int test = intel_translate_compare_func(func); @@ -187,7 +187,7 @@ i915AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) * calls to glEnable. */ static void -i915EvalLogicOpBlendState(GLcontext * ctx) +i915EvalLogicOpBlendState(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -210,7 +210,7 @@ i915EvalLogicOpBlendState(GLcontext * ctx) } static void -i915BlendColor(GLcontext * ctx, const GLfloat color[4]) +i915BlendColor(struct gl_context * ctx, const GLfloat color[4]) { struct i915_context *i915 = I915_CONTEXT(ctx); GLubyte r, g, b, a; @@ -255,7 +255,7 @@ translate_blend_equation(GLenum mode) } static void -i915UpdateBlendState(GLcontext * ctx) +i915UpdateBlendState(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); GLuint iab = (i915->state.Ctx[I915_CTXREG_IAB] & @@ -306,7 +306,7 @@ i915UpdateBlendState(GLcontext * ctx) static void -i915BlendFuncSeparate(GLcontext * ctx, GLenum srcRGB, +i915BlendFuncSeparate(struct gl_context * ctx, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA) { i915UpdateBlendState(ctx); @@ -314,14 +314,14 @@ i915BlendFuncSeparate(GLcontext * ctx, GLenum srcRGB, static void -i915BlendEquationSeparate(GLcontext * ctx, GLenum eqRGB, GLenum eqA) +i915BlendEquationSeparate(struct gl_context * ctx, GLenum eqRGB, GLenum eqA) { i915UpdateBlendState(ctx); } static void -i915DepthFunc(GLcontext * ctx, GLenum func) +i915DepthFunc(struct gl_context * ctx, GLenum func) { struct i915_context *i915 = I915_CONTEXT(ctx); int test = intel_translate_compare_func(func); @@ -334,7 +334,7 @@ i915DepthFunc(GLcontext * ctx, GLenum func) } static void -i915DepthMask(GLcontext * ctx, GLboolean flag) +i915DepthMask(struct gl_context * ctx, GLboolean flag) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -357,7 +357,7 @@ i915DepthMask(GLcontext * ctx, GLboolean flag) * - window pos/size or FBO size */ void -intelCalcViewport(GLcontext * ctx) +intelCalcViewport(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -390,7 +390,7 @@ intelCalcViewport(GLcontext * ctx) /** Called from ctx->Driver.Viewport() */ static void -i915Viewport(GLcontext * ctx, +i915Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); @@ -399,7 +399,7 @@ i915Viewport(GLcontext * ctx, /** Called from ctx->Driver.DepthRange() */ static void -i915DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +i915DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) { intelCalcViewport(ctx); } @@ -412,7 +412,7 @@ i915DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) * Fortunately stipple is usually a repeating pattern. */ static void -i915PolygonStipple(GLcontext * ctx, const GLubyte * mask) +i915PolygonStipple(struct gl_context * ctx, const GLubyte * mask) { struct i915_context *i915 = I915_CONTEXT(ctx); const GLubyte *m; @@ -474,7 +474,7 @@ i915PolygonStipple(GLcontext * ctx, const GLubyte * mask) * Hardware clipping */ static void -i915Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +i915Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct i915_context *i915 = I915_CONTEXT(ctx); int x1, y1, x2, y2; @@ -514,7 +514,7 @@ i915Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) } static void -i915LogicOp(GLcontext * ctx, GLenum opcode) +i915LogicOp(struct gl_context * ctx, GLenum opcode) { struct i915_context *i915 = I915_CONTEXT(ctx); int tmp = intel_translate_logic_op(opcode); @@ -529,7 +529,7 @@ i915LogicOp(GLcontext * ctx, GLenum opcode) static void -i915CullFaceFrontFace(GLcontext * ctx, GLenum unused) +i915CullFaceFrontFace(struct gl_context * ctx, GLenum unused) { struct i915_context *i915 = I915_CONTEXT(ctx); GLuint mode; @@ -560,7 +560,7 @@ i915CullFaceFrontFace(GLcontext * ctx, GLenum unused) } static void -i915LineWidth(GLcontext * ctx, GLfloat widthf) +i915LineWidth(struct gl_context * ctx, GLfloat widthf) { struct i915_context *i915 = I915_CONTEXT(ctx); int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_LINE_WIDTH_MASK; @@ -579,7 +579,7 @@ i915LineWidth(GLcontext * ctx, GLfloat widthf) } static void -i915PointSize(GLcontext * ctx, GLfloat size) +i915PointSize(struct gl_context * ctx, GLfloat size) { struct i915_context *i915 = I915_CONTEXT(ctx); int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK; @@ -598,7 +598,7 @@ i915PointSize(GLcontext * ctx, GLfloat size) static void -i915PointParameterfv(GLcontext * ctx, GLenum pname, const GLfloat *params) +i915PointParameterfv(struct gl_context * ctx, GLenum pname, const GLfloat *params) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -620,7 +620,7 @@ i915PointParameterfv(GLcontext * ctx, GLenum pname, const GLfloat *params) */ static void -i915ColorMask(GLcontext * ctx, +i915ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -645,7 +645,7 @@ i915ColorMask(GLcontext * ctx, } static void -update_specular(GLcontext * ctx) +update_specular(struct gl_context * ctx) { /* A hack to trigger the rebuild of the fragment program. */ @@ -653,7 +653,7 @@ update_specular(GLcontext * ctx) } static void -i915LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i915LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { DBG("%s\n", __FUNCTION__); @@ -663,7 +663,7 @@ i915LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) } static void -i915ShadeModel(GLcontext * ctx, GLenum mode) +i915ShadeModel(struct gl_context * ctx, GLenum mode) { struct i915_context *i915 = I915_CONTEXT(ctx); I915_STATECHANGE(i915, I915_UPLOAD_CTX); @@ -684,7 +684,7 @@ i915ShadeModel(GLcontext * ctx, GLenum mode) * Fog */ void -i915_update_fog(GLcontext * ctx) +i915_update_fog(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); GLenum mode; @@ -780,7 +780,7 @@ i915_update_fog(GLcontext * ctx) } static void -i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i915Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -820,7 +820,7 @@ i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) } static void -i915Hint(GLcontext * ctx, GLenum target, GLenum state) +i915Hint(struct gl_context * ctx, GLenum target, GLenum state) { switch (target) { case GL_FOG_HINT: @@ -834,7 +834,7 @@ i915Hint(GLcontext * ctx, GLenum target, GLenum state) */ static void -i915Enable(GLcontext * ctx, GLenum cap, GLboolean state) +i915Enable(struct gl_context * ctx, GLenum cap, GLboolean state) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1093,7 +1093,7 @@ i915_init_packets(struct i915_context *i915) } void -i915_update_provoking_vertex(GLcontext * ctx) +i915_update_provoking_vertex(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1150,7 +1150,7 @@ i915InitStateFunctions(struct dd_function_table *functions) void i915InitState(struct i915_context *i915) { - GLcontext *ctx = &i915->intel.ctx; + struct gl_context *ctx = &i915->intel.ctx; i915_init_packets(i915); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index e0e7f3bc3d..c724a21496 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -130,7 +130,7 @@ translate_wrap_mode(GLenum wrap) static GLboolean i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct i915_context *i915 = i915_context(ctx); struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *tObj = tUnit->_Current; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 8fa24e4815..59dfe08563 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -530,7 +530,7 @@ i915_set_draw_region(struct intel_context *intel, GLuint num_regions) { struct i915_context *i915 = i915_context(&intel->ctx); - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); GLuint value; diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c index dc6bc9a71c..0d8ab4b507 100644 --- a/src/mesa/drivers/dri/i915/intel_render.c +++ b/src/mesa/drivers/dri/i915/intel_render.c @@ -216,7 +216,7 @@ choose_render(struct intel_context *intel, struct vertex_buffer *VB) static GLboolean -intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage) +intel_run_render(struct gl_context * ctx, struct tnl_pipeline_stage *stage) { struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index ede111b87a..b9a8aeb12f 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -55,8 +55,8 @@ #include "i830_context.h" #include "i830_reg.h" -static void intelRenderPrimitive(GLcontext * ctx, GLenum prim); -static void intelRasterPrimitive(GLcontext * ctx, GLenum rprim, +static void intelRenderPrimitive(struct gl_context * ctx, GLenum prim); +static void intelRasterPrimitive(struct gl_context * ctx, GLenum rprim, GLuint hwprim); static void @@ -427,7 +427,7 @@ intel_draw_point(struct intel_context *intel, intelVertexPtr v0) static void intel_atten_point(struct intel_context *intel, intelVertexPtr v0) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; GLfloat psz[4], col[4], restore_psz, restore_alpha; _tnl_get_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz); @@ -784,7 +784,7 @@ static void intel_fallback_tri(struct intel_context *intel, intelVertex * v0, intelVertex * v1, intelVertex * v2) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; SWvertex v[3]; if (0) @@ -805,7 +805,7 @@ static void intel_fallback_line(struct intel_context *intel, intelVertex * v0, intelVertex * v1) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; SWvertex v[2]; if (0) @@ -824,7 +824,7 @@ static void intel_fallback_point(struct intel_context *intel, intelVertex * v0) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; SWvertex v[1]; if (0) @@ -877,7 +877,7 @@ intel_fallback_point(struct intel_context *intel, static void -intelRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) +intelRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n) { struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -901,7 +901,7 @@ intelRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) } static void -intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj) +intelRenderClippedLine(struct gl_context * ctx, GLuint ii, GLuint jj) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -909,7 +909,7 @@ intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj) } static void -intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) +intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n) { struct intel_context *intel = intel_context(ctx); const GLuint vertsize = intel->vertex_size; @@ -936,7 +936,7 @@ intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED) void -intelChooseRenderState(GLcontext * ctx) +intelChooseRenderState(struct gl_context * ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct intel_context *intel = intel_context(ctx); @@ -1049,7 +1049,7 @@ static const GLenum reduced_prim[GL_POLYGON + 1] = { static void -intelRunPipeline(GLcontext * ctx) +intelRunPipeline(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); @@ -1079,7 +1079,7 @@ intelRunPipeline(GLcontext * ctx) } static void -intelRenderStart(GLcontext * ctx) +intelRenderStart(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); @@ -1089,7 +1089,7 @@ intelRenderStart(GLcontext * ctx) } static void -intelRenderFinish(GLcontext * ctx) +intelRenderFinish(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); @@ -1106,7 +1106,7 @@ intelRenderFinish(GLcontext * ctx) * primitive. */ static void -intelRasterPrimitive(GLcontext * ctx, GLenum rprim, GLuint hwprim) +intelRasterPrimitive(struct gl_context * ctx, GLenum rprim, GLuint hwprim) { struct intel_context *intel = intel_context(ctx); @@ -1129,7 +1129,7 @@ intelRasterPrimitive(GLcontext * ctx, GLenum rprim, GLuint hwprim) /* */ static void -intelRenderPrimitive(GLcontext * ctx, GLenum prim) +intelRenderPrimitive(struct gl_context * ctx, GLenum prim) { struct intel_context *intel = intel_context(ctx); @@ -1201,7 +1201,7 @@ getFallbackString(GLuint bit) void intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); const GLbitfield oldfallback = intel->Fallback; @@ -1253,7 +1253,7 @@ union fi void -intelInitTriFuncs(GLcontext * ctx) +intelInitTriFuncs(struct gl_context * ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/i915/intel_tris.h b/src/mesa/drivers/dri/i915/intel_tris.h index 55b60a47f9..ad84de828b 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.h +++ b/src/mesa/drivers/dri/i915/intel_tris.h @@ -42,9 +42,9 @@ _NEW_PROGRAM | \ _NEW_POLYGONSTIPPLE) -extern void intelInitTriFuncs(GLcontext * ctx); +extern void intelInitTriFuncs(struct gl_context * ctx); -extern void intelChooseRenderState(GLcontext * ctx); +extern void intelChooseRenderState(struct gl_context * ctx); void intel_set_prim(struct intel_context *intel, uint32_t prim); GLuint *intel_get_prim_space(struct intel_context *intel, unsigned int count); diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 8430ee0cfa..00418760da 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -39,7 +39,7 @@ void brw_update_cc_vp(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_cc_viewport ccv; memset(&ccv, 0, sizeof(ccv)); @@ -91,7 +91,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 gl_context *ctx = &brw->intel.ctx; struct brw_cc_unit_state cc; void *map; diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index a1e9dae915..15e60bf3ce 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -159,7 +159,7 @@ static void compile_clip_prog( struct brw_context *brw, static void upload_clip_prog(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct brw_clip_prog_key key; memset(&key, 0, sizeof(key)); diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index 856d8f0c6c..885167da90 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -49,7 +49,7 @@ struct brw_clip_unit_key { static void clip_unit_populate_key(struct brw_context *brw, struct brw_clip_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_CLIP_PROG */ diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index d59ba0e5e8..3c4ae8a7a4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -64,7 +64,7 @@ GLboolean brwCreateContext( int api, struct dd_function_table functions; struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context); struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; unsigned i; if (!brw) { diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 700d201f49..f205c07a72 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -763,15 +763,15 @@ void brw_upload_cs_urb_state(struct brw_context *brw); int brw_disasm (FILE *file, struct brw_instruction *inst, int gen); /* brw_state.c */ -void brw_enable(GLcontext * ctx, GLenum cap, GLboolean state); -void brw_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval); +void brw_enable(struct gl_context * ctx, GLenum cap, GLboolean state); +void brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval); /*====================================================================== * Inline conversion functions. These are better-typed than the * macros used previously: */ static INLINE struct brw_context * -brw_context( GLcontext *ctx ) +brw_context( struct gl_context *ctx ) { return (struct brw_context *)ctx; } diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 8196d8ca62..9ce0d8decd 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -55,7 +55,7 @@ */ static void calculate_curbe_offsets( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; /* CACHE_NEW_WM_PROG */ const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16; @@ -179,7 +179,7 @@ static GLfloat fixed_plane[6][4] = { */ static void prepare_constant_buffer(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); const GLuint sz = brw->curbe.total_size; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index af5c37583b..46b9120842 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -80,7 +80,7 @@ static const GLenum reduced_prim[GL_POLYGON+1] = { static GLuint brw_set_prim(struct brw_context *brw, const struct _mesa_prim *prim) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLenum mode = prim->mode; if (INTEL_DEBUG & DEBUG_PRIMS) @@ -201,7 +201,7 @@ static GLboolean check_fallbacks( struct brw_context *brw, const struct _mesa_prim *prim, GLuint nr_prims ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint i; /* XXX FIXME */ @@ -300,7 +300,7 @@ static GLboolean check_fallbacks( struct brw_context *brw, /* May fail if out of video memory for texture or vbo upload, or on * fallback conditions. */ -static GLboolean brw_try_draw_prims( GLcontext *ctx, +static GLboolean brw_try_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -423,7 +423,7 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, return retval; } -void brw_draw_prims( GLcontext *ctx, +void brw_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -467,7 +467,7 @@ void brw_draw_prims( GLcontext *ctx, void brw_draw_init( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct vbo_context *vbo = vbo_context(ctx); /* Register our drawing function: diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index 2a14db217f..1fe417296f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -28,13 +28,13 @@ #ifndef BRW_DRAW_H #define BRW_DRAW_H -#include "main/mtypes.h" /* for GLcontext... */ +#include "main/mtypes.h" /* for struct gl_context... */ #include "vbo/vbo.h" struct brw_context; -void brw_draw_prims( GLcontext *ctx, +void brw_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prims, GLuint nr_prims, @@ -48,7 +48,7 @@ void brw_draw_destroy( struct brw_context *brw ); /* brw_draw_current.c */ -void brw_init_current_values(GLcontext *ctx, +void brw_init_current_values(struct gl_context *ctx, struct gl_client_array *arrays); #endif diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index f24c4146ad..c4654360d4 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -313,7 +313,7 @@ copy_array_to_vbo_array( struct brw_context *brw, static void brw_prepare_vertices(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = intel_context(ctx); GLbitfield vs_inputs = brw->vs.prog_data->inputs_read; GLuint i; @@ -451,7 +451,7 @@ static void brw_prepare_vertices(struct brw_context *brw) static void brw_emit_vertices(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = intel_context(ctx); GLuint i; @@ -583,7 +583,7 @@ const struct brw_tracked_state brw_vertices = { static void brw_prepare_indices(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; const struct _mesa_index_buffer *index_buffer = brw->ib.ib; GLuint ib_size; diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index ba401c215c..6796fb208d 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -43,7 +43,7 @@ static GLboolean do_check_fallback(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint i; if (brw->intel.no_rast) { diff --git a/src/mesa/drivers/dri/i965/brw_fallback.h b/src/mesa/drivers/dri/i965/brw_fallback.h index 50dcdacd17..13b18b52e6 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.h +++ b/src/mesa/drivers/dri/i965/brw_fallback.h @@ -28,15 +28,15 @@ #ifndef BRW_FALLBACK_H #define BRW_FALLBACK_H -#include "main/mtypes.h" /* for GLcontext... */ +#include "main/mtypes.h" /* for struct gl_context... */ struct brw_context; struct vbo_prim; -void brw_fallback( GLcontext *ctx ); -void brw_unfallback( GLcontext *ctx ); +void brw_fallback( struct gl_context *ctx ); +void brw_unfallback( struct gl_context *ctx ); -void brw_loopback_vertex_list( GLcontext *ctx, +void brw_loopback_vertex_list( struct gl_context *ctx, const GLfloat *buffer, const GLubyte *attrsz, const struct vbo_prim *prim, diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 5e5d17504b..35bb28914e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -52,7 +52,7 @@ 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) +brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) { struct brw_shader *shader; @@ -67,7 +67,7 @@ brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) } struct gl_shader_program * -brw_new_shader_program(GLcontext *ctx, GLuint name) +brw_new_shader_program(struct gl_context *ctx, GLuint name) { struct brw_shader_program *prog; prog = talloc_zero(NULL, struct brw_shader_program); @@ -79,7 +79,7 @@ brw_new_shader_program(GLcontext *ctx, GLuint name) } GLboolean -brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) +brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader) { if (!_mesa_ir_compile_shader(ctx, shader)) return GL_FALSE; @@ -88,7 +88,7 @@ brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) } GLboolean -brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { struct intel_context *intel = intel_context(ctx); @@ -2958,7 +2958,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) { struct brw_compile *p = &c->func; struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct brw_shader *shader = NULL; struct gl_shader_program *prog = ctx->Shader.CurrentProgram; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 93cde7f5ed..929ac682b0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -375,7 +375,7 @@ public: struct brw_context *brw; const struct gl_fragment_program *fp; struct intel_context *intel; - GLcontext *ctx; + struct gl_context *ctx; struct brw_wm_compile *c; struct brw_compile *p; struct brw_shader *shader; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 8952c9e346..ad178d84b6 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -167,7 +167,7 @@ static const GLenum gs_prim[GL_POLYGON+1] = { static void populate_key( struct brw_context *brw, struct brw_gs_prog_key *key ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_VS_PROG */ diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 6eeaba7772..27d161db41 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -48,7 +48,7 @@ static void upload_blend_constant_color(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_blend_constant_color bcc; memset(&bcc, 0, sizeof(bcc)); @@ -76,7 +76,7 @@ const struct brw_tracked_state brw_blend_constant_color = { static void upload_drawing_rect(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; BEGIN_BATCH(4); OUT_BATCH(_3DSTATE_DRAWRECT_INFO_I965); @@ -335,7 +335,7 @@ const struct brw_tracked_state brw_depthbuffer = { static void upload_polygon_stipple(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_polygon_stipple bps; GLuint i; @@ -378,7 +378,7 @@ const struct brw_tracked_state brw_polygon_stipple = { static void upload_polygon_stipple_offset(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_polygon_stipple_offset bpso; memset(&bpso, 0, sizeof(bpso)); @@ -449,7 +449,7 @@ const struct brw_tracked_state brw_aa_line_parameters = { static void upload_line_stipple(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_line_stipple bls; GLfloat tmp; GLint tmpi; diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 3e52be5d4b..8bc255a1c0 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -41,7 +41,7 @@ #include "brw_context.h" #include "brw_wm.h" -static void brwBindProgram( GLcontext *ctx, +static void brwBindProgram( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -57,7 +57,7 @@ static void brwBindProgram( GLcontext *ctx, } } -static struct gl_program *brwNewProgram( GLcontext *ctx, +static struct gl_program *brwNewProgram( struct gl_context *ctx, GLenum target, GLuint id ) { @@ -93,14 +93,14 @@ static struct gl_program *brwNewProgram( GLcontext *ctx, } } -static void brwDeleteProgram( GLcontext *ctx, +static void brwDeleteProgram( struct gl_context *ctx, struct gl_program *prog ) { _mesa_delete_program( ctx, prog ); } -static GLboolean brwIsProgramNative( GLcontext *ctx, +static GLboolean brwIsProgramNative( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -108,7 +108,7 @@ static GLboolean brwIsProgramNative( GLcontext *ctx, } static void -shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg) +shader_error(struct gl_context *ctx, struct gl_program *prog, const char *msg) { struct gl_shader_program *shader; @@ -120,7 +120,7 @@ shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg) } } -static GLboolean brwProgramStringNotify( GLcontext *ctx, +static GLboolean brwProgramStringNotify( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index 1b183735d7..f28f28663e 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -72,7 +72,7 @@ brw_queryobj_get_results(struct brw_query_object *query) } static struct gl_query_object * -brw_new_query_object(GLcontext *ctx, GLuint id) +brw_new_query_object(struct gl_context *ctx, GLuint id) { struct brw_query_object *query; @@ -87,7 +87,7 @@ brw_new_query_object(GLcontext *ctx, GLuint id) } static void -brw_delete_query(GLcontext *ctx, struct gl_query_object *q) +brw_delete_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; @@ -96,7 +96,7 @@ brw_delete_query(GLcontext *ctx, struct gl_query_object *q) } static void -brw_begin_query(GLcontext *ctx, struct gl_query_object *q) +brw_begin_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct intel_context *intel = intel_context(ctx); @@ -146,7 +146,7 @@ brw_begin_query(GLcontext *ctx, struct gl_query_object *q) * Begin the ARB_occlusion_query query on a query object. */ static void -brw_end_query(GLcontext *ctx, struct gl_query_object *q) +brw_end_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct intel_context *intel = intel_context(ctx); @@ -197,7 +197,7 @@ brw_end_query(GLcontext *ctx, struct gl_query_object *q) } } -static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q) +static void brw_wait_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; @@ -205,7 +205,7 @@ static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q) query->Base.Ready = GL_TRUE; } -static void brw_check_query(GLcontext *ctx, struct gl_query_object *q) +static void brw_check_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 7d005d278f..7dbd70daae 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -132,7 +132,7 @@ static void compile_sf_prog( struct brw_context *brw, */ static void upload_sf_prog(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_sf_prog_key key; memset(&key, 0, sizeof(key)); diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 914f275cc6..6ad9e1b48a 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -38,7 +38,7 @@ static void upload_sf_vp(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; struct brw_sf_viewport sfv; GLfloat y_scale, y_bias; @@ -139,7 +139,7 @@ struct brw_sf_unit_key { static void sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_SF_PROG */ diff --git a/src/mesa/drivers/dri/i965/brw_state.c b/src/mesa/drivers/dri/i965/brw_state.c index 1e77e427d3..13b231d5cf 100644 --- a/src/mesa/drivers/dri/i965/brw_state.c +++ b/src/mesa/drivers/dri/i965/brw_state.c @@ -28,7 +28,7 @@ #include "brw_context.h" void -brw_enable(GLcontext *ctx, GLenum cap, GLboolean state) +brw_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { struct brw_context *brw = brw_context(ctx); @@ -40,7 +40,7 @@ brw_enable(GLcontext *ctx, GLenum cap, GLboolean state) } void -brw_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval) +brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval) { struct brw_context *brw = brw_context(ctx); diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 1aadd5ca61..73940a5156 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -336,7 +336,7 @@ brw_print_dirty_count(struct dirty_bit_map *bit_map, int32_t bits) */ void brw_validate_state( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; struct brw_state_flags *state = &brw->state.dirty; GLuint i; diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index e911b105b2..39dfd34f4c 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -45,7 +45,7 @@ */ void brw_validate_textures( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; int i; diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index b0cfd4fe1e..4a41c7a517 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -43,7 +43,7 @@ static void do_vs_prog( struct brw_context *brw, struct brw_vertex_program *vp, struct brw_vs_prog_key *key ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint program_size; const GLuint *program; struct brw_vs_compile c; @@ -115,7 +115,7 @@ static void do_vs_prog( struct brw_context *brw, static void brw_upload_vs_prog(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_vs_prog_key key; struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program; diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index 249a800bf4..47cc0a7da7 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -190,7 +190,7 @@ static GLuint get_input_size(struct brw_context *brw, */ static void calc_wm_input_sizes( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; /* BRW_NEW_VERTEX_PROGRAM */ const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 9b2dd5b3d1..ebae94269f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -51,7 +51,7 @@ struct brw_vs_unit_key { static void vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index 0250a68d29..eabac51160 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -45,7 +45,7 @@ static void prepare_vs_constants(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; struct brw_vertex_program *vp = (struct brw_vertex_program *) brw->vertex_program; @@ -101,7 +101,7 @@ const struct brw_tracked_state brw_vs_constants = { * Sets brw->vs.surf_bo[surf] and brw->vp->const_buffer. */ static void -brw_update_vs_constant_surface( GLcontext *ctx, +brw_update_vs_constant_surface( struct gl_context *ctx, GLuint surf) { struct brw_context *brw = brw_context(ctx); @@ -151,7 +151,7 @@ prepare_vs_surfaces(struct brw_context *brw) */ static void upload_vs_surfaces(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; uint32_t *bind; int i; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 2ea5967df1..7aad6caf71 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -216,7 +216,7 @@ 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; + struct gl_context *ctx = &brw->intel.ctx; /* BRW_NEW_FRAGMENT_PROGRAM */ const struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 97bcf3821a..a094c45a7e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -467,10 +467,10 @@ void emit_xpd(struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1); -GLboolean brw_compile_shader(GLcontext *ctx, +GLboolean brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader); -GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog); -struct gl_shader *brw_new_shader(GLcontext *ctx, GLuint name, GLuint type); -struct gl_shader_program *brw_new_shader_program(GLcontext *ctx, GLuint name); +GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); +struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type); +struct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name); #endif 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 f9c48140fb..fea96d3538 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -233,7 +233,7 @@ static void brw_wm_sampler_populate_key(struct brw_context *brw, struct wm_sampler_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; int unit; char *last_entry_end = ((char*)&key->sampler_count) + sizeof(key->sampler_count); @@ -301,7 +301,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw, */ static void upload_wm_samplers( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct wm_sampler_key key; int i, sampler_key_size; diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 6699d0a73e..8cadedadfd 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -58,7 +58,7 @@ struct brw_wm_unit_key { static void wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const struct gl_fragment_program *fp = brw->fragment_program; const struct brw_fragment_program *bfp = (struct brw_fragment_program *) fp; struct intel_context *intel = &brw->intel; 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 37104f1f23..5588702afc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -209,7 +209,7 @@ brw_set_surface_tiling(struct brw_surface_state *surf, uint32_t tiling) } static void -brw_update_texture_surface( GLcontext *ctx, GLuint unit ) +brw_update_texture_surface( struct gl_context *ctx, GLuint unit ) { struct brw_context *brw = brw_context(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; @@ -315,7 +315,7 @@ brw_create_constant_surface(struct brw_context *brw, static void prepare_wm_constants(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; @@ -407,7 +407,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, unsigned int unit) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; drm_intel_bo *region_bo = NULL; struct intel_renderbuffer *irb = intel_renderbuffer(rb); struct intel_region *region = irb ? irb->region : NULL; @@ -572,7 +572,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, static void prepare_wm_surfaces(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; int i; int nr_surfaces = 0; @@ -619,7 +619,7 @@ prepare_wm_surfaces(struct brw_context *brw) static void upload_wm_surfaces(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint i; /* _NEW_BUFFERS | _NEW_COLOR */ diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c index 26f1070a16..4a98e26862 100644 --- a/src/mesa/drivers/dri/i965/gen6_cc.c +++ b/src/mesa/drivers/dri/i965/gen6_cc.c @@ -49,7 +49,7 @@ static void blend_state_populate_key(struct brw_context *brw, struct gen6_blend_state_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); @@ -181,7 +181,7 @@ static void color_calc_state_populate_key(struct brw_context *brw, struct gen6_color_calc_state_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c index e8bca83e3a..bf53146f11 100644 --- a/src/mesa/drivers/dri/i965/gen6_clip_state.c +++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c @@ -34,7 +34,7 @@ static void upload_clip_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; uint32_t depth_clamp = 0; uint32_t provoking; diff --git a/src/mesa/drivers/dri/i965/gen6_depthstencil.c b/src/mesa/drivers/dri/i965/gen6_depthstencil.c index d9eca9af35..96e6eade6b 100644 --- a/src/mesa/drivers/dri/i965/gen6_depthstencil.c +++ b/src/mesa/drivers/dri/i965/gen6_depthstencil.c @@ -41,7 +41,7 @@ static void depth_stencil_state_populate_key(struct brw_context *brw, struct brw_depth_stencil_state_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const unsigned back = ctx->Stencil._BackFace; memset(key, 0, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/gen6_scissor_state.c b/src/mesa/drivers/dri/i965/gen6_scissor_state.c index 3d483c710c..5684c2e44c 100644 --- a/src/mesa/drivers/dri/i965/gen6_scissor_state.c +++ b/src/mesa/drivers/dri/i965/gen6_scissor_state.c @@ -33,7 +33,7 @@ static void prepare_scissor_state(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0); struct gen6_scissor_rect scissor; diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index ba7f965c11..377b3a41bd 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -64,7 +64,7 @@ static void upload_sf_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; /* 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); diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c index 84bea323f8..b515e7712e 100644 --- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c @@ -65,7 +65,7 @@ const struct brw_tracked_state gen6_clip_vp = { static void prepare_sf_vp(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; struct brw_sf_viewport sfv; GLfloat y_scale, y_bias; diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index 50047a33a8..3eca4e971b 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -37,7 +37,7 @@ static void upload_vs_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); unsigned int nr_params = vp->program.Base.Parameters->NumParameters; diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 4a9df48ea4..5810266635 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -37,7 +37,7 @@ static void prepare_wm_constants(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct brw_fragment_program *fp = brw_fragment_program_const(brw->fragment_program); @@ -81,7 +81,7 @@ static void upload_wm_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct brw_fragment_program *fp = brw_fragment_program_const(brw->fragment_program); uint32_t dw2, dw4, dw5, dw6; diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 2c85ad3c36..a74e21720f 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -210,7 +210,7 @@ intelEmitCopyBlit(struct intel_context *intel, * \param mask bitmask of BUFFER_BIT_* values indicating buffers to clear */ void -intelClearWithBlit(GLcontext *ctx, GLbitfield mask) +intelClearWithBlit(struct gl_context *ctx, GLbitfield mask) { struct intel_context *intel = intel_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 70d277df3c..0163146573 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -33,7 +33,7 @@ extern void intelCopyBuffer(const __DRIdrawable * dpriv, const drm_clip_rect_t * rect); -extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask); +extern void intelClearWithBlit(struct gl_context * ctx, GLbitfield mask); GLboolean intelEmitCopyBlit(struct intel_context *intel, diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 117d4daf3b..1e99f9040a 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -40,7 +40,7 @@ #include "intel_regions.h" static GLboolean -intel_bufferobj_unmap(GLcontext * ctx, +intel_bufferobj_unmap(struct gl_context * ctx, GLenum target, struct gl_buffer_object *obj); /** Allocates a new drm_intel_bo to store the data for the buffer object. */ @@ -59,7 +59,7 @@ intel_bufferobj_alloc_buffer(struct intel_context *intel, * internal structure where somehow shared. */ static struct gl_buffer_object * -intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target) +intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target) { struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object); @@ -101,7 +101,7 @@ intel_bufferobj_cow(struct intel_context *intel, * Called via glDeleteBuffersARB(). */ static void -intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) +intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj) { struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -136,7 +136,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) * \return GL_TRUE for success, GL_FALSE if out of memory */ static GLboolean -intel_bufferobj_data(GLcontext * ctx, +intel_bufferobj_data(struct gl_context * ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, @@ -193,7 +193,7 @@ intel_bufferobj_data(GLcontext * ctx, * Called via glBufferSubDataARB(). */ static void -intel_bufferobj_subdata(GLcontext * ctx, +intel_bufferobj_subdata(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -239,7 +239,7 @@ intel_bufferobj_subdata(GLcontext * ctx, * Called via glGetBufferSubDataARB(). */ static void -intel_bufferobj_get_subdata(GLcontext * ctx, +intel_bufferobj_get_subdata(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -260,7 +260,7 @@ intel_bufferobj_get_subdata(GLcontext * ctx, * Called via glMapBufferARB(). */ static void * -intel_bufferobj_map(GLcontext * ctx, +intel_bufferobj_map(struct gl_context * ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { @@ -322,7 +322,7 @@ intel_bufferobj_map(GLcontext * ctx, * and blit it into the real BO at unmap time. */ static void * -intel_bufferobj_map_range(GLcontext * ctx, +intel_bufferobj_map_range(struct gl_context * ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *obj) { @@ -415,7 +415,7 @@ intel_bufferobj_map_range(GLcontext * ctx, * would defeat the point. */ static void -intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, +intel_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj) { @@ -449,7 +449,7 @@ intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, * Called via glUnmapBuffer(). */ static GLboolean -intel_bufferobj_unmap(GLcontext * ctx, +intel_bufferobj_unmap(struct gl_context * ctx, GLenum target, struct gl_buffer_object *obj) { struct intel_context *intel = intel_context(ctx); @@ -537,7 +537,7 @@ intel_bufferobj_buffer(struct intel_context *intel, } static void -intel_bufferobj_copy_subdata(GLcontext *ctx, +intel_bufferobj_copy_subdata(struct gl_context *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, GLintptr read_offset, GLintptr write_offset, @@ -596,7 +596,7 @@ intel_bufferobj_copy_subdata(GLcontext *ctx, #if FEATURE_APPLE_object_purgeable static GLenum -intel_buffer_purgeable(GLcontext * ctx, +intel_buffer_purgeable(struct gl_context * ctx, drm_intel_bo *buffer, GLenum option) { @@ -609,7 +609,7 @@ intel_buffer_purgeable(GLcontext * ctx, } static GLenum -intel_buffer_object_purgeable(GLcontext * ctx, +intel_buffer_object_purgeable(struct gl_context * ctx, struct gl_buffer_object *obj, GLenum option) { @@ -636,7 +636,7 @@ intel_buffer_object_purgeable(GLcontext * ctx, } static GLenum -intel_texture_object_purgeable(GLcontext * ctx, +intel_texture_object_purgeable(struct gl_context * ctx, struct gl_texture_object *obj, GLenum option) { @@ -650,7 +650,7 @@ intel_texture_object_purgeable(GLcontext * ctx, } static GLenum -intel_render_object_purgeable(GLcontext * ctx, +intel_render_object_purgeable(struct gl_context * ctx, struct gl_renderbuffer *obj, GLenum option) { @@ -664,7 +664,7 @@ intel_render_object_purgeable(GLcontext * ctx, } static GLenum -intel_buffer_unpurgeable(GLcontext * ctx, +intel_buffer_unpurgeable(struct gl_context * ctx, drm_intel_bo *buffer, GLenum option) { @@ -678,7 +678,7 @@ intel_buffer_unpurgeable(GLcontext * ctx, } static GLenum -intel_buffer_object_unpurgeable(GLcontext * ctx, +intel_buffer_object_unpurgeable(struct gl_context * ctx, struct gl_buffer_object *obj, GLenum option) { @@ -686,7 +686,7 @@ intel_buffer_object_unpurgeable(GLcontext * ctx, } static GLenum -intel_texture_object_unpurgeable(GLcontext * ctx, +intel_texture_object_unpurgeable(struct gl_context * ctx, struct gl_texture_object *obj, GLenum option) { @@ -700,7 +700,7 @@ intel_texture_object_unpurgeable(GLcontext * ctx, } static GLenum -intel_render_object_unpurgeable(GLcontext * ctx, +intel_render_object_unpurgeable(struct gl_context * ctx, struct gl_renderbuffer *obj, GLenum option) { diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 1bff344a45..ee551ef60d 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -88,7 +88,7 @@ intel_check_front_buffer_rendering(struct intel_context *intel) * color buffers. */ void -intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) +intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb) { struct intel_context *intel = intel_context(ctx); struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL; @@ -262,7 +262,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) static void -intelDrawBuffer(GLcontext * ctx, GLenum mode) +intelDrawBuffer(struct gl_context * ctx, GLenum mode) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct intel_context *const intel = intel_context(ctx); @@ -285,7 +285,7 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode) static void -intelReadBuffer(GLcontext * ctx, GLenum mode) +intelReadBuffer(struct gl_context * ctx, GLenum mode) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct intel_context *const intel = intel_context(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h index abb86aade6..2d4613b295 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.h +++ b/src/mesa/drivers/dri/intel/intel_buffers.h @@ -41,7 +41,7 @@ extern struct intel_region *intel_drawbuf_region(struct intel_context *intel); extern void intel_check_front_buffer_rendering(struct intel_context *intel); -extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb); +extern void intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb); extern void intelInitBufferFuncs(struct dd_function_table *functions); @@ -50,7 +50,7 @@ void intel_get_cliprects(struct intel_context *intel, unsigned int *num_cliprects, int *x_off, int *y_off); #ifdef I915 -void intelCalcViewport(GLcontext * ctx); +void intelCalcViewport(struct gl_context * ctx); #endif #endif /* INTEL_BUFFERS_H */ diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 3c22118866..d7814635b7 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -62,7 +62,7 @@ static const char *buffer_names[] = { * Called by ctx->Driver.Clear. */ static void -intelClear(GLcontext *ctx, GLbitfield mask) +intelClear(struct gl_context *ctx, GLbitfield mask) { struct intel_context *intel = intel_context(ctx); const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask[0]); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index c3b5148fe7..7ace50bde9 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -67,7 +67,7 @@ int INTEL_DEBUG = (0); static const GLubyte * -intelGetString(GLcontext * ctx, GLenum name) +intelGetString(struct gl_context * ctx, GLenum name) { const struct intel_context *const intel = intel_context(ctx); const char *chipset; @@ -190,7 +190,7 @@ intelGetString(GLcontext * ctx, GLenum name) } static void -intel_flush_front(GLcontext *ctx) +intel_flush_front(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; @@ -478,7 +478,7 @@ intel_prepare_render(struct intel_context *intel) } static void -intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; @@ -527,7 +527,7 @@ static const struct dri_debug_control debug_control[] = { static void -intelInvalidateState(GLcontext * ctx, GLuint new_state) +intelInvalidateState(struct gl_context * ctx, GLuint new_state) { struct intel_context *intel = intel_context(ctx); @@ -544,7 +544,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state) } void -intel_flush(GLcontext *ctx) +intel_flush(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); @@ -559,7 +559,7 @@ intel_flush(GLcontext *ctx) } static void -intel_glFlush(GLcontext *ctx) +intel_glFlush(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); @@ -569,7 +569,7 @@ intel_glFlush(GLcontext *ctx) } void -intelFinish(GLcontext * ctx) +intelFinish(struct gl_context * ctx) { struct gl_framebuffer *fb = ctx->DrawBuffer; int i; @@ -621,8 +621,8 @@ intelInitContext(struct intel_context *intel, void *sharedContextPrivate, struct dd_function_table *functions) { - GLcontext *ctx = &intel->ctx; - GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; + struct gl_context *ctx = &intel->ctx; + struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate; __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct intel_screen *intelScreen = sPriv->private; int bo_reuse_mode; @@ -737,7 +737,7 @@ intelInitContext(struct intel_context *intel, ctx->Const.MaxSamples = 1.0; /* reinitialize the context point state. - * It depend on constants in __GLcontextRec::Const + * It depend on constants in __struct gl_contextRec::Const */ _mesa_init_point(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index e94ba94df2..46d10d74ba 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -106,11 +106,11 @@ struct intel_sync_object { }; /** - * intel_context is derived from Mesa's context class: GLcontext. + * intel_context is derived from Mesa's context class: struct gl_context. */ struct intel_context { - GLcontext ctx; /**< base class, must be first field */ + struct gl_context ctx; /**< base class, must be first field */ struct { @@ -256,7 +256,7 @@ struct intel_context __DRIcontext *driContext; struct intel_screen *intelScreen; - void (*saved_viewport)(GLcontext * ctx, + void (*saved_viewport)(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height); /** @@ -388,8 +388,8 @@ extern GLboolean intelInitContext(struct intel_context *intel, void *sharedContextPrivate, struct dd_function_table *functions); -extern void intelFinish(GLcontext * ctx); -extern void intel_flush(GLcontext * ctx); +extern void intelFinish(struct gl_context * ctx); +extern void intel_flush(struct gl_context * ctx); extern void intelInitDriverFunctions(struct dd_function_table *functions); @@ -476,7 +476,7 @@ void i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region, * These are better-typed than the macros used previously: */ static INLINE struct intel_context * -intel_context(GLcontext * ctx) +intel_context(struct gl_context * ctx) { return (struct intel_context *) ctx; } diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 8d38a28bb8..974045730b 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -217,7 +217,7 @@ get_glsl_version() * extensions for a context. */ void -intelInitExtensions(GLcontext *ctx) +intelInitExtensions(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_extensions.h b/src/mesa/drivers/dri/intel/intel_extensions.h index 236442a4d6..fb2a846d39 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.h +++ b/src/mesa/drivers/dri/intel/intel_extensions.h @@ -30,10 +30,10 @@ extern void -intelInitExtensions(GLcontext *ctx); +intelInitExtensions(struct gl_context *ctx); extern void -intelInitExtensionsES2(GLcontext *ctx); +intelInitExtensionsES2(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c index ed5db20e38..71c86339c7 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c +++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c @@ -83,7 +83,7 @@ static const char *es2_extensions[] = { * extensions for a context. */ void -intelInitExtensionsES2(GLcontext *ctx) +intelInitExtensionsES2(struct gl_context *ctx) { int i; diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index a70c83b39d..862a13d2ea 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -50,7 +50,7 @@ * Create a new framebuffer object. */ static struct gl_framebuffer * -intel_new_framebuffer(GLcontext * ctx, GLuint name) +intel_new_framebuffer(struct gl_context * ctx, GLuint name) { /* Only drawable state in intel_framebuffer at this time, just use Mesa's * class @@ -81,7 +81,7 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb) * Return a pointer to a specific pixel in a renderbuffer. */ static void * -intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_get_pointer(struct gl_context * ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { /* By returning NULL we force all software rendering to go through @@ -96,7 +96,7 @@ intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb, * storage for a user-created renderbuffer. */ static GLboolean -intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -216,7 +216,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, #if FEATURE_OES_EGL_image static void -intel_image_target_renderbuffer_storage(GLcontext *ctx, +intel_image_target_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, void *image_handle) { @@ -252,7 +252,7 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx, * Not used for user-created renderbuffers! */ static GLboolean -intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(rb->Name == 0); @@ -265,7 +265,7 @@ intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, static void -intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, +intel_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { int i; @@ -293,7 +293,7 @@ intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, /** Dummy function for gl_renderbuffer::AllocStorage() */ static GLboolean -intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { _mesa_problem(ctx, "intel_op_alloc_storage should never be called."); @@ -396,7 +396,7 @@ intel_create_renderbuffer(gl_format format) * Typically called via glBindRenderbufferEXT(). */ static struct gl_renderbuffer * -intel_new_renderbuffer(GLcontext * ctx, GLuint name) +intel_new_renderbuffer(struct gl_context * ctx, GLuint name) { /*struct intel_context *intel = intel_context(ctx); */ struct intel_renderbuffer *irb; @@ -424,7 +424,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name) * Called via glBindFramebufferEXT(). */ static void -intel_bind_framebuffer(GLcontext * ctx, GLenum target, +intel_bind_framebuffer(struct gl_context * ctx, GLenum target, struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) { @@ -440,7 +440,7 @@ intel_bind_framebuffer(GLcontext * ctx, GLenum target, * Called via glFramebufferRenderbufferEXT(). */ static void -intel_framebuffer_renderbuffer(GLcontext * ctx, +intel_framebuffer_renderbuffer(struct gl_context * ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { @@ -454,7 +454,7 @@ intel_framebuffer_renderbuffer(GLcontext * ctx, static GLboolean -intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, +intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb, struct gl_texture_image *texImage) { if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { @@ -535,7 +535,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, * This will have the region info needed for hardware rendering. */ static struct intel_renderbuffer * -intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) +intel_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage) { const GLuint name = ~0; /* not significant, but distinct for debugging */ struct intel_renderbuffer *irb; @@ -566,7 +566,7 @@ intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) * before intel_finish_render_texture() is ever called. */ static void -intel_render_texture(GLcontext * ctx, +intel_render_texture(struct gl_context * ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { @@ -642,7 +642,7 @@ intel_render_texture(GLcontext * ctx, * Called by Mesa when rendering to a texture is done. */ static void -intel_finish_render_texture(GLcontext * ctx, +intel_finish_render_texture(struct gl_context * ctx, struct gl_renderbuffer_attachment *att) { struct intel_context *intel = intel_context(ctx); @@ -669,7 +669,7 @@ intel_finish_render_texture(GLcontext * ctx, * Do additional "completeness" testing of a framebuffer object. */ static void -intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) { const struct intel_renderbuffer *depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH); diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index cb088e4032..60583ef4c0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -55,7 +55,7 @@ effective_func(GLenum func, GLboolean src_alpha_is_one) * glDraw/CopyPixels. */ GLboolean -intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one) +intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_one) { if (ctx->NewState) _mesa_update_state(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index 743b6497c5..aef0e609da 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -31,21 +31,21 @@ #include "main/mtypes.h" void intelInitPixelFuncs(struct dd_function_table *functions); -GLboolean intel_check_blit_fragment_ops(GLcontext * ctx, +GLboolean intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_one); GLboolean intel_check_blit_format(struct intel_region *region, GLenum format, GLenum type); -void intelReadPixels(GLcontext * ctx, +void intelReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels); -void intelDrawPixels(GLcontext * ctx, +void intelDrawPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, @@ -53,12 +53,12 @@ void intelDrawPixels(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid * pixels); -void intelCopyPixels(GLcontext * ctx, +void intelCopyPixels(struct gl_context * ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type); -void intelBitmap(GLcontext * ctx, +void intelBitmap(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 23410f063c..63fb4b37b1 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -58,7 +58,7 @@ * PBO bitmaps. I think they are probably pretty rare though - I * wonder if Xgl uses them? */ -static const GLubyte *map_pbo( GLcontext *ctx, +static const GLubyte *map_pbo( struct gl_context *ctx, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) @@ -167,7 +167,7 @@ y_flip(struct gl_framebuffer *fb, int y, int height) * Render a bitmap. */ static GLboolean -do_blit_bitmap( GLcontext *ctx, +do_blit_bitmap( struct gl_context *ctx, GLint dstx, GLint dsty, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, @@ -320,7 +320,7 @@ out: * - Chop bitmap up into 32x32 squares and render w/polygon stipple. */ void -intelBitmap(GLcontext * ctx, +intelBitmap(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 2008a4c2be..c6b36ed429 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -76,7 +76,7 @@ copypix_src_region(struct intel_context *intel, GLenum type) * we allow Scissor. */ static GLboolean -intel_check_copypixel_blit_fragment_ops(GLcontext * ctx) +intel_check_copypixel_blit_fragment_ops(struct gl_context * ctx) { if (ctx->NewState) _mesa_update_state(ctx); @@ -102,7 +102,7 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx) * CopyPixels with the blitter. Don't support zooming, pixel transfer, etc. */ static GLboolean -do_blit_copypixels(GLcontext * ctx, +do_blit_copypixels(struct gl_context * ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type) @@ -198,7 +198,7 @@ out: void -intelCopyPixels(GLcontext * ctx, +intelCopyPixels(struct gl_context * ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 470c4b9326..2ec7ed8e26 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -39,7 +39,7 @@ #include "intel_pixel.h" void -intelDrawPixels(GLcontext * ctx, +intelDrawPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 21d2a7a93e..b249f9a5a0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -65,7 +65,7 @@ */ static GLboolean -do_blit_readpixels(GLcontext * ctx, +do_blit_readpixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) @@ -165,7 +165,7 @@ do_blit_readpixels(GLcontext * ctx, } void -intelReadPixels(GLcontext * ctx, +intelReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index c8d55c92a0..104cadf0f9 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -246,7 +246,7 @@ intel_map_unmap_framebuffer(struct intel_context *intel, * Old note: Moved locking out to get reasonable span performance. */ void -intelSpanRenderStart(GLcontext * ctx) +intelSpanRenderStart(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); GLuint i; @@ -273,7 +273,7 @@ intelSpanRenderStart(GLcontext * ctx) * the above function. */ void -intelSpanRenderFinish(GLcontext * ctx) +intelSpanRenderFinish(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); GLuint i; @@ -294,7 +294,7 @@ intelSpanRenderFinish(GLcontext * ctx) void -intelInitSpanFuncs(GLcontext * ctx) +intelInitSpanFuncs(struct gl_context * ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = intelSpanRenderStart; @@ -302,7 +302,7 @@ intelInitSpanFuncs(GLcontext * ctx) } void -intel_map_vertex_shader_textures(GLcontext *ctx) +intel_map_vertex_shader_textures(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); int i; @@ -321,7 +321,7 @@ intel_map_vertex_shader_textures(GLcontext *ctx) } void -intel_unmap_vertex_shader_textures(GLcontext *ctx) +intel_unmap_vertex_shader_textures(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); int i; diff --git a/src/mesa/drivers/dri/intel/intel_span.h b/src/mesa/drivers/dri/intel/intel_span.h index bffe109aa5..aa8d08e843 100644 --- a/src/mesa/drivers/dri/intel/intel_span.h +++ b/src/mesa/drivers/dri/intel/intel_span.h @@ -28,15 +28,15 @@ #ifndef _INTEL_SPAN_H #define _INTEL_SPAN_H -extern void intelInitSpanFuncs(GLcontext * ctx); +extern void intelInitSpanFuncs(struct gl_context * ctx); -extern void intelSpanRenderFinish(GLcontext * ctx); -extern void intelSpanRenderStart(GLcontext * ctx); +extern void intelSpanRenderFinish(struct gl_context * ctx); +extern void intelSpanRenderStart(struct gl_context * ctx); void intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb); void intel_renderbuffer_unmap(struct intel_context *intel, struct gl_renderbuffer *rb); -void intel_map_vertex_shader_textures(GLcontext *ctx); -void intel_unmap_vertex_shader_textures(GLcontext *ctx); +void intel_map_vertex_shader_textures(struct gl_context *ctx); +void intel_unmap_vertex_shader_textures(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c index c5ef909dbf..80598b7ef6 100644 --- a/src/mesa/drivers/dri/intel/intel_state.c +++ b/src/mesa/drivers/dri/intel/intel_state.c @@ -197,7 +197,7 @@ intel_translate_logic_op(GLenum opcode) /* Fallback to swrast for select and feedback. */ static void -intelRenderMode(GLcontext *ctx, GLenum mode) +intelRenderMode(struct gl_context *ctx, GLenum mode) { struct intel_context *intel = intel_context(ctx); FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER)); diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c index c2d86432ff..bbfac74b60 100644 --- a/src/mesa/drivers/dri/intel/intel_syncobj.c +++ b/src/mesa/drivers/dri/intel/intel_syncobj.c @@ -46,7 +46,7 @@ #include "intel_reg.h" static struct gl_sync_object * -intel_new_sync_object(GLcontext *ctx, GLuint id) +intel_new_sync_object(struct gl_context *ctx, GLuint id) { struct intel_sync_object *sync; @@ -56,7 +56,7 @@ intel_new_sync_object(GLcontext *ctx, GLuint id) } static void -intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s) +intel_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *s) { struct intel_sync_object *sync = (struct intel_sync_object *)s; @@ -65,7 +65,7 @@ intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s) } static void -intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s, +intel_fence_sync(struct gl_context *ctx, struct gl_sync_object *s, GLenum condition, GLbitfield flags) { struct intel_context *intel = intel_context(ctx); @@ -87,7 +87,7 @@ intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s, * The fix would be a new kernel function to do the GTT transition with a * timeout. */ -static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s, +static void intel_client_wait_sync(struct gl_context *ctx, struct gl_sync_object *s, GLbitfield flags, GLuint64 timeout) { struct intel_sync_object *sync = (struct intel_sync_object *)s; @@ -105,12 +105,12 @@ static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s, * any batchbuffers coming after this waitsync will naturally not occur until * the previous one is done. */ -static void intel_server_wait_sync(GLcontext *ctx, struct gl_sync_object *s, +static void intel_server_wait_sync(struct gl_context *ctx, struct gl_sync_object *s, GLbitfield flags, GLuint64 timeout) { } -static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s) +static void intel_check_sync(struct gl_context *ctx, struct gl_sync_object *s) { struct intel_sync_object *sync = (struct intel_sync_object *)s; diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index e2bff0878a..3d9a2549db 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -10,7 +10,7 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE static struct gl_texture_image * -intelNewTextureImage(GLcontext * ctx) +intelNewTextureImage(struct gl_context * ctx) { DBG("%s\n", __FUNCTION__); (void) ctx; @@ -19,7 +19,7 @@ intelNewTextureImage(GLcontext * ctx) static struct gl_texture_object * -intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target) +intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object); @@ -30,7 +30,7 @@ intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target) } static void -intelDeleteTextureObject(GLcontext *ctx, +intelDeleteTextureObject(struct gl_context *ctx, struct gl_texture_object *texObj) { struct intel_context *intel = intel_context(ctx); @@ -44,7 +44,7 @@ intelDeleteTextureObject(GLcontext *ctx, static void -intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) +intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage) { struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); @@ -150,7 +150,7 @@ timed_memcpy(void *dest, const void *src, size_t n) * map/unmap the base level texture image. */ static void -intelGenerateMipmap(GLcontext *ctx, GLenum target, +intelGenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) { diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index cd77dd5b8e..7906554e45 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -40,7 +40,7 @@ void intelInitTextureSubImageFuncs(struct dd_function_table *functions); void intelInitTextureCopyImageFuncs(struct dd_function_table *functions); -gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat, +gl_format intelChooseTextureFormat(struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type); void intelSetTexBuffer(__DRIcontext *pDRICtx, diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index d59b8711f2..2d046fd52d 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -101,7 +101,7 @@ do_copy_texsubimage(struct intel_context *intel, GLint dstx, GLint dsty, GLint x, GLint y, GLsizei width, GLsizei height) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct intel_region *src = get_teximage_source(intel, internalFormat); if (!intelImage->mt || !src || !src->buffer) { @@ -172,7 +172,7 @@ do_copy_texsubimage(struct intel_context *intel, static void -intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { @@ -220,7 +220,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, static void -intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) @@ -269,7 +269,7 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, static void -intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); @@ -295,7 +295,7 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, static void -intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 97b26efcb7..9d73a2fb37 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -15,7 +15,7 @@ * immediately after sampling... */ gl_format -intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, +intelChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type) { struct intel_context *intel = intel_context(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 187e537aac..35f3d7d382 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -300,7 +300,7 @@ try_pbo_zcopy(struct intel_context *intel, static void -intelTexImage(GLcontext * ctx, +intelTexImage(struct gl_context * ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, @@ -539,7 +539,7 @@ intelTexImage(GLcontext * ctx, static void -intelTexImage3D(GLcontext * ctx, +intelTexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, @@ -556,7 +556,7 @@ intelTexImage3D(GLcontext * ctx, static void -intelTexImage2D(GLcontext * ctx, +intelTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, @@ -572,7 +572,7 @@ intelTexImage2D(GLcontext * ctx, static void -intelTexImage1D(GLcontext * ctx, +intelTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, @@ -588,7 +588,7 @@ intelTexImage1D(GLcontext * ctx, static void -intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, +intelCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -606,7 +606,7 @@ intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, * then unmap it. */ static void -intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, +intel_get_tex_image(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLboolean compressed) @@ -666,7 +666,7 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, static void -intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, +intelGetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -677,7 +677,7 @@ intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, static void -intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +intelGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -693,7 +693,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, { struct gl_framebuffer *fb = dPriv->driverPrivate; struct intel_context *intel = pDRICtx->driverPrivate; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct intel_texture_object *intelObj; struct intel_texture_image *intelImage; struct intel_mipmap_tree *mt; @@ -774,7 +774,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) #if FEATURE_OES_EGL_image static void -intel_image_target_texture_2d(GLcontext *ctx, GLenum target, +intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLeglImageOES image_handle) diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index b7ce50a820..c9b992a21b 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -40,7 +40,7 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE static void -intelTexSubimage(GLcontext * ctx, +intelTexSubimage(struct gl_context * ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, @@ -189,7 +189,7 @@ intelTexSubimage(GLcontext * ctx, static void -intelTexSubImage3D(GLcontext * ctx, +intelTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, @@ -209,7 +209,7 @@ intelTexSubImage3D(GLcontext * ctx, static void -intelTexSubImage2D(GLcontext * ctx, +intelTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -229,7 +229,7 @@ intelTexSubImage2D(GLcontext * ctx, static void -intelTexSubImage1D(GLcontext * ctx, +intelTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, @@ -248,7 +248,7 @@ intelTexSubImage1D(GLcontext * ctx, } static void -intelCompressedTexSubImage2D(GLcontext * ctx, +intelCompressedTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 0d4f895dd4..7c989df5ec 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -90,7 +90,7 @@ GLboolean mach64CreateContext( gl_api api, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *driScreen = driContextPriv->driScreenPriv; struct dd_function_table functions; mach64ContextPtr mmesa; diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index 3d7943db01..11e8f53b28 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -161,7 +161,7 @@ struct mach64_texture_object { typedef struct mach64_texture_object mach64TexObj, *mach64TexObjPtr; struct mach64_context { - GLcontext *glCtx; + struct gl_context *glCtx; /* Driver and hardware state management */ diff --git a/src/mesa/drivers/dri/mach64/mach64_dd.c b/src/mesa/drivers/dri/mach64/mach64_dd.c index d464f6c518..9cb2c10759 100644 --- a/src/mesa/drivers/dri/mach64/mach64_dd.c +++ b/src/mesa/drivers/dri/mach64/mach64_dd.c @@ -55,7 +55,7 @@ static void mach64DDGetBufferSize( struct gl_framebuffer *buffer, /* Return various strings for glGetString(). */ -static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *mach64DDGetString( struct gl_context *ctx, GLenum name ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); static char buffer[128]; @@ -84,7 +84,7 @@ static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name ) * hardware. All commands that are normally sent to the ring are * already considered `flushed'. */ -static void mach64DDFlush( GLcontext *ctx ) +static void mach64DDFlush( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -107,7 +107,7 @@ static void mach64DDFlush( GLcontext *ctx ) /* Make sure all commands have been sent to the hardware and have * completed processing. */ -static void mach64DDFinish( GLcontext *ctx ) +static void mach64DDFinish( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c index 03587c44fd..0146e0d051 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c @@ -665,7 +665,7 @@ void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa ) * Buffer clear */ -static void mach64DDClear( GLcontext *ctx, GLbitfield mask ) +static void mach64DDClear( struct gl_context *ctx, GLbitfield mask ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); __DRIdrawable *dPriv = mmesa->driDrawable; diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c index 816682ec5f..d8426ddee1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c @@ -35,7 +35,7 @@ #define LOCALVARS #endif -void TAG(translate_vertex)(GLcontext *ctx, +void TAG(translate_vertex)(struct gl_context *ctx, const VERTEX *src, SWvertex *dst) { @@ -108,7 +108,7 @@ void TAG(translate_vertex)(GLcontext *ctx, -void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) +void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v ) { LOCALVARS GLuint format = GET_VERTEX_FORMAT(); @@ -199,7 +199,7 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) #define GET_COLOR(ptr, idx) ((ptr)->data[idx]) -INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, +INTERP_QUALIFIER void TAG(interp_extras)( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) @@ -230,7 +230,7 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, INTERP_VERTEX(ctx, t, dst, out, in, force_boundary); } -INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx, +INTERP_QUALIFIER void TAG(copy_pv_extras)( struct gl_context *ctx, GLuint dst, GLuint src ) { LOCALVARS diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h index 6e5fa3520e..8345f5cdbc 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h @@ -52,7 +52,7 @@ #define LOCALVARS #endif -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) @@ -312,7 +312,7 @@ static void TAG(emit)( GLcontext *ctx, #if DO_XYZW && DO_RGBA -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -344,7 +344,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) } -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) @@ -511,7 +511,7 @@ static void TAG(interp)( GLcontext *ctx, #endif /* DO_RGBA && DO_XYZW */ -static void TAG(copy_pv)( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void TAG(copy_pv)( struct gl_context *ctx, GLuint edst, GLuint esrc ) { #if DO_SPEC || DO_FOG || DO_RGBA LOCALVARS diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index b5ed03910c..956bccbcd6 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -379,7 +379,7 @@ mach64SwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { mach64ContextPtr mmesa; - GLcontext *ctx; + struct gl_context *ctx; mmesa = (mach64ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = mmesa->glCtx; if (ctx->Visual.doubleBufferMode) { diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c index aff938debf..4b853c2af3 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.c +++ b/src/mesa/drivers/dri/mach64/mach64_span.c @@ -128,21 +128,21 @@ #include "depthtmp.h" -static void mach64SpanRenderStart( GLcontext *ctx ) +static void mach64SpanRenderStart( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); LOCK_HARDWARE( mmesa ); FINISH_DMA_LOCKED( mmesa ); } -static void mach64SpanRenderFinish( GLcontext *ctx ) +static void mach64SpanRenderFinish( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); _swrast_flush( ctx ); UNLOCK_HARDWARE( mmesa ); } -void mach64DDInitSpanFuncs( GLcontext *ctx ) +void mach64DDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = mach64SpanRenderStart; diff --git a/src/mesa/drivers/dri/mach64/mach64_span.h b/src/mesa/drivers/dri/mach64/mach64_span.h index c0120ce9b0..2742e93c8e 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.h +++ b/src/mesa/drivers/dri/mach64/mach64_span.h @@ -33,7 +33,7 @@ #include "drirenderbuffer.h" -extern void mach64DDInitSpanFuncs( GLcontext *ctx ); +extern void mach64DDInitSpanFuncs( struct gl_context *ctx ); extern void mach64SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c index 69a5aea02c..8e795955c2 100644 --- a/src/mesa/drivers/dri/mach64/mach64_state.c +++ b/src/mesa/drivers/dri/mach64/mach64_state.c @@ -48,7 +48,7 @@ * Alpha blending */ -static void mach64UpdateAlphaMode( GLcontext *ctx ) +static void mach64UpdateAlphaMode( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint a = mmesa->setup.alpha_tst_cntl; @@ -185,7 +185,7 @@ static void mach64UpdateAlphaMode( GLcontext *ctx ) } } -static void mach64DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void mach64DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -193,7 +193,7 @@ static void mach64DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) mmesa->new_state |= MACH64_NEW_ALPHA; } -static void mach64DDBlendEquationSeparate( GLcontext *ctx, +static void mach64DDBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -214,7 +214,7 @@ static void mach64DDBlendEquationSeparate( GLcontext *ctx, mmesa->new_state |= MACH64_NEW_ALPHA; } -static void mach64DDBlendFuncSeparate( GLcontext *ctx, +static void mach64DDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -229,7 +229,7 @@ static void mach64DDBlendFuncSeparate( GLcontext *ctx, * Depth testing */ -static void mach64UpdateZMode( GLcontext *ctx ) +static void mach64UpdateZMode( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint z = mmesa->setup.z_cntl; @@ -285,7 +285,7 @@ static void mach64UpdateZMode( GLcontext *ctx ) } } -static void mach64DDDepthFunc( GLcontext *ctx, GLenum func ) +static void mach64DDDepthFunc( struct gl_context *ctx, GLenum func ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -293,7 +293,7 @@ static void mach64DDDepthFunc( GLcontext *ctx, GLenum func ) mmesa->new_state |= MACH64_NEW_DEPTH; } -static void mach64DDDepthMask( GLcontext *ctx, GLboolean flag ) +static void mach64DDDepthMask( struct gl_context *ctx, GLboolean flag ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -301,7 +301,7 @@ static void mach64DDDepthMask( GLcontext *ctx, GLboolean flag ) mmesa->new_state |= MACH64_NEW_DEPTH; } -static void mach64DDClearDepth( GLcontext *ctx, GLclampd d ) +static void mach64DDClearDepth( struct gl_context *ctx, GLclampd d ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -315,7 +315,7 @@ static void mach64DDClearDepth( GLcontext *ctx, GLclampd d ) * Fog */ -static void mach64UpdateFogAttrib( GLcontext *ctx ) +static void mach64UpdateFogAttrib( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -366,7 +366,7 @@ static void mach64UpdateFogAttrib( GLcontext *ctx ) } -static void mach64DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void mach64DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -379,7 +379,7 @@ static void mach64DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Clipping */ -static void mach64UpdateClipping( GLcontext *ctx ) +static void mach64UpdateClipping( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); mach64ScreenPtr mach64Screen = mmesa->mach64Screen; @@ -452,7 +452,7 @@ static void mach64UpdateClipping( GLcontext *ctx ) } } -static void mach64DDScissor( GLcontext *ctx, +static void mach64DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -466,7 +466,7 @@ static void mach64DDScissor( GLcontext *ctx, * Culling */ -static void mach64UpdateCull( GLcontext *ctx ) +static void mach64UpdateCull( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLfloat backface_sign = 1; @@ -495,7 +495,7 @@ static void mach64UpdateCull( GLcontext *ctx ) } -static void mach64DDCullFace( GLcontext *ctx, GLenum mode ) +static void mach64DDCullFace( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -503,7 +503,7 @@ static void mach64DDCullFace( GLcontext *ctx, GLenum mode ) mmesa->new_state |= MACH64_NEW_CULL; } -static void mach64DDFrontFace( GLcontext *ctx, GLenum mode ) +static void mach64DDFrontFace( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -516,7 +516,7 @@ static void mach64DDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void mach64UpdateMasks( GLcontext *ctx ) +static void mach64UpdateMasks( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint mask = 0xffffffff; @@ -536,7 +536,7 @@ static void mach64UpdateMasks( GLcontext *ctx ) } } -static void mach64DDColorMask( GLcontext *ctx, +static void mach64DDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -555,7 +555,7 @@ static void mach64DDColorMask( GLcontext *ctx, * sense to break them out of the core texture state update routines. */ -static void mach64UpdateSpecularLighting( GLcontext *ctx ) +static void mach64UpdateSpecularLighting( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint a = mmesa->setup.alpha_tst_cntl; @@ -578,7 +578,7 @@ static void mach64UpdateSpecularLighting( GLcontext *ctx ) } } -static void mach64DDLightModelfv( GLcontext *ctx, GLenum pname, +static void mach64DDLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -589,7 +589,7 @@ static void mach64DDLightModelfv( GLcontext *ctx, GLenum pname, } } -static void mach64DDShadeModel( GLcontext *ctx, GLenum mode ) +static void mach64DDShadeModel( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint s = mmesa->setup.setup_cntl; @@ -621,7 +621,7 @@ static void mach64DDShadeModel( GLcontext *ctx, GLenum mode ) */ -void mach64CalcViewport( GLcontext *ctx ) +void mach64CalcViewport( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -639,14 +639,14 @@ void mach64CalcViewport( GLcontext *ctx ) mmesa->SetupNewInputs = ~0; } -static void mach64Viewport( GLcontext *ctx, +static void mach64Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { mach64CalcViewport( ctx ); } -static void mach64DepthRange( GLcontext *ctx, +static void mach64DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { mach64CalcViewport( ctx ); @@ -657,7 +657,7 @@ static void mach64DepthRange( GLcontext *ctx, * Miscellaneous */ -static void mach64DDClearColor( GLcontext *ctx, +static void mach64DDClearColor( struct gl_context *ctx, const GLfloat color[4] ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -672,7 +672,7 @@ static void mach64DDClearColor( GLcontext *ctx, c[0], c[1], c[2], c[3] ); } -static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +static void mach64DDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -683,7 +683,7 @@ static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -void mach64SetCliprects( GLcontext *ctx, GLenum mode ) +void mach64SetCliprects( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); __DRIdrawable *dPriv = mmesa->driDrawable; @@ -717,7 +717,7 @@ void mach64SetCliprects( GLcontext *ctx, GLenum mode ) mmesa->dirty |= MACH64_UPLOAD_CLIPRECTS; } -static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode ) +static void mach64DDDrawBuffer( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -755,7 +755,7 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode ) mmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH; } -static void mach64DDReadBuffer( GLcontext *ctx, GLenum mode ) +static void mach64DDReadBuffer( struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } @@ -764,7 +764,7 @@ static void mach64DDReadBuffer( GLcontext *ctx, GLenum mode ) * State enable/disable */ -static void mach64DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void mach64DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -867,7 +867,7 @@ static void mach64DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) * Render mode */ -static void mach64DDRenderMode( GLcontext *ctx, GLenum mode ) +static void mach64DDRenderMode( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); FALLBACK( mmesa, MACH64_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -971,7 +971,7 @@ static void mach64DDPrintState( const char *msg, GLuint flags ) } /* Update the hardware state */ -void mach64DDUpdateHWState( GLcontext *ctx ) +void mach64DDUpdateHWState( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); int new_state = mmesa->new_state; @@ -1018,7 +1018,7 @@ void mach64DDUpdateHWState( GLcontext *ctx ) } -static void mach64DDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void mach64DDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1152,7 +1152,7 @@ void mach64DDInitState( mach64ContextPtr mmesa ) /* Initialize the driver's state functions. */ -void mach64DDInitStateFuncs( GLcontext *ctx ) +void mach64DDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = mach64DDInvalidateState; diff --git a/src/mesa/drivers/dri/mach64/mach64_state.h b/src/mesa/drivers/dri/mach64/mach64_state.h index 23081cb2fe..41c4d01d1d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_state.h +++ b/src/mesa/drivers/dri/mach64/mach64_state.h @@ -34,13 +34,13 @@ #include "mach64_context.h" extern void mach64DDInitState( mach64ContextPtr mmesa ); -extern void mach64DDInitStateFuncs( GLcontext *ctx ); +extern void mach64DDInitStateFuncs( struct gl_context *ctx ); -extern void mach64SetCliprects( GLcontext *ctx, GLenum mode ); -extern void mach64CalcViewport( GLcontext *ctx ); +extern void mach64SetCliprects( struct gl_context *ctx, GLenum mode ); +extern void mach64CalcViewport( struct gl_context *ctx ); -extern void mach64DDUpdateState( GLcontext *ctx ); -extern void mach64DDUpdateHWState( GLcontext *ctx ); +extern void mach64DDUpdateState( struct gl_context *ctx ); +extern void mach64DDUpdateHWState( struct gl_context *ctx ); extern void mach64EmitHwStateLocked( mach64ContextPtr mmesa ); diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 09367be5b4..68d273a3e7 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -133,7 +133,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ static gl_format -mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +mach64ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -241,7 +241,7 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, } } -static void mach64TexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void mach64TexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -271,7 +271,7 @@ static void mach64TexImage1D( GLcontext *ctx, GLenum target, GLint level, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64TexSubImage1D( GLcontext *ctx, +static void mach64TexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -304,7 +304,7 @@ static void mach64TexSubImage1D( GLcontext *ctx, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64TexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void mach64TexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -334,7 +334,7 @@ static void mach64TexImage2D( GLcontext *ctx, GLenum target, GLint level, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64TexSubImage2D( GLcontext *ctx, +static void mach64TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -371,7 +371,7 @@ static void mach64TexSubImage2D( GLcontext *ctx, * Device Driver API texture functions */ -static void mach64DDTexEnv( GLcontext *ctx, GLenum target, +static void mach64DDTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -425,7 +425,7 @@ static void mach64DDTexEnv( GLcontext *ctx, GLenum target, } } -static void mach64DDTexParameter( GLcontext *ctx, GLenum target, +static void mach64DDTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -489,7 +489,7 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64DDBindTexture( GLcontext *ctx, GLenum target, +static void mach64DDBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -510,7 +510,7 @@ static void mach64DDBindTexture( GLcontext *ctx, GLenum target, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64DDDeleteTexture( GLcontext *ctx, +static void mach64DDDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -537,7 +537,7 @@ static void mach64DDDeleteTexture( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -mach64NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +mach64NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.h b/src/mesa/drivers/dri/mach64/mach64_tex.h index 8e0b23ed15..0369982853 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.h +++ b/src/mesa/drivers/dri/mach64/mach64_tex.h @@ -32,7 +32,7 @@ #ifndef __MACH64_TEX_H__ #define __MACH64_TEX_H__ -extern void mach64UpdateTextureState( GLcontext *ctx ); +extern void mach64UpdateTextureState( struct gl_context *ctx ); extern void mach64UploadTexImages( mach64ContextPtr mach64ctx, mach64TexObjPtr t ); diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index adf774ec19..70365c8461 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -108,7 +108,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, t->maxLog2 = baseImage->MaxLog2; } -static void mach64UpdateTextureEnv( GLcontext *ctx, int unit ) +static void mach64UpdateTextureEnv( struct gl_context *ctx, int unit ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLint source = mmesa->tmu_source[unit]; @@ -284,7 +284,7 @@ static void mach64UpdateTextureEnv( GLcontext *ctx, int unit ) } -static void mach64UpdateTextureUnit( GLcontext *ctx, int unit ) +static void mach64UpdateTextureUnit( struct gl_context *ctx, int unit ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); int source = mmesa->tmu_source[unit]; @@ -427,7 +427,7 @@ static void mach64UpdateTextureUnit( GLcontext *ctx, int unit ) /* Update the hardware texture state */ -void mach64UpdateTextureState( GLcontext *ctx ) +void mach64UpdateTextureState( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index a81d21afff..024ee2f435 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -59,8 +59,8 @@ static const GLuint hw_prim[GL_POLYGON+1] = { MACH64_PRIM_POLYGON, }; -static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void mach64RasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void mach64RenderPrimitive( struct gl_context *ctx, GLenum prim ); /* FIXME: Remove this when native template is finished. */ @@ -120,7 +120,7 @@ static INLINE void mach64_draw_quad( mach64ContextPtr mmesa, mach64VertexPtr v3 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; GLint a; GLfloat ooa; @@ -425,7 +425,7 @@ static INLINE void mach64_draw_triangle( mach64ContextPtr mmesa, mach64VertexPtr v2 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; GLuint vertsize = mmesa->vertex_size; GLint a; GLfloat ooa; @@ -671,7 +671,7 @@ static INLINE void mach64_draw_line( mach64ContextPtr mmesa, mach64VertexPtr v1 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; /* 2 fractional bits for hardware: */ const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width, @@ -959,7 +959,7 @@ static INLINE void mach64_draw_point( mach64ContextPtr mmesa, mach64VertexPtr v0 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; /* 2 fractional bits for hardware: */ GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size, @@ -1473,7 +1473,7 @@ mach64_fallback_tri( mach64ContextPtr mmesa, mach64Vertex *v1, mach64Vertex *v2 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[3]; mach64_translate_vertex( ctx, v0, &v[0] ); mach64_translate_vertex( ctx, v1, &v[1] ); @@ -1487,7 +1487,7 @@ mach64_fallback_line( mach64ContextPtr mmesa, mach64Vertex *v0, mach64Vertex *v1 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[2]; mach64_translate_vertex( ctx, v0, &v[0] ); mach64_translate_vertex( ctx, v1, &v[1] ); @@ -1499,7 +1499,7 @@ static void mach64_fallback_point( mach64ContextPtr mmesa, mach64Vertex *v0 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[1]; mach64_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -1549,7 +1549,7 @@ mach64_fallback_point( mach64ContextPtr mmesa, /* Render clipped primitives */ /**********************************************************************/ -static void mach64RenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mach64RenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -1573,14 +1573,14 @@ static void mach64RenderClippedPoly( GLcontext *ctx, const GLuint *elts, } -static void mach64RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void mach64RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } #if MACH64_NATIVE_VTXFMT -static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mach64FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -1675,7 +1675,7 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, assert( vb == vbchk ); } #else -static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mach64FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -1715,7 +1715,7 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) -static void mach64ChooseRenderState(GLcontext *ctx) +static void mach64ChooseRenderState(struct gl_context *ctx) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; @@ -1769,7 +1769,7 @@ static void mach64ChooseRenderState(GLcontext *ctx) /* Validate state at pipeline start */ /**********************************************************************/ -static void mach64RunPipeline( GLcontext *ctx ) +static void mach64RunPipeline( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -1798,7 +1798,7 @@ static void mach64RunPipeline( GLcontext *ctx ) * and lines, points and bitmaps. */ -static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void mach64RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -1811,7 +1811,7 @@ static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void mach64RenderPrimitive( struct gl_context *ctx, GLenum prim ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint hw = hw_prim[prim]; @@ -1825,7 +1825,7 @@ static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim ) } -static void mach64RenderStart( GLcontext *ctx ) +static void mach64RenderStart( struct gl_context *ctx ) { /* Check for projective texturing. Make sure all texcoord * pointers point to something. (fix in mesa?) @@ -1833,7 +1833,7 @@ static void mach64RenderStart( GLcontext *ctx ) mach64CheckTexSizes( ctx ); } -static void mach64RenderFinish( GLcontext *ctx ) +static void mach64RenderFinish( struct gl_context *ctx ) { if (MACH64_CONTEXT(ctx)->RenderIndex & MACH64_FALLBACK_BIT) _swrast_flush( ctx ); @@ -1868,7 +1868,7 @@ static const char *getFallbackString(GLuint bit) return fallbackStrings[i]; } -void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void mach64Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -1908,7 +1908,7 @@ void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void mach64InitTriFuncs( GLcontext *ctx ) +void mach64InitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.h b/src/mesa/drivers/dri/mach64/mach64_tris.h index 042df42f5b..84f613c4ab 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.h +++ b/src/mesa/drivers/dri/mach64/mach64_tris.h @@ -33,10 +33,10 @@ #include "main/mtypes.h" -extern void mach64InitTriFuncs( GLcontext *ctx ); +extern void mach64InitTriFuncs( struct gl_context *ctx ); -extern void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void mach64Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( mmesa, bit, mode ) mach64Fallback( mmesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c index 046aff28a8..d0c04d3d03 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_vb.c @@ -54,10 +54,10 @@ #define MACH64_MAX_SETUP 0x80 static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); + void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_size; GLuint vertex_format; } setup_tab[MACH64_MAX_SETUP]; @@ -491,7 +491,7 @@ void mach64PrintSetupFlags( char *msg, GLuint flags ) -void mach64CheckTexSizes( GLcontext *ctx ) +void mach64CheckTexSizes( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -511,7 +511,7 @@ void mach64CheckTexSizes( GLcontext *ctx ) } } -void mach64BuildVertices( GLcontext *ctx, +void mach64BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ) @@ -557,7 +557,7 @@ void mach64BuildVertices( GLcontext *ctx, } } -void mach64ChooseVertexState( GLcontext *ctx ) +void mach64ChooseVertexState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -602,7 +602,7 @@ void mach64ChooseVertexState( GLcontext *ctx ) #if 0 -void mach64_emit_contiguous_verts( GLcontext *ctx, +void mach64_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count ) { @@ -614,7 +614,7 @@ void mach64_emit_contiguous_verts( GLcontext *ctx, #endif -void mach64InitVB( GLcontext *ctx ) +void mach64InitVB( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -631,7 +631,7 @@ void mach64InitVB( GLcontext *ctx ) } -void mach64FreeVB( GLcontext *ctx ) +void mach64FreeVB( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); if (mmesa->verts) { diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.h b/src/mesa/drivers/dri/mach64/mach64_vb.h index e0b366916b..8d9cd5b492 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.h +++ b/src/mesa/drivers/dri/mach64/mach64_vb.h @@ -46,32 +46,32 @@ _NEW_FOG) -extern void mach64CheckTexSizes( GLcontext *ctx ); -extern void mach64ChooseVertexState( GLcontext *ctx ); +extern void mach64CheckTexSizes( struct gl_context *ctx ); +extern void mach64ChooseVertexState( struct gl_context *ctx ); -extern void mach64BuildVertices( GLcontext *ctx, GLuint start, GLuint count, +extern void mach64BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void mach64PrintSetupFlags(char *msg, GLuint flags ); -extern void mach64InitVB( GLcontext *ctx ); -extern void mach64FreeVB( GLcontext *ctx ); +extern void mach64InitVB( struct gl_context *ctx ); +extern void mach64FreeVB( struct gl_context *ctx ); #if 0 -extern void mach64_emit_contiguous_verts( GLcontext *ctx, +extern void mach64_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count ); -extern void mach64_emit_indexed_verts( GLcontext *ctx, +extern void mach64_emit_indexed_verts( struct gl_context *ctx, GLuint start, GLuint count ); #endif -extern void mach64_translate_vertex( GLcontext *ctx, +extern void mach64_translate_vertex( struct gl_context *ctx, const mach64Vertex *src, SWvertex *dst ); -extern void mach64_print_vertex( GLcontext *ctx, const mach64Vertex *v ); +extern void mach64_print_vertex( struct gl_context *ctx, const mach64Vertex *v ); #endif /* __MACH64_VB_H__ */ diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h index 60bfab8f6d..a126dcae40 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h @@ -118,7 +118,7 @@ #if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES) -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) @@ -366,7 +366,7 @@ static void TAG(emit)( GLcontext *ctx, #error "cannot use tiny vertices with hw perspective divide" #endif -static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) { LOCALVARS @@ -422,7 +422,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, } } #else -static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) { LOCALVARS @@ -466,7 +466,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, #if (HAVE_PTEX_VERTICES) -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -494,7 +494,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) return GL_TRUE; } #else -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -535,7 +535,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) #endif /* ptex */ -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) diff --git a/src/mesa/drivers/dri/mga/mga_texcombine.c b/src/mesa/drivers/dri/mga/mga_texcombine.c index 24083d9651..1488a89bb6 100644 --- a/src/mesa/drivers/dri/mga/mga_texcombine.c +++ b/src/mesa/drivers/dri/mga/mga_texcombine.c @@ -41,7 +41,7 @@ #define MGA_ARG2 1 #define MGA_ALPHA 2 -GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit ) +GLboolean mgaUpdateTextureEnvCombine( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index 54eda62a96..33ad8b4256 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -196,7 +196,7 @@ mgaSetTexImages( mgaContextPtr mmesa, * Texture unit state management */ -static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit ) +static void mgaUpdateTextureEnvG200( struct gl_context *ctx, GLuint unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current; @@ -526,7 +526,7 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] = }, }; -static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit ) +static GLboolean mgaUpdateTextureEnvBlend( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -622,7 +622,7 @@ static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit ) return GL_TRUE; } -static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) +static void mgaUpdateTextureEnvG400( struct gl_context *ctx, GLuint unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); const int source = mmesa->tmu_source[unit]; @@ -719,7 +719,7 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) } } -static void disable_tex( GLcontext *ctx, int unit ) +static void disable_tex( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -747,7 +747,7 @@ static void disable_tex( GLcontext *ctx, int unit ) mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit); } -static GLboolean enable_tex( GLcontext *ctx, int unit ) +static GLboolean enable_tex( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -768,7 +768,7 @@ static GLboolean enable_tex( GLcontext *ctx, int unit ) return GL_TRUE; } -static GLboolean update_tex_common( GLcontext *ctx, int unit ) +static GLboolean update_tex_common( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -842,7 +842,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) } -static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) +static GLboolean updateTextureUnit( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); const int source = mmesa->tmu_source[unit]; @@ -865,7 +865,7 @@ static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) /* The G400 is now programmed quite differently wrt texture environment. */ -void mgaUpdateTextureState( GLcontext *ctx ) +void mgaUpdateTextureState( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); GLboolean ok; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 7e92396370..d1b281a2c0 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -427,7 +427,7 @@ mgaCreateContext( gl_api api, { int i; unsigned maxlevels; - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; mgaContextPtr mmesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; @@ -820,7 +820,7 @@ mgaSwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { mgaContextPtr mmesa; - GLcontext *ctx; + struct gl_context *ctx; mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate; ctx = mmesa->glCtx; diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 4141565931..b1fbb3c45d 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -179,7 +179,7 @@ struct mga_hw_state { struct mga_context_t { - GLcontext *glCtx; + struct gl_context *glCtx; unsigned int lastStamp; /* fullscreen breaks dpriv->laststamp, * need to shadow it here. */ diff --git a/src/mesa/drivers/dri/mga/mgadd.c b/src/mesa/drivers/dri/mga/mgadd.c index 2f23c0e514..1b39813e37 100644 --- a/src/mesa/drivers/dri/mga/mgadd.c +++ b/src/mesa/drivers/dri/mga/mgadd.c @@ -43,7 +43,7 @@ ***************************************/ -static const GLubyte *mgaGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *mgaGetString( struct gl_context *ctx, GLenum name ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); static char buffer[128]; diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index 259358eaa3..a54d86a178 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -201,7 +201,7 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) static void -mgaClear( GLcontext *ctx, GLbitfield mask ) +mgaClear( struct gl_context *ctx, GLbitfield mask ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); __DRIdrawable *dPriv = mmesa->driDrawable; @@ -479,7 +479,7 @@ void mgaCopyBuffer( __DRIdrawable *dPriv ) * * \sa glFinish, mgaFlush, mgaFlushDMA */ -static void mgaFinish( GLcontext *ctx ) +static void mgaFinish( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); uint32_t fence; @@ -688,7 +688,7 @@ void mgaGetILoadBufferLocked( mgaContextPtr mmesa ) * * \sa glFlush, mgaFinish, mgaFlushDMA */ -static void mgaFlush( GLcontext *ctx ) +static void mgaFlush( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c index 1b6fb7d6b3..b8e365c714 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.c +++ b/src/mesa/drivers/dri/mga/mgapixel.c @@ -56,7 +56,7 @@ static GLboolean -check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, +check_depth_stencil_24_8( const struct gl_context *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) @@ -80,7 +80,7 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, static GLboolean -check_depth( const GLcontext *ctx, GLenum type, +check_depth( const struct gl_context *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { @@ -100,7 +100,7 @@ check_depth( const GLcontext *ctx, GLenum type, static GLboolean -check_color( const GLcontext *ctx, GLenum type, GLenum format, +check_color( const struct gl_context *ctx, GLenum type, GLenum format, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { @@ -125,7 +125,7 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format, } static GLboolean -check_color_per_fragment_ops( const GLcontext *ctx ) +check_color_per_fragment_ops( const struct gl_context *ctx ) { return (!( ctx->Color.AlphaEnabled || ctx->Depth.Test || @@ -145,7 +145,7 @@ check_color_per_fragment_ops( const GLcontext *ctx ) } static GLboolean -check_depth_per_fragment_ops( const GLcontext *ctx ) +check_depth_per_fragment_ops( const struct gl_context *ctx ) { return ( ctx->Current.RasterPosValid && ctx->Color.ColorMask[0][RCOMP] == 0 && @@ -160,7 +160,7 @@ check_depth_per_fragment_ops( const GLcontext *ctx ) */ #if defined(MESA_packed_depth_stencil) static GLboolean -check_stencil_per_fragment_ops( const GLcontext *ctx ) +check_stencil_per_fragment_ops( const struct gl_context *ctx ) { return ( !ctx->Pixel.IndexShift && !ctx->Pixel.IndexOffset ); @@ -169,7 +169,7 @@ check_stencil_per_fragment_ops( const GLcontext *ctx ) static GLboolean -clip_pixelrect( const GLcontext *ctx, +clip_pixelrect( const struct gl_context *ctx, const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height, @@ -215,7 +215,7 @@ clip_pixelrect( const GLcontext *ctx, } static GLboolean -mgaTryReadPixels( GLcontext *ctx, +mgaTryReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -373,7 +373,7 @@ mgaTryReadPixels( GLcontext *ctx, } static void -mgaDDReadPixels( GLcontext *ctx, +mgaDDReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -386,7 +386,7 @@ mgaDDReadPixels( GLcontext *ctx, -static void do_draw_pix( GLcontext *ctx, +static void do_draw_pix( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLint pitch, const void *pixels, @@ -470,7 +470,7 @@ static void do_draw_pix( GLcontext *ctx, static GLboolean -mgaTryDrawPixels( GLcontext *ctx, +mgaTryDrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -619,7 +619,7 @@ mgaTryDrawPixels( GLcontext *ctx, } static void -mgaDDDrawPixels( GLcontext *ctx, +mgaDDDrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -637,7 +637,7 @@ mgaDDDrawPixels( GLcontext *ctx, * the same block of agp space which isn't used for anything else at * present. */ -void mgaDDInitPixelFuncs( GLcontext *ctx ) +void mgaDDInitPixelFuncs( struct gl_context *ctx ) { #if 0 /* evidently, these functions don't always work */ diff --git a/src/mesa/drivers/dri/mga/mgapixel.h b/src/mesa/drivers/dri/mga/mgapixel.h index f5f300db56..6241b4b5ef 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.h +++ b/src/mesa/drivers/dri/mga/mgapixel.h @@ -30,6 +30,6 @@ #include "main/mtypes.h" -extern void mgaDDInitPixelFuncs( GLcontext *ctx ); +extern void mgaDDInitPixelFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/mga/mgarender.c b/src/mesa/drivers/dri/mga/mgarender.c index cc0cea618d..f10a91adce 100644 --- a/src/mesa/drivers/dri/mga/mgarender.c +++ b/src/mesa/drivers/dri/mga/mgarender.c @@ -66,7 +66,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define HAVE_ELTS 0 /* for now */ -static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim ) +static void mgaDmaPrimitive( struct gl_context *ctx, GLenum prim ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint hwprim; @@ -124,7 +124,7 @@ static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim ) /**********************************************************************/ -static GLboolean mga_run_render( GLcontext *ctx, +static GLboolean mga_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 1f2fb0c39a..dd9a8d74ed 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -169,7 +169,7 @@ static void -mgaSpanRenderStart( GLcontext *ctx ) +mgaSpanRenderStart( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); FLUSH_BATCH( mmesa ); @@ -177,7 +177,7 @@ mgaSpanRenderStart( GLcontext *ctx ) } static void -mgaSpanRenderFinish( GLcontext *ctx ) +mgaSpanRenderFinish( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); _swrast_flush( ctx ); @@ -192,7 +192,7 @@ mgaSpanRenderFinish( GLcontext *ctx ) * write routines for 888 and 8888. We also need to determine whether or not * the visual has destination alpha. */ -void mgaDDInitSpanFuncs( GLcontext *ctx ) +void mgaDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = mgaSpanRenderStart; diff --git a/src/mesa/drivers/dri/mga/mgaspan.h b/src/mesa/drivers/dri/mga/mgaspan.h index a35a9b8479..48186b46e9 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.h +++ b/src/mesa/drivers/dri/mga/mgaspan.h @@ -30,7 +30,7 @@ #include "drirenderbuffer.h" -extern void mgaDDInitSpanFuncs( GLcontext *ctx ); +extern void mgaDDInitSpanFuncs( struct gl_context *ctx ); extern void mgaSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 745d5e9852..25d7de28fe 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -51,7 +51,7 @@ #include "drirenderbuffer.h" -static void updateSpecularLighting( GLcontext *ctx ); +static void updateSpecularLighting( struct gl_context *ctx ); static const GLuint mgarop_NoBLK[16] = { DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000, @@ -68,7 +68,7 @@ static const GLuint mgarop_NoBLK[16] = { * Alpha blending */ -static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) +static void mgaDDAlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLubyte refByte; @@ -111,7 +111,7 @@ static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) mmesa->hw.alpha_func = a | MGA_FIELD( AC_atref, refByte ); } -static void updateBlendLogicOp(GLcontext *ctx) +static void updateBlendLogicOp(struct gl_context *ctx) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLboolean logicOp = RGBA_LOGICOP_ENABLED(ctx); @@ -126,14 +126,14 @@ static void updateBlendLogicOp(GLcontext *ctx) mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) ); } -static void mgaDDBlendEquationSeparate(GLcontext *ctx, +static void mgaDDBlendEquationSeparate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { assert( modeRGB == modeA ); updateBlendLogicOp( ctx ); } -static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, +static void mgaDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -205,7 +205,7 @@ static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, * Depth testing */ -static void mgaDDDepthFunc(GLcontext *ctx, GLenum func) +static void mgaDDDepthFunc(struct gl_context *ctx, GLenum func) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); int zmode; @@ -239,7 +239,7 @@ static void mgaDDDepthFunc(GLcontext *ctx, GLenum func) mmesa->hw.zmode |= zmode; } -static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag) +static void mgaDDDepthMask(struct gl_context *ctx, GLboolean flag) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -250,7 +250,7 @@ static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag) } -static void mgaDDClearDepth(GLcontext *ctx, GLclampd d) +static void mgaDDClearDepth(struct gl_context *ctx, GLclampd d) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -272,7 +272,7 @@ static void mgaDDClearDepth(GLcontext *ctx, GLclampd d) */ -static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void mgaDDFogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -292,7 +292,7 @@ static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) */ -void mgaUpdateClipping(const GLcontext *ctx) +void mgaUpdateClipping(const struct gl_context *ctx) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -319,7 +319,7 @@ void mgaUpdateClipping(const GLcontext *ctx) } -static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y, +static void mgaDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { if ( ctx->Scissor.Enabled ) { @@ -338,7 +338,7 @@ static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y, #define _CULL_NEGATIVE ((1<<11)|(1<<5)|(1<<16)) #define _CULL_POSITIVE (1<<11) -static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) +static void mgaDDCullFaceFrontFace(struct gl_context *ctx, GLenum unused) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -368,7 +368,7 @@ static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) * Masks */ -static void mgaDDColorMask(GLcontext *ctx, +static void mgaDDColorMask(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -421,7 +421,7 @@ static int mgaStipples[16] = { * \param mask Pointer to the 32x32 stipple mask */ -static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void mgaDDPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const GLubyte *m = mask; @@ -478,7 +478,7 @@ static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) * sense to break them out of the core texture state update routines. */ -static void updateSpecularLighting( GLcontext *ctx ) +static void updateSpecularLighting( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); unsigned int specen; @@ -497,7 +497,7 @@ static void updateSpecularLighting( GLcontext *ctx ) */ -static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, +static void mgaDDLightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { @@ -513,7 +513,7 @@ static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, static void -mgaDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref, +mgaDDStencilFuncSeparate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -558,7 +558,7 @@ mgaDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref, } static void -mgaDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) +mgaDDStencilMaskSeparate(struct gl_context *ctx, GLenum face, GLuint mask) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -568,7 +568,7 @@ mgaDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) } static void -mgaDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail, +mgaDDStencilOpSeparate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -676,7 +676,7 @@ mgaDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail, * Window position and viewport transformation */ -void mgaCalcViewport( GLcontext *ctx ) +void mgaCalcViewport( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -694,14 +694,14 @@ void mgaCalcViewport( GLcontext *ctx ) mmesa->SetupNewInputs = ~0; } -static void mgaViewport( GLcontext *ctx, +static void mgaViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { mgaCalcViewport( ctx ); } -static void mgaDepthRange( GLcontext *ctx, +static void mgaDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { mgaCalcViewport( ctx ); @@ -712,7 +712,7 @@ static void mgaDepthRange( GLcontext *ctx, * Miscellaneous */ -static void mgaDDClearColor(GLcontext *ctx, +static void mgaDDClearColor(struct gl_context *ctx, const GLfloat color[4] ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -729,13 +729,13 @@ static void mgaDDClearColor(GLcontext *ctx, /* Fallback to swrast for select and feedback. */ -static void mgaRenderMode( GLcontext *ctx, GLenum mode ) +static void mgaRenderMode( struct gl_context *ctx, GLenum mode ) { FALLBACK( ctx, MGA_FALLBACK_RENDERMODE, (mode != GL_RENDER) ); } -static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode ) +static void mgaDDLogicOp( struct gl_context *ctx, GLenum opcode ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -791,7 +791,7 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) } -static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode ) +static void mgaDDDrawBuffer(struct gl_context *ctx, GLenum mode ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -823,7 +823,7 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode ) } -static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode ) +static void mgaDDReadBuffer(struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } @@ -834,7 +834,7 @@ static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode ) */ -static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) +static void mgaDDEnable(struct gl_context *ctx, GLenum cap, GLboolean state) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -932,7 +932,7 @@ static void mgaDDPrintDirty( const char *msg, GLuint state ) void mgaEmitHwStateLocked( mgaContextPtr mmesa ) { drm_mga_sarea_t *sarea = mmesa->sarea; - GLcontext * ctx = mmesa->glCtx; + struct gl_context * ctx = mmesa->glCtx; if (MGA_DEBUG & DEBUG_VERBOSE_MSG) mgaDDPrintDirty( __FUNCTION__, mmesa->dirty ); @@ -1009,7 +1009,7 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa ) */ -static void mgaDDValidateState( GLcontext *ctx ) +static void mgaDDValidateState( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -1033,7 +1033,7 @@ static void mgaDDValidateState( GLcontext *ctx ) } -static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void mgaDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1043,7 +1043,7 @@ static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state ) } -static void mgaRunPipeline( GLcontext *ctx ) +static void mgaRunPipeline( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -1062,7 +1062,7 @@ static void mgaRunPipeline( GLcontext *ctx ) void mgaInitState( mgaContextPtr mmesa ) { mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; if (ctx->Visual.doubleBufferMode) { /* use back buffer by default */ @@ -1161,7 +1161,7 @@ void mgaInitState( mgaContextPtr mmesa ) } -void mgaDDInitStateFuncs( GLcontext *ctx ) +void mgaDDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = mgaDDInvalidateState; ctx->Driver.Enable = mgaDDEnable; diff --git a/src/mesa/drivers/dri/mga/mgastate.h b/src/mesa/drivers/dri/mga/mgastate.h index ec65d4e6cd..6e8a869cf7 100644 --- a/src/mesa/drivers/dri/mga/mgastate.h +++ b/src/mesa/drivers/dri/mga/mgastate.h @@ -29,10 +29,10 @@ #define _MGA_STATE_H extern void mgaInitState( mgaContextPtr mmesa ); -extern void mgaDDInitStateFuncs(GLcontext *ctx); -extern void mgaUpdateClipping(const GLcontext *ctx); -extern void mgaUpdateCull( GLcontext *ctx ); -extern void mgaCalcViewport( GLcontext *ctx ); +extern void mgaDDInitStateFuncs(struct gl_context *ctx); +extern void mgaUpdateClipping(const struct gl_context *ctx); +extern void mgaUpdateCull( struct gl_context *ctx ); +extern void mgaCalcViewport( struct gl_context *ctx ); extern void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ); #endif diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index ca3dd4b013..11ab9b6117 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -161,7 +161,7 @@ static void mgaSetTexBorderColor(mgaTextureObjectPtr t, const GLfloat color[4]) static gl_format -mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +mgaChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -336,7 +336,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj ) } -static void mgaTexEnv( GLcontext *ctx, GLenum target, +static void mgaTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { GLuint unit = ctx->Texture.CurrentUnit; @@ -355,7 +355,7 @@ static void mgaTexEnv( GLcontext *ctx, GLenum target, } -static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void mgaTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -384,7 +384,7 @@ static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level, t->dirty_images[0] |= (1UL << level); } -static void mgaTexSubImage2D( GLcontext *ctx, +static void mgaTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -424,7 +424,7 @@ static void mgaTexSubImage2D( GLcontext *ctx, */ static void -mgaTexParameter( GLcontext *ctx, GLenum target, +mgaTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -480,7 +480,7 @@ mgaTexParameter( GLcontext *ctx, GLenum target, static void -mgaBindTexture( GLcontext *ctx, GLenum target, +mgaBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) || @@ -489,7 +489,7 @@ mgaBindTexture( GLcontext *ctx, GLenum target, static void -mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +mgaDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); driTextureObject * t = (driTextureObject *) tObj->DriverData; @@ -516,7 +516,7 @@ mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +mgaNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/mga/mgatex.h b/src/mesa/drivers/dri/mga/mgatex.h index 789034964a..3827fb0668 100644 --- a/src/mesa/drivers/dri/mga/mgatex.h +++ b/src/mesa/drivers/dri/mga/mgatex.h @@ -37,7 +37,7 @@ typedef struct mga_texture_object_s *mgaTextureObjectPtr; * state is properly setup. Texture residence is checked later * when we grab the lock. */ -void mgaUpdateTextureState( GLcontext *ctx ); +void mgaUpdateTextureState( struct gl_context *ctx ); int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t ); @@ -45,6 +45,6 @@ void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ); void mgaInitTextureFuncs( struct dd_function_table *functions ); -GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit ); +GLboolean mgaUpdateTextureEnvCombine( struct gl_context *ctx, int unit ); #endif diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index 07cf682f6e..7b06774adb 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -40,7 +40,7 @@ #include "mgavb.h" -static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void mgaRenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** * Functions to draw basic primitives * @@ -285,7 +285,7 @@ mga_fallback_tri( mgaContextPtr mmesa, mgaVertex *v1, mgaVertex *v2 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[3]; mga_translate_vertex( ctx, v0, &v[0] ); mga_translate_vertex( ctx, v1, &v[1] ); @@ -299,7 +299,7 @@ mga_fallback_line( mgaContextPtr mmesa, mgaVertex *v0, mgaVertex *v1 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[2]; mga_translate_vertex( ctx, v0, &v[0] ); mga_translate_vertex( ctx, v1, &v[1] ); @@ -311,7 +311,7 @@ static void mga_fallback_point( mgaContextPtr mmesa, mgaVertex *v0 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[1]; mga_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -630,7 +630,7 @@ static void init_rast_tab( void ) -static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n ) +static void mgaRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -652,13 +652,13 @@ static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n ) tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void mgaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void mgaRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } -static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mgaFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -687,7 +687,7 @@ static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \ DD_TRI_UNFILLED) -void mgaChooseRenderState(GLcontext *ctx) +void mgaChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -773,7 +773,7 @@ static GLenum reduced_prim[GL_POLYGON+1] = { /* Always called between RenderStart and RenderFinish --> We already * hold the lock. */ -void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ) +void mgaRasterPrimitive( struct gl_context *ctx, GLenum prim, GLuint hwprim ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -806,7 +806,7 @@ void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ) * which renders strips as strips, the equivalent calculations are * performed in mgarender.c. */ -static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void mgaRenderPrimitive( struct gl_context *ctx, GLenum prim ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -821,7 +821,7 @@ static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim ) } } -static void mgaRenderFinish( GLcontext *ctx ) +static void mgaRenderFinish( struct gl_context *ctx ) { if (MGA_CONTEXT(ctx)->RenderIndex & MGA_FALLBACK_BIT) _swrast_flush( ctx ); @@ -856,7 +856,7 @@ static const char *getFallbackString(GLuint bit) } -void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void mgaFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -893,7 +893,7 @@ void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) } -void mgaDDInitTriFuncs( GLcontext *ctx ) +void mgaDDInitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mgaContextPtr mmesa = MGA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mga/mgatris.h b/src/mesa/drivers/dri/mga/mgatris.h index 43612b80a1..2f574feb93 100644 --- a/src/mesa/drivers/dri/mga/mgatris.h +++ b/src/mesa/drivers/dri/mga/mgatris.h @@ -30,11 +30,11 @@ #include "main/mtypes.h" -extern void mgaDDInitTriFuncs( GLcontext *ctx ); -extern void mgaChooseRenderState( GLcontext *ctx ); -extern void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ); +extern void mgaDDInitTriFuncs( struct gl_context *ctx ); +extern void mgaChooseRenderState( struct gl_context *ctx ); +extern void mgaRasterPrimitive( struct gl_context *ctx, GLenum prim, GLuint hwprim ); -extern void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void mgaFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( ctx, bit, mode ) mgaFallback( ctx, bit, mode ) #define _MGA_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \ diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c index 71bbf33f23..f098aa5cbc 100644 --- a/src/mesa/drivers/dri/mga/mgavb.c +++ b/src/mesa/drivers/dri/mga/mgavb.c @@ -52,10 +52,10 @@ #define MGA_MAX_SETUP 0x80 static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); + void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_size; GLuint vertex_format; } setup_tab[MGA_MAX_SETUP]; @@ -316,7 +316,7 @@ void mgaPrintSetupFlags(char *msg, GLuint flags ) } -void mgaCheckTexSizes( GLcontext *ctx ) +void mgaCheckTexSizes( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -339,7 +339,7 @@ void mgaCheckTexSizes( GLcontext *ctx ) } -void mgaBuildVertices( GLcontext *ctx, +void mgaBuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ) @@ -386,7 +386,7 @@ void mgaBuildVertices( GLcontext *ctx, } -void mgaChooseVertexState( GLcontext *ctx ) +void mgaChooseVertexState( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -433,7 +433,7 @@ void mgaChooseVertexState( GLcontext *ctx ) -void *mga_emit_contiguous_verts( GLcontext *ctx, +void *mga_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest) @@ -446,7 +446,7 @@ void *mga_emit_contiguous_verts( GLcontext *ctx, -void mgaInitVB( GLcontext *ctx ) +void mgaInitVB( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -467,7 +467,7 @@ void mgaInitVB( GLcontext *ctx ) } -void mgaFreeVB( GLcontext *ctx ) +void mgaFreeVB( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); if (mmesa->verts) { diff --git a/src/mesa/drivers/dri/mga/mgavb.h b/src/mesa/drivers/dri/mga/mgavb.h index 8d24ab7b5f..20e5d8ba70 100644 --- a/src/mesa/drivers/dri/mga/mgavb.h +++ b/src/mesa/drivers/dri/mga/mgavb.h @@ -39,27 +39,27 @@ _NEW_FOG) -extern void mgaChooseVertexState( GLcontext *ctx ); -extern void mgaCheckTexSizes( GLcontext *ctx ); -extern void mgaBuildVertices( GLcontext *ctx, +extern void mgaChooseVertexState( struct gl_context *ctx ); +extern void mgaCheckTexSizes( struct gl_context *ctx ); +extern void mgaBuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void mgaPrintSetupFlags(char *msg, GLuint flags ); -extern void mgaInitVB( GLcontext *ctx ); -extern void mgaFreeVB( GLcontext *ctx ); +extern void mgaInitVB( struct gl_context *ctx ); +extern void mgaFreeVB( struct gl_context *ctx ); -extern void *mga_emit_contiguous_verts( GLcontext *ctx, +extern void *mga_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest ); -extern void mga_translate_vertex(GLcontext *ctx, +extern void mga_translate_vertex(struct gl_context *ctx, const mgaVertex *src, SWvertex *dst); -extern void mga_print_vertex( GLcontext *ctx, const mgaVertex *v ); +extern void mga_print_vertex( struct gl_context *ctx, const mgaVertex *v ); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c index fc5f77b46a..f31772fe1d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c @@ -28,7 +28,7 @@ #include "nouveau_context.h" static GLboolean -nouveau_bo_marker_emit(GLcontext *ctx, struct nouveau_bo_marker *m, +nouveau_bo_marker_emit(struct gl_context *ctx, struct nouveau_bo_marker *m, uint32_t flags) { struct nouveau_channel *chan = context_chan(ctx); @@ -136,7 +136,7 @@ nouveau_bo_context_reset(struct nouveau_bo_context *bctx) } GLboolean -nouveau_bo_state_emit(GLcontext *ctx) +nouveau_bo_state_emit(struct gl_context *ctx) { struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo; int i, j; @@ -155,7 +155,7 @@ nouveau_bo_state_emit(GLcontext *ctx) } void -nouveau_bo_state_init(GLcontext *ctx) +nouveau_bo_state_init(struct gl_context *ctx) { struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo; int i; @@ -165,7 +165,7 @@ nouveau_bo_state_init(GLcontext *ctx) } void -nouveau_bo_state_destroy(GLcontext *ctx) +nouveau_bo_state_destroy(struct gl_context *ctx) { struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo; int i, j; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h index da0a3a5c6f..6119a8336e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h @@ -52,7 +52,7 @@ struct nouveau_bo_marker { }; struct nouveau_bo_context { - GLcontext *ctx; + struct gl_context *ctx; struct nouveau_bo_marker *marker; int allocated; @@ -84,13 +84,13 @@ void nouveau_bo_context_reset(struct nouveau_bo_context *bctx); GLboolean -nouveau_bo_state_emit(GLcontext *ctx); +nouveau_bo_state_emit(struct gl_context *ctx); void -nouveau_bo_state_init(GLcontext *ctx); +nouveau_bo_state_init(struct gl_context *ctx); void -nouveau_bo_state_destroy(GLcontext *ctx); +nouveau_bo_state_destroy(struct gl_context *ctx); #define __context_bctx(ctx, i) \ ({ \ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c index 5906ad6d39..ad6e5bd805 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c @@ -31,7 +31,7 @@ #include "main/bufferobj.h" static struct gl_buffer_object * -nouveau_bufferobj_new(GLcontext *ctx, GLuint buffer, GLenum target) +nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target) { struct nouveau_bufferobj *nbo; @@ -45,7 +45,7 @@ nouveau_bufferobj_new(GLcontext *ctx, GLuint buffer, GLenum target) } static void -nouveau_bufferobj_del(GLcontext *ctx, struct gl_buffer_object *obj) +nouveau_bufferobj_del(struct gl_context *ctx, struct gl_buffer_object *obj) { struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj); @@ -54,7 +54,7 @@ nouveau_bufferobj_del(GLcontext *ctx, struct gl_buffer_object *obj) } static GLboolean -nouveau_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size, +nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *obj) { @@ -80,7 +80,7 @@ nouveau_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size, } static void -nouveau_bufferobj_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, +nouveau_bufferobj_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, struct gl_buffer_object *obj) { @@ -92,7 +92,7 @@ nouveau_bufferobj_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, } static void -nouveau_bufferobj_get_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, +nouveau_bufferobj_get_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data, struct gl_buffer_object *obj) { @@ -104,7 +104,7 @@ nouveau_bufferobj_get_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, } static void * -nouveau_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, +nouveau_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { return ctx->Driver.MapBufferRange(ctx, target, 0, obj->Size, access, @@ -112,7 +112,7 @@ nouveau_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, } static void * -nouveau_bufferobj_map_range(GLcontext *ctx, GLenum target, GLintptr offset, +nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLenum access, struct gl_buffer_object *obj) { @@ -142,7 +142,7 @@ nouveau_bufferobj_map_range(GLcontext *ctx, GLenum target, GLintptr offset, } static GLboolean -nouveau_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj) +nouveau_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj) { struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index fed0b7a34f..d3e2c0df6c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -69,7 +69,7 @@ static void nouveau_channel_flush_notify(struct nouveau_channel *chan) { struct nouveau_context *nctx = chan->user_private; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; if (nctx->fallback < SWRAST) nouveau_bo_state_emit(ctx); @@ -83,7 +83,7 @@ nouveau_context_create(gl_api api, __DRIscreen *dri_screen = dri_ctx->driScreenPriv; struct nouveau_screen *screen = dri_screen->private; struct nouveau_context *nctx; - GLcontext *ctx; + struct gl_context *ctx; ctx = screen->driver->context_create(screen, visual, share_ctx); if (!ctx) @@ -97,8 +97,8 @@ nouveau_context_create(gl_api api, } GLboolean -nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, - const struct gl_config *visual, GLcontext *share_ctx) +nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, + const struct gl_config *visual, struct gl_context *share_ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct dd_function_table functions; @@ -144,7 +144,7 @@ nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, } void -nouveau_context_deinit(GLcontext *ctx) +nouveau_context_deinit(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -171,7 +171,7 @@ void nouveau_context_destroy(__DRIcontext *dri_ctx) { struct nouveau_context *nctx = dri_ctx->driverPrivate; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; context_drv(ctx)->context_destroy(ctx); } @@ -179,7 +179,7 @@ nouveau_context_destroy(__DRIcontext *dri_ctx) void nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw) { - GLcontext *ctx = dri_ctx->driverPrivate; + struct gl_context *ctx = dri_ctx->driverPrivate; __DRIscreen *screen = dri_ctx->driScreenPriv; struct gl_framebuffer *fb = draw->driverPrivate; struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb); @@ -253,7 +253,7 @@ static void update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw, int *stamp) { - GLcontext *ctx = dri_ctx->driverPrivate; + struct gl_context *ctx = dri_ctx->driverPrivate; struct gl_framebuffer *fb = draw->driverPrivate; *stamp = *draw->pStamp; @@ -273,7 +273,7 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw, { if (dri_ctx) { struct nouveau_context *nctx = dri_ctx->driverPrivate; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; /* Ask the X server for new renderbuffers. */ if (dri_draw->driverPrivate != ctx->WinSysDrawBuffer) @@ -307,7 +307,7 @@ nouveau_context_unbind(__DRIcontext *dri_ctx) } void -nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode) +nouveau_fallback(struct gl_context *ctx, enum nouveau_fallback mode) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -339,7 +339,7 @@ validate_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw, } void -nouveau_validate_framebuffer(GLcontext *ctx) +nouveau_validate_framebuffer(struct gl_context *ctx) { __DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context; __DRIdrawable *dri_draw = dri_ctx->driDrawablePriv; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 8cbfefe85a..23a8725672 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -57,7 +57,7 @@ struct nouveau_hw_state { }; struct nouveau_context { - GLcontext base; + struct gl_context base; __DRIcontext *dri_context; struct nouveau_screen *screen; @@ -99,11 +99,11 @@ nouveau_context_create(gl_api api, void *share_ctx); GLboolean -nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, - const struct gl_config *visual, GLcontext *share_ctx); +nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, + const struct gl_config *visual, struct gl_context *share_ctx); void -nouveau_context_deinit(GLcontext *ctx); +nouveau_context_deinit(struct gl_context *ctx); void nouveau_context_destroy(__DRIcontext *dri_ctx); @@ -119,10 +119,10 @@ GLboolean nouveau_context_unbind(__DRIcontext *dri_ctx); void -nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode); +nouveau_fallback(struct gl_context *ctx, enum nouveau_fallback mode); void -nouveau_validate_framebuffer(GLcontext *ctx); +nouveau_validate_framebuffer(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 6452fe218e..27e2892f71 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -32,7 +32,7 @@ #include "drivers/common/meta.h" static const GLubyte * -nouveau_get_string(GLcontext *ctx, GLenum name) +nouveau_get_string(struct gl_context *ctx, GLenum name) { static char buffer[128]; char hardware_name[32]; @@ -52,7 +52,7 @@ nouveau_get_string(GLcontext *ctx, GLenum name) } static void -nouveau_flush(GLcontext *ctx) +nouveau_flush(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -70,13 +70,13 @@ nouveau_flush(GLcontext *ctx) } static void -nouveau_finish(GLcontext *ctx) +nouveau_finish(struct gl_context *ctx) { nouveau_flush(ctx); } void -nouveau_clear(GLcontext *ctx, GLbitfield buffers) +nouveau_clear(struct gl_context *ctx, GLbitfield buffers) { struct gl_framebuffer *fb = ctx->DrawBuffer; int x, y, w, h; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h index fa2bc7abd1..8036b18edc 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h @@ -51,16 +51,16 @@ #define DRIVER_AUTHOR "Nouveau" struct nouveau_driver { - GLcontext *(*context_create)(struct nouveau_screen *screen, + struct gl_context *(*context_create)(struct nouveau_screen *screen, const struct gl_config *visual, - GLcontext *share_ctx); - void (*context_destroy)(GLcontext *ctx); + struct gl_context *share_ctx); + void (*context_destroy)(struct gl_context *ctx); - void (*surface_copy)(GLcontext *ctx, + void (*surface_copy)(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, int w, int h); - void (*surface_fill)(GLcontext *ctx, + void (*surface_fill)(struct gl_context *ctx, struct nouveau_surface *dst, unsigned mask, unsigned value, int dx, int dy, int w, int h); @@ -73,10 +73,10 @@ struct nouveau_driver { fprintf(stderr, "%s: " format, __func__, ## __VA_ARGS__) void -nouveau_clear(GLcontext *ctx, GLbitfield buffers); +nouveau_clear(struct gl_context *ctx, GLbitfield buffers); void -nouveau_span_functions_init(GLcontext *ctx); +nouveau_span_functions_init(struct gl_context *ctx); void nouveau_driver_functions_init(struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index 397d4ad1eb..079b5d63e4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -86,7 +86,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat) } static GLboolean -nouveau_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +nouveau_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -115,7 +115,7 @@ nouveau_renderbuffer_del(struct gl_renderbuffer *rb) } static struct gl_renderbuffer * -nouveau_renderbuffer_new(GLcontext *ctx, GLuint name) +nouveau_renderbuffer_new(struct gl_context *ctx, GLuint name) { struct gl_renderbuffer *rb; @@ -133,7 +133,7 @@ nouveau_renderbuffer_new(GLcontext *ctx, GLuint name) } static GLboolean -nouveau_renderbuffer_dri_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +nouveau_renderbuffer_dri_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -166,7 +166,7 @@ nouveau_renderbuffer_dri_new(GLenum format, __DRIdrawable *drawable) } static struct gl_framebuffer * -nouveau_framebuffer_new(GLcontext *ctx, GLuint name) +nouveau_framebuffer_new(struct gl_context *ctx, GLuint name) { struct nouveau_framebuffer *nfb; @@ -195,7 +195,7 @@ nouveau_framebuffer_dri_new(const struct gl_config *visual) } static void -nouveau_bind_framebuffer(GLcontext *ctx, GLenum target, +nouveau_bind_framebuffer(struct gl_context *ctx, GLenum target, struct gl_framebuffer *dfb, struct gl_framebuffer *rfb) { @@ -203,7 +203,7 @@ nouveau_bind_framebuffer(GLcontext *ctx, GLenum target, } static void -nouveau_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +nouveau_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb); @@ -227,7 +227,7 @@ get_tex_format(struct gl_texture_image *ti) } static void -nouveau_render_texture(GLcontext *ctx, struct gl_framebuffer *fb, +nouveau_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { struct gl_renderbuffer *rb = att->Renderbuffer; @@ -255,7 +255,7 @@ nouveau_render_texture(GLcontext *ctx, struct gl_framebuffer *fb, } static void -nouveau_finish_render_texture(GLcontext *ctx, +nouveau_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { texture_dirty(att->Texture); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h b/src/mesa/drivers/dri/nouveau/nouveau_render.h index 29d96eda77..81c6119fcc 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_render.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h @@ -31,7 +31,7 @@ struct nouveau_array_state; -typedef void (*dispatch_t)(GLcontext *, unsigned int, int, unsigned int); +typedef void (*dispatch_t)(struct gl_context *, unsigned int, int, unsigned int); typedef unsigned (*extract_u_t)(struct nouveau_array_state *, int, int); typedef float (*extract_f_t)(struct nouveau_array_state *, int, int); @@ -40,7 +40,7 @@ struct nouveau_attr_info { int imm_method; int imm_fields; - void (*emit)(GLcontext *, struct nouveau_array_state *, const void *); + void (*emit)(struct gl_context *, struct nouveau_array_state *, const void *); }; struct nouveau_array_state { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c index 7ccd7e6416..dd38c14aa7 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c @@ -104,9 +104,9 @@ static void get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch) { if (!a->fields) { - auto void f(GLcontext *, unsigned int, int, unsigned int); + auto void f(struct gl_context *, unsigned int, int, unsigned int); - void f(GLcontext *ctx, unsigned int start, int delta, + void f(struct gl_context *ctx, unsigned int start, int delta, unsigned int n) { struct nouveau_channel *chan = context_chan(ctx); RENDER_LOCALS(ctx); @@ -117,9 +117,9 @@ get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch) *dispatch = f; } else if (a->type == GL_UNSIGNED_INT) { - auto void f(GLcontext *, unsigned int, int, unsigned int); + auto void f(struct gl_context *, unsigned int, int, unsigned int); - void f(GLcontext *ctx, unsigned int start, int delta, + void f(struct gl_context *ctx, unsigned int start, int delta, unsigned int n) { struct nouveau_channel *chan = context_chan(ctx); RENDER_LOCALS(ctx); @@ -130,9 +130,9 @@ get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch) *dispatch = f; } else { - auto void f(GLcontext *, unsigned int, int, unsigned int); + auto void f(struct gl_context *, unsigned int, int, unsigned int); - void f(GLcontext *ctx, unsigned int start, int delta, + void f(struct gl_context *ctx, unsigned int start, int delta, unsigned int n) { struct nouveau_channel *chan = context_chan(ctx); RENDER_LOCALS(ctx); @@ -208,7 +208,7 @@ get_array_extract(struct nouveau_array_state *a, * always be located right at the beginning of . */ static inline void * -get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo, +get_scratch_vbo(struct gl_context *ctx, unsigned size, struct nouveau_bo **bo, unsigned *offset) { struct nouveau_scratch_state *scratch = &to_render_state(ctx)->scratch; @@ -253,7 +253,7 @@ get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo, * Returns how many vertices you can draw using pushbuf dwords. */ static inline unsigned -get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib, +get_max_vertices(struct gl_context *ctx, const struct _mesa_index_buffer *ib, int n) { struct nouveau_render_state *render = to_render_state(ctx); @@ -290,7 +290,7 @@ get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib, #include "nouveau_swtnl_t.c" static void -TAG(emit_material)(GLcontext *ctx, struct nouveau_array_state *a, +TAG(emit_material)(struct gl_context *ctx, struct nouveau_array_state *a, const void *v) { const int attr = a->attr - VERT_ATTRIB_GENERIC0; @@ -314,7 +314,7 @@ TAG(emit_material)(GLcontext *ctx, struct nouveau_array_state *a, } static void -TAG(render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, +TAG(render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -334,7 +334,7 @@ TAG(render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, } void -TAG(render_init)(GLcontext *ctx) +TAG(render_init)(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_scratch_state *scratch = &render->scratch; @@ -355,7 +355,7 @@ TAG(render_init)(GLcontext *ctx) } void -TAG(render_destroy)(GLcontext *ctx) +TAG(render_destroy)(struct gl_context *ctx) { TAG(swtnl_destroy)(ctx); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c b/src/mesa/drivers/dri/nouveau/nouveau_span.c index 1bfdecc6a2..761cc769ef 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_span.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c @@ -131,7 +131,7 @@ renderbuffer_map_unmap(struct gl_renderbuffer *rb, GLboolean map) } static void -texture_unit_map_unmap(GLcontext *ctx, struct gl_texture_unit *u, GLboolean map) +texture_unit_map_unmap(struct gl_context *ctx, struct gl_texture_unit *u, GLboolean map) { if (!u->_ReallyEnabled) return; @@ -157,7 +157,7 @@ framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map) } static void -span_map_unmap(GLcontext *ctx, GLboolean map) +span_map_unmap(struct gl_context *ctx, GLboolean map) { int i; @@ -171,21 +171,21 @@ span_map_unmap(GLcontext *ctx, GLboolean map) } static void -nouveau_span_start(GLcontext *ctx) +nouveau_span_start(struct gl_context *ctx) { nouveau_fallback(ctx, SWRAST); span_map_unmap(ctx, GL_TRUE); } static void -nouveau_span_finish(GLcontext *ctx) +nouveau_span_finish(struct gl_context *ctx) { span_map_unmap(ctx, GL_FALSE); nouveau_fallback(ctx, HWTNL); } void -nouveau_span_functions_init(GLcontext *ctx) +nouveau_span_functions_init(struct gl_context *ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 01bcbc4b3c..7b7ddd2f54 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -33,45 +33,45 @@ #include "tnl/tnl.h" static void -nouveau_alpha_func(GLcontext *ctx, GLenum func, GLfloat ref) +nouveau_alpha_func(struct gl_context *ctx, GLenum func, GLfloat ref) { context_dirty(ctx, ALPHA_FUNC); } static void -nouveau_blend_color(GLcontext *ctx, const GLfloat color[4]) +nouveau_blend_color(struct gl_context *ctx, const GLfloat color[4]) { context_dirty(ctx, BLEND_COLOR); } static void -nouveau_blend_equation_separate(GLcontext *ctx, GLenum modeRGB, GLenum modeA) +nouveau_blend_equation_separate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { context_dirty(ctx, BLEND_EQUATION); } static void -nouveau_blend_func_separate(GLcontext *ctx, GLenum sfactorRGB, +nouveau_blend_func_separate(struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { context_dirty(ctx, BLEND_FUNC); } static void -nouveau_clip_plane(GLcontext *ctx, GLenum plane, const GLfloat *equation) +nouveau_clip_plane(struct gl_context *ctx, GLenum plane, const GLfloat *equation) { context_dirty_i(ctx, CLIP_PLANE, plane - GL_CLIP_PLANE0); } static void -nouveau_color_mask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, +nouveau_color_mask(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { context_dirty(ctx, COLOR_MASK); } static void -nouveau_color_material(GLcontext *ctx, GLenum face, GLenum mode) +nouveau_color_material(struct gl_context *ctx, GLenum face, GLenum mode) { context_dirty(ctx, COLOR_MATERIAL); context_dirty(ctx, MATERIAL_FRONT_AMBIENT); @@ -83,44 +83,44 @@ nouveau_color_material(GLcontext *ctx, GLenum face, GLenum mode) } static void -nouveau_cull_face(GLcontext *ctx, GLenum mode) +nouveau_cull_face(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, CULL_FACE); } static void -nouveau_front_face(GLcontext *ctx, GLenum mode) +nouveau_front_face(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, FRONT_FACE); } static void -nouveau_depth_func(GLcontext *ctx, GLenum func) +nouveau_depth_func(struct gl_context *ctx, GLenum func) { context_dirty(ctx, DEPTH); } static void -nouveau_depth_mask(GLcontext *ctx, GLboolean flag) +nouveau_depth_mask(struct gl_context *ctx, GLboolean flag) { context_dirty(ctx, DEPTH); } static void -nouveau_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval) +nouveau_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval) { context_dirty(ctx, VIEWPORT); } static void -nouveau_draw_buffers(GLcontext *ctx, GLsizei n, const GLenum *buffers) +nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers) { nouveau_validate_framebuffer(ctx); context_dirty(ctx, FRAMEBUFFER); } static void -nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state) +nouveau_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { int i; @@ -242,13 +242,13 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state) } static void -nouveau_fog(GLcontext *ctx, GLenum pname, const GLfloat *params) +nouveau_fog(struct gl_context *ctx, GLenum pname, const GLfloat *params) { context_dirty(ctx, FOG); } static void -nouveau_light(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params) +nouveau_light(struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params) { switch (pname) { case GL_AMBIENT: @@ -276,100 +276,100 @@ nouveau_light(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params) } static void -nouveau_light_model(GLcontext *ctx, GLenum pname, const GLfloat *params) +nouveau_light_model(struct gl_context *ctx, GLenum pname, const GLfloat *params) { context_dirty(ctx, LIGHT_MODEL); context_dirty(ctx, MODELVIEW); } static void -nouveau_line_stipple(GLcontext *ctx, GLint factor, GLushort pattern ) +nouveau_line_stipple(struct gl_context *ctx, GLint factor, GLushort pattern ) { context_dirty(ctx, LINE_STIPPLE); } static void -nouveau_line_width(GLcontext *ctx, GLfloat width) +nouveau_line_width(struct gl_context *ctx, GLfloat width) { context_dirty(ctx, LINE_MODE); } static void -nouveau_logic_opcode(GLcontext *ctx, GLenum opcode) +nouveau_logic_opcode(struct gl_context *ctx, GLenum opcode) { context_dirty(ctx, LOGIC_OPCODE); } static void -nouveau_point_parameter(GLcontext *ctx, GLenum pname, const GLfloat *params) +nouveau_point_parameter(struct gl_context *ctx, GLenum pname, const GLfloat *params) { context_dirty(ctx, POINT_PARAMETER); } static void -nouveau_point_size(GLcontext *ctx, GLfloat size) +nouveau_point_size(struct gl_context *ctx, GLfloat size) { context_dirty(ctx, POINT_MODE); } static void -nouveau_polygon_mode(GLcontext *ctx, GLenum face, GLenum mode) +nouveau_polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode) { context_dirty(ctx, POLYGON_MODE); } static void -nouveau_polygon_offset(GLcontext *ctx, GLfloat factor, GLfloat units) +nouveau_polygon_offset(struct gl_context *ctx, GLfloat factor, GLfloat units) { context_dirty(ctx, POLYGON_OFFSET); } static void -nouveau_polygon_stipple(GLcontext *ctx, const GLubyte *mask) +nouveau_polygon_stipple(struct gl_context *ctx, const GLubyte *mask) { context_dirty(ctx, POLYGON_STIPPLE); } static void -nouveau_render_mode(GLcontext *ctx, GLenum mode) +nouveau_render_mode(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, RENDER_MODE); } static void -nouveau_scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +nouveau_scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { context_dirty(ctx, SCISSOR); } static void -nouveau_shade_model(GLcontext *ctx, GLenum mode) +nouveau_shade_model(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, SHADE_MODEL); } static void -nouveau_stencil_func_separate(GLcontext *ctx, GLenum face, GLenum func, +nouveau_stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { context_dirty(ctx, STENCIL_FUNC); } static void -nouveau_stencil_mask_separate(GLcontext *ctx, GLenum face, GLuint mask) +nouveau_stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask) { context_dirty(ctx, STENCIL_MASK); } static void -nouveau_stencil_op_separate(GLcontext *ctx, GLenum face, GLenum fail, +nouveau_stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { context_dirty(ctx, STENCIL_OP); } static void -nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname, +nouveau_tex_gen(struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params) { switch (pname) { @@ -384,7 +384,7 @@ nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname, } static void -nouveau_tex_env(GLcontext *ctx, GLenum target, GLenum pname, +nouveau_tex_env(struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param) { switch (target) { @@ -398,7 +398,7 @@ nouveau_tex_env(GLcontext *ctx, GLenum target, GLenum pname, } static void -nouveau_tex_parameter(GLcontext *ctx, GLenum target, +nouveau_tex_parameter(struct gl_context *ctx, GLenum target, struct gl_texture_object *t, GLenum pname, const GLfloat *params) { @@ -424,18 +424,18 @@ nouveau_tex_parameter(GLcontext *ctx, GLenum target, } static void -nouveau_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +nouveau_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { context_dirty(ctx, VIEWPORT); } void -nouveau_emit_nothing(GLcontext *ctx, int emit) +nouveau_emit_nothing(struct gl_context *ctx, int emit) { } int -nouveau_next_dirty_state(GLcontext *ctx) +nouveau_next_dirty_state(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); int i = BITSET_FFS(nctx->dirty) - 1; @@ -447,7 +447,7 @@ nouveau_next_dirty_state(GLcontext *ctx) } void -nouveau_state_emit(GLcontext *ctx) +nouveau_state_emit(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); const struct nouveau_driver *drv = context_drv(ctx); @@ -462,7 +462,7 @@ nouveau_state_emit(GLcontext *ctx) } static void -nouveau_update_state(GLcontext *ctx, GLbitfield new_state) +nouveau_update_state(struct gl_context *ctx, GLbitfield new_state) { int i; @@ -496,7 +496,7 @@ nouveau_update_state(GLcontext *ctx, GLbitfield new_state) } void -nouveau_state_init(GLcontext *ctx) +nouveau_state_init(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h b/src/mesa/drivers/dri/nouveau/nouveau_state.h index 38ac9753c8..cc61cf1a52 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h @@ -105,18 +105,18 @@ enum { MAX_NOUVEAU_STATE = NUM_NOUVEAU_STATE + 16, }; -typedef void (*nouveau_state_func)(GLcontext *ctx, int emit); +typedef void (*nouveau_state_func)(struct gl_context *ctx, int emit); void -nouveau_state_init(GLcontext *ctx); +nouveau_state_init(struct gl_context *ctx); void -nouveau_emit_nothing(GLcontext *ctx, int emit); +nouveau_emit_nothing(struct gl_context *ctx, int emit); int -nouveau_next_dirty_state(GLcontext *ctx); +nouveau_next_dirty_state(struct gl_context *ctx); void -nouveau_state_emit(GLcontext *ctx); +nouveau_state_emit(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.c b/src/mesa/drivers/dri/nouveau/nouveau_surface.c index b6b5c641c0..e6a712095c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_surface.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.c @@ -29,7 +29,7 @@ #include "nouveau_util.h" void -nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s, +nouveau_surface_alloc(struct gl_context *ctx, struct nouveau_surface *s, enum nouveau_surface_layout layout, unsigned flags, unsigned format, unsigned width, unsigned height) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.h b/src/mesa/drivers/dri/nouveau/nouveau_surface.h index ebdc89afb4..8915ee4ca0 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_surface.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.h @@ -46,7 +46,7 @@ struct nouveau_surface { }; void -nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s, +nouveau_surface_alloc(struct gl_context *ctx, struct nouveau_surface *s, enum nouveau_surface_layout layout, unsigned flags, unsigned format, unsigned width, unsigned height); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c index a1609a0dd5..b3588e8fd3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c @@ -99,7 +99,7 @@ static struct swtnl_attr_info { }; static void -swtnl_choose_attrs(GLcontext *ctx) +swtnl_choose_attrs(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -153,7 +153,7 @@ swtnl_choose_attrs(GLcontext *ctx) } static void -swtnl_alloc_vertices(GLcontext *ctx) +swtnl_alloc_vertices(struct gl_context *ctx) { struct nouveau_swtnl_state *swtnl = &to_render_state(ctx)->swtnl; @@ -164,7 +164,7 @@ swtnl_alloc_vertices(GLcontext *ctx) } static void -swtnl_bind_vertices(GLcontext *ctx) +swtnl_bind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_swtnl_state *swtnl = &render->swtnl; @@ -182,7 +182,7 @@ swtnl_bind_vertices(GLcontext *ctx) } static void -swtnl_unbind_vertices(GLcontext *ctx) +swtnl_unbind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -200,7 +200,7 @@ swtnl_unbind_vertices(GLcontext *ctx) } static void -swtnl_flush_vertices(GLcontext *ctx) +swtnl_flush_vertices(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_swtnl_state *swtnl = &to_render_state(ctx)->swtnl; @@ -232,25 +232,25 @@ swtnl_flush_vertices(GLcontext *ctx) /* TnL renderer entry points */ static void -swtnl_start(GLcontext *ctx) +swtnl_start(struct gl_context *ctx) { swtnl_choose_attrs(ctx); } static void -swtnl_finish(GLcontext *ctx) +swtnl_finish(struct gl_context *ctx) { swtnl_flush_vertices(ctx); swtnl_unbind_vertices(ctx); } static void -swtnl_primitive(GLcontext *ctx, GLenum mode) +swtnl_primitive(struct gl_context *ctx, GLenum mode) { } static void -swtnl_reset_stipple(GLcontext *ctx) +swtnl_reset_stipple(struct gl_context *ctx) { } @@ -273,7 +273,7 @@ swtnl_reset_stipple(GLcontext *ctx) } while (0) static void -swtnl_points(GLcontext *ctx, GLuint first, GLuint last) +swtnl_points(struct gl_context *ctx, GLuint first, GLuint last) { int i, count; @@ -289,7 +289,7 @@ swtnl_points(GLcontext *ctx, GLuint first, GLuint last) } static void -swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2) +swtnl_line(struct gl_context *ctx, GLuint v1, GLuint v2) { BEGIN_PRIMITIVE(GL_LINES, 2); OUT_VERTEX(v1); @@ -297,7 +297,7 @@ swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2) } static void -swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) +swtnl_triangle(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3) { BEGIN_PRIMITIVE(GL_TRIANGLES, 3); OUT_VERTEX(v1); @@ -306,7 +306,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) } static void -swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) +swtnl_quad(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) { BEGIN_PRIMITIVE(GL_QUADS, 4); OUT_VERTEX(v1); @@ -317,7 +317,7 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) /* TnL initialization. */ static void -TAG(swtnl_init)(GLcontext *ctx) +TAG(swtnl_init)(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -348,7 +348,7 @@ TAG(swtnl_init)(GLcontext *ctx) } static void -TAG(swtnl_destroy)(GLcontext *ctx) +TAG(swtnl_destroy)(struct gl_context *ctx) { nouveau_bo_ref(NULL, &to_render_state(ctx)->swtnl.vbo); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 14c7b5f64b..cd063702af 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -41,7 +41,7 @@ #include "drivers/common/meta.h" static struct gl_texture_object * -nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target) +nouveau_texture_new(struct gl_context *ctx, GLuint name, GLenum target) { struct nouveau_texture *nt = CALLOC_STRUCT(nouveau_texture); @@ -51,7 +51,7 @@ nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target) } static void -nouveau_texture_free(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_free(struct gl_context *ctx, struct gl_texture_object *t) { struct nouveau_texture *nt = to_nouveau_texture(t); int i; @@ -63,7 +63,7 @@ nouveau_texture_free(GLcontext *ctx, struct gl_texture_object *t) } static struct gl_texture_image * -nouveau_teximage_new(GLcontext *ctx) +nouveau_teximage_new(struct gl_context *ctx) { struct nouveau_teximage *nti = CALLOC_STRUCT(nouveau_teximage); @@ -71,7 +71,7 @@ nouveau_teximage_new(GLcontext *ctx) } static void -nouveau_teximage_free(GLcontext *ctx, struct gl_texture_image *ti) +nouveau_teximage_free(struct gl_context *ctx, struct gl_texture_image *ti) { struct nouveau_teximage *nti = to_nouveau_teximage(ti); @@ -79,7 +79,7 @@ nouveau_teximage_free(GLcontext *ctx, struct gl_texture_image *ti) } static void -nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti) +nouveau_teximage_map(struct gl_context *ctx, struct gl_texture_image *ti) { struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; int ret; @@ -93,7 +93,7 @@ nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti) } static void -nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti) +nouveau_teximage_unmap(struct gl_context *ctx, struct gl_texture_image *ti) { struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; @@ -103,7 +103,7 @@ nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti) } static gl_format -nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat, +nouveau_choose_tex_format(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) { switch (internalFormat) { @@ -195,7 +195,7 @@ teximage_fits(struct gl_texture_object *t, int level) } static GLboolean -validate_teximage(GLcontext *ctx, struct gl_texture_object *t, +validate_teximage(struct gl_context *ctx, struct gl_texture_object *t, int level, int x, int y, int z, int width, int height, int depth) { @@ -231,7 +231,7 @@ get_last_level(struct gl_texture_object *t) } static void -relayout_texture(GLcontext *ctx, struct gl_texture_object *t) +relayout_texture(struct gl_context *ctx, struct gl_texture_object *t) { struct gl_texture_image *base = t->Image[0][t->BaseLevel]; @@ -284,7 +284,7 @@ relayout_texture(GLcontext *ctx, struct gl_texture_object *t) } GLboolean -nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t) { struct nouveau_texture *nt = to_nouveau_texture(t); int i, last = get_last_level(t); @@ -311,7 +311,7 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t) } void -nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t) { if (!teximage_fits(t, t->BaseLevel) || !teximage_fits(t, get_last_level(t))) { @@ -335,7 +335,7 @@ get_teximage_placement(struct gl_texture_image *ti) } static void -nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, +nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -386,7 +386,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } static void -nouveau_teximage_1d(GLcontext *ctx, GLenum target, GLint level, +nouveau_teximage_1d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -400,7 +400,7 @@ nouveau_teximage_1d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_teximage_2d(GLcontext *ctx, GLenum target, GLint level, +nouveau_teximage_2d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -414,7 +414,7 @@ nouveau_teximage_2d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level, +nouveau_teximage_3d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -428,7 +428,7 @@ nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, +nouveau_texsubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -462,7 +462,7 @@ nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } static void -nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level, +nouveau_texsubimage_3d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -476,7 +476,7 @@ nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level, +nouveau_texsubimage_2d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const void *pixels, @@ -490,7 +490,7 @@ nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level, +nouveau_texsubimage_1d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, @@ -503,7 +503,7 @@ nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_get_teximage(GLcontext *ctx, GLenum target, GLint level, +nouveau_get_teximage(struct gl_context *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_object *t, struct gl_texture_image *ti) @@ -515,7 +515,7 @@ nouveau_get_teximage(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_bind_texture(GLcontext *ctx, GLenum target, +nouveau_bind_texture(struct gl_context *ctx, GLenum target, struct gl_texture_object *t) { context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit); @@ -541,7 +541,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw) { struct nouveau_context *nctx = dri_ctx->driverPrivate; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; struct gl_framebuffer *fb = draw->driverPrivate; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; @@ -574,7 +574,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, } static void -nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_map(struct gl_context *ctx, struct gl_texture_object *t) { int i; @@ -585,7 +585,7 @@ nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t) } static void -nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_unmap(struct gl_context *ctx, struct gl_texture_object *t) { int i; @@ -596,7 +596,7 @@ nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t) } static void -store_mipmap(GLcontext *ctx, GLenum target, int first, int last, +store_mipmap(struct gl_context *ctx, GLenum target, int first, int last, struct gl_texture_object *t) { struct gl_pixelstore_attrib packing = { @@ -624,7 +624,7 @@ store_mipmap(GLcontext *ctx, GLenum target, int first, int last, } static void -nouveau_generate_mipmap(GLcontext *ctx, GLenum target, +nouveau_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *t) { if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.h b/src/mesa/drivers/dri/nouveau/nouveau_texture.h index 251f537bba..fc170215f3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.h @@ -49,9 +49,9 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw); GLboolean -nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t); +nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t); void -nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t); +nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h index 584cb80ef6..8df8867d14 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_util.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h @@ -130,7 +130,7 @@ get_scissors(struct gl_framebuffer *fb, int *x, int *y, int *w, int *h) } static inline void -get_viewport_scale(GLcontext *ctx, float a[16]) +get_viewport_scale(struct gl_context *ctx, float a[16]) { struct gl_viewport_attrib *vp = &ctx->Viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -147,7 +147,7 @@ get_viewport_scale(GLcontext *ctx, float a[16]) } static inline void -get_viewport_translate(GLcontext *ctx, float a[4]) +get_viewport_translate(struct gl_context *ctx, float a[4]) { struct gl_viewport_attrib *vp = &ctx->Viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index 9373b936ab..394f3c9b50 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -86,7 +86,7 @@ vbo_deinit_array(struct nouveau_array_state *a) } static int -get_array_stride(GLcontext *ctx, const struct gl_client_array *a) +get_array_stride(struct gl_context *ctx, const struct gl_client_array *a) { struct nouveau_render_state *render = to_render_state(ctx); @@ -98,7 +98,7 @@ get_array_stride(GLcontext *ctx, const struct gl_client_array *a) } static void -vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, +vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); @@ -124,7 +124,7 @@ vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, } static void -vbo_deinit_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, +vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); @@ -149,7 +149,7 @@ vbo_deinit_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, /* Make some rendering decisions from the GL context. */ static void -vbo_choose_render_mode(GLcontext *ctx, const struct gl_client_array **arrays) +vbo_choose_render_mode(struct gl_context *ctx, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -172,7 +172,7 @@ vbo_choose_render_mode(GLcontext *ctx, const struct gl_client_array **arrays) } static void -vbo_emit_attr(GLcontext *ctx, const struct gl_client_array **arrays, int attr) +vbo_emit_attr(struct gl_context *ctx, const struct gl_client_array **arrays, int attr) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_render_state *render = to_render_state(ctx); @@ -209,7 +209,7 @@ vbo_emit_attr(GLcontext *ctx, const struct gl_client_array **arrays, int attr) #define MAT(a) (VERT_ATTRIB_GENERIC0 + MAT_ATTRIB_##a) static void -vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays) +vbo_choose_attrs(struct gl_context *ctx, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -251,7 +251,7 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays) } static int -get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays) +get_max_client_stride(struct gl_context *ctx, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i, s = 0; @@ -271,14 +271,14 @@ get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays) } static void -TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, +TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index); static GLboolean -vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_maybe_split(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index) @@ -316,7 +316,7 @@ vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays, /* VBO rendering path. */ static void -vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_bind_vertices(struct gl_context *ctx, const struct gl_client_array **arrays, GLint basevertex, GLuint min_index, GLuint max_index) { struct nouveau_render_state *render = to_render_state(ctx); @@ -354,7 +354,7 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays, } static void -vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index) @@ -396,7 +396,7 @@ extract_id(struct nouveau_array_state *a, int i, int j) } static void -vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_draw_imm(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index) @@ -433,7 +433,7 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays, /* draw_prims entry point when we're doing hw-tnl. */ static void -TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, +TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 9906cac07a..8683343b39 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -46,7 +46,7 @@ texunit_needs_combiners(struct gl_texture_unit *u) } struct nouveau_grobj * -nv04_context_engine(GLcontext *ctx) +nv04_context_engine(struct gl_context *ctx) { struct nv04_context *nctx = to_nv04_context(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -90,7 +90,7 @@ static void nv04_channel_flush_notify(struct nouveau_channel *chan) { struct nouveau_context *nctx = chan->user_private; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; if (nctx->fallback < SWRAST) { nouveau_bo_state_emit(ctx); @@ -106,7 +106,7 @@ nv04_channel_flush_notify(struct nouveau_channel *chan) } static void -nv04_hwctx_init(GLcontext *ctx) +nv04_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -136,7 +136,7 @@ nv04_hwctx_init(GLcontext *ctx) } static void -init_dummy_texture(GLcontext *ctx) +init_dummy_texture(struct gl_context *ctx) { struct nouveau_surface *s = &to_nv04_context(ctx)->dummy_texture; @@ -150,7 +150,7 @@ init_dummy_texture(GLcontext *ctx) } static void -nv04_context_destroy(GLcontext *ctx) +nv04_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -166,13 +166,13 @@ nv04_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * +static struct gl_context * nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual, - GLcontext *share_ctx) + struct gl_context *share_ctx) { struct nv04_context *nctx; struct nouveau_hw_state *hw; - GLcontext *ctx; + struct gl_context *ctx; int ret; nctx = CALLOC_STRUCT(nv04_context); diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.h b/src/mesa/drivers/dri/nouveau/nv04_context.h index ccd3b61e26..45e70d2bc3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.h +++ b/src/mesa/drivers/dri/nouveau/nv04_context.h @@ -40,7 +40,7 @@ struct nv04_context { #define nv04_mtex_engine(obj) ((obj)->grclass == NV04_MULTITEX_TRIANGLE) struct nouveau_grobj * -nv04_context_engine(GLcontext *ctx); +nv04_context_engine(struct gl_context *ctx); extern const struct nouveau_driver nv04_driver; diff --git a/src/mesa/drivers/dri/nouveau/nv04_driver.h b/src/mesa/drivers/dri/nouveau/nv04_driver.h index 4d599e683a..554914d1c3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv04_driver.h @@ -39,55 +39,55 @@ enum { /* nv04_render.c */ void -nv04_render_init(GLcontext *ctx); +nv04_render_init(struct gl_context *ctx); void -nv04_render_destroy(GLcontext *ctx); +nv04_render_destroy(struct gl_context *ctx); /* nv04_surface.c */ GLboolean -nv04_surface_init(GLcontext *ctx); +nv04_surface_init(struct gl_context *ctx); void -nv04_surface_takedown(GLcontext *ctx); +nv04_surface_takedown(struct gl_context *ctx); void -nv04_surface_copy(GLcontext *ctx, +nv04_surface_copy(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, int w, int h); void -nv04_surface_fill(GLcontext *ctx, +nv04_surface_fill(struct gl_context *ctx, struct nouveau_surface *dst, unsigned mask, unsigned value, int dx, int dy, int w, int h); /* nv04_state_fb.c */ void -nv04_emit_framebuffer(GLcontext *ctx, int emit); +nv04_emit_framebuffer(struct gl_context *ctx, int emit); void -nv04_emit_scissor(GLcontext *ctx, int emit); +nv04_emit_scissor(struct gl_context *ctx, int emit); /* nv04_state_raster.c */ void -nv04_defer_control(GLcontext *ctx, int emit); +nv04_defer_control(struct gl_context *ctx, int emit); void -nv04_emit_control(GLcontext *ctx, int emit); +nv04_emit_control(struct gl_context *ctx, int emit); void -nv04_defer_blend(GLcontext *ctx, int emit); +nv04_defer_blend(struct gl_context *ctx, int emit); void -nv04_emit_blend(GLcontext *ctx, int emit); +nv04_emit_blend(struct gl_context *ctx, int emit); /* nv04_state_frag.c */ void -nv04_emit_tex_env(GLcontext *ctx, int emit); +nv04_emit_tex_env(struct gl_context *ctx, int emit); /* nv04_state_tex.c */ void -nv04_emit_tex_obj(GLcontext *ctx, int emit); +nv04_emit_tex_obj(struct gl_context *ctx, int emit); #endif diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c index 56e396d51f..47bad24f9d 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_render.c +++ b/src/mesa/drivers/dri/nouveau/nv04_render.c @@ -37,7 +37,7 @@ #define NUM_VERTEX_ATTRS 6 static void -swtnl_update_viewport(GLcontext *ctx) +swtnl_update_viewport(struct gl_context *ctx) { float *viewport = to_nv04_context(ctx)->viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -51,7 +51,7 @@ swtnl_update_viewport(GLcontext *ctx) } static void -swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit) +swtnl_emit_attr(struct gl_context *ctx, struct tnl_attr_map *m, int attr, int emit) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -68,7 +68,7 @@ swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit) } static void -swtnl_choose_attrs(GLcontext *ctx) +swtnl_choose_attrs(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx); @@ -94,24 +94,24 @@ swtnl_choose_attrs(GLcontext *ctx) /* TnL renderer entry points */ static void -swtnl_start(GLcontext *ctx) +swtnl_start(struct gl_context *ctx) { swtnl_choose_attrs(ctx); } static void -swtnl_finish(GLcontext *ctx) +swtnl_finish(struct gl_context *ctx) { FIRE_RING(context_chan(ctx)); } static void -swtnl_primitive(GLcontext *ctx, GLenum mode) +swtnl_primitive(struct gl_context *ctx, GLenum mode) { } static void -swtnl_reset_stipple(GLcontext *ctx) +swtnl_reset_stipple(struct gl_context *ctx) { } @@ -146,17 +146,17 @@ swtnl_reset_stipple(GLcontext *ctx) } static void -swtnl_points(GLcontext *ctx, GLuint first, GLuint last) +swtnl_points(struct gl_context *ctx, GLuint first, GLuint last) { } static void -swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2) +swtnl_line(struct gl_context *ctx, GLuint v1, GLuint v2) { } static void -swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) +swtnl_triangle(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3) { BEGIN_PRIMITIVE(3); OUT_VERTEX(v1); @@ -166,7 +166,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) } static void -swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) +swtnl_quad(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) { BEGIN_PRIMITIVE(4); OUT_VERTEX(v1); @@ -178,7 +178,7 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) /* TnL initialization. */ void -nv04_render_init(GLcontext *ctx) +nv04_render_init(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -207,6 +207,6 @@ nv04_render_init(GLcontext *ctx) } void -nv04_render_destroy(GLcontext *ctx) +nv04_render_destroy(struct gl_context *ctx) { } diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c index b9d232dbb8..a3e343660f 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c @@ -47,7 +47,7 @@ get_rt_format(gl_format format) } void -nv04_emit_framebuffer(GLcontext *ctx, int emit) +nv04_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -97,7 +97,7 @@ nv04_emit_framebuffer(GLcontext *ctx, int emit) } void -nv04_emit_scissor(GLcontext *ctx, int emit) +nv04_emit_scissor(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c index bb5d7dc20f..658b23a4d9 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c @@ -41,7 +41,7 @@ NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0 struct combiner_state { - GLcontext *ctx; + struct gl_context *ctx; int unit; GLboolean alpha; GLboolean premodulate; @@ -234,7 +234,7 @@ setup_combiner(struct combiner_state *rc) } void -nv04_emit_tex_env(GLcontext *ctx, int emit) +nv04_emit_tex_env(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_ENV0; struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c index c191571a5f..a114f44b22 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c @@ -127,13 +127,13 @@ get_blend_func(unsigned func) } void -nv04_defer_control(GLcontext *ctx, int emit) +nv04_defer_control(struct gl_context *ctx, int emit) { context_dirty(ctx, CONTROL); } void -nv04_emit_control(GLcontext *ctx, int emit) +nv04_emit_control(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx); @@ -247,13 +247,13 @@ nv04_emit_control(GLcontext *ctx, int emit) } void -nv04_defer_blend(GLcontext *ctx, int emit) +nv04_defer_blend(struct gl_context *ctx, int emit) { context_dirty(ctx, BLEND); } void -nv04_emit_blend(GLcontext *ctx, int emit) +nv04_emit_blend(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c index b720089fbf..1fe47a30e4 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c @@ -56,7 +56,7 @@ get_tex_format(struct gl_texture_image *ti) } void -nv04_emit_tex_obj(GLcontext *ctx, int emit) +nv04_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c index ce0103604c..6d3ffa26d3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_surface.c +++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c @@ -191,7 +191,7 @@ sifm_format(gl_format format) } static void -nv04_surface_copy_swizzle(GLcontext *ctx, +nv04_surface_copy_swizzle(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -269,7 +269,7 @@ nv04_surface_copy_swizzle(GLcontext *ctx, } static void -nv04_surface_copy_m2mf(GLcontext *ctx, +nv04_surface_copy_m2mf(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -362,7 +362,7 @@ get_swizzled_offset(struct nouveau_surface *s, unsigned x, unsigned y) } static void -nv04_surface_copy_cpu(GLcontext *ctx, +nv04_surface_copy_cpu(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -393,7 +393,7 @@ nv04_surface_copy_cpu(GLcontext *ctx, } void -nv04_surface_copy(GLcontext *ctx, +nv04_surface_copy(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -418,7 +418,7 @@ nv04_surface_copy(GLcontext *ctx, } void -nv04_surface_fill(GLcontext *ctx, +nv04_surface_fill(struct gl_context *ctx, struct nouveau_surface *dst, unsigned mask, unsigned value, int dx, int dy, int w, int h) @@ -460,7 +460,7 @@ nv04_surface_fill(GLcontext *ctx, } void -nv04_surface_takedown(GLcontext *ctx) +nv04_surface_takedown(struct gl_context *ctx) { struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -475,7 +475,7 @@ nv04_surface_takedown(GLcontext *ctx) } GLboolean -nv04_surface_init(GLcontext *ctx) +nv04_surface_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 04b0fc37a8..fdcb43b771 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -41,7 +41,7 @@ static const struct dri_extension nv10_extensions[] = { }; static GLboolean -use_fast_zclear(GLcontext *ctx, GLbitfield buffers) +use_fast_zclear(struct gl_context *ctx, GLbitfield buffers) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -62,7 +62,7 @@ use_fast_zclear(GLcontext *ctx, GLbitfield buffers) } GLboolean -nv10_use_viewport_zclear(GLcontext *ctx) +nv10_use_viewport_zclear(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -74,7 +74,7 @@ nv10_use_viewport_zclear(GLcontext *ctx) } float -nv10_transform_depth(GLcontext *ctx, float z) +nv10_transform_depth(struct gl_context *ctx, float z) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -85,7 +85,7 @@ nv10_transform_depth(GLcontext *ctx, float z) } static void -nv10_zclear(GLcontext *ctx, GLbitfield *buffers) +nv10_zclear(struct gl_context *ctx, GLbitfield *buffers) { /* * Pre-nv17 cards don't have native support for fast Z clears, @@ -145,7 +145,7 @@ nv10_zclear(GLcontext *ctx, GLbitfield *buffers) } static void -nv17_zclear(GLcontext *ctx, GLbitfield *buffers) +nv17_zclear(struct gl_context *ctx, GLbitfield *buffers) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -175,7 +175,7 @@ nv17_zclear(GLcontext *ctx, GLbitfield *buffers) } static void -nv10_clear(GLcontext *ctx, GLbitfield buffers) +nv10_clear(struct gl_context *ctx, GLbitfield buffers) { nouveau_validate_framebuffer(ctx); @@ -190,7 +190,7 @@ nv10_clear(GLcontext *ctx, GLbitfield buffers) } static void -nv10_hwctx_init(GLcontext *ctx) +nv10_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -402,7 +402,7 @@ nv10_hwctx_init(GLcontext *ctx) } static void -nv10_context_destroy(GLcontext *ctx) +nv10_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -415,12 +415,12 @@ nv10_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * +static struct gl_context * nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual, - GLcontext *share_ctx) + struct gl_context *share_ctx) { struct nouveau_context *nctx; - GLcontext *ctx; + struct gl_context *ctx; unsigned celsius_class; int ret; diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h b/src/mesa/drivers/dri/nouveau/nv10_driver.h index 61dceab7b6..dec3d64e7d 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h @@ -38,124 +38,124 @@ enum { extern const struct nouveau_driver nv10_driver; GLboolean -nv10_use_viewport_zclear(GLcontext *ctx); +nv10_use_viewport_zclear(struct gl_context *ctx); float -nv10_transform_depth(GLcontext *ctx, float z); +nv10_transform_depth(struct gl_context *ctx, float z); /* nv10_render.c */ void -nv10_render_init(GLcontext *ctx); +nv10_render_init(struct gl_context *ctx); void -nv10_render_destroy(GLcontext *ctx); +nv10_render_destroy(struct gl_context *ctx); /* nv10_state_fb.c */ void -nv10_emit_framebuffer(GLcontext *ctx, int emit); +nv10_emit_framebuffer(struct gl_context *ctx, int emit); void -nv10_emit_render_mode(GLcontext *ctx, int emit); +nv10_emit_render_mode(struct gl_context *ctx, int emit); void -nv10_emit_scissor(GLcontext *ctx, int emit); +nv10_emit_scissor(struct gl_context *ctx, int emit); void -nv10_emit_viewport(GLcontext *ctx, int emit); +nv10_emit_viewport(struct gl_context *ctx, int emit); void -nv10_emit_zclear(GLcontext *ctx, int emit); +nv10_emit_zclear(struct gl_context *ctx, int emit); /* nv10_state_polygon.c */ void -nv10_emit_cull_face(GLcontext *ctx, int emit); +nv10_emit_cull_face(struct gl_context *ctx, int emit); void -nv10_emit_front_face(GLcontext *ctx, int emit); +nv10_emit_front_face(struct gl_context *ctx, int emit); void -nv10_emit_line_mode(GLcontext *ctx, int emit); +nv10_emit_line_mode(struct gl_context *ctx, int emit); void -nv10_emit_line_stipple(GLcontext *ctx, int emit); +nv10_emit_line_stipple(struct gl_context *ctx, int emit); void -nv10_emit_point_mode(GLcontext *ctx, int emit); +nv10_emit_point_mode(struct gl_context *ctx, int emit); void -nv10_emit_polygon_mode(GLcontext *ctx, int emit); +nv10_emit_polygon_mode(struct gl_context *ctx, int emit); void -nv10_emit_polygon_offset(GLcontext *ctx, int emit); +nv10_emit_polygon_offset(struct gl_context *ctx, int emit); void -nv10_emit_polygon_stipple(GLcontext *ctx, int emit); +nv10_emit_polygon_stipple(struct gl_context *ctx, int emit); /* nv10_state_raster.c */ void -nv10_emit_alpha_func(GLcontext *ctx, int emit); +nv10_emit_alpha_func(struct gl_context *ctx, int emit); void -nv10_emit_blend_color(GLcontext *ctx, int emit); +nv10_emit_blend_color(struct gl_context *ctx, int emit); void -nv10_emit_blend_equation(GLcontext *ctx, int emit); +nv10_emit_blend_equation(struct gl_context *ctx, int emit); void -nv10_emit_blend_func(GLcontext *ctx, int emit); +nv10_emit_blend_func(struct gl_context *ctx, int emit); void -nv10_emit_color_mask(GLcontext *ctx, int emit); +nv10_emit_color_mask(struct gl_context *ctx, int emit); void -nv10_emit_depth(GLcontext *ctx, int emit); +nv10_emit_depth(struct gl_context *ctx, int emit); void -nv10_emit_dither(GLcontext *ctx, int emit); +nv10_emit_dither(struct gl_context *ctx, int emit); void -nv10_emit_logic_opcode(GLcontext *ctx, int emit); +nv10_emit_logic_opcode(struct gl_context *ctx, int emit); void -nv10_emit_shade_model(GLcontext *ctx, int emit); +nv10_emit_shade_model(struct gl_context *ctx, int emit); void -nv10_emit_stencil_func(GLcontext *ctx, int emit); +nv10_emit_stencil_func(struct gl_context *ctx, int emit); void -nv10_emit_stencil_mask(GLcontext *ctx, int emit); +nv10_emit_stencil_mask(struct gl_context *ctx, int emit); void -nv10_emit_stencil_op(GLcontext *ctx, int emit); +nv10_emit_stencil_op(struct gl_context *ctx, int emit); /* nv10_state_frag.c */ void -nv10_get_general_combiner(GLcontext *ctx, int i, +nv10_get_general_combiner(struct gl_context *ctx, int i, uint32_t *a_in, uint32_t *a_out, uint32_t *c_in, uint32_t *c_out, uint32_t *k); void -nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n); +nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n); void -nv10_emit_tex_env(GLcontext *ctx, int emit); +nv10_emit_tex_env(struct gl_context *ctx, int emit); void -nv10_emit_frag(GLcontext *ctx, int emit); +nv10_emit_frag(struct gl_context *ctx, int emit); /* nv10_state_tex.c */ void -nv10_emit_tex_gen(GLcontext *ctx, int emit); +nv10_emit_tex_gen(struct gl_context *ctx, int emit); void -nv10_emit_tex_mat(GLcontext *ctx, int emit); +nv10_emit_tex_mat(struct gl_context *ctx, int emit); void -nv10_emit_tex_obj(GLcontext *ctx, int emit); +nv10_emit_tex_obj(struct gl_context *ctx, int emit); /* nv10_state_tnl.c */ void -nv10_get_fog_coeff(GLcontext *ctx, float k[3]); +nv10_get_fog_coeff(struct gl_context *ctx, float k[3]); void nv10_get_spot_coeff(struct gl_light *l, float k[7]); @@ -164,42 +164,42 @@ void nv10_get_shininess_coeff(float s, float k[6]); void -nv10_emit_clip_plane(GLcontext *ctx, int emit); +nv10_emit_clip_plane(struct gl_context *ctx, int emit); void -nv10_emit_color_material(GLcontext *ctx, int emit); +nv10_emit_color_material(struct gl_context *ctx, int emit); void -nv10_emit_fog(GLcontext *ctx, int emit); +nv10_emit_fog(struct gl_context *ctx, int emit); void -nv10_emit_light_enable(GLcontext *ctx, int emit); +nv10_emit_light_enable(struct gl_context *ctx, int emit); void -nv10_emit_light_model(GLcontext *ctx, int emit); +nv10_emit_light_model(struct gl_context *ctx, int emit); void -nv10_emit_light_source(GLcontext *ctx, int emit); +nv10_emit_light_source(struct gl_context *ctx, int emit); void -nv10_emit_material_ambient(GLcontext *ctx, int emit); +nv10_emit_material_ambient(struct gl_context *ctx, int emit); void -nv10_emit_material_diffuse(GLcontext *ctx, int emit); +nv10_emit_material_diffuse(struct gl_context *ctx, int emit); void -nv10_emit_material_specular(GLcontext *ctx, int emit); +nv10_emit_material_specular(struct gl_context *ctx, int emit); void -nv10_emit_material_shininess(GLcontext *ctx, int emit); +nv10_emit_material_shininess(struct gl_context *ctx, int emit); void -nv10_emit_modelview(GLcontext *ctx, int emit); +nv10_emit_modelview(struct gl_context *ctx, int emit); void -nv10_emit_point_parameter(GLcontext *ctx, int emit); +nv10_emit_point_parameter(struct gl_context *ctx, int emit); void -nv10_emit_projection(GLcontext *ctx, int emit); +nv10_emit_projection(struct gl_context *ctx, int emit); #endif diff --git a/src/mesa/drivers/dri/nouveau/nv10_render.c b/src/mesa/drivers/dri/nouveau/nv10_render.c index e4c51f804c..a03ace3536 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_render.c +++ b/src/mesa/drivers/dri/nouveau/nv10_render.c @@ -32,7 +32,7 @@ #define NUM_VERTEX_ATTRS 8 static void -nv10_emit_material(GLcontext *ctx, struct nouveau_array_state *a, +nv10_emit_material(struct gl_context *ctx, struct nouveau_array_state *a, const void *v); /* Vertex attribute format. */ @@ -106,7 +106,7 @@ get_hw_format(int type) } static void -nv10_render_set_format(GLcontext *ctx) +nv10_render_set_format(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -136,7 +136,7 @@ nv10_render_set_format(GLcontext *ctx) } static void -nv10_render_bind_vertices(GLcontext *ctx) +nv10_render_bind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_bo_context *bctx = context_bctx(ctx, VERTEX); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c index 81edbe8172..d87fe96b1c 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c @@ -51,7 +51,7 @@ get_rt_format(gl_format format) } static void -setup_lma_buffer(GLcontext *ctx) +setup_lma_buffer(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -86,7 +86,7 @@ setup_lma_buffer(GLcontext *ctx) } void -nv10_emit_framebuffer(GLcontext *ctx, int emit) +nv10_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -149,12 +149,12 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit) } void -nv10_emit_render_mode(GLcontext *ctx, int emit) +nv10_emit_render_mode(struct gl_context *ctx, int emit) { } void -nv10_emit_scissor(GLcontext *ctx, int emit) +nv10_emit_scissor(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -168,7 +168,7 @@ nv10_emit_scissor(GLcontext *ctx, int emit) } void -nv10_emit_viewport(GLcontext *ctx, int emit) +nv10_emit_viewport(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -194,7 +194,7 @@ nv10_emit_viewport(GLcontext *ctx, int emit) } void -nv10_emit_zclear(GLcontext *ctx, int emit) +nv10_emit_zclear(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c index ab713f9dbf..5138c36df7 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c @@ -61,7 +61,7 @@ #define RC_OUT_SUM NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 struct combiner_state { - GLcontext *ctx; + struct gl_context *ctx; int unit; GLboolean premodulate; @@ -298,7 +298,7 @@ setup_combiner(struct combiner_state *rc) } void -nv10_get_general_combiner(GLcontext *ctx, int i, +nv10_get_general_combiner(struct gl_context *ctx, int i, uint32_t *a_in, uint32_t *a_out, uint32_t *c_in, uint32_t *c_out, uint32_t *k) { @@ -328,7 +328,7 @@ nv10_get_general_combiner(GLcontext *ctx, int i, } void -nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n) +nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n) { struct combiner_state rc = {}; @@ -366,7 +366,7 @@ nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n) } void -nv10_emit_tex_env(GLcontext *ctx, int emit) +nv10_emit_tex_env(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_ENV0; struct nouveau_channel *chan = context_chan(ctx); @@ -398,7 +398,7 @@ nv10_emit_tex_env(GLcontext *ctx, int emit) } void -nv10_emit_frag(GLcontext *ctx, int emit) +nv10_emit_frag(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c b/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c index deddca1011..4e49b0278c 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c @@ -31,7 +31,7 @@ #include "nv10_driver.h" void -nv10_emit_cull_face(GLcontext *ctx, int emit) +nv10_emit_cull_face(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -47,7 +47,7 @@ nv10_emit_cull_face(GLcontext *ctx, int emit) } void -nv10_emit_front_face(GLcontext *ctx, int emit) +nv10_emit_front_face(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -58,7 +58,7 @@ nv10_emit_front_face(GLcontext *ctx, int emit) } void -nv10_emit_line_mode(GLcontext *ctx, int emit) +nv10_emit_line_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -73,12 +73,12 @@ nv10_emit_line_mode(GLcontext *ctx, int emit) } void -nv10_emit_line_stipple(GLcontext *ctx, int emit) +nv10_emit_line_stipple(struct gl_context *ctx, int emit) { } void -nv10_emit_point_mode(GLcontext *ctx, int emit) +nv10_emit_point_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -91,7 +91,7 @@ nv10_emit_point_mode(GLcontext *ctx, int emit) } void -nv10_emit_polygon_mode(GLcontext *ctx, int emit) +nv10_emit_polygon_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -105,7 +105,7 @@ nv10_emit_polygon_mode(GLcontext *ctx, int emit) } void -nv10_emit_polygon_offset(GLcontext *ctx, int emit) +nv10_emit_polygon_offset(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -121,6 +121,6 @@ nv10_emit_polygon_offset(GLcontext *ctx, int emit) } void -nv10_emit_polygon_stipple(GLcontext *ctx, int emit) +nv10_emit_polygon_stipple(struct gl_context *ctx, int emit) { } diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c index a62cd807a9..99609844a1 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c @@ -31,7 +31,7 @@ #include "nv10_driver.h" void -nv10_emit_alpha_func(GLcontext *ctx, int emit) +nv10_emit_alpha_func(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -45,7 +45,7 @@ nv10_emit_alpha_func(GLcontext *ctx, int emit) } void -nv10_emit_blend_color(GLcontext *ctx, int emit) +nv10_emit_blend_color(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -58,7 +58,7 @@ nv10_emit_blend_color(GLcontext *ctx, int emit) } void -nv10_emit_blend_equation(GLcontext *ctx, int emit) +nv10_emit_blend_equation(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -71,7 +71,7 @@ nv10_emit_blend_equation(GLcontext *ctx, int emit) } void -nv10_emit_blend_func(GLcontext *ctx, int emit) +nv10_emit_blend_func(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -82,7 +82,7 @@ nv10_emit_blend_func(GLcontext *ctx, int emit) } void -nv10_emit_color_mask(GLcontext *ctx, int emit) +nv10_emit_color_mask(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -95,7 +95,7 @@ nv10_emit_color_mask(GLcontext *ctx, int emit) } void -nv10_emit_depth(GLcontext *ctx, int emit) +nv10_emit_depth(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -109,7 +109,7 @@ nv10_emit_depth(GLcontext *ctx, int emit) } void -nv10_emit_dither(GLcontext *ctx, int emit) +nv10_emit_dither(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -119,7 +119,7 @@ nv10_emit_dither(GLcontext *ctx, int emit) } void -nv10_emit_logic_opcode(GLcontext *ctx, int emit) +nv10_emit_logic_opcode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -133,7 +133,7 @@ nv10_emit_logic_opcode(GLcontext *ctx, int emit) } void -nv10_emit_shade_model(GLcontext *ctx, int emit) +nv10_emit_shade_model(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -144,7 +144,7 @@ nv10_emit_shade_model(GLcontext *ctx, int emit) } void -nv10_emit_stencil_func(GLcontext *ctx, int emit) +nv10_emit_stencil_func(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -159,7 +159,7 @@ nv10_emit_stencil_func(GLcontext *ctx, int emit) } void -nv10_emit_stencil_mask(GLcontext *ctx, int emit) +nv10_emit_stencil_mask(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -169,7 +169,7 @@ nv10_emit_stencil_mask(GLcontext *ctx, int emit) } void -nv10_emit_stencil_op(GLcontext *ctx, int emit) +nv10_emit_stencil_op(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c index 6961ccbb45..0092ad0c20 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c @@ -37,7 +37,7 @@ #define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i)) void -nv10_emit_tex_gen(GLcontext *ctx, int emit) +nv10_emit_tex_gen(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_GEN0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -70,7 +70,7 @@ nv10_emit_tex_gen(GLcontext *ctx, int emit) } void -nv10_emit_tex_mat(GLcontext *ctx, int emit) +nv10_emit_tex_mat(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_MAT0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -151,7 +151,7 @@ get_tex_format_rect(struct gl_texture_image *ti) } void -nv10_emit_tex_obj(GLcontext *ctx, int emit) +nv10_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c index 6b2ede88e6..175abfca5c 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c @@ -32,7 +32,7 @@ #include "nv10_driver.h" void -nv10_emit_clip_plane(GLcontext *ctx, int emit) +nv10_emit_clip_plane(struct gl_context *ctx, int emit) { } @@ -54,7 +54,7 @@ get_material_bitmask(unsigned m) } void -nv10_emit_color_material(GLcontext *ctx, int emit) +nv10_emit_color_material(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -93,7 +93,7 @@ get_fog_source(unsigned source) } void -nv10_get_fog_coeff(GLcontext *ctx, float k[3]) +nv10_get_fog_coeff(struct gl_context *ctx, float k[3]) { struct gl_fog_attrib *f = &ctx->Fog; @@ -121,7 +121,7 @@ nv10_get_fog_coeff(GLcontext *ctx, float k[3]) } void -nv10_emit_fog(GLcontext *ctx, int emit) +nv10_emit_fog(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -161,7 +161,7 @@ get_light_mode(struct gl_light *l) } void -nv10_emit_light_enable(GLcontext *ctx, int emit) +nv10_emit_light_enable(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -187,7 +187,7 @@ nv10_emit_light_enable(GLcontext *ctx, int emit) } void -nv10_emit_light_model(GLcontext *ctx, int emit) +nv10_emit_light_model(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -273,7 +273,7 @@ nv10_get_spot_coeff(struct gl_light *l, float k[7]) } void -nv10_emit_light_source(GLcontext *ctx, int emit) +nv10_emit_light_source(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_LIGHT_SOURCE0; struct nouveau_channel *chan = context_chan(ctx); @@ -313,7 +313,7 @@ nv10_emit_light_source(GLcontext *ctx, int emit) ctx->Light.ColorMaterialBitmask & (1 << MAT_ATTRIB_FRONT_##attr)) void -nv10_emit_material_ambient(GLcontext *ctx, int emit) +nv10_emit_material_ambient(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -355,7 +355,7 @@ nv10_emit_material_ambient(GLcontext *ctx, int emit) } void -nv10_emit_material_diffuse(GLcontext *ctx, int emit) +nv10_emit_material_diffuse(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -377,7 +377,7 @@ nv10_emit_material_diffuse(GLcontext *ctx, int emit) } void -nv10_emit_material_specular(GLcontext *ctx, int emit) +nv10_emit_material_specular(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -419,7 +419,7 @@ nv10_get_shininess_coeff(float s, float k[6]) } void -nv10_emit_material_shininess(GLcontext *ctx, int emit) +nv10_emit_material_shininess(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -435,7 +435,7 @@ nv10_emit_material_shininess(GLcontext *ctx, int emit) } void -nv10_emit_modelview(GLcontext *ctx, int emit) +nv10_emit_modelview(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -464,12 +464,12 @@ nv10_emit_modelview(GLcontext *ctx, int emit) } void -nv10_emit_point_parameter(GLcontext *ctx, int emit) +nv10_emit_point_parameter(struct gl_context *ctx, int emit) { } void -nv10_emit_projection(GLcontext *ctx, int emit) +nv10_emit_projection(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index bc424f8b28..c6111a2a9a 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_context.c +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c @@ -40,7 +40,7 @@ static const struct dri_extension nv20_extensions[] = { }; static void -nv20_hwctx_init(GLcontext *ctx) +nv20_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -371,7 +371,7 @@ nv20_hwctx_init(GLcontext *ctx) } static void -nv20_context_destroy(GLcontext *ctx) +nv20_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -384,12 +384,12 @@ nv20_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * +static struct gl_context * nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visual, - GLcontext *share_ctx) + struct gl_context *share_ctx) { struct nouveau_context *nctx; - GLcontext *ctx; + struct gl_context *ctx; unsigned kelvin_class; int ret; diff --git a/src/mesa/drivers/dri/nouveau/nv20_driver.h b/src/mesa/drivers/dri/nouveau/nv20_driver.h index 8adecef2c4..7fbe6ccfa6 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv20_driver.h @@ -39,78 +39,78 @@ extern const struct nouveau_driver nv20_driver; /* nv20_render.c */ void -nv20_render_init(GLcontext *ctx); +nv20_render_init(struct gl_context *ctx); void -nv20_render_destroy(GLcontext *ctx); +nv20_render_destroy(struct gl_context *ctx); /* nv20_state_fb.c */ void -nv20_emit_framebuffer(GLcontext *ctx, int emit); +nv20_emit_framebuffer(struct gl_context *ctx, int emit); void -nv20_emit_viewport(GLcontext *ctx, int emit); +nv20_emit_viewport(struct gl_context *ctx, int emit); /* nv20_state_polygon.c */ void -nv20_emit_point_mode(GLcontext *ctx, int emit); +nv20_emit_point_mode(struct gl_context *ctx, int emit); /* nv20_state_raster.c */ void -nv20_emit_logic_opcode(GLcontext *ctx, int emit); +nv20_emit_logic_opcode(struct gl_context *ctx, int emit); /* nv20_state_frag.c */ void -nv20_emit_tex_env(GLcontext *ctx, int emit); +nv20_emit_tex_env(struct gl_context *ctx, int emit); void -nv20_emit_frag(GLcontext *ctx, int emit); +nv20_emit_frag(struct gl_context *ctx, int emit); /* nv20_state_tex.c */ void -nv20_emit_tex_gen(GLcontext *ctx, int emit); +nv20_emit_tex_gen(struct gl_context *ctx, int emit); void -nv20_emit_tex_mat(GLcontext *ctx, int emit); +nv20_emit_tex_mat(struct gl_context *ctx, int emit); void -nv20_emit_tex_obj(GLcontext *ctx, int emit); +nv20_emit_tex_obj(struct gl_context *ctx, int emit); void -nv20_emit_tex_shader(GLcontext *ctx, int emit); +nv20_emit_tex_shader(struct gl_context *ctx, int emit); /* nv20_state_tnl.c */ void -nv20_emit_clip_plane(GLcontext *ctx, int emit); +nv20_emit_clip_plane(struct gl_context *ctx, int emit); void -nv20_emit_color_material(GLcontext *ctx, int emit); +nv20_emit_color_material(struct gl_context *ctx, int emit); void -nv20_emit_fog(GLcontext *ctx, int emit); +nv20_emit_fog(struct gl_context *ctx, int emit); void -nv20_emit_light_model(GLcontext *ctx, int emit); +nv20_emit_light_model(struct gl_context *ctx, int emit); void -nv20_emit_light_source(GLcontext *ctx, int emit); +nv20_emit_light_source(struct gl_context *ctx, int emit); void -nv20_emit_material_ambient(GLcontext *ctx, int emit); +nv20_emit_material_ambient(struct gl_context *ctx, int emit); void -nv20_emit_material_diffuse(GLcontext *ctx, int emit); +nv20_emit_material_diffuse(struct gl_context *ctx, int emit); void -nv20_emit_material_specular(GLcontext *ctx, int emit); +nv20_emit_material_specular(struct gl_context *ctx, int emit); void -nv20_emit_material_shininess(GLcontext *ctx, int emit); +nv20_emit_material_shininess(struct gl_context *ctx, int emit); void -nv20_emit_modelview(GLcontext *ctx, int emit); +nv20_emit_modelview(struct gl_context *ctx, int emit); void -nv20_emit_projection(GLcontext *ctx, int emit); +nv20_emit_projection(struct gl_context *ctx, int emit); #endif diff --git a/src/mesa/drivers/dri/nouveau/nv20_render.c b/src/mesa/drivers/dri/nouveau/nv20_render.c index d7c3e747f0..6b66854462 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_render.c +++ b/src/mesa/drivers/dri/nouveau/nv20_render.c @@ -32,7 +32,7 @@ #define NUM_VERTEX_ATTRS 16 static void -nv20_emit_material(GLcontext *ctx, struct nouveau_array_state *a, +nv20_emit_material(struct gl_context *ctx, struct nouveau_array_state *a, const void *v); /* Vertex attribute format. */ @@ -130,7 +130,7 @@ get_hw_format(int type) } static void -nv20_render_set_format(GLcontext *ctx) +nv20_render_set_format(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -158,7 +158,7 @@ nv20_render_set_format(GLcontext *ctx) } static void -nv20_render_bind_vertices(GLcontext *ctx) +nv20_render_bind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_bo_context *bctx = context_bctx(ctx, VERTEX); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c index 95691cad04..7822ca2a09 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c @@ -52,7 +52,7 @@ get_rt_format(gl_format format) } void -nv20_emit_framebuffer(GLcontext *ctx, int emit) +nv20_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -103,7 +103,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit) } void -nv20_emit_viewport(GLcontext *ctx, int emit) +nv20_emit_viewport(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c index 74803d2ae8..f9212d8b39 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c @@ -31,7 +31,7 @@ #include "nv20_driver.h" void -nv20_emit_tex_env(GLcontext *ctx, int emit) +nv20_emit_tex_env(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_ENV0; struct nouveau_channel *chan = context_chan(ctx); @@ -55,7 +55,7 @@ nv20_emit_tex_env(GLcontext *ctx, int emit) } void -nv20_emit_frag(GLcontext *ctx, int emit) +nv20_emit_frag(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c b/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c index 3a320e2dac..a6e237f8c4 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c @@ -31,7 +31,7 @@ #include "nv20_driver.h" void -nv20_emit_point_mode(GLcontext *ctx, int emit) +nv20_emit_point_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_raster.c b/src/mesa/drivers/dri/nouveau/nv20_state_raster.c index b43b29bb23..0fc7a3259d 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_raster.c @@ -31,7 +31,7 @@ #include "nv20_driver.h" void -nv20_emit_logic_opcode(GLcontext *ctx, int emit) +nv20_emit_logic_opcode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index ea6b9b96db..cfff1fe839 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -37,7 +37,7 @@ #define TX_MATRIX(i) (NV20TCL_TX0_MATRIX(0) + 64 * (i)) void -nv20_emit_tex_gen(GLcontext *ctx, int emit) +nv20_emit_tex_gen(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_GEN0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -67,7 +67,7 @@ nv20_emit_tex_gen(GLcontext *ctx, int emit) } void -nv20_emit_tex_mat(GLcontext *ctx, int emit) +nv20_emit_tex_mat(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_MAT0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -154,7 +154,7 @@ get_tex_format_rect(struct gl_texture_image *ti) } void -nv20_emit_tex_obj(GLcontext *ctx, int emit) +nv20_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; struct nouveau_channel *chan = context_chan(ctx); @@ -251,7 +251,7 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit) } void -nv20_emit_tex_shader(GLcontext *ctx, int emit) +nv20_emit_tex_shader(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c index 2daaae260c..b65cd9ad87 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c @@ -55,7 +55,7 @@ NV20TCL_FRONT_MATERIAL_SHININESS(0)) void -nv20_emit_clip_plane(GLcontext *ctx, int emit) +nv20_emit_clip_plane(struct gl_context *ctx, int emit) { } @@ -86,7 +86,7 @@ get_material_bitmask(unsigned m) } void -nv20_emit_color_material(GLcontext *ctx, int emit) +nv20_emit_color_material(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -140,7 +140,7 @@ get_fog_source(unsigned source) } void -nv20_emit_fog(GLcontext *ctx, int emit) +nv20_emit_fog(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -165,7 +165,7 @@ nv20_emit_fog(GLcontext *ctx, int emit) } void -nv20_emit_light_model(GLcontext *ctx, int emit) +nv20_emit_light_model(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -187,7 +187,7 @@ nv20_emit_light_model(GLcontext *ctx, int emit) } void -nv20_emit_light_source(GLcontext *ctx, int emit) +nv20_emit_light_source(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_LIGHT_SOURCE0; struct nouveau_channel *chan = context_chan(ctx); @@ -226,7 +226,7 @@ nv20_emit_light_source(GLcontext *ctx, int emit) ctx->Light.ColorMaterialBitmask & (1 << MAT_ATTRIB_##attr(side))) void -nv20_emit_material_ambient(GLcontext *ctx, int emit) +nv20_emit_material_ambient(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_AMBIENT; struct nouveau_channel *chan = context_chan(ctx); @@ -269,7 +269,7 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit) } void -nv20_emit_material_diffuse(GLcontext *ctx, int emit) +nv20_emit_material_diffuse(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_DIFFUSE; struct nouveau_channel *chan = context_chan(ctx); @@ -292,7 +292,7 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit) } void -nv20_emit_material_specular(GLcontext *ctx, int emit) +nv20_emit_material_specular(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_SPECULAR; struct nouveau_channel *chan = context_chan(ctx); @@ -311,7 +311,7 @@ nv20_emit_material_specular(GLcontext *ctx, int emit) } void -nv20_emit_material_shininess(GLcontext *ctx, int emit) +nv20_emit_material_shininess(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_SHININESS; struct nouveau_channel *chan = context_chan(ctx); @@ -328,7 +328,7 @@ nv20_emit_material_shininess(GLcontext *ctx, int emit) } void -nv20_emit_modelview(GLcontext *ctx, int emit) +nv20_emit_modelview(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -357,7 +357,7 @@ nv20_emit_modelview(GLcontext *ctx, int emit) } void -nv20_emit_projection(GLcontext *ctx, int emit) +nv20_emit_projection(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index accd9a5ddb..274108005f 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -103,7 +103,7 @@ GLboolean r128CreateContext( gl_api api, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct dd_function_table functions; r128ContextPtr rmesa; diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index e9ff2fe9de..0a06c43878 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -113,7 +113,7 @@ typedef void (*r128_point_func)( r128ContextPtr, struct r128_context { - GLcontext *glCtx; /* Mesa context */ + struct gl_context *glCtx; /* Mesa context */ /* Driver and hardware state management */ diff --git a/src/mesa/drivers/dri/r128/r128_dd.c b/src/mesa/drivers/dri/r128/r128_dd.c index 7dcfa3b285..0b7005eba6 100644 --- a/src/mesa/drivers/dri/r128/r128_dd.c +++ b/src/mesa/drivers/dri/r128/r128_dd.c @@ -59,7 +59,7 @@ static void r128GetBufferSize( struct gl_framebuffer *buffer, /* Return various strings for glGetString(). */ -static const GLubyte *r128GetString( GLcontext *ctx, GLenum name ) +static const GLubyte *r128GetString( struct gl_context *ctx, GLenum name ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); static char buffer[128]; @@ -97,7 +97,7 @@ static const GLubyte *r128GetString( GLcontext *ctx, GLenum name ) * hardware. All commands that are normally sent to the ring are * already considered `flushed'. */ -static void r128Flush( GLcontext *ctx ) +static void r128Flush( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -118,7 +118,7 @@ static void r128Flush( GLcontext *ctx ) /* Make sure all commands have been sent to the hardware and have * completed processing. */ -static void r128Finish( GLcontext *ctx ) +static void r128Finish( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index 56758d971c..950e1d4fbd 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -398,7 +398,7 @@ void r128PageFlip( __DRIdrawable *dPriv ) * Buffer clear */ -static void r128Clear( GLcontext *ctx, GLbitfield mask ) +static void r128Clear( struct gl_context *ctx, GLbitfield mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); __DRIdrawable *dPriv = rmesa->driDrawable; diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 43ab0fc64d..bbcb6ee180 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -359,7 +359,7 @@ r128SwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { r128ContextPtr rmesa; - GLcontext *ctx; + struct gl_context *ctx; rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = rmesa->glCtx; if (ctx->Visual.doubleBufferMode) { diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c index d9d109c17e..307de56ee1 100644 --- a/src/mesa/drivers/dri/r128/r128_span.c +++ b/src/mesa/drivers/dri/r128/r128_span.c @@ -400,7 +400,7 @@ do { \ #include "stenciltmp.h" static void -r128SpanRenderStart( GLcontext *ctx ) +r128SpanRenderStart( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); FLUSH_BATCH(rmesa); @@ -409,7 +409,7 @@ r128SpanRenderStart( GLcontext *ctx ) } static void -r128SpanRenderFinish( GLcontext *ctx ) +r128SpanRenderFinish( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); _swrast_flush( ctx ); @@ -417,7 +417,7 @@ r128SpanRenderFinish( GLcontext *ctx ) UNLOCK_HARDWARE( rmesa ); } -void r128DDInitSpanFuncs( GLcontext *ctx ) +void r128DDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = r128SpanRenderStart; diff --git a/src/mesa/drivers/dri/r128/r128_span.h b/src/mesa/drivers/dri/r128/r128_span.h index 259810ee79..adb571d4d0 100644 --- a/src/mesa/drivers/dri/r128/r128_span.h +++ b/src/mesa/drivers/dri/r128/r128_span.h @@ -37,7 +37,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" -extern void r128DDInitSpanFuncs( GLcontext *ctx ); +extern void r128DDInitSpanFuncs( struct gl_context *ctx ); extern void r128SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 9ad25f7f46..4a49e8fc70 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -125,7 +125,7 @@ static int blend_factor( r128ContextPtr rmesa, GLenum factor, GLboolean is_src ) } -static void r128UpdateAlphaMode( GLcontext *ctx ) +static void r128UpdateAlphaMode( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint a = rmesa->setup.misc_3d_state_cntl_reg; @@ -209,7 +209,7 @@ static void r128UpdateAlphaMode( GLcontext *ctx ) } } -static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void r128DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -217,7 +217,7 @@ static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) rmesa->new_state |= R128_NEW_ALPHA; } -static void r128DDBlendEquationSeparate( GLcontext *ctx, +static void r128DDBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -239,7 +239,7 @@ static void r128DDBlendEquationSeparate( GLcontext *ctx, rmesa->new_state |= R128_NEW_ALPHA; } -static void r128DDBlendFuncSeparate( GLcontext *ctx, +static void r128DDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -254,7 +254,7 @@ static void r128DDBlendFuncSeparate( GLcontext *ctx, */ static void -r128DDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +r128DDStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -302,7 +302,7 @@ r128DDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +r128DDStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) | @@ -315,7 +315,7 @@ r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) } } -static void r128DDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, +static void r128DDStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -414,7 +414,7 @@ static void r128DDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, } } -static void r128DDClearStencil( GLcontext *ctx, GLint s ) +static void r128DDClearStencil( struct gl_context *ctx, GLint s ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -428,7 +428,7 @@ static void r128DDClearStencil( GLcontext *ctx, GLint s ) * Depth testing */ -static void r128UpdateZMode( GLcontext *ctx ) +static void r128UpdateZMode( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint z = rmesa->setup.z_sten_cntl_c; @@ -485,7 +485,7 @@ static void r128UpdateZMode( GLcontext *ctx ) } } -static void r128DDDepthFunc( GLcontext *ctx, GLenum func ) +static void r128DDDepthFunc( struct gl_context *ctx, GLenum func ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -493,7 +493,7 @@ static void r128DDDepthFunc( GLcontext *ctx, GLenum func ) rmesa->new_state |= R128_NEW_DEPTH; } -static void r128DDDepthMask( GLcontext *ctx, GLboolean flag ) +static void r128DDDepthMask( struct gl_context *ctx, GLboolean flag ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -501,7 +501,7 @@ static void r128DDDepthMask( GLcontext *ctx, GLboolean flag ) rmesa->new_state |= R128_NEW_DEPTH; } -static void r128DDClearDepth( GLcontext *ctx, GLclampd d ) +static void r128DDClearDepth( struct gl_context *ctx, GLclampd d ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -524,7 +524,7 @@ static void r128DDClearDepth( GLcontext *ctx, GLclampd d ) * Fog */ -static void r128UpdateFogAttrib( GLcontext *ctx ) +static void r128UpdateFogAttrib( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint t = rmesa->setup.tex_cntl_c; @@ -553,7 +553,7 @@ static void r128UpdateFogAttrib( GLcontext *ctx ) } } -static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void r128DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -566,7 +566,7 @@ static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Clipping */ -static void r128UpdateClipping( GLcontext *ctx ) +static void r128UpdateClipping( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -622,7 +622,7 @@ static void r128UpdateClipping( GLcontext *ctx ) } } -static void r128DDScissor( GLcontext *ctx, +static void r128DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -636,7 +636,7 @@ static void r128DDScissor( GLcontext *ctx, * Culling */ -static void r128UpdateCull( GLcontext *ctx ) +static void r128UpdateCull( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint f = rmesa->setup.pm4_vc_fpu_setup; @@ -675,7 +675,7 @@ static void r128UpdateCull( GLcontext *ctx ) } } -static void r128DDCullFace( GLcontext *ctx, GLenum mode ) +static void r128DDCullFace( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -683,7 +683,7 @@ static void r128DDCullFace( GLcontext *ctx, GLenum mode ) rmesa->new_state |= R128_NEW_CULL; } -static void r128DDFrontFace( GLcontext *ctx, GLenum mode ) +static void r128DDFrontFace( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -696,7 +696,7 @@ static void r128DDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void r128UpdateMasks( GLcontext *ctx ) +static void r128UpdateMasks( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -712,7 +712,7 @@ static void r128UpdateMasks( GLcontext *ctx ) } } -static void r128DDColorMask( GLcontext *ctx, +static void r128DDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -731,7 +731,7 @@ static void r128DDColorMask( GLcontext *ctx, * sense to break them out of the core texture state update routines. */ -static void updateSpecularLighting( GLcontext *ctx ) +static void updateSpecularLighting( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint t = rmesa->setup.tex_cntl_c; @@ -761,7 +761,7 @@ static void updateSpecularLighting( GLcontext *ctx ) } -static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, +static void r128DDLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -777,7 +777,7 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, } } -static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) +static void r128DDShadeModel( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint s = rmesa->setup.pm4_vc_fpu_setup; @@ -811,7 +811,7 @@ static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) * Window position */ -static void r128UpdateWindow( GLcontext *ctx ) +static void r128UpdateWindow( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); int x = rmesa->driDrawable->x; @@ -834,7 +834,7 @@ static void r128UpdateWindow( GLcontext *ctx ) * Viewport */ -static void r128CalcViewport( GLcontext *ctx ) +static void r128CalcViewport( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -850,14 +850,14 @@ static void r128CalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * rmesa->depth_scale; } -static void r128Viewport( GLcontext *ctx, +static void r128Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { r128CalcViewport( ctx ); } -static void r128DepthRange( GLcontext *ctx, +static void r128DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { r128CalcViewport( ctx ); @@ -868,7 +868,7 @@ static void r128DepthRange( GLcontext *ctx, * Miscellaneous */ -static void r128DDClearColor( GLcontext *ctx, +static void r128DDClearColor( struct gl_context *ctx, const GLfloat color[4] ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -883,7 +883,7 @@ static void r128DDClearColor( GLcontext *ctx, c[0], c[1], c[2], c[3] ); } -static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +static void r128DDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -894,7 +894,7 @@ static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode ) +static void r128DDDrawBuffer( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -921,7 +921,7 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode ) rmesa->new_state |= R128_NEW_WINDOW; } -static void r128DDReadBuffer( GLcontext *ctx, GLenum mode ) +static void r128DDReadBuffer( struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } @@ -931,7 +931,7 @@ static void r128DDReadBuffer( GLcontext *ctx, GLenum mode ) * Polygon stipple */ -static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void r128DDPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint stipple[32], i; @@ -962,7 +962,7 @@ static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) * Render mode */ -static void r128DDRenderMode( GLcontext *ctx, GLenum mode ) +static void r128DDRenderMode( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); FALLBACK( rmesa, R128_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -974,7 +974,7 @@ static void r128DDRenderMode( GLcontext *ctx, GLenum mode ) * State enable/disable */ -static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void r128DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -1206,7 +1206,7 @@ static void r128DDPrintState( const char *msg, GLuint flags ) (flags & R128_NEW_WINDOW) ? "window, " : "" ); } -void r128DDUpdateHWState( GLcontext *ctx ) +void r128DDUpdateHWState( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); int new_state = rmesa->new_state; @@ -1253,7 +1253,7 @@ void r128DDUpdateHWState( GLcontext *ctx ) } -static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void r128DDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1404,7 +1404,7 @@ void r128DDInitState( r128ContextPtr rmesa ) /* Initialize the driver's state functions. */ -void r128DDInitStateFuncs( GLcontext *ctx ) +void r128DDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = r128DDInvalidateState; diff --git a/src/mesa/drivers/dri/r128/r128_state.h b/src/mesa/drivers/dri/r128/r128_state.h index a44327dfb3..55b0cbf4b7 100644 --- a/src/mesa/drivers/dri/r128/r128_state.h +++ b/src/mesa/drivers/dri/r128/r128_state.h @@ -38,10 +38,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_context.h" extern void r128DDInitState( r128ContextPtr rmesa ); -extern void r128DDInitStateFuncs( GLcontext *ctx ); +extern void r128DDInitStateFuncs( struct gl_context *ctx ); -extern void r128DDUpdateState( GLcontext *ctx ); -extern void r128DDUpdateHWState( GLcontext *ctx ); +extern void r128DDUpdateState( struct gl_context *ctx ); +extern void r128DDUpdateHWState( struct gl_context *ctx ); extern void r128EmitHwStateLocked( r128ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 2dd47b06a5..ba3305e076 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -173,7 +173,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ static gl_format -r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +r128ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -287,7 +287,7 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, } -static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void r128TexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -317,7 +317,7 @@ static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level, } -static void r128TexSubImage1D( GLcontext *ctx, +static void r128TexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -350,7 +350,7 @@ static void r128TexSubImage1D( GLcontext *ctx, } -static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void r128TexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -380,7 +380,7 @@ static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level, } -static void r128TexSubImage2D( GLcontext *ctx, +static void r128TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -412,7 +412,7 @@ static void r128TexSubImage2D( GLcontext *ctx, } -static void r128TexEnv( GLcontext *ctx, GLenum target, +static void r128TexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -500,7 +500,7 @@ static void r128TexEnv( GLcontext *ctx, GLenum target, } -static void r128TexParameter( GLcontext *ctx, GLenum target, +static void r128TexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -551,7 +551,7 @@ static void r128TexParameter( GLcontext *ctx, GLenum target, } } -static void r128BindTexture( GLcontext *ctx, GLenum target, +static void r128BindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { if ( R128_DEBUG & DEBUG_VERBOSE_API ) { @@ -564,7 +564,7 @@ static void r128BindTexture( GLcontext *ctx, GLenum target, } -static void r128DeleteTexture( GLcontext *ctx, +static void r128DeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -588,7 +588,7 @@ static void r128DeleteTexture( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +r128NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/r128/r128_tex.h b/src/mesa/drivers/dri/r128/r128_tex.h index 7df8decf76..98e9b04ad0 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.h +++ b/src/mesa/drivers/dri/r128/r128_tex.h @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R128_TEX_H__ #define __R128_TEX_H__ -extern void r128UpdateTextureState( GLcontext *ctx ); +extern void r128UpdateTextureState( struct gl_context *ctx ); extern void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t ); diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 2505b5cd65..1144163941 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -192,7 +192,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, #define INPUT_PREVIOUS (R128_INPUT_FACTOR_PREV_COLOR | \ R128_INP_FACTOR_A_PREV_ALPHA) -static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit ) +static GLboolean r128UpdateTextureEnv( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLint source = rmesa->tmu_source[unit]; @@ -476,7 +476,7 @@ static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit ) return GL_TRUE; } -static void disable_tex( GLcontext *ctx, int unit ) +static void disable_tex( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -499,7 +499,7 @@ static void disable_tex( GLcontext *ctx, int unit ) rmesa->blend_flags &= ~R128_BLEND_MULTITEX; } -static GLboolean enable_tex_2d( GLcontext *ctx, int unit ) +static GLboolean enable_tex_2d( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const int source = rmesa->tmu_source[unit]; @@ -524,7 +524,7 @@ static GLboolean enable_tex_2d( GLcontext *ctx, int unit ) return GL_TRUE; } -static GLboolean update_tex_common( GLcontext *ctx, int unit ) +static GLboolean update_tex_common( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const int source = rmesa->tmu_source[unit]; @@ -597,7 +597,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) return r128UpdateTextureEnv( ctx, unit ); } -static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) +static GLboolean updateTextureUnit( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const int source = rmesa->tmu_source[unit]; @@ -618,7 +618,7 @@ static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) } -void r128UpdateTextureState( GLcontext *ctx ) +void r128UpdateTextureState( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLboolean ok; diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index 9ea2a9d162..92c8a4eb6b 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -62,8 +62,8 @@ static const GLuint hw_prim[GL_POLYGON+1] = { R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST, }; -static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void r128RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void r128RasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void r128RenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** @@ -344,7 +344,7 @@ r128_fallback_tri( r128ContextPtr rmesa, r128Vertex *v1, r128Vertex *v2 ) { - GLcontext *ctx = rmesa->glCtx; + struct gl_context *ctx = rmesa->glCtx; SWvertex v[3]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -358,7 +358,7 @@ r128_fallback_line( r128ContextPtr rmesa, r128Vertex *v0, r128Vertex *v1 ) { - GLcontext *ctx = rmesa->glCtx; + struct gl_context *ctx = rmesa->glCtx; SWvertex v[2]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -370,7 +370,7 @@ static void r128_fallback_point( r128ContextPtr rmesa, r128Vertex *v0 ) { - GLcontext *ctx = rmesa->glCtx; + struct gl_context *ctx = rmesa->glCtx; SWvertex v[1]; _swsetup_Translate( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -426,7 +426,7 @@ r128_fallback_point( r128ContextPtr rmesa, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) #define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS) -void r128ChooseRenderState(GLcontext *ctx) +void r128ChooseRenderState(struct gl_context *ctx) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; @@ -479,7 +479,7 @@ void r128ChooseRenderState(GLcontext *ctx) /* Validate state at pipeline start */ /**********************************************************************/ -static void r128RunPipeline( GLcontext *ctx ) +static void r128RunPipeline( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -509,7 +509,7 @@ static void r128RunPipeline( GLcontext *ctx ) * primitives. */ -static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void r128RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -531,7 +531,7 @@ static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void r128SetupAntialias( GLcontext *ctx, GLenum prim ) +static void r128SetupAntialias( struct gl_context *ctx, GLenum prim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -553,7 +553,7 @@ static void r128SetupAntialias( GLcontext *ctx, GLenum prim ) } } -static void r128RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void r128RenderPrimitive( struct gl_context *ctx, GLenum prim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint hw = hw_prim[prim]; @@ -584,7 +584,7 @@ do { \ offset += (SIZE); \ } while (0) -static void r128RenderStart( GLcontext *ctx ) +static void r128RenderStart( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -681,7 +681,7 @@ static void r128RenderStart( GLcontext *ctx ) } } -static void r128RenderFinish( GLcontext *ctx ) +static void r128RenderFinish( struct gl_context *ctx ) { if (R128_CONTEXT(ctx)->RenderIndex & R128_FALLBACK_BIT) _swrast_flush( ctx ); @@ -717,7 +717,7 @@ static const char *getFallbackString(GLuint bit) return fallbackStrings[i]; } -void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void r128Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -768,7 +768,7 @@ void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void r128InitTriFuncs( GLcontext *ctx ) +void r128InitTriFuncs( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_tris.h b/src/mesa/drivers/dri/r128/r128_tris.h index c0667edb61..a139497765 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.h +++ b/src/mesa/drivers/dri/r128/r128_tris.h @@ -37,10 +37,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" -extern void r128InitTriFuncs( GLcontext *ctx ); -extern void r128ChooseRenderState( GLcontext *ctx ); +extern void r128InitTriFuncs( struct gl_context *ctx ); +extern void r128ChooseRenderState( struct gl_context *ctx ); -extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void r128Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c index e187fc0f61..05a15c444c 100644 --- a/src/mesa/drivers/dri/r200/r200_blit.c +++ b/src/mesa/drivers/dri/r200/r200_blit.c @@ -444,7 +444,7 @@ static inline void emit_draw_packet(struct r200_context *r200, * @param[in] height region height * @param[in] flip_y set if y coords of the source image need to be flipped */ -unsigned r200_blit(GLcontext *ctx, +unsigned r200_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r200/r200_blit.h b/src/mesa/drivers/dri/r200/r200_blit.h index 53206f0b47..56018b9c0e 100644 --- a/src/mesa/drivers/dri/r200/r200_blit.h +++ b/src/mesa/drivers/dri/r200/r200_blit.h @@ -32,7 +32,7 @@ void r200_blit_init(struct r200_context *r200); unsigned r200_check_blit(gl_format mesa_format); -unsigned r200_blit(GLcontext *ctx, +unsigned r200_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index ad43a8ca92..931a9ecf8f 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -167,7 +167,7 @@ static void r200FireEB(r200ContextPtr rmesa, int vertex_count, int type) } } -void r200FlushElts(GLcontext *ctx) +void r200FlushElts(struct gl_context *ctx) { r200ContextPtr rmesa = R200_CONTEXT(ctx); int nr, elt_used = rmesa->tcl.elt_used; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 2a35e2d6e4..723e31401d 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -80,7 +80,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* Return various strings for glGetString(). */ -static const GLubyte *r200GetString( GLcontext *ctx, GLenum name ) +static const GLubyte *r200GetString( struct gl_context *ctx, GLenum name ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); static char buffer[128]; @@ -279,7 +279,7 @@ GLboolean r200CreateContext( gl_api api, radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); struct dd_function_table functions; r200ContextPtr rmesa; - GLcontext *ctx; + struct gl_context *ctx; int i; int tcl_mode; diff --git a/src/mesa/drivers/dri/r200/r200_fragshader.c b/src/mesa/drivers/dri/r200/r200_fragshader.c index 2a9268dd34..b1d045c5ca 100644 --- a/src/mesa/drivers/dri/r200/r200_fragshader.c +++ b/src/mesa/drivers/dri/r200/r200_fragshader.c @@ -121,7 +121,7 @@ static GLuint dstmask_table[8] = R200_TXC_OUTPUT_MASK_RGB }; -static void r200UpdateFSArith( GLcontext *ctx ) +static void r200UpdateFSArith( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint *afs_cmd; @@ -322,7 +322,7 @@ static void r200UpdateFSArith( GLcontext *ctx ) rmesa->afs_loaded = ctx->ATIFragmentShader.Current; } -static void r200UpdateFSRouting( GLcontext *ctx ) { +static void r200UpdateFSRouting( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; GLuint reg; @@ -499,7 +499,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) { } } -static void r200UpdateFSConstants( GLcontext *ctx ) +static void r200UpdateFSConstants( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; @@ -537,7 +537,7 @@ static void r200UpdateFSConstants( GLcontext *ctx ) * stored in some DriverData object attached to the mesa atifs object, i.e. binding a * shader wouldn't force us to "recompile" the shader). */ -void r200UpdateFragmentShader( GLcontext *ctx ) +void r200UpdateFragmentShader( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index df73de5394..02201cb53d 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -54,7 +54,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define R200_TIMEOUT 512 #define R200_IDLE_RETRY 16 -static void r200KernelClear(GLcontext *ctx, GLuint flags) +static void r200KernelClear(struct gl_context *ctx, GLuint flags) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -180,7 +180,7 @@ static void r200KernelClear(GLcontext *ctx, GLuint flags) /* ================================================================ * Buffer clear */ -static void r200Clear( GLcontext *ctx, GLbitfield mask ) +static void r200Clear( struct gl_context *ctx, GLbitfield mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index c5dca89bc7..f2527189aa 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -54,7 +54,7 @@ extern void r200EmitVbufPrim( r200ContextPtr rmesa, GLuint primitive, GLuint vertex_nr ); -extern void r200FlushElts(GLcontext *ctx); +extern void r200FlushElts(struct gl_context *ctx); extern GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa, GLuint primitive, diff --git a/src/mesa/drivers/dri/r200/r200_maos.h b/src/mesa/drivers/dri/r200/r200_maos.h index 16a70475e1..f58f77d8db 100644 --- a/src/mesa/drivers/dri/r200/r200_maos.h +++ b/src/mesa/drivers/dri/r200/r200_maos.h @@ -37,6 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_context.h" -extern void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev ); +extern void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev ); #endif diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index aecba7f894..8a047e6419 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -70,7 +70,7 @@ do { \ } while (0) #endif -static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, +static void r200_emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos, GLvoid *data, int stride, int count) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -103,7 +103,7 @@ static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, /* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ -void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev ) +void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 29d7bed8b6..b523edcb5d 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -63,7 +63,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Alpha blending */ -static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void r200AlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC]; @@ -106,7 +106,7 @@ static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc; } -static void r200BlendColor( GLcontext *ctx, const GLfloat cf[4] ) +static void r200BlendColor( struct gl_context *ctx, const GLfloat cf[4] ) { GLubyte color[4]; r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -199,7 +199,7 @@ static int blend_factor( GLenum factor, GLboolean is_src ) * and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for * unknown reasons. */ -static void r200_set_blend_state( GLcontext * ctx ) +static void r200_set_blend_state( struct gl_context * ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint cntl = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & @@ -323,13 +323,13 @@ static void r200_set_blend_state( GLcontext * ctx ) } -static void r200BlendEquationSeparate( GLcontext *ctx, +static void r200BlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { r200_set_blend_state( ctx ); } -static void r200BlendFuncSeparate( GLcontext *ctx, +static void r200BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -341,7 +341,7 @@ static void r200BlendFuncSeparate( GLcontext *ctx, * Depth testing */ -static void r200DepthFunc( GLcontext *ctx, GLenum func ) +static void r200DepthFunc( struct gl_context *ctx, GLenum func ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -376,7 +376,7 @@ static void r200DepthFunc( GLcontext *ctx, GLenum func ) } } -static void r200ClearDepth( GLcontext *ctx, GLclampd d ) +static void r200ClearDepth( struct gl_context *ctx, GLclampd d ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] & @@ -392,7 +392,7 @@ static void r200ClearDepth( GLcontext *ctx, GLclampd d ) } } -static void r200DepthMask( GLcontext *ctx, GLboolean flag ) +static void r200DepthMask( struct gl_context *ctx, GLboolean flag ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); R200_STATECHANGE( rmesa, ctx ); @@ -410,7 +410,7 @@ static void r200DepthMask( GLcontext *ctx, GLboolean flag ) */ -static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void r200Fogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); union { int i; float f; } c, d; @@ -526,7 +526,7 @@ static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Culling */ -static void r200CullFace( GLcontext *ctx, GLenum unused ) +static void r200CullFace( struct gl_context *ctx, GLenum unused ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -563,7 +563,7 @@ static void r200CullFace( GLcontext *ctx, GLenum unused ) } } -static void r200FrontFace( GLcontext *ctx, GLenum mode ) +static void r200FrontFace( struct gl_context *ctx, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -591,7 +591,7 @@ static void r200FrontFace( GLcontext *ctx, GLenum mode ) /* ============================================================= * Point state */ -static void r200PointSize( GLcontext *ctx, GLfloat size ) +static void r200PointSize( struct gl_context *ctx, GLfloat size ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLfloat *fcmd = (GLfloat *)rmesa->hw.ptp.cmd; @@ -612,7 +612,7 @@ static void r200PointSize( GLcontext *ctx, GLfloat size ) fcmd[PTP_VPORT_SCALE_PTSIZE] = ctx->Point.Size; } -static void r200PointParameter( GLcontext *ctx, GLenum pname, const GLfloat *params) +static void r200PointParameter( struct gl_context *ctx, GLenum pname, const GLfloat *params) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLfloat *fcmd = (GLfloat *)rmesa->hw.ptp.cmd; @@ -680,7 +680,7 @@ static void r200PointParameter( GLcontext *ctx, GLenum pname, const GLfloat *par /* ============================================================= * Line state */ -static void r200LineWidth( GLcontext *ctx, GLfloat widthf ) +static void r200LineWidth( struct gl_context *ctx, GLfloat widthf ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -701,7 +701,7 @@ static void r200LineWidth( GLcontext *ctx, GLfloat widthf ) } } -static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) +static void r200LineStipple( struct gl_context *ctx, GLint factor, GLushort pattern ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -714,7 +714,7 @@ static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) /* ============================================================= * Masks */ -static void r200ColorMask( GLcontext *ctx, +static void r200ColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -752,7 +752,7 @@ static void r200ColorMask( GLcontext *ctx, * Polygon state */ -static void r200PolygonOffset( GLcontext *ctx, +static void r200PolygonOffset( struct gl_context *ctx, GLfloat factor, GLfloat units ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -770,7 +770,7 @@ static void r200PolygonOffset( GLcontext *ctx, rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32; } -static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) +static void r200PolygonMode( struct gl_context *ctx, GLenum face, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; @@ -797,7 +797,7 @@ static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) /* Examine lighting and texture state to determine if separate specular * should be enabled. */ -static void r200UpdateSpecular( GLcontext *ctx ) +static void r200UpdateSpecular( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); uint32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL]; @@ -871,7 +871,7 @@ static void r200UpdateSpecular( GLcontext *ctx ) /* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ -static void update_global_ambient( GLcontext *ctx ) +static void update_global_ambient( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); float *fcmd = (float *)R200_DB_STATE( glt ); @@ -902,7 +902,7 @@ static void update_global_ambient( GLcontext *ctx ) * - light[p].colors * - light[p].enabled */ -static void update_light_colors( GLcontext *ctx, GLuint p ) +static void update_light_colors( struct gl_context *ctx, GLuint p ) { struct gl_light *l = &ctx->Light.Light[p]; @@ -920,7 +920,7 @@ static void update_light_colors( GLcontext *ctx, GLuint p ) } } -static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) +static void r200ColorMaterial( struct gl_context *ctx, GLenum face, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1]; @@ -1022,7 +1022,7 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) } -void r200UpdateMaterial( GLcontext *ctx ) +void r200UpdateMaterial( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLfloat (*mat)[4] = ctx->Light.Material.Attrib; @@ -1117,7 +1117,7 @@ void r200UpdateMaterial( GLcontext *ctx ) * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW * and _MESA_NEW_NEED_EYE_COORDS. */ -static void update_light( GLcontext *ctx ) +static void update_light( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1177,7 +1177,7 @@ static void update_light( GLcontext *ctx ) } } -static void r200Lightfv( GLcontext *ctx, GLenum light, +static void r200Lightfv( struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1288,7 +1288,7 @@ static void r200Lightfv( GLcontext *ctx, GLenum light, } } -static void r200UpdateLocalViewer ( GLcontext *ctx ) +static void r200UpdateLocalViewer ( struct gl_context *ctx ) { /* It looks like for the texgen modes GL_SPHERE_MAP, GL_NORMAL_MAP and GL_REFLECTION_MAP we need R200_LOCAL_VIEWER set (fglrx does exactly that @@ -1308,7 +1308,7 @@ static void r200UpdateLocalViewer ( GLcontext *ctx ) rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER; } -static void r200LightModelfv( GLcontext *ctx, GLenum pname, +static void r200LightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1343,7 +1343,7 @@ static void r200LightModelfv( GLcontext *ctx, GLenum pname, } } -static void r200ShadeModel( GLcontext *ctx, GLenum mode ) +static void r200ShadeModel( struct gl_context *ctx, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -1384,7 +1384,7 @@ static void r200ShadeModel( GLcontext *ctx, GLenum mode ) * User clip planes */ -static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void r200ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0; r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1397,7 +1397,7 @@ static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) rmesa->hw.ucp[p].cmd[UCP_W] = ip[3]; } -static void r200UpdateClipPlanes( GLcontext *ctx ) +static void r200UpdateClipPlanes( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint p; @@ -1421,7 +1421,7 @@ static void r200UpdateClipPlanes( GLcontext *ctx ) */ static void -r200StencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +r200StencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1466,7 +1466,7 @@ r200StencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -r200StencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +r200StencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1477,7 +1477,7 @@ r200StencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) } static void -r200StencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, +r200StencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1569,7 +1569,7 @@ r200StencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, } } -static void r200ClearStencil( GLcontext *ctx, GLint s ) +static void r200ClearStencil( struct gl_context *ctx, GLint s ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1588,7 +1588,7 @@ static void r200ClearStencil( GLcontext *ctx, GLint s ) * Called when window size or position changes or viewport or depth range * state is changed. We update the hardware viewport state here. */ -void r200UpdateWindow( GLcontext *ctx ) +void r200UpdateWindow( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1624,7 +1624,7 @@ void r200UpdateWindow( GLcontext *ctx ) rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32; } -void r200_vtbl_update_scissor( GLcontext *ctx ) +void r200_vtbl_update_scissor( struct gl_context *ctx ) { r200ContextPtr r200 = R200_CONTEXT(ctx); unsigned x1, y1, x2, y2; @@ -1650,7 +1650,7 @@ void r200_vtbl_update_scissor( GLcontext *ctx ) } -static void r200Viewport( GLcontext *ctx, GLint x, GLint y, +static void r200Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { /* Don't pipeline viewport changes, conflict with window offset @@ -1662,13 +1662,13 @@ static void r200Viewport( GLcontext *ctx, GLint x, GLint y, radeon_viewport(ctx, x, y, width, height); } -static void r200DepthRange( GLcontext *ctx, GLclampd nearval, +static void r200DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { r200UpdateWindow( ctx ); } -void r200UpdateViewportOffset( GLcontext *ctx ) +void r200UpdateViewportOffset( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1724,7 +1724,7 @@ void r200UpdateViewportOffset( GLcontext *ctx ) * Miscellaneous */ -static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] ) +static void r200ClearColor( struct gl_context *ctx, const GLfloat c[4] ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLubyte color[4]; @@ -1743,7 +1743,7 @@ static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] ) } -static void r200RenderMode( GLcontext *ctx, GLenum mode ) +static void r200RenderMode( struct gl_context *ctx, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); FALLBACK( rmesa, R200_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -1769,7 +1769,7 @@ static GLuint r200_rop_tab[] = { R200_ROP_SET, }; -static void r200LogicOpCode( GLcontext *ctx, GLenum opcode ) +static void r200LogicOpCode( struct gl_context *ctx, GLenum opcode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint rop = (GLuint)opcode - GL_CLEAR; @@ -1784,7 +1784,7 @@ static void r200LogicOpCode( GLcontext *ctx, GLenum opcode ) * State enable/disable */ -static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void r200Enable( struct gl_context *ctx, GLenum cap, GLboolean state ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint p, flag; @@ -2168,7 +2168,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) } -void r200LightingSpaceChange( GLcontext *ctx ) +void r200LightingSpaceChange( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean tmp; @@ -2225,7 +2225,7 @@ static void upload_matrix_t( r200ContextPtr rmesa, const GLfloat *src, int idx ) } -static void update_texturematrix( GLcontext *ctx ) +static void update_texturematrix( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLuint tpc = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0]; @@ -2283,7 +2283,7 @@ static void update_texturematrix( GLcontext *ctx ) } } -static GLboolean r200ValidateBuffers(GLcontext *ctx) +static GLboolean r200ValidateBuffers(struct gl_context *ctx) { r200ContextPtr rmesa = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -2333,7 +2333,7 @@ static GLboolean r200ValidateBuffers(GLcontext *ctx) return GL_TRUE; } -GLboolean r200ValidateState( GLcontext *ctx ) +GLboolean r200ValidateState( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint new_state = rmesa->radeon.NewGLState; @@ -2405,7 +2405,7 @@ GLboolean r200ValidateState( GLcontext *ctx ) } -static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) +static void r200InvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -2420,7 +2420,7 @@ static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) * Should map to inputs just like the generic vertex arrays for vertex progs. * In theory there could still be too many and we'd still need a fallback. */ -static GLboolean check_material( GLcontext *ctx ) +static GLboolean check_material( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; @@ -2435,7 +2435,7 @@ static GLboolean check_material( GLcontext *ctx ) return GL_FALSE; } -static void r200WrapRunPipeline( GLcontext *ctx ) +static void r200WrapRunPipeline( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean has_material; @@ -2465,7 +2465,7 @@ static void r200WrapRunPipeline( GLcontext *ctx ) } -static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void r200PolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { r200ContextPtr r200 = R200_CONTEXT(ctx); GLint i; @@ -2538,7 +2538,7 @@ void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *func } -void r200InitTnlFuncs( GLcontext *ctx ) +void r200InitTnlFuncs( struct gl_context *ctx ) { TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = r200UpdateMaterial; TNL_CONTEXT(ctx)->Driver.RunPipeline = r200WrapRunPipeline; diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index 327ba837e2..340bd8234a 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -39,25 +39,25 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r200InitState( r200ContextPtr rmesa ); extern void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *functions ); -extern void r200InitTnlFuncs( GLcontext *ctx ); +extern void r200InitTnlFuncs( struct gl_context *ctx ); -extern void r200UpdateMaterial( GLcontext *ctx ); +extern void r200UpdateMaterial( struct gl_context *ctx ); -extern void r200UpdateViewportOffset( GLcontext *ctx ); -extern void r200UpdateWindow( GLcontext *ctx ); -extern void r200UpdateDrawBuffer(GLcontext *ctx); +extern void r200UpdateViewportOffset( struct gl_context *ctx ); +extern void r200UpdateWindow( struct gl_context *ctx ); +extern void r200UpdateDrawBuffer(struct gl_context *ctx); -extern GLboolean r200ValidateState( GLcontext *ctx ); +extern GLboolean r200ValidateState( struct gl_context *ctx ); -extern void r200_vtbl_update_scissor( GLcontext *ctx ); +extern void r200_vtbl_update_scissor( struct gl_context *ctx ); -extern void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) do { \ if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \ __FUNCTION__, bit, mode ); \ r200Fallback( rmesa->radeon.glCtx, bit, mode ); \ } while (0) -extern void r200LightingSpaceChange( GLcontext *ctx ); +extern void r200LightingSpaceChange( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 1606553009..f6afb90d59 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -228,7 +228,7 @@ static int cmdscl2( int offset, int stride, int count ) * If it is active check function returns maximum emit size. */ #define CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ (void) rmesa; \ @@ -236,21 +236,21 @@ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ } #define TCL_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ return (!rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ } #define TCL_OR_VP_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ } #define VP_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ (void) atom; \ @@ -337,7 +337,7 @@ VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->Base.NumNativeParameter OUT_BATCH(CP_PACKET0_ONE(R200_SE_TCL_SCALAR_DATA_REG, h.scalars.count - 1)); \ OUT_BATCH_TABLE((data), h.scalars.count); \ } while(0) -static int check_rrb(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_rrb(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -347,7 +347,7 @@ static int check_rrb(GLcontext *ctx, struct radeon_state_atom *atom) return atom->cmd_size; } -static int check_polygon_stipple(GLcontext *ctx, +static int check_polygon_stipple(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); @@ -356,7 +356,7 @@ static int check_polygon_stipple(GLcontext *ctx, return 0; } -static void mtl_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void mtl_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -368,7 +368,7 @@ static void mtl_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void lit_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -380,7 +380,7 @@ static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void ptp_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void ptp_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -392,7 +392,7 @@ static void ptp_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void veclinear_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void veclinear_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -401,7 +401,7 @@ static void veclinear_emit(GLcontext *ctx, struct radeon_state_atom *atom) OUT_VECLINEAR(atom->cmd[0], atom->cmd+1); } -static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void scl_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -413,7 +413,7 @@ static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) } -static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void vec_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -424,7 +424,7 @@ static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -491,7 +491,7 @@ static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always_ctx( struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb, *drb; @@ -516,7 +516,7 @@ static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) return dwords; } -static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -600,7 +600,7 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int get_tex_size(GLcontext* ctx, struct radeon_state_atom *atom) +static int get_tex_size(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); uint32_t dwords = atom->cmd_size + 2; @@ -612,7 +612,7 @@ static int get_tex_size(GLcontext* ctx, struct radeon_state_atom *atom) return dwords; } -static int check_tex_pair(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex_pair(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); /** XOR is bit flip operation so use it for finding pair */ @@ -622,7 +622,7 @@ static int check_tex_pair(GLcontext* ctx, struct radeon_state_atom *atom) return get_tex_size(ctx, atom); } -static int check_tex(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); if (!(r200->state.texture.unit[atom->idx].unitneeded)) @@ -632,7 +632,7 @@ static int check_tex(GLcontext* ctx, struct radeon_state_atom *atom) } -static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -657,7 +657,7 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int get_tex_mm_size(GLcontext* ctx, struct radeon_state_atom *atom) +static int get_tex_mm_size(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); uint32_t dwords = atom->cmd_size + 2; @@ -676,7 +676,7 @@ static int get_tex_mm_size(GLcontext* ctx, struct radeon_state_atom *atom) return dwords; } -static int check_tex_pair_mm(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex_pair_mm(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); /** XOR is bit flip operation so use it for finding pair */ @@ -686,7 +686,7 @@ static int check_tex_pair_mm(GLcontext* ctx, struct radeon_state_atom *atom) return get_tex_mm_size(ctx, atom); } -static int check_tex_mm(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex_mm(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); if (!(r200->state.texture.unit[atom->idx].unitneeded)) @@ -696,7 +696,7 @@ static int check_tex_mm(GLcontext* ctx, struct radeon_state_atom *atom) } -static void tex_emit_mm(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit_mm(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -726,7 +726,7 @@ static void tex_emit_mm(GLcontext *ctx, struct radeon_state_atom *atom) } -static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -753,7 +753,7 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -782,7 +782,7 @@ static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) */ void r200InitState( r200ContextPtr rmesa ) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; GLuint i; rmesa->radeon.state.color.clear = 0x00000000; diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index effe6fb933..38864162ce 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -75,7 +75,7 @@ do { \ rmesa->radeon.swtcl.vertex_attr_count++; \ } while (0) -static void r200SetVertexFormat( GLcontext *ctx ) +static void r200SetVertexFormat( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -221,7 +221,7 @@ static void r200_predict_emit_size( r200ContextPtr rmesa ) } -static void r200RenderStart( GLcontext *ctx ) +static void r200RenderStart( struct gl_context *ctx ) { r200SetVertexFormat( ctx ); if (RADEON_DEBUG & RADEON_VERTS) @@ -234,7 +234,7 @@ static void r200RenderStart( GLcontext *ctx ) * determine in advance whether or not the hardware can / should do the * projection divide or Mesa should do it. */ -void r200ChooseVertexState( GLcontext *ctx ) +void r200ChooseVertexState( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -286,7 +286,7 @@ void r200ChooseVertexState( GLcontext *ctx ) } } -void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset) +void r200_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { r200ContextPtr rmesa = R200_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_VERTS) @@ -315,7 +315,7 @@ void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset) /**************************************************************************/ -static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim) +static INLINE GLuint reduced_hw_prim( struct gl_context *ctx, GLuint prim) { switch (prim) { case GL_POINTS: @@ -336,9 +336,9 @@ static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim) } -static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ); -static void r200ResetLineStipple( GLcontext *ctx ); +static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim ); +static void r200ResetLineStipple( struct gl_context *ctx ); /*********************************************************************** * Emit primitives as inline vertices * @@ -568,7 +568,7 @@ static void init_rast_tab( void ) /* Choose render functions */ /**********************************************************************/ -void r200ChooseRenderState( GLcontext *ctx ) +void r200ChooseRenderState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -608,7 +608,7 @@ void r200ChooseRenderState( GLcontext *ctx ) /**********************************************************************/ -static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -634,7 +634,7 @@ static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); rmesa->radeon.swtcl.render_primitive = prim; @@ -642,11 +642,11 @@ static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ) r200RasterPrimitive( ctx, reduced_hw_prim(ctx, prim) ); } -static void r200RenderFinish( GLcontext *ctx ) +static void r200RenderFinish( struct gl_context *ctx ) { } -static void r200ResetLineStipple( GLcontext *ctx ) +static void r200ResetLineStipple( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); R200_STATECHANGE( rmesa, lin ); @@ -678,7 +678,7 @@ static const char *getFallbackString(GLuint bit) } -void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -745,7 +745,7 @@ void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) * NV_texture_rectangle). */ void -r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, +r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) @@ -920,7 +920,7 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, /* Initialization. */ /**********************************************************************/ -void r200InitSwtcl( GLcontext *ctx ) +void r200InitSwtcl( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r200ContextPtr rmesa = R200_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.h b/src/mesa/drivers/dri/r200/r200_swtcl.h index b0905879d7..668e175603 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.h +++ b/src/mesa/drivers/dri/r200/r200_swtcl.h @@ -38,32 +38,32 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "r200_context.h" -extern void r200InitSwtcl( GLcontext *ctx ); +extern void r200InitSwtcl( struct gl_context *ctx ); -extern void r200ChooseRenderState( GLcontext *ctx ); -extern void r200ChooseVertexState( GLcontext *ctx ); +extern void r200ChooseRenderState( struct gl_context *ctx ); +extern void r200ChooseVertexState( struct gl_context *ctx ); -extern void r200CheckTexSizes( GLcontext *ctx ); +extern void r200CheckTexSizes( struct gl_context *ctx ); -extern void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count, +extern void r200BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void r200PrintSetupFlags(char *msg, GLuint flags ); -extern void r200_translate_vertex( GLcontext *ctx, +extern void r200_translate_vertex( struct gl_context *ctx, const radeonVertex *src, SWvertex *dst ); -extern void r200_print_vertex( GLcontext *ctx, const radeonVertex *v ); +extern void r200_print_vertex( struct gl_context *ctx, const radeonVertex *v ); -extern void r200_import_float_colors( GLcontext *ctx ); -extern void r200_import_float_spec_colors( GLcontext *ctx ); +extern void r200_import_float_colors( struct gl_context *ctx ); +extern void r200_import_float_spec_colors( struct gl_context *ctx ); -extern void r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, +extern void r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); -void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset); +void r200_swtcl_flush(struct gl_context *ctx, uint32_t current_offset); #endif diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index ba54177476..84db7c9d4e 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -177,7 +177,7 @@ while (0) * discrete and there are no intervening state changes. (Somewhat * duplicates changes to DrawArrays code) */ -static void r200EmitPrim( GLcontext *ctx, +static void r200EmitPrim( struct gl_context *ctx, GLenum prim, GLuint hwprim, GLuint start, @@ -241,7 +241,7 @@ static void r200EmitPrim( GLcontext *ctx, /* External entrypoints */ /**********************************************************************/ -void r200EmitPrimitive( GLcontext *ctx, +void r200EmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -249,7 +249,7 @@ void r200EmitPrimitive( GLcontext *ctx, tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void r200EmitEltPrimitive( GLcontext *ctx, +void r200EmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -257,7 +257,7 @@ void r200EmitEltPrimitive( GLcontext *ctx, tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void r200TclPrimitive( GLcontext *ctx, +void r200TclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ) { @@ -339,7 +339,7 @@ r200InitStaticFogData( void ) * Fog blend factors are in the range [0,1]. */ float -r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) +r200ComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ) { GLfloat end = ctx->Fog.End; GLfloat d, temp; @@ -374,7 +374,7 @@ r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) * Predict total emit size for next rendering operation so there is no flush in middle of rendering * Prediction has to aim towards the best possible value that is worse than worst case scenario */ -static GLuint r200EnsureEmitSize( GLcontext * ctx , GLubyte* vimap_rev ) +static GLuint r200EnsureEmitSize( struct gl_context * ctx , GLubyte* vimap_rev ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -439,7 +439,7 @@ static GLuint r200EnsureEmitSize( GLcontext * ctx , GLubyte* vimap_rev ) /* TCL render. */ -static GLboolean r200_run_tcl_render( GLcontext *ctx, +static GLboolean r200_run_tcl_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -596,7 +596,7 @@ const struct tnl_pipeline_stage _r200_tcl_stage = */ -static void transition_to_swtnl( GLcontext *ctx ) +static void transition_to_swtnl( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -620,7 +620,7 @@ static void transition_to_swtnl( GLcontext *ctx ) rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~(R200_VAP_TCL_ENABLE|R200_VAP_PROG_VTX_SHADER_ENABLE); } -static void transition_to_hwtnl( GLcontext *ctx ) +static void transition_to_hwtnl( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -690,7 +690,7 @@ static char *getFallbackString(GLuint bit) -void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint oldfallback = rmesa->radeon.TclFallback; diff --git a/src/mesa/drivers/dri/r200/r200_tcl.h b/src/mesa/drivers/dri/r200/r200_tcl.h index f191ddc7eb..53a1f11e9d 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.h +++ b/src/mesa/drivers/dri/r200/r200_tcl.h @@ -37,17 +37,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_context.h" -extern void r200TclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim ); -extern void r200EmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void r200TclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ); +extern void r200EmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void r200EmitPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void r200EmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); extern void r200InitStaticFogData( void ); -extern float r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ); +extern float r200ComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ); #define R200_TCL_FALLBACK_RASTER 0x1 /* rasterization */ #define R200_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */ diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 6723b12bf4..5207c2901a 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -294,7 +294,7 @@ static void r200SetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] ) t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] ); } -static void r200TexEnv( GLcontext *ctx, GLenum target, +static void r200TexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -366,7 +366,7 @@ static void r200TexEnv( GLcontext *ctx, GLenum target, * next UpdateTextureState */ -static void r200TexParameter( GLcontext *ctx, GLenum target, +static void r200TexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ) { @@ -409,7 +409,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target, } -static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void r200DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { r200ContextPtr rmesa = R200_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); @@ -446,7 +446,7 @@ static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) * Basically impossible to do this on the fly - just collect some * basic info & do the checks from ValidateState(). */ -static void r200TexGen( GLcontext *ctx, +static void r200TexGen( struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params ) @@ -464,7 +464,7 @@ static void r200TexGen( GLcontext *ctx, * allocate the default texture objects. * Fixup MaxAnisotropy according to user preference. */ -static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx, +static struct gl_texture_object *r200NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { diff --git a/src/mesa/drivers/dri/r200/r200_tex.h b/src/mesa/drivers/dri/r200/r200_tex.h index 1a1e7038df..8bebf8a037 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.h +++ b/src/mesa/drivers/dri/r200/r200_tex.h @@ -42,7 +42,7 @@ extern void r200SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); -extern void r200UpdateTextureState( GLcontext *ctx ); +extern void r200UpdateTextureState( struct gl_context *ctx ); extern int r200UploadTexImages( r200ContextPtr rmesa, radeonTexObjPtr t, GLuint face ); @@ -50,8 +50,8 @@ extern void r200DestroyTexObj( r200ContextPtr rmesa, radeonTexObjPtr t ); extern void r200InitTextureFuncs( radeonContextPtr radeon, struct dd_function_table *functions ); -extern void r200UpdateFragmentShader( GLcontext *ctx ); +extern void r200UpdateFragmentShader( struct gl_context *ctx ); -extern void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d ); +extern void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d ); #endif /* __R200_TEX_H__ */ diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 9ccf30c3ac..690bec640b 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -302,7 +302,7 @@ do { \ * Texture unit state management */ -static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit, int slot, GLuint replaceargs ) +static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slot, GLuint replaceargs ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -869,7 +869,7 @@ void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) #define REF_COLOR 1 #define REF_ALPHA 2 -static GLboolean r200UpdateAllTexEnv( GLcontext *ctx ) +static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLint i, j, currslot; @@ -1203,7 +1203,7 @@ static GLuint r200_need_dis_texgen(const GLbitfield texGenEnabled, /* * Returns GL_FALSE if fallback required. */ -static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit ) +static GLboolean r200_validate_texgen( struct gl_context *ctx, GLuint unit ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -1385,7 +1385,7 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d ) +void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1521,7 +1521,7 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) } -static GLboolean r200_validate_texture(GLcontext *ctx, struct gl_texture_object *texObj, int unit) +static GLboolean r200_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit) { r200ContextPtr rmesa = R200_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -1564,7 +1564,7 @@ static GLboolean r200_validate_texture(GLcontext *ctx, struct gl_texture_object return !t->border_fallback; } -static GLboolean r200UpdateTextureUnit(GLcontext *ctx, int unit) +static GLboolean r200UpdateTextureUnit(struct gl_context *ctx, int unit) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint unitneeded = rmesa->state.texture.unit[unit].unitneeded; @@ -1588,7 +1588,7 @@ static GLboolean r200UpdateTextureUnit(GLcontext *ctx, int unit) } -void r200UpdateTextureState( GLcontext *ctx ) +void r200UpdateTextureState( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean ok; diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 5d268319f3..5d69012a81 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -100,7 +100,7 @@ static struct{ }; #undef OPN -static GLboolean r200VertexProgUpdateParams(GLcontext *ctx, struct r200_vertex_program *vp) +static GLboolean r200VertexProgUpdateParams(struct gl_context *ctx, struct r200_vertex_program *vp) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1]; @@ -396,7 +396,7 @@ static unsigned long op_operands(enum prog_opcode opcode) * * \return GL_TRUE for success, GL_FALSE for failure. */ -static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_vertex_program *vp) +static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r200_vertex_program *vp) { struct gl_vertex_program *mesa_vp = &vp->mesa_program; struct prog_instruction *vpi; @@ -1098,7 +1098,7 @@ else { return GL_TRUE; } -void r200SetupVertexProg( GLcontext *ctx ) { +void r200SetupVertexProg( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); struct r200_vertex_program *vp = (struct r200_vertex_program *)ctx->VertexProgram.Current; GLboolean fallback; @@ -1179,7 +1179,7 @@ void r200SetupVertexProg( GLcontext *ctx ) { static void -r200BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog) +r200BindProgram(struct gl_context *ctx, GLenum target, struct gl_program *prog) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1194,7 +1194,7 @@ r200BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog) } static struct gl_program * -r200NewProgram(GLcontext *ctx, GLenum target, GLuint id) +r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id) { struct r200_vertex_program *vp; @@ -1213,13 +1213,13 @@ r200NewProgram(GLcontext *ctx, GLenum target, GLuint id) static void -r200DeleteProgram(GLcontext *ctx, struct gl_program *prog) +r200DeleteProgram(struct gl_context *ctx, struct gl_program *prog) { _mesa_delete_program(ctx, prog); } static GLboolean -r200ProgramStringNotify(GLcontext *ctx, GLenum target, struct gl_program *prog) +r200ProgramStringNotify(struct gl_context *ctx, GLenum target, struct gl_program *prog) { struct r200_vertex_program *vp = (void *)prog; r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1244,7 +1244,7 @@ r200ProgramStringNotify(GLcontext *ctx, GLenum target, struct gl_program *prog) } static GLboolean -r200IsProgramNative(GLcontext *ctx, GLenum target, struct gl_program *prog) +r200IsProgramNative(struct gl_context *ctx, GLenum target, struct gl_program *prog) { struct r200_vertex_program *vp = (void *)prog; diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.h b/src/mesa/drivers/dri/r200/r200_vertprog.h index 938237680c..4757f4b32b 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.h +++ b/src/mesa/drivers/dri/r200/r200_vertprog.h @@ -11,7 +11,7 @@ typedef struct { } VERTEX_SHADER_INSTRUCTION; extern void r200InitShaderFuncs(struct dd_function_table *functions); -extern void r200SetupVertexProg( GLcontext *ctx ); +extern void r200SetupVertexProg( struct gl_context *ctx ); #define VSF_FLAG_X 1 #define VSF_FLAG_Y 2 diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 74aef765e3..9fd8e8fde5 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -569,7 +569,7 @@ unsigned r300_check_blit(gl_format dst_format) * @param[in] height region height * @param[in] flip_y set if y coords of the source image need to be flipped */ -unsigned r300_blit(GLcontext *ctx, +unsigned r300_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r300/r300_blit.h b/src/mesa/drivers/dri/r300/r300_blit.h index 39b157a57b..286dbe1856 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.h +++ b/src/mesa/drivers/dri/r300/r300_blit.h @@ -32,7 +32,7 @@ void r300_blit_init(struct r300_context *r300); unsigned r300_check_blit(gl_format mesa_format); -unsigned r300_blit(GLcontext *ctx, +unsigned r300_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index c40802aec6..8a2f5ce021 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -69,7 +69,7 @@ static unsigned packet0_count(r300ContextPtr r300, uint32_t *pkt) #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) #define r500fp_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->r500fp.count) -static int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vpu(struct gl_context *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -83,7 +83,7 @@ static int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? (cnt * 4) + extra : 0; } -static int check_vpp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vpp(struct gl_context *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -114,7 +114,7 @@ void r300_emit_vpu(struct r300_context *r300, END_BATCH(); } -static void emit_vpu_state(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_vpu_state(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); drm_r300_cmd_header_t cmd; @@ -126,7 +126,7 @@ static void emit_vpu_state(GLcontext *ctx, struct radeon_state_atom * atom) r300_emit_vpu(r300, &atom->cmd[1], vpu_count(atom->cmd) * 4, addr); } -static void emit_vpp_state(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_vpp_state(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); drm_r300_cmd_header_t cmd; @@ -158,7 +158,7 @@ void r500_emit_fp(struct r300_context *r300, END_BATCH(); } -static void emit_r500fp_atom(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_r500fp_atom(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); drm_r300_cmd_header_t cmd; @@ -179,7 +179,7 @@ static void emit_r500fp_atom(GLcontext *ctx, struct radeon_state_atom * atom) r500_emit_fp(r300, &atom->cmd[1], count, addr, type, clamp); } -static int check_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) +static int check_tex_offsets(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int numtmus = packet0_count(r300, r300->hw.tex.offset.cmd); @@ -200,7 +200,7 @@ static int check_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) return dw; } -static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_tex_offsets(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -249,7 +249,7 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) } } -void r300_emit_scissor(GLcontext *ctx) +void r300_emit_scissor(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -287,7 +287,7 @@ void r300_emit_scissor(GLcontext *ctx) OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT)); END_BATCH(); } -static int check_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static int check_cb_offset(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t dw = 6 + 3 + 16; @@ -411,7 +411,7 @@ void r300_emit_cb_setup(struct r300_context *r300, END_BATCH(); } -static void emit_cb_offset_atom(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_cb_offset_atom(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -433,7 +433,7 @@ static void emit_cb_offset_atom(GLcontext *ctx, struct radeon_state_atom * atom) } } -static int check_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static int check_zb_offset(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t dw; @@ -443,7 +443,7 @@ static int check_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) return dw; } -static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_zb_offset(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -476,7 +476,7 @@ static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) END_BATCH(); } -static void emit_zstencil_format(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_zstencil_format(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -504,17 +504,17 @@ static void emit_zstencil_format(GLcontext *ctx, struct radeon_state_atom * atom END_BATCH(); } -static int check_never(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_never(struct gl_context *ctx, struct radeon_state_atom *atom) { return 0; } -static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; } -static int check_variable(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_variable(struct gl_context *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -525,7 +525,7 @@ static int check_variable(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? cnt + 1 : 0; } -static int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_r500fp(struct gl_context *ctx, struct radeon_state_atom *atom) { int cnt; r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -537,7 +537,7 @@ static int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? (cnt * 6) + extra : 0; } -static int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_r500fp_const(struct gl_context *ctx, struct radeon_state_atom *atom) { int cnt; r300ContextPtr r300 = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index 0e68da928e..7e6b8c5de6 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -45,7 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SCISSORS_BUFSZ (3) void r300InitCmdBuf(r300ContextPtr r300); -void r300_emit_scissor(GLcontext *ctx); +void r300_emit_scissor(struct gl_context *ctx); void r300_emit_vpu(struct r300_context *ctx, uint32_t *data, diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index f3f1a59e6a..9fbd36bfe6 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -219,7 +219,7 @@ static void r300_vtbl_pre_emit_atoms(radeonContextPtr radeon) end_3d(radeon); } -static void r300_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +static void r300_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) { r300ContextPtr r300 = R300_CONTEXT(ctx); if (mode) @@ -331,7 +331,7 @@ static void r300_init_vtbl(radeonContextPtr radeon) } } -static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) +static void r300InitConstValues(struct gl_context *ctx, radeonScreenPtr screen) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -439,7 +439,7 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen) r300->options = options; } -static void r300InitGLExtensions(GLcontext *ctx) +static void r300InitGLExtensions(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -485,7 +485,7 @@ GLboolean r300CreateContext(gl_api api, radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); struct dd_function_table functions; r300ContextPtr r300; - GLcontext *ctx; + struct gl_context *ctx; assert(glVisual); assert(driContextPriv); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 90933e0af6..349a3d412f 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -463,9 +463,9 @@ struct r300_swtcl_info { }; struct r300_vtable { - void (* SetupRSUnit)(GLcontext *ctx); - void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); - void (* SetupPixelShader)(GLcontext *ctx); + void (* SetupRSUnit)(struct gl_context *ctx); + void (* SetupFragmentShaderTextures)(struct gl_context *ctx, int *tmu_mappings); + void (* SetupPixelShader)(struct gl_context *ctx); }; struct r300_vertex_buffer { @@ -552,7 +552,7 @@ extern void r300InitShaderFuncs(struct dd_function_table *functions); extern void r300InitShaderFunctions(r300ContextPtr r300); -extern void r300InitDraw(GLcontext *ctx); +extern void r300InitDraw(struct gl_context *ctx); #define r300PackFloat32 radeonPackFloat32 #define r300PackFloat24 radeonPackFloat24 diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index 5ae9f49840..81769e1ee5 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -75,7 +75,7 @@ static int getTypeSize(GLenum type) } } -static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r300FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLvoid *src_ptr; @@ -143,7 +143,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } -static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r300SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -219,7 +219,7 @@ static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer * Convert attribute data type to float * If the attribute uses named buffer object replace the bo with newly allocated bo */ -static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_array *input, struct vertex_attribute *attr) +static void r300ConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct vertex_attribute *attr) { r300ContextPtr r300 = R300_CONTEXT(ctx); const GLvoid *src_ptr; @@ -290,7 +290,7 @@ static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_ } } -static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *input, int count, struct vertex_attribute *attr) +static void r300AlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct vertex_attribute *attr) { r300ContextPtr r300 = R300_CONTEXT(ctx); const int dst_stride = (input->StrideB + 3) & ~3; @@ -328,7 +328,7 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i attr->stride = dst_stride; } -static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const struct gl_client_array *input) +static void r300TranslateAttrib(struct gl_context *ctx, GLuint attr, int count, const struct gl_client_array *input) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_buffer *vbuf = &r300->vbuf; @@ -467,7 +467,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st ++vbuf->num_attribs; } -static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +static void r300SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_buffer *vbuf = &r300->vbuf; @@ -497,7 +497,7 @@ static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *ar return; } -static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void r300AllocDmaRegions(struct gl_context *ctx, const struct gl_client_array *input[], int count) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_buffer *vbuf = &r300->vbuf; @@ -578,7 +578,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in } -static void r300FreeData(GLcontext *ctx) +static void r300FreeData(struct gl_context *ctx) { /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo * to prevent double unref in radeonReleaseArrays @@ -604,7 +604,7 @@ static void r300FreeData(GLcontext *ctx) } } -static GLuint r300PredictTryDrawPrimsSize(GLcontext *ctx, +static GLuint r300PredictTryDrawPrimsSize(struct gl_context *ctx, GLuint nr_prims, const struct _mesa_prim *prim) { struct r300_context *r300 = R300_CONTEXT(ctx); @@ -641,7 +641,7 @@ static GLuint r300PredictTryDrawPrimsSize(GLcontext *ctx, return dwords; } -static GLboolean r300TryDrawPrims(GLcontext *ctx, +static GLboolean r300TryDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -707,7 +707,7 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void r300DrawPrims(GLcontext *ctx, +static void r300DrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -741,7 +741,7 @@ static void r300DrawPrims(GLcontext *ctx, _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); } -void r300InitDraw(GLcontext *ctx) +void r300InitDraw(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index a24d431611..f392006ced 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -48,14 +48,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_emit.h" -GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead) +GLuint r300VAPInputCntl0(struct gl_context * ctx, GLuint InputsRead) { /* No idea what this value means. I have seen other values written to * this register... */ return 0x5555; } -GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) +GLuint r300VAPInputCntl1(struct gl_context * ctx, GLuint InputsRead) { GLuint i, vic_1 = 0; @@ -76,7 +76,7 @@ GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) return vic_1; } -GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes) +GLuint r300VAPOutputCntl0(struct gl_context * ctx, GLuint vp_writes) { GLuint ret = 0; @@ -100,7 +100,7 @@ GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes) return ret; } -GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes) +GLuint r300VAPOutputCntl1(struct gl_context * ctx, GLuint vp_writes) { GLuint i, ret = 0, first_free_texcoord = 0; diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index a456d8867c..8911ab7728 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -220,9 +220,9 @@ extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim); extern void r300EmitCacheFlush(r300ContextPtr rmesa); -extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); -extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); -extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes); -extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes); +extern GLuint r300VAPInputCntl0(struct gl_context * ctx, GLuint InputsRead); +extern GLuint r300VAPInputCntl1(struct gl_context * ctx, GLuint InputsRead); +extern GLuint r300VAPOutputCntl0(struct gl_context * ctx, GLuint vp_writes); +extern GLuint r300VAPOutputCntl1(struct gl_context * ctx, GLuint vp_writes); #endif diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 4af91f114d..4e457b51eb 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -208,7 +208,7 @@ static void allocate_hw_inputs( } -static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_program_cont *cont, struct r300_fragment_program *fp) +static void translate_fragment_program(struct gl_context *ctx, struct r300_fragment_program_cont *cont, struct r300_fragment_program *fp) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_fragment_program_compiler compiler; @@ -278,7 +278,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog rc_destroy(&compiler.Base); } -struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ctx) +struct r300_fragment_program *r300SelectAndTranslateFragmentShader(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_fragment_program_cont *fp_list; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.h b/src/mesa/drivers/dri/r300/r300_fragprog_common.h index 3d64c08cee..cfa5acf433 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.h @@ -32,6 +32,6 @@ #include "r300_context.h" -struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ctx); +struct r300_fragment_program *r300SelectAndTranslateFragmentShader(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index cf89ab7ec3..821318e7a5 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -321,7 +321,7 @@ static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type) END_BATCH(); } -void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) +void r300RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim) { r300ContextPtr rmesa = R300_CONTEXT(ctx); BATCH_LOCALS(&rmesa->radeon); @@ -444,7 +444,7 @@ static const char *getFallbackString(r300ContextPtr rmesa, uint32_t bit) } } -void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) +void r300SwitchFallback(struct gl_context *ctx, uint32_t bit, GLboolean mode) { TNLcontext *tnl = TNL_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h index 581e9fa0cc..5a78592c75 100644 --- a/src/mesa/drivers/dri/r300/r300_render.h +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -63,8 +63,8 @@ extern const struct tnl_pipeline_stage _r300_render_stage; -extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode); +extern void r300SwitchFallback(struct gl_context *ctx, uint32_t bit, GLboolean mode); -extern void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim); +extern void r300RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim); #endif diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index a9bddf0577..f2bbac5b85 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -32,7 +32,7 @@ #include "r300_context.h" #include "r300_fragprog_common.h" -static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont *cache) +static void freeFragProgCache(struct gl_context *ctx, struct r300_fragment_program_cont *cache) { struct r300_fragment_program *tmp, *fp = cache->progs; @@ -44,7 +44,7 @@ static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont } } -static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *cache) +static void freeVertProgCache(struct gl_context *ctx, struct r300_vertex_program_cont *cache) { struct r300_vertex_program *tmp, *vp = cache->progs; @@ -57,7 +57,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *c } } -static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, +static struct gl_program *r300NewProgram(struct gl_context * ctx, GLenum target, GLuint id) { struct r300_vertex_program_cont *vp; @@ -81,7 +81,7 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, return NULL; } -static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) +static void r300DeleteProgram(struct gl_context * ctx, struct gl_program *prog) { struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog; struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog; @@ -99,7 +99,7 @@ static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) } static GLboolean -r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +r300ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog; struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog; @@ -123,7 +123,7 @@ r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) } static GLboolean -r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +r300IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { struct r300_fragment_program *fp = r300SelectAndTranslateFragmentShader(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index bacb8f5e3a..ab8c1df5f7 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -62,7 +62,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_render.h" #include "r300_vertprog.h" -static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) +static void r300BlendColor(struct gl_context * ctx, const GLfloat cf[4]) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -204,7 +204,7 @@ static void r300SetBlendCntl(r300ContextPtr r300, int func, int eqn, } } -static void r300SetBlendState(GLcontext * ctx) +static void r300SetBlendState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); int func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | @@ -302,13 +302,13 @@ static void r300SetBlendState(GLcontext * ctx) R300_ALPHA_BLEND_ENABLE), funcA, eqnA); } -static void r300BlendEquationSeparate(GLcontext * ctx, +static void r300BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) { r300SetBlendState(ctx); } -static void r300BlendFuncSeparate(GLcontext * ctx, +static void r300BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { @@ -331,7 +331,7 @@ static GLuint translate_logicop(GLenum logicop) * Used internally to update the r300->hw hardware state to match the * current OpenGL state. */ -static void r300SetLogicOpState(GLcontext *ctx) +static void r300SetLogicOpState(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); R300_STATECHANGE(r300, rop); @@ -347,13 +347,13 @@ static void r300SetLogicOpState(GLcontext *ctx) * Called by Mesa when an application program changes the LogicOp state * via glLogicOp. */ -static void r300LogicOpcode(GLcontext *ctx, GLenum logicop) +static void r300LogicOpcode(struct gl_context *ctx, GLenum logicop) { if (RGBA_LOGICOP_ENABLED(ctx)) r300SetLogicOpState(ctx); } -static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void r300ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLint p; @@ -373,7 +373,7 @@ static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) rmesa->hw.vpucp[p].cmd[R300_VPUCP_W] = ip[3]; } -static void r300SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) +static void r300SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLuint p; @@ -395,7 +395,7 @@ static void r300SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) /** * Update our tracked culling state based on Mesa's state. */ -static void r300UpdateCulling(GLcontext * ctx) +static void r300UpdateCulling(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t val = 0; @@ -435,7 +435,7 @@ static void r300UpdateCulling(GLcontext * ctx) r300->hw.cul.cmd[R300_CUL_CULL] = val; } -static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) +static void r300SetPolygonOffsetState(struct gl_context * ctx, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -447,14 +447,14 @@ static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) } } -static GLboolean current_fragment_program_writes_depth(GLcontext* ctx) +static GLboolean current_fragment_program_writes_depth(struct gl_context* ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); return ctx->FragmentProgram._Current && r300->selected_fp->code.writes_depth; } -static void r300SetEarlyZState(GLcontext * ctx) +static void r300SetEarlyZState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLuint topZ = R300_ZTOP_ENABLE; @@ -499,7 +499,7 @@ static void r300SetEarlyZState(GLcontext * ctx) } } -static void r300SetAlphaState(GLcontext * ctx) +static void r300SetAlphaState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLubyte refByte; @@ -549,7 +549,7 @@ static void r300SetAlphaState(GLcontext * ctx) r300->hw.at.cmd[R300_AT_UNKNOWN] = 0; } -static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) +static void r300AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) { (void)func; (void)ref; @@ -579,7 +579,7 @@ static int translate_func(int func) return 0; } -static void r300SetDepthState(GLcontext * ctx) +static void r300SetDepthState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -598,7 +598,7 @@ static void r300SetDepthState(GLcontext * ctx) } } -static void r300CatchStencilFallback(GLcontext *ctx) +static void r300CatchStencilFallback(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); const unsigned back = ctx->Stencil._BackFace; @@ -616,7 +616,7 @@ static void r300CatchStencilFallback(GLcontext *ctx) } } -static void r300SetStencilState(GLcontext * ctx, GLboolean state) +static void r300SetStencilState(struct gl_context * ctx, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLboolean hw_stencil = GL_FALSE; @@ -641,7 +641,7 @@ static void r300SetStencilState(GLcontext * ctx, GLboolean state) } } -static void r300UpdatePolygonMode(GLcontext * ctx) +static void r300UpdatePolygonMode(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t hw_mode = R300_GA_POLY_MODE_DISABLE; @@ -704,7 +704,7 @@ static void r300UpdatePolygonMode(GLcontext * ctx) * * \note Mesa already filters redundant calls to this function. */ -static void r300CullFace(GLcontext * ctx, GLenum mode) +static void r300CullFace(struct gl_context * ctx, GLenum mode) { (void)mode; @@ -716,7 +716,7 @@ static void r300CullFace(GLcontext * ctx, GLenum mode) * * \note Mesa already filters redundant calls to this function. */ -static void r300FrontFace(GLcontext * ctx, GLenum mode) +static void r300FrontFace(struct gl_context * ctx, GLenum mode) { (void)mode; @@ -729,7 +729,7 @@ static void r300FrontFace(GLcontext * ctx, GLenum mode) * * \note Mesa already filters redundant calls to this function. */ -static void r300DepthFunc(GLcontext * ctx, GLenum func) +static void r300DepthFunc(struct gl_context * ctx, GLenum func) { (void)func; r300SetDepthState(ctx); @@ -740,7 +740,7 @@ static void r300DepthFunc(GLcontext * ctx, GLenum func) * * \note Mesa already filters redundant calls to this function. */ -static void r300DepthMask(GLcontext * ctx, GLboolean mask) +static void r300DepthMask(struct gl_context * ctx, GLboolean mask) { (void)mask; r300SetDepthState(ctx); @@ -749,7 +749,7 @@ static void r300DepthMask(GLcontext * ctx, GLboolean mask) /** * Handle glColorMask() */ -static void r300ColorMask(GLcontext * ctx, +static void r300ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -767,7 +767,7 @@ static void r300ColorMask(GLcontext * ctx, /* ============================================================= * Point state */ -static void r300PointSize(GLcontext * ctx, GLfloat size) +static void r300PointSize(struct gl_context * ctx, GLfloat size) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -784,7 +784,7 @@ static void r300PointSize(GLcontext * ctx, GLfloat size) ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT); } -static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) +static void r300PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -814,7 +814,7 @@ static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa /* ============================================================= * Line state */ -static void r300LineWidth(GLcontext * ctx, GLfloat widthf) +static void r300LineWidth(struct gl_context * ctx, GLfloat widthf) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -826,7 +826,7 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf) R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0); } -static void r300PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) +static void r300PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) { (void)face; (void)mode; @@ -864,7 +864,7 @@ static int translate_stencil_op(int op) return 0; } -static void r300ShadeModel(GLcontext * ctx, GLenum mode) +static void r300ShadeModel(struct gl_context * ctx, GLenum mode) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -885,7 +885,7 @@ static void r300ShadeModel(GLcontext * ctx, GLenum mode) rmesa->hw.shade2.cmd[3] = 0x00000000; } -static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, +static void r300StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -932,7 +932,7 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, } } -static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) +static void r300StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); const unsigned back = ctx->Stencil._BackFace; @@ -956,7 +956,7 @@ static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) } } -static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, +static void r300StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -992,7 +992,7 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, * Window position and viewport transformation */ -static void r300UpdateWindow(GLcontext * ctx) +static void r300UpdateWindow(struct gl_context * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1028,7 +1028,7 @@ static void r300UpdateWindow(GLcontext * ctx) rmesa->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(tz); } -static void r300Viewport(GLcontext * ctx, GLint x, GLint y, +static void r300Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { /* Don't pipeline viewport changes, conflict with window offset @@ -1040,12 +1040,12 @@ static void r300Viewport(GLcontext * ctx, GLint x, GLint y, radeon_viewport(ctx, x, y, width, height); } -static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +static void r300DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) { r300UpdateWindow(ctx); } -void r300UpdateViewportOffset(GLcontext * ctx) +void r300UpdateViewportOffset(struct gl_context * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1074,7 +1074,7 @@ void r300UpdateViewportOffset(GLcontext * ctx) * Update R300's own internal state parameters. * For now just STATE_R300_WINDOW_DIMENSION */ -static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) +static void r300UpdateStateParameters(struct gl_context * ctx, GLuint new_state) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct gl_program_parameter_list *paramList; @@ -1096,7 +1096,7 @@ static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) /* ============================================================= * Polygon state */ -static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) +static void r300PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLfloat constant = units; @@ -1193,7 +1193,7 @@ static unsigned long gen_fixed_filter(unsigned long f) return f; } -static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) +static void r300SetupFragmentShaderTextures(struct gl_context *ctx, int *tmu_mappings) { r300ContextPtr r300 = R300_CONTEXT(ctx); int i; @@ -1235,7 +1235,7 @@ static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) R300_US_TEX_INST_0, code->tex.length); } -static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) +static void r500SetupFragmentShaderTextures(struct gl_context *ctx, int *tmu_mappings) { r300ContextPtr r300 = R300_CONTEXT(ctx); int i; @@ -1280,7 +1280,7 @@ static GLuint translate_lod_bias(GLfloat bias) } -static void r300SetupTextures(GLcontext * ctx) +static void r300SetupTextures(struct gl_context * ctx) { int i, mtu; struct radeon_tex_obj *t; @@ -1427,7 +1427,7 @@ union r300_outputs_written { ((hw_tcl_on) ? (ow).vp_outputs & (1 << (vp_result)) : \ RENDERINPUTS_TEST( (ow.index_bitset), (tnl_attrib) )) -static void r300SetupRSUnit(GLcontext * ctx) +static void r300SetupRSUnit(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); union r300_outputs_written OutputsWritten; @@ -1521,7 +1521,7 @@ static void r300SetupRSUnit(GLcontext * ctx) WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); } -static void r500SetupRSUnit(GLcontext * ctx) +static void r500SetupRSUnit(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); union r300_outputs_written OutputsWritten; @@ -1681,7 +1681,7 @@ void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, * * \note Mesa already filters redundant calls to this function. */ -static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) +static void r300Enable(struct gl_context * ctx, GLenum cap, GLboolean state) { r300ContextPtr rmesa = R300_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_STATE) @@ -1756,7 +1756,7 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) */ static void r300ResetHwState(r300ContextPtr r300) { - GLcontext *ctx = r300->radeon.glCtx; + struct gl_context *ctx = r300->radeon.glCtx; int has_tcl; has_tcl = r300->options.hw_tcl_enabled; @@ -1965,7 +1965,7 @@ static void r300ResetHwState(r300ContextPtr r300) void r300UpdateShaders(r300ContextPtr rmesa) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; /* should only happenen once, just after context is created */ /* TODO: shouldn't we fallback to sw here? */ @@ -1994,7 +1994,7 @@ void r300UpdateShaders(r300ContextPtr rmesa) rmesa->radeon.NewGLState = 0; } -static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, GLuint index, GLfloat * buffer) +static const GLfloat *get_fragmentprogram_constant(struct gl_context *ctx, GLuint index, GLfloat * buffer) { static const GLfloat dummy[4] = { 0, 0, 0, 0 }; r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -2052,7 +2052,7 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, GLuint index, } -static void r300SetupPixelShader(GLcontext *ctx) +static void r300SetupPixelShader(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = rmesa->selected_fp; @@ -2109,7 +2109,7 @@ static void r300SetupPixelShader(GLcontext *ctx) if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ } while(0) -static void r500SetupPixelShader(GLcontext *ctx) +static void r500SetupPixelShader(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = rmesa->selected_fp; @@ -2158,7 +2158,7 @@ static void r500SetupPixelShader(GLcontext *ctx) bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, fp->code.constants.Count * 4); } -void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) +void r300SetupVAP(struct gl_context *ctx, GLuint InputsRead, GLuint OutputsWritten) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); struct vertex_attribute *attrs = rmesa->vbuf.attribs; @@ -2218,7 +2218,7 @@ void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) void r300UpdateShaderStates(r300ContextPtr rmesa) { - GLcontext *ctx; + struct gl_context *ctx; ctx = rmesa->radeon.glCtx; /* should only happenen once, just after context is created */ @@ -2241,7 +2241,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) #define EASY_US_OUT_FMT(comps, c0, c1, c2, c3) \ (R500_OUT_FMT_##comps | R500_C0_SEL_##c0 | R500_C1_SEL_##c1 | \ R500_C2_SEL_##c2 | R500_C3_SEL_##c3) -static void r300SetupUsOutputFormat(GLcontext *ctx) +static void r300SetupUsOutputFormat(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); uint32_t hw_format; @@ -2304,7 +2304,7 @@ static void r300SetupUsOutputFormat(GLcontext *ctx) /** * Called by Mesa after an internal state update. */ -static void r300InvalidateState(GLcontext * ctx, GLuint new_state) +static void r300InvalidateState(struct gl_context * ctx, GLuint new_state) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -2347,7 +2347,7 @@ void r300InitState(r300ContextPtr r300) r300ResetHwState(r300); } -static void r300RenderMode(GLcontext * ctx, GLenum mode) +static void r300RenderMode(struct gl_context * ctx, GLenum mode) { r300SwitchFallback(ctx, R300_FALLBACK_RENDER_MODE, ctx->RenderMode != GL_RENDER); } diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index e70f84f4e4..e3b0da4cbd 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -50,13 +50,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. r300->radeon.hw.is_dirty = GL_TRUE; \ } while(0) -void r300UpdateViewportOffset (GLcontext * ctx); -void r300UpdateDrawBuffer (GLcontext * ctx); +void r300UpdateViewportOffset (struct gl_context * ctx); +void r300UpdateDrawBuffer (struct gl_context * ctx); void r300UpdateShaders (r300ContextPtr rmesa); void r300UpdateShaderStates (r300ContextPtr rmesa); void r300InitState (r300ContextPtr r300); void r300InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count); -void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten); +void r300SetupVAP(struct gl_context *ctx, GLuint InputsRead, GLuint OutputsWritten); #endif /* __R300_STATE_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 4dcc7cb022..4a6762ff83 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -68,7 +68,7 @@ do { \ ++num_attrs; \ } while (0) -void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten) +void r300ChooseSwtclVertexFormat(struct gl_context *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -226,7 +226,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset); } -static void r300PrepareVertices(GLcontext *ctx) +static void r300PrepareVertices(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint InputsRead, OutputsWritten; @@ -285,7 +285,7 @@ static GLuint reduced_prim[] = { GL_TRIANGLES, }; -static void r300RasterPrimitive( GLcontext *ctx, GLuint prim ); +static void r300RasterPrimitive( struct gl_context *ctx, GLuint prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -497,7 +497,7 @@ static void init_rast_tab( void ) /**********************************************************************/ /* Choose render functions */ /**********************************************************************/ -static void r300ChooseRenderState( GLcontext *ctx ) +static void r300ChooseRenderState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -528,7 +528,7 @@ static void r300ChooseRenderState( GLcontext *ctx ) } } -void r300RenderStart(GLcontext *ctx) +void r300RenderStart(struct gl_context *ctx) { radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, "%s\n", __func__); r300ContextPtr rmesa = R300_CONTEXT( ctx ); @@ -550,11 +550,11 @@ void r300RenderStart(GLcontext *ctx) } } -void r300RenderFinish(GLcontext *ctx) +void r300RenderFinish(struct gl_context *ctx) { } -static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void r300RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r300ContextPtr rmesa = R300_CONTEXT(ctx); radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__); @@ -565,7 +565,7 @@ static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -void r300RenderPrimitive(GLcontext *ctx, GLenum prim) +void r300RenderPrimitive(struct gl_context *ctx, GLenum prim) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -578,13 +578,13 @@ void r300RenderPrimitive(GLcontext *ctx, GLenum prim) r300RasterPrimitive( ctx, reduced_prim[prim] ); } -void r300ResetLineStipple(GLcontext *ctx) +void r300ResetLineStipple(struct gl_context *ctx) { if (RADEON_DEBUG & RADEON_VERTS) fprintf(stderr, "%s\n", __func__); } -void r300InitSwtcl(GLcontext *ctx) +void r300InitSwtcl(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -620,7 +620,7 @@ void r300InitSwtcl(GLcontext *ctx) _tnl_need_projected_coords( ctx, GL_FALSE ); } -void r300DestroySwtcl(GLcontext *ctx) +void r300DestroySwtcl(struct gl_context *ctx) { } @@ -656,7 +656,7 @@ static void r300EmitVbufPrim(r300ContextPtr rmesa, GLuint primitive, GLuint vert END_BATCH(); } -void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset) +void r300_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__); r300ContextPtr rmesa = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index c271d26546..51cfffc2af 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -50,16 +50,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SWTCL_OVM_TEX(n) ((n) + 6) #define SWTCL_OVM_POINT_SIZE 15 -extern void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *InputsRead, GLuint *OutputsWritten); +extern void r300ChooseSwtclVertexFormat(struct gl_context *ctx, GLuint *InputsRead, GLuint *OutputsWritten); -extern void r300InitSwtcl( GLcontext *ctx ); -extern void r300DestroySwtcl( GLcontext *ctx ); +extern void r300InitSwtcl( struct gl_context *ctx ); +extern void r300DestroySwtcl( struct gl_context *ctx ); -extern void r300RenderStart(GLcontext *ctx); -extern void r300RenderFinish(GLcontext *ctx); -extern void r300RenderPrimitive(GLcontext *ctx, GLenum prim); -extern void r300ResetLineStipple(GLcontext *ctx); +extern void r300RenderStart(struct gl_context *ctx); +extern void r300RenderFinish(struct gl_context *ctx); +extern void r300RenderPrimitive(struct gl_context *ctx, GLenum prim); +extern void r300ResetLineStipple(struct gl_context *ctx); -extern void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset); +extern void r300_swtcl_flush(struct gl_context *ctx, uint32_t current_offset); #endif diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index baef206bc2..a6bda0e499 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -185,7 +185,7 @@ static void r300SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) * next UpdateTextureState */ -static void r300TexParameter(GLcontext * ctx, GLenum target, +static void r300TexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat * params) { @@ -243,7 +243,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, } } -static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void r300DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); @@ -284,7 +284,7 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) * allocate the default texture objects. * Fixup MaxAnisotropy according to user preference. */ -static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx, +static struct gl_texture_object *r300NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h index aca44cd766..c44a39cb46 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.h +++ b/src/mesa/drivers/dri/r300/r300_tex.h @@ -47,7 +47,7 @@ extern void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); -extern GLboolean r300ValidateBuffers(GLcontext * ctx); +extern GLboolean r300ValidateBuffers(struct gl_context * ctx); extern void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 9458869826..0116c5d2fa 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -301,7 +301,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) * * Mostly this means populating the texture object's mipmap tree. */ -static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj) +static GLboolean r300_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -320,7 +320,7 @@ static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object /** * Ensure all enabled and complete textures are uploaded along with any buffers being used. */ -GLboolean r300ValidateBuffers(GLcontext * ctx) +GLboolean r300ValidateBuffers(struct gl_context * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index a160128091..1daa305e3c 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -49,7 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Write parameter array for the given vertex program into dst. * Return the total number of components written. */ -static int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program *vp, float *dst) +static int r300VertexProgUpdateParams(struct gl_context * ctx, struct r300_vertex_program *vp, float *dst) { int i; @@ -227,7 +227,7 @@ static void initialize_NV_registers(struct radeon_compiler * compiler) inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_0000; } -static struct r300_vertex_program *build_program(GLcontext *ctx, +static struct r300_vertex_program *build_program(struct gl_context *ctx, struct r300_vertex_program_key *wanted_key, const struct gl_vertex_program *mesa_vp) { @@ -307,7 +307,7 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, return vp; } -struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx) +struct r300_vertex_program * r300SelectAndTranslateVertexShader(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_program_key wanted_key = { 0 }; @@ -386,7 +386,7 @@ static void r300EmitVertexProgram(r300ContextPtr r300, int dest, struct r300_ver void r300SetupVertexProgram(r300ContextPtr rmesa) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; struct r300_vertex_program *prog = rmesa->selected_vp; int inst_count = 0; int param_count = 0; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index ccec896be4..ce24dcb353 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -6,6 +6,6 @@ void r300SetupVertexProgram(r300ContextPtr rmesa); -struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx); +struct r300_vertex_program * r300SelectAndTranslateVertexShader(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h index e793656dbe..52b7fb91e6 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.h +++ b/src/mesa/drivers/dri/r300/radeon_context.h @@ -52,7 +52,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__); /* TCL fallbacks */ -extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode); +extern void radeonTclFallback(struct gl_context * ctx, GLuint bit, GLboolean mode); #define TCL_FALLBACK( ctx, bit, mode ) ; diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.c b/src/mesa/drivers/dri/r600/evergreen_blit.c index 1ed8a08b78..fc9fa9d22c 100644 --- a/src/mesa/drivers/dri/r600/evergreen_blit.c +++ b/src/mesa/drivers/dri/r600/evergreen_blit.c @@ -423,7 +423,7 @@ eg_set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_fo } -static inline void eg_load_shaders(GLcontext * ctx) +static inline void eg_load_shaders(struct gl_context * ctx) { radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); @@ -1688,7 +1688,7 @@ static GLboolean eg_validate_buffers(context_t *rmesa, return GL_TRUE; } -unsigned evergreen_blit(GLcontext *ctx, +unsigned evergreen_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.h b/src/mesa/drivers/dri/r600/evergreen_blit.h index 68d072ecb0..783f83f089 100644 --- a/src/mesa/drivers/dri/r600/evergreen_blit.h +++ b/src/mesa/drivers/dri/r600/evergreen_blit.h @@ -30,7 +30,7 @@ unsigned evergreen_check_blit(gl_format mesa_format); -unsigned evergreen_blit(GLcontext *ctx, +unsigned evergreen_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index 770e7f91c6..2c9e4e2b84 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -60,7 +60,7 @@ do { \ insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \ } while (0) -static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -74,7 +74,7 @@ static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static void evergreenSendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -114,12 +114,12 @@ static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ) } -static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; } -static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendTexState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -221,7 +221,7 @@ static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom } } -static int check_evergreen_tx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_evergreen_tx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); unsigned int i, count = 0; @@ -238,7 +238,7 @@ static int check_evergreen_tx(GLcontext *ctx, struct radeon_state_atom *atom) return count * 37 + 6; } -static void evergreenSendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -269,7 +269,7 @@ static void evergreenSendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom } extern int evergreen_getTypeSize(GLenum type); -static void evergreenSetupVTXConstants(GLcontext * ctx, +static void evergreenSetupVTXConstants(struct gl_context * ctx, void * pAos, StreamDesc * pStreamDesc) { @@ -357,7 +357,7 @@ static void evergreenSetupVTXConstants(GLcontext * ctx, COMMIT_BATCH(); } -static int check_evergreen_vtx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_evergreen_vtx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); int count = context->radeon.tcl.aos_count * 12; @@ -369,7 +369,7 @@ static int check_evergreen_vtx(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendVTX(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *)(context->selected_vp); @@ -390,7 +390,7 @@ static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) } } } -static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendPA(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -511,7 +511,7 @@ static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendTP(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendTP(struct gl_context *ctx, struct radeon_state_atom *atom) { /* context_t *context = EVERGREEN_CONTEXT(ctx); @@ -523,7 +523,7 @@ static void evergreenSendTP(GLcontext *ctx, struct radeon_state_atom *atom) */ } -static void evergreenSendPSresource(GLcontext *ctx) +static void evergreenSendPSresource(struct gl_context *ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -578,7 +578,7 @@ static void evergreenSendPSresource(GLcontext *ctx) COMMIT_BATCH(); } -static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendVSresource(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -634,7 +634,7 @@ static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *at COMMIT_BATCH(); } -static void evergreenSendSQ(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSQ(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -749,7 +749,7 @@ static void evergreenSendSQ(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendSPI(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSPI(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -821,7 +821,7 @@ static void evergreenSendSPI(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendSX(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSX(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -897,7 +897,7 @@ static void evergreenSetDepthTarget(context_t *context) } -static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendDB(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1366,7 +1366,7 @@ static void evergreenSetRenderTarget(context_t *context, int id) evergreen->render_target[id].enabled = GL_TRUE; } -static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendCB(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1451,7 +1451,7 @@ static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendVGT(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendVGT(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); diff --git a/src/mesa/drivers/dri/r600/evergreen_context.c b/src/mesa/drivers/dri/r600/evergreen_context.c index fff7c20031..911775f590 100644 --- a/src/mesa/drivers/dri/r600/evergreen_context.c +++ b/src/mesa/drivers/dri/r600/evergreen_context.c @@ -61,7 +61,7 @@ static void evergreen_vtbl_pre_emit_atoms(radeonContextPtr radeon) r700Start3D((context_t *)radeon); } -static void evergreen_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +static void evergreen_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) { context_t *context = EVERGREEN_CONTEXT(ctx); if (mode) diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 0e7edf4fbe..cfb923efdd 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -44,7 +44,7 @@ #include "evergreen_vertprog.h" #include "evergreen_fragprog.h" -void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) +void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog) { static const gl_state_index winstate[STATE_LENGTH] = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0}; @@ -95,7 +95,7 @@ void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fpro //TODO : Validate FP input with VP output. void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { unsigned int unBit; unsigned int i; @@ -354,7 +354,7 @@ GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_p GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { GLuint number_of_colors_exported; GLboolean z_enabled = GL_FALSE; @@ -457,7 +457,7 @@ GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp return GL_TRUE; } -void evergreenSelectFragmentShader(GLcontext *ctx) +void evergreenSelectFragmentShader(struct gl_context *ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) @@ -471,7 +471,7 @@ void evergreenSelectFragmentShader(GLcontext *ctx) evergreenTranslateFragmentShader(fp, &(fp->mesa_program), ctx); } -void * evergreenGetActiveFpShaderBo(GLcontext * ctx) +void * evergreenGetActiveFpShaderBo(struct gl_context * ctx) { struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) (ctx->FragmentProgram._Current); @@ -479,7 +479,7 @@ void * evergreenGetActiveFpShaderBo(GLcontext * ctx) return fp->shaderbo; } -void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx) +void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx) { struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) (ctx->FragmentProgram._Current); @@ -487,7 +487,7 @@ void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx) return fp->constbo0; } -GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) +GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -737,7 +737,7 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) return GL_TRUE; } -GLboolean evergreenSetupFPconstants(GLcontext * ctx) +GLboolean evergreenSetupFPconstants(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.h b/src/mesa/drivers/dri/r600/evergreen_fragprog.h index 0e200bf383..97f06a75fc 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.h @@ -51,27 +51,27 @@ struct evergreen_fragment_program }; /* Internal */ -void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog); +void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog); void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx); + struct gl_context *ctx); GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp, struct gl_fragment_program *mesa_fp); GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, struct gl_fragment_program *mesa_vp, - GLcontext *ctx); + struct gl_context *ctx); /* Interface */ -extern void evergreenSelectFragmentShader(GLcontext *ctx); +extern void evergreenSelectFragmentShader(struct gl_context *ctx); -extern GLboolean evergreenSetupFragmentProgram(GLcontext * ctx); +extern GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx); -extern GLboolean evergreenSetupFPconstants(GLcontext * ctx); +extern GLboolean evergreenSetupFPconstants(struct gl_context * ctx); -extern void * evergreenGetActiveFpShaderBo(GLcontext * ctx); +extern void * evergreenGetActiveFpShaderBo(struct gl_context * ctx); -extern void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx); +extern void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx); #endif /*_EVERGREEN_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.c b/src/mesa/drivers/dri/r600/evergreen_ioctl.c index 5c1270790d..19f8e6b3ec 100644 --- a/src/mesa/drivers/dri/r600/evergreen_ioctl.c +++ b/src/mesa/drivers/dri/r600/evergreen_ioctl.c @@ -40,7 +40,7 @@ #include "r700_clear.h" -void evergreenClear(GLcontext * ctx, GLbitfield mask) +void evergreenClear(struct gl_context * ctx, GLbitfield mask) { r700Clear(ctx, mask); } diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.h b/src/mesa/drivers/dri/r600/evergreen_ioctl.h index 3c663a7083..a41b5b6033 100644 --- a/src/mesa/drivers/dri/r600/evergreen_ioctl.h +++ b/src/mesa/drivers/dri/r600/evergreen_ioctl.h @@ -30,7 +30,7 @@ #include "r600_context.h" #include "radeon_drm.h" -extern void evergreenClear(GLcontext * ctx, GLbitfield mask); +extern void evergreenClear(struct gl_context * ctx, GLbitfield mask); extern void evergreenInitIoctlFuncs(struct dd_function_table *functions); #endif /* _EVERGREEN_IOCTL_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_oglprog.c b/src/mesa/drivers/dri/r600/evergreen_oglprog.c index 9fe523234c..a2a361f32e 100644 --- a/src/mesa/drivers/dri/r600/evergreen_oglprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_oglprog.c @@ -40,7 +40,7 @@ #include "evergreen_vertprog.h" -static void evergreen_freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +static void evergreen_freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache) { struct evergreen_vertex_program *tmp, *vp = cache->progs; @@ -64,7 +64,7 @@ static void evergreen_freeVertProgCache(GLcontext *ctx, struct r700_vertex_progr } } -static struct gl_program *evergreenNewProgram(GLcontext * ctx, +static struct gl_program *evergreenNewProgram(struct gl_context * ctx, GLenum target, GLuint id) { @@ -109,7 +109,7 @@ static struct gl_program *evergreenNewProgram(GLcontext * ctx, return pProgram; } -static void evergreenDeleteProgram(GLcontext * ctx, struct gl_program *prog) +static void evergreenDeleteProgram(struct gl_context * ctx, struct gl_program *prog) { struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; struct evergreen_fragment_program * fp; @@ -147,7 +147,7 @@ static void evergreenDeleteProgram(GLcontext * ctx, struct gl_program *prog) } static GLboolean -evergreenProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +evergreenProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; struct evergreen_fragment_program * fp = (struct evergreen_fragment_program*)prog; @@ -178,7 +178,7 @@ evergreenProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program * return GL_TRUE; } -static GLboolean evergreenIsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +static GLboolean evergreenIsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { return GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 27089bfcf7..0c0eeca1fc 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -148,7 +148,7 @@ 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, +static void evergreenRunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim, GLint basevertex) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -219,7 +219,7 @@ static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int COMMIT_BATCH(); } -static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) //same +static void evergreenRunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) //same { context_t *context = EVERGREEN_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); @@ -363,7 +363,7 @@ static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int * Convert attribute data type to float * If the attribute uses named buffer object replace the bo with newly allocated bo */ -static void evergreenConvertAttrib(GLcontext *ctx, int count, +static void evergreenConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct StreamDesc *attr) { @@ -442,7 +442,7 @@ static void evergreenConvertAttrib(GLcontext *ctx, int count, } } -static void evergreenFixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void evergreenFixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = EVERGREEN_CONTEXT(ctx); GLvoid *src_ptr; @@ -517,7 +517,7 @@ static void evergreenFixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_b } } -static GLboolean evergreen_check_fallbacks(GLcontext *ctx) //same +static GLboolean evergreen_check_fallbacks(struct gl_context *ctx) //same { if (ctx->RenderMode != GL_RENDER) return GL_TRUE; @@ -528,7 +528,7 @@ static GLboolean evergreen_check_fallbacks(GLcontext *ctx) //same /* start 3d, idle, cb/db flush */ #define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 -static GLuint evergreenPredictRenderSize(GLcontext* ctx, +static GLuint evergreenPredictRenderSize(struct gl_context* ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint nr_prims) @@ -567,7 +567,7 @@ static GLuint evergreenPredictRenderSize(GLcontext* ctx, } -static void evergreenSetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void evergreenSetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -620,7 +620,7 @@ static void evergreenSetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_b } } -static void evergreenAlignDataToDword(GLcontext *ctx, +static void evergreenAlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct StreamDesc *attr) @@ -662,7 +662,7 @@ static void evergreenAlignDataToDword(GLcontext *ctx, attr->stride = dst_stride; } -static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) { context_t *context = EVERGREEN_CONTEXT(ctx); GLuint stride; @@ -763,7 +763,7 @@ static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array * RADEON_GEM_DOMAIN_GTT, 0); } -static void evergreenFreeData(GLcontext *ctx) +static void evergreenFreeData(struct gl_context *ctx) { /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo * to prevent double unref in radeonReleaseArrays @@ -799,7 +799,7 @@ static void evergreenFreeData(GLcontext *ctx) } } -static GLboolean evergreenTryDrawPrims(GLcontext *ctx, +static GLboolean evergreenTryDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -898,7 +898,7 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void evergreenDrawPrims(GLcontext *ctx, +static void evergreenDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -932,7 +932,7 @@ static void evergreenDrawPrims(GLcontext *ctx, } } -void evergreenInitDraw(GLcontext *ctx) +void evergreenInitDraw(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c index 69c5ab656e..a77be183a1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.c +++ b/src/mesa/drivers/dri/r600/evergreen_state.c @@ -53,9 +53,9 @@ #include "evergreen_fragprog.h" #include "evergreen_tex.h" -void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); //same +void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); //same -void evergreenUpdateShaders(GLcontext * ctx) +void evergreenUpdateShaders(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -73,7 +73,7 @@ void evergreenUpdateShaders(GLcontext * ctx) context->radeon.NewGLState = 0; } -void evergreeUpdateShaders(GLcontext * ctx) +void evergreeUpdateShaders(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -94,7 +94,7 @@ void evergreeUpdateShaders(GLcontext * ctx) /* * To correctly position primitives: */ -void evergreenUpdateViewportOffset(GLcontext * ctx) //------------------ +void evergreenUpdateViewportOffset(struct gl_context * ctx) //------------------ { context_t *context = R700_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -120,7 +120,7 @@ void evergreenUpdateViewportOffset(GLcontext * ctx) //------------------ radeonUpdateScissor(ctx); } -void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state) //same +void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state) //same { struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *)ctx->FragmentProgram._Current; @@ -144,7 +144,7 @@ void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state) //same /** * Called by Mesa after an internal state update. */ -static void evergreenInvalidateState(GLcontext * ctx, GLuint new_state) //same +static void evergreenInvalidateState(struct gl_context * ctx, GLuint new_state) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -212,7 +212,7 @@ static void evergreenInvalidateState(GLcontext * ctx, GLuint new_state) //same context->radeon.NewGLState |= new_state; } -static void evergreenSetAlphaState(GLcontext * ctx) //same +static void evergreenSetAlphaState(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -259,14 +259,14 @@ static void evergreenSetAlphaState(GLcontext * ctx) //same } } -static void evergreenAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //same +static void evergreenAlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //same { (void)func; (void)ref; evergreenSetAlphaState(ctx); } -static void evergreenBlendColor(GLcontext * ctx, const GLfloat cf[4]) //same +static void evergreenBlendColor(struct gl_context * ctx, const GLfloat cf[4]) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -334,7 +334,7 @@ static int evergreenblend_factor(GLenum factor, GLboolean is_src) //same } } -static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits +static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -459,13 +459,13 @@ static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, C evergreen->CB_BLEND0_CONTROL.u32All = blend_reg; } -static void evergreenBlendEquationSeparate(GLcontext * ctx, +static void evergreenBlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) //same { evergreenSetBlendState(ctx); } -static void evergreenBlendFuncSeparate(GLcontext * ctx, +static void evergreenBlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) //same { @@ -513,7 +513,7 @@ static GLuint evergreen_translate_logicop(GLenum logicop) //same } } -static void evergreenSetLogicOpState(GLcontext *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits. +static void evergreenSetLogicOpState(struct gl_context *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits. { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -531,7 +531,7 @@ static void evergreenSetLogicOpState(GLcontext *ctx) //diff : CB_COLOR_CONTROL.R EG_CB_COLOR_CONTROL__ROP3_mask); } -static void evergreenClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff +static void evergreenClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -549,7 +549,7 @@ static void evergreenClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq evergreen->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; } -static void evergreenSetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls +static void evergreenSetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -569,7 +569,7 @@ static void evergreenSetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean st } } -static void evergreenSetDBRenderState(GLcontext * ctx) +static void evergreenSetDBRenderState(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -629,13 +629,13 @@ static void evergreenSetDBRenderState(GLcontext * ctx) } } -void evergreenUpdateShaderStates(GLcontext * ctx) +void evergreenUpdateShaderStates(struct gl_context * ctx) { evergreenSetDBRenderState(ctx); evergreenUpdateTextureState(ctx); } -static void evergreenSetDepthState(GLcontext * ctx) //same +static void evergreenSetDepthState(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -701,7 +701,7 @@ static void evergreenSetDepthState(GLcontext * ctx) //same } } -static void evergreenSetStencilState(GLcontext * ctx, GLboolean state) //same +static void evergreenSetStencilState(struct gl_context * ctx, GLboolean state) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -724,7 +724,7 @@ static void evergreenSetStencilState(GLcontext * ctx, GLboolean state) //same } } -static void evergreenUpdateCulling(GLcontext * ctx) //same +static void evergreenUpdateCulling(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -776,7 +776,7 @@ static void evergreenUpdateCulling(GLcontext * ctx) //same evergreen->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; } -static void evergreenSetPolygonOffsetState(GLcontext * ctx, GLboolean state) //same +static void evergreenSetPolygonOffsetState(struct gl_context * ctx, GLboolean state) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -794,7 +794,7 @@ static void evergreenSetPolygonOffsetState(GLcontext * ctx, GLboolean state) //s } } -static void evergreenUpdateLineStipple(GLcontext * ctx) //diff +static void evergreenUpdateLineStipple(struct gl_context * ctx) //diff { /* TODO */ } @@ -913,7 +913,7 @@ void evergreenSetScissor(context_t *context) //diff evergreen->viewport[id].enabled = GL_TRUE; } -static void evergreenUpdateWindow(GLcontext * ctx, int id) //diff in calling evergreenSetScissor +static void evergreenUpdateWindow(struct gl_context * ctx, int id) //diff in calling evergreenSetScissor { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -969,7 +969,7 @@ static void evergreenUpdateWindow(GLcontext * ctx, int id) //diff in calling eve evergreenSetScissor(context); } -static void evergreenEnable(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls +static void evergreenEnable(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1030,7 +1030,7 @@ static void evergreenEnable(GLcontext * ctx, GLenum cap, GLboolean state) //diff } -static void evergreenColorMask(GLcontext * ctx, +static void evergreenColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1046,26 +1046,26 @@ static void evergreenColorMask(GLcontext * ctx, } } -static void evergreenDepthFunc(GLcontext * ctx, GLenum func) //same +static void evergreenDepthFunc(struct gl_context * ctx, GLenum func) //same { evergreenSetDepthState(ctx); } -static void evergreenDepthMask(GLcontext * ctx, GLboolean mask) //same +static void evergreenDepthMask(struct gl_context * ctx, GLboolean mask) //same { evergreenSetDepthState(ctx); } -static void evergreenCullFace(GLcontext * ctx, GLenum mode) //same +static void evergreenCullFace(struct gl_context * ctx, GLenum mode) //same { evergreenUpdateCulling(ctx); } -static void evergreenFogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //same +static void evergreenFogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same { } -static void evergreenUpdatePolygonMode(GLcontext * ctx) //same +static void evergreenUpdatePolygonMode(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1120,13 +1120,13 @@ static void evergreenUpdatePolygonMode(GLcontext * ctx) //same } } -static void evergreenFrontFace(GLcontext * ctx, GLenum mode) //same +static void evergreenFrontFace(struct gl_context * ctx, GLenum mode) //same { evergreenUpdateCulling(ctx); evergreenUpdatePolygonMode(ctx); } -static void evergreenShadeModel(GLcontext * ctx, GLenum mode) //same +static void evergreenShadeModel(struct gl_context * ctx, GLenum mode) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1146,13 +1146,13 @@ static void evergreenShadeModel(GLcontext * ctx, GLenum mode) //same } } -static void evergreenLogicOpcode(GLcontext *ctx, GLenum logicop) //diff +static void evergreenLogicOpcode(struct gl_context *ctx, GLenum logicop) //diff { if (RGBA_LOGICOP_ENABLED(ctx)) evergreenSetLogicOpState(ctx); } -static void evergreenPointSize(GLcontext * ctx, GLfloat size) //same +static void evergreenPointSize(struct gl_context * ctx, GLfloat size) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1174,7 +1174,7 @@ static void evergreenPointSize(GLcontext * ctx, GLfloat size) //same } -static void evergreenPointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //same +static void evergreenPointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1225,7 +1225,7 @@ static int evergreen_translate_stencil_func(int func) //same return 0; } -static void evergreenStencilFuncSeparate(GLcontext * ctx, GLenum face, +static void evergreenStencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1254,7 +1254,7 @@ static void evergreenStencilFuncSeparate(GLcontext * ctx, GLenum face, STENCILFUNC_BF_shift, STENCILFUNC_BF_mask); } -static void evergreenStencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //same +static void evergreenStencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1298,7 +1298,7 @@ static int evergreen_translate_stencil_op(int op) //same return 0; } -static void evergreenStencilOpSeparate(GLcontext * ctx, GLenum face, +static void evergreenStencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1322,7 +1322,7 @@ static void evergreenStencilOpSeparate(GLcontext * ctx, GLenum face, STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); } -static void evergreenViewport(GLcontext * ctx, +static void evergreenViewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, @@ -1333,12 +1333,12 @@ static void evergreenViewport(GLcontext * ctx, radeon_viewport(ctx, x, y, width, height); } -static void evergreenDepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow +static void evergreenDepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow { evergreenUpdateWindow(ctx, 0); } -static void evergreenLineWidth(GLcontext * ctx, GLfloat widthf) //same +static void evergreenLineWidth(struct gl_context * ctx, GLfloat widthf) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1352,7 +1352,7 @@ static void evergreenLineWidth(GLcontext * ctx, GLfloat widthf) //same PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); } -static void evergreenLineStipple(GLcontext *ctx, GLint factor, GLushort pattern) //same +static void evergreenLineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1364,7 +1364,7 @@ static void evergreenLineStipple(GLcontext *ctx, GLint factor, GLushort pattern) SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); } -static void evergreenPolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //diff : +static void evergreenPolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //diff : //all register here offset diff, bits same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1395,7 +1395,7 @@ static void evergreenPolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat unit evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; } -static void evergreenPolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //same +static void evergreenPolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //same { (void)face; (void)mode; @@ -1403,12 +1403,12 @@ static void evergreenPolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //sa evergreenUpdatePolygonMode(ctx); } -static void evergreenRenderMode(GLcontext * ctx, GLenum mode) //same +static void evergreenRenderMode(struct gl_context * ctx, GLenum mode) //same { } //TODO : move to kernel. -static void evergreenInitSQConfig(GLcontext * ctx) +static void evergreenInitSQConfig(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1608,7 +1608,7 @@ static void evergreenInitSQConfig(GLcontext * ctx) NUM_CLIP_SEQ_mask); } -void evergreenInitState(GLcontext * ctx) //diff +void evergreenInitState(struct gl_context * ctx) //diff { context_t *context = R700_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); diff --git a/src/mesa/drivers/dri/r600/evergreen_state.h b/src/mesa/drivers/dri/r600/evergreen_state.h index ffdb56b38a..2f350e90fa 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.h +++ b/src/mesa/drivers/dri/r600/evergreen_state.h @@ -31,15 +31,15 @@ #include "r600_context.h" -extern void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); -extern void evergreenUpdateShaders(GLcontext * ctx); -extern void evergreenUpdateShaderStates(GLcontext * ctx); +extern void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); +extern void evergreenUpdateShaders(struct gl_context * ctx); +extern void evergreenUpdateShaderStates(struct gl_context * ctx); -extern void evergreeUpdateShaders(GLcontext * ctx); +extern void evergreeUpdateShaders(struct gl_context * ctx); -extern void evergreenUpdateViewportOffset(GLcontext * ctx); +extern void evergreenUpdateViewportOffset(struct gl_context * ctx); -extern void evergreenInitState(GLcontext * ctx); +extern void evergreenInitState(struct gl_context * ctx); extern void evergreenInitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); extern void evergreenSetScissor(context_t *context); diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.c b/src/mesa/drivers/dri/r600/evergreen_tex.c index 8b42045ebb..58420ed123 100644 --- a/src/mesa/drivers/dri/r600/evergreen_tex.c +++ b/src/mesa/drivers/dri/r600/evergreen_tex.c @@ -934,7 +934,7 @@ EG_S_FIXED(float value, uint32_t frac_bits) return value * (1 << frac_bits); } -static GLboolean evergreen_setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean evergreen_setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { context_t *context = EVERGREEN_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -1289,7 +1289,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur return; } -void evergreenUpdateTextureState(GLcontext * ctx) +void evergreenUpdateTextureState(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(context); @@ -1311,7 +1311,7 @@ void evergreenUpdateTextureState(GLcontext * ctx) } } -static GLboolean evergreen_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean evergreen_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { radeonTexObj *t = radeon_tex_obj(texObj); @@ -1327,7 +1327,7 @@ static GLboolean evergreen_validate_texture(GLcontext * ctx, struct gl_texture_o return GL_TRUE; } -GLboolean evergreenValidateBuffers(GLcontext * ctx) +GLboolean evergreenValidateBuffers(struct gl_context * ctx) { context_t *rmesa = EVERGREEN_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -1403,7 +1403,7 @@ GLboolean evergreenValidateBuffers(GLcontext * ctx) return GL_TRUE; } -static struct gl_texture_object *evergreenNewTextureObject(GLcontext * ctx, +static struct gl_texture_object *evergreenNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { @@ -1426,7 +1426,7 @@ static struct gl_texture_object *evergreenNewTextureObject(GLcontext * ctx, return &t->base; } -static void evergreenDeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void evergreenDeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { context_t * rmesa = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(rmesa); @@ -1456,7 +1456,7 @@ static void evergreenDeleteTexture(GLcontext * ctx, struct gl_texture_object *te _mesa_delete_texture_object(ctx, texObj); } -static void evergreenTexParameter(GLcontext * ctx, GLenum target, +static void evergreenTexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat * params) { diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.h b/src/mesa/drivers/dri/r600/evergreen_tex.h index b43508a9ea..982a087f8e 100644 --- a/src/mesa/drivers/dri/r600/evergreen_tex.h +++ b/src/mesa/drivers/dri/r600/evergreen_tex.h @@ -27,9 +27,9 @@ #ifndef _EVERGREEN_TEX_H_ #define _EVERGREEN_TEX_H_ -extern GLboolean evergreenValidateBuffers(GLcontext * ctx); +extern GLboolean evergreenValidateBuffers(struct gl_context * ctx); -extern void evergreenUpdateTextureState(GLcontext * ctx); +extern void evergreenUpdateTextureState(struct gl_context * ctx); extern void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); extern void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 0099cef527..b3371f20b1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -169,7 +169,7 @@ GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( } GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -196,7 +196,7 @@ GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( return GL_TRUE; } -void evergreen_Map_Vertex_Program(GLcontext *ctx, +void evergreen_Map_Vertex_Program(struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -292,7 +292,7 @@ GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_pro return GL_TRUE; } -struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, +struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -374,7 +374,7 @@ struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, return vp; } -void evergreenSelectVertexShader(GLcontext *ctx) +void evergreenSelectVertexShader(struct gl_context *ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program_cont *vpc; @@ -448,7 +448,7 @@ int evergreen_getTypeSize(GLenum type) } } -static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input) +static void evergreenTranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -534,7 +534,7 @@ static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, co context->nNumActiveAos++; } -void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vpc @@ -563,7 +563,7 @@ void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arra context->radeon.tcl.aos_count = context->nNumActiveAos; } -void * evergreenGetActiveVpShaderBo(GLcontext * ctx) +void * evergreenGetActiveVpShaderBo(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vp = context->selected_vp;; @@ -574,7 +574,7 @@ void * evergreenGetActiveVpShaderBo(GLcontext * ctx) return NULL; } -void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx) +void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vp = context->selected_vp;; @@ -585,7 +585,7 @@ void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx) return NULL; } -GLboolean evergreenSetupVertexProgram(GLcontext * ctx) +GLboolean evergreenSetupVertexProgram(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -646,7 +646,7 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) return GL_TRUE; } -GLboolean evergreenSetupVPconstants(GLcontext * ctx) +GLboolean evergreenSetupVPconstants(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.h b/src/mesa/drivers/dri/r600/evergreen_vertprog.h index 5853902115..8163e36927 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.h @@ -80,29 +80,29 @@ GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); -void evergreen_Map_Vertex_Program(GLcontext *ctx, +void evergreen_Map_Vertex_Program(struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); -struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, +struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp); /* Interface */ -extern void evergreenSelectVertexShader(GLcontext *ctx); -extern void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); +extern void evergreenSelectVertexShader(struct gl_context *ctx); +extern void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count); -extern GLboolean evergreenSetupVertexProgram(GLcontext * ctx); +extern GLboolean evergreenSetupVertexProgram(struct gl_context * ctx); -extern GLboolean evergreenSetupVPconstants(GLcontext * ctx); +extern GLboolean evergreenSetupVPconstants(struct gl_context * ctx); -extern void * evergreenGetActiveVpShaderBo(GLcontext * ctx); +extern void * evergreenGetActiveVpShaderBo(struct gl_context * ctx); -extern void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx); +extern void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx); extern int evergreen_getTypeSize(GLenum type); diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c index 3090c9f613..31c32d62f9 100644 --- a/src/mesa/drivers/dri/r600/r600_blit.c +++ b/src/mesa/drivers/dri/r600/r600_blit.c @@ -408,7 +408,7 @@ set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_forma } -static inline void load_shaders(GLcontext * ctx) +static inline void load_shaders(struct gl_context * ctx) { radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); @@ -1566,7 +1566,7 @@ static GLboolean validate_buffers(context_t *rmesa, return GL_TRUE; } -unsigned r600_blit(GLcontext *ctx, +unsigned r600_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/r600_blit.h b/src/mesa/drivers/dri/r600/r600_blit.h index d56b21ba9b..9dc8e2fec6 100644 --- a/src/mesa/drivers/dri/r600/r600_blit.h +++ b/src/mesa/drivers/dri/r600/r600_blit.h @@ -30,7 +30,7 @@ unsigned r600_check_blit(gl_format mesa_format); -unsigned r600_blit(GLcontext *ctx, +unsigned r600_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 103f33d39e..c882a9cce9 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -208,7 +208,7 @@ static void r600_vtbl_pre_emit_atoms(radeonContextPtr radeon) r700Start3D((context_t *)radeon); } -static void r600_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +static void r600_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) { context_t *context = R700_CONTEXT(ctx); if (mode) @@ -249,7 +249,7 @@ static void r600_init_vtbl(radeonContextPtr radeon) radeon->vtbl.is_format_renderable = r600IsFormatRenderable; } -static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) +static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -335,7 +335,7 @@ static void r600ParseOptions(context_t *r600, radeonScreenPtr screen) } -static void r600InitGLExtensions(GLcontext *ctx) +static void r600InitGLExtensions(struct gl_context *ctx) { context_t *r600 = R700_CONTEXT(ctx); #ifdef R600_ENABLE_GLSL_TEST @@ -388,7 +388,7 @@ GLboolean r600CreateContext(gl_api api, radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); struct dd_function_table functions; context_t *r600; - GLcontext *ctx; + struct gl_context *ctx; assert(glVisual); assert(driContextPriv); diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 1954d3429a..d3dc901acf 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -188,7 +188,7 @@ struct r600_context { #define EVERGREEN_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) -#define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx)) +#define GL_CONTEXT(context) ((struct gl_context *)(context->radeon.glCtx)) #define GET_EVERGREEN_CHIP(context) ((EVERGREEN_CHIP_CONTEXT*)(context->pChip)) @@ -232,10 +232,10 @@ extern void r700WaitForIdleClean(context_t *context); extern void r700Start3D(context_t *context); extern void r600InitAtoms(context_t *context); -extern void r700InitDraw(GLcontext *ctx); +extern void r700InitDraw(struct gl_context *ctx); extern void evergreenInitAtoms(context_t *context); -extern void evergreenInitDraw(GLcontext *ctx); +extern void evergreenInitDraw(struct gl_context *ctx); #define RADEON_D_CAPTURE 0 #define RADEON_D_PLAYBACK 1 diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index a840106c14..53ece9a350 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -49,7 +49,7 @@ void r600EmitCacheFlush(context_t *rmesa) { } -GLboolean r600AllocShaderConsts(GLcontext * ctx, +GLboolean r600AllocShaderConsts(struct gl_context * ctx, void ** constbo, int sizeinBYTE, char * szShaderUsage) @@ -93,7 +93,7 @@ shader_again_alloc: return GL_TRUE; } -GLboolean r600EmitShaderConsts(GLcontext * ctx, +GLboolean r600EmitShaderConsts(struct gl_context * ctx, void * constbo, int bo_offset, GLvoid * data, @@ -114,7 +114,7 @@ GLboolean r600EmitShaderConsts(GLcontext * ctx, return GL_TRUE; } -GLboolean r600EmitShader(GLcontext * ctx, +GLboolean r600EmitShader(struct gl_context * ctx, void ** shaderbo, GLvoid * data, int sizeinDWORD, @@ -163,7 +163,7 @@ shader_again_alloc: return GL_TRUE; } -GLboolean r600DeleteShader(GLcontext * ctx, +GLboolean r600DeleteShader(struct gl_context * ctx, void * shaderbo) { struct radeon_bo * pbo = (struct radeon_bo *)shaderbo; diff --git a/src/mesa/drivers/dri/r600/r600_emit.h b/src/mesa/drivers/dri/r600/r600_emit.h index 259561539f..c50b6060ca 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.h +++ b/src/mesa/drivers/dri/r600/r600_emit.h @@ -43,20 +43,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void r600EmitCacheFlush(context_t *rmesa); -extern GLboolean r600EmitShader(GLcontext * ctx, +extern GLboolean r600EmitShader(struct gl_context * ctx, void ** shaderbo, GLvoid * data, int sizeinDWORD, char * szShaderUsage); -extern GLboolean r600DeleteShader(GLcontext * ctx, +extern GLboolean r600DeleteShader(struct gl_context * ctx, void * shaderbo); -extern GLboolean r600AllocShaderConsts(GLcontext * ctx, +extern GLboolean r600AllocShaderConsts(struct gl_context * ctx, void ** constbo, int sizeinBYTE, char * szShaderUsage); -GLboolean r600EmitShaderConsts(GLcontext * ctx, +GLboolean r600EmitShaderConsts(struct gl_context * ctx, void * constbo, int bo_offset, GLvoid * data, diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c index 512a52ede3..d6a58f410c 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ b/src/mesa/drivers/dri/r600/r600_tex.c @@ -276,7 +276,7 @@ static void r600SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) * next UpdateTextureState */ -static void r600TexParameter(GLcontext * ctx, GLenum target, +static void r600TexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat * params) { @@ -332,7 +332,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target, } } -static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void r600DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { context_t* rmesa = R700_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); @@ -368,7 +368,7 @@ static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) * allocate the default texture objects. * Fixup MaxAnisotropy according to user preference. */ -static struct gl_texture_object *r600NewTextureObject(GLcontext * ctx, +static struct gl_texture_object *r600NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { diff --git a/src/mesa/drivers/dri/r600/r600_tex.h b/src/mesa/drivers/dri/r600/r600_tex.h index 771affdfa6..256588429e 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.h +++ b/src/mesa/drivers/dri/r600/r600_tex.h @@ -56,7 +56,7 @@ extern void r600SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); -extern GLboolean r600ValidateBuffers(GLcontext * ctx); +extern GLboolean r600ValidateBuffers(struct gl_context * ctx); extern void r600InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index fd928cfe5d..3869768bf0 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -52,9 +52,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "evergreen_tex.h" -void r600UpdateTextureState(GLcontext * ctx); +void r600UpdateTextureState(struct gl_context * ctx); -void r600UpdateTextureState(GLcontext * ctx) +void r600UpdateTextureState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -707,7 +707,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj) * \param rmesa Context pointer * \param t the r300 texture object */ -static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { context_t *rmesa = R700_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -803,7 +803,7 @@ static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object * * Mostly this means populating the texture object's mipmap tree. */ -static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean r600_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { radeonTexObj *t = radeon_tex_obj(texObj); @@ -822,7 +822,7 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object /** * Ensure all enabled and complete textures are uploaded along with any buffers being used. */ -GLboolean r600ValidateBuffers(GLcontext * ctx) +GLboolean r600ValidateBuffers(struct gl_context * ctx) { context_t *rmesa = R700_CONTEXT(ctx); struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 3bb194eb6d..4ec2845ab4 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -39,7 +39,7 @@ #include "radeon_mipmap_tree.h" -static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendTexState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -104,7 +104,7 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) #define SAMPLER_STRIDE 3 -static void r700SendTexSamplerState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendTexSamplerState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -141,7 +141,7 @@ static void r700SendTexSamplerState(GLcontext *ctx, struct radeon_state_atom *at } } -static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendTexBorderColorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -167,7 +167,7 @@ static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom } extern int getTypeSize(GLenum type); -static void r700SetupVTXConstants(GLcontext * ctx, +static void r700SetupVTXConstants(struct gl_context * ctx, void * pAos, StreamDesc * pStreamDesc) { @@ -243,7 +243,7 @@ static void r700SetupVTXConstants(GLcontext * ctx, } -static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVTXState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp; @@ -599,7 +599,7 @@ static void r700SetDepthTarget(context_t *context) /* r700->DB_PREFETCH_LIMIT.bits.DEPTH_HEIGHT_TILE_MAX = (context->currentDraw->h >> 3) - 1; */ /* z buffer sie may much bigger than what need, so use actual used h. */ } -static void r700SendDepthTargetState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendDepthTargetState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -646,7 +646,7 @@ static void r700SendDepthTargetState(GLcontext *ctx, struct radeon_state_atom *a } -static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendRenderTargetState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -724,7 +724,7 @@ static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom * } -static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendPSState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -766,7 +766,7 @@ static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVSState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -827,7 +827,7 @@ static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendFSState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -869,7 +869,7 @@ static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendViewportState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendViewportState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -903,7 +903,7 @@ static void r700SendViewportState(GLcontext *ctx, struct radeon_state_atom *atom } -static void r700SendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -940,7 +940,7 @@ static void r700SendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendUCPState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendUCPState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -962,7 +962,7 @@ static void r700SendUCPState(GLcontext *ctx, struct radeon_state_atom *atom) } } -static void r700SendSPIState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSPIState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1037,7 +1037,7 @@ static void r700SendSPIState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendVGTState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVGTState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1083,7 +1083,7 @@ static void r700SendVGTState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendSXState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSXState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1098,7 +1098,7 @@ static void r700SendSXState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendDBState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1124,7 +1124,7 @@ static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendStencilState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendStencilState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1138,7 +1138,7 @@ static void r700SendStencilState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendCBState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1168,7 +1168,7 @@ static void r700SendCBState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendCBCLRCMPState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBCLRCMPState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1184,7 +1184,7 @@ static void r700SendCBCLRCMPState(GLcontext *ctx, struct radeon_state_atom *atom COMMIT_BATCH(); } -static void r700SendCBBlendState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBBlendState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1216,7 +1216,7 @@ static void r700SendCBBlendState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendCBBlendColorState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBBlendColorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1233,7 +1233,7 @@ static void r700SendCBBlendColorState(GLcontext *ctx, struct radeon_state_atom * COMMIT_BATCH(); } -static void r700SendSUState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSUState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1251,7 +1251,7 @@ static void r700SendSUState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendPolyState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendPolyState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1271,7 +1271,7 @@ static void r700SendPolyState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendCLState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCLState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1287,7 +1287,7 @@ static void r700SendCLState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendGBState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendGBState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1303,7 +1303,7 @@ static void r700SendGBState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendScissorState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendScissorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1336,7 +1336,7 @@ static void r700SendScissorState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendSCState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSCState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1353,7 +1353,7 @@ static void r700SendSCState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendAAState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendAAState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1368,7 +1368,7 @@ static void r700SendAAState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendPSConsts(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendPSConsts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1392,7 +1392,7 @@ static void r700SendPSConsts(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendVSConsts(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVSConsts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1417,7 +1417,7 @@ static void r700SendVSConsts(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -1443,12 +1443,12 @@ static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) query->emitted_begin = GL_TRUE; } -static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; } -static int check_cb(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_cb(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); int count = 7; @@ -1460,7 +1460,7 @@ static int check_cb(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_blnd(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1485,7 +1485,7 @@ static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_ucp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_ucp(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1500,7 +1500,7 @@ static int check_ucp(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_vtx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vtx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); int count = context->radeon.tcl.aos_count * 18; @@ -1509,7 +1509,7 @@ static int check_vtx(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_tx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); unsigned int i, count = 0; @@ -1526,7 +1526,7 @@ static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom) return count * 31; } -static int check_ps_consts(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_ps_consts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1539,7 +1539,7 @@ static int check_ps_consts(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vs_consts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1552,7 +1552,7 @@ static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; diff --git a/src/mesa/drivers/dri/r600/r700_clear.c b/src/mesa/drivers/dri/r600/r700_clear.c index d1008f28b9..853dec9233 100644 --- a/src/mesa/drivers/dri/r600/r700_clear.c +++ b/src/mesa/drivers/dri/r600/r700_clear.c @@ -45,7 +45,7 @@ static GLboolean r700ClearFast(context_t *context, GLbitfield mask) return GL_FALSE; } -void r700Clear(GLcontext * ctx, GLbitfield mask) +void r700Clear(struct gl_context * ctx, GLbitfield mask) { context_t *context = R700_CONTEXT(ctx); radeonContextPtr radeon = &context->radeon; diff --git a/src/mesa/drivers/dri/r600/r700_clear.h b/src/mesa/drivers/dri/r600/r700_clear.h index bed1d3a90e..de372ee303 100644 --- a/src/mesa/drivers/dri/r600/r700_clear.h +++ b/src/mesa/drivers/dri/r600/r700_clear.h @@ -28,6 +28,6 @@ #ifndef __r700_CLEAR_H__ #define __r700_CLEAR_H__ -extern void r700Clear(GLcontext * ctx, GLbitfield mask); +extern void r700Clear(struct gl_context * ctx, GLbitfield mask); #endif /* __r700_CLEAR_H__ */ diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 217b0e27a4..2a6a39dfba 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -44,7 +44,7 @@ #include "r700_debug.h" -void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) +void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog) { static const gl_state_index winstate[STATE_LENGTH] = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0}; @@ -95,7 +95,7 @@ void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) //TODO : Validate FP input with VP output. void Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { unsigned int unBit; unsigned int i; @@ -353,7 +353,7 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -466,7 +466,7 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, return GL_TRUE; } -void r700SelectFragmentShader(GLcontext *ctx) +void r700SelectFragmentShader(struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_fragment_program *fp = (struct r700_fragment_program *) @@ -480,7 +480,7 @@ void r700SelectFragmentShader(GLcontext *ctx) r700TranslateFragmentShader(fp, &(fp->mesa_program), ctx); } -void * r700GetActiveFpShaderBo(GLcontext * ctx) +void * r700GetActiveFpShaderBo(struct gl_context * ctx) { struct r700_fragment_program *fp = (struct r700_fragment_program *) (ctx->FragmentProgram._Current); @@ -488,7 +488,7 @@ void * r700GetActiveFpShaderBo(GLcontext * ctx) return fp->shaderbo; } -void * r700GetActiveFpShaderConstBo(GLcontext * ctx) +void * r700GetActiveFpShaderConstBo(struct gl_context * ctx) { struct r700_fragment_program *fp = (struct r700_fragment_program *) (ctx->FragmentProgram._Current); @@ -496,7 +496,7 @@ void * r700GetActiveFpShaderConstBo(GLcontext * ctx) return fp->constbo0; } -GLboolean r700SetupFragmentProgram(GLcontext * ctx) +GLboolean r700SetupFragmentProgram(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.h b/src/mesa/drivers/dri/r600/r700_fragprog.h index aaa6043d5d..bdb95ff0e7 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.h +++ b/src/mesa/drivers/dri/r600/r700_fragprog.h @@ -51,25 +51,25 @@ struct r700_fragment_program }; /* Internal */ -void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog); +void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog); void Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx); + struct gl_context *ctx); GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp); GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_vp, - GLcontext *ctx); + struct gl_context *ctx); /* Interface */ -extern void r700SelectFragmentShader(GLcontext *ctx); +extern void r700SelectFragmentShader(struct gl_context *ctx); -extern GLboolean r700SetupFragmentProgram(GLcontext * ctx); +extern GLboolean r700SetupFragmentProgram(struct gl_context * ctx); -extern void * r700GetActiveFpShaderBo(GLcontext * ctx); +extern void * r700GetActiveFpShaderBo(struct gl_context * ctx); -extern void * r700GetActiveFpShaderConstBo(GLcontext * ctx); +extern void * r700GetActiveFpShaderConstBo(struct gl_context * ctx); #endif /*_R700_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index e0c9179004..6ca7458003 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -40,7 +40,7 @@ #include "r700_vertprog.h" -static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +static void freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache) { struct r700_vertex_program *tmp, *vp = cache->progs; @@ -64,7 +64,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *c } } -static struct gl_program *r700NewProgram(GLcontext * ctx, +static struct gl_program *r700NewProgram(struct gl_context * ctx, GLenum target, GLuint id) { @@ -109,7 +109,7 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, return pProgram; } -static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) +static void r700DeleteProgram(struct gl_context * ctx, struct gl_program *prog) { struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; struct r700_fragment_program * fp; @@ -147,7 +147,7 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) } static GLboolean -r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +r700ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; struct r700_fragment_program * fp = (struct r700_fragment_program*)prog; @@ -178,7 +178,7 @@ r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) return GL_TRUE; } -static GLboolean r700IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +static GLboolean r700IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { return GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index f90c69c416..bb14a239b7 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -244,7 +244,7 @@ static int r700NumVerts(int num_verts, int prim) return num_verts - verts_off; } -static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, +static void r700RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim, GLint basevertex) { context_t *context = R700_CONTEXT(ctx); @@ -315,7 +315,7 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, COMMIT_BATCH(); } -static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) +static void r700RunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) { context_t *context = R700_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); @@ -434,7 +434,7 @@ static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, /* start 3d, idle, cb/db flush */ #define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 -static GLuint r700PredictRenderSize(GLcontext* ctx, +static GLuint r700PredictRenderSize(struct gl_context* ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint nr_prims) @@ -501,7 +501,7 @@ static GLuint r700PredictRenderSize(GLcontext* ctx, * Convert attribute data type to float * If the attribute uses named buffer object replace the bo with newly allocated bo */ -static void r700ConvertAttrib(GLcontext *ctx, int count, +static void r700ConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct StreamDesc *attr) { @@ -580,7 +580,7 @@ static void r700ConvertAttrib(GLcontext *ctx, int count, } } -static void r700AlignDataToDword(GLcontext *ctx, +static void r700AlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct StreamDesc *attr) @@ -622,7 +622,7 @@ static void r700AlignDataToDword(GLcontext *ctx, attr->stride = dst_stride; } -static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void r700SetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) { context_t *context = R700_CONTEXT(ctx); GLuint stride; @@ -723,7 +723,7 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input RADEON_GEM_DOMAIN_GTT, 0); } -static void r700FreeData(GLcontext *ctx) +static void r700FreeData(struct gl_context *ctx) { /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo * to prevent double unref in radeonReleaseArrays @@ -748,7 +748,7 @@ static void r700FreeData(GLcontext *ctx) } } -static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r700FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = R700_CONTEXT(ctx); GLvoid *src_ptr; @@ -823,7 +823,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } } -static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r700SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = R700_CONTEXT(ctx); @@ -876,7 +876,7 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } } -static GLboolean check_fallbacks(GLcontext *ctx) +static GLboolean check_fallbacks(struct gl_context *ctx) { if (ctx->RenderMode != GL_RENDER) return GL_TRUE; @@ -884,7 +884,7 @@ static GLboolean check_fallbacks(GLcontext *ctx) return GL_FALSE; } -static GLboolean r700TryDrawPrims(GLcontext *ctx, +static GLboolean r700TryDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -972,7 +972,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void r700DrawPrims(GLcontext *ctx, +static void r700DrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -1011,7 +1011,7 @@ static void r700DrawPrims(GLcontext *ctx, } } -void r700InitDraw(GLcontext *ctx) +void r700InitDraw(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index 8b3ed5cd82..cbbfaed31c 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -38,7 +38,7 @@ #include "r700_shader.h" -void r700ShaderInit(GLcontext * ctx) +void r700ShaderInit(struct gl_context * ctx) { } diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h index 0599ffd901..183dd33525 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.h +++ b/src/mesa/drivers/dri/r600/r700_shader.h @@ -33,7 +33,7 @@ #include "r700_shaderinst.h" -void r700ShaderInit(GLcontext * ctx); +void r700ShaderInit(struct gl_context * ctx); typedef enum R700ShaderType { diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 925b4ffe6d..bd04a633b4 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -52,14 +52,14 @@ #include "r700_fragprog.h" #include "r700_vertprog.h" -void r600UpdateTextureState(GLcontext * ctx); -static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state); -static void r700UpdatePolygonMode(GLcontext * ctx); -static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state); -static void r700SetStencilState(GLcontext * ctx, GLboolean state); -static void r700UpdateWindow(GLcontext * ctx, int id); - -void r700UpdateShaders(GLcontext * ctx) +void r600UpdateTextureState(struct gl_context * ctx); +static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state); +static void r700UpdatePolygonMode(struct gl_context * ctx); +static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state); +static void r700SetStencilState(struct gl_context * ctx, GLboolean state); +static void r700UpdateWindow(struct gl_context * ctx, int id); + +void r700UpdateShaders(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -80,7 +80,7 @@ void r700UpdateShaders(GLcontext * ctx) /* * To correctly position primitives: */ -void r700UpdateViewportOffset(GLcontext * ctx) //------------------ +void r700UpdateViewportOffset(struct gl_context * ctx) //------------------ { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -106,7 +106,7 @@ void r700UpdateViewportOffset(GLcontext * ctx) //------------------ radeonUpdateScissor(ctx); } -void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state) //-------------------- +void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state) //-------------------- { struct r700_fragment_program *fp = (struct r700_fragment_program *)ctx->FragmentProgram._Current; @@ -130,7 +130,7 @@ void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state) //------------ /** * Called by Mesa after an internal state update. */ -static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //------------------- +static void r700InvalidateState(struct gl_context * ctx, GLuint new_state) //------------------- { context_t *context = R700_CONTEXT(ctx); @@ -190,7 +190,7 @@ static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //----------- context->radeon.NewGLState |= new_state; } -static void r700SetDBRenderState(GLcontext * ctx) +static void r700SetDBRenderState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -245,13 +245,13 @@ static void r700SetDBRenderState(GLcontext * ctx) } } -void r700UpdateShaderStates(GLcontext * ctx) +void r700UpdateShaderStates(struct gl_context * ctx) { r700SetDBRenderState(ctx); r600UpdateTextureState(ctx); } -static void r700SetDepthState(GLcontext * ctx) +static void r700SetDepthState(struct gl_context * ctx) { struct radeon_renderbuffer *rrb; context_t *context = R700_CONTEXT(ctx); @@ -320,7 +320,7 @@ static void r700SetDepthState(GLcontext * ctx) } } -static void r700SetAlphaState(GLcontext * ctx) +static void r700SetAlphaState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -368,7 +368,7 @@ static void r700SetAlphaState(GLcontext * ctx) } -static void r700AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //--------------- +static void r700AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //--------------- { (void)func; (void)ref; @@ -376,7 +376,7 @@ static void r700AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //--------- } -static void r700BlendColor(GLcontext * ctx, const GLfloat cf[4]) //---------------- +static void r700BlendColor(struct gl_context * ctx, const GLfloat cf[4]) //---------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -444,7 +444,7 @@ static int blend_factor(GLenum factor, GLboolean is_src) } } -static void r700SetBlendState(GLcontext * ctx) +static void r700SetBlendState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -576,13 +576,13 @@ static void r700SetBlendState(GLcontext * ctx) } -static void r700BlendEquationSeparate(GLcontext * ctx, +static void r700BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) //----------------- { r700SetBlendState(ctx); } -static void r700BlendFuncSeparate(GLcontext * ctx, +static void r700BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) //------------------------ { @@ -637,7 +637,7 @@ static GLuint translate_logicop(GLenum logicop) * Used internally to update the r300->hw hardware state to match the * current OpenGL state. */ -static void r700SetLogicOpState(GLcontext *ctx) +static void r700SetLogicOpState(struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); @@ -655,13 +655,13 @@ static void r700SetLogicOpState(GLcontext *ctx) * Called by Mesa when an application program changes the LogicOp state * via glLogicOp. */ -static void r700LogicOpcode(GLcontext *ctx, GLenum logicop) +static void r700LogicOpcode(struct gl_context *ctx, GLenum logicop) { if (RGBA_LOGICOP_ENABLED(ctx)) r700SetLogicOpState(ctx); } -static void r700UpdateCulling(GLcontext * ctx) +static void r700UpdateCulling(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); @@ -713,7 +713,7 @@ static void r700UpdateCulling(GLcontext * ctx) r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; } -static void r700UpdateLineStipple(GLcontext * ctx) +static void r700UpdateLineStipple(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); @@ -730,7 +730,7 @@ static void r700UpdateLineStipple(GLcontext * ctx) } } -static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //------------------ +static void r700Enable(struct gl_context * ctx, GLenum cap, GLboolean state) //------------------ { context_t *context = R700_CONTEXT(ctx); @@ -794,7 +794,7 @@ static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //--------- /** * Handle glColorMask() */ -static void r700ColorMask(GLcontext * ctx, +static void r700ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) //------------------ { context_t *context = R700_CONTEXT(ctx); @@ -815,7 +815,7 @@ static void r700ColorMask(GLcontext * ctx, * * \note Mesa already filters redundant calls to this function. */ -static void r700DepthFunc(GLcontext * ctx, GLenum func) //-------------------- +static void r700DepthFunc(struct gl_context * ctx, GLenum func) //-------------------- { r700SetDepthState(ctx); } @@ -825,7 +825,7 @@ static void r700DepthFunc(GLcontext * ctx, GLenum func) //-------------------- * * \note Mesa already filters redundant calls to this function. */ -static void r700DepthMask(GLcontext * ctx, GLboolean mask) //------------------ +static void r700DepthMask(struct gl_context * ctx, GLboolean mask) //------------------ { r700SetDepthState(ctx); } @@ -835,7 +835,7 @@ static void r700DepthMask(GLcontext * ctx, GLboolean mask) //------------------ * * \note Mesa already filters redundant calls to this function. */ -static void r700CullFace(GLcontext * ctx, GLenum mode) //----------------- +static void r700CullFace(struct gl_context * ctx, GLenum mode) //----------------- { r700UpdateCulling(ctx); } @@ -843,7 +843,7 @@ static void r700CullFace(GLcontext * ctx, GLenum mode) //----------------- /* ============================================================= * Fog */ -static void r700Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //-------------- +static void r700Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //-------------- { } @@ -852,13 +852,13 @@ static void r700Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //-- * * \note Mesa already filters redundant calls to this function. */ -static void r700FrontFace(GLcontext * ctx, GLenum mode) //------------------ +static void r700FrontFace(struct gl_context * ctx, GLenum mode) //------------------ { r700UpdateCulling(ctx); r700UpdatePolygonMode(ctx); } -static void r700ShadeModel(GLcontext * ctx, GLenum mode) //-------------------- +static void r700ShadeModel(struct gl_context * ctx, GLenum mode) //-------------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -881,7 +881,7 @@ static void r700ShadeModel(GLcontext * ctx, GLenum mode) //-------------------- /* ============================================================= * Point state */ -static void r700PointSize(GLcontext * ctx, GLfloat size) +static void r700PointSize(struct gl_context * ctx, GLfloat size) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -903,7 +903,7 @@ static void r700PointSize(GLcontext * ctx, GLfloat size) } -static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //--------------- +static void r700PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //--------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -980,7 +980,7 @@ static int translate_stencil_op(int op) return 0; } -static void r700SetStencilState(GLcontext * ctx, GLboolean state) +static void r700SetStencilState(struct gl_context * ctx, GLboolean state) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1002,7 +1002,7 @@ static void r700SetStencilState(GLcontext * ctx, GLboolean state) } } -static void r700StencilFuncSeparate(GLcontext * ctx, GLenum face, +static void r700StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) //--------------------- { context_t *context = R700_CONTEXT(ctx); @@ -1032,7 +1032,7 @@ static void r700StencilFuncSeparate(GLcontext * ctx, GLenum face, } -static void r700StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //-------------- +static void r700StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //-------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1050,7 +1050,7 @@ static void r700StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) / } -static void r700StencilOpSeparate(GLcontext * ctx, GLenum face, +static void r700StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) //-------------------- { context_t *context = R700_CONTEXT(ctx); @@ -1074,7 +1074,7 @@ static void r700StencilOpSeparate(GLcontext * ctx, GLenum face, STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); } -static void r700UpdateWindow(GLcontext * ctx, int id) //-------------------- +static void r700UpdateWindow(struct gl_context * ctx, int id) //-------------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1131,7 +1131,7 @@ static void r700UpdateWindow(GLcontext * ctx, int id) //-------------------- } -static void r700Viewport(GLcontext * ctx, +static void r700Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, @@ -1142,12 +1142,12 @@ static void r700Viewport(GLcontext * ctx, radeon_viewport(ctx, x, y, width, height); } -static void r700DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //------------- +static void r700DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //------------- { r700UpdateWindow(ctx, 0); } -static void r700LineWidth(GLcontext * ctx, GLfloat widthf) //--------------- +static void r700LineWidth(struct gl_context * ctx, GLfloat widthf) //--------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1161,7 +1161,7 @@ static void r700LineWidth(GLcontext * ctx, GLfloat widthf) //--------------- PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); } -static void r700LineStipple(GLcontext *ctx, GLint factor, GLushort pattern) +static void r700LineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1173,7 +1173,7 @@ static void r700LineStipple(GLcontext *ctx, GLint factor, GLushort pattern) SETfield(r700->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); } -static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state) +static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1191,7 +1191,7 @@ static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state) } } -static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //-------------- +static void r700PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //-------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1221,7 +1221,7 @@ static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) // r700->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; } -static void r700UpdatePolygonMode(GLcontext * ctx) +static void r700UpdatePolygonMode(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1276,7 +1276,7 @@ static void r700UpdatePolygonMode(GLcontext * ctx) } } -static void r700PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //------------------ +static void r700PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //------------------ { (void)face; (void)mode; @@ -1284,11 +1284,11 @@ static void r700PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //------- r700UpdatePolygonMode(ctx); } -static void r700RenderMode(GLcontext * ctx, GLenum mode) //--------------------- +static void r700RenderMode(struct gl_context * ctx, GLenum mode) //--------------------- { } -static void r700ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void r700ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1306,7 +1306,7 @@ static void r700ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) r700->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; } -static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) +static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1428,7 +1428,7 @@ void r700SetScissor(context_t *context) //--------------- r700->viewport[id].enabled = GL_TRUE; } -static void r700InitSQConfig(GLcontext * ctx) +static void r700InitSQConfig(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1635,7 +1635,7 @@ static void r700InitSQConfig(GLcontext * ctx) * Assumes that the command buffer and state atoms have been * initialized already. */ -void r700InitState(GLcontext * ctx) //------------------- +void r700InitState(struct gl_context * ctx) //------------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); diff --git a/src/mesa/drivers/dri/r600/r700_state.h b/src/mesa/drivers/dri/r600/r700_state.h index 56885e0b15..2d51198c8a 100644 --- a/src/mesa/drivers/dri/r600/r700_state.h +++ b/src/mesa/drivers/dri/r600/r700_state.h @@ -33,13 +33,13 @@ #include "r700_chip.h" -extern void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state); -extern void r700UpdateShaders (GLcontext * ctx); -extern void r700UpdateShaderStates(GLcontext * ctx); +extern void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state); +extern void r700UpdateShaders (struct gl_context * ctx); +extern void r700UpdateShaderStates(struct gl_context * ctx); -extern void r700UpdateViewportOffset(GLcontext * ctx); +extern void r700UpdateViewportOffset(struct gl_context * ctx); -extern void r700InitState (GLcontext * ctx); +extern void r700InitState (struct gl_context * ctx); extern void r700InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); extern void r700SetScissor(context_t *context); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 2fee5b4433..7ba49d8f98 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -170,7 +170,7 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions( } GLboolean Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -197,7 +197,7 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions2( return GL_TRUE; } -void Map_Vertex_Program(GLcontext *ctx, +void Map_Vertex_Program(struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -293,7 +293,7 @@ GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, return GL_TRUE; } -struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, +struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp) { context_t *context = R700_CONTEXT(ctx); @@ -385,7 +385,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return vp; } -void r700SelectVertexShader(GLcontext *ctx) +void r700SelectVertexShader(struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program_cont *vpc; @@ -459,7 +459,7 @@ int getTypeSize(GLenum type) } } -static void r700TranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input) +static void r700TranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input) { context_t *context = R700_CONTEXT(ctx); @@ -545,7 +545,7 @@ static void r700TranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const s context->nNumActiveAos++; } -void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vpc @@ -574,7 +574,7 @@ void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], context->radeon.tcl.aos_count = context->nNumActiveAos; } -void * r700GetActiveVpShaderBo(GLcontext * ctx) +void * r700GetActiveVpShaderBo(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp;; @@ -585,7 +585,7 @@ void * r700GetActiveVpShaderBo(GLcontext * ctx) return NULL; } -void * r700GetActiveVpShaderConstBo(GLcontext * ctx) +void * r700GetActiveVpShaderConstBo(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp;; @@ -596,7 +596,7 @@ void * r700GetActiveVpShaderConstBo(GLcontext * ctx) return NULL; } -GLboolean r700SetupVertexProgram(GLcontext * ctx) +GLboolean r700SetupVertexProgram(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h index 9acdc8e350..859afb6e97 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ b/src/mesa/drivers/dri/r600/r700_vertprog.h @@ -80,27 +80,27 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions( struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); -void Map_Vertex_Program(GLcontext *ctx, +void Map_Vertex_Program(struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); -struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, +struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp); /* Interface */ -extern void r700SelectVertexShader(GLcontext *ctx); -extern void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); +extern void r700SelectVertexShader(struct gl_context *ctx); +extern void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count); -extern GLboolean r700SetupVertexProgram(GLcontext * ctx); +extern GLboolean r700SetupVertexProgram(struct gl_context * ctx); -extern void * r700GetActiveVpShaderBo(GLcontext * ctx); +extern void * r700GetActiveVpShaderBo(struct gl_context * ctx); -extern void * r700GetActiveVpShaderConstBo(GLcontext * ctx); +extern void * r700GetActiveVpShaderConstBo(struct gl_context * ctx); extern int getTypeSize(GLenum type); diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c index 143822361e..fe14540bc2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.c +++ b/src/mesa/drivers/dri/radeon/radeon_blit.c @@ -321,7 +321,7 @@ static inline void emit_draw_packet(struct r100_context *r100, * @param[in] height region height * @param[in] flip_y set if y coords of the source image need to be flipped */ -unsigned r100_blit(GLcontext *ctx, +unsigned r100_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.h b/src/mesa/drivers/dri/radeon/radeon_blit.h index d7d0b5554a..5e5c73481a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.h +++ b/src/mesa/drivers/dri/radeon/radeon_blit.h @@ -32,7 +32,7 @@ void r100_blit_init(struct r100_context *r100); unsigned r100_check_blit(gl_format mesa_format); -unsigned r100_blit(GLcontext *ctx, +unsigned r100_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 0897dafbd8..0d1af726c0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -40,7 +40,7 @@ get_radeon_buffer_object(struct gl_buffer_object *obj) } static struct gl_buffer_object * -radeonNewBufferObject(GLcontext * ctx, +radeonNewBufferObject(struct gl_context * ctx, GLuint name, GLenum target) { @@ -57,7 +57,7 @@ radeonNewBufferObject(GLcontext * ctx, * Called via glDeleteBuffersARB(). */ static void -radeonDeleteBufferObject(GLcontext * ctx, +radeonDeleteBufferObject(struct gl_context * ctx, struct gl_buffer_object *obj) { struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj); @@ -82,7 +82,7 @@ radeonDeleteBufferObject(GLcontext * ctx, * \return GL_TRUE for success, GL_FALSE if out of memory */ static GLboolean -radeonBufferData(GLcontext * ctx, +radeonBufferData(struct gl_context * ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, @@ -129,7 +129,7 @@ radeonBufferData(GLcontext * ctx, * Called via glBufferSubDataARB(). */ static void -radeonBufferSubData(GLcontext * ctx, +radeonBufferSubData(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -154,7 +154,7 @@ radeonBufferSubData(GLcontext * ctx, * Called via glGetBufferSubDataARB() */ static void -radeonGetBufferSubData(GLcontext * ctx, +radeonGetBufferSubData(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -174,7 +174,7 @@ radeonGetBufferSubData(GLcontext * ctx, * Called via glMapBufferARB() */ static void * -radeonMapBuffer(GLcontext * ctx, +radeonMapBuffer(struct gl_context * ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) @@ -204,7 +204,7 @@ radeonMapBuffer(GLcontext * ctx, * Called via glUnmapBufferARB() */ static GLboolean -radeonUnmapBuffer(GLcontext * ctx, +radeonUnmapBuffer(struct gl_context * ctx, GLenum target, struct gl_buffer_object *obj) { diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index c1a660af3d..43a6355ad8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -201,7 +201,7 @@ void radeonSetCliprects(radeonContextPtr radeon) -void radeonUpdateScissor( GLcontext *ctx ) +void radeonUpdateScissor( struct gl_context *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); GLint x = ctx->Scissor.X, y = ctx->Scissor.Y; @@ -252,7 +252,7 @@ void radeonUpdateScissor( GLcontext *ctx ) * Scissoring */ -void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h) +void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (ctx->Scissor.Enabled) { @@ -578,7 +578,7 @@ void radeonSwapBuffers(__DRIdrawable * dPriv) if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { radeonContextPtr radeon; - GLcontext *ctx; + struct gl_context *ctx; radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate; ctx = radeon->glCtx; @@ -620,7 +620,7 @@ void radeonCopySubBuffer(__DRIdrawable * dPriv, { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { radeonContextPtr radeon; - GLcontext *ctx; + struct gl_context *ctx; radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate; ctx = radeon->glCtx; @@ -646,7 +646,7 @@ void radeonCopySubBuffer(__DRIdrawable * dPriv, * If so, set the intel->front_buffer_dirty field to true. */ void -radeon_check_front_buffer_rendering(GLcontext *ctx) +radeon_check_front_buffer_rendering(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); const struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -662,7 +662,7 @@ radeon_check_front_buffer_rendering(GLcontext *ctx) } -void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) +void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_renderbuffer *rrbDepth = NULL, *rrbStencil = NULL, @@ -817,7 +817,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) /** * Called via glDrawBuffer. */ -void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) +void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) { if (RADEON_DEBUG & RADEON_DRI) fprintf(stderr, "%s %s\n", __FUNCTION__, @@ -844,7 +844,7 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) radeon_draw_buffer(ctx, ctx->DrawBuffer); } -void radeonReadBuffer( GLcontext *ctx, GLenum mode ) +void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); @@ -891,11 +891,11 @@ void radeon_window_moved(radeonContextPtr radeon) } } -void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height) +void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); __DRIcontext *driContext = radeon->dri.context; - void (*old_viewport)(GLcontext *ctx, GLint x, GLint y, + void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); if (!driContext->driScreenPriv->dri2.enabled) @@ -1064,7 +1064,7 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean emitAll) COMMIT_BATCH(); } -static GLboolean radeon_revalidate_bos(GLcontext *ctx) +static GLboolean radeon_revalidate_bos(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); int ret; @@ -1104,7 +1104,7 @@ void radeonEmitState(radeonContextPtr radeon) } -void radeonFlush(GLcontext *ctx) +void radeonFlush(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_IOCTL) @@ -1145,7 +1145,7 @@ flush_front: /* Make sure all commands have been sent to the hardware and have * completed processing. */ -void radeonFinish(GLcontext * ctx) +void radeonFinish(struct gl_context * ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -1327,7 +1327,7 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n, } -void radeonUserClear(GLcontext *ctx, GLuint mask) +void radeonUserClear(struct gl_context *ctx, GLuint mask) { _mesa_meta_Clear(ctx, mask); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index 35b3f08fff..85a114623a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -5,11 +5,11 @@ #include "radeon_dma.h" #include "radeon_texture.h" -void radeonUserClear(GLcontext *ctx, GLuint mask); +void radeonUserClear(struct gl_context *ctx, GLuint mask); void radeonRecalcScissorRects(radeonContextPtr radeon); void radeonSetCliprects(radeonContextPtr radeon); -void radeonUpdateScissor( GLcontext *ctx ); -void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h); +void radeonUpdateScissor( struct gl_context *ctx ); +void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h); void radeonWaitForIdleLocked(radeonContextPtr radeon); extern uint32_t radeonGetAge(radeonContextPtr radeon); @@ -21,18 +21,18 @@ void radeonCopySubBuffer(__DRIdrawable * dPriv, void radeonUpdatePageFlipping(radeonContextPtr rmesa); -void radeonFlush(GLcontext *ctx); -void radeonFinish(GLcontext * ctx); +void radeonFlush(struct gl_context *ctx); +void radeonFinish(struct gl_context * ctx); void radeonEmitState(radeonContextPtr radeon); GLuint radeonCountStateEmitSize(radeonContextPtr radeon); -void radeon_clear_tris(GLcontext *ctx, GLbitfield mask); +void radeon_clear_tris(struct gl_context *ctx, GLbitfield mask); void radeon_window_moved(radeonContextPtr radeon); -void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb); -void radeonDrawBuffer( GLcontext *ctx, GLenum mode ); -void radeonReadBuffer( GLcontext *ctx, GLenum mode ); -void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height); +void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb); +void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ); +void radeonReadBuffer( struct gl_context *ctx, GLenum mode ); +void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height); void radeon_get_cliprects(radeonContextPtr radeon, struct drm_clip_rect **cliprects, unsigned int *num_cliprects, @@ -45,12 +45,12 @@ struct radeon_renderbuffer * radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv); void -radeonReadPixels(GLcontext * ctx, +radeonReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels); -void radeon_check_front_buffer_rendering(GLcontext *ctx); +void radeon_check_front_buffer_rendering(struct gl_context *ctx); static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb) { struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 68aacd7f16..40544860b3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -105,7 +105,7 @@ static const char* get_chip_family_name(int chip_family) /* Return various strings for glGetString(). */ -static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name) +static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); static char buffer[128]; @@ -186,8 +186,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon, { __DRIscreen *sPriv = driContextPriv->driScreenPriv; radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); - GLcontext* ctx; - GLcontext* shareCtx; + struct gl_context* ctx; + struct gl_context* shareCtx; int fthrottle_mode; /* Fill in additional standard functions. */ diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 5c3299f597..c62913afd0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -159,8 +159,8 @@ struct radeon_state_atom { GLuint *cmd; /* one or more cmd's */ GLuint *lastcmd; /* one or more cmd's */ GLboolean dirty; /* dirty-mark in emit_state_list */ - int (*check) (GLcontext *, struct radeon_state_atom *atom); /* is this state active? */ - void (*emit) (GLcontext *, struct radeon_state_atom *atom); + int (*check) (struct gl_context *, struct radeon_state_atom *atom); /* is this state active? */ + void (*emit) (struct gl_context *, struct radeon_state_atom *atom); }; struct radeon_hw_state { @@ -316,7 +316,7 @@ struct radeon_dma { * flush must be called before non-active vertex allocations can be * performed. */ - void (*flush) (GLcontext *); + void (*flush) (struct gl_context *); }; /* radeon_swtcl.c @@ -432,7 +432,7 @@ struct radeon_cmdbuf { }; struct radeon_context { - GLcontext *glCtx; + struct gl_context *glCtx; radeonScreenPtr radeonScreen; /* Screen private DRI data */ /* Texture object bookkeeping @@ -518,17 +518,17 @@ struct radeon_context { struct { void (*get_lock)(radeonContextPtr radeon); - void (*update_viewport_offset)(GLcontext *ctx); + void (*update_viewport_offset)(struct gl_context *ctx); void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa); - void (*swtcl_flush)(GLcontext *ctx, uint32_t offset); + void (*swtcl_flush)(struct gl_context *ctx, uint32_t offset); void (*pre_emit_atoms)(radeonContextPtr rmesa); void (*pre_emit_state)(radeonContextPtr rmesa); - void (*fallback)(GLcontext *ctx, GLuint bit, GLboolean mode); - void (*free_context)(GLcontext *ctx); + void (*fallback)(struct gl_context *ctx, GLuint bit, GLboolean mode); + void (*free_context)(struct gl_context *ctx); void (*emit_query_finish)(radeonContextPtr radeon); - void (*update_scissor)(GLcontext *ctx); + void (*update_scissor)(struct gl_context *ctx); unsigned (*check_blit)(gl_format mesa_format); - unsigned (*blit)(GLcontext *ctx, + unsigned (*blit)(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index c0b9a222c4..cc9590213c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -167,7 +167,7 @@ static void r100_vtbl_pre_emit_state(radeonContextPtr radeon) radeon->hw.is_dirty = 1; } -static void r100_vtbl_free_context(GLcontext *ctx) +static void r100_vtbl_free_context(struct gl_context *ctx) { r100ContextPtr rmesa = R100_CONTEXT(ctx); _mesa_vector4f_free( &rmesa->tcl.ObjClean ); @@ -214,7 +214,7 @@ r100CreateContext( gl_api api, radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); struct dd_function_table functions; r100ContextPtr rmesa; - GLcontext *ctx; + struct gl_context *ctx; int i; int tcl_mode, fthrottle_mode; diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 31a45169da..03d4e9656d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -133,7 +133,7 @@ void radeonEmitVec16(uint32_t *out, const GLvoid * data, int stride, int count) } } -void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, +void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos, const GLvoid * data, int size, int stride, int count) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -389,7 +389,7 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa) /* Flush vertices in the current dma region. */ -void rcommon_flush_last_swtcl_prim( GLcontext *ctx ) +void rcommon_flush_last_swtcl_prim( struct gl_context *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct radeon_dma *dma = &rmesa->dma; @@ -462,7 +462,7 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) return head; } -void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs ) +void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs ) { radeonContextPtr radeon = RADEON_CONTEXT( ctx ); int i; diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.h b/src/mesa/drivers/dri/radeon/radeon_dma.h index 74e653fd18..ad6a3b8baa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.h +++ b/src/mesa/drivers/dri/radeon/radeon_dma.h @@ -38,7 +38,7 @@ void radeonEmitVec8(uint32_t *out, const GLvoid * data, int stride, int count); void radeonEmitVec12(uint32_t *out, const GLvoid * data, int stride, int count); void radeonEmitVec16(uint32_t *out, const GLvoid * data, int stride, int count); -void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, +void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos, const GLvoid * data, int size, int stride, int count); void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes); @@ -50,9 +50,9 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa, int bytes, int alignment); void radeonReleaseDmaRegions(radeonContextPtr rmesa); -void rcommon_flush_last_swtcl_prim(GLcontext *ctx); +void rcommon_flush_last_swtcl_prim(struct gl_context *ctx); void *rcommonAllocDmaLowVerts(radeonContextPtr rmesa, int nverts, int vsize); void radeonFreeDmaRegions(radeonContextPtr rmesa); -void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs ); +void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 0597d4250d..2a6fbaeaf0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -47,7 +47,7 @@ } while(0) static struct gl_framebuffer * -radeon_new_framebuffer(GLcontext *ctx, GLuint name) +radeon_new_framebuffer(struct gl_context *ctx, GLuint name) { return _mesa_new_framebuffer(ctx, name); } @@ -70,7 +70,7 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb) } static void * -radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, +radeon_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { radeon_print(RADEON_TEXTURE, RADEON_TRACE, @@ -85,7 +85,7 @@ radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, * storage for a user-created renderbuffer. */ static GLboolean -radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -206,7 +206,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, * Not used for user-created renderbuffers! */ static GLboolean -radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +radeon_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(rb->Name == 0); @@ -223,7 +223,7 @@ radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, static void -radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, +radeon_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { struct radeon_framebuffer *radeon_fb = (struct radeon_framebuffer*)fb; @@ -255,7 +255,7 @@ radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, /** Dummy function for gl_renderbuffer::AllocStorage() */ static GLboolean -radeon_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +radeon_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { _mesa_problem(ctx, "radeon_op_alloc_storage should never be called."); @@ -352,7 +352,7 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv) } static struct gl_renderbuffer * -radeon_new_renderbuffer(GLcontext * ctx, GLuint name) +radeon_new_renderbuffer(struct gl_context * ctx, GLuint name) { struct radeon_renderbuffer *rrb; @@ -376,7 +376,7 @@ radeon_new_renderbuffer(GLcontext * ctx, GLuint name) } static void -radeon_bind_framebuffer(GLcontext * ctx, GLenum target, +radeon_bind_framebuffer(struct gl_context * ctx, GLenum target, struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { radeon_print(RADEON_TEXTURE, RADEON_TRACE, @@ -393,7 +393,7 @@ radeon_bind_framebuffer(GLcontext * ctx, GLenum target, } static void -radeon_framebuffer_renderbuffer(GLcontext * ctx, +radeon_framebuffer_renderbuffer(struct gl_context * ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { @@ -410,7 +410,7 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx, } static GLboolean -radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, +radeon_update_wrapper(struct gl_context *ctx, struct radeon_renderbuffer *rrb, struct gl_texture_image *texImage) { radeon_print(RADEON_TEXTURE, RADEON_TRACE, @@ -459,7 +459,7 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, static struct radeon_renderbuffer * -radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) +radeon_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage) { const GLuint name = ~0; /* not significant, but distinct for debugging */ struct radeon_renderbuffer *rrb; @@ -488,7 +488,7 @@ radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) } static void -radeon_render_texture(GLcontext * ctx, +radeon_render_texture(struct gl_context * ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { @@ -568,13 +568,13 @@ radeon_render_texture(GLcontext * ctx, } static void -radeon_finish_render_texture(GLcontext * ctx, +radeon_finish_render_texture(struct gl_context * ctx, struct gl_renderbuffer_attachment *att) { } static void -radeon_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); gl_format mesa_format; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index d08a82f1a5..a91d872779 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -178,7 +178,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, #endif } -void radeonFlushElts( GLcontext *ctx ) +void radeonFlushElts( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); BATCH_LOCALS(&rmesa->radeon); @@ -432,7 +432,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, */ #define RADEON_MAX_CLEARS 256 -static void radeonKernelClear(GLcontext *ctx, GLuint flags) +static void radeonKernelClear(struct gl_context *ctx, GLuint flags) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -555,7 +555,7 @@ static void radeonKernelClear(GLcontext *ctx, GLuint flags) UNLOCK_HARDWARE( &rmesa->radeon ); } -static void radeonClear( GLcontext *ctx, GLbitfield mask ) +static void radeonClear( struct gl_context *ctx, GLbitfield mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -629,7 +629,7 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask ) } } -void radeonInitIoctlFuncs( GLcontext *ctx ) +void radeonInitIoctlFuncs( struct gl_context *ctx ) { ctx->Driver.Clear = radeonClear; ctx->Driver.Finish = radeonFinish; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/src/mesa/drivers/dri/radeon/radeon_ioctl.h index deb53ae313..790205719b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.h +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.h @@ -50,7 +50,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, GLuint primitive, GLuint vertex_nr ); -extern void radeonFlushElts( GLcontext *ctx ); +extern void radeonFlushElts( struct gl_context *ctx ); extern GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, @@ -77,9 +77,9 @@ extern void radeonEmitWait( r100ContextPtr rmesa, GLuint flags ); extern void radeonFlushCmdBuf( r100ContextPtr rmesa, const char * ); -extern void radeonFlush( GLcontext *ctx ); -extern void radeonFinish( GLcontext *ctx ); -extern void radeonInitIoctlFuncs( GLcontext *ctx ); +extern void radeonFlush( struct gl_context *ctx ); +extern void radeonFinish( struct gl_context *ctx ); +extern void radeonInitIoctlFuncs( struct gl_context *ctx ); extern void radeonGetAllParams( r100ContextPtr rmesa ); extern void radeonSetUpAtomList( r100ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/radeon/radeon_maos.h b/src/mesa/drivers/dri/radeon/radeon_maos.h index b88eb198d5..0feea35815 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos.h @@ -37,6 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_context.h" -extern void radeonEmitArrays( GLcontext *ctx, GLuint inputs ); +extern void radeonEmitArrays( struct gl_context *ctx, GLuint inputs ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index d810e6080e..94fe7e4b9f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -48,7 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_maos.h" #include "radeon_tcl.h" -static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, +static void emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos, GLvoid *data, int stride, int count) { int i; @@ -121,7 +121,7 @@ static void emit_stq_vec(uint32_t *out, GLvoid *data, int stride, int count) -static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos, +static void emit_tex_vector(struct gl_context *ctx, struct radeon_aos *aos, GLvoid *data, int size, int stride, int count) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -182,7 +182,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos, /* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ -void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) +void radeonEmitArrays( struct gl_context *ctx, GLuint inputs ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index d764ccb982..b73fc8abfe 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -34,7 +34,7 @@ #define TCL_DEBUG 0 #endif -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest ) { diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index ad3bc2d23d..5dac2a362b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -54,7 +54,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. union emit_union { float f; GLuint ui; radeon_color_t rgba; }; static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void * ); + void (*emit)( struct gl_context *, GLuint, GLuint, void * ); GLuint vertex_size; GLuint vertex_format; } setup_tab[RADEON_TCL_MAX_SETUP]; @@ -307,7 +307,7 @@ static void init_tcl_verts( void ) } -void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) +void radeonEmitArrays( struct gl_context *ctx, GLuint inputs ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index ddfde3edaf..1fadad2756 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -578,7 +578,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, * If individual images are stored in different mipmap trees * use the mipmap tree that has the most of the correct data. */ -int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj) +int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c index 216eb932db..e44d6f2f8f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c +++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c @@ -86,7 +86,7 @@ static gl_format gl_format_and_type_to_mesa_format(GLenum format, GLenum type) } static GLboolean -do_blit_readpixels(GLcontext * ctx, +do_blit_readpixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) @@ -194,7 +194,7 @@ do_blit_readpixels(GLcontext * ctx, } void -radeonReadPixels(GLcontext * ctx, +radeonReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index 5b7178bcca..a45ca7cad0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -33,7 +33,7 @@ #include -static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) +static void radeonQueryGetResult(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -79,7 +79,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) radeon_bo_unmap(query->bo); } -static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id) +static struct gl_query_object * radeonNewQueryObject(struct gl_context *ctx, GLuint id) { struct radeon_query_object *query; @@ -95,7 +95,7 @@ static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id) return &query->Base; } -static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonDeleteQuery(struct gl_context *ctx, struct gl_query_object *q) { struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -108,7 +108,7 @@ static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q) free(query); } -static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonWaitQuery(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -125,7 +125,7 @@ static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q) } -static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonBeginQuery(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -148,7 +148,7 @@ static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q) radeon->hw.is_dirty = GL_TRUE; } -void radeonEmitQueryEnd(GLcontext *ctx) +void radeonEmitQueryEnd(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -168,7 +168,7 @@ void radeonEmitQueryEnd(GLcontext *ctx) radeon->vtbl.emit_query_finish(radeon); } -static void radeonEndQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonEndQuery(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); @@ -181,7 +181,7 @@ static void radeonEndQuery(GLcontext *ctx, struct gl_query_object *q) radeon->query.current = NULL; } -static void radeonCheckQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonCheckQuery(struct gl_context *ctx, struct gl_query_object *q) { radeon_print(RADEON_STATE, RADEON_TRACE, "%s: query id %d\n", __FUNCTION__, q->Id); @@ -219,7 +219,7 @@ void radeonInitQueryObjFunctions(struct dd_function_table *functions) functions->WaitQuery = radeonWaitQuery; } -int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom) +int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -229,7 +229,7 @@ int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom) return atom->cmd_size; } -void radeon_emit_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); BATCH_LOCALS(radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.h b/src/mesa/drivers/dri/radeon/radeon_queryobj.h index 19374dc76b..e506393482 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.h +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.h @@ -29,15 +29,15 @@ #include "main/simple_list.h" #include "radeon_common_context.h" -extern void radeonEmitQueryBegin(GLcontext *ctx); -extern void radeonEmitQueryEnd(GLcontext *ctx); +extern void radeonEmitQueryBegin(struct gl_context *ctx); +extern void radeonEmitQueryEnd(struct gl_context *ctx); extern void radeonInitQueryObjFunctions(struct dd_function_table *functions); #define RADEON_QUERY_PAGE_SIZE 4096 -int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom); -void radeon_emit_queryobj(GLcontext *ctx, struct radeon_state_atom *atom); +int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom); +void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom); static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ) { diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 9dfe2dd243..1c5326fe9d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -1015,7 +1015,7 @@ static void map_unmap_rb(struct gl_renderbuffer *rb, int flag) } static void -radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, +radeon_map_unmap_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLboolean map) { GLuint i, j; @@ -1060,7 +1060,7 @@ radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, radeon_check_front_buffer_rendering(ctx); } -static void radeonSpanRenderStart(GLcontext * ctx) +static void radeonSpanRenderStart(struct gl_context * ctx) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); int i; @@ -1087,7 +1087,7 @@ static void radeonSpanRenderStart(GLcontext * ctx) radeon_map_unmap_framebuffer(ctx, ctx->ReadBuffer, GL_TRUE); } -static void radeonSpanRenderFinish(GLcontext * ctx) +static void radeonSpanRenderFinish(struct gl_context * ctx) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); int i; @@ -1108,7 +1108,7 @@ static void radeonSpanRenderFinish(GLcontext * ctx) } } -void radeonInitSpanFuncs(GLcontext * ctx) +void radeonInitSpanFuncs(struct gl_context * ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_span.h b/src/mesa/drivers/dri/radeon/radeon_span.h index ea6a2e7fb4..64517b5923 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.h +++ b/src/mesa/drivers/dri/radeon/radeon_span.h @@ -42,6 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __RADEON_SPAN_H__ #define __RADEON_SPAN_H__ -extern void radeonInitSpanFuncs(GLcontext * ctx); +extern void radeonInitSpanFuncs(struct gl_context * ctx); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 539b067742..cae12f192c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -55,13 +55,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_tex.h" #include "radeon_swtcl.h" -static void radeonUpdateSpecular( GLcontext *ctx ); +static void radeonUpdateSpecular( struct gl_context *ctx ); /* ============================================================= * Alpha blending */ -static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void radeonAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC]; @@ -104,7 +104,7 @@ static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc; } -static void radeonBlendEquationSeparate( GLcontext *ctx, +static void radeonBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -144,7 +144,7 @@ static void radeonBlendEquationSeparate( GLcontext *ctx, } } -static void radeonBlendFuncSeparate( GLcontext *ctx, +static void radeonBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -256,7 +256,7 @@ static void radeonBlendFuncSeparate( GLcontext *ctx, * Depth testing */ -static void radeonDepthFunc( GLcontext *ctx, GLenum func ) +static void radeonDepthFunc( struct gl_context *ctx, GLenum func ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -292,7 +292,7 @@ static void radeonDepthFunc( GLcontext *ctx, GLenum func ) } -static void radeonDepthMask( GLcontext *ctx, GLboolean flag ) +static void radeonDepthMask( struct gl_context *ctx, GLboolean flag ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); RADEON_STATECHANGE( rmesa, ctx ); @@ -304,7 +304,7 @@ static void radeonDepthMask( GLcontext *ctx, GLboolean flag ) } } -static void radeonClearDepth( GLcontext *ctx, GLclampd d ) +static void radeonClearDepth( struct gl_context *ctx, GLclampd d ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] & @@ -326,7 +326,7 @@ static void radeonClearDepth( GLcontext *ctx, GLclampd d ) */ -static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void radeonFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); union { int i; float f; } c, d; @@ -411,7 +411,7 @@ static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Culling */ -static void radeonCullFace( GLcontext *ctx, GLenum unused ) +static void radeonCullFace( struct gl_context *ctx, GLenum unused ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -448,7 +448,7 @@ static void radeonCullFace( GLcontext *ctx, GLenum unused ) } } -static void radeonFrontFace( GLcontext *ctx, GLenum mode ) +static void radeonFrontFace( struct gl_context *ctx, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -477,7 +477,7 @@ static void radeonFrontFace( GLcontext *ctx, GLenum mode ) /* ============================================================= * Line state */ -static void radeonLineWidth( GLcontext *ctx, GLfloat widthf ) +static void radeonLineWidth( struct gl_context *ctx, GLfloat widthf ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -494,7 +494,7 @@ static void radeonLineWidth( GLcontext *ctx, GLfloat widthf ) } } -static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) +static void radeonLineStipple( struct gl_context *ctx, GLint factor, GLushort pattern ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -507,7 +507,7 @@ static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) /* ============================================================= * Masks */ -static void radeonColorMask( GLcontext *ctx, +static void radeonColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -536,7 +536,7 @@ static void radeonColorMask( GLcontext *ctx, * Polygon state */ -static void radeonPolygonOffset( GLcontext *ctx, +static void radeonPolygonOffset( struct gl_context *ctx, GLfloat factor, GLfloat units ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -549,7 +549,7 @@ static void radeonPolygonOffset( GLcontext *ctx, rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32; } -static void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ) +static void radeonPolygonStipplePreKMS( struct gl_context *ctx, const GLubyte *mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint i; @@ -574,7 +574,7 @@ static void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ) UNLOCK_HARDWARE( &rmesa->radeon ); } -static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) +static void radeonPolygonMode( struct gl_context *ctx, GLenum face, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; @@ -601,7 +601,7 @@ static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) /* Examine lighting and texture state to determine if separate specular * should be enabled. */ -static void radeonUpdateSpecular( GLcontext *ctx ) +static void radeonUpdateSpecular( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); uint32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL]; @@ -689,7 +689,7 @@ static void radeonUpdateSpecular( GLcontext *ctx ) /* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ -static void update_global_ambient( GLcontext *ctx ) +static void update_global_ambient( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); float *fcmd = (float *)RADEON_DB_STATE( glt ); @@ -719,7 +719,7 @@ static void update_global_ambient( GLcontext *ctx ) * - light[p].colors * - light[p].enabled */ -static void update_light_colors( GLcontext *ctx, GLuint p ) +static void update_light_colors( struct gl_context *ctx, GLuint p ) { struct gl_light *l = &ctx->Light.Light[p]; @@ -739,7 +739,7 @@ static void update_light_colors( GLcontext *ctx, GLuint p ) /* Also fallback for asym colormaterial mode in twoside lighting... */ -static void check_twoside_fallback( GLcontext *ctx ) +static void check_twoside_fallback( struct gl_context *ctx ) { GLboolean fallback = GL_FALSE; GLint i; @@ -764,7 +764,7 @@ static void check_twoside_fallback( GLcontext *ctx ) } -static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) +static void radeonColorMaterial( struct gl_context *ctx, GLenum face, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]; @@ -828,7 +828,7 @@ static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) } } -void radeonUpdateMaterial( GLcontext *ctx ) +void radeonUpdateMaterial( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLfloat (*mat)[4] = ctx->Light.Material.Attrib; @@ -893,7 +893,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW * and _MESA_NEW_NEED_EYE_COORDS. */ -static void update_light( GLcontext *ctx ) +static void update_light( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -957,7 +957,7 @@ static void update_light( GLcontext *ctx ) } } -static void radeonLightfv( GLcontext *ctx, GLenum light, +static void radeonLightfv( struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1078,7 +1078,7 @@ static void radeonLightfv( GLcontext *ctx, GLenum light, -static void radeonLightModelfv( GLcontext *ctx, GLenum pname, +static void radeonLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1120,7 +1120,7 @@ static void radeonLightModelfv( GLcontext *ctx, GLenum pname, } } -static void radeonShadeModel( GLcontext *ctx, GLenum mode ) +static void radeonShadeModel( struct gl_context *ctx, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -1158,7 +1158,7 @@ static void radeonShadeModel( GLcontext *ctx, GLenum mode ) * User clip planes */ -static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void radeonClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0; r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1171,7 +1171,7 @@ static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) rmesa->hw.ucp[p].cmd[UCP_W] = ip[3]; } -static void radeonUpdateClipPlanes( GLcontext *ctx ) +static void radeonUpdateClipPlanes( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint p; @@ -1195,7 +1195,7 @@ static void radeonUpdateClipPlanes( GLcontext *ctx ) */ static void -radeonStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +radeonStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1240,7 +1240,7 @@ radeonStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -radeonStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +radeonStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1250,7 +1250,7 @@ radeonStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) ((ctx->Stencil.WriteMask[0] & 0xff) << RADEON_STENCIL_WRITEMASK_SHIFT); } -static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, +static void radeonStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1370,7 +1370,7 @@ static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, } } -static void radeonClearStencil( GLcontext *ctx, GLint s ) +static void radeonClearStencil( struct gl_context *ctx, GLint s ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1396,7 +1396,7 @@ static void radeonClearStencil( GLcontext *ctx, GLint s ) * Called when window size or position changes or viewport or depth range * state is changed. We update the hardware viewport state here. */ -void radeonUpdateWindow( GLcontext *ctx ) +void radeonUpdateWindow( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1433,7 +1433,7 @@ void radeonUpdateWindow( GLcontext *ctx ) } -static void radeonViewport( GLcontext *ctx, GLint x, GLint y, +static void radeonViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { /* Don't pipeline viewport changes, conflict with window offset @@ -1445,13 +1445,13 @@ static void radeonViewport( GLcontext *ctx, GLint x, GLint y, radeon_viewport(ctx, x, y, width, height); } -static void radeonDepthRange( GLcontext *ctx, GLclampd nearval, +static void radeonDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { radeonUpdateWindow( ctx ); } -void radeonUpdateViewportOffset( GLcontext *ctx ) +void radeonUpdateViewportOffset( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1507,7 +1507,7 @@ void radeonUpdateViewportOffset( GLcontext *ctx ) * Miscellaneous */ -static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] ) +static void radeonClearColor( struct gl_context *ctx, const GLfloat color[4] ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLubyte c[4]; @@ -1526,7 +1526,7 @@ static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] ) } -static void radeonRenderMode( GLcontext *ctx, GLenum mode ) +static void radeonRenderMode( struct gl_context *ctx, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); FALLBACK( rmesa, RADEON_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -1552,7 +1552,7 @@ static GLuint radeon_rop_tab[] = { RADEON_ROP_SET, }; -static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode ) +static void radeonLogicOpCode( struct gl_context *ctx, GLenum opcode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint rop = (GLuint)opcode - GL_CLEAR; @@ -1567,7 +1567,7 @@ static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode ) * State enable/disable */ -static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void radeonEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint p, flag; @@ -1860,7 +1860,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) } -static void radeonLightingSpaceChange( GLcontext *ctx ) +static void radeonLightingSpaceChange( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean tmp; @@ -1995,7 +1995,7 @@ static void upload_matrix_t( r100ContextPtr rmesa, GLfloat *src, int idx ) } -static void update_texturematrix( GLcontext *ctx ) +static void update_texturematrix( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); GLuint tpc = rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL]; @@ -2061,7 +2061,7 @@ static void update_texturematrix( GLcontext *ctx ) } } -static GLboolean r100ValidateBuffers(GLcontext *ctx) +static GLboolean r100ValidateBuffers(struct gl_context *ctx) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -2105,7 +2105,7 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) return GL_TRUE; } -GLboolean radeonValidateState( GLcontext *ctx ) +GLboolean radeonValidateState( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint new_state = rmesa->radeon.NewGLState; @@ -2163,7 +2163,7 @@ GLboolean radeonValidateState( GLcontext *ctx ) } -static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) +static void radeonInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -2176,7 +2176,7 @@ static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) /* A hack. Need a faster way to find this out. */ -static GLboolean check_material( GLcontext *ctx ) +static GLboolean check_material( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; @@ -2192,7 +2192,7 @@ static GLboolean check_material( GLcontext *ctx ) } -static void radeonWrapRunPipeline( GLcontext *ctx ) +static void radeonWrapRunPipeline( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean has_material; @@ -2221,7 +2221,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) } } -static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void radeonPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { r100ContextPtr r100 = R100_CONTEXT(ctx); GLint i; @@ -2242,7 +2242,7 @@ static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask ) * Many of the ctx->Driver functions might have been initialized to * software defaults in the earlier _mesa_init_driver_functions() call. */ -void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 ) +void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2 ) { ctx->Driver.UpdateState = radeonInvalidateState; ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h index c780cff0cf..9a011e11b2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.h +++ b/src/mesa/drivers/dri/radeon/radeon_state.h @@ -40,20 +40,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_context.h" extern void radeonInitState( r100ContextPtr rmesa ); -extern void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2); +extern void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2); -extern void radeonUpdateMaterial( GLcontext *ctx ); +extern void radeonUpdateMaterial( struct gl_context *ctx ); -extern void radeonUpdateViewportOffset( GLcontext *ctx ); -extern void radeonUpdateWindow( GLcontext *ctx ); -extern void radeonUpdateDrawBuffer( GLcontext *ctx ); +extern void radeonUpdateViewportOffset( struct gl_context *ctx ); +extern void radeonUpdateWindow( struct gl_context *ctx ); +extern void radeonUpdateDrawBuffer( struct gl_context *ctx ); extern void radeonUploadTexMatrix( r100ContextPtr rmesa, int unit, GLboolean swapcols ); -extern GLboolean radeonValidateState( GLcontext *ctx ); +extern GLboolean radeonValidateState( struct gl_context *ctx ); -extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) do { \ if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \ __FUNCTION__, bit, mode ); \ diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index 91718a4777..698efb145c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -195,13 +195,13 @@ static int cmdscl( int offset, int stride, int count ) } #define CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ return FLAG ? atom->cmd_size + (ADD) : 0; \ } #define TCL_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ r100ContextPtr rmesa = R100_CONTEXT(ctx); \ return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ @@ -294,7 +294,7 @@ CHECK( txr2, (ctx->Texture.Unit[2]._ReallyEnabled & TEXTURE_RECT_BIT), 0 ) OUT_BATCH_TABLE((data), h.scalars.count); \ } while(0) -static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void scl_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -306,7 +306,7 @@ static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) } -static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void vec_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -318,7 +318,7 @@ static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) } -static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void lit_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -330,7 +330,7 @@ static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -395,7 +395,7 @@ static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always_ctx( struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); struct radeon_renderbuffer *rrb, *drb; @@ -417,7 +417,7 @@ static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) return dwords; } -static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -512,7 +512,7 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -540,7 +540,7 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -576,7 +576,7 @@ static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -611,7 +611,7 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -666,7 +666,7 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) */ void radeonInitState( r100ContextPtr rmesa ) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; GLuint i; rmesa->radeon.state.color.clear = 0x00000000; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 29defe73a7..f5b0df6ef5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -87,7 +87,7 @@ static GLuint radeon_cp_vc_frmts[3][2] = { RADEON_CP_VC_FRMT_ST2, RADEON_CP_VC_FRMT_ST2 | RADEON_CP_VC_FRMT_Q2 }, }; -static void radeonSetVertexFormat( GLcontext *ctx ) +static void radeonSetVertexFormat( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -243,7 +243,7 @@ static void radeon_predict_emit_size( r100ContextPtr rmesa ) } } -static void radeonRenderStart( GLcontext *ctx ) +static void radeonRenderStart( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); @@ -260,7 +260,7 @@ static void radeonRenderStart( GLcontext *ctx ) * determine in advance whether or not the hardware can / should do the * projection divide or Mesa should do it. */ -void radeonChooseVertexState( GLcontext *ctx ) +void radeonChooseVertexState( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -302,7 +302,7 @@ void radeonChooseVertexState( GLcontext *ctx ) } } -void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset) +void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -398,7 +398,7 @@ static void* radeon_alloc_verts( r100ContextPtr rmesa , GLuint nr, GLuint size ) /**********************************************************************/ -static GLboolean radeon_run_render( GLcontext *ctx, +static GLboolean radeon_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -467,9 +467,9 @@ static const GLuint reduced_hw_prim[GL_POLYGON+1] = { RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST }; -static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim ); -static void radeonResetLineStipple( GLcontext *ctx ); +static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim ); +static void radeonResetLineStipple( struct gl_context *ctx ); /*********************************************************************** @@ -678,7 +678,7 @@ static void init_rast_tab( void ) /* Choose render functions */ /**********************************************************************/ -void radeonChooseRenderState( GLcontext *ctx ) +void radeonChooseRenderState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -718,7 +718,7 @@ void radeonChooseRenderState( GLcontext *ctx ) /**********************************************************************/ -static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -728,7 +728,7 @@ static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); rmesa->radeon.swtcl.render_primitive = prim; @@ -736,11 +736,11 @@ static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim ) radeonRasterPrimitive( ctx, reduced_hw_prim[prim] ); } -static void radeonRenderFinish( GLcontext *ctx ) +static void radeonRenderFinish( struct gl_context *ctx ) { } -static void radeonResetLineStipple( GLcontext *ctx ) +static void radeonResetLineStipple( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); RADEON_STATECHANGE( rmesa, lin ); @@ -774,7 +774,7 @@ static const char *getFallbackString(GLuint bit) } -void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -831,7 +831,7 @@ void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void radeonInitSwtcl( GLcontext *ctx ) +void radeonInitSwtcl( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r100ContextPtr rmesa = R100_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.h b/src/mesa/drivers/dri/radeon/radeon_swtcl.h index da89158eeb..ce2aa1e4c3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.h +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.h @@ -39,28 +39,28 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "radeon_context.h" -extern void radeonInitSwtcl( GLcontext *ctx ); +extern void radeonInitSwtcl( struct gl_context *ctx ); -extern void radeonChooseRenderState( GLcontext *ctx ); -extern void radeonChooseVertexState( GLcontext *ctx ); +extern void radeonChooseRenderState( struct gl_context *ctx ); +extern void radeonChooseVertexState( struct gl_context *ctx ); -extern void radeonCheckTexSizes( GLcontext *ctx ); +extern void radeonCheckTexSizes( struct gl_context *ctx ); -extern void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count, +extern void radeonBuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void radeonPrintSetupFlags(char *msg, GLuint flags ); -extern void radeon_emit_indexed_verts( GLcontext *ctx, +extern void radeon_emit_indexed_verts( struct gl_context *ctx, GLuint start, GLuint count ); -extern void radeon_translate_vertex( GLcontext *ctx, +extern void radeon_translate_vertex( struct gl_context *ctx, const radeonVertex *src, SWvertex *dst ); -extern void radeon_print_vertex( GLcontext *ctx, const radeonVertex *v ); +extern void radeon_print_vertex( struct gl_context *ctx, const radeonVertex *v ); -extern void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset); +extern void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 5e1718f9df..c59b413012 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -164,7 +164,7 @@ static GLushort *radeonAllocElts( r100ContextPtr rmesa, GLuint nr ) * discrete and there are no intervening state changes. (Somewhat * duplicates changes to DrawArrays code) */ -static void radeonEmitPrim( GLcontext *ctx, +static void radeonEmitPrim( struct gl_context *ctx, GLenum prim, GLuint hwprim, GLuint start, @@ -228,7 +228,7 @@ static void radeonEmitPrim( GLcontext *ctx, /* External entrypoints */ /**********************************************************************/ -void radeonEmitPrimitive( GLcontext *ctx, +void radeonEmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -236,7 +236,7 @@ void radeonEmitPrimitive( GLcontext *ctx, tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void radeonEmitEltPrimitive( GLcontext *ctx, +void radeonEmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -244,7 +244,7 @@ void radeonEmitEltPrimitive( GLcontext *ctx, tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void radeonTclPrimitive( GLcontext *ctx, +void radeonTclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ) { @@ -326,7 +326,7 @@ radeonInitStaticFogData( void ) * Fog blend factors are in the range [0,1]. */ float -radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) +radeonComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ) { GLfloat end = ctx->Fog.End; GLfloat d, temp; @@ -361,7 +361,7 @@ radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) * Predict total emit size for next rendering operation so there is no flush in middle of rendering * Prediction has to aim towards the best possible value that is worse than worst case scenario */ -static GLuint radeonEnsureEmitSize( GLcontext * ctx , GLuint inputs ) +static GLuint radeonEnsureEmitSize( struct gl_context * ctx , GLuint inputs ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -432,7 +432,7 @@ static GLuint radeonEnsureEmitSize( GLcontext * ctx , GLuint inputs ) /* TCL render. */ -static GLboolean radeon_run_tcl_render( GLcontext *ctx, +static GLboolean radeon_run_tcl_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -529,7 +529,7 @@ const struct tnl_pipeline_stage _radeon_tcl_stage = */ -static void transition_to_swtnl( GLcontext *ctx ) +static void transition_to_swtnl( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -558,7 +558,7 @@ static void transition_to_swtnl( GLcontext *ctx ) } -static void transition_to_hwtnl( GLcontext *ctx ) +static void transition_to_hwtnl( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -618,7 +618,7 @@ static char *getFallbackString(GLuint bit) -void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void radeonTclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint oldfallback = rmesa->radeon.TclFallback; diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.h b/src/mesa/drivers/dri/radeon/radeon_tcl.h index dccbea5fdb..cf19766b9f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.h +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.h @@ -38,16 +38,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_context.h" -extern void radeonTclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim ); -extern void radeonEmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void radeonTclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ); +extern void radeonEmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void radeonEmitPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void radeonEmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void radeonTclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); extern void radeonInitStaticFogData( void ); -extern float radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ); +extern float radeonComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ); #define RADEON_TCL_FALLBACK_RASTER 0x1 /* rasterization */ #define RADEON_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */ diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index c66e5d17b1..d5285e24cd 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -253,7 +253,7 @@ static void radeonSetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] ) #define SCALED_FLOAT_TO_BYTE( x, scale ) \ (((GLuint)((255.0F / scale) * (x))) / 2) -static void radeonTexEnv( GLcontext *ctx, GLenum target, +static void radeonTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -316,7 +316,7 @@ static void radeonTexEnv( GLcontext *ctx, GLenum target, * next UpdateTextureState */ -static void radeonTexParameter( GLcontext *ctx, GLenum target, +static void radeonTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ) { @@ -354,7 +354,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target, } } -static void radeonDeleteTexture( GLcontext *ctx, +static void radeonDeleteTexture( struct gl_context *ctx, struct gl_texture_object *texObj ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -392,7 +392,7 @@ static void radeonDeleteTexture( GLcontext *ctx, * Basically impossible to do this on the fly - just collect some * basic info & do the checks from ValidateState(). */ -static void radeonTexGen( GLcontext *ctx, +static void radeonTexGen( struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params ) @@ -409,7 +409,7 @@ static void radeonTexGen( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj); diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.h b/src/mesa/drivers/dri/radeon/radeon_tex.h index 0113ffd3da..05729f1e0b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.h +++ b/src/mesa/drivers/dri/radeon/radeon_tex.h @@ -45,7 +45,7 @@ extern void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawabl extern void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv); -extern void radeonUpdateTextureState( GLcontext *ctx ); +extern void radeonUpdateTextureState( struct gl_context *ctx ); extern int radeonUploadTexImages( r100ContextPtr rmesa, radeonTexObjPtr t, GLuint face ); diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c index 4cb0bb60c8..f14dfa25d4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c @@ -37,7 +37,7 @@ #include "radeon_mipmap_tree.h" static GLboolean -do_copy_texsubimage(GLcontext *ctx, +do_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level, struct radeon_tex_obj *tobj, radeon_texture_image *timg, @@ -141,7 +141,7 @@ do_copy_texsubimage(GLcontext *ctx, } void -radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) @@ -196,7 +196,7 @@ fail: } void -radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c index f878b48e5f..4a73089ce1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c @@ -40,7 +40,7 @@ * then unmap it. */ static void -radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level, +radeon_get_tex_image(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage, int compressed) @@ -83,7 +83,7 @@ radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level, } void -radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level, +radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -93,7 +93,7 @@ radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level, } void -radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index f852116dee..dd8ecdd500 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -260,7 +260,7 @@ do { \ * Texture unit state management */ -static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit ) +static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -885,7 +885,7 @@ static void set_texgen_matrix( r100ContextPtr rmesa, /* Returns GL_FALSE if fallback required. */ -static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit ) +static GLboolean radeon_validate_texgen( struct gl_context *ctx, GLuint unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -1085,7 +1085,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int return GL_TRUE; } -static GLboolean radeon_validate_texture(GLcontext *ctx, struct gl_texture_object *texObj, int unit) +static GLboolean radeon_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit) { r100ContextPtr rmesa = R100_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -1128,7 +1128,7 @@ static GLboolean radeon_validate_texture(GLcontext *ctx, struct gl_texture_objec return !t->border_fallback; } -static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) +static GLboolean radeonUpdateTextureUnit( struct gl_context *ctx, int unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1155,7 +1155,7 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) return GL_TRUE; } -void radeonUpdateTextureState( GLcontext *ctx ) +void radeonUpdateTextureState( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean ok; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index d1ebd83550..18ccb512d7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -76,7 +76,7 @@ void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, /** * Allocate an empty texture image object. */ -struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx) +struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx) { return CALLOC(sizeof(radeon_texture_image)); } @@ -84,7 +84,7 @@ struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx) /** * Free memory associated with this texture image. */ -void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage) +void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage) { radeon_texture_image* image = get_radeon_texture_image(timage); @@ -154,7 +154,7 @@ void radeon_teximage_unmap(radeon_texture_image *image) } } -static void map_override(GLcontext *ctx, radeonTexObj *t) +static void map_override(struct gl_context *ctx, radeonTexObj *t) { radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]); @@ -163,7 +163,7 @@ static void map_override(GLcontext *ctx, radeonTexObj *t) img->base.Data = t->bo->ptr; } -static void unmap_override(GLcontext *ctx, radeonTexObj *t) +static void unmap_override(struct gl_context *ctx, radeonTexObj *t) { radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]); @@ -175,7 +175,7 @@ static void unmap_override(GLcontext *ctx, radeonTexObj *t) /** * Map a validated texture for reading during software rendering. */ -void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj) +void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj) { radeonTexObj* t = radeon_tex_obj(texObj); int face, level; @@ -213,7 +213,7 @@ void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj) } } -void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj) +void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj) { radeonTexObj* t = radeon_tex_obj(texObj); int face, level; @@ -241,7 +241,7 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj) * This relies on internal details of _mesa_generate_mipmap, in particular * the fact that the memory for recreated texture images is always freed. */ -static void radeon_generate_mipmap(GLcontext *ctx, GLenum target, +static void radeon_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { radeonTexObj* t = radeon_tex_obj(texObj); @@ -273,7 +273,7 @@ static void radeon_generate_mipmap(GLcontext *ctx, GLenum target, } -void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj) +void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct radeon_bo *bo; @@ -338,7 +338,7 @@ static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa, return _dri_texformat_argb8888; } -gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, +gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type) @@ -347,7 +347,7 @@ gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, type, 0); } -gl_format radeonChooseTextureFormat(GLcontext * ctx, +gl_format radeonChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type, GLboolean fbo) @@ -641,7 +641,7 @@ static void teximage_assign_miptree(radeonContextPtr rmesa, "%s Failed to allocate miptree.\n", __func__); } -static GLuint * allocate_image_offsets(GLcontext *ctx, +static GLuint * allocate_image_offsets(struct gl_context *ctx, unsigned alignedWidth, unsigned height, unsigned depth) @@ -665,7 +665,7 @@ static GLuint * allocate_image_offsets(GLcontext *ctx, /** * Update a subregion of the given texture image. */ -static void radeon_store_teximage(GLcontext* ctx, int dims, +static void radeon_store_teximage(struct gl_context* ctx, int dims, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, @@ -758,7 +758,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, * All glTexImage calls go through this function. */ static void radeon_teximage( - GLcontext *ctx, int dims, + struct gl_context *ctx, int dims, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, @@ -833,7 +833,7 @@ static void radeon_teximage( _mesa_unmap_teximage_pbo(ctx, packing); } -void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid * pixels, @@ -845,7 +845,7 @@ void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, 0, format, type, pixels, packing, texObj, texImage, 0); } -void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid * pixels, @@ -858,7 +858,7 @@ void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, 0, format, type, pixels, packing, texObj, texImage, 0); } -void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid * data, @@ -869,7 +869,7 @@ void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, imageSize, 0, 0, data, &ctx->Unpack, texObj, texImage, 1); } -void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, @@ -885,7 +885,7 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, /** * All glTexSubImage calls go through this function. */ -static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int level, +static void radeon_texsubimage(struct gl_context* ctx, int dims, GLenum target, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, @@ -939,7 +939,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve _mesa_unmap_teximage_pbo(ctx, packing); } -void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -952,7 +952,7 @@ void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, format, type, pixels, packing, texObj, texImage, 0); } -void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -966,7 +966,7 @@ void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, 0); } -void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, @@ -979,7 +979,7 @@ void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, } -void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 4ce639ea34..9138a7d554 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -35,47 +35,47 @@ void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, GLuint numrows, GLuint rowsize); -struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx); -void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage); +struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx); +void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage); void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable); void radeon_teximage_unmap(radeon_texture_image *image); -void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj); -void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj); -void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj); -int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj); +void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj); +void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj); +void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj); +int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj); -gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, +gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type); -gl_format radeonChooseTextureFormat(GLcontext * ctx, +gl_format radeonChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type, GLboolean fbo); -void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid * pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid * pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid * data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, @@ -83,7 +83,7 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -91,7 +91,7 @@ void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -99,7 +99,7 @@ void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, @@ -107,7 +107,7 @@ void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, @@ -116,21 +116,21 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level, +void radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +void radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +void radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +void radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index a8ba033411..b3aaa0e504 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -291,7 +291,7 @@ savageCreateContext( gl_api api, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; savageContextPtr imesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct dd_function_table functions; diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h index 6723456ec9..75bec62fa8 100644 --- a/src/mesa/drivers/dri/savage/savagecontext.h +++ b/src/mesa/drivers/dri/savage/savagecontext.h @@ -148,7 +148,7 @@ struct savage_elt_t { struct savage_context_t { GLint refcount; - GLcontext *glCtx; + struct gl_context *glCtx; int lastTexHeap; driTexHeap *textureHeaps[SAVAGE_NR_TEX_HEAPS]; diff --git a/src/mesa/drivers/dri/savage/savagedd.c b/src/mesa/drivers/dri/savage/savagedd.c index bbf49aec27..3f8d7aafb0 100644 --- a/src/mesa/drivers/dri/savage/savagedd.c +++ b/src/mesa/drivers/dri/savage/savagedd.c @@ -45,7 +45,7 @@ ***************************************/ -static const GLubyte *savageDDGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *savageDDGetString( struct gl_context *ctx, GLenum name ) { static char *cardNames[S3_LAST] = { "Unknown", @@ -79,7 +79,7 @@ static const GLubyte *savageDDGetString( GLcontext *ctx, GLenum name ) } } #if 0 -static GLint savageGetParameteri(const GLcontext *ctx, GLint param) +static GLint savageGetParameteri(const struct gl_context *ctx, GLint param) { switch (param) { case DD_HAVE_HARDWARE_FOG: @@ -91,7 +91,7 @@ static GLint savageGetParameteri(const GLcontext *ctx, GLint param) #endif -void savageDDInitDriverFuncs( GLcontext *ctx ) +void savageDDInitDriverFuncs( struct gl_context *ctx ) { ctx->Driver.GetString = savageDDGetString; } diff --git a/src/mesa/drivers/dri/savage/savagedd.h b/src/mesa/drivers/dri/savage/savagedd.h index 698a8d5de9..c526141299 100644 --- a/src/mesa/drivers/dri/savage/savagedd.h +++ b/src/mesa/drivers/dri/savage/savagedd.h @@ -28,5 +28,5 @@ #include "main/context.h" -void savageDDInitDriverFuncs( GLcontext *ctx ); +void savageDDInitDriverFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 9e181ce3be..46bbb653b8 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -119,7 +119,7 @@ void savageGetDMABuffer( savageContextPtr imesa ) #if 0 /* Still keeping this around because it demonstrates page flipping and * automatic z-clear. */ -static void savage_BCI_clear(GLcontext *ctx, drm_savage_clear_t *pclear) +static void savage_BCI_clear(struct gl_context *ctx, drm_savage_clear_t *pclear) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); int nbox = imesa->sarea->nbox; @@ -325,7 +325,7 @@ static GLuint savageIntersectClipRects(drm_clip_rect_t *dest, } -static void savageDDClear( GLcontext *ctx, GLbitfield mask ) +static void savageDDClear( struct gl_context *ctx, GLbitfield mask ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); GLuint colorMask, depthMask, clearColor, clearDepth, flags; @@ -635,7 +635,7 @@ void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ) } -static void savageDDFlush( GLcontext *ctx ) +static void savageDDFlush( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) @@ -644,7 +644,7 @@ static void savageDDFlush( GLcontext *ctx ) savageFlushCmdBuf(imesa, GL_FALSE); } -static void savageDDFinish( GLcontext *ctx ) +static void savageDDFinish( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) @@ -654,7 +654,7 @@ static void savageDDFinish( GLcontext *ctx ) WAIT_IDLE_EMPTY(imesa); } -void savageDDInitIoctlFuncs( GLcontext *ctx ) +void savageDDInitIoctlFuncs( struct gl_context *ctx ) { ctx->Driver.Clear = savageDDClear; ctx->Driver.Flush = savageDDFlush; diff --git a/src/mesa/drivers/dri/savage/savageioctl.h b/src/mesa/drivers/dri/savage/savageioctl.h index e7e80816c1..7d34825c29 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.h +++ b/src/mesa/drivers/dri/savage/savageioctl.h @@ -37,7 +37,7 @@ void savageWaitEvent( savageContextPtr imesa, unsigned int event); void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard ); void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ); -void savageDDInitIoctlFuncs( GLcontext *ctx ); +void savageDDInitIoctlFuncs( struct gl_context *ctx ); void savageSwapBuffers( __DRIdrawable *dPriv ); diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index 2d9e80e29c..8cc448ad4f 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -142,7 +142,7 @@ /* Render pipeline stage */ /**********************************************************************/ -static GLboolean savage_run_render( GLcontext *ctx, +static GLboolean savage_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -234,7 +234,7 @@ struct texnorm_stage_data { #define TEXNORM_STAGE_DATA(stage) ((struct texnorm_stage_data *)stage->privatePtr) -static GLboolean run_texnorm_stage( GLcontext *ctx, +static GLboolean run_texnorm_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage); @@ -307,7 +307,7 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_texnorm_data( GLcontext *ctx, +static GLboolean alloc_texnorm_data( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -325,7 +325,7 @@ static GLboolean alloc_texnorm_data( GLcontext *ctx, return GL_TRUE; } -static void validate_texnorm( GLcontext *ctx, +static void validate_texnorm( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage); diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c index 735aac50fd..8542f47fd9 100644 --- a/src/mesa/drivers/dri/savage/savagespan.c +++ b/src/mesa/drivers/dri/savage/savagespan.c @@ -187,7 +187,7 @@ * the frame buffer. */ static void -savageCopyPixels( GLcontext *ctx, +savageCopyPixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) @@ -198,7 +198,7 @@ savageCopyPixels( GLcontext *ctx, _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type); } static void -savageDrawPixels( GLcontext *ctx, +savageDrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -211,7 +211,7 @@ savageDrawPixels( GLcontext *ctx, _swrast_DrawPixels(ctx, x, y, width, height, format, type, packing, pixels); } static void -savageReadPixels( GLcontext *ctx, +savageReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -226,7 +226,7 @@ savageReadPixels( GLcontext *ctx, /* * Make sure the hardware is idle when span-rendering. */ -static void savageSpanRenderStart( GLcontext *ctx ) +static void savageSpanRenderStart( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); FLUSH_BATCH(imesa); @@ -234,7 +234,7 @@ static void savageSpanRenderStart( GLcontext *ctx ) } -void savageDDInitSpanFuncs( GLcontext *ctx ) +void savageDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = savageSpanRenderStart; diff --git a/src/mesa/drivers/dri/savage/savagespan.h b/src/mesa/drivers/dri/savage/savagespan.h index 00094e255e..41d6f75cbb 100644 --- a/src/mesa/drivers/dri/savage/savagespan.h +++ b/src/mesa/drivers/dri/savage/savagespan.h @@ -28,7 +28,7 @@ #include "drirenderbuffer.h" -extern void savageDDInitSpanFuncs( GLcontext *ctx ); +extern void savageDDInitSpanFuncs( struct gl_context *ctx ); extern void savageSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis, diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 84e1b52585..0906f85b1f 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -73,8 +73,8 @@ #define S3D_TR 15 -static void savageBlendFunc_s4(GLcontext *); -static void savageBlendFunc_s3d(GLcontext *); +static void savageBlendFunc_s4(struct gl_context *); +static void savageBlendFunc_s3d(struct gl_context *); static INLINE GLuint savagePackColor(GLuint format, GLubyte r, GLubyte g, @@ -92,16 +92,16 @@ static INLINE GLuint savagePackColor(GLuint format, } -static void savageDDAlphaFunc_s4(GLcontext *ctx, GLenum func, GLfloat ref) +static void savageDDAlphaFunc_s4(struct gl_context *ctx, GLenum func, GLfloat ref) { savageBlendFunc_s4(ctx); } -static void savageDDAlphaFunc_s3d(GLcontext *ctx, GLenum func, GLfloat ref) +static void savageDDAlphaFunc_s3d(struct gl_context *ctx, GLenum func, GLfloat ref) { savageBlendFunc_s3d(ctx); } -static void savageDDBlendEquationSeparate(GLcontext *ctx, +static void savageDDBlendEquationSeparate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { assert( modeRGB == modeA ); @@ -119,7 +119,7 @@ static void savageDDBlendEquationSeparate(GLcontext *ctx, } -static void savageBlendFunc_s4(GLcontext *ctx) +static void savageBlendFunc_s4(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui; @@ -294,7 +294,7 @@ static void savageBlendFunc_s4(GLcontext *ctx) drawCtrl1 != imesa->regs.s4.drawCtrl1.ui) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageBlendFunc_s3d(GLcontext *ctx) +static void savageBlendFunc_s3d(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui; @@ -465,14 +465,14 @@ static void savageBlendFunc_s3d(GLcontext *ctx) imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageDDBlendFuncSeparate_s4( GLcontext *ctx, GLenum sfactorRGB, +static void savageDDBlendFuncSeparate_s4( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { assert (dfactorRGB == dfactorA && sfactorRGB == sfactorA); savageBlendFunc_s4( ctx ); } -static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB, +static void savageDDBlendFuncSeparate_s3d( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -482,7 +482,7 @@ static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB, -static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func) +static void savageDDDepthFunc_s4(struct gl_context *ctx, GLenum func) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); ZCmpFunc zmode; @@ -546,7 +546,7 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func) zWatermarks != imesa->regs.s4.zWatermarks.ui) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func) +static void savageDDDepthFunc_s3d(struct gl_context *ctx, GLenum func) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); ZCmpFunc zmode; @@ -600,11 +600,11 @@ static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageDDDepthMask_s4(GLcontext *ctx, GLboolean flag) +static void savageDDDepthMask_s4(struct gl_context *ctx, GLboolean flag) { savageDDDepthFunc_s4(ctx,ctx->Depth.Func); } -static void savageDDDepthMask_s3d(GLcontext *ctx, GLboolean flag) +static void savageDDDepthMask_s3d(struct gl_context *ctx, GLboolean flag) { savageDDDepthFunc_s3d(ctx,ctx->Depth.Func); } @@ -617,7 +617,7 @@ static void savageDDDepthMask_s3d(GLcontext *ctx, GLboolean flag) */ -static void savageDDScissor( GLcontext *ctx, GLint x, GLint y, +static void savageDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -635,7 +635,7 @@ static void savageDDScissor( GLcontext *ctx, GLint x, GLint y, -static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode ) +static void savageDDDrawBuffer(struct gl_context *ctx, GLenum mode ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); uint32_t destCtrl = imesa->regs.s4.destCtrl.ui; @@ -667,13 +667,13 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode ) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageDDReadBuffer(GLcontext *ctx, GLenum mode ) +static void savageDDReadBuffer(struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } #if 0 -static void savageDDSetColor(GLcontext *ctx, +static void savageDDSetColor(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { @@ -686,7 +686,7 @@ static void savageDDSetColor(GLcontext *ctx, * Window position and viewport transformation */ -void savageCalcViewport( GLcontext *ctx ) +void savageCalcViewport( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -712,14 +712,14 @@ void savageCalcViewport( GLcontext *ctx ) imesa->SetupNewInputs = ~0; } -static void savageViewport( GLcontext *ctx, +static void savageViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { savageCalcViewport( ctx ); } -static void savageDepthRange( GLcontext *ctx, +static void savageDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { savageCalcViewport( ctx ); @@ -730,7 +730,7 @@ static void savageDepthRange( GLcontext *ctx, * Miscellaneous */ -static void savageDDClearColor(GLcontext *ctx, +static void savageDDClearColor(struct gl_context *ctx, const GLfloat color[4] ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -746,7 +746,7 @@ static void savageDDClearColor(GLcontext *ctx, /* Fallback to swrast for select and feedback. */ -static void savageRenderMode( GLcontext *ctx, GLenum mode ) +static void savageRenderMode( struct gl_context *ctx, GLenum mode ) { FALLBACK( ctx, SAVAGE_FALLBACK_RENDERMODE, (mode != GL_RENDER) ); } @@ -758,7 +758,7 @@ static void savageRenderMode( GLcontext *ctx, GLenum mode ) * Culling - the savage isn't quite as clean here as the rest of * its interfaces, but it's not bad. */ -static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) +static void savageDDCullFaceFrontFace(struct gl_context *ctx, GLenum unused) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint cullMode=imesa->LcsCullMode; @@ -793,7 +793,7 @@ static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) } #endif /* end #if HW_CULL */ -static void savageUpdateCull( GLcontext *ctx ) +static void savageUpdateCull( struct gl_context *ctx ) { #if HW_CULL savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -829,7 +829,7 @@ static void savageUpdateCull( GLcontext *ctx ) * to have any effect. If only some channels are masked we need a * software fallback on all chips. */ -static void savageDDColorMask_s4(GLcontext *ctx, +static void savageDDColorMask_s4(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -855,7 +855,7 @@ static void savageDDColorMask_s4(GLcontext *ctx, imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } } -static void savageDDColorMask_s3d(GLcontext *ctx, +static void savageDDColorMask_s3d(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -865,7 +865,7 @@ static void savageDDColorMask_s3d(GLcontext *ctx, FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b)); } -static void savageUpdateSpecular_s4(GLcontext *ctx) { +static void savageUpdateSpecular_s4(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui; @@ -879,7 +879,7 @@ static void savageUpdateSpecular_s4(GLcontext *ctx) { imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageUpdateSpecular_s3d(GLcontext *ctx) { +static void savageUpdateSpecular_s3d(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui; @@ -893,18 +893,18 @@ static void savageUpdateSpecular_s3d(GLcontext *ctx) { imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageDDLightModelfv_s4(GLcontext *ctx, GLenum pname, +static void savageDDLightModelfv_s4(struct gl_context *ctx, GLenum pname, const GLfloat *param) { savageUpdateSpecular_s4 (ctx); } -static void savageDDLightModelfv_s3d(GLcontext *ctx, GLenum pname, +static void savageDDLightModelfv_s3d(struct gl_context *ctx, GLenum pname, const GLfloat *param) { savageUpdateSpecular_s3d (ctx); } -static void savageDDShadeModel_s4(GLcontext *ctx, GLuint mod) +static void savageDDShadeModel_s4(struct gl_context *ctx, GLuint mod) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui; @@ -921,7 +921,7 @@ static void savageDDShadeModel_s4(GLcontext *ctx, GLuint mod) if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui) imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageDDShadeModel_s3d(GLcontext *ctx, GLuint mod) +static void savageDDShadeModel_s3d(struct gl_context *ctx, GLuint mod) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui; @@ -946,7 +946,7 @@ static void savageDDShadeModel_s3d(GLcontext *ctx, GLuint mod) * on savage3d and savage4. No need for two separate functions. */ -static void savageDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void savageDDFogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint fogClr; @@ -977,7 +977,7 @@ static void savageDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) static void -savageDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, +savageDDStencilFuncSeparate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1010,7 +1010,7 @@ savageDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, } static void -savageDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) +savageDDStencilMaskSeparate(struct gl_context *ctx, GLenum face, GLuint mask) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1039,7 +1039,7 @@ static unsigned get_stencil_op_value( GLenum op ) } static void -savageDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, +savageDDStencilOpSeparate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1057,7 +1057,7 @@ savageDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, /* ============================================================= */ -static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state) +static void savageDDEnable_s4(struct gl_context *ctx, GLenum cap, GLboolean state) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1148,7 +1148,7 @@ static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state) ; } } -static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state) +static void savageDDEnable_s3d(struct gl_context *ctx, GLenum cap, GLboolean state) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1227,7 +1227,7 @@ static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state) } } -void savageDDUpdateHwState( GLcontext *ctx ) +void savageDDUpdateHwState( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1671,7 +1671,7 @@ void savageDDInitState( savageContextPtr imesa ) { NEW_TEXTURE_MATRIX|\ NEW_USER_CLIP|NEW_CLIENT_STATE)) -static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void savageDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1681,7 +1681,7 @@ static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state ) } -void savageDDInitStateFuncs(GLcontext *ctx) +void savageDDInitStateFuncs(struct gl_context *ctx) { ctx->Driver.UpdateState = savageDDInvalidateState; ctx->Driver.BlendEquationSeparate = savageDDBlendEquationSeparate; diff --git a/src/mesa/drivers/dri/savage/savagestate.h b/src/mesa/drivers/dri/savage/savagestate.h index 5fe718d7a6..dca4fd0c01 100644 --- a/src/mesa/drivers/dri/savage/savagestate.h +++ b/src/mesa/drivers/dri/savage/savagestate.h @@ -28,14 +28,14 @@ #include "savagecontext.h" -void savageCalcViewport( GLcontext *ctx ); +void savageCalcViewport( struct gl_context *ctx ); void savageEmitOldState( savageContextPtr imesa ); void savageEmitChangedState( savageContextPtr imesa ); -extern void savageDDUpdateHwState( GLcontext *ctx ); +extern void savageDDUpdateHwState( struct gl_context *ctx ); extern void savageDDInitState( savageContextPtr imesa ); -extern void savageDDInitStateFuncs( GLcontext *ctx ); -extern void savageDDRenderStart(GLcontext *ctx); -extern void savageDDRenderEnd(GLcontext *ctx); +extern void savageDDInitStateFuncs( struct gl_context *ctx ); +extern void savageDDRenderStart(struct gl_context *ctx); +extern void savageDDRenderEnd(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 89090da5c6..3aece732c9 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -649,7 +649,7 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) /* Called by the _mesa_store_teximage[123]d() functions. */ static gl_format -savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +savageChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1148,7 +1148,7 @@ savage4_set_filter_mode( savageContextPtr imesa, unsigned unit, } -static void savageUpdateTex0State_s4( GLcontext *ctx ) +static void savageUpdateTex0State_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); struct gl_texture_object *tObj; @@ -1392,7 +1392,7 @@ static void savageUpdateTex0State_s4( GLcontext *ctx ) return; } -static void savageUpdateTex1State_s4( GLcontext *ctx ) +static void savageUpdateTex1State_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); struct gl_texture_object *tObj; @@ -1575,7 +1575,7 @@ static void savageUpdateTex1State_s4( GLcontext *ctx ) if(t->base.heap->heapId == SAVAGE_AGP_HEAP) imesa->regs.s4.texAddr[1].ui |= 0x1; } -static void savageUpdateTexState_s3d( GLcontext *ctx ) +static void savageUpdateTexState_s3d( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); struct gl_texture_object *tObj; @@ -1746,7 +1746,7 @@ static void savageTimestampTextures( savageContextPtr imesa ) } -static void savageUpdateTextureState_s4( GLcontext *ctx ) +static void savageUpdateTextureState_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1771,7 +1771,7 @@ static void savageUpdateTextureState_s4( GLcontext *ctx ) imesa->dirty |= (SAVAGE_UPLOAD_TEX0 | SAVAGE_UPLOAD_TEX1); } -static void savageUpdateTextureState_s3d( GLcontext *ctx ) +static void savageUpdateTextureState_s3d( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1789,7 +1789,7 @@ static void savageUpdateTextureState_s3d( GLcontext *ctx ) savageUpdateTexState_s3d( ctx ); imesa->dirty |= (SAVAGE_UPLOAD_TEX0); } -void savageUpdateTextureState( GLcontext *ctx) +void savageUpdateTextureState( struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE); @@ -1806,7 +1806,7 @@ void savageUpdateTextureState( GLcontext *ctx) * DRIVER functions *****************************************/ -static void savageTexEnv( GLcontext *ctx, GLenum target, +static void savageTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -1847,7 +1847,7 @@ static void savageTexImageChanged (savageTexObjPtr t) { } } -static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void savageTexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1872,7 +1872,7 @@ static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexSubImage1D( GLcontext *ctx, +static void savageTexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -1904,7 +1904,7 @@ static void savageTexSubImage1D( GLcontext *ctx, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void savageTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1929,7 +1929,7 @@ static void savageTexImage2D( GLcontext *ctx, GLenum target, GLint level, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexSubImage2D( GLcontext *ctx, +static void savageTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1962,7 +1962,7 @@ static void savageTexSubImage2D( GLcontext *ctx, } static void -savageCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, +savageCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -1987,7 +1987,7 @@ savageCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, } static void -savageCompressedTexSubImage2D( GLcontext *ctx, +savageCompressedTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -2018,7 +2018,7 @@ savageCompressedTexSubImage2D( GLcontext *ctx, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexParameter( GLcontext *ctx, GLenum target, +static void savageTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -2050,7 +2050,7 @@ static void savageTexParameter( GLcontext *ctx, GLenum target, imesa->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageBindTexture( GLcontext *ctx, GLenum target, +static void savageBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -2061,7 +2061,7 @@ static void savageBindTexture( GLcontext *ctx, GLenum target, imesa->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +static void savageDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { driTextureObject *t = (driTextureObject *)tObj->DriverData; savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -2078,7 +2078,7 @@ static void savageDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj static struct gl_texture_object * -savageNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +savageNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/savage/savagetex.h b/src/mesa/drivers/dri/savage/savagetex.h index e5f8a80f85..6108c1aade 100644 --- a/src/mesa/drivers/dri/savage/savagetex.h +++ b/src/mesa/drivers/dri/savage/savagetex.h @@ -75,7 +75,7 @@ typedef struct { #define __HWParseTexEnvCombine(imesa, flag0, TexCtrl, TexBlendCtrl) -void savageUpdateTextureState( GLcontext *ctx ); +void savageUpdateTextureState( struct gl_context *ctx ); void savageDDInitTextureFuncs( struct dd_function_table *functions ); void savageDestroyTexObj( savageContextPtr imesa, savageTexObjPtr t ); diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index 0050485e31..79a951147f 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -53,8 +53,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "savagetex.h" #include "savageioctl.h" -static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ); -static void savageRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void savageRasterPrimitive( struct gl_context *ctx, GLuint prim ); +static void savageRenderPrimitive( struct gl_context *ctx, GLenum prim ); static GLenum reduced_prim[GL_POLYGON+1] = { @@ -562,7 +562,7 @@ savage_fallback_tri( savageContextPtr imesa, savageVertexPtr v1, savageVertexPtr v2 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[3]; FLUSH_BATCH(imesa); WAIT_IDLE_EMPTY(imesa); @@ -578,7 +578,7 @@ savage_fallback_line( savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[2]; FLUSH_BATCH(imesa); WAIT_IDLE_EMPTY(imesa); @@ -592,7 +592,7 @@ static void savage_fallback_point( savageContextPtr imesa, savageVertexPtr v0 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[1]; FLUSH_BATCH(imesa); WAIT_IDLE_EMPTY(imesa); @@ -645,7 +645,7 @@ savage_fallback_point( savageContextPtr imesa, /* Render clipped primitives */ /**********************************************************************/ -static void savageRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void savageRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -661,13 +661,13 @@ static void savageRenderClippedPoly( GLcontext *ctx, const GLuint *elts, } } -static void savageRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void savageRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } /* -static void savageFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void savageFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { r128ContextPtr rmesa = R128_CONTEXT( ctx ); @@ -711,7 +711,7 @@ static void savageFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) -static void savageChooseRenderState(GLcontext *ctx) +static void savageChooseRenderState(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; @@ -781,7 +781,7 @@ static void savageChooseRenderState(GLcontext *ctx) /* Validate state at pipeline start */ /**********************************************************************/ -static void savageRunPipeline( GLcontext *ctx ) +static void savageRunPipeline( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -829,7 +829,7 @@ static void savageRunPipeline( GLcontext *ctx ) * primitives. */ -static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ) +static void savageRasterPrimitive( struct gl_context *ctx, GLuint prim ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -851,7 +851,7 @@ static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ) #endif } -static void savageRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void savageRenderPrimitive( struct gl_context *ctx, GLenum prim ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -870,7 +870,7 @@ static void savageRenderPrimitive( GLcontext *ctx, GLenum prim ) * them. Fallback to swrast we can't. Returns GL_TRUE if projective * texture coordinates must be faked, GL_FALSE otherwise. */ -static GLboolean savageCheckPTexHack( GLcontext *ctx ) +static GLboolean savageCheckPTexHack( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -933,7 +933,7 @@ do { \ #define SAVAGE_EMIT_ST1 0x0300 -static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) +static INLINE GLuint savageChooseVertexFormat_s3d( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -996,7 +996,7 @@ static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) } -static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) +static INLINE GLuint savageChooseVertexFormat_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -1121,7 +1121,7 @@ static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) } -static void savageRenderStart( GLcontext *ctx ) +static void savageRenderStart( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -1199,7 +1199,7 @@ static void savageRenderStart( GLcontext *ctx ) } } -static void savageRenderFinish( GLcontext *ctx ) +static void savageRenderFinish( struct gl_context *ctx ) { /* Flush the last primitive now, before any state is changed. */ savageFlushVertices(SAVAGE_CONTEXT(ctx)); @@ -1227,7 +1227,7 @@ static const char * const fallbackStrings[] = { "Projective texture", }; -void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void savageFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1279,7 +1279,7 @@ void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void savageInitTriFuncs( GLcontext *ctx ) +void savageInitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/savage/savagetris.h b/src/mesa/drivers/dri/savage/savagetris.h index a2a9375ed5..5dcae78f76 100644 --- a/src/mesa/drivers/dri/savage/savagetris.h +++ b/src/mesa/drivers/dri/savage/savagetris.h @@ -38,10 +38,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" -extern void savageInitTriFuncs( GLcontext *ctx ); +extern void savageInitTriFuncs( struct gl_context *ctx ); -extern void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void savageFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( ctx, bit, mode ) savageFallback( ctx, bit, mode ) diff --git a/src/mesa/drivers/dri/sis/sis6326_clear.c b/src/mesa/drivers/dri/sis/sis6326_clear.c index d46ecc9cd2..fba6c7f2d7 100644 --- a/src/mesa/drivers/dri/sis/sis6326_clear.c +++ b/src/mesa/drivers/dri/sis/sis6326_clear.c @@ -34,11 +34,11 @@ #include "swrast/swrast.h" #include "main/macros.h" -static void sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, +static void sis_clear_front_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height); -static void sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, +static void sis_clear_back_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height); -static void sis_clear_z_buffer(GLcontext * ctx, GLbitfield mask, GLint x, +static void sis_clear_z_buffer(struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ); static void @@ -69,7 +69,7 @@ sis6326UpdateZPattern(sisContextPtr smesa, GLclampd z) } void -sis6326DDClear(GLcontext *ctx, GLbitfield mask) +sis6326DDClear(struct gl_context *ctx, GLbitfield mask) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLint x1, y1, width1, height1; @@ -114,7 +114,7 @@ sis6326DDClear(GLcontext *ctx, GLbitfield mask) void -sis6326DDClearColor(GLcontext *ctx, const GLfloat color[4]) +sis6326DDClearColor(struct gl_context *ctx, const GLfloat color[4]) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte c[4]; @@ -128,7 +128,7 @@ sis6326DDClearColor(GLcontext *ctx, const GLfloat color[4]) } void -sis6326DDClearDepth(GLcontext *ctx, GLclampd d) +sis6326DDClearDepth(struct gl_context *ctx, GLclampd d) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -136,7 +136,7 @@ sis6326DDClearDepth(GLcontext *ctx, GLclampd d) } static void -sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, +sis_clear_back_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -160,7 +160,7 @@ sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, } static void -sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, +sis_clear_front_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -211,7 +211,7 @@ sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, } static void -sis_clear_z_buffer(GLcontext * ctx, GLbitfield mask, GLint x, GLint y, +sis_clear_z_buffer(struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis6326_state.c b/src/mesa/drivers/dri/sis/sis6326_state.c index 52008c7ea3..9708f63912 100644 --- a/src/mesa/drivers/dri/sis/sis6326_state.c +++ b/src/mesa/drivers/dri/sis/sis6326_state.c @@ -46,7 +46,7 @@ */ static void -sis6326DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +sis6326DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte refbyte; @@ -91,7 +91,7 @@ sis6326DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) } static void -sis6326DDBlendFuncSeparate( GLcontext *ctx, +sis6326DDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -172,7 +172,7 @@ sis6326DDBlendFuncSeparate( GLcontext *ctx, */ static void -sis6326DDDepthFunc( GLcontext *ctx, GLenum func ) +sis6326DDDepthFunc( struct gl_context *ctx, GLenum func ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -214,7 +214,7 @@ sis6326DDDepthFunc( GLcontext *ctx, GLenum func ) } static void -sis6326DDDepthMask( GLcontext *ctx, GLboolean flag ) +sis6326DDDepthMask( struct gl_context *ctx, GLboolean flag ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -230,7 +230,7 @@ sis6326DDDepthMask( GLcontext *ctx, GLboolean flag ) */ static void -sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) +sis6326DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *params ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -258,7 +258,7 @@ sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) */ void -sis6326UpdateClipping(GLcontext *ctx) +sis6326UpdateClipping(struct gl_context *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -300,7 +300,7 @@ sis6326UpdateClipping(GLcontext *ctx) } static void -sis6326DDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) +sis6326DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { if (ctx->Scissor.Enabled) sis6326UpdateClipping( ctx ); @@ -311,20 +311,20 @@ sis6326DDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) */ static void -sis6326UpdateCull( GLcontext *ctx ) +sis6326UpdateCull( struct gl_context *ctx ) { /* XXX culling */ } static void -sis6326DDCullFace( GLcontext *ctx, GLenum mode ) +sis6326DDCullFace( struct gl_context *ctx, GLenum mode ) { sis6326UpdateCull( ctx ); } static void -sis6326DDFrontFace( GLcontext *ctx, GLenum mode ) +sis6326DDFrontFace( struct gl_context *ctx, GLenum mode ) { sis6326UpdateCull( ctx ); } @@ -333,7 +333,7 @@ sis6326DDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void sis6326DDColorMask( GLcontext *ctx, +static void sis6326DDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -350,7 +350,7 @@ static void sis6326DDColorMask( GLcontext *ctx, * Rendering attributes */ -static void sis6326UpdateSpecular(GLcontext *ctx) +static void sis6326UpdateSpecular(struct gl_context *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -361,14 +361,14 @@ static void sis6326UpdateSpecular(GLcontext *ctx) current->hwCapEnable &= ~S_ENABLE_Specular; } -static void sis6326DDLightModelfv(GLcontext *ctx, GLenum pname, +static void sis6326DDLightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { sis6326UpdateSpecular(ctx); } } -static void sis6326DDShadeModel( GLcontext *ctx, GLenum mode ) +static void sis6326DDShadeModel( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -384,7 +384,7 @@ static void sis6326DDShadeModel( GLcontext *ctx, GLenum mode ) * Viewport */ -static void sis6326CalcViewport( GLcontext *ctx ) +static void sis6326CalcViewport( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -400,14 +400,14 @@ static void sis6326CalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale; } -static void sis6326DDViewport( GLcontext *ctx, +static void sis6326DDViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { sis6326CalcViewport( ctx ); } -static void sis6326DDDepthRange( GLcontext *ctx, +static void sis6326DDDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { sis6326CalcViewport( ctx ); @@ -418,7 +418,7 @@ static void sis6326DDDepthRange( GLcontext *ctx, */ static void -sis6326DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +sis6326DDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -487,7 +487,7 @@ sis6326DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ) +void sis6326DDDrawBuffer( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -544,7 +544,7 @@ void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ) */ static void -sis6326DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +sis6326DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -617,7 +617,7 @@ sis6326DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) /* Called before beginning of rendering. */ void -sis6326UpdateHWState( GLcontext *ctx ) +sis6326UpdateHWState( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -639,7 +639,7 @@ sis6326UpdateHWState( GLcontext *ctx ) } static void -sis6326DDInvalidateState( GLcontext *ctx, GLuint new_state ) +sis6326DDInvalidateState( struct gl_context *ctx, GLuint new_state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -656,7 +656,7 @@ void sis6326DDInitState( sisContextPtr smesa ) { __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; /* add Texture Perspective Enable */ current->hwCapEnable = S_ENABLE_TextureCache | @@ -708,7 +708,7 @@ void sis6326DDInitState( sisContextPtr smesa ) /* Initialize the driver's state functions. */ -void sis6326DDInitStateFuncs( GLcontext *ctx ) +void sis6326DDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = sis6326DDInvalidateState; diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index d358ef62dc..a5d870469d 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -38,12 +38,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "main/macros.h" -static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask, +static GLbitfield sis_3D_Clear( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ); -static void sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, +static void sis_clear_color_buffer( struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height ); -static void sis_clear_z_stencil_buffer( GLcontext * ctx, +static void sis_clear_z_stencil_buffer( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ); @@ -94,7 +94,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil ) } void -sisDDClear( GLcontext * ctx, GLbitfield mask ) +sisDDClear( struct gl_context * ctx, GLbitfield mask ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -148,7 +148,7 @@ sisDDClear( GLcontext * ctx, GLbitfield mask ) void -sisDDClearColor( GLcontext * ctx, const GLfloat color[4] ) +sisDDClearColor( struct gl_context * ctx, const GLfloat color[4] ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte c[4]; @@ -162,7 +162,7 @@ sisDDClearColor( GLcontext * ctx, const GLfloat color[4] ) } void -sisDDClearDepth( GLcontext * ctx, GLclampd d ) +sisDDClearDepth( struct gl_context * ctx, GLclampd d ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -170,7 +170,7 @@ sisDDClearDepth( GLcontext * ctx, GLclampd d ) } void -sisDDClearStencil( GLcontext * ctx, GLint s ) +sisDDClearStencil( struct gl_context * ctx, GLint s ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -178,7 +178,7 @@ sisDDClearStencil( GLcontext * ctx, GLint s ) } static GLbitfield -sis_3D_Clear( GLcontext * ctx, GLbitfield mask, +sis_3D_Clear( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -323,7 +323,7 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, } static void -sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, +sis_clear_color_buffer( struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -389,7 +389,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, } static void -sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask, +sis_clear_z_stencil_buffer( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index 07b363826d..c5a9fdfb2a 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -147,7 +147,7 @@ WaitingFor3dIdle(sisContextPtr smesa, int wLen) } } -void sisReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, +void sisReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -163,7 +163,7 @@ sisCreateContext( gl_api api, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *sPriv = driContextPriv->driScreenPriv; sisContextPtr smesa; sisScreenPtr sisScreen; diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 54e98fd00a..a82a659431 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -256,7 +256,7 @@ struct sis_renderbuffer { struct sis_context { /* This must be first in this structure */ - GLcontext *glCtx; + struct gl_context *glCtx; /* Vertex state */ GLuint vertex_size; @@ -444,7 +444,7 @@ extern GLboolean sisCreateContext( gl_api api, void *sharedContextPrivate ); extern void sisDestroyContext( __DRIcontext * ); -void sisReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, +void sisReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); extern GLboolean sisMakeCurrent( __DRIcontext *driContextPriv, diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index af1d9ee0ad..90e894b842 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -65,7 +65,7 @@ sisGetBufferSize( struct gl_framebuffer *buffer, /* Return various strings for glGetString(). */ static const GLubyte * -sisGetString( GLcontext *ctx, GLenum name ) +sisGetString( struct gl_context *ctx, GLenum name ) { sisContextPtr smesa = SIS_CONTEXT(ctx); static char buffer[128]; @@ -90,7 +90,7 @@ sisGetString( GLcontext *ctx, GLenum name ) /* Send all commands to the hardware. */ static void -sisFlush( GLcontext *ctx ) +sisFlush( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -101,7 +101,7 @@ sisFlush( GLcontext *ctx ) * completed processing. */ static void -sisFinish( GLcontext *ctx ) +sisFinish( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -118,7 +118,7 @@ sisDeleteRenderbuffer(struct gl_renderbuffer *rb) } static GLboolean -sisRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, +sisRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { rb->Width = width; diff --git a/src/mesa/drivers/dri/sis/sis_fog.c b/src/mesa/drivers/dri/sis/sis_fog.c index 6c774e010e..a9b84654a3 100644 --- a/src/mesa/drivers/dri/sis/sis_fog.c +++ b/src/mesa/drivers/dri/sis/sis_fog.c @@ -40,7 +40,7 @@ static GLint convertFtToFogFt( GLfloat dwInValue ); static GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction ); void -sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) +sisDDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *params ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 7ca5031846..75f6fcf211 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -262,7 +262,7 @@ sisSwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { sisContextPtr smesa = (sisContextPtr) dPriv->driContextPriv->driverPrivate; - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; if (ctx->Visual.doubleBufferMode) { _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c index ba7f6d0932..01c1fc428d 100644 --- a/src/mesa/drivers/dri/sis/sis_span.c +++ b/src/mesa/drivers/dri/sis/sis_span.c @@ -143,7 +143,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. -void sisSpanRenderStart( GLcontext *ctx ) +void sisSpanRenderStart( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -152,7 +152,7 @@ void sisSpanRenderStart( GLcontext *ctx ) WaitEngIdle( smesa ); } -void sisSpanRenderFinish( GLcontext *ctx ) +void sisSpanRenderFinish( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -161,7 +161,7 @@ void sisSpanRenderFinish( GLcontext *ctx ) } void -sisDDInitSpanFuncs( GLcontext *ctx ) +sisDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = sisSpanRenderStart; diff --git a/src/mesa/drivers/dri/sis/sis_span.h b/src/mesa/drivers/dri/sis/sis_span.h index eca72027d5..cbe4bbdc55 100644 --- a/src/mesa/drivers/dri/sis/sis_span.h +++ b/src/mesa/drivers/dri/sis/sis_span.h @@ -34,10 +34,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" -extern void sisSpanRenderStart( GLcontext *ctx ); -extern void sisSpanRenderFinish( GLcontext *ctx ); +extern void sisSpanRenderStart( struct gl_context *ctx ); +extern void sisSpanRenderFinish( struct gl_context *ctx ); -extern void sisDDInitSpanFuncs( GLcontext *ctx ); +extern void sisDDInitSpanFuncs( struct gl_context *ctx ); extern void sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index 6173231a82..e53c326441 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -49,7 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ static void -sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref ) +sisDDAlphaFunc( struct gl_context * ctx, GLenum func, GLfloat ref ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte refbyte; @@ -94,7 +94,7 @@ sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref ) } static void -sisDDBlendFuncSeparate( GLcontext *ctx, +sisDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -193,7 +193,7 @@ sisDDBlendFuncSeparate( GLcontext *ctx, */ static void -sisDDDepthFunc( GLcontext * ctx, GLenum func ) +sisDDDepthFunc( struct gl_context * ctx, GLenum func ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -235,7 +235,7 @@ sisDDDepthFunc( GLcontext * ctx, GLenum func ) } void -sisDDDepthMask( GLcontext * ctx, GLboolean flag ) +sisDDDepthMask( struct gl_context * ctx, GLboolean flag ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -277,7 +277,7 @@ sisDDDepthMask( GLcontext * ctx, GLboolean flag ) */ void -sisUpdateClipping( GLcontext *ctx ) +sisUpdateClipping( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -324,7 +324,7 @@ sisUpdateClipping( GLcontext *ctx ) } static void -sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) +sisDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { if (ctx->Scissor.Enabled) sisUpdateClipping( ctx ); @@ -335,7 +335,7 @@ sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) */ static void -sisUpdateCull( GLcontext *ctx ) +sisUpdateCull( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLint cullflag, frontface; @@ -356,13 +356,13 @@ sisUpdateCull( GLcontext *ctx ) static void -sisDDCullFace( GLcontext *ctx, GLenum mode ) +sisDDCullFace( struct gl_context *ctx, GLenum mode ) { sisUpdateCull( ctx ); } static void -sisDDFrontFace( GLcontext *ctx, GLenum mode ) +sisDDFrontFace( struct gl_context *ctx, GLenum mode ) { sisUpdateCull( ctx ); } @@ -371,7 +371,7 @@ sisDDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void sisDDColorMask( GLcontext *ctx, +static void sisDDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -402,7 +402,7 @@ static void sisDDColorMask( GLcontext *ctx, * Rendering attributes */ -static void sisUpdateSpecular(GLcontext *ctx) +static void sisUpdateSpecular(struct gl_context *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -413,7 +413,7 @@ static void sisUpdateSpecular(GLcontext *ctx) current->hwCapEnable &= ~MASK_SpecularEnable; } -static void sisDDLightModelfv(GLcontext *ctx, GLenum pname, +static void sisDDLightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { @@ -421,7 +421,7 @@ static void sisDDLightModelfv(GLcontext *ctx, GLenum pname, } } -static void sisDDShadeModel( GLcontext *ctx, GLenum mode ) +static void sisDDShadeModel( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -437,7 +437,7 @@ static void sisDDShadeModel( GLcontext *ctx, GLenum mode ) * Viewport */ -static void sisCalcViewport( GLcontext *ctx ) +static void sisCalcViewport( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -453,14 +453,14 @@ static void sisCalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale; } -static void sisDDViewport( GLcontext *ctx, +static void sisDDViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { sisCalcViewport( ctx ); } -static void sisDDDepthRange( GLcontext *ctx, +static void sisDDDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { sisCalcViewport( ctx ); @@ -471,7 +471,7 @@ static void sisDDDepthRange( GLcontext *ctx, */ static void -sisDDLogicOpCode( GLcontext *ctx, GLenum opcode ) +sisDDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -537,7 +537,7 @@ sisDDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ) +void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -589,7 +589,7 @@ void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ) */ static void -sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state ) +sisDDEnable( struct gl_context * ctx, GLenum cap, GLboolean state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -672,7 +672,7 @@ sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state ) /* Called before beginning of rendering. */ void -sisUpdateHWState( GLcontext *ctx ) +sisUpdateHWState( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -698,7 +698,7 @@ sisUpdateHWState( GLcontext *ctx ) } static void -sisDDInvalidateState( GLcontext *ctx, GLuint new_state ) +sisDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -715,7 +715,7 @@ void sisDDInitState( sisContextPtr smesa ) { __GLSiSHardware *current = &smesa->current; __GLSiSHardware *prev = &(smesa->prev); - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; /* add Texture Perspective Enable */ prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable | @@ -826,7 +826,7 @@ void sisDDInitState( sisContextPtr smesa ) /* Initialize the driver's state functions. */ -void sisDDInitStateFuncs( GLcontext *ctx ) +void sisDDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = sisDDInvalidateState; diff --git a/src/mesa/drivers/dri/sis/sis_state.h b/src/mesa/drivers/dri/sis/sis_state.h index 2d0ea9c5fb..dcade4a979 100644 --- a/src/mesa/drivers/dri/sis/sis_state.h +++ b/src/mesa/drivers/dri/sis/sis_state.h @@ -34,35 +34,35 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_context.h" /* sis6326_clear.c */ -extern void sis6326DDClear( GLcontext *ctx, GLbitfield mask ); -extern void sis6326DDClearColor( GLcontext * ctx, const GLfloat color[4] ); -extern void sis6326DDClearDepth( GLcontext * ctx, GLclampd d ); +extern void sis6326DDClear( struct gl_context *ctx, GLbitfield mask ); +extern void sis6326DDClearColor( struct gl_context * ctx, const GLfloat color[4] ); +extern void sis6326DDClearDepth( struct gl_context * ctx, GLclampd d ); extern void sis6326UpdateZPattern(sisContextPtr smesa, GLclampd z); /* sis_clear.c */ -extern void sisDDClear( GLcontext *ctx, GLbitfield mask ); -extern void sisDDClearColor( GLcontext * ctx, const GLfloat color[4] ); -extern void sisDDClearDepth( GLcontext * ctx, GLclampd d ); -extern void sisDDClearStencil( GLcontext * ctx, GLint s ); +extern void sisDDClear( struct gl_context *ctx, GLbitfield mask ); +extern void sisDDClearColor( struct gl_context * ctx, const GLfloat color[4] ); +extern void sisDDClearDepth( struct gl_context * ctx, GLclampd d ); +extern void sisDDClearStencil( struct gl_context * ctx, GLint s ); extern void sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, int stencil ); /* sis_fog.c */ -extern void sisDDFogfv( GLcontext * ctx, GLenum pname, const GLfloat * params ); +extern void sisDDFogfv( struct gl_context * ctx, GLenum pname, const GLfloat * params ); /* sis6326_state.c */ extern void sis6326DDInitState( sisContextPtr smesa ); -extern void sis6326DDInitStateFuncs( GLcontext *ctx ); -extern void sis6326UpdateClipping( GLcontext * gc ); -extern void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ); -extern void sis6326UpdateHWState( GLcontext *ctx ); +extern void sis6326DDInitStateFuncs( struct gl_context *ctx ); +extern void sis6326UpdateClipping( struct gl_context * gc ); +extern void sis6326DDDrawBuffer( struct gl_context *ctx, GLenum mode ); +extern void sis6326UpdateHWState( struct gl_context *ctx ); /* sis_state.c */ extern void sisDDInitState( sisContextPtr smesa ); -extern void sisDDInitStateFuncs( GLcontext *ctx ); -extern void sisDDDepthMask( GLcontext * ctx, GLboolean flag ); -extern void sisUpdateClipping( GLcontext * gc ); -extern void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ); -extern void sisUpdateHWState( GLcontext *ctx ); +extern void sisDDInitStateFuncs( struct gl_context *ctx ); +extern void sisDDDepthMask( struct gl_context * ctx, GLboolean flag ); +extern void sisUpdateClipping( struct gl_context * gc ); +extern void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode ); +extern void sisUpdateHWState( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/sis/sis_stencil.c b/src/mesa/drivers/dri/sis/sis_stencil.c index 55c0440eba..92eb08f31f 100644 --- a/src/mesa/drivers/dri/sis/sis_stencil.c +++ b/src/mesa/drivers/dri/sis/sis_stencil.c @@ -36,7 +36,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_stencil.h" static void -sisDDStencilFuncSeparate( GLcontext * ctx, GLenum face, +sisDDStencilFuncSeparate( struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -85,7 +85,7 @@ sisDDStencilFuncSeparate( GLcontext * ctx, GLenum face, } static void -sisDDStencilMaskSeparate( GLcontext * ctx, GLenum face, GLuint mask ) +sisDDStencilMaskSeparate( struct gl_context * ctx, GLenum face, GLuint mask ) { if (!ctx->Visual.stencilBits) return; @@ -95,7 +95,7 @@ sisDDStencilMaskSeparate( GLcontext * ctx, GLenum face, GLuint mask ) } static void -sisDDStencilOpSeparate( GLcontext * ctx, GLenum face, GLenum fail, +sisDDStencilOpSeparate( struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -197,7 +197,7 @@ sisDDStencilOpSeparate( GLcontext * ctx, GLenum face, GLenum fail, } void -sisDDInitStencilFuncs( GLcontext *ctx ) +sisDDInitStencilFuncs( struct gl_context *ctx ) { ctx->Driver.StencilFuncSeparate = sisDDStencilFuncSeparate; ctx->Driver.StencilMaskSeparate = sisDDStencilMaskSeparate; diff --git a/src/mesa/drivers/dri/sis/sis_stencil.h b/src/mesa/drivers/dri/sis/sis_stencil.h index 6b556c4378..9d061e87fd 100644 --- a/src/mesa/drivers/dri/sis/sis_stencil.h +++ b/src/mesa/drivers/dri/sis/sis_stencil.h @@ -31,6 +31,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __SIS_STENCIL_H__ #define __SIS_STENCIL_H__ -extern void sisDDInitStencilFuncs( GLcontext *ctx ); +extern void sisDDInitStencilFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 31709c3af6..bb4896d9bd 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -152,7 +152,7 @@ sisFreeTexImage( sisContextPtr smesa, sisTexObjPtr t, int level ) } static void -sisTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param ) +sisTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -160,7 +160,7 @@ sisTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param ) } static void -sisTexParameter( GLcontext *ctx, GLenum target, +sisTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ) { @@ -170,7 +170,7 @@ sisTexParameter( GLcontext *ctx, GLenum target, } static void -sisBindTexture( GLcontext *ctx, GLenum target, +sisBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -194,7 +194,7 @@ sisBindTexture( GLcontext *ctx, GLenum target, } static void -sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj ) +sisDeleteTexture( struct gl_context * ctx, struct gl_texture_object *texObj ) { sisContextPtr smesa = SIS_CONTEXT(ctx); sisTexObjPtr t; @@ -220,14 +220,14 @@ sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj ) _mesa_delete_texture_object(ctx, texObj); } -static GLboolean sisIsTextureResident( GLcontext * ctx, +static GLboolean sisIsTextureResident( struct gl_context * ctx, struct gl_texture_object *texObj ) { return (texObj->DriverData != NULL); } static gl_format -sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +sisChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -352,7 +352,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, } } -static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void sisTexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -389,7 +389,7 @@ static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level, } -static void sisTexSubImage1D( GLcontext *ctx, +static void sisTexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -439,7 +439,7 @@ static void sisTexSubImage1D( GLcontext *ctx, smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } -static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void sisTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -475,7 +475,7 @@ static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level, smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } -static void sisTexSubImage2D( GLcontext *ctx, +static void sisTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -544,7 +544,7 @@ static void sisTexSubImage2D( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +sisNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/sis/sis_tex.h b/src/mesa/drivers/dri/sis/sis_tex.h index c499e80e86..f467b7dca9 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.h +++ b/src/mesa/drivers/dri/sis/sis_tex.h @@ -32,6 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define __SIS_TEX_H__ extern void sisInitTextureFuncs( struct dd_function_table *table ); -extern void sisUpdateTextureState( GLcontext *ctx ); +extern void sisUpdateTextureState( struct gl_context *ctx ); #endif /* __SIS_TEX_H__ */ diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index 7b0eebd066..daec239321 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -46,7 +46,7 @@ static GLint TransferTexturePitch (GLint dwPitch); /* Handle texenv stuff, called from validate_texture (renderstart) */ static void -sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj, +sis_set_texture_env0( struct gl_context *ctx, struct gl_texture_object *texObj, int unit ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -182,7 +182,7 @@ sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj, /* Handle texenv stuff, called from validate_texture (renderstart) */ static void -sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj, +sis_set_texture_env1( struct gl_context *ctx, struct gl_texture_object *texObj, int unit) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -318,7 +318,7 @@ sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj, /* Returns 0 if a software fallback is necessary */ static GLboolean -sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, +sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, int hw_unit ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -583,7 +583,7 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, /* Disable a texture unit, called from validate_texture */ static void -sis_reset_texture_env (GLcontext *ctx, int hw_unit) +sis_reset_texture_env (struct gl_context *ctx, int hw_unit) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -620,7 +620,7 @@ sis_reset_texture_env (GLcontext *ctx, int hw_unit) } } -static void updateTextureUnit( GLcontext *ctx, int unit ) +static void updateTextureUnit( struct gl_context *ctx, int unit ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -656,7 +656,7 @@ static void updateTextureUnit( GLcontext *ctx, int unit ) } -void sisUpdateTextureState( GLcontext *ctx ) +void sisUpdateTextureState( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); int i; diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index d109a8c41e..8db593fb9c 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -92,8 +92,8 @@ static const GLuint hw_prim_agp_shade[OP_3D_TRIANGLE_DRAW+1] = { MASK_PsShadingFlatC }; -static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void sisRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void sisRasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void sisRenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -556,7 +556,7 @@ sis_fallback_tri( sisContextPtr smesa, sisVertex *v1, sisVertex *v2 ) { - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; SWvertex v[3]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -573,7 +573,7 @@ sis_fallback_line( sisContextPtr smesa, sisVertex *v0, sisVertex *v1 ) { - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; SWvertex v[2]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -588,7 +588,7 @@ static void sis_fallback_point( sisContextPtr smesa, sisVertex *v0 ) { - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; SWvertex v[1]; _swsetup_Translate( ctx, v0, &v[0] ); sisSpanRenderStart( ctx ); @@ -643,7 +643,7 @@ sis_fallback_point( sisContextPtr smesa, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) #define _SIS_NEW_RENDER_STATE (ANY_RASTER_FLAGS | ANY_FALLBACK_FLAGS) -static void sisChooseRenderState(GLcontext *ctx) +static void sisChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); sisContextPtr smesa = SIS_CONTEXT( ctx ); @@ -701,7 +701,7 @@ static void sisChooseRenderState(GLcontext *ctx) /**********************************************************************/ /* Multipass rendering for front buffering */ /**********************************************************************/ -static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) +static GLboolean multipass_cliprect( struct gl_context *ctx, GLuint pass ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); @@ -743,7 +743,7 @@ static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) /* Validate state at pipeline start */ /**********************************************************************/ -static void sisRunPipeline( GLcontext *ctx ) +static void sisRunPipeline( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); @@ -776,7 +776,7 @@ static void sisRunPipeline( GLcontext *ctx ) * and lines, points and bitmaps. */ -static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void sisRasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { sisContextPtr smesa = SIS_CONTEXT(ctx); if (smesa->hw_primitive != hwprim) { @@ -810,7 +810,7 @@ static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void sisRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void sisRenderPrimitive( struct gl_context *ctx, GLenum prim ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -836,7 +836,7 @@ do { \ smesa->vertex_attr_count++; \ } while (0) -static void sisRenderStart( GLcontext *ctx ) +static void sisRenderStart( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -927,7 +927,7 @@ static void sisRenderStart( GLcontext *ctx ) } } -static void sisRenderFinish( GLcontext *ctx ) +static void sisRenderFinish( struct gl_context *ctx ) { } @@ -1039,7 +1039,7 @@ static const char *getFallbackString(GLuint bit) return fallbackStrings[i]; } -void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void sisFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -1090,7 +1090,7 @@ void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void sisInitTriFuncs( GLcontext *ctx ) +void sisInitTriFuncs( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis_tris.h b/src/mesa/drivers/dri/sis/sis_tris.h index b34fe8c7c9..d454090607 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.h +++ b/src/mesa/drivers/dri/sis/sis_tris.h @@ -34,10 +34,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_lock.h" #include "main/mtypes.h" -extern void sisInitTriFuncs( GLcontext *ctx ); +extern void sisInitTriFuncs( struct gl_context *ctx ); extern void sisFlushPrims( sisContextPtr smesa ); extern void sisFlushPrimsLocked( sisContextPtr smesa ); -extern void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void sisFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( smesa, bit, mode ) sisFallback( smesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 5b52135627..52ba3acf65 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -273,7 +273,7 @@ bytes_per_line(unsigned pitch_bits, unsigned mul) } static GLboolean -swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +swrast_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); @@ -290,7 +290,7 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, } static GLboolean -swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +swrast_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); @@ -499,7 +499,7 @@ get_window_size( struct gl_framebuffer *fb, GLsizei *w, GLsizei *h ) } static void -swrast_check_and_update_window_size( GLcontext *ctx, struct gl_framebuffer *fb ) +swrast_check_and_update_window_size( struct gl_context *ctx, struct gl_framebuffer *fb ) { GLsizei width, height; @@ -510,7 +510,7 @@ swrast_check_and_update_window_size( GLcontext *ctx, struct gl_framebuffer *fb ) } static const GLubyte * -get_string(GLcontext *ctx, GLenum pname) +get_string(struct gl_context *ctx, GLenum pname) { (void) ctx; switch (pname) { @@ -524,7 +524,7 @@ get_string(GLcontext *ctx, GLenum pname) } static void -update_state( GLcontext *ctx, GLuint new_state ) +update_state( struct gl_context *ctx, GLuint new_state ) { /* not much to do here - pass it on */ _swrast_InvalidateState( ctx, new_state ); @@ -534,7 +534,7 @@ update_state( GLcontext *ctx, GLuint new_state ) } static void -viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct gl_framebuffer *draw = ctx->WinSysDrawBuffer; struct gl_framebuffer *read = ctx->WinSysReadBuffer; @@ -543,7 +543,7 @@ viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) swrast_check_and_update_window_size(ctx, read); } -static gl_format swrastChooseTextureFormat(GLcontext * ctx, +static gl_format swrastChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type) @@ -575,8 +575,8 @@ dri_create_context(gl_api api, { struct dri_context *ctx = NULL; struct dri_context *share = (struct dri_context *)sharedContextPrivate; - GLcontext *mesaCtx = NULL; - GLcontext *sharedCtx = NULL; + struct gl_context *mesaCtx = NULL; + struct gl_context *sharedCtx = NULL; struct dd_function_table functions; TRACE; @@ -646,7 +646,7 @@ dri_destroy_context(__DRIcontext * cPriv) if (cPriv) { struct dri_context *ctx = dri_context(cPriv); - GLcontext *mesaCtx; + struct gl_context *mesaCtx; mesaCtx = &ctx->Base; @@ -664,7 +664,7 @@ dri_make_current(__DRIcontext * cPriv, __DRIdrawable * driDrawPriv, __DRIdrawable * driReadPriv) { - GLcontext *mesaCtx; + struct gl_context *mesaCtx; struct gl_framebuffer *mesaDraw; struct gl_framebuffer *mesaRead; TRACE; diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index 054bdba27b..bdb52ef26f 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -58,7 +58,7 @@ struct dri_context { /* mesa, base class, must be first */ - GLcontext Base; + struct gl_context Base; /* dri */ __DRIcontext *cPriv; @@ -71,7 +71,7 @@ dri_context(__DRIcontext * driContextPriv) } static INLINE struct dri_context * -swrast_context(GLcontext *ctx) +swrast_context(struct gl_context *ctx) { return (struct dri_context *) ctx; } diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h index 1e9405eebf..69f8d9f240 100644 --- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h +++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -37,7 +37,7 @@ #define _SWRAST_SPANTEMP_ONCE static INLINE void -PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p ) +PUT_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLvoid *p ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv; @@ -51,7 +51,7 @@ PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p ) static INLINE void -GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) +GET_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLubyte *p ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv; @@ -63,7 +63,7 @@ GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) } static INLINE void -PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) +PUT_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv; @@ -76,7 +76,7 @@ PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) } static INLINE void -GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) +GET_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv; @@ -118,7 +118,7 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) static void -NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values ) { #ifdef SPAN_VARS @@ -138,7 +138,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values ) { #ifdef SPAN_VARS @@ -156,7 +156,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { @@ -189,7 +189,7 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_row_rgb)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { @@ -230,7 +230,7 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_mono_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -263,7 +263,7 @@ NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) { @@ -286,7 +286,7 @@ NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_mono_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte mask[] ) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index adefc1472a..63dfa5ae74 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -124,7 +124,7 @@ static const struct dri_extension napalm_extensions[] = /* * Enable/Disable the extensions for this context. */ -static void tdfxDDInitExtensions( GLcontext *ctx ) +static void tdfxDDInitExtensions( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -168,7 +168,7 @@ GLboolean tdfxCreateContext( gl_api api, void *sharedContextPrivate ) { tdfxContextPtr fxMesa; - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *sPriv = driContextPriv->driScreenPriv; tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA + @@ -635,7 +635,7 @@ tdfxMakeCurrent( __DRIcontext *driContextPriv, if ( driContextPriv ) { tdfxContextPtr newFx = (tdfxContextPtr) driContextPriv->driverPrivate; - GLcontext *newCtx = newFx->glCtx; + struct gl_context *newCtx = newFx->glCtx; GET_CURRENT_CONTEXT(curCtx); if ((newFx->driDrawable != driDrawPriv) diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.h b/src/mesa/drivers/dri/tdfx/tdfx_context.h index 2b2807903b..fb38419dcd 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.h @@ -810,7 +810,7 @@ typedef void (*tdfx_point_func)( tdfxContextPtr, tdfxVertex * ); struct tdfx_context { /* Set once and never changed: */ - GLcontext *glCtx; /* The core Mesa context */ + struct gl_context *glCtx; /* The core Mesa context */ GLuint new_gl_state; GLuint new_state; @@ -957,10 +957,10 @@ extern GLboolean tdfxInitGlide( tdfxContextPtr tmesa ); extern void -FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]); +FX_grColorMaskv(struct gl_context *ctx, const GLboolean rgba[4]); extern void -FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]); +FX_grColorMaskv_NoLock(struct gl_context *ctx, const GLboolean rgba[4]); /* Color packing utilities diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/src/mesa/drivers/dri/tdfx/tdfx_dd.c index 101b6da687..d60931ad7f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.c @@ -54,7 +54,7 @@ const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE). * Why? */ -static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *tdfxDDGetString( struct gl_context *ctx, GLenum name ) { tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; @@ -103,7 +103,7 @@ static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) static void -tdfxBeginQuery(GLcontext *ctx, struct gl_query_object *q) +tdfxBeginQuery(struct gl_context *ctx, struct gl_query_object *q) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -119,7 +119,7 @@ tdfxBeginQuery(GLcontext *ctx, struct gl_query_object *q) static void -tdfxEndQuery(GLcontext *ctx, struct gl_query_object *q) +tdfxEndQuery(struct gl_context *ctx, struct gl_query_object *q) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FxI32 total_pixels; @@ -187,7 +187,7 @@ void tdfxDDInitDriverFuncs( const struct gl_config *visual, */ void -FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) +FX_grColorMaskv(struct gl_context *ctx, const GLboolean rgba[4]) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); LOCK_HARDWARE(fxMesa); @@ -207,7 +207,7 @@ FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) } void -FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]) +FX_grColorMaskv_NoLock(struct gl_context *ctx, const GLboolean rgba[4]) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (ctx->Visual.redBits == 8) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c index 5a7184056d..bbbd0d5740 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c @@ -153,7 +153,7 @@ inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height) #if 0 GLboolean -tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, +tdfx_bitmap_R5G6B5(struct gl_context * ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * bitmap) @@ -317,7 +317,7 @@ tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, #if 0 GLboolean -tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, +tdfx_bitmap_R8G8B8A8(struct gl_context * ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * bitmap) @@ -475,7 +475,7 @@ tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, #endif void -tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, +tdfx_readpixels_R5G6B5(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -532,7 +532,7 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, } void -tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, +tdfx_readpixels_R8G8B8A8(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -591,7 +591,7 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, } void -tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, +tdfx_drawpixels_R8G8B8A8(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.h b/src/mesa/drivers/dri/tdfx/tdfx_pixels.h index f5e5427653..f4cc20fd62 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.h @@ -41,33 +41,33 @@ #include "main/context.h" extern void -tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py, +tdfx_bitmap_R5G6B5( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); extern void -tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py, +tdfx_bitmap_R8G8B8A8( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); extern void -tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y, +tdfx_readpixels_R5G6B5( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, GLvoid *dstImage ); extern void -tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, +tdfx_readpixels_R8G8B8A8( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, GLvoid *dstImage ); extern void -tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, +tdfx_drawpixels_R8G8B8A8( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_render.c b/src/mesa/drivers/dri/tdfx/tdfx_render.c index 979bcd4514..f083756787 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_render.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_render.c @@ -45,7 +45,7 @@ /* Clear the color and/or depth buffers. */ -static void tdfxClear( GLcontext *ctx, GLbitfield mask ) +static void tdfxClear( struct gl_context *ctx, GLbitfield mask ) { tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM); @@ -314,7 +314,7 @@ static void tdfxClear( GLcontext *ctx, GLbitfield mask ) -static void tdfxFinish( GLcontext *ctx ) +static void tdfxFinish( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -325,7 +325,7 @@ static void tdfxFinish( GLcontext *ctx ) UNLOCK_HARDWARE( fxMesa ); } -static void tdfxFlush( GLcontext *ctx ) +static void tdfxFlush( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -528,7 +528,7 @@ static void uploadTextureSource( tdfxContextPtr fxMesa ) static void uploadTextureImages( tdfxContextPtr fxMesa ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; int unit; for (unit = 0; unit < TDFX_NUM_TMU; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c index 5af4a4602e..12524e2316 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c @@ -582,7 +582,7 @@ GetFbParams(tdfxContextPtr fxMesa, static void -tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDWriteDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[]) { @@ -819,7 +819,7 @@ tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, } static void -tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDWriteMonoDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[]) { @@ -833,7 +833,7 @@ tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, static void -tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDReadDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLuint *depth = (GLuint *) values; @@ -937,7 +937,7 @@ tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, static void -tdfxDDWriteDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDWriteDepthPixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[]) { @@ -1020,7 +1020,7 @@ tdfxDDWriteDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, static void -tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n, +tdfxDDReadDepthPixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { GLuint *depth = (GLuint *) values; @@ -1107,7 +1107,7 @@ tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n, #define BUILD_ZS(z, s) (((s) << 24) | (z)) static void -write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, +write_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[]) { @@ -1166,7 +1166,7 @@ write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, static void -write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, +write_mono_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[]) { @@ -1180,7 +1180,7 @@ write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, static void -read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, +read_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { @@ -1232,7 +1232,7 @@ read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, static void -write_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, +write_stencil_pixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[]) { @@ -1271,7 +1271,7 @@ write_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, static void -read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, +read_stencil_pixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { @@ -1318,13 +1318,13 @@ read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, /**********************************************************************/ -static void tdfxSpanRenderStart( GLcontext *ctx ) +static void tdfxSpanRenderStart( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); LOCK_HARDWARE(fxMesa); } -static void tdfxSpanRenderFinish( GLcontext *ctx ) +static void tdfxSpanRenderFinish( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); _swrast_flush( ctx ); @@ -1335,7 +1335,7 @@ static void tdfxSpanRenderFinish( GLcontext *ctx ) /* Initialize swrast device driver */ /**********************************************************************/ -void tdfxDDInitSpanFuncs( GLcontext *ctx ) +void tdfxDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); swdd->SpanRenderStart = tdfxSpanRenderStart; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.h b/src/mesa/drivers/dri/tdfx/tdfx_span.h index cd39191959..ae3d074a58 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.h @@ -40,7 +40,7 @@ #include "main/context.h" #include "drirenderbuffer.h" -extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); +extern void tdfxDDInitSpanFuncs( struct gl_context *ctx ); extern void tdfxSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index dcbc7647f2..3f6822d457 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -60,7 +60,7 @@ * Alpha blending */ -static void tdfxUpdateAlphaMode( GLcontext *ctx ) +static void tdfxUpdateAlphaMode( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrCmpFnc_t func; @@ -283,7 +283,7 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) } } -static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void tdfxDDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -291,7 +291,7 @@ static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) fxMesa->new_state |= TDFX_NEW_ALPHA; } -static void tdfxDDBlendEquationSeparate( GLcontext *ctx, +static void tdfxDDBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -301,7 +301,7 @@ static void tdfxDDBlendEquationSeparate( GLcontext *ctx, fxMesa->new_state |= TDFX_NEW_ALPHA; } -static void tdfxDDBlendFuncSeparate( GLcontext *ctx, +static void tdfxDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -321,7 +321,7 @@ static void tdfxDDBlendFuncSeparate( GLcontext *ctx, * Stipple */ -void tdfxUpdateStipple( GLcontext *ctx ) +void tdfxUpdateStipple( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); GrStippleMode_t mode = GR_STIPPLE_DISABLE; @@ -347,7 +347,7 @@ void tdfxUpdateStipple( GLcontext *ctx ) * Depth testing */ -static void tdfxUpdateZMode( GLcontext *ctx ) +static void tdfxUpdateZMode( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); GrCmpFnc_t func; @@ -386,7 +386,7 @@ static void tdfxUpdateZMode( GLcontext *ctx ) } } -static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) +static void tdfxDDDepthFunc( struct gl_context *ctx, GLenum func ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -394,7 +394,7 @@ static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) fxMesa->new_state |= TDFX_NEW_DEPTH; } -static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) +static void tdfxDDDepthMask( struct gl_context *ctx, GLboolean flag ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -402,7 +402,7 @@ static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) fxMesa->new_state |= TDFX_NEW_DEPTH; } -static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d ) +static void tdfxDDClearDepth( struct gl_context *ctx, GLclampd d ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -445,7 +445,7 @@ static GrStencil_t convertGLStencilOp( GLenum op ) } -static void tdfxUpdateStencil( GLcontext *ctx ) +static void tdfxUpdateStencil( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -470,7 +470,7 @@ static void tdfxUpdateStencil( GLcontext *ctx ) static void -tdfxDDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +tdfxDDStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -480,7 +480,7 @@ tdfxDDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -tdfxDDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +tdfxDDStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -489,7 +489,7 @@ tdfxDDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) } static void -tdfxDDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum sfail, +tdfxDDStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum sfail, GLenum zfail, GLenum zpass ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -503,7 +503,7 @@ tdfxDDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum sfail, * Fog - orthographic fog still not working */ -static void tdfxUpdateFogAttrib( GLcontext *ctx ) +static void tdfxUpdateFogAttrib( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrFogMode_t mode; @@ -562,7 +562,7 @@ static void tdfxUpdateFogAttrib( GLcontext *ctx ) } } -static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void tdfxDDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -614,7 +614,7 @@ static int intersect_rect( drm_clip_rect_t *out, * Examine XF86 cliprect list and scissor state to recompute our * cliprect list. */ -void tdfxUpdateClipping( GLcontext *ctx ) +void tdfxUpdateClipping( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); __DRIdrawable *dPriv = fxMesa->driDrawable; @@ -695,7 +695,7 @@ void tdfxUpdateClipping( GLcontext *ctx ) * Culling */ -void tdfxUpdateCull( GLcontext *ctx ) +void tdfxUpdateCull( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrCullMode_t mode = GR_CULL_DISABLE; @@ -737,7 +737,7 @@ void tdfxUpdateCull( GLcontext *ctx ) } } -static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) +static void tdfxDDCullFace( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -745,7 +745,7 @@ static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) fxMesa->new_state |= TDFX_NEW_CULL; } -static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) +static void tdfxDDFrontFace( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -758,7 +758,7 @@ static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) * Line drawing. */ -static void tdfxUpdateLine( GLcontext *ctx ) +static void tdfxUpdateLine( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -771,7 +771,7 @@ static void tdfxUpdateLine( GLcontext *ctx ) } -static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) +static void tdfxDDLineWidth( struct gl_context *ctx, GLfloat width ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); FLUSH_BATCH( fxMesa ); @@ -783,7 +783,7 @@ static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) * Color Attributes */ -static void tdfxDDColorMask( GLcontext *ctx, +static void tdfxDDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -810,7 +810,7 @@ static void tdfxDDColorMask( GLcontext *ctx, } -static void tdfxDDClearColor( GLcontext *ctx, +static void tdfxDDClearColor( struct gl_context *ctx, const GLfloat color[4] ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -829,7 +829,7 @@ static void tdfxDDClearColor( GLcontext *ctx, * Light Model */ -static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, +static void tdfxDDLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -841,7 +841,7 @@ static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, } } -static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) +static void tdfxDDShadeModel( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -856,7 +856,7 @@ static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) */ static void -tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +tdfxDDScissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FLUSH_BATCH( fxMesa ); @@ -867,7 +867,7 @@ tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) * Render */ -static void tdfxUpdateRenderAttrib( GLcontext *ctx ) +static void tdfxUpdateRenderAttrib( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FLUSH_BATCH( fxMesa ); @@ -878,7 +878,7 @@ static void tdfxUpdateRenderAttrib( GLcontext *ctx ) * Viewport */ -void tdfxUpdateViewport( GLcontext *ctx ) +void tdfxUpdateViewport( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -895,7 +895,7 @@ void tdfxUpdateViewport( GLcontext *ctx ) } -static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, +static void tdfxDDViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -904,7 +904,7 @@ static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, } -static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal ) +static void tdfxDDDepthRange( struct gl_context *ctx, GLclampd nearVal, GLclampd farVal ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FLUSH_BATCH( fxMesa ); @@ -916,7 +916,7 @@ static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal * State enable/disable */ -static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void tdfxDDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -1017,7 +1017,7 @@ static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) /* Set the buffer used for drawing */ /* XXX support for separate read/draw buffers hasn't been tested */ -static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode ) +static void tdfxDDDrawBuffer( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1054,7 +1054,7 @@ static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode ) } -static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode ) +static void tdfxDDReadBuffer( struct gl_context *ctx, GLenum mode ) { /* XXX ??? */ } @@ -1064,7 +1064,7 @@ static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode ) * Polygon stipple */ -static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void tdfxDDPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); const GLubyte *m = mask; @@ -1119,7 +1119,7 @@ static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) -static void tdfxDDRenderMode( GLcontext *ctx, GLenum mode ) +static void tdfxDDRenderMode( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FALLBACK( fxMesa, TDFX_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -1150,7 +1150,7 @@ static void tdfxDDPrintState( const char *msg, GLuint flags ) -void tdfxDDUpdateHwState( GLcontext *ctx ) +void tdfxDDUpdateHwState( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); int new_state = fxMesa->new_state; @@ -1226,7 +1226,7 @@ void tdfxDDUpdateHwState( GLcontext *ctx ) } -static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void tdfxDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1242,7 +1242,7 @@ static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state ) */ void tdfxInitState( tdfxContextPtr fxMesa ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; GLint i; fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; @@ -1390,7 +1390,7 @@ void tdfxInitState( tdfxContextPtr fxMesa ) -void tdfxDDInitStateFuncs( GLcontext *ctx ) +void tdfxDDInitStateFuncs( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.h b/src/mesa/drivers/dri/tdfx/tdfx_state.h index 4880b990fc..2e96fcbeb5 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.h @@ -40,21 +40,21 @@ #include "main/context.h" #include "tdfx_context.h" -extern void tdfxDDInitStateFuncs( GLcontext *ctx ); +extern void tdfxDDInitStateFuncs( struct gl_context *ctx ); -extern void tdfxDDUpdateHwState( GLcontext *ctx ); +extern void tdfxDDUpdateHwState( struct gl_context *ctx ); extern void tdfxInitState( tdfxContextPtr fxMesa ); -extern void tdfxUpdateClipping( GLcontext *ctx ); +extern void tdfxUpdateClipping( struct gl_context *ctx ); -extern void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void tdfxFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) tdfxFallback( rmesa->glCtx, bit, mode ) -extern void tdfxUpdateCull( GLcontext *ctx ); -extern void tdfxUpdateStipple( GLcontext *ctx ); -extern void tdfxUpdateViewport( GLcontext *ctx ); +extern void tdfxUpdateCull( struct gl_context *ctx ); +extern void tdfxUpdateStipple( struct gl_context *ctx ); +extern void tdfxUpdateViewport( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 1c51452c10..0326b847cb 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -52,7 +52,7 @@ /* no borders! can't halve 1x1! (stride > width * comp) not allowed */ static void -_mesa_halve2x2_teximage2d ( GLcontext *ctx, +_mesa_halve2x2_teximage2d ( struct gl_context *ctx, struct gl_texture_image *texImage, GLuint bytesPerPixel, GLint srcWidth, GLint srcHeight, @@ -176,7 +176,7 @@ logbase2(int n) static void -tdfxGenerateMipmap(GLcontext *ctx, GLenum target, +tdfxGenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { GLint mipWidth, mipHeight; @@ -242,7 +242,7 @@ tdfxGenerateMipmap(GLcontext *ctx, GLenum target, * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0) */ static void -tdfxTexGetInfo(const GLcontext *ctx, int w, int h, +tdfxTexGetInfo(const struct gl_context *ctx, int w, int h, GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio, float *sscale, float *tscale, int *wscale, int *hscale) @@ -307,7 +307,7 @@ tdfxTexGetInfo(const GLcontext *ctx, int w, int h, * We need to call this when a texture object's minification filter * or texture image sizes change. */ -static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj) +static void RevalidateTexture(struct gl_context *ctx, struct gl_texture_object *tObj) { tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); GLint minl, maxl; @@ -390,7 +390,7 @@ fxAllocTexObjData(tdfxContextPtr fxMesa) * Called via glBindTexture. */ static void -tdfxBindTexture(GLcontext * ctx, GLenum target, +tdfxBindTexture(struct gl_context * ctx, GLenum target, struct gl_texture_object *tObj) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -419,7 +419,7 @@ tdfxBindTexture(GLcontext * ctx, GLenum target, * Called via glTexEnv. */ static void -tdfxTexEnv(GLcontext * ctx, GLenum target, GLenum pname, +tdfxTexEnv(struct gl_context * ctx, GLenum target, GLenum pname, const GLfloat * param) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -445,7 +445,7 @@ tdfxTexEnv(GLcontext * ctx, GLenum target, GLenum pname, * Called via glTexParameter. */ static void -tdfxTexParameter(GLcontext * ctx, GLenum target, +tdfxTexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat * params) { @@ -610,7 +610,7 @@ tdfxTexParameter(GLcontext * ctx, GLenum target, * Here, we delete the Glide data associated with the texture. */ static void -tdfxDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxDeleteTexture(struct gl_context * ctx, struct gl_texture_object *tObj) { if (ctx && ctx->DriverCtx) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -626,7 +626,7 @@ tdfxDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj) * Return true if texture is resident, false otherwise. */ static GLboolean -tdfxIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj) +tdfxIsTextureResident(struct gl_context *ctx, struct gl_texture_object *tObj) { tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); return (GLboolean) (ti && ti->isInTM); @@ -707,7 +707,7 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) static void -tdfxUpdateTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxUpdateTexturePalette(struct gl_context * ctx, struct gl_texture_object *tObj) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -760,7 +760,7 @@ fxTexusError(const char *string, FxBool fatal) static gl_format -tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +tdfxChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1216,7 +1216,7 @@ fxFetchFunction(GLint mesaFormat) static GLboolean -adjust2DRatio (GLcontext *ctx, +adjust2DRatio (struct gl_context *ctx, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const GLvoid *pixels, @@ -1302,7 +1302,7 @@ adjust2DRatio (GLcontext *ctx, static void -tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, @@ -1454,7 +1454,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, static void -tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1521,7 +1521,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, static void -tdfxTexImage1D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, @@ -1537,7 +1537,7 @@ tdfxTexImage1D(GLcontext *ctx, GLenum target, GLint level, } static void -tdfxTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -1561,7 +1561,7 @@ tdfxTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, /**********************************************************************/ static void -tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, +tdfxCompressedTexImage2D (struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -1671,7 +1671,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, static void -tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, +tdfxCompressedTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, @@ -1752,7 +1752,7 @@ PrintTexture(int w, int h, int c, const GLubyte * data) GLboolean -tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, +tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, @@ -1840,7 +1840,7 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -tdfxNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +tdfxNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.h b/src/mesa/drivers/dri/tdfx/tdfx_tex.h index a445935a01..26885fae3e 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.h @@ -47,47 +47,47 @@ extern void -tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj); +tdfxTexValidate(struct gl_context * ctx, struct gl_texture_object *tObj); #if 000 /* DEAD? */ extern void -fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state); +fxDDTexUseGlobalPalette(struct gl_context * ctx, GLboolean state); #endif extern GLboolean -tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, +tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border); extern GLvoid * -tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, +tdfxDDGetTexImage(struct gl_context * ctx, GLenum target, GLint level, const struct gl_texture_object *texObj, GLenum * formatOut, GLenum * typeOut, GLboolean * freeImageOut); extern void -tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, +tdfxDDGetCompressedTexImage( struct gl_context *ctx, GLenum target, GLint lod, void *image, const struct gl_texture_object *texObj, struct gl_texture_image *texImage ); extern GLint -tdfxSpecificCompressedTexFormat(GLcontext *ctx, +tdfxSpecificCompressedTexFormat(struct gl_context *ctx, GLint internalFormat, GLint numDimensions); extern GLint -tdfxBaseCompressedTexFormat(GLcontext *ctx, +tdfxBaseCompressedTexFormat(struct gl_context *ctx, GLint internalFormat); extern GLboolean -tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat); +tdfxDDIsCompressedFormat(struct gl_context *ctx, GLint internalFormat); extern GLsizei -tdfxDDCompressedImageSize(GLcontext *ctx, +tdfxDDCompressedImageSize(struct gl_context *ctx, GLenum intFormat, GLuint numDimensions, GLuint width, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.c b/src/mesa/drivers/dri/tdfx/tdfx_texman.c index dc46453916..1160ae2d0b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texman.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.c @@ -744,7 +744,7 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) void -tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, +tdfxTMReloadMipMapLevel(struct gl_context *ctx, struct gl_texture_object *tObj, GLint level) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -964,7 +964,7 @@ tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) */ void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects; GLuint id; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.h b/src/mesa/drivers/dri/tdfx/tdfx_texman.h index a9af4cb7c5..87bdc3fea9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texman.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.h @@ -48,7 +48,7 @@ extern void tdfxTMClose( tdfxContextPtr fxMesa ); extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj); -extern void tdfxTMReloadMipMapLevel( GLcontext *ctx, +extern void tdfxTMReloadMipMapLevel( struct gl_context *ctx, struct gl_texture_object *tObj, GLint level ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c index b04f48c7a7..227f36be65 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c @@ -160,7 +160,7 @@ * If we fail, we'll have to use software rendering. */ static GLboolean -SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, +SetupTexEnvNapalm(struct gl_context *ctx, GLboolean useIteratedRGBA, const struct gl_texture_unit *texUnit, GLenum baseFormat, struct tdfx_texcombine_ext *env) { @@ -838,7 +838,7 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, * If failure, we'll use software rendering. */ static GLboolean -SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, +SetupSingleTexEnvVoodoo3(struct gl_context *ctx, int unit, GLenum envMode, GLenum baseFormat) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1047,7 +1047,7 @@ SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, * If failure, we'll use software rendering. */ static GLboolean -SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0, +SetupDoubleTexEnvVoodoo3(struct gl_context *ctx, int tmu0, GLenum envMode0, GLenum baseFormat0, GLenum envMode1, GLenum baseFormat1) { @@ -1362,7 +1362,7 @@ setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) { struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData; tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); - const GLcontext *ctx = fxMesa->glCtx; + const struct gl_context *ctx = fxMesa->glCtx; /* Make sure we're not loaded incorrectly */ if (ti->isInTM && !shared->umaTexMemory) { @@ -1571,7 +1571,7 @@ selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend) #if 0 static void print_state(tdfxContextPtr fxMesa) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current; struct gl_texture_object *tObj1 = ctx->Texture.Unit[1]._Current; GLenum base0 = tObj0->Image[0][tObj0->BaseLevel] ? tObj0->Image[0][tObj0->BaseLevel]->Format : 99; @@ -1599,7 +1599,7 @@ static void print_state(tdfxContextPtr fxMesa) * Input: ctx - the context * unit - the OpenGL texture unit to use. */ -static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) +static void setupTextureSingleTMU(struct gl_context * ctx, GLuint unit) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); tdfxTexInfo *ti; @@ -1715,7 +1715,7 @@ setupDoubleTMU(tdfxContextPtr fxMesa, const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; - const GLcontext *ctx = fxMesa->glCtx; + const struct gl_context *ctx = fxMesa->glCtx; tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); GLuint tstate = 0; @@ -1914,7 +1914,7 @@ setupDoubleTMU(tdfxContextPtr fxMesa, #undef T1_IN_TMU1 } -static void setupTextureDoubleTMU(GLcontext * ctx) +static void setupTextureDoubleTMU(struct gl_context * ctx) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); struct gl_texture_object *tObj0 = ctx->Texture.Unit[1]._Current; @@ -2019,7 +2019,7 @@ static void setupTextureDoubleTMU(GLcontext * ctx) void -tdfxUpdateTextureState( GLcontext *ctx ) +tdfxUpdateTextureState( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -2108,7 +2108,7 @@ tdfxUpdateTextureState( GLcontext *ctx ) * This is very common in Quake3. */ void -tdfxUpdateTextureBinding( GLcontext *ctx ) +tdfxUpdateTextureBinding( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.h b/src/mesa/drivers/dri/tdfx/tdfx_texstate.h index 0c5c4101ca..92ac3a37eb 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.h @@ -37,7 +37,7 @@ #ifndef __TDFX_TEXSTATE_H__ #define __TDFX_TEXSTATE_H__ -extern void tdfxUpdateTextureState( GLcontext *ctx ); -extern void tdfxUpdateTextureBinding( GLcontext *ctx ); +extern void tdfxUpdateTextureState( struct gl_context *ctx ); +extern void tdfxUpdateTextureBinding( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c index d65833c20b..1f8cf6cde1 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c @@ -49,8 +49,8 @@ #include "tdfx_render.h" -static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim ); -static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void tdfxRasterPrimitive( struct gl_context *ctx, GLenum prim ); +static void tdfxRenderPrimitive( struct gl_context *ctx, GLenum prim ); static GLenum reduced_prim[GL_POLYGON+1] = { GL_POINTS, @@ -136,7 +136,7 @@ do { \ * primitives. */ static void -tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst) +tdfx_translate_vertex( struct gl_context *ctx, const tdfxVertex *src, SWvertex *dst) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -193,7 +193,7 @@ tdfx_fallback_tri( tdfxContextPtr fxMesa, tdfxVertex *v1, tdfxVertex *v2 ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; SWvertex v[3]; tdfx_translate_vertex( ctx, v0, &v[0] ); tdfx_translate_vertex( ctx, v1, &v[1] ); @@ -207,7 +207,7 @@ tdfx_fallback_line( tdfxContextPtr fxMesa, tdfxVertex *v0, tdfxVertex *v1 ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; SWvertex v[2]; tdfx_translate_vertex( ctx, v0, &v[0] ); tdfx_translate_vertex( ctx, v1, &v[1] ); @@ -219,7 +219,7 @@ static void tdfx_fallback_point( tdfxContextPtr fxMesa, tdfxVertex *v0 ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; SWvertex v[1]; tdfx_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -229,7 +229,7 @@ tdfx_fallback_point( tdfxContextPtr fxMesa, * Functions to draw basic primitives * ***********************************************************************/ -static void tdfx_print_vertex( GLcontext *ctx, const tdfxVertex *v ) +static void tdfx_print_vertex( struct gl_context *ctx, const tdfxVertex *v ) { tdfxContextPtr tmesa = TDFX_CONTEXT( ctx ); @@ -557,7 +557,7 @@ static void init_rast_tab( void ) */ #define INIT(x) tdfxRenderPrimitive( ctx, x ) -static void tdfx_render_vb_points( GLcontext *ctx, +static void tdfx_render_vb_points( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -584,7 +584,7 @@ static void tdfx_render_vb_points( GLcontext *ctx, } } -static void tdfx_render_vb_line_strip( GLcontext *ctx, +static void tdfx_render_vb_line_strip( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -612,7 +612,7 @@ static void tdfx_render_vb_line_strip( GLcontext *ctx, } } -static void tdfx_render_vb_line_loop( GLcontext *ctx, +static void tdfx_render_vb_line_loop( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -649,7 +649,7 @@ static void tdfx_render_vb_line_loop( GLcontext *ctx, } } -static void tdfx_render_vb_lines( GLcontext *ctx, +static void tdfx_render_vb_lines( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -677,7 +677,7 @@ static void tdfx_render_vb_lines( GLcontext *ctx, } } -static void tdfx_render_vb_triangles( GLcontext *ctx, +static void tdfx_render_vb_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -708,7 +708,7 @@ static void tdfx_render_vb_triangles( GLcontext *ctx, } -static void tdfx_render_vb_tri_strip( GLcontext *ctx, +static void tdfx_render_vb_tri_strip( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -730,7 +730,7 @@ static void tdfx_render_vb_tri_strip( GLcontext *ctx, } -static void tdfx_render_vb_tri_fan( GLcontext *ctx, +static void tdfx_render_vb_tri_fan( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -745,7 +745,7 @@ static void tdfx_render_vb_tri_fan( GLcontext *ctx, fxVB + start, sizeof(tdfxVertex) ); } -static void tdfx_render_vb_quads( GLcontext *ctx, +static void tdfx_render_vb_quads( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -771,7 +771,7 @@ static void tdfx_render_vb_quads( GLcontext *ctx, } } -static void tdfx_render_vb_quad_strip( GLcontext *ctx, +static void tdfx_render_vb_quad_strip( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -788,7 +788,7 @@ static void tdfx_render_vb_quad_strip( GLcontext *ctx, count-start, fxVB + start, sizeof(tdfxVertex)); } -static void tdfx_render_vb_poly( GLcontext *ctx, +static void tdfx_render_vb_poly( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -803,7 +803,7 @@ static void tdfx_render_vb_poly( GLcontext *ctx, fxVB + start, sizeof(tdfxVertex)); } -static void tdfx_render_vb_noop( GLcontext *ctx, +static void tdfx_render_vb_noop( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -811,7 +811,7 @@ static void tdfx_render_vb_noop( GLcontext *ctx, (void) (ctx && start && count && flags); } -static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *, +static void (*tdfx_render_tab_verts[GL_POLYGON+2])(struct gl_context *, GLuint, GLuint, GLuint) = @@ -897,7 +897,7 @@ static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *, -static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void tdfxRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -920,13 +920,13 @@ static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts, tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void tdfxRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void tdfxRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } -static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void tdfxFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { int i; @@ -974,7 +974,7 @@ static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, _NEW_POLYGONSTIPPLE) -static void tdfxChooseRenderState(GLcontext *ctx) +static void tdfxChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1061,7 +1061,7 @@ static void tdfxChooseRenderState(GLcontext *ctx) * TODO: Use single back-buffer cliprect where possible. * NOTE: starts at 1, not zero! */ -static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) +static GLboolean multipass_cliprect( struct gl_context *ctx, GLuint pass ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (pass >= fxMesa->numClipRects) @@ -1081,7 +1081,7 @@ static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) /* Runtime render state and callbacks */ /**********************************************************************/ -static void tdfxRunPipeline( GLcontext *ctx ) +static void tdfxRunPipeline( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1103,7 +1103,7 @@ static void tdfxRunPipeline( GLcontext *ctx ) } -static void tdfxRenderStart( GLcontext *ctx ) +static void tdfxRenderStart( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1138,7 +1138,7 @@ static void tdfxRenderStart( GLcontext *ctx ) /* Always called between RenderStart and RenderFinish --> We already * hold the lock. */ -static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim ) +static void tdfxRasterPrimitive( struct gl_context *ctx, GLenum prim ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -1170,7 +1170,7 @@ static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim ) * which renders strips as strips, the equivalent calculations are * performed in tdfx_render.c. */ -static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void tdfxRenderPrimitive( struct gl_context *ctx, GLenum prim ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -1185,7 +1185,7 @@ static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim ) } } -static void tdfxRenderFinish( GLcontext *ctx ) +static void tdfxRenderFinish( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1227,7 +1227,7 @@ static char *getFallbackString(GLuint bit) } -void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void tdfxFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1266,7 +1266,7 @@ void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) } -void tdfxDDInitTriFuncs( GLcontext *ctx ) +void tdfxDDInitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.h b/src/mesa/drivers/dri/tdfx/tdfx_tris.h index ec48a48692..421b8e1c0d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.h @@ -35,7 +35,7 @@ #include "main/mtypes.h" -extern void tdfxDDInitTriFuncs( GLcontext *ctx ); +extern void tdfxDDInitTriFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c index 546d89aa84..dafb6eccd9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c @@ -33,7 +33,7 @@ #include "tdfx_vb.h" #include "tdfx_render.h" -static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); tdfxVertex *dst = fxMesa->verts + edst; @@ -42,10 +42,10 @@ static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) } static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void * ); + void (*emit)( struct gl_context *, GLuint, GLuint, void * ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_format; } setup_tab[TDFX_MAX_SETUP]; @@ -55,7 +55,7 @@ static struct { #define GET_COLOR(ptr, idx) ((ptr)->data[idx]) -static void interp_extras( GLcontext *ctx, +static void interp_extras( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) @@ -79,7 +79,7 @@ static void interp_extras( GLcontext *ctx, force_boundary); } -static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) +static void copy_pv_extras( struct gl_context *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -204,7 +204,7 @@ void tdfxPrintSetupFlags(char *msg, GLuint flags ) -void tdfxCheckTexSizes( GLcontext *ctx ) +void tdfxCheckTexSizes( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -234,7 +234,7 @@ void tdfxCheckTexSizes( GLcontext *ctx ) } -void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, +void tdfxBuildVertices( struct gl_context *ctx, GLuint start, GLuint end, GLuint newinputs ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -275,7 +275,7 @@ void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, } -void tdfxChooseVertexState( GLcontext *ctx ) +void tdfxChooseVertexState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -321,7 +321,7 @@ void tdfxChooseVertexState( GLcontext *ctx ) -void tdfxInitVB( GLcontext *ctx ) +void tdfxInitVB( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -337,7 +337,7 @@ void tdfxInitVB( GLcontext *ctx ) } -void tdfxFreeVB( GLcontext *ctx ) +void tdfxFreeVB( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (fxMesa->verts) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.h b/src/mesa/drivers/dri/tdfx/tdfx_vb.h index 1e190e85f6..238a076d87 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.h @@ -48,21 +48,21 @@ _NEW_FOG) -extern void tdfxValidateBuildProjVerts(GLcontext *ctx, +extern void tdfxValidateBuildProjVerts(struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void tdfxPrintSetupFlags(char *msg, GLuint flags ); -extern void tdfxInitVB( GLcontext *ctx ); +extern void tdfxInitVB( struct gl_context *ctx ); -extern void tdfxFreeVB( GLcontext *ctx ); +extern void tdfxFreeVB( struct gl_context *ctx ); -extern void tdfxCheckTexSizes( GLcontext *ctx ); +extern void tdfxCheckTexSizes( struct gl_context *ctx ); -extern void tdfxChooseVertexState( GLcontext *ctx ); +extern void tdfxChooseVertexState( struct gl_context *ctx ); -extern void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, +extern void tdfxBuildVertices( struct gl_context *ctx, GLuint start, GLuint end, GLuint newinputs ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h index 19baf7d0d2..c593ce05ea 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h @@ -33,7 +33,7 @@ #define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14] -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest ) { @@ -157,7 +157,7 @@ static void TAG(emit)( GLcontext *ctx, } -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { /* fprintf(stderr, "%s\n", __FUNCTION__); */ @@ -183,7 +183,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) } -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 5e6e271b45..963609bde4 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -77,7 +77,7 @@ GLuint VIA_DEBUG = 0; * * \sa glGetString */ -static const GLubyte *viaGetString(GLcontext *ctx, GLenum name) +static const GLubyte *viaGetString(struct gl_context *ctx, GLenum name) { static char buffer[128]; unsigned offset; @@ -133,7 +133,7 @@ viaDeleteRenderbuffer(struct gl_renderbuffer *rb) } static GLboolean -viaRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, +viaRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { rb->Width = width; @@ -352,7 +352,7 @@ calculate_buffer_parameters(struct via_context *vmesa, } -void viaReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, +void viaReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -461,7 +461,7 @@ viaCreateContext(gl_api api, __DRIcontext *driContextPriv, void *sharedContextPrivate) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; struct via_context *vmesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; @@ -830,7 +830,7 @@ viaMakeCurrent(__DRIcontext *driContextPriv, if (driContextPriv) { struct via_context *vmesa = (struct via_context *)driContextPriv->driverPrivate; - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; struct gl_framebuffer *drawBuffer, *readBuffer; drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; @@ -935,7 +935,7 @@ viaSwapBuffers(__DRIdrawable *drawablePrivate) dPriv->driContextPriv->driverPrivate) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; _mesa_notifySwapBuffers(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 4e3bed342d..660e771407 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -153,8 +153,8 @@ struct via_texture_object { struct via_context { GLint refcount; - GLcontext *glCtx; - GLcontext *shareCtx; + struct gl_context *glCtx; + struct gl_context *shareCtx; /* XXX These don't belong here. They should be per-drawable state. */ struct via_renderbuffer front; @@ -394,7 +394,7 @@ extern void viaEmitHwStateLocked(struct via_context *vmesa); extern void viaEmitScissorValues(struct via_context *vmesa, int box_nr, int emit); extern void viaXMesaSetBackClipRects(struct via_context *vmesa); extern void viaXMesaSetFrontClipRects(struct via_context *vmesa); -extern void viaReAllocateBuffers(GLcontext *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); +extern void viaReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); extern void viaXMesaWindowMoved(struct via_context *vmesa); extern GLboolean viaTexCombineState(struct via_context *vmesa, diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 25aad1b204..116adda18e 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -201,7 +201,7 @@ static void viaFillBuffer(struct via_context *vmesa, -static void viaClear(GLcontext *ctx, GLbitfield mask) +static void viaClear(struct gl_context *ctx, GLbitfield mask) { struct via_context *vmesa = VIA_CONTEXT(ctx); __DRIdrawable *dPriv = vmesa->driDrawable; @@ -951,25 +951,25 @@ void viaFlushDma(struct via_context *vmesa) } } -static void viaFlush(GLcontext *ctx) +static void viaFlush(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); VIA_FLUSH_DMA(vmesa); } -static void viaFinish(GLcontext *ctx) +static void viaFinish(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); VIA_FLUSH_DMA(vmesa); viaWaitIdle(vmesa, GL_FALSE); } -static void viaClearStencil(GLcontext *ctx, int s) +static void viaClearStencil(struct gl_context *ctx, int s) { return; } -void viaInitIoctlFuncs(GLcontext *ctx) +void viaInitIoctlFuncs(struct gl_context *ctx) { ctx->Driver.Flush = viaFlush; ctx->Driver.Clear = viaClear; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h index c6b32cf085..03df789b52 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.h +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h @@ -32,7 +32,7 @@ void viaFinishPrimitive(struct via_context *vmesa); void viaFlushDma(struct via_context *vmesa); void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags); -void viaInitIoctlFuncs(GLcontext *ctx); +void viaInitIoctlFuncs(struct gl_context *ctx); void viaCopyBuffer(__DRIdrawable *dpriv); void viaPageFlip(__DRIdrawable *dpriv); void viaCheckDma(struct via_context *vmesa, GLuint bytes); diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c index 4351f11955..10e2b4eadd 100644 --- a/src/mesa/drivers/dri/unichrome/via_render.c +++ b/src/mesa/drivers/dri/unichrome/via_render.c @@ -86,7 +86,7 @@ /**********************************************************************/ /* Fast Render pipeline stage */ /**********************************************************************/ -static GLboolean via_run_fastrender(GLcontext *ctx, +static GLboolean via_run_fastrender(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { struct via_context *vmesa = VIA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index 31f794ffc8..4ca584261b 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -149,21 +149,21 @@ /* Move locking out to get reasonable span performance. */ -void viaSpanRenderStart( GLcontext *ctx ) +void viaSpanRenderStart( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); viaWaitIdle(vmesa, GL_FALSE); LOCK_HARDWARE(vmesa); } -void viaSpanRenderFinish( GLcontext *ctx ) +void viaSpanRenderFinish( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); _swrast_flush( ctx ); UNLOCK_HARDWARE( vmesa ); } -void viaInitSpanFuncs(GLcontext *ctx) +void viaInitSpanFuncs(struct gl_context *ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = viaSpanRenderStart; diff --git a/src/mesa/drivers/dri/unichrome/via_span.h b/src/mesa/drivers/dri/unichrome/via_span.h index 8830075bff..b7abf68538 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.h +++ b/src/mesa/drivers/dri/unichrome/via_span.h @@ -25,9 +25,9 @@ #ifndef _VIA_SPAN_H #define _VIA_SPAN_H -extern void viaInitSpanFuncs(GLcontext *ctx); -extern void viaSpanRenderStart( GLcontext *ctx ); -extern void viaSpanRenderFinish( GLcontext *ctx ); +extern void viaInitSpanFuncs(struct gl_context *ctx); +extern void viaSpanRenderStart( struct gl_context *ctx ); +extern void viaSpanRenderFinish( struct gl_context *ctx ); extern void viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis); diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index f7029b9492..033352188d 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -78,7 +78,7 @@ static GLuint viaComputeLodBias(GLfloat bias) void viaEmitState(struct via_context *vmesa) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; GLuint i = 0; GLuint j = 0; RING_VARS; @@ -523,7 +523,7 @@ static INLINE GLuint viaPackColor(GLuint bpp, } } -static void viaBlendEquationSeparate(GLcontext *ctx, +static void viaBlendEquationSeparate(struct gl_context *ctx, GLenum rgbMode, GLenum aMode) { @@ -545,7 +545,7 @@ static void viaBlendEquationSeparate(GLcontext *ctx, ctx->Color.LogicOp != GL_COPY)); } -static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) +static void viaBlendFunc(struct gl_context *ctx, GLenum sfactor, GLenum dfactor) { struct via_context *vmesa = VIA_CONTEXT(ctx); GLboolean fallback = GL_FALSE; @@ -580,7 +580,7 @@ static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) /* Shouldn't be called as the extension is disabled. */ -static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, +static void viaBlendFuncSeparate(struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { @@ -597,7 +597,7 @@ static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, /* ============================================================= * Hardware clipping */ -static void viaScissor(GLcontext *ctx, GLint x, GLint y, +static void viaScissor(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -619,7 +619,7 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y, vmesa->scissorRect.y2 = vmesa->driDrawable->h - y; } -static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state) +static void viaEnable(struct gl_context *ctx, GLenum cap, GLboolean state) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -637,13 +637,13 @@ static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state) /* Fallback to swrast for select and feedback. */ -static void viaRenderMode(GLcontext *ctx, GLenum mode) +static void viaRenderMode(struct gl_context *ctx, GLenum mode) { FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER)); } -static void viaDrawBuffer(GLcontext *ctx, GLenum mode) +static void viaDrawBuffer(struct gl_context *ctx, GLenum mode) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -678,7 +678,7 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode) viaXMesaWindowMoved(vmesa); } -static void viaClearColor(GLcontext *ctx, const GLfloat color[4]) +static void viaClearColor(struct gl_context *ctx, const GLfloat color[4]) { struct via_context *vmesa = VIA_CONTEXT(ctx); GLubyte pcolor[4]; @@ -696,7 +696,7 @@ static void viaClearColor(GLcontext *ctx, const GLfloat color[4]) #define WRITEMASK_GREEN_SHIFT 29 #define WRITEMASK_BLUE_SHIFT 28 -static void viaColorMask(GLcontext *ctx, +static void viaColorMask(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { @@ -716,7 +716,7 @@ static void viaColorMask(GLcontext *ctx, /* This hardware just isn't capable of private back buffers without * glitches and/or a hefty locking scheme. */ -void viaCalcViewport(GLcontext *ctx) +void viaCalcViewport(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); __DRIdrawable *dPriv = vmesa->driDrawable; @@ -733,20 +733,20 @@ void viaCalcViewport(GLcontext *ctx) m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max); } -static void viaViewport(GLcontext *ctx, +static void viaViewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { viaCalcViewport(ctx); } -static void viaDepthRange(GLcontext *ctx, +static void viaDepthRange(struct gl_context *ctx, GLclampd nearval, GLclampd farval) { viaCalcViewport(ctx); } -void viaInitState(GLcontext *ctx) +void viaInitState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -865,7 +865,7 @@ get_minmag_filter( GLenum min, GLenum mag ) } -static GLboolean viaChooseTextureState(GLcontext *ctx) +static GLboolean viaChooseTextureState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0]; @@ -950,7 +950,7 @@ static GLboolean viaChooseTextureState(GLcontext *ctx) return GL_TRUE; } -static void viaChooseColorState(GLcontext *ctx) +static void viaChooseColorState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); GLenum s = ctx->Color.BlendSrcRGB; @@ -1246,7 +1246,7 @@ static void viaChooseColorState(GLcontext *ctx) vmesa->regEnable &= ~HC_HenAW_MASK; } -static void viaChooseFogState(GLcontext *ctx) +static void viaChooseFogState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1271,7 +1271,7 @@ static void viaChooseFogState(GLcontext *ctx) } } -static void viaChooseDepthState(GLcontext *ctx) +static void viaChooseDepthState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); if (ctx->Depth.Test) { @@ -1295,7 +1295,7 @@ static void viaChooseDepthState(GLcontext *ctx) } } -static void viaChooseLineState(GLcontext *ctx) +static void viaChooseLineState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1309,7 +1309,7 @@ static void viaChooseLineState(GLcontext *ctx) } } -static void viaChoosePolygonState(GLcontext *ctx) +static void viaChoosePolygonState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1335,7 +1335,7 @@ static void viaChoosePolygonState(GLcontext *ctx) } } -static void viaChooseStencilState(GLcontext *ctx) +static void viaChooseStencilState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1421,7 +1421,7 @@ static void viaChooseStencilState(GLcontext *ctx) -static void viaChooseTriangle(GLcontext *ctx) +static void viaChooseTriangle(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1445,7 +1445,7 @@ static void viaChooseTriangle(GLcontext *ctx) } } -void viaValidateState( GLcontext *ctx ) +void viaValidateState( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1492,7 +1492,7 @@ void viaValidateState( GLcontext *ctx ) vmesa->newState = 0; } -static void viaInvalidateState(GLcontext *ctx, GLuint newState) +static void viaInvalidateState(struct gl_context *ctx, GLuint newState) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1505,7 +1505,7 @@ static void viaInvalidateState(GLcontext *ctx, GLuint newState) _tnl_InvalidateState(ctx, newState); } -void viaInitStateFuncs(GLcontext *ctx) +void viaInitStateFuncs(struct gl_context *ctx) { /* Callbacks for internal Mesa events. */ diff --git a/src/mesa/drivers/dri/unichrome/via_state.h b/src/mesa/drivers/dri/unichrome/via_state.h index 065ec57d33..8a23705520 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.h +++ b/src/mesa/drivers/dri/unichrome/via_state.h @@ -27,10 +27,10 @@ #include "via_context.h" -extern void viaInitState(GLcontext *ctx); -extern void viaInitStateFuncs(GLcontext *ctx); -extern void viaCalcViewport(GLcontext *ctx); -extern void viaValidateState(GLcontext *ctx); +extern void viaInitState(struct gl_context *ctx); +extern void viaInitStateFuncs(struct gl_context *ctx); +extern void viaCalcViewport(struct gl_context *ctx); +extern void viaValidateState(struct gl_context *ctx); extern void viaEmitState(struct via_context *vmesa); extern void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 49426fef8d..18fb8f33b9 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -45,7 +45,7 @@ #include "via_3d_reg.h" static gl_format -viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, +viaChooseTexFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -437,7 +437,7 @@ GLboolean viaSwapOutWork( struct via_context *vmesa ) /* Basically, just collect the image dimensions and addresses for each * image and update the texture object state accordingly. */ -static GLboolean viaSetTexImages(GLcontext *ctx, +static GLboolean viaSetTexImages(struct gl_context *ctx, struct gl_texture_object *texObj) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -624,7 +624,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx, } -GLboolean viaUpdateTextureState( GLcontext *ctx ) +GLboolean viaUpdateTextureState( struct gl_context *ctx ) { struct gl_texture_unit *texUnit = ctx->Texture.Unit; GLuint i; @@ -651,7 +651,7 @@ GLboolean viaUpdateTextureState( GLcontext *ctx ) -static void viaTexImage(GLcontext *ctx, +static void viaTexImage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, @@ -798,7 +798,7 @@ static void viaTexImage(GLcontext *ctx, _mesa_unmap_teximage_pbo(ctx, packing); } -static void viaTexImage2D(GLcontext *ctx, +static void viaTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, @@ -813,7 +813,7 @@ static void viaTexImage2D(GLcontext *ctx, packing, texObj, texImage ); } -static void viaTexSubImage2D(GLcontext *ctx, +static void viaTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -834,7 +834,7 @@ static void viaTexSubImage2D(GLcontext *ctx, texImage); } -static void viaTexImage1D(GLcontext *ctx, +static void viaTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, @@ -849,7 +849,7 @@ static void viaTexImage1D(GLcontext *ctx, packing, texObj, texImage ); } -static void viaTexSubImage1D(GLcontext *ctx, +static void viaTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -872,7 +872,7 @@ static void viaTexSubImage1D(GLcontext *ctx, -static GLboolean viaIsTextureResident(GLcontext *ctx, +static GLboolean viaIsTextureResident(struct gl_context *ctx, struct gl_texture_object *texObj) { struct via_texture_object *viaObj = @@ -884,14 +884,14 @@ static GLboolean viaIsTextureResident(GLcontext *ctx, -static struct gl_texture_image *viaNewTextureImage( GLcontext *ctx ) +static struct gl_texture_image *viaNewTextureImage( struct gl_context *ctx ) { (void) ctx; return (struct gl_texture_image *)CALLOC_STRUCT(via_texture_image); } -static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx, +static struct gl_texture_object *viaNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { @@ -906,7 +906,7 @@ static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx, } -static void viaFreeTextureImageData( GLcontext *ctx, +static void viaFreeTextureImageData( struct gl_context *ctx, struct gl_texture_image *texImage ) { struct via_context *vmesa = VIA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.h b/src/mesa/drivers/dri/unichrome/via_tex.h index 25eeee32f3..9495c956b5 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.h +++ b/src/mesa/drivers/dri/unichrome/via_tex.h @@ -30,7 +30,7 @@ struct via_context; -GLboolean viaUpdateTextureState(GLcontext *ctx); +GLboolean viaUpdateTextureState(struct gl_context *ctx); void viaInitTextureFuncs(struct dd_function_table * functions); GLboolean viaSwapOutWork( struct via_context *vmesa ); diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index be3c9a770f..51f6af9228 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -490,7 +490,7 @@ via_fallback_tri(struct via_context *vmesa, viaVertex *v1, viaVertex *v2) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; SWvertex v[3]; _swsetup_Translate(ctx, v0, &v[0]); _swsetup_Translate(ctx, v1, &v[1]); @@ -506,7 +506,7 @@ via_fallback_line(struct via_context *vmesa, viaVertex *v0, viaVertex *v1) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; SWvertex v[2]; _swsetup_Translate(ctx, v0, &v[0]); _swsetup_Translate(ctx, v1, &v[1]); @@ -520,7 +520,7 @@ static void via_fallback_point(struct via_context *vmesa, viaVertex *v0) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; SWvertex v[1]; _swsetup_Translate(ctx, v0, &v[0]); viaSpanRenderStart( ctx ); @@ -528,7 +528,7 @@ via_fallback_point(struct via_context *vmesa, viaSpanRenderFinish( ctx ); } -static void viaResetLineStipple( GLcontext *ctx ) +static void viaResetLineStipple( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); vmesa->regCmdB |= HC_HLPrst_MASK; @@ -578,7 +578,7 @@ static void viaResetLineStipple( GLcontext *ctx ) -static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, +static void viaRenderClippedPoly(struct gl_context *ctx, const GLuint *elts, GLuint n) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -602,13 +602,13 @@ static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj) +static void viaRenderClippedLine(struct gl_context *ctx, GLuint ii, GLuint jj) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line(ctx, ii, jj); } -static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, +static void viaFastRenderClippedPoly(struct gl_context *ctx, const GLuint *elts, GLuint n) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -645,7 +645,7 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, _NEW_POLYGONSTIPPLE) -static void viaChooseRenderState(GLcontext *ctx) +static void viaChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -739,7 +739,7 @@ do { \ -static void viaChooseVertexState( GLcontext *ctx ) +static void viaChooseVertexState( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -822,7 +822,7 @@ static void viaChooseVertexState( GLcontext *ctx ) * them. Fallback to swrast if we can't. Returns GL_TRUE if projective * texture coordinates must be faked, GL_FALSE otherwise. */ -static GLboolean viaCheckPTexHack( GLcontext *ctx ) +static GLboolean viaCheckPTexHack( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -853,7 +853,7 @@ static GLboolean viaCheckPTexHack( GLcontext *ctx ) /**********************************************************************/ -static void viaRenderStart(GLcontext *ctx) +static void viaRenderStart(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -888,7 +888,7 @@ static void viaRenderStart(GLcontext *ctx) VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; } -static void viaRenderFinish(GLcontext *ctx) +static void viaRenderFinish(struct gl_context *ctx) { VIA_FINISH_PRIM(VIA_CONTEXT(ctx)); } @@ -897,7 +897,7 @@ static void viaRenderFinish(GLcontext *ctx) /* System to flush dma and emit state changes based on the rasterized * primitive. */ -void viaRasterPrimitive(GLcontext *ctx, +void viaRasterPrimitive(struct gl_context *ctx, GLenum glprim, GLenum hwprim) { @@ -1035,7 +1035,7 @@ void viaRasterPrimitive(GLcontext *ctx, /* Callback for mesa: */ -static void viaRenderPrimitive( GLcontext *ctx, GLuint prim ) +static void viaRenderPrimitive( struct gl_context *ctx, GLuint prim ) { viaRasterPrimitive( ctx, prim, hwPrim[prim] ); } @@ -1103,7 +1103,7 @@ void viaFinishPrimitive(struct via_context *vmesa) void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldfallback = vmesa->Fallback; @@ -1148,7 +1148,7 @@ void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode) } } -static void viaRunPipeline( GLcontext *ctx ) +static void viaRunPipeline( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1166,7 +1166,7 @@ static void viaRunPipeline( GLcontext *ctx ) /**********************************************************************/ -void viaInitTriFuncs(GLcontext *ctx) +void viaInitTriFuncs(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_tris.h b/src/mesa/drivers/dri/unichrome/via_tris.h index bc6ef4e4eb..4bc83fc624 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.h +++ b/src/mesa/drivers/dri/unichrome/via_tris.h @@ -28,8 +28,8 @@ #include "main/mtypes.h" extern void viaPrintRenderState(const char *msg, GLuint state); -extern void viaInitTriFuncs(GLcontext *ctx); -extern void viaRasterPrimitive(GLcontext *ctx, GLenum rPrim, GLuint hwPrim); -extern void viaRasterPrimitiveFinish(GLcontext *ctx); +extern void viaInitTriFuncs(struct gl_context *ctx); +extern void viaRasterPrimitive(struct gl_context *ctx, GLenum rPrim, GLuint hwPrim); +extern void viaRasterPrimitiveFinish(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index fd3432a983..5195bca97f 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -95,10 +95,10 @@ struct GLFBDevBufferRec { }; /** - * Derived from Mesa's GLcontext class. + * Derived from Mesa's struct gl_context class. */ struct GLFBDevContextRec { - GLcontext glcontext; /* base class */ + struct gl_context glcontext; /* base class */ GLFBDevVisualPtr visual; GLFBDevBufferPtr drawBuffer; GLFBDevBufferPtr readBuffer; @@ -122,7 +122,7 @@ struct GLFBDevRenderbufferRec { static const GLubyte * -get_string(GLcontext *ctx, GLenum pname) +get_string(struct gl_context *ctx, GLenum pname) { (void) ctx; switch (pname) { @@ -135,7 +135,7 @@ get_string(GLcontext *ctx, GLenum pname) static void -update_state( GLcontext *ctx, GLuint new_state ) +update_state( struct gl_context *ctx, GLuint new_state ) { /* not much to do here - pass it on */ _swrast_InvalidateState( ctx, new_state ); @@ -159,7 +159,7 @@ get_buffer_size( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) * framebuffer size has changed (and update corresponding state). */ static void -viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { GLuint newWidth, newHeight; struct gl_framebuffer *buffer; @@ -463,7 +463,7 @@ delete_renderbuffer(struct gl_renderbuffer *rb) static GLboolean -renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { /* no-op: the renderbuffer storage is allocated just once when it's @@ -706,7 +706,7 @@ GLFBDevContextPtr glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) { GLFBDevContextPtr ctx; - GLcontext *glctx; + struct gl_context *glctx; struct dd_function_table functions; ASSERT(visual); @@ -732,7 +732,7 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) ctx->visual = visual; /* Create module contexts */ - glctx = (GLcontext *) &ctx->glcontext; + glctx = (struct gl_context *) &ctx->glcontext; _swrast_CreateContext( glctx ); _vbo_CreateContext( glctx ); _tnl_CreateContext( glctx ); @@ -762,7 +762,7 @@ glFBDevDestroyContext( GLFBDevContextPtr context ) GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext(); if (context) { - GLcontext *mesaCtx = &context->glcontext; + struct gl_context *mesaCtx = &context->glcontext; _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 4b264539cb..37dc35cbed 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -57,11 +57,11 @@ /** - * OSMesa rendering context, derived from core Mesa GLcontext. + * OSMesa rendering context, derived from core Mesa struct gl_context. */ struct osmesa_context { - GLcontext mesa; /*< Base class - this must be first */ + struct gl_context mesa; /*< Base class - this must be first */ struct gl_config *gl_visual; /*< Describes the buffers */ struct gl_renderbuffer *rb; /*< The user's colorbuffer */ struct gl_framebuffer *gl_buffer; /*< The framebuffer, containing user's rb */ @@ -75,7 +75,7 @@ struct osmesa_context static INLINE OSMesaContext -OSMESA_CONTEXT(GLcontext *ctx) +OSMESA_CONTEXT(struct gl_context *ctx) { /* Just cast, since we're using structure containment */ return (OSMesaContext) ctx; @@ -88,7 +88,7 @@ OSMESA_CONTEXT(GLcontext *ctx) static const GLubyte * -get_string( GLcontext *ctx, GLenum name ) +get_string( struct gl_context *ctx, GLenum name ) { (void) ctx; switch (name) { @@ -107,7 +107,7 @@ get_string( GLcontext *ctx, GLenum name ) static void -osmesa_update_state( GLcontext *ctx, GLuint new_state ) +osmesa_update_state( struct gl_context *ctx, GLuint new_state ) { /* easy - just propogate */ _swrast_InvalidateState( ctx, new_state ); @@ -557,7 +557,7 @@ do { \ * function. Otherwise, return NULL. */ static swrast_line_func -osmesa_choose_line_function( GLcontext *ctx ) +osmesa_choose_line_function( struct gl_context *ctx ) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -668,7 +668,7 @@ osmesa_choose_line_function( GLcontext *ctx ) * Return pointer to an optimized triangle function if possible. */ static swrast_tri_func -osmesa_choose_triangle_function( GLcontext *ctx ) +osmesa_choose_triangle_function( struct gl_context *ctx ) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -708,7 +708,7 @@ osmesa_choose_triangle_function( GLcontext *ctx ) * standard swrast functions. */ static void -osmesa_choose_triangle( GLcontext *ctx ) +osmesa_choose_triangle( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -718,7 +718,7 @@ osmesa_choose_triangle( GLcontext *ctx ) } static void -osmesa_choose_line( GLcontext *ctx ) +osmesa_choose_line( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -806,7 +806,7 @@ osmesa_delete_renderbuffer(struct gl_renderbuffer *rb) * Just set up all the gl_renderbuffer methods. */ static GLboolean -osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); @@ -994,7 +994,7 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, * Allocate a new renderbuffer to describe the user-provided color buffer. */ static struct gl_renderbuffer * -new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type) +new_osmesa_renderbuffer(struct gl_context *ctx, GLenum format, GLenum type) { const GLuint name = 0; struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name); @@ -1157,7 +1157,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, if (!_mesa_initialize_context(&osmesa->mesa, osmesa->gl_visual, sharelist ? &sharelist->mesa - : (GLcontext *) NULL, + : (struct gl_context *) NULL, &functions, (void *) osmesa)) { _mesa_destroy_visual( osmesa->gl_visual ); free(osmesa); @@ -1202,7 +1202,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, /* Initialize the software rasterizer and helper modules. */ { - GLcontext *ctx = &osmesa->mesa; + struct gl_context *ctx = &osmesa->mesa; SWcontext *swrast; TNLcontext *tnl; @@ -1367,7 +1367,7 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type, GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) { - GLcontext *ctx = _mesa_get_current_context(); + struct gl_context *ctx = _mesa_get_current_context(); if (ctx) return (OSMesaContext) ctx; else diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 39d2704417..833e2526f3 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -92,9 +92,9 @@ static WMesaFramebuffer wmesa_framebuffer(struct gl_framebuffer *fb) /** - * Given a GLcontext, return the corresponding WMesaContext. + * Given a struct gl_context, return the corresponding WMesaContext. */ -static WMesaContext wmesa_context(const GLcontext *ctx) +static WMesaContext wmesa_context(const struct gl_context *ctx) { return (WMesaContext) ctx; } @@ -104,7 +104,7 @@ static WMesaContext wmesa_context(const GLcontext *ctx) * Every driver should implement a GetString function in order to * return a meaningful GL_RENDERER string. */ -static const GLubyte *wmesa_get_string(GLcontext *ctx, GLenum name) +static const GLubyte *wmesa_get_string(struct gl_context *ctx, GLenum name) { return (name == GL_RENDERER) ? (GLubyte *) "Mesa Windows GDI Driver" : NULL; @@ -224,7 +224,7 @@ wmesa_get_buffer_size(struct gl_framebuffer *buffer, GLuint *width, GLuint *heig } -static void wmesa_flush(GLcontext *ctx) +static void wmesa_flush(struct gl_context *ctx) { WMesaContext pwc = wmesa_context(ctx); WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->WinSysDrawBuffer); @@ -250,7 +250,7 @@ static void wmesa_flush(GLcontext *ctx) /* * Set the color used to clear the color buffer. */ -static void clear_color(GLcontext *ctx, const GLfloat color[4]) +static void clear_color(struct gl_context *ctx, const GLfloat color[4]) { WMesaContext pwc = wmesa_context(ctx); WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); @@ -277,7 +277,7 @@ static void clear_color(GLcontext *ctx, const GLfloat color[4]) * Clearing of the other non-color buffers is left to the swrast. */ -static void clear(GLcontext *ctx, GLbitfield mask) +static void clear(struct gl_context *ctx, GLbitfield mask) { #define FLIP(Y) (ctx->DrawBuffer->Height - (Y) - 1) const GLint x = ctx->DrawBuffer->_Xmin; @@ -447,7 +447,7 @@ static void clear(GLcontext *ctx, GLbitfield mask) **/ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_front(const GLcontext *ctx, +static void write_rgba_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -534,7 +534,7 @@ static void write_rgba_span_front(const GLcontext *ctx, } /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_front(const GLcontext *ctx, +static void write_rgb_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -563,7 +563,7 @@ static void write_rgb_span_front(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_front(const GLcontext *ctx, +static void write_mono_rgba_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -588,7 +588,7 @@ static void write_mono_rgba_span_front(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_front(const GLcontext *ctx, +static void write_rgba_pixels_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -611,7 +611,7 @@ static void write_rgba_pixels_front(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_front(const GLcontext *ctx, +static void write_mono_rgba_pixels_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -629,7 +629,7 @@ static void write_mono_rgba_pixels_front(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_front(const GLcontext *ctx, +static void read_rgba_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -649,7 +649,7 @@ static void read_rgba_span_front(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_front(const GLcontext *ctx, +static void read_rgba_pixels_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -678,7 +678,7 @@ LPDWORD lpdw = ((LPDWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_32(const GLcontext *ctx, +static void write_rgba_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -708,7 +708,7 @@ static void write_rgba_span_32(const GLcontext *ctx, /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_32(const GLcontext *ctx, +static void write_rgb_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -740,7 +740,7 @@ static void write_rgb_span_32(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_32(const GLcontext *ctx, +static void write_mono_rgba_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -766,7 +766,7 @@ static void write_mono_rgba_span_32(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_32(const GLcontext *ctx, +static void write_rgba_pixels_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], @@ -785,7 +785,7 @@ static void write_rgba_pixels_32(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_32(const GLcontext *ctx, +static void write_mono_rgba_pixels_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -802,7 +802,7 @@ static void write_mono_rgba_pixels_32(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_32(const GLcontext *ctx, +static void read_rgba_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -826,7 +826,7 @@ static void read_rgba_span_32(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_32(const GLcontext *ctx, +static void read_rgba_pixels_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -860,7 +860,7 @@ lpb[1] = (g); \ lpb[2] = (r); } /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_24(const GLcontext *ctx, +static void write_rgba_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -894,7 +894,7 @@ static void write_rgba_span_24(const GLcontext *ctx, /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_24(const GLcontext *ctx, +static void write_rgb_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -930,7 +930,7 @@ static void write_rgb_span_24(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_24(const GLcontext *ctx, +static void write_mono_rgba_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -959,7 +959,7 @@ static void write_mono_rgba_span_24(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_24(const GLcontext *ctx, +static void write_rgba_pixels_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], @@ -978,7 +978,7 @@ static void write_rgba_pixels_24(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_24(const GLcontext *ctx, +static void write_mono_rgba_pixels_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -995,7 +995,7 @@ static void write_mono_rgba_pixels_24(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_24(const GLcontext *ctx, +static void read_rgba_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -1017,7 +1017,7 @@ static void read_rgba_span_24(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_24(const GLcontext *ctx, +static void read_rgba_pixels_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -1049,7 +1049,7 @@ LPWORD lpw = ((LPWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_16(const GLcontext *ctx, +static void write_rgba_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -1079,7 +1079,7 @@ static void write_rgba_span_16(const GLcontext *ctx, /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_16(const GLcontext *ctx, +static void write_rgb_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -1111,7 +1111,7 @@ static void write_rgb_span_16(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_16(const GLcontext *ctx, +static void write_mono_rgba_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -1138,7 +1138,7 @@ static void write_mono_rgba_span_16(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_16(const GLcontext *ctx, +static void write_rgba_pixels_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], @@ -1158,7 +1158,7 @@ static void write_rgba_pixels_16(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_16(const GLcontext *ctx, +static void write_mono_rgba_pixels_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -1176,7 +1176,7 @@ static void write_mono_rgba_pixels_16(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_16(const GLcontext *ctx, +static void read_rgba_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -1200,7 +1200,7 @@ static void read_rgba_span_16(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_16(const GLcontext *ctx, +static void read_rgba_pixels_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -1244,7 +1244,7 @@ wmesa_delete_renderbuffer(struct gl_renderbuffer *rb) * has changed. Do whatever's needed to cope with that. */ static GLboolean -wmesa_renderbuffer_storage(GLcontext *ctx, +wmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, @@ -1320,7 +1320,7 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat, * Resize the front/back colorbuffers to match the latest window size. */ static void -wmesa_resize_buffers(GLcontext *ctx, struct gl_framebuffer *buffer, +wmesa_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *buffer, GLuint width, GLuint height) { WMesaContext pwc = wmesa_context(ctx); @@ -1348,7 +1348,7 @@ wmesa_resize_buffers(GLcontext *ctx, struct gl_framebuffer *buffer, * we get the viewport set correctly, even if the app does not call * glViewport and relies on the defaults. */ -static void wmesa_viewport(GLcontext *ctx, +static void wmesa_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { @@ -1371,7 +1371,7 @@ static void wmesa_viewport(GLcontext *ctx, * Called when the driver should update it's state, based on the new_state * flags. */ -static void wmesa_update_state(GLcontext *ctx, GLuint new_state) +static void wmesa_update_state(struct gl_context *ctx, GLuint new_state) { _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); @@ -1403,7 +1403,7 @@ WMesaContext WMesaCreateContext(HDC hDC, WMesaContext c; struct dd_function_table functions; GLint red_bits, green_bits, blue_bits, alpha_bits; - GLcontext *ctx; + struct gl_context *ctx; struct gl_config *visual; (void) Pal; @@ -1511,7 +1511,7 @@ WMesaContext WMesaCreateContext(HDC hDC, void WMesaDestroyContext( WMesaContext pwc ) { - GLcontext *ctx = &pwc->gl_ctx; + struct gl_context *ctx = &pwc->gl_ctx; WMesaFramebuffer pwfb; GET_CURRENT_CONTEXT(cur_ctx); diff --git a/src/mesa/drivers/windows/gdi/wmesadef.h b/src/mesa/drivers/windows/gdi/wmesadef.h index 1c0e245111..a73609b007 100644 --- a/src/mesa/drivers/windows/gdi/wmesadef.h +++ b/src/mesa/drivers/windows/gdi/wmesadef.h @@ -7,10 +7,10 @@ /** - * The Windows Mesa rendering context, derived from GLcontext. + * The Windows Mesa rendering context, derived from struct gl_context. */ struct wmesa_context { - GLcontext gl_ctx; /* The core GL/Mesa context */ + struct gl_context gl_ctx; /* The core GL/Mesa context */ HDC hDC; COLORREF clearColorRef; HPEN clearPen; diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.c b/src/mesa/drivers/windows/gldirect/dglcontext.c index a420b36ffb..10ea057850 100644 --- a/src/mesa/drivers/windows/gldirect/dglcontext.c +++ b/src/mesa/drivers/windows/gldirect/dglcontext.c @@ -42,8 +42,8 @@ #ifdef _USE_GLD3_WGL #include "gld_driver.h" -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); #endif // _USE_GLD3_WGL // TODO: Clean out old DX6-specific code from GLD 2.x CAD driver diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.h b/src/mesa/drivers/windows/gldirect/dglcontext.h index f46d83eab0..ce04603c19 100644 --- a/src/mesa/drivers/windows/gldirect/dglcontext.h +++ b/src/mesa/drivers/windows/gldirect/dglcontext.h @@ -87,7 +87,7 @@ typedef struct { void *glPriv; // Mesa vars: - GLcontext *glCtx; // The core Mesa context + struct gl_context *glCtx; // The core Mesa context struct gl_config *glVis; // Describes the color buffer struct gl_framebuffer *glBuffer; // Ancillary buffers @@ -135,7 +135,7 @@ typedef struct { // // Mesa context vars: // - GLcontext *glCtx; // The core Mesa context + struct gl_context *glCtx; // The core Mesa context struct gl_config *glVis; // Describes the color buffer struct gl_framebuffer *glBuffer; // Ancillary buffers diff --git a/src/mesa/drivers/windows/gldirect/dglwgl.c b/src/mesa/drivers/windows/gldirect/dglwgl.c index 74ecb01a5b..c46cfe162f 100644 --- a/src/mesa/drivers/windows/gldirect/dglwgl.c +++ b/src/mesa/drivers/windows/gldirect/dglwgl.c @@ -874,8 +874,8 @@ BOOL APIENTRY _GLD_WGL_EXPORT(SetPixelFormat)( // Copied from GLD2.x. KeithH // static GLboolean _gldShareLists( - GLcontext *ctx1, - GLcontext *ctx2) + struct gl_context *ctx1, + struct gl_context *ctx2) { /* Sanity check context pointers */ if (ctx1 == NULL || ctx2 == NULL) @@ -955,7 +955,7 @@ BOOL APIENTRY _GLD_WGL_EXPORT(SwapLayerBuffers)( // either MESA glViewport() or GLD wglMakeCurrent(). BOOL dglWglResizeBuffers( - GLcontext *ctx, + struct gl_context *ctx, BOOL bDefaultDriver) { DGL_ctx *dgl = NULL; diff --git a/src/mesa/drivers/windows/gldirect/dglwgl.h b/src/mesa/drivers/windows/gldirect/dglwgl.h index aac0410333..3e7e5892ca 100644 --- a/src/mesa/drivers/windows/gldirect/dglwgl.h +++ b/src/mesa/drivers/windows/gldirect/dglwgl.h @@ -118,7 +118,7 @@ BOOL APIENTRY DGL_UseFontOutlinesA(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FL BOOL APIENTRY DGL_UseFontOutlinesW(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FLOAT f, int g, LPGLYPHMETRICSFLOAT h); #endif //_USE_GLD3_WGL -BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); #ifdef __cplusplus } diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c index 4a38b35adf..1c43a38557 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c @@ -69,7 +69,7 @@ const float _fPersp_33 = 1.6f; //--------------------------------------------------------------------------- void _gld_mesa_warning( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal warning mechanism @@ -79,7 +79,7 @@ void _gld_mesa_warning( //--------------------------------------------------------------------------- void _gld_mesa_fatal( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal fatal-message mechanism @@ -199,7 +199,7 @@ D3DBLEND _gldConvertBlendFunc( //--------------------------------------------------------------------------- void gld_Noop_DX7( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); @@ -209,7 +209,7 @@ void gld_Noop_DX7( //--------------------------------------------------------------------------- void gld_Error_DX7( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG // Quite useless. @@ -222,7 +222,7 @@ void gld_Error_DX7( //--------------------------------------------------------------------------- static GLboolean gld_set_draw_buffer_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum mode) { (void) ctx; @@ -237,7 +237,7 @@ static GLboolean gld_set_draw_buffer_DX7( //--------------------------------------------------------------------------- static void gld_set_read_buffer_DX7( - GLcontext *ctx, + struct gl_context *ctx, struct gl_framebuffer *buffer, GLenum mode) { @@ -251,7 +251,7 @@ static void gld_set_read_buffer_DX7( //--------------------------------------------------------------------------- void gld_Clear_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, @@ -342,7 +342,7 @@ void gld_Clear_DX7( // Mesa 5: Parameter change static void gld_buffer_size_DX7( -// GLcontext *ctx, +// struct gl_context *ctx, struct gl_framebuffer *fb, GLuint *width, GLuint *height) @@ -356,14 +356,14 @@ static void gld_buffer_size_DX7( //--------------------------------------------------------------------------- static void gld_Finish_DX7( - GLcontext *ctx) + struct gl_context *ctx) { } //--------------------------------------------------------------------------- static void gld_Flush_DX7( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gld = GLD_GET_CONTEXT(ctx); @@ -379,7 +379,7 @@ static void gld_Flush_DX7( //--------------------------------------------------------------------------- void gld_NEW_STENCIL( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -404,7 +404,7 @@ void gld_NEW_STENCIL( //--------------------------------------------------------------------------- void gld_NEW_COLOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -438,7 +438,7 @@ void gld_NEW_COLOR( //--------------------------------------------------------------------------- void gld_NEW_DEPTH( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -451,7 +451,7 @@ void gld_NEW_DEPTH( //--------------------------------------------------------------------------- void gld_NEW_POLYGON( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -516,7 +516,7 @@ void gld_NEW_POLYGON( //--------------------------------------------------------------------------- void gld_NEW_FOG( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -571,7 +571,7 @@ void gld_NEW_FOG( //--------------------------------------------------------------------------- void gld_NEW_LIGHT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -591,7 +591,7 @@ void gld_NEW_LIGHT( //--------------------------------------------------------------------------- void gld_NEW_MODELVIEW( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -639,7 +639,7 @@ void gld_NEW_MODELVIEW( //--------------------------------------------------------------------------- void gld_NEW_PROJECTION( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -718,7 +718,7 @@ void gldOrthoHook_DX7( //--------------------------------------------------------------------------- void gld_NEW_VIEWPORT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -760,7 +760,7 @@ void gld_NEW_VIEWPORT( //--------------------------------------------------------------------------- __inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) + struct gl_context *ctx) { struct gl_eval_attrib *eval = &ctx->Eval; @@ -792,7 +792,7 @@ __inline BOOL _gldAnyEvalEnabled( //--------------------------------------------------------------------------- BOOL _gldChooseInternalPipeline( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx7 *gld) { // return TRUE; // DEBUGGING: ALWAYS USE MESA @@ -856,7 +856,7 @@ BOOL _gldChooseInternalPipeline( //--------------------------------------------------------------------------- void gld_update_state_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -991,7 +991,7 @@ void gld_update_state_DX7( //--------------------------------------------------------------------------- void gld_Viewport_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1053,11 +1053,11 @@ void gld_Viewport_DX7( //--------------------------------------------------------------------------- -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX7( -// GLcontext *ctx) +// struct gl_context *ctx) struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); @@ -1069,7 +1069,7 @@ void gldResizeBuffers_DX7( // This is only for debugging. // To use, plug into ctx->Driver.Enable pointer below. void gld_Enable( - GLcontext *ctx, + struct gl_context *ctx, GLenum e, GLboolean b) { @@ -1082,10 +1082,10 @@ void gld_Enable( // Driver pointer setup //--------------------------------------------------------------------------- -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); +extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum); void gldSetupDriverPointers_DX7( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h index 6f549c9d19..2e1d136568 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h @@ -225,68 +225,68 @@ typedef struct { //--------------------------------------------------------------------------- PROC gldGetProcAddress_DX7(LPCSTR a); -void gldEnableExtensions_DX7(GLcontext *ctx); -void gldInstallPipeline_DX7(GLcontext *ctx); -void gldSetupDriverPointers_DX7(GLcontext *ctx); +void gldEnableExtensions_DX7(struct gl_context *ctx); +void gldInstallPipeline_DX7(struct gl_context *ctx); +void gldSetupDriverPointers_DX7(struct gl_context *ctx); void gldResizeBuffers_DX7(struct gl_framebuffer *fb); // Texture functions -void gldCopyTexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX7(GLcontext *ctx); -void gld_DrawPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX7(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX7(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX7(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX7(GLcontext *ctx); +void gldCopyTexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void gldCopyTexImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void gldCopyTexSubImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); +void gldCopyTexSubImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +void gldCopyTexSubImage3D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +void gld_NEW_TEXTURE_DX7(struct gl_context *ctx); +void gld_DrawPixels_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); +void gld_ReadPixels_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); +void gld_CopyPixels_DX7(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); +void gld_Bitmap_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +const struct gl_texture_format* gld_ChooseTextureFormat_DX7(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); +void gld_TexImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); +void gld_TexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); +void gld_TexSubImage2D_DX7( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); +void gld_TexSubImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +void gld_DeleteTexture_DX7(struct gl_context *ctx, struct gl_texture_object *tObj); +void gld_ResetLineStipple_DX7(struct gl_context *ctx); // 2D primitive functions -void gld_Points2D_DX7(GLcontext *ctx, GLuint first, GLuint last); +void gld_Points2D_DX7(struct gl_context *ctx, GLuint first, GLuint last); -void gld_Line2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1); +void gld_Line2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlatExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlatExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // 3D primitive functions -void gld_Points3D_DX7(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points3D_DX7(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Line3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // Primitive functions for Two-sided-lighting Vertex Shader -void gld_Points2DTwoside_DX7(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points2DTwoside_DX7(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); #endif diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c index ba60980bbe..4ed3c3ca05 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c @@ -69,7 +69,7 @@ #include "extensions.h" // For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); //--------------------------------------------------------------------------- // Hack for the SGIS_multitexture extension that was removed from Mesa @@ -281,7 +281,7 @@ PROC gldGetProcAddress_DX( //--------------------------------------------------------------------------- void gldEnableExtensions_DX7( - GLcontext *ctx) + struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c index 9ccec69b98..b801542736 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c @@ -65,7 +65,7 @@ static const struct tnl_pipeline_stage *gld_pipeline[] = { //--------------------------------------------------------------------------- void gldInstallPipeline_DX7( - GLcontext *ctx) + struct gl_context *ctx) { // Remove any existing pipeline stages, // then install GLDirect pipeline stages. diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c index 0b373814fe..7fc50004de 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c @@ -277,7 +277,7 @@ //--------------------------------------------------------------------------- __inline DWORD _gldComputeFog( - GLcontext *ctx, + struct gl_context *ctx, SWvertex *swv) { // Full fog calculation. @@ -300,7 +300,7 @@ __inline DWORD _gldComputeFog( //--------------------------------------------------------------------------- void gld_ResetLineStipple_DX7( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Fake stipple with a 32x32 texture. } @@ -310,7 +310,7 @@ void gld_ResetLineStipple_DX7( //--------------------------------------------------------------------------- void gld_Points2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -358,7 +358,7 @@ void gld_Points2D_DX7( //--------------------------------------------------------------------------- void gld_Line2DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -391,7 +391,7 @@ void gld_Line2DFlat_DX7( //--------------------------------------------------------------------------- void gld_Line2DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -422,7 +422,7 @@ void gld_Line2DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -461,7 +461,7 @@ void gld_Triangle2DFlat_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -500,7 +500,7 @@ void gld_Triangle2DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DFlatExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -549,7 +549,7 @@ void gld_Triangle2DFlatExtras_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DSmoothExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -589,7 +589,7 @@ void gld_Triangle2DSmoothExtras_DX7( //--------------------------------------------------------------------------- void gld_Quad2DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -653,7 +653,7 @@ void gld_Quad2DFlat_DX7( //--------------------------------------------------------------------------- void gld_Quad2DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -716,7 +716,7 @@ void gld_Quad2DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Quad2DFlatExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -793,7 +793,7 @@ void gld_Quad2DFlatExtras_DX7( //--------------------------------------------------------------------------- void gld_Quad2DSmoothExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -860,7 +860,7 @@ void gld_Quad2DSmoothExtras_DX7( //--------------------------------------------------------------------------- void gld_Points3D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -913,7 +913,7 @@ void gld_Points3D_DX7( //--------------------------------------------------------------------------- void gld_Line3DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -939,7 +939,7 @@ void gld_Line3DFlat_DX7( //--------------------------------------------------------------------------- void gld_Line3DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -966,7 +966,7 @@ void gld_Line3DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Triangle3DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -999,7 +999,7 @@ void gld_Triangle3DFlat_DX7( //--------------------------------------------------------------------------- void gld_Triangle3DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -1033,7 +1033,7 @@ void gld_Triangle3DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Quad3DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1085,7 +1085,7 @@ void gld_Quad3DFlat_DX7( //--------------------------------------------------------------------------- void gld_Quad3DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1139,34 +1139,34 @@ void gld_Quad3DSmooth_DX7( /* -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last) +void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last) { // NOTE: Two-sided lighting does not apply to Points } //--------------------------------------------------------------------------- -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { } //--------------------------------------------------------------------------- -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1231,7 +1231,7 @@ void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuin //--------------------------------------------------------------------------- -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1338,7 +1338,7 @@ void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, //--------------------------------------------------------------------------- -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c index bbe673516d..74c3b0d344 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c @@ -817,7 +817,7 @@ void _gldClearSurface( //--------------------------------------------------------------------------- void gldCopyTexImage1D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -829,7 +829,7 @@ void gldCopyTexImage1D_DX7( //--------------------------------------------------------------------------- void gldCopyTexImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, @@ -845,7 +845,7 @@ void gldCopyTexImage2D_DX7( //--------------------------------------------------------------------------- void gldCopyTexSubImage1D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -855,7 +855,7 @@ void gldCopyTexSubImage1D_DX7( //--------------------------------------------------------------------------- void gldCopyTexSubImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -871,7 +871,7 @@ void gldCopyTexSubImage2D_DX7( //--------------------------------------------------------------------------- void gldCopyTexSubImage3D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -903,7 +903,7 @@ typedef struct { //--------------------------------------------------------------------------- HRESULT _gldDrawPixels( - GLcontext *ctx, + struct gl_context *ctx, BOOL bChromakey, // Alpha test for glBitmap() images GLint x, // GL x position GLint y, // GL y position (needs flipping) @@ -1009,7 +1009,7 @@ HRESULT _gldDrawPixels( //--------------------------------------------------------------------------- void gld_DrawPixels_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1086,7 +1086,7 @@ void gld_DrawPixels_DX7( //--------------------------------------------------------------------------- void gld_ReadPixels_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -1241,7 +1241,7 @@ gld_ReadPixels_DX7_return: //--------------------------------------------------------------------------- void gld_CopyPixels_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, @@ -1330,7 +1330,7 @@ void gld_CopyPixels_DX7( //--------------------------------------------------------------------------- void gld_Bitmap_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, @@ -1475,7 +1475,7 @@ void gld_Bitmap_DX7( //--------------------------------------------------------------------------- void _gldAllocateTexture( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj, struct gl_texture_image *texImage) { @@ -1533,7 +1533,7 @@ void _gldAllocateTexture( //--------------------------------------------------------------------------- const struct gl_texture_format* gld_ChooseTextureFormat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) @@ -1622,7 +1622,7 @@ const struct gl_texture_format* gld_ChooseTextureFormat_DX7( /* // Safer(?), slower version. void gld_TexImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1700,7 +1700,7 @@ void gld_TexImage2D_DX7( // Faster, more efficient version. // Copies subimage straight to dest texture void gld_TexImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1792,7 +1792,7 @@ void gld_TexImage2D_DX7( //--------------------------------------------------------------------------- -void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, +void gld_TexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1807,7 +1807,7 @@ void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- /* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1883,7 +1883,7 @@ void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, // Faster, more efficient version. // Copies subimage straight to dest texture -void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D_DX7( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1963,7 +1963,7 @@ void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- -void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage1D_DX7( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -1977,7 +1977,7 @@ void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- void gld_DeleteTexture_DX7( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj) { GLD_context *gld = (GLD_context*)(ctx->DriverCtx); @@ -2036,7 +2036,7 @@ __inline void _gldSetAlphaOps( //--------------------------------------------------------------------------- void gldUpdateTextureUnit( - GLcontext *ctx, + struct gl_context *ctx, GLuint unit, BOOL bPassThrough) { @@ -2145,7 +2145,7 @@ void gldUpdateTextureUnit( //--------------------------------------------------------------------------- void gld_NEW_TEXTURE_DX7( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c index c39775cad3..0a1b9479ef 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c @@ -61,7 +61,7 @@ //--------------------------------------------------------------------------- /* __inline void _gldSetVertexShaderConstants( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *gld) { D3DXMATRIX mat, matView, matProj; @@ -116,7 +116,7 @@ __inline void _gldSetVertexShaderConstants( //--------------------------------------------------------------------------- static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c index 72e5e1308c..a8356c0a20 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c @@ -167,7 +167,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -255,7 +255,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ /* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -266,7 +266,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -306,7 +306,7 @@ tnl_quad_func _gldSetupQuad[4] = { //--------------------------------------------------------------------------- static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c index fa44a952a0..0d860dbe1a 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c @@ -57,8 +57,8 @@ extern int nContextError; #define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); //--------------------------------------------------------------------------- @@ -243,7 +243,7 @@ void _gldDestroyPrimitiveBuffer( //--------------------------------------------------------------------------- HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx7 *lpCtx, GLD_pb_dx7 *gldVB) { diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c index e2793ba557..c4c2e0b567 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c @@ -69,7 +69,7 @@ const float _fPersp_33 = 1.6f; //--------------------------------------------------------------------------- void _gld_mesa_warning( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal warning mechanism @@ -79,7 +79,7 @@ void _gld_mesa_warning( //--------------------------------------------------------------------------- void _gld_mesa_fatal( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal fatal-message mechanism @@ -199,7 +199,7 @@ D3DBLEND _gldConvertBlendFunc( //--------------------------------------------------------------------------- void gld_Noop_DX8( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); @@ -209,7 +209,7 @@ void gld_Noop_DX8( //--------------------------------------------------------------------------- void gld_Error_DX8( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG // Quite useless. @@ -222,7 +222,7 @@ void gld_Error_DX8( //--------------------------------------------------------------------------- static GLboolean gld_set_draw_buffer_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum mode) { (void) ctx; @@ -237,7 +237,7 @@ static GLboolean gld_set_draw_buffer_DX8( //--------------------------------------------------------------------------- static void gld_set_read_buffer_DX8( - GLcontext *ctx, + struct gl_context *ctx, struct gl_framebuffer *buffer, GLenum mode) { @@ -251,7 +251,7 @@ static void gld_set_read_buffer_DX8( //--------------------------------------------------------------------------- void gld_Clear_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, @@ -342,7 +342,7 @@ void gld_Clear_DX8( // Mesa 5: Parameter change static void gld_buffer_size_DX8( -// GLcontext *ctx, +// struct gl_context *ctx, struct gl_framebuffer *fb, GLuint *width, GLuint *height) @@ -356,14 +356,14 @@ static void gld_buffer_size_DX8( //--------------------------------------------------------------------------- static void gld_Finish_DX8( - GLcontext *ctx) + struct gl_context *ctx) { } //--------------------------------------------------------------------------- static void gld_Flush_DX8( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gld = GLD_GET_CONTEXT(ctx); @@ -379,7 +379,7 @@ static void gld_Flush_DX8( //--------------------------------------------------------------------------- void gld_NEW_STENCIL( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -404,7 +404,7 @@ void gld_NEW_STENCIL( //--------------------------------------------------------------------------- void gld_NEW_COLOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -436,7 +436,7 @@ void gld_NEW_COLOR( //--------------------------------------------------------------------------- void gld_NEW_DEPTH( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -449,7 +449,7 @@ void gld_NEW_DEPTH( //--------------------------------------------------------------------------- void gld_NEW_POLYGON( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -514,7 +514,7 @@ void gld_NEW_POLYGON( //--------------------------------------------------------------------------- void gld_NEW_FOG( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -569,7 +569,7 @@ void gld_NEW_FOG( //--------------------------------------------------------------------------- void gld_NEW_LIGHT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -589,7 +589,7 @@ void gld_NEW_LIGHT( //--------------------------------------------------------------------------- void gld_NEW_MODELVIEW( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -621,7 +621,7 @@ void gld_NEW_MODELVIEW( //--------------------------------------------------------------------------- void gld_NEW_PROJECTION( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -700,7 +700,7 @@ void gldOrthoHook_DX8( //--------------------------------------------------------------------------- void gld_NEW_VIEWPORT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -742,7 +742,7 @@ void gld_NEW_VIEWPORT( //--------------------------------------------------------------------------- __inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) + struct gl_context *ctx) { struct gl_eval_attrib *eval = &ctx->Eval; @@ -774,7 +774,7 @@ __inline BOOL _gldAnyEvalEnabled( //--------------------------------------------------------------------------- BOOL _gldChooseInternalPipeline( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *gld) { // return TRUE; // DEBUGGING: ALWAYS USE MESA @@ -838,7 +838,7 @@ BOOL _gldChooseInternalPipeline( //--------------------------------------------------------------------------- void gld_update_state_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -971,7 +971,7 @@ void gld_update_state_DX8( //--------------------------------------------------------------------------- void gld_Viewport_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1033,11 +1033,11 @@ void gld_Viewport_DX8( //--------------------------------------------------------------------------- -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX8( -// GLcontext *ctx) +// struct gl_context *ctx) struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); @@ -1049,7 +1049,7 @@ void gldResizeBuffers_DX8( // This is only for debugging. // To use, plug into ctx->Driver.Enable pointer below. void gld_Enable( - GLcontext *ctx, + struct gl_context *ctx, GLenum e, GLboolean b) { @@ -1062,10 +1062,10 @@ void gld_Enable( // Driver pointer setup //--------------------------------------------------------------------------- -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); +extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum); void gldSetupDriverPointers_DX8( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h index 2446d90636..b207ecc788 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h @@ -256,69 +256,69 @@ typedef struct { //--------------------------------------------------------------------------- PROC gldGetProcAddress_DX8(LPCSTR a); -void gldEnableExtensions_DX8(GLcontext *ctx); -void gldInstallPipeline_DX8(GLcontext *ctx); -void gldSetupDriverPointers_DX8(GLcontext *ctx); -//void gldResizeBuffers_DX8(GLcontext *ctx); +void gldEnableExtensions_DX8(struct gl_context *ctx); +void gldInstallPipeline_DX8(struct gl_context *ctx); +void gldSetupDriverPointers_DX8(struct gl_context *ctx); +//void gldResizeBuffers_DX8(struct gl_context *ctx); void gldResizeBuffers_DX8(struct gl_framebuffer *fb); // Texture functions -void gldCopyTexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX8(GLcontext *ctx); -void gld_DrawPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX8(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX8(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX8(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX8(GLcontext *ctx); +void gldCopyTexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void gldCopyTexImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void gldCopyTexSubImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); +void gldCopyTexSubImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +void gldCopyTexSubImage3D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +void gld_NEW_TEXTURE_DX8(struct gl_context *ctx); +void gld_DrawPixels_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); +void gld_ReadPixels_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); +void gld_CopyPixels_DX8(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); +void gld_Bitmap_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +const struct gl_texture_format* gld_ChooseTextureFormat_DX8(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); +void gld_TexImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); +void gld_TexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); +void gld_TexSubImage2D_DX8( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); +void gld_TexSubImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +void gld_DeleteTexture_DX8(struct gl_context *ctx, struct gl_texture_object *tObj); +void gld_ResetLineStipple_DX8(struct gl_context *ctx); // 2D primitive functions -void gld_Points2D_DX8(GLcontext *ctx, GLuint first, GLuint last); +void gld_Points2D_DX8(struct gl_context *ctx, GLuint first, GLuint last); -void gld_Line2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1); +void gld_Line2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlatExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlatExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // 3D primitive functions -void gld_Points3D_DX8(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points3D_DX8(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Line3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // Primitive functions for Two-sided-lighting Vertex Shader -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); #endif diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c index b51bba9b3c..9218945805 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c @@ -69,7 +69,7 @@ #include "extensions.h" // For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); //--------------------------------------------------------------------------- // Hack for the SGIS_multitexture extension that was removed from Mesa @@ -281,7 +281,7 @@ PROC gldGetProcAddress_DX( //--------------------------------------------------------------------------- void gldEnableExtensions_DX8( - GLcontext *ctx) + struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c index 2baea57443..9113d70345 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c @@ -65,7 +65,7 @@ static const struct tnl_pipeline_stage *gld_pipeline[] = { //--------------------------------------------------------------------------- void gldInstallPipeline_DX8( - GLcontext *ctx) + struct gl_context *ctx) { // Remove any existing pipeline stages, // then install GLDirect pipeline stages. diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c index 990922580a..5b9dac09c6 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c @@ -277,7 +277,7 @@ //--------------------------------------------------------------------------- __inline DWORD _gldComputeFog( - GLcontext *ctx, + struct gl_context *ctx, SWvertex *swv) { // Full fog calculation. @@ -300,7 +300,7 @@ __inline DWORD _gldComputeFog( //--------------------------------------------------------------------------- void gld_ResetLineStipple_DX8( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Fake stipple with a 32x32 texture. } @@ -310,7 +310,7 @@ void gld_ResetLineStipple_DX8( //--------------------------------------------------------------------------- void gld_Points2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -357,7 +357,7 @@ void gld_Points2D_DX8( //--------------------------------------------------------------------------- void gld_Line2DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -390,7 +390,7 @@ void gld_Line2DFlat_DX8( //--------------------------------------------------------------------------- void gld_Line2DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -421,7 +421,7 @@ void gld_Line2DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -460,7 +460,7 @@ void gld_Triangle2DFlat_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -499,7 +499,7 @@ void gld_Triangle2DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DFlatExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -548,7 +548,7 @@ void gld_Triangle2DFlatExtras_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DSmoothExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -588,7 +588,7 @@ void gld_Triangle2DSmoothExtras_DX8( //--------------------------------------------------------------------------- void gld_Quad2DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -652,7 +652,7 @@ void gld_Quad2DFlat_DX8( //--------------------------------------------------------------------------- void gld_Quad2DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -715,7 +715,7 @@ void gld_Quad2DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Quad2DFlatExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -792,7 +792,7 @@ void gld_Quad2DFlatExtras_DX8( //--------------------------------------------------------------------------- void gld_Quad2DSmoothExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -859,7 +859,7 @@ void gld_Quad2DSmoothExtras_DX8( //--------------------------------------------------------------------------- void gld_Points3D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -911,7 +911,7 @@ void gld_Points3D_DX8( //--------------------------------------------------------------------------- void gld_Line3DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -937,7 +937,7 @@ void gld_Line3DFlat_DX8( //--------------------------------------------------------------------------- void gld_Line3DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -964,7 +964,7 @@ void gld_Line3DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Triangle3DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -997,7 +997,7 @@ void gld_Triangle3DFlat_DX8( //--------------------------------------------------------------------------- void gld_Triangle3DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -1031,7 +1031,7 @@ void gld_Triangle3DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Quad3DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1083,7 +1083,7 @@ void gld_Quad3DFlat_DX8( //--------------------------------------------------------------------------- void gld_Quad3DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1137,34 +1137,34 @@ void gld_Quad3DSmooth_DX8( /* -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last) +void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last) { // NOTE: Two-sided lighting does not apply to Points } //--------------------------------------------------------------------------- -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { } //--------------------------------------------------------------------------- -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1229,7 +1229,7 @@ void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuin //--------------------------------------------------------------------------- -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1336,7 +1336,7 @@ void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, //--------------------------------------------------------------------------- -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c index f24b3cfb74..6ea670a88a 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c @@ -760,7 +760,7 @@ const struct gl_texture_format* _gldMesaFormatForD3DFormat( //--------------------------------------------------------------------------- void gldCopyTexImage1D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -772,7 +772,7 @@ void gldCopyTexImage1D_DX8( //--------------------------------------------------------------------------- void gldCopyTexImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, @@ -788,7 +788,7 @@ void gldCopyTexImage2D_DX8( //--------------------------------------------------------------------------- void gldCopyTexSubImage1D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -798,7 +798,7 @@ void gldCopyTexSubImage1D_DX8( //--------------------------------------------------------------------------- void gldCopyTexSubImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -814,7 +814,7 @@ void gldCopyTexSubImage2D_DX8( //--------------------------------------------------------------------------- void gldCopyTexSubImage3D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -846,7 +846,7 @@ typedef struct { //--------------------------------------------------------------------------- HRESULT _gldDrawPixels( - GLcontext *ctx, + struct gl_context *ctx, BOOL bChromakey, // Alpha test for glBitmap() images GLint x, // GL x position GLint y, // GL y position (needs flipping) @@ -982,7 +982,7 @@ HRESULT _gldDrawPixels( //--------------------------------------------------------------------------- void gld_DrawPixels_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1045,7 +1045,7 @@ void gld_DrawPixels_DX8( //--------------------------------------------------------------------------- void gld_ReadPixels_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -1198,7 +1198,7 @@ gld_ReadPixels_DX8_return: //--------------------------------------------------------------------------- void gld_CopyPixels_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, @@ -1284,7 +1284,7 @@ void gld_CopyPixels_DX8( //--------------------------------------------------------------------------- void gld_Bitmap_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, @@ -1389,7 +1389,7 @@ void gld_Bitmap_DX8( //--------------------------------------------------------------------------- void _gldAllocateTexture( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj, struct gl_texture_image *texImage) { @@ -1435,7 +1435,7 @@ void _gldAllocateTexture( //--------------------------------------------------------------------------- const struct gl_texture_format* gld_ChooseTextureFormat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) @@ -1524,7 +1524,7 @@ const struct gl_texture_format* gld_ChooseTextureFormat_DX8( /* // Safer(?), slower version. void gld_TexImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1602,7 +1602,7 @@ void gld_TexImage2D_DX8( // Faster, more efficient version. // Copies subimage straight to dest texture void gld_TexImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1676,7 +1676,7 @@ void gld_TexImage2D_DX8( //--------------------------------------------------------------------------- -void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, +void gld_TexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1691,7 +1691,7 @@ void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- /* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1767,7 +1767,7 @@ void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, // Faster, more efficient version. // Copies subimage straight to dest texture -void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D_DX8( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1828,7 +1828,7 @@ void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- -void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage1D_DX8( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -1842,7 +1842,7 @@ void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- void gld_DeleteTexture_DX8( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj) { GLD_context *gld = (GLD_context*)(ctx->DriverCtx); @@ -1894,7 +1894,7 @@ __inline void _gldSetAlphaOps( //--------------------------------------------------------------------------- void gldUpdateTextureUnit( - GLcontext *ctx, + struct gl_context *ctx, GLuint unit, BOOL bPassThrough) { @@ -1994,7 +1994,7 @@ void gldUpdateTextureUnit( //--------------------------------------------------------------------------- void gld_NEW_TEXTURE_DX8( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c index 265c81fb4a..983df9bc09 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c @@ -61,7 +61,7 @@ //--------------------------------------------------------------------------- __inline void _gldSetVertexShaderConstants( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *gld) { D3DXMATRIX mat, matView, matProj; @@ -116,7 +116,7 @@ __inline void _gldSetVertexShaderConstants( //--------------------------------------------------------------------------- static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c index 9ab562010c..19ffc72c81 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c @@ -167,7 +167,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -255,7 +255,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ /* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -266,7 +266,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -306,7 +306,7 @@ tnl_quad_func _gldSetupQuad[4] = { //--------------------------------------------------------------------------- static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c index 011d810e97..73c76c7d4b 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c @@ -54,8 +54,8 @@ extern int nContextError; #define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); //--------------------------------------------------------------------------- @@ -233,7 +233,7 @@ void _gldDestroyPrimitiveBuffer( //--------------------------------------------------------------------------- HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *lpCtx, GLD_pb_dx8 *gldVB) { diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c index 0186b26832..aab7085201 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c @@ -69,7 +69,7 @@ const float _fPersp_33 = 1.6f; //--------------------------------------------------------------------------- void _gld_mesa_warning( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal warning mechanism @@ -79,7 +79,7 @@ void _gld_mesa_warning( //--------------------------------------------------------------------------- void _gld_mesa_fatal( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal fatal-message mechanism @@ -199,7 +199,7 @@ D3DBLEND _gldConvertBlendFunc( //--------------------------------------------------------------------------- void gld_Noop_DX9( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); @@ -209,7 +209,7 @@ void gld_Noop_DX9( //--------------------------------------------------------------------------- void gld_Error_DX9( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG // Quite useless. @@ -222,7 +222,7 @@ void gld_Error_DX9( //--------------------------------------------------------------------------- static GLboolean gld_set_draw_buffer_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum mode) { (void) ctx; @@ -237,7 +237,7 @@ static GLboolean gld_set_draw_buffer_DX9( //--------------------------------------------------------------------------- static void gld_set_read_buffer_DX9( - GLcontext *ctx, + struct gl_context *ctx, struct gl_framebuffer *buffer, GLenum mode) { @@ -251,7 +251,7 @@ static void gld_set_read_buffer_DX9( //--------------------------------------------------------------------------- void gld_Clear_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, @@ -340,7 +340,7 @@ void gld_Clear_DX9( // Mesa 5: Parameter change static void gld_buffer_size_DX9( -// GLcontext *ctx, +// struct gl_context *ctx, struct gl_framebuffer *fb, GLuint *width, GLuint *height) @@ -354,14 +354,14 @@ static void gld_buffer_size_DX9( //--------------------------------------------------------------------------- static void gld_Finish_DX9( - GLcontext *ctx) + struct gl_context *ctx) { } //--------------------------------------------------------------------------- static void gld_Flush_DX9( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gld = GLD_GET_CONTEXT(ctx); @@ -377,7 +377,7 @@ static void gld_Flush_DX9( //--------------------------------------------------------------------------- void gld_NEW_STENCIL( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -402,7 +402,7 @@ void gld_NEW_STENCIL( //--------------------------------------------------------------------------- void gld_NEW_COLOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -434,7 +434,7 @@ void gld_NEW_COLOR( //--------------------------------------------------------------------------- void gld_NEW_DEPTH( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -447,7 +447,7 @@ void gld_NEW_DEPTH( //--------------------------------------------------------------------------- void gld_NEW_POLYGON( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -513,7 +513,7 @@ void gld_NEW_POLYGON( //--------------------------------------------------------------------------- void gld_NEW_FOG( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -568,7 +568,7 @@ void gld_NEW_FOG( //--------------------------------------------------------------------------- void gld_NEW_LIGHT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -588,7 +588,7 @@ void gld_NEW_LIGHT( //--------------------------------------------------------------------------- void gld_NEW_MODELVIEW( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -620,7 +620,7 @@ void gld_NEW_MODELVIEW( //--------------------------------------------------------------------------- void gld_NEW_PROJECTION( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -699,7 +699,7 @@ void gldOrthoHook_DX9( //--------------------------------------------------------------------------- void gld_NEW_VIEWPORT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -741,7 +741,7 @@ void gld_NEW_VIEWPORT( //--------------------------------------------------------------------------- void gld_NEW_SCISSOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -768,7 +768,7 @@ void gld_NEW_SCISSOR( //--------------------------------------------------------------------------- __inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) + struct gl_context *ctx) { struct gl_eval_attrib *eval = &ctx->Eval; @@ -800,7 +800,7 @@ __inline BOOL _gldAnyEvalEnabled( //--------------------------------------------------------------------------- BOOL _gldChooseInternalPipeline( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx9 *gld) { // return TRUE; // DEBUGGING: ALWAYS USE MESA @@ -864,7 +864,7 @@ BOOL _gldChooseInternalPipeline( //--------------------------------------------------------------------------- void gld_update_state_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -1001,7 +1001,7 @@ void gld_update_state_DX9( //--------------------------------------------------------------------------- void gld_Viewport_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1063,11 +1063,11 @@ void gld_Viewport_DX9( //--------------------------------------------------------------------------- -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX9( -// GLcontext *ctx) +// struct gl_context *ctx) struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); @@ -1079,7 +1079,7 @@ void gldResizeBuffers_DX9( // This is only for debugging. // To use, plug into ctx->Driver.Enable pointer below. void gld_Enable( - GLcontext *ctx, + struct gl_context *ctx, GLenum e, GLboolean b) { @@ -1092,10 +1092,10 @@ void gld_Enable( // Driver pointer setup //--------------------------------------------------------------------------- -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); +extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum); void gldSetupDriverPointers_DX9( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h index 201595f724..67601da7fb 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h @@ -259,69 +259,69 @@ typedef struct { //--------------------------------------------------------------------------- PROC gldGetProcAddress_DX9(LPCSTR a); -void gldEnableExtensions_DX9(GLcontext *ctx); -void gldInstallPipeline_DX9(GLcontext *ctx); -void gldSetupDriverPointers_DX9(GLcontext *ctx); -//void gldResizeBuffers_DX9(GLcontext *ctx); +void gldEnableExtensions_DX9(struct gl_context *ctx); +void gldInstallPipeline_DX9(struct gl_context *ctx); +void gldSetupDriverPointers_DX9(struct gl_context *ctx); +//void gldResizeBuffers_DX9(struct gl_context *ctx); void gldResizeBuffers_DX9(struct gl_framebuffer *fb); // Texture functions -void gldCopyTexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX9(GLcontext *ctx); -void gld_DrawPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX9(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX9(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); -void gld_TexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX9(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX9(GLcontext *ctx); +void gldCopyTexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void gldCopyTexImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void gldCopyTexSubImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); +void gldCopyTexSubImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +void gldCopyTexSubImage3D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +void gld_NEW_TEXTURE_DX9(struct gl_context *ctx); +void gld_DrawPixels_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); +void gld_ReadPixels_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); +void gld_CopyPixels_DX9(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); +void gld_Bitmap_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +const struct gl_texture_format* gld_ChooseTextureFormat_DX9(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); +void gld_TexImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage); +void gld_TexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); +void gld_TexSubImage2D_DX9( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); +void gld_TexSubImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +void gld_DeleteTexture_DX9(struct gl_context *ctx, struct gl_texture_object *tObj); +void gld_ResetLineStipple_DX9(struct gl_context *ctx); // 2D primitive functions -void gld_Points2D_DX9(GLcontext *ctx, GLuint first, GLuint last); +void gld_Points2D_DX9(struct gl_context *ctx, GLuint first, GLuint last); -void gld_Line2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1); +void gld_Line2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlatExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlatExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // 3D primitive functions -void gld_Points3D_DX9(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points3D_DX9(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Line3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // Primitive functions for Two-sided-lighting Vertex Shader -void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points2DTwoside_DX9(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); #endif diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c index e8c73a6ff8..667c59c491 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c @@ -69,7 +69,7 @@ #include "extensions.h" // For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); //--------------------------------------------------------------------------- // Hack for the SGIS_multitexture extension that was removed from Mesa @@ -281,7 +281,7 @@ PROC gldGetProcAddress_DX( //--------------------------------------------------------------------------- void gldEnableExtensions_DX9( - GLcontext *ctx) + struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c index 2b272aa628..f9abbdbdfe 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c @@ -65,7 +65,7 @@ static const struct tnl_pipeline_stage *gld_pipeline[] = { //--------------------------------------------------------------------------- void gldInstallPipeline_DX9( - GLcontext *ctx) + struct gl_context *ctx) { // Remove any existing pipeline stages, // then install GLDirect pipeline stages. diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c index fd4dd4ed75..99edd26e9d 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c @@ -277,7 +277,7 @@ //--------------------------------------------------------------------------- __inline DWORD _gldComputeFog( - GLcontext *ctx, + struct gl_context *ctx, SWvertex *swv) { // Full fog calculation. @@ -300,7 +300,7 @@ __inline DWORD _gldComputeFog( //--------------------------------------------------------------------------- void gld_ResetLineStipple_DX9( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Fake stipple with a 32x32 texture. } @@ -310,7 +310,7 @@ void gld_ResetLineStipple_DX9( //--------------------------------------------------------------------------- void gld_Points2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -357,7 +357,7 @@ void gld_Points2D_DX9( //--------------------------------------------------------------------------- void gld_Line2DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -390,7 +390,7 @@ void gld_Line2DFlat_DX9( //--------------------------------------------------------------------------- void gld_Line2DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -421,7 +421,7 @@ void gld_Line2DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -460,7 +460,7 @@ void gld_Triangle2DFlat_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -499,7 +499,7 @@ void gld_Triangle2DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DFlatExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -548,7 +548,7 @@ void gld_Triangle2DFlatExtras_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DSmoothExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -588,7 +588,7 @@ void gld_Triangle2DSmoothExtras_DX9( //--------------------------------------------------------------------------- void gld_Quad2DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -652,7 +652,7 @@ void gld_Quad2DFlat_DX9( //--------------------------------------------------------------------------- void gld_Quad2DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -715,7 +715,7 @@ void gld_Quad2DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Quad2DFlatExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -792,7 +792,7 @@ void gld_Quad2DFlatExtras_DX9( //--------------------------------------------------------------------------- void gld_Quad2DSmoothExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -859,7 +859,7 @@ void gld_Quad2DSmoothExtras_DX9( //--------------------------------------------------------------------------- void gld_Points3D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -911,7 +911,7 @@ void gld_Points3D_DX9( //--------------------------------------------------------------------------- void gld_Line3DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -937,7 +937,7 @@ void gld_Line3DFlat_DX9( //--------------------------------------------------------------------------- void gld_Line3DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -964,7 +964,7 @@ void gld_Line3DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Triangle3DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -997,7 +997,7 @@ void gld_Triangle3DFlat_DX9( //--------------------------------------------------------------------------- void gld_Triangle3DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -1031,7 +1031,7 @@ void gld_Triangle3DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Quad3DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1083,7 +1083,7 @@ void gld_Quad3DFlat_DX9( //--------------------------------------------------------------------------- void gld_Quad3DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1137,34 +1137,34 @@ void gld_Quad3DSmooth_DX9( /* -void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last) +void gld_Points2DTwoside_DX9(struct gl_context *ctx, GLuint first, GLuint last) { // NOTE: Two-sided lighting does not apply to Points } //--------------------------------------------------------------------------- -void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { } //--------------------------------------------------------------------------- -void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -1229,7 +1229,7 @@ void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuin //--------------------------------------------------------------------------- -void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -1336,7 +1336,7 @@ void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, //--------------------------------------------------------------------------- -void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c index 5a82235616..bd7a64f57f 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c @@ -760,7 +760,7 @@ const struct gl_texture_format* _gldMesaFormatForD3DFormat( //--------------------------------------------------------------------------- void gldCopyTexImage1D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -772,7 +772,7 @@ void gldCopyTexImage1D_DX9( //--------------------------------------------------------------------------- void gldCopyTexImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, @@ -788,7 +788,7 @@ void gldCopyTexImage2D_DX9( //--------------------------------------------------------------------------- void gldCopyTexSubImage1D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -798,7 +798,7 @@ void gldCopyTexSubImage1D_DX9( //--------------------------------------------------------------------------- void gldCopyTexSubImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -814,7 +814,7 @@ void gldCopyTexSubImage2D_DX9( //--------------------------------------------------------------------------- void gldCopyTexSubImage3D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -846,7 +846,7 @@ typedef struct { //--------------------------------------------------------------------------- HRESULT _gldDrawPixels( - GLcontext *ctx, + struct gl_context *ctx, BOOL bChromakey, // Alpha test for glBitmap() images GLint x, // GL x position GLint y, // GL y position (needs flipping) @@ -991,7 +991,7 @@ HRESULT _gldDrawPixels( //--------------------------------------------------------------------------- void gld_DrawPixels_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1060,7 +1060,7 @@ void gld_DrawPixels_DX9( //--------------------------------------------------------------------------- void gld_ReadPixels_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -1230,7 +1230,7 @@ gld_ReadPixels_DX9_return: //--------------------------------------------------------------------------- void gld_CopyPixels_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, @@ -1329,7 +1329,7 @@ void gld_CopyPixels_DX9( //--------------------------------------------------------------------------- void gld_Bitmap_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, @@ -1440,7 +1440,7 @@ void gld_Bitmap_DX9( //--------------------------------------------------------------------------- void _gldAllocateTexture( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj, struct gl_texture_image *texImage) { @@ -1486,7 +1486,7 @@ void _gldAllocateTexture( //--------------------------------------------------------------------------- const struct gl_texture_format* gld_ChooseTextureFormat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) @@ -1575,7 +1575,7 @@ const struct gl_texture_format* gld_ChooseTextureFormat_DX9( /* // Safer(?), slower version. void gld_TexImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1653,7 +1653,7 @@ void gld_TexImage2D_DX9( // Faster, more efficient version. // Copies subimage straight to dest texture void gld_TexImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1727,7 +1727,7 @@ void gld_TexImage2D_DX9( //--------------------------------------------------------------------------- -void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, +void gld_TexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1742,7 +1742,7 @@ void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- /* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1818,7 +1818,7 @@ void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, // Faster, more efficient version. // Copies subimage straight to dest texture -void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D_DX9( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1879,7 +1879,7 @@ void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- -void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage1D_DX9( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -1893,7 +1893,7 @@ void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- void gld_DeleteTexture_DX9( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj) { GLD_context *gld = (GLD_context*)(ctx->DriverCtx); @@ -1945,7 +1945,7 @@ __inline void _gldSetAlphaOps( //--------------------------------------------------------------------------- void gldUpdateTextureUnit( - GLcontext *ctx, + struct gl_context *ctx, GLuint unit, BOOL bPassThrough) { @@ -2050,7 +2050,7 @@ void gldUpdateTextureUnit( //--------------------------------------------------------------------------- void gld_NEW_TEXTURE_DX9( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c index 91a68b3f2d..5f818d9f96 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c @@ -61,7 +61,7 @@ //--------------------------------------------------------------------------- __inline void _gldSetVertexShaderConstants( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx9 *gld) { D3DXMATRIX mat, matView, matProj; @@ -116,7 +116,7 @@ __inline void _gldSetVertexShaderConstants( //--------------------------------------------------------------------------- static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -237,7 +237,7 @@ static GLboolean gld_d3d_render_stage_run( //--------------------------------------------------------------------------- static void gld_d3d_render_stage_check( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c index 64acab2d2a..b5e005b25b 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c @@ -162,7 +162,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -250,7 +250,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ /* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -261,7 +261,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -301,7 +301,7 @@ tnl_quad_func _gldSetupQuad[4] = { //--------------------------------------------------------------------------- static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c index a03b865bb4..6cf46fb7a8 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c @@ -54,8 +54,8 @@ extern int nContextError; #define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); //--------------------------------------------------------------------------- @@ -246,7 +246,7 @@ void _gldDestroyPrimitiveBuffer( //--------------------------------------------------------------------------- HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx9 *lpCtx, GLD_pb_dx9 *gldVB) { diff --git a/src/mesa/drivers/windows/gldirect/gld_driver.c b/src/mesa/drivers/windows/gldirect/gld_driver.c index f7c575614b..aa7bc27c99 100644 --- a/src/mesa/drivers/windows/gldirect/gld_driver.c +++ b/src/mesa/drivers/windows/gldirect/gld_driver.c @@ -193,7 +193,7 @@ static BOOL _GetDisplayMode_ERROR( //--------------------------------------------------------------------------- const GLubyte* _gldGetStringGeneric( - GLcontext *ctx, + struct gl_context *ctx, GLenum name) { if (!ctx) diff --git a/src/mesa/drivers/windows/gldirect/gld_driver.h b/src/mesa/drivers/windows/gldirect/gld_driver.h index 01a46a8325..7c393bc4c7 100644 --- a/src/mesa/drivers/windows/gldirect/gld_driver.h +++ b/src/mesa/drivers/windows/gldirect/gld_driver.h @@ -83,7 +83,7 @@ typedef struct { extern GLD_driver _gldDriver; BOOL gldInitDriverPointers(DWORD dwDriver); -const GLubyte* _gldGetStringGeneric(GLcontext *ctx, GLenum name); +const GLubyte* _gldGetStringGeneric(struct gl_context *ctx, GLenum name); #endif // _USE_GLD3_WGL diff --git a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c index b3c2026475..7a26df8071 100644 --- a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c +++ b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c @@ -610,7 +610,7 @@ BOOL wmFlush(PWMC pwc, HDC hDC) // Support Functions //--------------------------------------------------------------------------- -static void flush(GLcontext* ctx) +static void flush(struct gl_context* ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); @@ -634,10 +634,10 @@ static void flush(GLcontext* ctx) /* * Set the color used to clear the color buffer. */ -//static void clear_color( GLcontext* ctx, const GLchan color[4] ) +//static void clear_color( struct gl_context* ctx, const GLchan color[4] ) // Changed for Mesa 5.x. KeithH static void clear_color( - GLcontext* ctx, + struct gl_context* ctx, const GLfloat color[4]) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -664,7 +664,7 @@ static void clear_color( * Otherwise, we let swrast do it. */ -static clear(GLcontext* ctx, GLbitfield mask, +static clear(struct gl_context* ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -787,7 +787,7 @@ static clear(GLcontext* ctx, GLbitfield mask, //--------------------------------------------------------------------------- -static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) +static void enable( struct gl_context* ctx, GLenum pname, GLboolean enable ) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); @@ -814,7 +814,7 @@ static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) //--------------------------------------------------------------------------- -static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode ) +static GLboolean set_draw_buffer( struct gl_context* ctx, GLenum mode ) { /* TODO: this could be better */ if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) { @@ -828,7 +828,7 @@ static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode ) //--------------------------------------------------------------------------- -static void set_read_buffer(GLcontext *ctx, struct gl_framebuffer *colorBuffer, +static void set_read_buffer(struct gl_context *ctx, struct gl_framebuffer *colorBuffer, GLenum buffer ) { /* XXX todo */ @@ -840,7 +840,7 @@ static void set_read_buffer(GLcontext *ctx, struct gl_framebuffer *colorBuffer, /* Return characteristics of the output buffer. */ -//static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height ) +//static void buffer_size( struct gl_context* ctx, GLuint *width, GLuint *height ) // Altered for Mesa 5.x. KeithH static void buffer_size( struct gl_framebuffer *buffer, @@ -888,28 +888,28 @@ static void buffer_size( /* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */ -static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) +static void fast_rgb_points( struct gl_context* ctx, GLuint first, GLuint last ) { } //--------------------------------------------------------------------------- /* Return pointer to accelerated points function */ -extern tnl_points_func choose_points_function( GLcontext* ctx ) +extern tnl_points_func choose_points_function( struct gl_context* ctx ) { return NULL; } //--------------------------------------------------------------------------- -static void fast_flat_rgb_line( GLcontext* ctx, GLuint v0, +static void fast_flat_rgb_line( struct gl_context* ctx, GLuint v0, GLuint v1, GLuint pv ) { } //--------------------------------------------------------------------------- -static tnl_line_func choose_line_function( GLcontext* ctx ) +static tnl_line_func choose_line_function( struct gl_context* ctx ) { } @@ -920,7 +920,7 @@ static tnl_line_func choose_line_function( GLcontext* ctx ) /* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */ -static void write_ci32_span( const GLcontext* ctx, +static void write_ci32_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) @@ -939,7 +939,7 @@ static void write_ci32_span( const GLcontext* ctx, //--------------------------------------------------------------------------- /* Write a horizontal span of 8-bit color-index pixels with a boolean mask. */ -static void write_ci8_span( const GLcontext* ctx, +static void write_ci8_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) @@ -962,7 +962,7 @@ static void write_ci8_span( const GLcontext* ctx, * Write a horizontal span of pixels with a boolean mask. The current * color index is used for all pixels. */ -static void write_mono_ci_span(const GLcontext* ctx, +static void write_mono_ci_span(const struct gl_context* ctx, GLuint n,GLint x,GLint y, GLuint colorIndex, const GLubyte mask[]) { @@ -984,7 +984,7 @@ static void write_mono_ci_span(const GLcontext* ctx, */ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, +static void write_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -1035,7 +1035,7 @@ static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, //--------------------------------------------------------------------------- /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span( const GLcontext* ctx, +static void write_rgb_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] ) { @@ -1090,7 +1090,7 @@ static void write_rgb_span( const GLcontext* ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span( const GLcontext* ctx, +static void write_mono_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) { @@ -1123,7 +1123,7 @@ static void write_mono_rgba_span( const GLcontext* ctx, /* Write an array of 32-bit index pixels with a boolean mask. */ -static void write_ci32_pixels( const GLcontext* ctx, +static void write_ci32_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { @@ -1147,7 +1147,7 @@ static void write_ci32_pixels( const GLcontext* ctx, * Write an array of pixels with a boolean mask. The current color * index is used for all pixels. */ -static void write_mono_ci_pixels( const GLcontext* ctx, +static void write_mono_ci_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ) @@ -1169,7 +1169,7 @@ static void write_mono_ci_pixels( const GLcontext* ctx, /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels( const GLcontext* ctx, +static void write_rgba_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ) { @@ -1194,7 +1194,7 @@ static void write_rgba_pixels( const GLcontext* ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels( const GLcontext* ctx, +static void write_mono_rgba_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], @@ -1218,7 +1218,7 @@ static void write_mono_rgba_pixels( const GLcontext* ctx, /**********************************************************************/ /* Read a horizontal span of color-index pixels. */ -static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, +static void read_ci32_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, GLuint index[]) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -1233,7 +1233,7 @@ static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, //--------------------------------------------------------------------------- /* Read an array of color index pixels. */ -static void read_ci32_pixels( const GLcontext* ctx, +static void read_ci32_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[] ) { @@ -1251,7 +1251,7 @@ static void read_ci32_pixels( const GLcontext* ctx, //--------------------------------------------------------------------------- /* Read a horizontal span of color pixels. */ -static void read_rgba_span( const GLcontext* ctx, +static void read_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { @@ -1275,7 +1275,7 @@ static void read_rgba_span( const GLcontext* ctx, //--------------------------------------------------------------------------- /* Read an array of color pixels. */ -static void read_rgba_pixels( const GLcontext* ctx, +static void read_rgba_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { @@ -1301,7 +1301,7 @@ static void read_rgba_pixels( const GLcontext* ctx, //--------------------------------------------------------------------------- static void wmesa_update_state( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { _swrast_InvalidateState( ctx, new_state ); @@ -1313,7 +1313,7 @@ static void wmesa_update_state( //--------------------------------------------------------------------------- static void wmesa_viewport( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1325,7 +1325,7 @@ static void wmesa_viewport( //--------------------------------------------------------------------------- static void wmesa_update_state_first_time( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); @@ -1570,7 +1570,7 @@ BOOL gldBuildPixelformatList_MesaSW(void) BOOL gldInitialiseMesa_MesaSW( DGL_ctx *gld) { - GLcontext *ctx; + struct gl_context *ctx; if (gld == NULL) return FALSE; diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index f091c38bc4..cb474f7ce5 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1200,7 +1200,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, * Convert an RGBA color to a pixel value. */ unsigned long -xmesa_color_to_pixel(GLcontext *ctx, +xmesa_color_to_pixel(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat) { @@ -1481,7 +1481,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) { static GLboolean firstTime = GL_TRUE; XMesaContext c; - GLcontext *mesaCtx; + struct gl_context *mesaCtx; struct dd_function_table functions; TNLcontext *tnl; @@ -1490,7 +1490,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) firstTime = GL_FALSE; } - /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */ + /* Note: the XMesaContext contains a Mesa struct gl_context struct (inheritance) */ c = (XMesaContext) CALLOC_STRUCT(xmesa_context); if (!c) return NULL; @@ -1501,7 +1501,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_init_driver_functions(&functions); xmesa_init_driver_functions(v, &functions); if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual, - share_list ? &(share_list->mesa) : (GLcontext *) NULL, + share_list ? &(share_list->mesa) : (struct gl_context *) NULL, &functions, (void *) c)) { free(c); return NULL; @@ -1574,7 +1574,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) PUBLIC void XMesaDestroyContext( XMesaContext c ) { - GLcontext *mesaCtx = &c->mesa; + struct gl_context *mesaCtx = &c->mesa; #ifdef FX FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) ); @@ -1804,7 +1804,7 @@ xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer) xmesa_get_window_size(drawBuffer->display, drawBuffer, &width, &height); if (drawBuffer->mesa_buffer.Width != width || drawBuffer->mesa_buffer.Height != height) { - GLcontext *ctx = xmctx ? &xmctx->mesa : NULL; + struct gl_context *ctx = xmctx ? &xmctx->mesa : NULL; _mesa_resize_framebuffer(ctx, &(drawBuffer->mesa_buffer), width, height); } drawBuffer->mesa_buffer.Initialized = GL_TRUE; /* XXX TEMPORARY? */ @@ -2252,7 +2252,7 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { - GLcontext *ctx = &xmesa->mesa; + struct gl_context *ctx = &xmesa->mesa; GLint r = (GLint) (red * 255.0F); GLint g = (GLint) (green * 255.0F); GLint b = (GLint) (blue * 255.0F); diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 3a696f7106..2683bd44d1 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -251,7 +251,7 @@ xmesa_delete_renderbuffer(struct gl_renderbuffer *rb) * Called via gl_renderbuffer::AllocStorage() */ static GLboolean -xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +xmesa_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb); @@ -278,7 +278,7 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, * Called via gl_renderbuffer::AllocStorage() */ static GLboolean -xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb); @@ -323,7 +323,7 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, struct xmesa_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const struct gl_config *visual, +xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name, const struct gl_config *visual, GLboolean backBuffer) { struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 5edafb890b..4f43e80722 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -91,7 +91,7 @@ const int xmesa_kernel1[16] = { static void -finish_or_flush( GLcontext *ctx ) +finish_or_flush( struct gl_context *ctx ) { #ifdef XFree86Server /* NOT_NEEDED */ @@ -107,7 +107,7 @@ finish_or_flush( GLcontext *ctx ) static void -clear_color( GLcontext *ctx, const GLfloat color[4] ) +clear_color( struct gl_context *ctx, const GLfloat color[4] ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -134,7 +134,7 @@ clear_color( GLcontext *ctx, const GLfloat color[4] ) /* Implements glColorMask() */ static void -color_mask(GLcontext *ctx, +color_mask(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -173,7 +173,7 @@ color_mask(GLcontext *ctx, * Clear the front or back color buffer, if it's implemented with a pixmap. */ static void -clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_pixmap(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -193,7 +193,7 @@ clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_8bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -206,7 +206,7 @@ clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_HPCR_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -227,7 +227,7 @@ clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_16bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -249,7 +249,7 @@ clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, /* Optimized code provided by Nozomi Ytow */ static void -clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_24bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -282,7 +282,7 @@ clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_32bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -326,7 +326,7 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_nbit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -345,7 +345,7 @@ clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_buffers(GLcontext *ctx, GLbitfield buffers) +clear_buffers(struct gl_context *ctx, GLbitfield buffers) { if (ctx->DrawBuffer->Name == 0) { /* this is a window system framebuffer */ @@ -396,7 +396,7 @@ clear_buffers(GLcontext *ctx, GLbitfield buffers) * Check if we can do an optimized glDrawPixels into an 8R8G8B visual. */ static GLboolean -can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) +can_do_DrawPixels_8R8G8B(struct gl_context *ctx, GLenum format, GLenum type) { if (format == GL_BGRA && type == GL_UNSIGNED_BYTE && @@ -432,7 +432,7 @@ can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) * The image format must be GL_BGRA to match the PF_8R8G8B pixel format. */ static void -xmesa_DrawPixels_8R8G8B( GLcontext *ctx, +xmesa_DrawPixels_8R8G8B( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -529,7 +529,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, * Check if we can do an optimized glDrawPixels into an 5R6G5B visual. */ static GLboolean -can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) +can_do_DrawPixels_5R6G5B(struct gl_context *ctx, GLenum format, GLenum type) { if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && @@ -567,7 +567,7 @@ can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) * match the PF_5R6G5B pixel format. */ static void -xmesa_DrawPixels_5R6G5B( GLcontext *ctx, +xmesa_DrawPixels_5R6G5B( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -662,7 +662,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, * Determine if we can do an optimized glCopyPixels. */ static GLboolean -can_do_CopyPixels(GLcontext *ctx, GLenum type) +can_do_CopyPixels(struct gl_context *ctx, GLenum type) { if (type == GL_COLOR && ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ @@ -701,7 +701,7 @@ can_do_CopyPixels(GLcontext *ctx, GLenum type) * We do support copying from one window to another, ala glXMakeCurrentRead. */ static void -xmesa_CopyPixels( GLcontext *ctx, +xmesa_CopyPixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { @@ -740,7 +740,7 @@ xmesa_CopyPixels( GLcontext *ctx, * return a meaningful GL_RENDERER string. */ static const GLubyte * -get_string( GLcontext *ctx, GLenum name ) +get_string( struct gl_context *ctx, GLenum name ) { (void) ctx; switch (name) { @@ -767,7 +767,7 @@ get_string( GLcontext *ctx, GLenum name ) * dither enable/disable. */ static void -enable( GLcontext *ctx, GLenum pname, GLboolean state ) +enable( struct gl_context *ctx, GLenum pname, GLboolean state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -785,7 +785,7 @@ enable( GLcontext *ctx, GLenum pname, GLboolean state ) static void -clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) +clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -819,7 +819,7 @@ clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) static void -clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) +clear_color_HPCR_pixmap( struct gl_context *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -863,7 +863,7 @@ clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) * flags. */ void -xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) +xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -954,7 +954,7 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) * texels. */ static GLboolean -test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, +test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border) { @@ -988,7 +988,7 @@ test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures! */ static gl_format -choose_tex_format( GLcontext *ctx, GLint internalFormat, +choose_tex_format( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch (internalFormat) { @@ -1014,7 +1014,7 @@ choose_tex_format( GLcontext *ctx, GLint internalFormat, * That problem led to the GLX_MESA_resize_buffers extension. */ static void -xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +xmesa_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { XMesaContext xmctx = XMESA_CONTEXT(ctx); XMesaBuffer xmdrawbuf = XMESA_BUFFER(ctx->WinSysDrawBuffer); @@ -1044,7 +1044,7 @@ struct xmesa_query_object static struct gl_query_object * -xmesa_new_query_object(GLcontext *ctx, GLuint id) +xmesa_new_query_object(struct gl_context *ctx, GLuint id) { struct xmesa_query_object *q = CALLOC_STRUCT(xmesa_query_object); if (q) { @@ -1056,7 +1056,7 @@ xmesa_new_query_object(GLcontext *ctx, GLuint id) static void -xmesa_begin_query(GLcontext *ctx, struct gl_query_object *q) +xmesa_begin_query(struct gl_context *ctx, struct gl_query_object *q) { if (q->Target == GL_TIME_ELAPSED_EXT) { struct xmesa_query_object *xq = (struct xmesa_query_object *) q; @@ -1083,7 +1083,7 @@ time_diff(const struct timeval *t0, const struct timeval *t1) static void -xmesa_end_query(GLcontext *ctx, struct gl_query_object *q) +xmesa_end_query(struct gl_context *ctx, struct gl_query_object *q) { if (q->Target == GL_TIME_ELAPSED_EXT) { struct xmesa_query_object *xq = (struct xmesa_query_object *) q; @@ -1175,7 +1175,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, * functions. * Called during context creation only. */ -void xmesa_register_swrast_functions( GLcontext *ctx ) +void xmesa_register_swrast_functions( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT( ctx ); diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index f643b6d3a7..f03f99f918 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -54,7 +54,7 @@ */ #if 000 /* XXX don't use this, it doesn't dither correctly */ -static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert ) +static void draw_points_ANY_pixmap( struct gl_context *ctx, const SWvertex *vert ) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; @@ -89,7 +89,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert ) * our internal point functions, otherwise fall back to the standard * swrast functions. */ -void xmesa_choose_point( GLcontext *ctx ) +void xmesa_choose_point( struct gl_context *ctx ) { #if 0 XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -546,7 +546,7 @@ void xmesa_choose_point( GLcontext *ctx ) * for the XSetLineAttributes() function call. */ static void -xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) +xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; @@ -578,7 +578,7 @@ xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) * swrast fallback. */ static swrast_line_func -get_line_func(GLcontext *ctx) +get_line_func(struct gl_context *ctx) { #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -682,7 +682,7 @@ get_line_func(GLcontext *ctx) * standard swrast functions. */ void -xmesa_choose_line(GLcontext *ctx) +xmesa_choose_line(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index c39d87c451..ab66c5e1f1 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -163,13 +163,13 @@ static unsigned long read_pixel( XMesaDisplay *dpy, #define PUT_ROW_ARGS \ - GLcontext *ctx, \ + struct gl_context *ctx, \ struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, \ const void *values, const GLubyte mask[] #define RGB_SPAN_ARGS \ - GLcontext *ctx, \ + struct gl_context *ctx, \ struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, \ const void *values, const GLubyte mask[] @@ -2242,7 +2242,7 @@ static void put_row_rgb_GRAYSCALE8_ximage( RGB_SPAN_ARGS ) #define PUT_VALUES_ARGS \ - GLcontext *ctx, struct gl_renderbuffer *rb, \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ GLuint n, const GLint x[], const GLint y[], \ const void *values, const GLubyte mask[] @@ -2829,7 +2829,7 @@ static void put_values_GRAYSCALE8_ximage( PUT_VALUES_ARGS ) /**********************************************************************/ #define PUT_MONO_ROW_ARGS \ - GLcontext *ctx, struct gl_renderbuffer *rb, \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, const void *value, \ const GLubyte mask[] @@ -3267,7 +3267,7 @@ static void put_mono_row_DITHER_5R6G5B_ximage( PUT_MONO_ROW_ARGS ) /**********************************************************************/ #define PUT_MONO_VALUES_ARGS \ - GLcontext *ctx, struct gl_renderbuffer *rb, \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ GLuint n, const GLint x[], const GLint y[], \ const void *value, const GLubyte mask[] @@ -3773,7 +3773,7 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS ) * else return number of pixels to skip in the destination array. */ static int -clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y) +clip_for_xgetimage(struct gl_context *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); @@ -3813,7 +3813,7 @@ clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLin * Read a horizontal span of color-index pixels. */ static void -get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, +get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLuint *index = (GLuint *) values; @@ -3870,7 +3870,7 @@ get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, * Read a horizontal span of color pixels. */ static void -get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, +get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; @@ -4272,7 +4272,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, * Read an array of color index pixels. */ static void -get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb, +get_values_ci(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { GLuint *indx = (GLuint *) values; @@ -4296,7 +4296,7 @@ get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_values_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, +get_values_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index a6efb35e3c..98dece113d 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1448,7 +1448,7 @@ do { \ * swrast fallback. */ static swrast_tri_func -get_triangle_func(GLcontext *ctx) +get_triangle_func(struct gl_context *ctx) { #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -1644,7 +1644,7 @@ get_triangle_func(GLcontext *ctx) * of our internal tri functions, otherwise fall back to the * standard swrast functions. */ -void xmesa_choose_triangle( GLcontext *ctx ) +void xmesa_choose_triangle( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 37b7a587de..a24b6a1a96 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -54,7 +54,7 @@ struct xmesa_renderbuffer; /* Function pointer for clearing color buffers */ -typedef void (*ClearFunc)( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +typedef void (*ClearFunc)( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ); @@ -128,11 +128,11 @@ struct xmesa_visual { /** - * Context info, derived from GLcontext. + * Context info, derived from struct gl_context. * Basically corresponds to a GLXContext. */ struct xmesa_context { - GLcontext mesa; /* the core library context (containment) */ + struct gl_context mesa; /* the core library context (containment) */ XMesaVisual xm_visual; /* Describes the buffers */ XMesaBuffer xm_buffer; /* current span/point/line/triangle buffer */ @@ -495,7 +495,7 @@ extern const int xmesa_kernel1[16]; */ extern struct xmesa_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const struct gl_config *visual, +xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name, const struct gl_config *visual, GLboolean backBuffer); extern void @@ -505,7 +505,7 @@ extern XMesaBuffer xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis); extern unsigned long -xmesa_color_to_pixel( GLcontext *ctx, +xmesa_color_to_pixel( struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat ); @@ -521,7 +521,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, struct dd_function_table *driver ); extern void -xmesa_update_state( GLcontext *ctx, GLbitfield new_state ); +xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ); extern void xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, @@ -542,11 +542,11 @@ xmesa_renderbuffer(struct gl_renderbuffer *rb) /** - * Return pointer to XMesaContext corresponding to a Mesa GLcontext. + * Return pointer to XMesaContext corresponding to a Mesa struct gl_context. * Since we're using structure containment, it's just a cast!. */ static INLINE XMesaContext -XMESA_CONTEXT(GLcontext *ctx) +XMESA_CONTEXT(struct gl_context *ctx) { return (XMesaContext) ctx; } @@ -566,12 +566,12 @@ XMESA_BUFFER(struct gl_framebuffer *b) /* Plugged into the software rasterizer. Try to use internal * swrast-style point, line and triangle functions. */ -extern void xmesa_choose_point( GLcontext *ctx ); -extern void xmesa_choose_line( GLcontext *ctx ); -extern void xmesa_choose_triangle( GLcontext *ctx ); +extern void xmesa_choose_point( struct gl_context *ctx ); +extern void xmesa_choose_line( struct gl_context *ctx ); +extern void xmesa_choose_triangle( struct gl_context *ctx ); -extern void xmesa_register_swrast_functions( GLcontext *ctx ); +extern void xmesa_register_swrast_functions( struct gl_context *ctx ); diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 2012d00fd5..9026110f3e 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -115,7 +115,7 @@ _mesa_init_accum_dispatch(struct _glapi_table *disp) void -_mesa_init_accum( GLcontext *ctx ) +_mesa_init_accum( struct gl_context *ctx ) { /* Accumulate buffer group */ ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); diff --git a/src/mesa/main/accum.h b/src/mesa/main/accum.h index 4b628bafa0..def692a73a 100644 --- a/src/mesa/main/accum.h +++ b/src/mesa/main/accum.h @@ -67,6 +67,6 @@ _mesa_init_accum_dispatch(struct _glapi_table *disp) #endif /* FEATURE_accum */ extern void -_mesa_init_accum( GLcontext *ctx ); +_mesa_init_accum( struct gl_context *ctx ); #endif /* ACCUM_H */ diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index ffcd194240..172c33b47b 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1031,7 +1031,7 @@ static attrib_func AttribFuncsARB[2][4][8] = { /**********************************************************************/ -GLboolean _ae_create_context( GLcontext *ctx ) +GLboolean _ae_create_context( struct gl_context *ctx ) { if (ctx->aelt_context) return GL_TRUE; @@ -1064,7 +1064,7 @@ GLboolean _ae_create_context( GLcontext *ctx ) } -void _ae_destroy_context( GLcontext *ctx ) +void _ae_destroy_context( struct gl_context *ctx ) { if ( AE_CONTEXT( ctx ) ) { FREE( ctx->aelt_context ); @@ -1092,7 +1092,7 @@ static void check_vbo( AEcontext *actx, * etc). * Note: this may be called during display list construction. */ -static void _ae_update_state( GLcontext *ctx ) +static void _ae_update_state( struct gl_context *ctx ) { AEcontext *actx = AE_CONTEXT(ctx); AEarray *aa = actx->arrays; @@ -1211,7 +1211,7 @@ static void _ae_update_state( GLcontext *ctx ) actx->NewState = 0; } -void _ae_map_vbos( GLcontext *ctx ) +void _ae_map_vbos( struct gl_context *ctx ) { AEcontext *actx = AE_CONTEXT(ctx); GLuint i; @@ -1232,7 +1232,7 @@ void _ae_map_vbos( GLcontext *ctx ) actx->mapped_vbos = GL_TRUE; } -void _ae_unmap_vbos( GLcontext *ctx ) +void _ae_unmap_vbos( struct gl_context *ctx ) { AEcontext *actx = AE_CONTEXT(ctx); GLuint i; @@ -1300,7 +1300,7 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) } -void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) +void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state ) { AEcontext *actx = AE_CONTEXT(ctx); diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h index d18c0792c3..610e522a94 100644 --- a/src/mesa/main/api_arrayelt.h +++ b/src/mesa/main/api_arrayelt.h @@ -37,15 +37,15 @@ (vfmt)->ArrayElement = impl ## ArrayElement; \ } while (0) -extern GLboolean _ae_create_context( GLcontext *ctx ); -extern void _ae_destroy_context( GLcontext *ctx ); -extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ); +extern GLboolean _ae_create_context( struct gl_context *ctx ); +extern void _ae_destroy_context( struct gl_context *ctx ); +extern void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state ); extern void GLAPIENTRY _ae_ArrayElement( GLint elt ); /* May optionally be called before a batch of element calls: */ -extern void _ae_map_vbos( GLcontext *ctx ); -extern void _ae_unmap_vbos( GLcontext *ctx ); +extern void _ae_map_vbos( struct gl_context *ctx ); +extern void _ae_unmap_vbos( struct gl_context *ctx ); extern void _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, @@ -56,18 +56,18 @@ _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, #define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl) do { } while (0) static INLINE GLboolean -_ae_create_context( GLcontext *ctx ) +_ae_create_context( struct gl_context *ctx ) { return GL_TRUE; } static INLINE void -_ae_destroy_context( GLcontext *ctx ) +_ae_destroy_context( struct gl_context *ctx ) { } static INLINE void -_ae_invalidate_state( GLcontext *ctx, GLuint new_state ) +_ae_invalidate_state( struct gl_context *ctx, GLuint new_state ) { } diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index b3b5c6cc05..4929a9310d 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -54,7 +54,7 @@ index_bytes(GLenum type, GLsizei count) * Find the max index in the given element/index buffer */ GLuint -_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, +_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, const void *indices, struct gl_buffer_object *elementBuf) { @@ -99,7 +99,7 @@ _mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, * Check if OK to draw arrays/elements. */ static GLboolean -check_valid_to_render(GLcontext *ctx, const char *function) +check_valid_to_render(struct gl_context *ctx, const char *function) { if (!_mesa_valid_to_render(ctx, function)) { return GL_FALSE; @@ -140,7 +140,7 @@ check_valid_to_render(GLcontext *ctx, const char *function) * \return GL_TRUE if OK, GL_FALSE if any indexed vertex goes is out of bounds */ static GLboolean -check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type, +check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { struct _mesa_prim prim; @@ -181,7 +181,7 @@ check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type, * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean -_mesa_validate_DrawElements(GLcontext *ctx, +_mesa_validate_DrawElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { @@ -237,7 +237,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean -_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, +_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) @@ -298,7 +298,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean -_mesa_validate_DrawArrays(GLcontext *ctx, +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLint start, GLsizei count) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); @@ -327,7 +327,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, GLboolean -_mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first, +_mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); @@ -371,7 +371,7 @@ _mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first, GLboolean -_mesa_validate_DrawElementsInstanced(GLcontext *ctx, +_mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) { diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h index cd27d58aa7..b232a90843 100644 --- a/src/mesa/main/api_validate.h +++ b/src/mesa/main/api_validate.h @@ -32,32 +32,32 @@ extern GLuint -_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, +_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, const void *indices, struct gl_buffer_object *elementBuf); extern GLboolean -_mesa_validate_DrawArrays(GLcontext *ctx, +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLint start, GLsizei count); extern GLboolean -_mesa_validate_DrawElements(GLcontext *ctx, +_mesa_validate_DrawElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); extern GLboolean -_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, +_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); extern GLboolean -_mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first, +_mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount); extern GLboolean -_mesa_validate_DrawElementsInstanced(GLcontext *ctx, +_mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 0069cd3dcf..0d64b7de8d 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -61,7 +61,7 @@ */ static INLINE struct gl_array_object * -lookup_arrayobj(GLcontext *ctx, GLuint id) +lookup_arrayobj(struct gl_context *ctx, GLuint id) { if (id == 0) return NULL; @@ -77,7 +77,7 @@ lookup_arrayobj(GLcontext *ctx, GLuint id) * This is done just prior to array object destruction. */ static void -unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) +unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj) { GLuint i; @@ -109,7 +109,7 @@ unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) * \c dd_function_table::NewArrayObject. */ struct gl_array_object * -_mesa_new_array_object( GLcontext *ctx, GLuint name ) +_mesa_new_array_object( struct gl_context *ctx, GLuint name ) { struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object); if (obj) @@ -125,7 +125,7 @@ _mesa_new_array_object( GLcontext *ctx, GLuint name ) * \c dd_function_table::DeleteArrayObject. */ void -_mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) +_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ) { (void) ctx; unbind_array_object_vbos(ctx, obj); @@ -138,7 +138,7 @@ _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) * Set ptr to arrayObj w/ reference counting. */ void -_mesa_reference_array_object(GLcontext *ctx, +_mesa_reference_array_object(struct gl_context *ctx, struct gl_array_object **ptr, struct gl_array_object *arrayObj) { @@ -193,7 +193,7 @@ _mesa_reference_array_object(GLcontext *ctx, static void -init_array(GLcontext *ctx, +init_array(struct gl_context *ctx, struct gl_client_array *array, GLint size, GLint type) { array->Size = size; @@ -216,7 +216,7 @@ init_array(GLcontext *ctx, * Initialize a gl_array_object's arrays. */ void -_mesa_initialize_array_object( GLcontext *ctx, +_mesa_initialize_array_object( struct gl_context *ctx, struct gl_array_object *obj, GLuint name ) { @@ -253,7 +253,7 @@ _mesa_initialize_array_object( GLcontext *ctx, * Add the given array object to the array object pool. */ static void -save_array_object( GLcontext *ctx, struct gl_array_object *obj ) +save_array_object( struct gl_context *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* insert into hash table */ @@ -267,7 +267,7 @@ save_array_object( GLcontext *ctx, struct gl_array_object *obj ) * Do not deallocate the array object though. */ static void -remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) +remove_array_object( struct gl_context *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* remove from hash table */ @@ -327,7 +327,7 @@ update_min(GLuint min, struct gl_client_array *array) * Examine vertex arrays to update the gl_array_object::_MaxElement field. */ void -_mesa_update_array_object_max_element(GLcontext *ctx, +_mesa_update_array_object_max_element(struct gl_context *ctx, struct gl_array_object *arrayObj) { GLuint i, min = ~0; @@ -364,7 +364,7 @@ _mesa_update_array_object_max_element(GLcontext *ctx, * glGenVertexArrays(). */ static void -bind_vertex_array(GLcontext *ctx, GLuint id, GLboolean genRequired) +bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) { struct gl_array_object * const oldObj = ctx->Array.ArrayObj; struct gl_array_object *newObj = NULL; @@ -495,7 +495,7 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) * \param vboOnly Will arrays have to reside in VBOs? */ static void -gen_vertex_arrays(GLcontext *ctx, GLsizei n, GLuint *arrays, GLboolean vboOnly) +gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays, GLboolean vboOnly) { GLuint first; GLint i; diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index fdf7e2bca4..26e3af19c9 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -43,23 +43,23 @@ */ extern struct gl_array_object * -_mesa_new_array_object( GLcontext *ctx, GLuint name ); +_mesa_new_array_object( struct gl_context *ctx, GLuint name ); extern void -_mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ); +_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ); extern void -_mesa_reference_array_object(GLcontext *ctx, +_mesa_reference_array_object(struct gl_context *ctx, struct gl_array_object **ptr, struct gl_array_object *arrayObj); extern void -_mesa_initialize_array_object( GLcontext *ctx, +_mesa_initialize_array_object( struct gl_context *ctx, struct gl_array_object *obj, GLuint name ); extern void -_mesa_update_array_object_max_element(GLcontext *ctx, +_mesa_update_array_object_max_element(struct gl_context *ctx, struct gl_array_object *arrayObj); diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index 550f50b7a0..ae2feb3229 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -62,7 +62,7 @@ _mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) * Allocate and initialize a new ATI fragment shader object. */ struct ati_fragment_shader * -_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) +_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) { struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader); (void) ctx; @@ -78,7 +78,7 @@ _mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) * Delete the given ati fragment shader */ void -_mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s) +_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) { GLuint i; for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { diff --git a/src/mesa/main/atifragshader.h b/src/mesa/main/atifragshader.h index 31c335ec81..6911bba5ae 100644 --- a/src/mesa/main/atifragshader.h +++ b/src/mesa/main/atifragshader.h @@ -66,10 +66,10 @@ extern void _mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp); extern struct ati_fragment_shader * -_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id); +_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id); extern void -_mesa_delete_ati_fragment_shader(GLcontext *ctx, +_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s); @@ -133,13 +133,13 @@ _mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) } static INLINE struct ati_fragment_shader * -_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) +_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) { return NULL; } static INLINE void -_mesa_delete_ati_fragment_shader(GLcontext *ctx, +_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) { } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 0299525f46..fb6fbe5b6d 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -473,7 +473,7 @@ end: static void -pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) +pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) { const GLuint curTexUnitSave = ctx->Texture.CurrentUnit; GLuint i; @@ -669,7 +669,7 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) * Pop/restore texture attribute/group state. */ static void -pop_texture_group(GLcontext *ctx, struct texture_state *texstate) +pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) { GLuint u; @@ -1323,7 +1323,7 @@ adjust_buffer_object_ref_counts(struct gl_array_object *arrayObj, GLint step) * object refcounts. */ static void -copy_pixelstore(GLcontext *ctx, +copy_pixelstore(struct gl_context *ctx, struct gl_pixelstore_attrib *dst, const struct gl_pixelstore_attrib *src) { @@ -1506,7 +1506,7 @@ _mesa_init_attrib_dispatch(struct _glapi_table *disp) * Free any attribute state data that might be attached to the context. */ void -_mesa_free_attrib_data(GLcontext *ctx) +_mesa_free_attrib_data(struct gl_context *ctx) { while (ctx->AttribStackDepth > 0) { struct gl_attrib_node *attr, *next; @@ -1538,7 +1538,7 @@ _mesa_free_attrib_data(GLcontext *ctx) } -void _mesa_init_attrib( GLcontext *ctx ) +void _mesa_init_attrib( struct gl_context *ctx ) { /* Renderer and client attribute stacks */ ctx->AttribStackDepth = 0; diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h index 83b28a65b7..777781bdf0 100644 --- a/src/mesa/main/attrib.h +++ b/src/mesa/main/attrib.h @@ -70,9 +70,9 @@ _mesa_init_attrib_dispatch(struct _glapi_table *disp) #endif /* FEATURE_attrib_stack */ extern void -_mesa_init_attrib( GLcontext *ctx ); +_mesa_init_attrib( struct gl_context *ctx ); extern void -_mesa_free_attrib_data( GLcontext *ctx ); +_mesa_free_attrib_data( struct gl_context *ctx ); #endif /* ATTRIB_H */ diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 736a94c052..ec778b7244 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -207,7 +207,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, #if _HAVE_FULL_GL static GLboolean -_mesa_validate_blend_equation( GLcontext *ctx, +_mesa_validate_blend_equation( struct gl_context *ctx, GLenum mode, GLboolean is_separate ) { switch (mode) { @@ -589,9 +589,9 @@ _mesa_ClampColorARB(GLenum target, GLenum clamp) * \param ctx GL context. * * Initializes the related fields in the context color attribute group, - * __GLcontextRec::Color. + * __struct gl_contextRec::Color. */ -void _mesa_init_color( GLcontext * ctx ) +void _mesa_init_color( struct gl_context * ctx ) { /* Color buffer group */ ctx->Color.IndexMask = ~0u; diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h index b4fd7470eb..677b01cc9f 100644 --- a/src/mesa/main/blend.h +++ b/src/mesa/main/blend.h @@ -82,6 +82,6 @@ _mesa_ClampColorARB(GLenum target, GLenum clamp); extern void -_mesa_init_color( GLcontext * ctx ); +_mesa_init_color( struct gl_context * ctx ); #endif diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 61d46b936b..0a68008a10 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -62,7 +62,7 @@ * specified context or \c NULL if \c target is invalid. */ static INLINE struct gl_buffer_object ** -get_buffer_target(GLcontext *ctx, GLenum target) +get_buffer_target(struct gl_context *ctx, GLenum target) { switch (target) { case GL_ARRAY_BUFFER_ARB: @@ -99,7 +99,7 @@ get_buffer_target(GLcontext *ctx, GLenum target) * specified context or \c NULL if \c target is invalid. */ static INLINE struct gl_buffer_object * -get_buffer(GLcontext *ctx, GLenum target) +get_buffer(struct gl_context *ctx, GLenum target) { struct gl_buffer_object **bufObj = get_buffer_target(ctx, target); if (bufObj) @@ -143,7 +143,7 @@ simplified_access_mode(GLbitfield access) * \sa glBufferSubDataARB, glGetBufferSubDataARB */ static struct gl_buffer_object * -buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, +buffer_object_subdata_range_good( struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const char *caller ) { @@ -189,7 +189,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, * Default callback for the \c dd_function_table::NewBufferObject() hook. */ static struct gl_buffer_object * -_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) +_mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_buffer_object *obj; @@ -207,7 +207,7 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) * Default callback for the \c dd_function_table::DeleteBuffer() hook. */ static void -_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) +_mesa_delete_buffer_object( struct gl_context *ctx, struct gl_buffer_object *bufObj ) { (void) ctx; @@ -228,7 +228,7 @@ _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) * Set ptr to bufObj w/ reference counting. */ void -_mesa_reference_buffer_object(GLcontext *ctx, +_mesa_reference_buffer_object(struct gl_context *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj) { @@ -328,7 +328,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, * \sa glBufferDataARB, dd_function_table::BufferData. */ static GLboolean -_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, +_mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage, struct gl_buffer_object * bufObj ) { @@ -372,7 +372,7 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, * \sa glBufferSubDataARB, dd_function_table::BufferSubData. */ static void -_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, +_mesa_buffer_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object * bufObj ) { @@ -405,7 +405,7 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData. */ static void -_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, +_mesa_buffer_get_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data, struct gl_buffer_object * bufObj ) { @@ -432,7 +432,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * \sa glMapBufferARB, dd_function_table::MapBuffer */ static void * -_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, +_mesa_buffer_map( struct gl_context *ctx, GLenum target, GLenum access, struct gl_buffer_object *bufObj ) { (void) ctx; @@ -455,7 +455,7 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, * Called via glMapBufferRange(). */ static void * -_mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset, +_mesa_buffer_map_range( struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *bufObj ) { @@ -476,7 +476,7 @@ _mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset, * Called via glFlushMappedBufferRange(). */ static void -_mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target, +_mesa_buffer_flush_mapped_range( struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj ) { @@ -497,7 +497,7 @@ _mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target, * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer */ static GLboolean -_mesa_buffer_unmap( GLcontext *ctx, GLenum target, +_mesa_buffer_unmap( struct gl_context *ctx, GLenum target, struct gl_buffer_object *bufObj ) { (void) ctx; @@ -516,7 +516,7 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target, * Called via glCopyBuffserSubData(). */ static void -_mesa_copy_buffer_subdata(GLcontext *ctx, +_mesa_copy_buffer_subdata(struct gl_context *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, GLintptr readOffset, GLintptr writeOffset, @@ -546,7 +546,7 @@ _mesa_copy_buffer_subdata(GLcontext *ctx, * Initialize the state associated with buffer objects */ void -_mesa_init_buffer_objects( GLcontext *ctx ) +_mesa_init_buffer_objects( struct gl_context *ctx ) { _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, ctx->Shared->NullBufferObj); @@ -561,7 +561,7 @@ _mesa_init_buffer_objects( GLcontext *ctx ) void -_mesa_free_buffer_objects( GLcontext *ctx ) +_mesa_free_buffer_objects( struct gl_context *ctx ) { _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL); _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL); @@ -576,7 +576,7 @@ _mesa_free_buffer_objects( GLcontext *ctx ) * Called by glBindBuffer() and other functions. */ static void -bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) +bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer) { struct gl_buffer_object *oldBufObj; struct gl_buffer_object *newBufObj = NULL; @@ -632,7 +632,7 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) * shared state. */ void -_mesa_update_default_objects_buffer_objects(GLcontext *ctx) +_mesa_update_default_objects_buffer_objects(struct gl_context *ctx) { /* Bind the NullBufferObj to remove references to those * in the shared context hash table. @@ -716,7 +716,7 @@ _mesa_validate_pbo_access(GLuint dimensions, * \return NULL if error, else pointer to start of data */ const GLvoid * -_mesa_map_pbo_source(GLcontext *ctx, +_mesa_map_pbo_source(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *src) { @@ -750,7 +750,7 @@ _mesa_map_pbo_source(GLcontext *ctx, * _mesa_unmap_pbo_source(). */ const GLvoid * -_mesa_map_validate_pbo_source(GLcontext *ctx, +_mesa_map_validate_pbo_source(struct gl_context *ctx, GLuint dimensions, const struct gl_pixelstore_attrib *unpack, GLsizei width, GLsizei height, GLsizei depth, @@ -786,7 +786,7 @@ _mesa_map_validate_pbo_source(GLcontext *ctx, * Counterpart to _mesa_map_pbo_source() */ void -_mesa_unmap_pbo_source(GLcontext *ctx, +_mesa_unmap_pbo_source(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack) { ASSERT(unpack != &ctx->Pack); /* catch pack/unpack mismatch */ @@ -806,7 +806,7 @@ _mesa_unmap_pbo_source(GLcontext *ctx, * \return NULL if error, else pointer to start of data */ void * -_mesa_map_pbo_dest(GLcontext *ctx, +_mesa_map_pbo_dest(struct gl_context *ctx, const struct gl_pixelstore_attrib *pack, GLvoid *dest) { @@ -840,7 +840,7 @@ _mesa_map_pbo_dest(GLcontext *ctx, * _mesa_unmap_pbo_dest(). */ GLvoid * -_mesa_map_validate_pbo_dest(GLcontext *ctx, +_mesa_map_validate_pbo_dest(struct gl_context *ctx, GLuint dimensions, const struct gl_pixelstore_attrib *unpack, GLsizei width, GLsizei height, GLsizei depth, @@ -876,7 +876,7 @@ _mesa_map_validate_pbo_dest(GLcontext *ctx, * Counterpart to _mesa_map_pbo_dest() */ void -_mesa_unmap_pbo_dest(GLcontext *ctx, +_mesa_unmap_pbo_dest(struct gl_context *ctx, const struct gl_pixelstore_attrib *pack) { ASSERT(pack != &ctx->Unpack); /* catch pack/unpack mismatch */ @@ -892,7 +892,7 @@ _mesa_unmap_pbo_dest(GLcontext *ctx, * Always return NULL for ID 0. */ struct gl_buffer_object * -_mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer) +_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer) { if (buffer == 0) return NULL; @@ -909,7 +909,7 @@ _mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer) * unbound from all arrays in the current context. */ static void -unbind(GLcontext *ctx, +unbind(struct gl_context *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *obj) { @@ -1754,7 +1754,7 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) #if FEATURE_APPLE_object_purgeable static GLenum -_mesa_BufferObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) +_mesa_BufferObjectPurgeable(struct gl_context *ctx, GLuint name, GLenum option) { struct gl_buffer_object *bufObj; GLenum retval; @@ -1787,7 +1787,7 @@ _mesa_BufferObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) static GLenum -_mesa_RenderObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) +_mesa_RenderObjectPurgeable(struct gl_context *ctx, GLuint name, GLenum option) { struct gl_renderbuffer *bufObj; GLenum retval; @@ -1816,7 +1816,7 @@ _mesa_RenderObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) static GLenum -_mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) +_mesa_TextureObjectPurgeable(struct gl_context *ctx, GLuint name, GLenum option) { struct gl_texture_object *bufObj; GLenum retval; @@ -1897,7 +1897,7 @@ _mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) static GLenum -_mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) +_mesa_BufferObjectUnpurgeable(struct gl_context *ctx, GLuint name, GLenum option) { struct gl_buffer_object *bufObj; GLenum retval; @@ -1927,7 +1927,7 @@ _mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) static GLenum -_mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) +_mesa_RenderObjectUnpurgeable(struct gl_context *ctx, GLuint name, GLenum option) { struct gl_renderbuffer *bufObj; GLenum retval; @@ -1957,7 +1957,7 @@ _mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) static GLenum -_mesa_TextureObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) +_mesa_TextureObjectUnpurgeable(struct gl_context *ctx, GLuint name, GLenum option) { struct gl_texture_object *bufObj; GLenum retval; @@ -2027,7 +2027,7 @@ _mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) static void -_mesa_GetBufferObjectParameterivAPPLE(GLcontext *ctx, GLuint name, +_mesa_GetBufferObjectParameterivAPPLE(struct gl_context *ctx, GLuint name, GLenum pname, GLint* params) { struct gl_buffer_object *bufObj; @@ -2053,7 +2053,7 @@ _mesa_GetBufferObjectParameterivAPPLE(GLcontext *ctx, GLuint name, static void -_mesa_GetRenderObjectParameterivAPPLE(GLcontext *ctx, GLuint name, +_mesa_GetRenderObjectParameterivAPPLE(struct gl_context *ctx, GLuint name, GLenum pname, GLint* params) { struct gl_renderbuffer *bufObj; @@ -2079,7 +2079,7 @@ _mesa_GetRenderObjectParameterivAPPLE(GLcontext *ctx, GLuint name, static void -_mesa_GetTextureObjectParameterivAPPLE(GLcontext *ctx, GLuint name, +_mesa_GetTextureObjectParameterivAPPLE(struct gl_context *ctx, GLuint name, GLenum pname, GLint* params) { struct gl_texture_object *bufObj; diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index f234d06c6c..4b97e34767 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -57,24 +57,24 @@ _mesa_is_bufferobj(const struct gl_buffer_object *obj) extern void -_mesa_init_buffer_objects( GLcontext *ctx ); +_mesa_init_buffer_objects( struct gl_context *ctx ); extern void -_mesa_free_buffer_objects( GLcontext *ctx ); +_mesa_free_buffer_objects( struct gl_context *ctx ); extern void -_mesa_update_default_objects_buffer_objects(GLcontext *ctx); +_mesa_update_default_objects_buffer_objects(struct gl_context *ctx); extern struct gl_buffer_object * -_mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer); +_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer); extern void _mesa_initialize_buffer_object( struct gl_buffer_object *obj, GLuint name, GLenum target ); extern void -_mesa_reference_buffer_object(GLcontext *ctx, +_mesa_reference_buffer_object(struct gl_context *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj); @@ -85,12 +85,12 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, const GLvoid *ptr); extern const GLvoid * -_mesa_map_pbo_source(GLcontext *ctx, +_mesa_map_pbo_source(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *src); extern const GLvoid * -_mesa_map_validate_pbo_source(GLcontext *ctx, +_mesa_map_validate_pbo_source(struct gl_context *ctx, GLuint dimensions, const struct gl_pixelstore_attrib *unpack, GLsizei width, GLsizei height, GLsizei depth, @@ -98,16 +98,16 @@ _mesa_map_validate_pbo_source(GLcontext *ctx, const char *where); extern void -_mesa_unmap_pbo_source(GLcontext *ctx, +_mesa_unmap_pbo_source(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack); extern void * -_mesa_map_pbo_dest(GLcontext *ctx, +_mesa_map_pbo_dest(struct gl_context *ctx, const struct gl_pixelstore_attrib *pack, GLvoid *dest); extern GLvoid * -_mesa_map_validate_pbo_dest(GLcontext *ctx, +_mesa_map_validate_pbo_dest(struct gl_context *ctx, GLuint dimensions, const struct gl_pixelstore_attrib *unpack, GLsizei width, GLsizei height, GLsizei depth, @@ -115,7 +115,7 @@ _mesa_map_validate_pbo_dest(GLcontext *ctx, const char *where); extern void -_mesa_unmap_pbo_dest(GLcontext *ctx, +_mesa_unmap_pbo_dest(struct gl_context *ctx, const struct gl_pixelstore_attrib *pack); diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index fb30b59960..86446311fe 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -50,7 +50,7 @@ * \return bitmask of BUFFER_BIT_* flags */ static GLbitfield -supported_buffer_bitmask(const GLcontext *ctx, const struct gl_framebuffer *fb) +supported_buffer_bitmask(const struct gl_context *ctx, const struct gl_framebuffer *fb) { GLbitfield mask = 0x0; @@ -355,7 +355,7 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) * BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT). */ void -_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, +_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, const GLbitfield *destMask) { struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -452,7 +452,7 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, * \param bufferIndex the numerical index corresponding to 'buffer' */ void -_mesa_readbuffer(GLcontext *ctx, GLenum buffer, GLint bufferIndex) +_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex) { struct gl_framebuffer *fb = ctx->ReadBuffer; diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 8a7e7b5c1f..36d6c8b660 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -43,11 +43,11 @@ extern void GLAPIENTRY _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers); extern void -_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, +_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, const GLbitfield *destMask); extern void -_mesa_readbuffer(GLcontext *ctx, GLenum buffer, GLint bufferIndex); +_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex); extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 49d86b3b1f..b011da04b4 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -100,7 +100,7 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) * * \param mask bit-mask indicating the buffers to be cleared. * - * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState + * Flushes the vertices and verifies the parameter. If __struct gl_contextRec::NewState * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, * etc. If the rasterization mode is set to GL_RENDER then requests the driver * to clear the buffers, via the dd_function_table::Clear callback. @@ -191,7 +191,7 @@ _mesa_Clear( GLbitfield mask ) * Return INVALID_MASK if the drawbuffer value is invalid. */ static GLbitfield -make_color_buffer_mask(GLcontext *ctx, GLint drawbuffer) +make_color_buffer_mask(struct gl_context *ctx, GLint drawbuffer) { const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment; GLbitfield mask = 0x0; diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 5c2697d40a..6295dc88de 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -176,7 +176,7 @@ set_component_sizes( struct gl_color_table *table ) * \param [rgba]Bias - RGBA bias factors */ static void -store_colortable_entries(GLcontext *ctx, struct gl_color_table *table, +store_colortable_entries(struct gl_context *ctx, struct gl_color_table *table, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data, GLfloat rScale, GLfloat rBias, diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index 8d9a91d547..25b3dd678d 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -117,7 +117,7 @@ _mesa_EndConditionalRender(void) * \return GL_TRUE if we should render, GL_FALSE if we should discard */ GLboolean -_mesa_check_conditional_render(GLcontext *ctx) +_mesa_check_conditional_render(struct gl_context *ctx) { struct gl_query_object *q = ctx->Query.CondRenderQuery; diff --git a/src/mesa/main/condrender.h b/src/mesa/main/condrender.h index d55e9805fe..cf6d4ca289 100644 --- a/src/mesa/main/condrender.h +++ b/src/mesa/main/condrender.h @@ -39,7 +39,7 @@ extern void APIENTRY _mesa_EndConditionalRender(void); extern GLboolean -_mesa_check_conditional_render(GLcontext *ctx); +_mesa_check_conditional_render(struct gl_context *ctx); #endif /* CONDRENDER_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0ecbea2c51..41f30cae43 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -163,7 +163,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256]; * We have to finish any pending rendering. */ void -_mesa_notifySwapBuffers(GLcontext *ctx) +_mesa_notifySwapBuffers(struct gl_context *ctx) { if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS) _mesa_debug(ctx, "SwapBuffers\n"); @@ -377,7 +377,7 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock); * \sa _math_init(). */ static void -one_time_init( GLcontext *ctx ) +one_time_init( struct gl_context *ctx ) { static GLboolean alreadyCalled = GL_FALSE; (void) ctx; @@ -444,7 +444,7 @@ one_time_init( GLcontext *ctx ) * Initialize fields of gl_current_attrib (aka ctx->Current.*) */ static void -_mesa_init_current(GLcontext *ctx) +_mesa_init_current(struct gl_context *ctx) { GLuint i; @@ -526,7 +526,7 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) * some of these values (such as number of texture units). */ static void -_mesa_init_constants(GLcontext *ctx) +_mesa_init_constants(struct gl_context *ctx) { assert(ctx); @@ -632,7 +632,7 @@ _mesa_init_constants(GLcontext *ctx) * Only called the first time a context is bound. */ static void -check_context_limits(GLcontext *ctx) +check_context_limits(struct gl_context *ctx) { /* check that we don't exceed the size of various bitfields */ assert(VERT_RESULT_MAX <= @@ -707,7 +707,7 @@ check_context_limits(GLcontext *ctx) * functions for the more complex data structures. */ static GLboolean -init_attrib_groups(GLcontext *ctx) +init_attrib_groups(struct gl_context *ctx) { assert(ctx); @@ -775,7 +775,7 @@ init_attrib_groups(GLcontext *ctx) * state. */ static GLboolean -update_default_objects(GLcontext *ctx) +update_default_objects(struct gl_context *ctx) { assert(ctx); @@ -827,7 +827,7 @@ _mesa_alloc_dispatch_table(int size) /** - * Initialize a GLcontext struct (rendering context). + * Initialize a struct gl_context struct (rendering context). * * This includes allocating all the other structs and arrays which hang off of * the context by pointers. @@ -854,10 +854,10 @@ _mesa_alloc_dispatch_table(int size) * \param driverContext pointer to driver-specific context data */ GLboolean -_mesa_initialize_context_for_api(GLcontext *ctx, +_mesa_initialize_context_for_api(struct gl_context *ctx, gl_api api, const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext) { @@ -993,9 +993,9 @@ _mesa_initialize_context_for_api(GLcontext *ctx, } GLboolean -_mesa_initialize_context(GLcontext *ctx, +_mesa_initialize_context(struct gl_context *ctx, const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext) { @@ -1008,7 +1008,7 @@ _mesa_initialize_context(GLcontext *ctx, } /** - * Allocate and initialize a GLcontext structure. + * Allocate and initialize a struct gl_context structure. * Note that the driver needs to pass in its dd_function_table here since * we need to at least call driverFunctions->NewTextureObject to initialize * the rendering context. @@ -1020,21 +1020,21 @@ _mesa_initialize_context(GLcontext *ctx, * driver has plugged in all its special functions. * \param driverContext points to the device driver's private context state * - * \return pointer to a new __GLcontextRec or NULL if error. + * \return pointer to a new __struct gl_contextRec or NULL if error. */ -GLcontext * +struct gl_context * _mesa_create_context_for_api(gl_api api, const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext) { - GLcontext *ctx; + struct gl_context *ctx; ASSERT(visual); /*ASSERT(driverContext);*/ - ctx = (GLcontext *) calloc(1, sizeof(GLcontext)); + ctx = (struct gl_context *) calloc(1, sizeof(struct gl_context)); if (!ctx) return NULL; @@ -1048,9 +1048,9 @@ _mesa_create_context_for_api(gl_api api, } } -GLcontext * +struct gl_context * _mesa_create_context(const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext) { @@ -1063,12 +1063,12 @@ _mesa_create_context(const struct gl_config *visual, /** * Free the data associated with the given context. * - * But doesn't free the GLcontext struct itself. + * But doesn't free the struct gl_context struct itself. * * \sa _mesa_initialize_context() and init_attrib_groups(). */ void -_mesa_free_context_data( GLcontext *ctx ) +_mesa_free_context_data( struct gl_context *ctx ) { if (!_mesa_get_current_context()){ /* No current context, but we may need one in order to delete @@ -1142,14 +1142,14 @@ _mesa_free_context_data( GLcontext *ctx ) /** - * Destroy a GLcontext structure. + * Destroy a struct gl_context structure. * * \param ctx GL context. * - * Calls _mesa_free_context_data() and frees the GLcontext structure itself. + * Calls _mesa_free_context_data() and frees the struct gl_context structure itself. */ void -_mesa_destroy_context( GLcontext *ctx ) +_mesa_destroy_context( struct gl_context *ctx ) { if (ctx) { _mesa_free_context_data(ctx); @@ -1172,7 +1172,7 @@ _mesa_destroy_context( GLcontext *ctx ) * structures. */ void -_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) +_mesa_copy_context( const struct gl_context *src, struct gl_context *dst, GLuint mask ) { if (mask & GL_ACCUM_BUFFER_BIT) { /* OK to memcpy */ @@ -1291,7 +1291,7 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) * \return GL_TRUE if compatible, GL_FALSE otherwise. */ static GLboolean -check_compatible(const GLcontext *ctx, const struct gl_framebuffer *buffer) +check_compatible(const struct gl_context *ctx, const struct gl_framebuffer *buffer) { const struct gl_config *ctxvis = &ctx->Visual; const struct gl_config *bufvis = &buffer->Visual; @@ -1340,7 +1340,7 @@ check_compatible(const GLcontext *ctx, const struct gl_framebuffer *buffer) * Really, the device driver should totally take care of this. */ static void -initialize_framebuffer_size(GLcontext *ctx, struct gl_framebuffer *fb) +initialize_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb) { GLuint width, height; if (ctx->Driver.GetBufferSize) { @@ -1357,7 +1357,7 @@ initialize_framebuffer_size(GLcontext *ctx, struct gl_framebuffer *fb) * Initialize the size if the given width and height are non-zero. */ void -_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height) +_mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height) { if (!ctx->ViewportInitialized && width > 0 && height > 0) { /* Note: set flag here, before calling _mesa_set_viewport(), to prevent @@ -1385,7 +1385,7 @@ _mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height) * \param readBuffer the reading framebuffer */ GLboolean -_mesa_make_current( GLcontext *newCtx, struct gl_framebuffer *drawBuffer, +_mesa_make_current( struct gl_context *newCtx, struct gl_framebuffer *drawBuffer, struct gl_framebuffer *readBuffer ) { if (MESA_VERBOSE & VERBOSE_API) @@ -1524,7 +1524,7 @@ _mesa_make_current( GLcontext *newCtx, struct gl_framebuffer *drawBuffer, * be deleted if nobody else is sharing them. */ GLboolean -_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) +_mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare) { if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { struct gl_shared_state *oldSharedState = ctx->Shared; @@ -1555,10 +1555,10 @@ _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in * context.h. */ -GLcontext * +struct gl_context * _mesa_get_current_context( void ) { - return (GLcontext *) _glapi_get_context(); + return (struct gl_context *) _glapi_get_context(); } @@ -1572,10 +1572,10 @@ _mesa_get_current_context( void ) * * \return pointer to dispatch_table. * - * Simply returns __GLcontextRec::CurrentDispatch. + * Simply returns __struct gl_contextRec::CurrentDispatch. */ struct _glapi_table * -_mesa_get_dispatch(GLcontext *ctx) +_mesa_get_dispatch(struct gl_context *ctx) { return ctx->CurrentDispatch; } @@ -1601,7 +1601,7 @@ _mesa_get_dispatch(GLcontext *ctx) * This is called via _mesa_error(). */ void -_mesa_record_error(GLcontext *ctx, GLenum error) +_mesa_record_error(struct gl_context *ctx, GLenum error) { if (!ctx) return; @@ -1621,7 +1621,7 @@ _mesa_record_error(GLcontext *ctx, GLenum error) * Flush commands and wait for completion. */ void -_mesa_finish(GLcontext *ctx) +_mesa_finish(struct gl_context *ctx) { FLUSH_CURRENT( ctx, 0 ); if (ctx->Driver.Finish) { @@ -1634,7 +1634,7 @@ _mesa_finish(GLcontext *ctx) * Flush commands. */ void -_mesa_flush(GLcontext *ctx) +_mesa_flush(struct gl_context *ctx) { FLUSH_CURRENT( ctx, 0 ); if (ctx->Driver.Flush) { @@ -1680,7 +1680,7 @@ _mesa_Flush(void) * Otherwise we default to MUL/MAD. */ void -_mesa_set_mvp_with_dp4( GLcontext *ctx, +_mesa_set_mvp_with_dp4( struct gl_context *ctx, GLboolean flag ) { ctx->mvp_with_dp4 = flag; @@ -1696,7 +1696,7 @@ _mesa_set_mvp_with_dp4( GLcontext *ctx, * \return GL_TRUE if OK to render, GL_FALSE if not */ GLboolean -_mesa_valid_to_render(GLcontext *ctx, const char *where) +_mesa_valid_to_render(struct gl_context *ctx, const char *where) { bool vert_from_glsl_shader = false; bool geom_from_glsl_shader = false; diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index d89ae36a5c..42d98a33a8 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -29,7 +29,7 @@ * * There are three large Mesa data types/classes which are meant to be * used by device drivers: - * - GLcontext: this contains the Mesa rendering state + * - struct gl_context: this contains the Mesa rendering state * - struct gl_config: this describes the color buffer (RGB vs. ci), whether or not * there's a depth buffer, stencil buffer, etc. * - struct gl_framebuffer: contains pointers to the depth buffer, stencil buffer, @@ -38,7 +38,7 @@ * These types should be encapsulated by corresponding device driver * data types. See xmesa.h and xmesaP.h for an example. * - * In OOP terms, GLcontext, struct gl_config, and struct gl_framebuffer are base classes + * In OOP terms, struct gl_context, struct gl_config, and struct gl_framebuffer are base classes * which the device driver must derive from. * * The following functions create and destroy these data types. @@ -99,78 +99,78 @@ _mesa_destroy_visual( struct gl_config *vis ); /** \name Context-related functions */ /*@{*/ -extern GLcontext * +extern struct gl_context * _mesa_create_context( const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext ); extern GLboolean -_mesa_initialize_context( GLcontext *ctx, +_mesa_initialize_context( struct gl_context *ctx, const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext ); -extern GLcontext * +extern struct gl_context * _mesa_create_context_for_api(gl_api api, const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext); extern GLboolean -_mesa_initialize_context_for_api(GLcontext *ctx, +_mesa_initialize_context_for_api(struct gl_context *ctx, gl_api api, const struct gl_config *visual, - GLcontext *share_list, + struct gl_context *share_list, const struct dd_function_table *driverFunctions, void *driverContext); extern void -_mesa_free_context_data( GLcontext *ctx ); +_mesa_free_context_data( struct gl_context *ctx ); extern void -_mesa_destroy_context( GLcontext *ctx ); +_mesa_destroy_context( struct gl_context *ctx ); extern void -_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); +_mesa_copy_context(const struct gl_context *src, struct gl_context *dst, GLuint mask); extern void -_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height); +_mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height); extern GLboolean -_mesa_make_current( GLcontext *ctx, struct gl_framebuffer *drawBuffer, +_mesa_make_current( struct gl_context *ctx, struct gl_framebuffer *drawBuffer, struct gl_framebuffer *readBuffer ); extern GLboolean -_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare); +_mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare); -extern GLcontext * +extern struct gl_context * _mesa_get_current_context(void); /*@}*/ extern void -_mesa_init_get_hash(GLcontext *ctx); +_mesa_init_get_hash(struct gl_context *ctx); extern void -_mesa_notifySwapBuffers(GLcontext *gc); +_mesa_notifySwapBuffers(struct gl_context *gc); extern struct _glapi_table * -_mesa_get_dispatch(GLcontext *ctx); +_mesa_get_dispatch(struct gl_context *ctx); void -_mesa_set_mvp_with_dp4( GLcontext *ctx, +_mesa_set_mvp_with_dp4( struct gl_context *ctx, GLboolean flag ); extern GLboolean -_mesa_valid_to_render(GLcontext *ctx, const char *where); +_mesa_valid_to_render(struct gl_context *ctx, const char *where); @@ -178,14 +178,14 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where); /*@{*/ extern void -_mesa_record_error( GLcontext *ctx, GLenum error ); +_mesa_record_error( struct gl_context *ctx, GLenum error ); extern void -_mesa_finish(GLcontext *ctx); +_mesa_finish(struct gl_context *ctx); extern void -_mesa_flush(GLcontext *ctx); +_mesa_flush(struct gl_context *ctx); extern void GLAPIENTRY @@ -211,7 +211,7 @@ _mesa_Flush( void ); * * Checks if dd_function_table::NeedFlush is marked to flush stored vertices, * and calls dd_function_table::FlushVertices if so. Marks - * __GLcontextRec::NewState with \p newstate. + * __struct gl_contextRec::NewState with \p newstate. */ #define FLUSH_VERTICES(ctx, newstate) \ do { \ @@ -230,7 +230,7 @@ do { \ * * Checks if dd_function_table::NeedFlush is marked to flush current state, * and calls dd_function_table::FlushVertices if so. Marks - * __GLcontextRec::NewState with \p newstate. + * __struct gl_contextRec::NewState with \p newstate. */ #define FLUSH_CURRENT(ctx, newstate) \ do { \ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 01ad2903df..c9f0facdaf 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -70,7 +70,7 @@ struct dd_function_table { * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be * returned. */ - const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); + const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name ); /** * Notify the driver after Mesa has made some internal state changes. @@ -78,7 +78,7 @@ struct dd_function_table { * This is in addition to any state change callbacks Mesa may already have * made. */ - void (*UpdateState)( GLcontext *ctx, GLbitfield new_state ); + void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state ); /** * Get the width and height of the named buffer/window. @@ -93,42 +93,42 @@ struct dd_function_table { * Resize the given framebuffer to the given size. * XXX OBSOLETE: this function will be removed in the future. */ - void (*ResizeBuffers)( GLcontext *ctx, struct gl_framebuffer *fb, + void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height); /** * Called whenever an error is generated. - * __GLcontextRec::ErrorValue contains the error value. + * __struct gl_contextRec::ErrorValue contains the error value. */ - void (*Error)( GLcontext *ctx ); + void (*Error)( struct gl_context *ctx ); /** * This is called whenever glFinish() is called. */ - void (*Finish)( GLcontext *ctx ); + void (*Finish)( struct gl_context *ctx ); /** * This is called whenever glFlush() is called. */ - void (*Flush)( GLcontext *ctx ); + void (*Flush)( struct gl_context *ctx ); /** * Clear the color/depth/stencil/accum buffer(s). * \param buffers a bitmask of BUFFER_BIT_* flags indicating which * renderbuffers need to be cleared. */ - void (*Clear)( GLcontext *ctx, GLbitfield buffers ); + void (*Clear)( struct gl_context *ctx, GLbitfield buffers ); /** * Execute glAccum command. */ - void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value ); + void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value ); /** * Execute glRasterPos, updating the ctx->Current.Raster fields */ - void (*RasterPos)( GLcontext *ctx, const GLfloat v[4] ); + void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] ); /** * \name Image-related functions @@ -139,7 +139,7 @@ struct dd_function_table { * Called by glDrawPixels(). * \p unpack describes how to unpack the source image data. */ - void (*DrawPixels)( GLcontext *ctx, + void (*DrawPixels)( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -148,7 +148,7 @@ struct dd_function_table { /** * Called by glReadPixels(). */ - void (*ReadPixels)( GLcontext *ctx, + void (*ReadPixels)( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -157,14 +157,14 @@ struct dd_function_table { /** * Called by glCopyPixels(). */ - void (*CopyPixels)( GLcontext *ctx, GLint srcx, GLint srcy, + void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type ); /** * Called by glBitmap(). */ - void (*Bitmap)( GLcontext *ctx, + void (*Bitmap)( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); @@ -183,7 +183,7 @@ struct dd_function_table { * functions. The driver should examine \p internalFormat and return a * gl_format value. */ - GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat, + GLuint (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ); /** @@ -203,7 +203,7 @@ struct dd_function_table { * * Drivers should call a fallback routine from texstore.c if needed. */ - void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, + void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -216,7 +216,7 @@ struct dd_function_table { * * \sa dd_function_table::TexImage1D. */ - void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, + void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -229,7 +229,7 @@ struct dd_function_table { * * \sa dd_function_table::TexImage1D. */ - void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, + void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -258,7 +258,7 @@ struct dd_function_table { * * The driver should use a fallback routine from texstore.c if needed. */ - void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + void (*TexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -271,7 +271,7 @@ struct dd_function_table { * * \sa dd_function_table::TexSubImage1D. */ - void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + void (*TexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -285,7 +285,7 @@ struct dd_function_table { * * \sa dd_function_table::TexSubImage1D. */ - void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + void (*TexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLint depth, GLenum format, GLenum type, @@ -297,7 +297,7 @@ struct dd_function_table { /** * Called by glGetTexImage(). */ - void (*GetTexImage)( GLcontext *ctx, GLenum target, GLint level, + void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); @@ -307,7 +307,7 @@ struct dd_function_table { * * Drivers should use a fallback routine from texstore.c if needed. */ - void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, + void (*CopyTexImage1D)( struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border ); @@ -316,7 +316,7 @@ struct dd_function_table { * * Drivers should use a fallback routine from texstore.c if needed. */ - void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level, + void (*CopyTexImage2D)( struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); @@ -325,7 +325,7 @@ struct dd_function_table { * * Drivers should use a fallback routine from texstore.c if needed. */ - void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); /** @@ -333,7 +333,7 @@ struct dd_function_table { * * Drivers should use a fallback routine from texstore.c if needed. */ - void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); @@ -342,7 +342,7 @@ struct dd_function_table { * * Drivers should use a fallback routine from texstore.c if needed. */ - void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); @@ -350,7 +350,7 @@ struct dd_function_table { /** * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. */ - void (*GenerateMipmap)(GLcontext *ctx, GLenum target, + void (*GenerateMipmap)(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); /** @@ -359,7 +359,7 @@ struct dd_function_table { * * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails. */ - GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target, + GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, @@ -387,7 +387,7 @@ struct dd_function_table { * \a retainInternalCopy is returned by this function and indicates whether * core Mesa should keep an internal copy of the texture image. */ - void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, + void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data, @@ -398,7 +398,7 @@ struct dd_function_table { * * \sa dd_function_table::CompressedTexImage1D. */ - void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, + void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -409,7 +409,7 @@ struct dd_function_table { * * \sa dd_function_table::CompressedTexImage3D. */ - void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, + void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, @@ -434,7 +434,7 @@ struct dd_function_table { * \param texImage is the target texture image. It will have the texture \p * width, \p height, \p depth, \p border and \p internalFormat information. */ - void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level, + void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, @@ -445,7 +445,7 @@ struct dd_function_table { * * \sa dd_function_table::CompressedTexImage3D. */ - void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level, + void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, @@ -457,7 +457,7 @@ struct dd_function_table { * * \sa dd_function_table::CompressedTexImage3D. */ - void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level, + void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLint height, GLint depth, GLenum format, @@ -469,7 +469,7 @@ struct dd_function_table { /** * Called by glGetCompressedTexImage. */ - void (*GetCompressedTexImage)(GLcontext *ctx, GLenum target, GLint level, + void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint level, GLvoid *img, struct gl_texture_object *texObj, struct gl_texture_image *texImage); @@ -484,7 +484,7 @@ struct dd_function_table { /** * Called by glBindTexture(). */ - void (*BindTexture)( GLcontext *ctx, GLenum target, + void (*BindTexture)( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ); /** @@ -492,7 +492,7 @@ struct dd_function_table { * A new gl_texture_object should be returned. The driver should * attach to it any device-specific info it needs. */ - struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name, + struct gl_texture_object * (*NewTextureObject)( struct gl_context *ctx, GLuint name, GLenum target ); /** * Called when a texture object is about to be deallocated. @@ -500,22 +500,22 @@ struct dd_function_table { * Driver should delete the gl_texture_object object and anything * hanging off of it. */ - void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); + void (*DeleteTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); /** * Called to allocate a new texture image object. */ - struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx ); + struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx ); /** * Called to free tImage->Data. */ - void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage ); + void (*FreeTexImageData)( struct gl_context *ctx, struct gl_texture_image *tImage ); /** Map texture image data into user space */ - void (*MapTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); + void (*MapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); /** Unmap texture images from user space */ - void (*UnmapTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); + void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); /** * Note: no context argument. This function doesn't initially look @@ -533,7 +533,7 @@ struct dd_function_table { /** * Called by glAreTextureResident(). */ - GLboolean (*IsTextureResident)( GLcontext *ctx, + GLboolean (*IsTextureResident)( struct gl_context *ctx, struct gl_texture_object *t ); /** @@ -542,7 +542,7 @@ struct dd_function_table { * If \p tObj is NULL then the shared texture palette * gl_texture_object::Palette is to be updated. */ - void (*UpdateTexturePalette)( GLcontext *ctx, + void (*UpdateTexturePalette)( struct gl_context *ctx, struct gl_texture_object *tObj ); /*@}*/ @@ -551,11 +551,11 @@ struct dd_function_table { * \name Imaging functionality */ /*@{*/ - void (*CopyColorTable)( GLcontext *ctx, + void (*CopyColorTable)( struct gl_context *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width ); - void (*CopyColorSubTable)( GLcontext *ctx, + void (*CopyColorSubTable)( struct gl_context *ctx, GLenum target, GLsizei start, GLint x, GLint y, GLsizei width ); /*@}*/ @@ -566,21 +566,21 @@ struct dd_function_table { */ /*@{*/ /** Bind a vertex/fragment program */ - void (*BindProgram)(GLcontext *ctx, GLenum target, struct gl_program *prog); + void (*BindProgram)(struct gl_context *ctx, GLenum target, struct gl_program *prog); /** Allocate a new program */ - struct gl_program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id); + struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id); /** Delete a program */ - void (*DeleteProgram)(GLcontext *ctx, struct gl_program *prog); + void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog); /** * Notify driver that a program string (and GPU code) has been specified * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is * supported by the driver. */ - GLboolean (*ProgramStringNotify)(GLcontext *ctx, GLenum target, + GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target, struct gl_program *prog); /** Query if program can be loaded onto hardware */ - GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, + GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target, struct gl_program *prog); /*@}*/ @@ -597,14 +597,14 @@ struct dd_function_table { * have CompileShader() called, so if lowering passes are done they * need to also be performed in LinkShader(). */ - GLboolean (*CompileShader)(GLcontext *ctx, struct gl_shader *shader); + GLboolean (*CompileShader)(struct gl_context *ctx, struct gl_shader *shader); /** * Called when a shader program is linked. * * This gives drivers an opportunity to clone the IR and make their * own transformations on it for the purposes of code generation. */ - GLboolean (*LinkShader)(GLcontext *ctx, struct gl_shader_program *shader); + GLboolean (*LinkShader)(struct gl_context *ctx, struct gl_shader_program *shader); /*@}*/ /** @@ -618,102 +618,102 @@ struct dd_function_table { */ /*@{*/ /** Specify the alpha test function */ - void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref); + void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref); /** Set the blend color */ - void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]); + void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]); /** Set the blend equation */ - void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA); + void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA); /** Specify pixel arithmetic */ - void (*BlendFuncSeparate)(GLcontext *ctx, + void (*BlendFuncSeparate)(struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA); /** Specify clear values for the color buffers */ - void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]); + void (*ClearColor)(struct gl_context *ctx, const GLfloat color[4]); /** Specify the clear value for the depth buffer */ - void (*ClearDepth)(GLcontext *ctx, GLclampd d); + void (*ClearDepth)(struct gl_context *ctx, GLclampd d); /** Specify the clear value for the stencil buffer */ - void (*ClearStencil)(GLcontext *ctx, GLint s); + void (*ClearStencil)(struct gl_context *ctx, GLint s); /** Specify a plane against which all geometry is clipped */ - void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation ); + void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation ); /** Enable and disable writing of frame buffer color components */ - void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask, + void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask ); - void (*ColorMaskIndexed)(GLcontext *ctx, GLuint buf, GLboolean rmask, + void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask); /** Cause a material color to track the current color */ - void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode); + void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode); /** Specify whether front- or back-facing facets can be culled */ - void (*CullFace)(GLcontext *ctx, GLenum mode); + void (*CullFace)(struct gl_context *ctx, GLenum mode); /** Define front- and back-facing polygons */ - void (*FrontFace)(GLcontext *ctx, GLenum mode); + void (*FrontFace)(struct gl_context *ctx, GLenum mode); /** Specify the value used for depth buffer comparisons */ - void (*DepthFunc)(GLcontext *ctx, GLenum func); + void (*DepthFunc)(struct gl_context *ctx, GLenum func); /** Enable or disable writing into the depth buffer */ - void (*DepthMask)(GLcontext *ctx, GLboolean flag); + void (*DepthMask)(struct gl_context *ctx, GLboolean flag); /** Specify mapping of depth values from NDC to window coordinates */ - void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval); + void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval); /** Specify the current buffer for writing */ - void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); + void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer ); /** Specify the buffers for writing for fragment programs*/ - void (*DrawBuffers)( GLcontext *ctx, GLsizei n, const GLenum *buffers ); + void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers ); /** Enable or disable server-side gl capabilities */ - void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state); + void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state); /** Specify fog parameters */ - void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); + void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); /** Specify implementation-specific hints */ - void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode); + void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode); /** Set light source parameters. * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already * been transformed to eye-space. */ - void (*Lightfv)(GLcontext *ctx, GLenum light, + void (*Lightfv)(struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params ); /** Set the lighting model parameters */ - void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); + void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); /** Specify the line stipple pattern */ - void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); + void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern ); /** Specify the width of rasterized lines */ - void (*LineWidth)(GLcontext *ctx, GLfloat width); + void (*LineWidth)(struct gl_context *ctx, GLfloat width); /** Specify a logical pixel operation for color index rendering */ - void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); - void (*PointParameterfv)(GLcontext *ctx, GLenum pname, + void (*LogicOpcode)(struct gl_context *ctx, GLenum opcode); + void (*PointParameterfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); /** Specify the diameter of rasterized points */ - void (*PointSize)(GLcontext *ctx, GLfloat size); + void (*PointSize)(struct gl_context *ctx, GLfloat size); /** Select a polygon rasterization mode */ - void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); + void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode); /** Set the scale and units used to calculate depth values */ - void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units); + void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units); /** Set the polygon stippling pattern */ - void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); + void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask ); /* Specifies the current buffer for reading */ - void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); + void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer ); /** Set rasterization mode */ - void (*RenderMode)(GLcontext *ctx, GLenum mode ); + void (*RenderMode)(struct gl_context *ctx, GLenum mode ); /** Define the scissor box */ - void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); /** Select flat or smooth shading */ - void (*ShadeModel)(GLcontext *ctx, GLenum mode); + void (*ShadeModel)(struct gl_context *ctx, GLenum mode); /** OpenGL 2.0 two-sided StencilFunc */ - void (*StencilFuncSeparate)(GLcontext *ctx, GLenum face, GLenum func, + void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask); /** OpenGL 2.0 two-sided StencilMask */ - void (*StencilMaskSeparate)(GLcontext *ctx, GLenum face, GLuint mask); + void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask); /** OpenGL 2.0 two-sided StencilOp */ - void (*StencilOpSeparate)(GLcontext *ctx, GLenum face, GLenum fail, + void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /** Control the generation of texture coordinates */ - void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname, + void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params); /** Set texture environment parameters */ - void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, + void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param); /** Set texture parameters */ - void (*TexParameter)(GLcontext *ctx, GLenum target, + void (*TexParameter)(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params); /** Set the viewport */ - void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); /*@}*/ @@ -721,30 +721,30 @@ struct dd_function_table { * \name Vertex/pixel buffer object functions */ /*@{*/ - void (*BindBuffer)( GLcontext *ctx, GLenum target, + void (*BindBuffer)( struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj ); - struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer, + struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer, GLenum target ); - void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj ); + void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj ); - GLboolean (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size, + GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *obj ); - void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset, + void (*BufferSubData)( struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, struct gl_buffer_object *obj ); - void (*GetBufferSubData)( GLcontext *ctx, GLenum target, + void (*GetBufferSubData)( struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data, struct gl_buffer_object *obj ); - void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access, + void * (*MapBuffer)( struct gl_context *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj ); - void (*CopyBufferSubData)( GLcontext *ctx, + void (*CopyBufferSubData)( struct gl_context *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, GLintptr readOffset, GLintptr writeOffset, @@ -752,15 +752,15 @@ struct dd_function_table { /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access: */ - void * (*MapBufferRange)( GLcontext *ctx, GLenum target, GLintptr offset, + void * (*MapBufferRange)( struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *obj); - void (*FlushMappedBufferRange)(GLcontext *ctx, GLenum target, + void (*FlushMappedBufferRange)(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj); - GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, + GLboolean (*UnmapBuffer)( struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj ); /*@}*/ @@ -769,38 +769,38 @@ struct dd_function_table { */ /*@{*/ /* variations on ObjectPurgeable */ - GLenum (*BufferObjectPurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectPurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectPurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); + GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); + GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); + GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); /* variations on ObjectUnpurgeable */ - GLenum (*BufferObjectUnpurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectUnpurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectUnpurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); + GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); + GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); + GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); /*@}*/ /** * \name Functions for GL_EXT_framebuffer_{object,blit}. */ /*@{*/ - struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); - struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); - void (*BindFramebuffer)(GLcontext *ctx, GLenum target, + struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name); + struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, GLuint name); + void (*BindFramebuffer)(struct gl_context *ctx, GLenum target, struct gl_framebuffer *drawFb, struct gl_framebuffer *readFb); - void (*FramebufferRenderbuffer)(GLcontext *ctx, + void (*FramebufferRenderbuffer)(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb); - void (*RenderTexture)(GLcontext *ctx, + void (*RenderTexture)(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att); - void (*FinishRenderTexture)(GLcontext *ctx, + void (*FinishRenderTexture)(struct gl_context *ctx, struct gl_renderbuffer_attachment *att); - void (*ValidateFramebuffer)(GLcontext *ctx, + void (*ValidateFramebuffer)(struct gl_context *ctx, struct gl_framebuffer *fb); /*@}*/ - void (*BlitFramebuffer)(GLcontext *ctx, + void (*BlitFramebuffer)(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); @@ -809,12 +809,12 @@ struct dd_function_table { * \name Query objects */ /*@{*/ - struct gl_query_object * (*NewQueryObject)(GLcontext *ctx, GLuint id); - void (*DeleteQuery)(GLcontext *ctx, struct gl_query_object *q); - void (*BeginQuery)(GLcontext *ctx, struct gl_query_object *q); - void (*EndQuery)(GLcontext *ctx, struct gl_query_object *q); - void (*CheckQuery)(GLcontext *ctx, struct gl_query_object *q); - void (*WaitQuery)(GLcontext *ctx, struct gl_query_object *q); + struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id); + void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q); /*@}*/ @@ -822,21 +822,21 @@ struct dd_function_table { * \name Vertex Array objects */ /*@{*/ - struct gl_array_object * (*NewArrayObject)(GLcontext *ctx, GLuint id); - void (*DeleteArrayObject)(GLcontext *ctx, struct gl_array_object *obj); - void (*BindArrayObject)(GLcontext *ctx, struct gl_array_object *obj); + struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id); + void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); + void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); /*@}*/ /** * \name GLSL-related functions (ARB extensions and OpenGL 2.x) */ /*@{*/ - struct gl_shader *(*NewShader)(GLcontext *ctx, GLuint name, GLenum type); - void (*DeleteShader)(GLcontext *ctx, struct gl_shader *shader); - struct gl_shader_program *(*NewShaderProgram)(GLcontext *ctx, GLuint name); - void (*DeleteShaderProgram)(GLcontext *ctx, + struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type); + void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader); + struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, GLuint name); + void (*DeleteShaderProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); - void (*UseProgram)(GLcontext *ctx, struct gl_shader_program *shProg); + void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); /*@}*/ @@ -862,7 +862,7 @@ struct dd_function_table { * This must be non-NULL if a driver installs a custom T&L module and sets * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise. */ - void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state ); + void (*ValidateTnlModule)( struct gl_context *ctx, GLuint new_state ); #define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1) @@ -889,7 +889,7 @@ struct dd_function_table { #define FLUSH_UPDATE_CURRENT 0x2 /** * Set by the driver-supplied T&L engine whenever vertices are buffered - * between glBegin()/glEnd() objects or __GLcontextRec::Current is not + * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not * updated. * * The dd_function_table::FlushVertices call below may be used to resolve @@ -902,32 +902,32 @@ struct dd_function_table { /* Called prior to any of the GLvertexformat functions being * called. Paired with Driver.FlushVertices(). */ - void (*BeginVertices)( GLcontext *ctx ); + void (*BeginVertices)( struct gl_context *ctx ); /** * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered * vertices, if FLUSH_UPDATE_CURRENT bit is set updates - * __GLcontextRec::Current and gl_light_attrib::Material + * __struct gl_contextRec::Current and gl_light_attrib::Material * * Note that the default T&L engine never clears the * FLUSH_UPDATE_CURRENT bit, even after performing the update. */ - void (*FlushVertices)( GLcontext *ctx, GLuint flags ); - void (*SaveFlushVertices)( GLcontext *ctx ); + void (*FlushVertices)( struct gl_context *ctx, GLuint flags ); + void (*SaveFlushVertices)( struct gl_context *ctx ); /** * Give the driver the opportunity to hook in its own vtxfmt for * compiling optimized display lists. This is called on each valid * glBegin() during list compilation. */ - GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode ); + GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode ); /** * Notify driver that the special derived value _NeedEyeCoords has * changed. */ - void (*LightingSpaceChange)( GLcontext *ctx ); + void (*LightingSpaceChange)( struct gl_context *ctx ); /** * Called by glNewList(). @@ -935,64 +935,64 @@ struct dd_function_table { * Let the T&L component know what is going on with display lists * in time to make changes to dispatch tables, etc. */ - void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode ); + void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode ); /** * Called by glEndList(). * * \sa dd_function_table::NewList. */ - void (*EndList)( GLcontext *ctx ); + void (*EndList)( struct gl_context *ctx ); /** * Called by glCallList(s). * * Notify the T&L component before and after calling a display list. */ - void (*BeginCallList)( GLcontext *ctx, + void (*BeginCallList)( struct gl_context *ctx, struct gl_display_list *dlist ); /** * Called by glEndCallList(). * * \sa dd_function_table::BeginCallList. */ - void (*EndCallList)( GLcontext *ctx ); + void (*EndCallList)( struct gl_context *ctx ); /** * \name GL_ARB_sync interfaces */ /*@{*/ - struct gl_sync_object * (*NewSyncObject)(GLcontext *, GLenum); - void (*FenceSync)(GLcontext *, struct gl_sync_object *, GLenum, GLbitfield); - void (*DeleteSyncObject)(GLcontext *, struct gl_sync_object *); - void (*CheckSync)(GLcontext *, struct gl_sync_object *); - void (*ClientWaitSync)(GLcontext *, struct gl_sync_object *, + struct gl_sync_object * (*NewSyncObject)(struct gl_context *, GLenum); + void (*FenceSync)(struct gl_context *, struct gl_sync_object *, GLenum, GLbitfield); + void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *); + void (*CheckSync)(struct gl_context *, struct gl_sync_object *); + void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *, GLbitfield, GLuint64); - void (*ServerWaitSync)(GLcontext *, struct gl_sync_object *, + void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *, GLbitfield, GLuint64); /*@}*/ /** GL_NV_conditional_render */ - void (*BeginConditionalRender)(GLcontext *ctx, struct gl_query_object *q, + void (*BeginConditionalRender)(struct gl_context *ctx, struct gl_query_object *q, GLenum mode); - void (*EndConditionalRender)(GLcontext *ctx, struct gl_query_object *q); + void (*EndConditionalRender)(struct gl_context *ctx, struct gl_query_object *q); /** * \name GL_OES_draw_texture interface */ /*@{*/ - void (*DrawTex)(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, + void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); /*@}*/ /** * \name GL_OES_EGL_image interface */ - void (*EGLImageTargetTexture2D)(GLcontext *ctx, GLenum target, + void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLeglImageOES image_handle); - void (*EGLImageTargetRenderbufferStorage)(GLcontext *ctx, + void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx, struct gl_renderbuffer *rb, void *image_handle); @@ -1000,18 +1000,18 @@ struct dd_function_table { * \name GL_EXT_transform_feedback interface */ struct gl_transform_feedback_object * - (*NewTransformFeedback)(GLcontext *ctx, GLuint name); - void (*DeleteTransformFeedback)(GLcontext *ctx, + (*NewTransformFeedback)(struct gl_context *ctx, GLuint name); + void (*DeleteTransformFeedback)(struct gl_context *ctx, struct gl_transform_feedback_object *obj); - void (*BeginTransformFeedback)(GLcontext *ctx, GLenum mode, + void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj); - void (*EndTransformFeedback)(GLcontext *ctx, + void (*EndTransformFeedback)(struct gl_context *ctx, struct gl_transform_feedback_object *obj); - void (*PauseTransformFeedback)(GLcontext *ctx, + void (*PauseTransformFeedback)(struct gl_context *ctx, struct gl_transform_feedback_object *obj); - void (*ResumeTransformFeedback)(GLcontext *ctx, + void (*ResumeTransformFeedback)(struct gl_context *ctx, struct gl_transform_feedback_object *obj); - void (*DrawTransformFeedback)(GLcontext *ctx, GLenum mode, + void (*DrawTransformFeedback)(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj); }; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 4205c7a4b7..a7e65f8d3a 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -233,7 +233,7 @@ static void add_debug_flags( const char *debug ) void -_mesa_init_debug( GLcontext *ctx ) +_mesa_init_debug( struct gl_context *ctx ) { char *c; @@ -578,7 +578,7 @@ _mesa_dump_stencil_buffer(const char *filename) * Quick and dirty function to "print" a texture to stdout. */ void -_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img) +_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img) { #if CHAN_TYPE != GL_UNSIGNED_BYTE _mesa_problem(NULL, "PrintTexture not supported"); diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index b517cc8259..e3bb4dfe81 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -45,7 +45,7 @@ extern void _mesa_print_tri_caps( const char *name, GLuint flags ); extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); extern void _mesa_print_state( const char *msg, GLuint state ); extern void _mesa_print_info( void ); -extern void _mesa_init_debug( GLcontext *ctx ); +extern void _mesa_init_debug( struct gl_context *ctx ); #else @@ -79,6 +79,6 @@ extern void _mesa_dump_stencil_buffer(const char *filename); extern void -_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img); +_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img); #endif diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index f187205b97..c5a910e144 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -153,7 +153,7 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) * Initialize the depth buffer attribute group in the given context. */ void -_mesa_init_depth(GLcontext *ctx) +_mesa_init_depth(struct gl_context *ctx) { ctx->Depth.Test = GL_FALSE; ctx->Depth.Clear = 1.0; diff --git a/src/mesa/main/depth.h b/src/mesa/main/depth.h index dcc0b4637a..d61d3b121b 100644 --- a/src/mesa/main/depth.h +++ b/src/mesa/main/depth.h @@ -50,7 +50,7 @@ extern void GLAPIENTRY _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); extern void -_mesa_init_depth( GLcontext * ctx ); +_mesa_init_depth( struct gl_context * ctx ); #else diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index dbaa841645..c5466dc9fc 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -46,7 +46,7 @@ static void * -nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) +nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { (void) ctx; (void) rb; @@ -73,7 +73,7 @@ delete_wrapper(struct gl_renderbuffer *rb) * Realloc storage for wrapper. */ static GLboolean -alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +alloc_wrapper_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { /* just pass this on to the wrapped renderbuffer */ @@ -103,7 +103,7 @@ alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb, */ static void -get_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, +get_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count, GLint x, GLint y, void *values) { struct gl_renderbuffer *dsrb = z24rb->Wrapped; @@ -130,7 +130,7 @@ get_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, } static void -get_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, +get_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count, const GLint x[], const GLint y[], void *values) { struct gl_renderbuffer *dsrb = z24rb->Wrapped; @@ -155,7 +155,7 @@ get_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, } static void -put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, +put_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { struct gl_renderbuffer *dsrb = z24rb->Wrapped; @@ -206,7 +206,7 @@ put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, } static void -put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, +put_mono_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { struct gl_renderbuffer *dsrb = z24rb->Wrapped; @@ -260,7 +260,7 @@ put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, } static void -put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, +put_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -313,7 +313,7 @@ put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, } static void -put_mono_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, +put_mono_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -348,7 +348,7 @@ put_mono_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, * \return new depth renderbuffer */ struct gl_renderbuffer * -_mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, +_mesa_new_z24_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb) { struct gl_renderbuffer *z24rb; @@ -396,7 +396,7 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, */ static void -get_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, +get_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count, GLint x, GLint y, void *values) { struct gl_renderbuffer *dsrb = s8rb->Wrapped; @@ -423,7 +423,7 @@ get_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, } static void -get_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, +get_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count, const GLint x[], const GLint y[], void *values) { struct gl_renderbuffer *dsrb = s8rb->Wrapped; @@ -448,7 +448,7 @@ get_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, } static void -put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, +put_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { struct gl_renderbuffer *dsrb = s8rb->Wrapped; @@ -499,7 +499,7 @@ put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, } static void -put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, +put_mono_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { struct gl_renderbuffer *dsrb = s8rb->Wrapped; @@ -550,7 +550,7 @@ put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, } static void -put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, +put_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -603,7 +603,7 @@ put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, } static void -put_mono_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, +put_mono_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -637,7 +637,7 @@ put_mono_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, * \return new stencil renderbuffer */ struct gl_renderbuffer * -_mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) +_mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb) { struct gl_renderbuffer *s8rb; @@ -698,7 +698,7 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) * (either 8-bit or 32-bit) */ void -_mesa_extract_stencil(GLcontext *ctx, +_mesa_extract_stencil(struct gl_context *ctx, struct gl_renderbuffer *dsRb, struct gl_renderbuffer *stencilRb) { @@ -747,7 +747,7 @@ _mesa_extract_stencil(GLcontext *ctx, * \param stencilRb the source stencil buffer (either 8-bit or 32-bit) */ void -_mesa_insert_stencil(GLcontext *ctx, +_mesa_insert_stencil(struct gl_context *ctx, struct gl_renderbuffer *dsRb, struct gl_renderbuffer *stencilRb) { @@ -803,7 +803,7 @@ _mesa_insert_stencil(GLcontext *ctx, * \param stencilRb the stencil renderbuffer to promote */ void -_mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb) +_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb) { const GLsizei width = stencilRb->Width; const GLsizei height = stencilRb->Height; diff --git a/src/mesa/main/depthstencil.h b/src/mesa/main/depthstencil.h index afbac77f0e..4db5868263 100644 --- a/src/mesa/main/depthstencil.h +++ b/src/mesa/main/depthstencil.h @@ -29,29 +29,29 @@ #include "mtypes.h" extern struct gl_renderbuffer * -_mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, +_mesa_new_z24_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb); extern struct gl_renderbuffer * -_mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, +_mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb); extern void -_mesa_extract_stencil(GLcontext *ctx, +_mesa_extract_stencil(struct gl_context *ctx, struct gl_renderbuffer *dsRb, struct gl_renderbuffer *stencilRb); extern void -_mesa_insert_stencil(GLcontext *ctx, +_mesa_insert_stencil(struct gl_context *ctx, struct gl_renderbuffer *dsRb, struct gl_renderbuffer *stencilRb); extern void -_mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb); +_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb); #endif /* DEPTHSTENCIL_H */ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cccec24853..f513f31c56 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -77,9 +77,9 @@ struct gl_list_instruction { GLuint Size; - void (*Execute)( GLcontext *ctx, void *data ); - void (*Destroy)( GLcontext *ctx, void *data ); - void (*Print)( GLcontext *ctx, void *data ); + void (*Execute)( struct gl_context *ctx, void *data ); + void (*Destroy)( struct gl_context *ctx, void *data ); + void (*Print)( struct gl_context *ctx, void *data ); }; @@ -496,7 +496,7 @@ make_list(GLuint name, GLuint count) * Lookup function to just encapsulate casting. */ static INLINE struct gl_display_list * -lookup_list(GLcontext *ctx, GLuint list) +lookup_list(struct gl_context *ctx, GLuint list) { return (struct gl_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); @@ -513,7 +513,7 @@ is_ext_opcode(OpCode opcode) /** Destroy an extended opcode instruction */ static GLint -ext_opcode_destroy(GLcontext *ctx, Node *node) +ext_opcode_destroy(struct gl_context *ctx, Node *node) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; @@ -525,7 +525,7 @@ ext_opcode_destroy(GLcontext *ctx, Node *node) /** Execute an extended opcode instruction */ static GLint -ext_opcode_execute(GLcontext *ctx, Node *node) +ext_opcode_execute(struct gl_context *ctx, Node *node) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; @@ -537,7 +537,7 @@ ext_opcode_execute(GLcontext *ctx, Node *node) /** Print an extended opcode instruction */ static GLint -ext_opcode_print(GLcontext *ctx, Node *node) +ext_opcode_print(struct gl_context *ctx, Node *node) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; @@ -552,7 +552,7 @@ ext_opcode_print(GLcontext *ctx, Node *node) * \param dlist - display list pointer */ void -_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) +_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) { Node *n, *block; GLboolean done; @@ -730,7 +730,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) * \param list - display list number */ static void -destroy_list(GLcontext *ctx, GLuint list) +destroy_list(struct gl_context *ctx, GLuint list) { struct gl_display_list *dlist; @@ -814,7 +814,7 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list) * If we run out of memory, GL_OUT_OF_MEMORY will be recorded. */ static GLvoid * -unpack_image(GLcontext *ctx, GLuint dimensions, +unpack_image(struct gl_context *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels, const struct gl_pixelstore_attrib *unpack) @@ -866,7 +866,7 @@ unpack_image(GLcontext *ctx, GLuint dimensions, * \return pointer to allocated memory (the opcode space) */ static Node * -dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) +dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes) { const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node); Node *n; @@ -917,7 +917,7 @@ dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) * opcode). */ void * -_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) +_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes) { Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes); if (n) @@ -938,11 +938,11 @@ _mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) * \return the new opcode number or -1 if error */ GLint -_mesa_dlist_alloc_opcode(GLcontext *ctx, +_mesa_dlist_alloc_opcode(struct gl_context *ctx, GLuint size, - void (*execute) (GLcontext *, void *), - void (*destroy) (GLcontext *, void *), - void (*print) (GLcontext *, void *)) + void (*execute) (struct gl_context *, void *), + void (*destroy) (struct gl_context *, void *), + void (*print) (struct gl_context *, void *)) { if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) { const GLuint i = ctx->ListExt->NumOpcodes++; @@ -967,7 +967,7 @@ _mesa_dlist_alloc_opcode(GLcontext *ctx, * \return pointer to start of instruction space */ static INLINE Node * -alloc_instruction(GLcontext *ctx, OpCode opcode, GLuint nparams) +alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams) { return dlist_alloc(ctx, opcode, nparams * sizeof(Node)); } @@ -1132,7 +1132,7 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) } } -static void invalidate_saved_current_state( GLcontext *ctx ) +static void invalidate_saved_current_state( struct gl_context *ctx ) { GLint i; @@ -6795,7 +6795,7 @@ save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, * command that provoked the error. I don't see this as a problem. */ static void -save_error(GLcontext *ctx, GLenum error, const char *s) +save_error(struct gl_context *ctx, GLenum error, const char *s) { Node *n; n = alloc_instruction(ctx, OPCODE_ERROR, 2); @@ -6810,7 +6810,7 @@ save_error(GLcontext *ctx, GLenum error, const char *s) * Compile an error into current display list. */ void -_mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) +_mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s) { if (ctx->CompileFlag) save_error(ctx, error, s); @@ -6823,7 +6823,7 @@ _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) * Test if ID names a display list. */ static GLboolean -islist(GLcontext *ctx, GLuint list) +islist(struct gl_context *ctx, GLuint list) { if (list > 0 && lookup_list(ctx, list)) { return GL_TRUE; @@ -6847,7 +6847,7 @@ islist(GLcontext *ctx, GLuint list) * \param list - display list number */ static void -execute_list(GLcontext *ctx, GLuint list) +execute_list(struct gl_context *ctx, GLuint list) { struct gl_display_list *dlist; Node *n; @@ -9577,7 +9577,7 @@ enum_string(GLenum k) * TODO: many commands aren't handled yet. */ static void GLAPIENTRY -print_list(GLcontext *ctx, GLuint list) +print_list(struct gl_context *ctx, GLuint list) { struct gl_display_list *dlist; Node *n; @@ -9969,7 +9969,7 @@ void _mesa_init_dlist_dispatch(struct _glapi_table *disp) * Initialize display list state for given context. */ void -_mesa_init_display_list(GLcontext *ctx) +_mesa_init_display_list(struct gl_context *ctx) { static GLboolean tableInitialized = GL_FALSE; @@ -9999,7 +9999,7 @@ _mesa_init_display_list(GLcontext *ctx) void -_mesa_free_display_list_data(GLcontext *ctx) +_mesa_free_display_list_data(struct gl_context *ctx) { free(ctx->ListExt); ctx->ListExt = NULL; diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index 86bb132e56..24241a4bd4 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -49,16 +49,16 @@ extern void GLAPIENTRY _mesa_CallList( GLuint list ); extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); -extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); +extern void _mesa_compile_error( struct gl_context *ctx, GLenum error, const char *s ); -extern void *_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint sz); +extern void *_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint sz); -extern GLint _mesa_dlist_alloc_opcode( GLcontext *ctx, GLuint sz, - void (*execute)( GLcontext *, void * ), - void (*destroy)( GLcontext *, void * ), - void (*print)( GLcontext *, void * ) ); +extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz, + void (*execute)( struct gl_context *, void * ), + void (*destroy)( struct gl_context *, void * ), + void (*print)( struct gl_context *, void * ) ); -extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); +extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist); extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); @@ -76,7 +76,7 @@ extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp); #define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0) static INLINE void -_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) +_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) { /* there should be no list to delete */ ASSERT_NO_FEATURE(); @@ -95,9 +95,9 @@ _mesa_init_dlist_dispatch(struct _glapi_table *disp) #endif /* FEATURE_dlist */ -extern void _mesa_init_display_list( GLcontext * ctx ); +extern void _mesa_init_display_list( struct gl_context * ctx ); -extern void _mesa_free_display_list_data(GLcontext *ctx); +extern void _mesa_free_display_list_data(struct gl_context *ctx); #endif /* DLIST_H */ diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index bf36a7e7a4..ac92a3fb08 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -43,7 +43,7 @@ * \return GL_TRUE if valid, GL_FALSE otherwise */ static GLboolean -valid_fragment_program(GLcontext *ctx) +valid_fragment_program(struct gl_context *ctx) { return !(ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled); } diff --git a/src/mesa/main/drawtex.c b/src/mesa/main/drawtex.c index c2ad5f2386..b9afc9974e 100644 --- a/src/mesa/main/drawtex.c +++ b/src/mesa/main/drawtex.c @@ -30,7 +30,7 @@ static void -draw_texture(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, +draw_texture(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) { if (!ctx->Extensions.OES_draw_texture) { diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index b2be44830a..5a5b199df3 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -50,7 +50,7 @@ * Helper to enable/disable client-side state. */ static void -client_state(GLcontext *ctx, GLenum cap, GLboolean state) +client_state(struct gl_context *ctx, GLenum cap, GLboolean state) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint flag; @@ -207,7 +207,7 @@ _mesa_DisableClientState( GLenum cap ) * higher than the number of supported coordinate units. And we'll return NULL. */ static struct gl_texture_unit * -get_texcoord_unit(GLcontext *ctx) +get_texcoord_unit(struct gl_context *ctx) { if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEnable/Disable(texcoord unit)"); @@ -225,7 +225,7 @@ get_texcoord_unit(GLcontext *ctx) * \return GL_TRUE if state is changing or GL_FALSE if no change */ static GLboolean -enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit) +enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit) { struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); const GLbitfield newenabled = state @@ -253,7 +253,7 @@ enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit) * dd_function_table::Enable. */ void -_mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) +_mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "%s %s (newstate is %x)\n", @@ -1005,7 +1005,7 @@ _mesa_Disable( GLenum cap ) * Enable/disable an indexed state var. */ void -_mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state) +_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state) { ASSERT(state == 0 || state == 1); switch (cap) { @@ -1095,7 +1095,7 @@ _mesa_IsEnabledIndexed( GLenum cap, GLuint index ) * Helper function to determine whether a texture target is enabled. */ static GLboolean -is_texture_enabled(GLcontext *ctx, GLbitfield bit) +is_texture_enabled(struct gl_context *ctx, GLbitfield bit) { const struct gl_texture_unit *const texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; diff --git a/src/mesa/main/enable.h b/src/mesa/main/enable.h index 24e3181a8b..69e52b1cb2 100644 --- a/src/mesa/main/enable.h +++ b/src/mesa/main/enable.h @@ -36,7 +36,7 @@ extern void -_mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state ); +_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state ); extern void GLAPIENTRY _mesa_Disable( GLenum cap ); @@ -48,7 +48,7 @@ extern GLboolean GLAPIENTRY _mesa_IsEnabled( GLenum cap ); extern void -_mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state); +_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state); extern void GLAPIENTRY _mesa_DisableIndexed( GLenum cap, GLuint index ); diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index bd2e1177fd..c607e6a26a 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -100,7 +100,7 @@ GLuint _mesa_evaluator_components( GLenum target ) * Return pointer to the gl_1d_map struct for the named target. */ static struct gl_1d_map * -get_1d_map( GLcontext *ctx, GLenum target ) +get_1d_map( struct gl_context *ctx, GLenum target ) { switch (target) { case GL_MAP1_VERTEX_3: @@ -150,7 +150,7 @@ get_1d_map( GLcontext *ctx, GLenum target ) * Return pointer to the gl_2d_map struct for the named target. */ static struct gl_2d_map * -get_2d_map( GLcontext *ctx, GLenum target ) +get_2d_map( struct gl_context *ctx, GLenum target ) { switch (target) { case GL_MAP2_VERTEX_3: @@ -880,7 +880,7 @@ init_2d_map( struct gl_2d_map *map, int n, const float *initial ) } -void _mesa_init_eval( GLcontext *ctx ) +void _mesa_init_eval( struct gl_context *ctx ) { int i; @@ -952,7 +952,7 @@ void _mesa_init_eval( GLcontext *ctx ) } -void _mesa_free_eval_data( GLcontext *ctx ) +void _mesa_free_eval_data( struct gl_context *ctx ) { int i; diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h index ffd1bab76d..bd908f00cd 100644 --- a/src/mesa/main/eval.h +++ b/src/mesa/main/eval.h @@ -57,7 +57,7 @@ extern GLuint _mesa_evaluator_components( GLenum target ); -extern void gl_free_control_points( GLcontext *ctx, +extern void gl_free_control_points( struct gl_context *ctx, GLenum target, GLfloat *data ); @@ -103,8 +103,8 @@ _mesa_init_eval_dispatch(struct _glapi_table *disp) #endif /* FEATURE_evaluators */ -extern void _mesa_init_eval( GLcontext *ctx ); -extern void _mesa_free_eval_data( GLcontext *ctx ); +extern void _mesa_init_eval( struct gl_context *ctx ); +extern void _mesa_free_eval_data( struct gl_context *ctx ); #endif /* EVAL_H */ diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 99583a6345..bc8cbef132 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -228,7 +228,7 @@ static const struct { * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc. */ void -_mesa_enable_sw_extensions(GLcontext *ctx) +_mesa_enable_sw_extensions(struct gl_context *ctx) { /*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/ ctx->Extensions.ARB_depth_clamp = GL_TRUE; @@ -388,7 +388,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) * Enable common EXT extensions in the ARB_imaging subset. */ void -_mesa_enable_imaging_extensions(GLcontext *ctx) +_mesa_enable_imaging_extensions(struct gl_context *ctx) { ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_logic_op = GL_TRUE; @@ -403,7 +403,7 @@ _mesa_enable_imaging_extensions(GLcontext *ctx) * A convenience function to be called by drivers. */ void -_mesa_enable_1_3_extensions(GLcontext *ctx) +_mesa_enable_1_3_extensions(struct gl_context *ctx) { /*ctx->Extensions.ARB_multisample = GL_TRUE;*/ ctx->Extensions.ARB_multitexture = GL_TRUE; @@ -423,7 +423,7 @@ _mesa_enable_1_3_extensions(GLcontext *ctx) * A convenience function to be called by drivers. */ void -_mesa_enable_1_4_extensions(GLcontext *ctx) +_mesa_enable_1_4_extensions(struct gl_context *ctx) { ctx->Extensions.ARB_depth_texture = GL_TRUE; ctx->Extensions.ARB_shadow = GL_TRUE; @@ -449,7 +449,7 @@ _mesa_enable_1_4_extensions(GLcontext *ctx) * A convenience function to be called by drivers. */ void -_mesa_enable_1_5_extensions(GLcontext *ctx) +_mesa_enable_1_5_extensions(struct gl_context *ctx) { ctx->Extensions.ARB_occlusion_query = GL_TRUE; /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/ @@ -462,7 +462,7 @@ _mesa_enable_1_5_extensions(GLcontext *ctx) * A convenience function to be called by drivers. */ void -_mesa_enable_2_0_extensions(GLcontext *ctx) +_mesa_enable_2_0_extensions(struct gl_context *ctx) { /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/ #if FEATURE_ARB_fragment_shader @@ -489,7 +489,7 @@ _mesa_enable_2_0_extensions(GLcontext *ctx) * A convenience function to be called by drivers. */ void -_mesa_enable_2_1_extensions(GLcontext *ctx) +_mesa_enable_2_1_extensions(struct gl_context *ctx) { #if FEATURE_EXT_pixel_buffer_object ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; @@ -505,7 +505,7 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) * \return GL_TRUE for success, GL_FALSE if invalid extension name */ static GLboolean -set_extension( GLcontext *ctx, const char *name, GLboolean state ) +set_extension( struct gl_context *ctx, const char *name, GLboolean state ) { GLboolean *base = (GLboolean *) &ctx->Extensions; GLuint i; @@ -534,7 +534,7 @@ set_extension( GLcontext *ctx, const char *name, GLboolean state ) * Typically called by drivers. */ void -_mesa_enable_extension( GLcontext *ctx, const char *name ) +_mesa_enable_extension( struct gl_context *ctx, const char *name ) { if (!set_extension(ctx, name, GL_TRUE)) _mesa_problem(ctx, "Trying to enable unknown extension: %s", name); @@ -546,7 +546,7 @@ _mesa_enable_extension( GLcontext *ctx, const char *name ) * XXX is this really needed??? */ void -_mesa_disable_extension( GLcontext *ctx, const char *name ) +_mesa_disable_extension( struct gl_context *ctx, const char *name ) { if (!set_extension(ctx, name, GL_FALSE)) _mesa_problem(ctx, "Trying to disable unknown extension: %s", name); @@ -557,7 +557,7 @@ _mesa_disable_extension( GLcontext *ctx, const char *name ) * Check if the i-th extension is enabled. */ static GLboolean -extension_enabled(GLcontext *ctx, GLuint index) +extension_enabled(struct gl_context *ctx, GLuint index) { const GLboolean *base = (const GLboolean *) &ctx->Extensions; if (!default_extensions[index].flag_offset || @@ -574,7 +574,7 @@ extension_enabled(GLcontext *ctx, GLuint index) * Test if the named extension is enabled in this context. */ GLboolean -_mesa_extension_is_enabled( GLcontext *ctx, const char *name ) +_mesa_extension_is_enabled( struct gl_context *ctx, const char *name ) { GLuint i; @@ -616,7 +616,7 @@ append(const char *a, const char *b) * Return a string of the unknown/leftover names. */ static const char * -get_extension_override( GLcontext *ctx ) +get_extension_override( struct gl_context *ctx ) { const char *envExt = _mesa_getenv("MESA_EXTENSION_OVERRIDE"); char *extraExt = NULL; @@ -667,7 +667,7 @@ get_extension_override( GLcontext *ctx ) * To be called during context initialization. */ void -_mesa_init_extensions( GLcontext *ctx ) +_mesa_init_extensions( struct gl_context *ctx ) { GLboolean *base = (GLboolean *) &ctx->Extensions; GLuint i; @@ -686,7 +686,7 @@ _mesa_init_extensions( GLcontext *ctx ) * glGetString(GL_EXTENSIONS) is called. */ static GLubyte * -compute_extensions( GLcontext *ctx ) +compute_extensions( struct gl_context *ctx ) { const char *extraExt = get_extension_override(ctx); GLuint extStrLen = 0; @@ -753,7 +753,7 @@ append_extension(GLubyte **str, const char *ext) static size_t -make_extension_string_es1(const GLcontext *ctx, GLubyte *str) +make_extension_string_es1(const struct gl_context *ctx, GLubyte *str) { size_t len = 0; @@ -835,7 +835,7 @@ make_extension_string_es1(const GLcontext *ctx, GLubyte *str) static GLubyte * -compute_extensions_es1(const GLcontext *ctx) +compute_extensions_es1(const struct gl_context *ctx) { GLubyte *s; unsigned int len; @@ -850,7 +850,7 @@ compute_extensions_es1(const GLcontext *ctx) } static size_t -make_extension_string_es2(const GLcontext *ctx, GLubyte *str) +make_extension_string_es2(const struct gl_context *ctx, GLubyte *str) { size_t len = 0; @@ -904,7 +904,7 @@ make_extension_string_es2(const GLcontext *ctx, GLubyte *str) } static GLubyte * -compute_extensions_es2(GLcontext *ctx) +compute_extensions_es2(struct gl_context *ctx) { GLubyte *s; unsigned int len; @@ -920,7 +920,7 @@ compute_extensions_es2(GLcontext *ctx) GLubyte * -_mesa_make_extension_string(GLcontext *ctx) +_mesa_make_extension_string(struct gl_context *ctx) { switch (ctx->API) { case API_OPENGL: @@ -939,7 +939,7 @@ _mesa_make_extension_string(GLcontext *ctx) * Return number of enabled extensions. */ GLuint -_mesa_get_extension_count(GLcontext *ctx) +_mesa_get_extension_count(struct gl_context *ctx) { GLuint i; @@ -964,7 +964,7 @@ _mesa_get_extension_count(GLcontext *ctx) * Return name of i-th enabled extension */ const GLubyte * -_mesa_get_enabled_extension(GLcontext *ctx, GLuint index) +_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index) { GLuint i; diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h index a25472440d..6eb8539396 100644 --- a/src/mesa/main/extensions.h +++ b/src/mesa/main/extensions.h @@ -40,35 +40,35 @@ #if _HAVE_FULL_GL -extern void _mesa_enable_sw_extensions(GLcontext *ctx); +extern void _mesa_enable_sw_extensions(struct gl_context *ctx); -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); -extern void _mesa_enable_1_3_extensions(GLcontext *ctx); +extern void _mesa_enable_1_3_extensions(struct gl_context *ctx); -extern void _mesa_enable_1_4_extensions(GLcontext *ctx); +extern void _mesa_enable_1_4_extensions(struct gl_context *ctx); -extern void _mesa_enable_1_5_extensions(GLcontext *ctx); +extern void _mesa_enable_1_5_extensions(struct gl_context *ctx); -extern void _mesa_enable_2_0_extensions(GLcontext *ctx); +extern void _mesa_enable_2_0_extensions(struct gl_context *ctx); -extern void _mesa_enable_2_1_extensions(GLcontext *ctx); +extern void _mesa_enable_2_1_extensions(struct gl_context *ctx); -extern void _mesa_enable_extension(GLcontext *ctx, const char *name); +extern void _mesa_enable_extension(struct gl_context *ctx, const char *name); -extern void _mesa_disable_extension(GLcontext *ctx, const char *name); +extern void _mesa_disable_extension(struct gl_context *ctx, const char *name); -extern GLboolean _mesa_extension_is_enabled(GLcontext *ctx, const char *name); +extern GLboolean _mesa_extension_is_enabled(struct gl_context *ctx, const char *name); -extern void _mesa_init_extensions(GLcontext *ctx); +extern void _mesa_init_extensions(struct gl_context *ctx); -extern GLubyte *_mesa_make_extension_string(GLcontext *ctx); +extern GLubyte *_mesa_make_extension_string(struct gl_context *ctx); extern GLuint -_mesa_get_extension_count(GLcontext *ctx); +_mesa_get_extension_count(struct gl_context *ctx); extern const GLubyte * -_mesa_get_enabled_extension(GLcontext *ctx, GLuint index); +_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index); #else diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index f28846c4c9..3dc78f2bf5 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -95,7 +95,7 @@ delete_dummy_framebuffer(struct gl_framebuffer *fb) void -_mesa_init_fbobjects(GLcontext *ctx) +_mesa_init_fbobjects(struct gl_context *ctx) { _glthread_INIT_MUTEX(DummyFramebuffer.Mutex); _glthread_INIT_MUTEX(DummyRenderbuffer.Mutex); @@ -115,7 +115,7 @@ _mesa_get_incomplete_framebuffer(void) * Helper routine for getting a gl_renderbuffer. */ struct gl_renderbuffer * -_mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id) +_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id) { struct gl_renderbuffer *rb; @@ -132,7 +132,7 @@ _mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id) * Helper routine for getting a gl_framebuffer. */ struct gl_framebuffer * -_mesa_lookup_framebuffer(GLcontext *ctx, GLuint id) +_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id) { struct gl_framebuffer *fb; @@ -166,7 +166,7 @@ invalidate_framebuffer(struct gl_framebuffer *fb) * the depth buffer attachment point. */ struct gl_renderbuffer_attachment * -_mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment) { GLuint i; @@ -216,7 +216,7 @@ _mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, * window-system framebuffer (not user-created framebuffer objects). */ static struct gl_renderbuffer_attachment * -_mesa_get_fb0_attachment(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment) { assert(fb->Name == 0); @@ -255,7 +255,7 @@ _mesa_get_fb0_attachment(GLcontext *ctx, struct gl_framebuffer *fb, * point. Update reference counts, etc. */ void -_mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) +_mesa_remove_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { if (att->Type == GL_TEXTURE) { ASSERT(att->Texture); @@ -281,7 +281,7 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) * The previous binding, if any, will be removed first. */ void -_mesa_set_texture_attachment(GLcontext *ctx, +_mesa_set_texture_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, @@ -322,7 +322,7 @@ _mesa_set_texture_attachment(GLcontext *ctx, * The previous binding, if any, will be removed first. */ void -_mesa_set_renderbuffer_attachment(GLcontext *ctx, +_mesa_set_renderbuffer_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb) { @@ -340,7 +340,7 @@ _mesa_set_renderbuffer_attachment(GLcontext *ctx, * Attach a renderbuffer object to a framebuffer object. */ void -_mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { struct gl_renderbuffer_attachment *att; @@ -406,7 +406,7 @@ fbo_incomplete(const char *msg, int index) * if GL_STENCIL, this is a stencil component attachment point. */ static void -test_attachment_completeness(const GLcontext *ctx, GLenum format, +test_attachment_completeness(const struct gl_context *ctx, GLenum format, struct gl_renderbuffer_attachment *att) { assert(format == GL_COLOR || format == GL_DEPTH || format == GL_STENCIL); @@ -563,7 +563,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, * framebuffer is complete. */ void -_mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) +_mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb) { GLuint numImages; GLenum intFormat = GL_NONE; /* color buffers' internal format */ @@ -833,7 +833,7 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) * The spec calls for unbinding. */ static void -detach_renderbuffer(GLcontext *ctx, +detach_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer *rb) { @@ -934,7 +934,7 @@ _mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers) * we'll also return GL_RED and GL_RG. */ GLenum -_mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat) +_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) { switch (internalFormat) { case GL_ALPHA: @@ -1287,7 +1287,7 @@ _mesa_IsFramebufferEXT(GLuint framebuffer) * attachments. */ static void -check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) +check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) { GLuint i; ASSERT(ctx->Driver.RenderTexture); @@ -1312,7 +1312,7 @@ check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) * notify the device driver that the texture image may have changed. */ static void -check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) +check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) { if (fb->Name == 0) return; /* can't render to texture with winsys framebuffers */ @@ -1606,7 +1606,7 @@ _mesa_CheckFramebufferStatusEXT(GLenum target) * Common code called by glFramebufferTexture1D/2D/3DEXT(). */ static void -framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, +framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index 9850ee9aa2..9e18e538a6 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -29,47 +29,47 @@ #include "mtypes.h" extern void -_mesa_init_fbobjects(GLcontext *ctx); +_mesa_init_fbobjects(struct gl_context *ctx); extern struct gl_framebuffer * _mesa_get_incomplete_framebuffer(void); extern struct gl_renderbuffer * -_mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id); +_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id); extern struct gl_framebuffer * -_mesa_lookup_framebuffer(GLcontext *ctx, GLuint id); +_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id); extern struct gl_renderbuffer_attachment * -_mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment); extern void -_mesa_remove_attachment(GLcontext *ctx, +_mesa_remove_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att); extern void -_mesa_set_texture_attachment(GLcontext *ctx, +_mesa_set_texture_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum texTarget, GLuint level, GLuint zoffset); extern void -_mesa_set_renderbuffer_attachment(GLcontext *ctx, +_mesa_set_renderbuffer_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb); extern void -_mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb); extern void -_mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb); +_mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb); extern GLenum -_mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat); +_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat); extern GLboolean GLAPIENTRY _mesa_IsRenderbufferEXT(GLuint renderbuffer); diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index c72b91280e..ffdecaecc2 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -116,7 +116,7 @@ _mesa_PassThrough( GLfloat token ) * Put a vertex into the feedback buffer. */ void -_mesa_feedback_vertex(GLcontext *ctx, +_mesa_feedback_vertex(struct gl_context *ctx, const GLfloat win[4], const GLfloat color[4], const GLfloat texcoord[4]) @@ -159,7 +159,7 @@ _mesa_feedback_vertex(GLcontext *ctx, * \note this function can't be put in a display list. * * Verifies we're not in selection mode, flushes the vertices and initialize - * the fields in __GLcontextRec::Select with the given buffer. + * the fields in __struct gl_contextRec::Select with the given buffer. */ static void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) @@ -192,7 +192,7 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) * increments the pointer. */ static INLINE void -write_record(GLcontext *ctx, GLuint value) +write_record(struct gl_context *ctx, GLuint value) { if (ctx->Select.BufferCount < ctx->Select.BufferSize) { ctx->Select.Buffer[ctx->Select.BufferCount] = value; @@ -211,7 +211,7 @@ write_record(GLcontext *ctx, GLuint value) * gl_selection::HitMaxZ. */ void -_mesa_update_hitflag(GLcontext *ctx, GLfloat z) +_mesa_update_hitflag(struct gl_context *ctx, GLfloat z) { ctx->Select.HitFlag = GL_TRUE; if (z < ctx->Select.HitMinZ) { @@ -235,7 +235,7 @@ _mesa_update_hitflag(GLcontext *ctx, GLfloat z) * \sa gl_selection. */ static void -write_hit_record(GLcontext *ctx) +write_hit_record(struct gl_context *ctx) { GLuint i; GLuint zmin, zmax, zscale = (~0u); @@ -266,7 +266,7 @@ write_hit_record(GLcontext *ctx) * * Verifies we are in select mode and resets the name stack depth and resets * the hit record data in gl_selection. Marks new render mode in - * __GLcontextRec::NewState. + * __struct gl_contextRec::NewState. */ static void GLAPIENTRY _mesa_InitNames( void ) @@ -297,7 +297,7 @@ _mesa_InitNames( void ) * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and replace the top-most name in the stack. * - * sa __GLcontextRec::Select. + * sa __struct gl_contextRec::Select. */ static void GLAPIENTRY _mesa_LoadName( GLuint name ) @@ -336,7 +336,7 @@ _mesa_LoadName( GLuint name ) * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and adds the name to the top of the name stack. * - * sa __GLcontextRec::Select. + * sa __struct gl_contextRec::Select. */ static void GLAPIENTRY _mesa_PushName( GLuint name ) @@ -367,7 +367,7 @@ _mesa_PushName( GLuint name ) * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and removes top-most name in the name stack. * - * sa __GLcontextRec::Select. + * sa __struct gl_contextRec::Select. */ static void GLAPIENTRY _mesa_PopName( void ) @@ -409,7 +409,7 @@ _mesa_PopName( void ) * Flushes the vertices and do the necessary cleanup according to the previous * rasterization mode, such as writing the hit record or resent the select * buffer index when exiting the select mode. Updates - * __GLcontextRec::RenderMode and notifies the driver via the + * __struct gl_contextRec::RenderMode and notifies the driver via the * dd_function_table::RenderMode callback. */ static GLint GLAPIENTRY @@ -519,7 +519,7 @@ _mesa_init_feedback_dispatch(struct _glapi_table *disp) /** * Initialize context feedback data. */ -void _mesa_init_feedback( GLcontext * ctx ) +void _mesa_init_feedback( struct gl_context * ctx ) { /* Feedback */ ctx->Feedback.Type = GL_2D; /* TODO: verify */ diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index c6354b97bc..f9fbbce70b 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -33,14 +33,14 @@ #if FEATURE_feedback extern void -_mesa_feedback_vertex( GLcontext *ctx, +_mesa_feedback_vertex( struct gl_context *ctx, const GLfloat win[4], const GLfloat color[4], const GLfloat texcoord[4] ); static INLINE void -_mesa_feedback_token( GLcontext *ctx, GLfloat token ) +_mesa_feedback_token( struct gl_context *ctx, GLfloat token ) { if (ctx->Feedback.Count < ctx->Feedback.BufferSize) { ctx->Feedback.Buffer[ctx->Feedback.Count] = token; @@ -50,7 +50,7 @@ _mesa_feedback_token( GLcontext *ctx, GLfloat token ) extern void -_mesa_update_hitflag( GLcontext *ctx, GLfloat z ); +_mesa_update_hitflag( struct gl_context *ctx, GLfloat z ); extern void @@ -61,7 +61,7 @@ _mesa_init_feedback_dispatch(struct _glapi_table *disp); #include "main/compiler.h" static INLINE void -_mesa_feedback_vertex( GLcontext *ctx, +_mesa_feedback_vertex( struct gl_context *ctx, const GLfloat win[4], const GLfloat color[4], const GLfloat texcoord[4] ) @@ -72,14 +72,14 @@ _mesa_feedback_vertex( GLcontext *ctx, static INLINE void -_mesa_feedback_token( GLcontext *ctx, GLfloat token ) +_mesa_feedback_token( struct gl_context *ctx, GLfloat token ) { /* render mode is always GL_RENDER */ ASSERT_NO_FEATURE(); } static INLINE void -_mesa_update_hitflag( GLcontext *ctx, GLfloat z ) +_mesa_update_hitflag( struct gl_context *ctx, GLfloat z ) { /* render mode is always GL_RENDER */ ASSERT_NO_FEATURE(); @@ -93,6 +93,6 @@ _mesa_init_feedback_dispatch(struct _glapi_table *disp) #endif /* FEATURE_feedback */ extern void -_mesa_init_feedback( GLcontext *ctx ); +_mesa_init_feedback( struct gl_context *ctx ); #endif /* FEEDBACK_H */ diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 92fec09bad..0f2c313c81 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -109,7 +109,7 @@ static GLuint translate_texgen( GLboolean enabled, GLenum mode ) -static GLboolean check_active_shininess( GLcontext *ctx, +static GLboolean check_active_shininess( struct gl_context *ctx, const struct state_key *key, GLuint side ) { @@ -129,7 +129,7 @@ static GLboolean check_active_shininess( GLcontext *ctx, } -static void make_state_key( GLcontext *ctx, struct state_key *key ) +static void make_state_key( struct gl_context *ctx, struct state_key *key ) { const struct gl_fragment_program *fp; GLuint i; @@ -1638,7 +1638,7 @@ create_new_program( const struct state_key *key, * XXX move this into core mesa (main/) */ struct gl_vertex_program * -_mesa_get_fixed_func_vertex_program(GLcontext *ctx) +_mesa_get_fixed_func_vertex_program(struct gl_context *ctx) { struct gl_vertex_program *prog; struct state_key key; diff --git a/src/mesa/main/ffvertex_prog.h b/src/mesa/main/ffvertex_prog.h index 38dc5fbb8d..72cd6ea115 100644 --- a/src/mesa/main/ffvertex_prog.h +++ b/src/mesa/main/ffvertex_prog.h @@ -33,7 +33,7 @@ #include "main/mtypes.h" struct gl_vertex_program * -_mesa_get_fixed_func_vertex_program(GLcontext *ctx); +_mesa_get_fixed_func_vertex_program(struct gl_context *ctx); diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 9f26c012d6..fd64bd1fd8 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -178,7 +178,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) /***** Initialization *****/ /**********************************************************************/ -void _mesa_init_fog( GLcontext * ctx ) +void _mesa_init_fog( struct gl_context * ctx ) { /* Fog group */ ctx->Fog.Enabled = GL_FALSE; diff --git a/src/mesa/main/fog.h b/src/mesa/main/fog.h index a14d19cdb3..7df4f0b673 100644 --- a/src/mesa/main/fog.h +++ b/src/mesa/main/fog.h @@ -54,7 +54,7 @@ _mesa_Fogfv(GLenum pname, const GLfloat *params ); extern void GLAPIENTRY _mesa_Fogiv(GLenum pname, const GLint *params ); -extern void _mesa_init_fog( GLcontext * ctx ); +extern void _mesa_init_fog( struct gl_context * ctx ); #else diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 0e9e6def9b..af3b5dfcf9 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -102,7 +102,7 @@ _mesa_create_framebuffer(const struct gl_config *visual) * \sa _mesa_create_framebuffer */ struct gl_framebuffer * -_mesa_new_framebuffer(GLcontext *ctx, GLuint name) +_mesa_new_framebuffer(struct gl_context *ctx, GLuint name) { struct gl_framebuffer *fb; (void) ctx; @@ -281,7 +281,7 @@ _mesa_reference_framebuffer(struct gl_framebuffer **ptr, * without a currently bound rendering context. */ void -_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { GLuint i; @@ -359,7 +359,7 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, * from device drivers (as was done in the past). */ void -_mesa_resizebuffers( GLcontext *ctx ) +_mesa_resizebuffers( struct gl_context *ctx ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); @@ -429,7 +429,7 @@ _mesa_ResizeBuffersMESA( void ) * window-system framebuffes. */ static void -update_framebuffer_size(GLcontext *ctx, struct gl_framebuffer *fb) +update_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb) { GLuint minWidth = ~0, minHeight = ~0; GLuint i; @@ -464,7 +464,7 @@ update_framebuffer_size(GLcontext *ctx, struct gl_framebuffer *fb) * \param ctx the GL context. */ void -_mesa_update_draw_buffer_bounds(GLcontext *ctx) +_mesa_update_draw_buffer_bounds(struct gl_context *ctx) { struct gl_framebuffer *buffer = ctx->DrawBuffer; @@ -600,7 +600,7 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) * \param attIndex indicates the renderbuffer to possibly wrap */ void -_mesa_update_depth_buffer(GLcontext *ctx, +_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint attIndex) { @@ -641,7 +641,7 @@ _mesa_update_depth_buffer(GLcontext *ctx, * \param attIndex indicates the renderbuffer to possibly wrap */ void -_mesa_update_stencil_buffer(GLcontext *ctx, +_mesa_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint attIndex) { @@ -722,7 +722,7 @@ _mesa_update_stencil_buffer(GLcontext *ctx, * writing colors. */ static void -update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb) +update_color_draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb) { GLuint output; @@ -746,7 +746,7 @@ update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb) * Unlike the DrawBuffer, we can only read from one (or zero) color buffers. */ static void -update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb) +update_color_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb) { (void) ctx; if (fb->_ColorReadBufferIndex == -1 || @@ -781,7 +781,7 @@ update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb) * glRenderbufferStorageEXT. */ static void -update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) { if (fb->Name == 0) { /* This is a window-system framebuffer */ @@ -823,7 +823,7 @@ update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) * Update state related to the current draw/read framebuffers. */ void -_mesa_update_framebuffer(GLcontext *ctx) +_mesa_update_framebuffer(struct gl_context *ctx) { struct gl_framebuffer *drawFb; struct gl_framebuffer *readFb; @@ -846,7 +846,7 @@ _mesa_update_framebuffer(GLcontext *ctx) * \return GL_TRUE if buffer exists, GL_FALSE otherwise */ GLboolean -_mesa_source_buffer_exists(GLcontext *ctx, GLenum format) +_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format) { const struct gl_renderbuffer_attachment *att = ctx->ReadBuffer->Attachment; @@ -922,7 +922,7 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format) * XXX could do some code merging w/ above function. */ GLboolean -_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) +_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format) { const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment; @@ -993,7 +993,7 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) * Used to answer the GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES query. */ GLenum -_mesa_get_color_read_format(GLcontext *ctx) +_mesa_get_color_read_format(struct gl_context *ctx) { switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { case MESA_FORMAT_ARGB8888: @@ -1010,7 +1010,7 @@ _mesa_get_color_read_format(GLcontext *ctx) * Used to answer the GL_IMPLEMENTATION_COLOR_READ_TYPE_OES query. */ GLenum -_mesa_get_color_read_type(GLcontext *ctx) +_mesa_get_color_read_type(struct gl_context *ctx) { switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { case MESA_FORMAT_ARGB8888: diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 0cf28424cf..13722ea457 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -32,7 +32,7 @@ extern struct gl_framebuffer * _mesa_create_framebuffer(const struct gl_config *visual); extern struct gl_framebuffer * -_mesa_new_framebuffer(GLcontext *ctx, GLuint name); +_mesa_new_framebuffer(struct gl_context *ctx, GLuint name); extern void _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, @@ -52,45 +52,45 @@ _mesa_reference_framebuffer(struct gl_framebuffer **ptr, struct gl_framebuffer *fb); extern void -_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height); extern void -_mesa_resizebuffers( GLcontext *ctx ); +_mesa_resizebuffers( struct gl_context *ctx ); extern void GLAPIENTRY _mesa_ResizeBuffersMESA( void ); extern void -_mesa_update_draw_buffer_bounds(GLcontext *ctx); +_mesa_update_draw_buffer_bounds(struct gl_context *ctx); extern void _mesa_update_framebuffer_visual(struct gl_framebuffer *fb); extern void -_mesa_update_depth_buffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint attIndex); extern void -_mesa_update_stencil_buffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint attIndex); extern void -_mesa_update_framebuffer(GLcontext *ctx); +_mesa_update_framebuffer(struct gl_context *ctx); extern GLboolean -_mesa_source_buffer_exists(GLcontext *ctx, GLenum format); +_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format); extern GLboolean -_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format); +_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format); extern GLenum -_mesa_get_color_read_type(GLcontext *ctx); +_mesa_get_color_read_type(struct gl_context *ctx); extern GLenum -_mesa_get_color_read_format(GLcontext *ctx); +_mesa_get_color_read_format(struct gl_context *ctx); extern void _mesa_print_framebuffer(const struct gl_framebuffer *fb); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index cb456fb64d..8224c15627 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -36,17 +36,17 @@ /* This is a table driven implemetation of the glGet*v() functions. * The basic idea is that most getters just look up an int somewhere - * in GLcontext and then convert it to a bool or float according to + * in struct gl_context and then convert it to a bool or float according to * which of glGetIntegerv() glGetBooleanv() etc is being called. * Instead of generating code to do this, we can just record the enum - * value and the offset into GLcontext in an array of structs. Then + * value and the offset into struct gl_context in an array of structs. Then * in glGet*(), we lookup the struct for the enum in question, and use * the offset to get the int we need. * * Sometimes we need to look up a float, a boolean, a bit in a * bitfield, a matrix or other types instead, so we need to track the - * type of the value in GLcontext. And sometimes the value isn't in - * GLcontext but in the drawbuffer, the array object, current texture + * type of the value in struct gl_context. And sometimes the value isn't in + * struct gl_context but in the drawbuffer, the array object, current texture * unit, or maybe it's a computed value. So we need to also track * where or how to find the value. Finally, we sometimes need to * check that one of a number of extensions are enabled, the GL @@ -165,7 +165,7 @@ union value { #define BUFFER_FIELD(field, type) \ LOC_BUFFER, type, offsetof(struct gl_framebuffer, field) #define CONTEXT_FIELD(field, type) \ - LOC_CONTEXT, type, offsetof(GLcontext, field) + LOC_CONTEXT, type, offsetof(struct gl_context, field) #define ARRAY_FIELD(field, type) \ LOC_ARRAY, type, offsetof(struct gl_array_object, field) #define CONST(value) \ @@ -371,7 +371,7 @@ static const struct value_desc values[] = { { GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA }, { GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA }, { GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, Const.MaxTextureLevels), NO_EXTRA }, + offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA }, { GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA }, { GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA }, { GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA }, @@ -410,7 +410,7 @@ static const struct value_desc values[] = { { GL_TEXTURE_BINDING_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map }, { GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, Const.MaxCubeTextureLevels), + offsetof(struct gl_context, Const.MaxCubeTextureLevels), extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */ /* XXX: OES_blend_subtract */ @@ -522,7 +522,7 @@ static const struct value_desc values[] = { { GL_MAX_TEXTURE_STACK_DEPTH, CONST(MAX_TEXTURE_STACK_DEPTH), NO_EXTRA }, { GL_MODELVIEW_MATRIX, CONTEXT_MATRIX(ModelviewMatrixStack.Top), NO_EXTRA }, { GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, ModelviewMatrixStack.Depth), NO_EXTRA }, + offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA }, { GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA }, { GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA }, { GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA }, @@ -535,7 +535,7 @@ static const struct value_desc values[] = { { GL_POINT_FADE_THRESHOLD_SIZE_EXT, CONTEXT_FLOAT(Point.Threshold), NO_EXTRA }, { GL_PROJECTION_MATRIX, CONTEXT_MATRIX(ProjectionMatrixStack.Top), NO_EXTRA }, { GL_PROJECTION_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, ProjectionMatrixStack.Depth), NO_EXTRA }, + offsetof(struct gl_context, ProjectionMatrixStack.Depth), NO_EXTRA }, { GL_RESCALE_NORMAL, CONTEXT_BOOL(Transform.RescaleNormals), NO_EXTRA }, { GL_SHADE_MODEL, CONTEXT_ENUM(Light.ShadeModel), NO_EXTRA }, { GL_TEXTURE_2D, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, @@ -672,7 +672,7 @@ static const struct value_desc values[] = { /* OES_texture_3D */ { GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA }, { GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, Const.Max3DTextureLevels), NO_EXTRA }, + offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA }, /* GL_ARB_fragment_program/OES_standard_derivatives */ { GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, @@ -683,11 +683,11 @@ static const struct value_desc values[] = { /* Enums unique to OpenGL ES 2.0 */ { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA }, { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA }, + offsetof(struct gl_context, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA }, { GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, Const.MaxVarying), NO_EXTRA }, + offsetof(struct gl_context, Const.MaxVarying), NO_EXTRA }, { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, - offsetof(GLcontext, Const.VertexProgram.MaxUniformComponents), NO_EXTRA }, + offsetof(struct gl_context, Const.VertexProgram.MaxUniformComponents), NO_EXTRA }, { GL_SHADER_COMPILER, CONST(1), NO_EXTRA }, /* OES_get_program_binary */ { GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, @@ -1256,7 +1256,7 @@ print_table_stats(void) * * \param the current context, for determining the API in question */ -void _mesa_init_get_hash(GLcontext *ctx) +void _mesa_init_get_hash(struct gl_context *ctx) { int i, hash, index, mask; int api_mask = 0, api_bit; @@ -1305,7 +1305,7 @@ void _mesa_init_get_hash(GLcontext *ctx) * \param v pointer to the tmp declared in the calling glGet*v() function */ static void -find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v) +find_custom_value(struct gl_context *ctx, const struct value_desc *d, union value *v) { struct gl_buffer_object *buffer_obj; struct gl_client_array *array; @@ -1583,7 +1583,7 @@ find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v) * otherwise GL_TRUE. */ static GLboolean -check_extra(GLcontext *ctx, const char *func, const struct value_desc *d) +check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d) { const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; int total, enabled; diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 3910047fb5..bfa283f6a3 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -35,7 +35,7 @@ * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. */ static const GLubyte * -shading_language_version(GLcontext *ctx) +shading_language_version(struct gl_context *ctx) { switch (ctx->API) { case API_OPENGL: @@ -233,7 +233,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) * Returns the current GL error code, or GL_NO_ERROR. * \return current error code * - * Returns __GLcontextRec::ErrorValue. + * Returns __struct gl_contextRec::ErrorValue. */ GLenum GLAPIENTRY _mesa_GetError( void ) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index b624e6ecac..72d924dcc3 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -277,7 +277,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) * \param table the hash table to delete * \param callback the callback function * \param userData arbitrary pointer to pass along to the callback - * (this is typically a GLcontext pointer) + * (this is typically a struct gl_context pointer) */ void _mesa_HashDeleteAll(struct _mesa_HashTable *table, @@ -313,7 +313,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, * \param table the hash table to walk * \param callback the callback function * \param userData arbitrary pointer to pass along to the callback - * (this is typically a GLcontext pointer) + * (this is typically a struct gl_context pointer) */ void _mesa_HashWalk(const struct _mesa_HashTable *table, diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 8902ae3776..878f10d4a4 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -130,7 +130,7 @@ _mesa_Hint( GLenum target, GLenum mode ) /***** Initialization *****/ /**********************************************************************/ -void _mesa_init_hint( GLcontext * ctx ) +void _mesa_init_hint( struct gl_context * ctx ) { /* Hint group */ ctx->Hint.PerspectiveCorrection = GL_DONT_CARE; diff --git a/src/mesa/main/hint.h b/src/mesa/main/hint.h index bfc3887107..66e78ad655 100644 --- a/src/mesa/main/hint.h +++ b/src/mesa/main/hint.h @@ -45,7 +45,7 @@ extern void GLAPIENTRY _mesa_Hint( GLenum target, GLenum mode ); extern void -_mesa_init_hint( GLcontext * ctx ); +_mesa_init_hint( struct gl_context * ctx ); #else diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index f83fcc725d..2c3af332c0 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -399,7 +399,7 @@ _mesa_bytes_per_pixel( GLenum format, GLenum type ) * otherwise. */ GLboolean -_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ) +_mesa_is_legal_format_and_type( struct gl_context *ctx, GLenum format, GLenum type ) { switch (format) { case GL_COLOR_INDEX: @@ -869,7 +869,7 @@ _mesa_is_integer_format(GLenum format) * \return GL_TRUE if compressed, GL_FALSE if uncompressed */ GLboolean -_mesa_is_compressed_format(GLcontext *ctx, GLenum format) +_mesa_is_compressed_format(struct gl_context *ctx, GLenum format) { switch (format) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -1541,7 +1541,7 @@ _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], * Apply pixel mapping to an array of floating point RGBA pixels. */ void -_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +_mesa_map_rgba( const struct gl_context *ctx, GLuint n, GLfloat rgba[][4] ) { const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1); const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1); @@ -1829,7 +1829,7 @@ _mesa_lookup_rgba_ubyte(const struct gl_color_table *table, * Map color indexes to float rgba values. */ void -_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, +_mesa_map_ci_to_rgba( const struct gl_context *ctx, GLuint n, const GLuint index[], GLfloat rgba[][4] ) { GLuint rmask = ctx->PixelMaps.ItoR.Size - 1; @@ -1854,7 +1854,7 @@ _mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, * Map ubyte color indexes to ubyte/RGBA values. */ void -_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[], +_mesa_map_ci8_to_rgba8(const struct gl_context *ctx, GLuint n, const GLubyte index[], GLubyte rgba[][4]) { GLuint rmask = ctx->PixelMaps.ItoR.Size - 1; @@ -1876,7 +1876,7 @@ _mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[], void -_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, +_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n, GLfloat depthValues[]) { const GLfloat scale = ctx->Pixel.DepthScale; @@ -1890,7 +1890,7 @@ _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, void -_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, +_mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n, GLuint depthValues[]) { const GLdouble max = (double) 0xffffffff; @@ -1909,7 +1909,7 @@ _mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, * as indicated by the transferOps bitmask */ void -_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, +_mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps, GLuint n, GLfloat rgba[][4]) { /* scale & bias */ @@ -1942,7 +1942,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, * Apply color index shift and offset to an array of pixels. */ static void -shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) +shift_and_offset_ci( const struct gl_context *ctx, GLuint n, GLuint indexes[] ) { GLint shift = ctx->Pixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; @@ -1972,7 +1972,7 @@ shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) * of color indexes; */ void -_mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps, +_mesa_apply_ci_transfer_ops(const struct gl_context *ctx, GLbitfield transferOps, GLuint n, GLuint indexes[]) { if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { @@ -1994,7 +1994,7 @@ _mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps, * of stencil values. */ void -_mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, +_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n, GLstencil stencil[]) { if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) { @@ -2035,7 +2035,7 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, * transfer ops are enabled. */ void -_mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], +_mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, @@ -3912,7 +3912,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], * XXX perhaps expand this to process whole images someday. */ void -_mesa_unpack_color_span_chan( GLcontext *ctx, +_mesa_unpack_color_span_chan( struct gl_context *ctx, GLuint n, GLenum dstFormat, GLchan dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -4262,7 +4262,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx, * instead of GLchan. */ void -_mesa_unpack_color_span_float( GLcontext *ctx, +_mesa_unpack_color_span_float( struct gl_context *ctx, GLuint n, GLenum dstFormat, GLfloat dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -4498,7 +4498,7 @@ _mesa_unpack_color_span_float( GLcontext *ctx, * directly return GLbyte data, no transfer ops apply. */ void -_mesa_unpack_dudv_span_byte( GLcontext *ctx, +_mesa_unpack_dudv_span_byte( struct gl_context *ctx, GLuint n, GLenum dstFormat, GLbyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -4565,7 +4565,7 @@ _mesa_unpack_dudv_span_byte( GLcontext *ctx, * transferOps - the pixel transfer operations to apply */ void -_mesa_unpack_index_span( const GLcontext *ctx, GLuint n, +_mesa_unpack_index_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, @@ -4643,7 +4643,7 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, void -_mesa_pack_index_span( const GLcontext *ctx, GLuint n, +_mesa_pack_index_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLuint *source, const struct gl_pixelstore_attrib *dstPacking, GLbitfield transferOps ) @@ -4773,7 +4773,7 @@ _mesa_pack_index_span( const GLcontext *ctx, GLuint n, * transferOps - apply offset/bias/lookup ops? */ void -_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, +_mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, @@ -4868,7 +4868,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, void -_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, +_mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLstencil *source, const struct gl_pixelstore_attrib *dstPacking ) { @@ -5043,7 +5043,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, * (ignored for GLfloat). */ void -_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, +_mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLuint depthMax, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking ) @@ -5242,7 +5242,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, * Pack an array of depth values. The values are floats in [0,1]. */ void -_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, +_mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest, GLenum dstType, const GLfloat *depthSpan, const struct gl_pixelstore_attrib *dstPacking ) { @@ -5358,7 +5358,7 @@ _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, * Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8. */ void -_mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest, +_mesa_pack_depth_stencil_span(const struct gl_context *ctx, GLuint n, GLuint *dest, const GLfloat *depthVals, const GLstencil *stencilVals, const struct gl_pixelstore_attrib *dstPacking) @@ -5673,7 +5673,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src, * GL_FALSE if image was completely clipped away (draw nothing) */ GLboolean -_mesa_clip_drawpixels(const GLcontext *ctx, +_mesa_clip_drawpixels(const struct gl_context *ctx, GLint *destX, GLint *destY, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *unpack) @@ -5744,7 +5744,7 @@ _mesa_clip_drawpixels(const GLcontext *ctx, * GL_FALSE if image was completely clipped away (draw nothing) */ GLboolean -_mesa_clip_readpixels(const GLcontext *ctx, +_mesa_clip_readpixels(const struct gl_context *ctx, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *pack) @@ -5794,7 +5794,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, * \return GL_FALSE if region is totally clipped, GL_TRUE otherwise. */ GLboolean -_mesa_clip_copytexsubimage(const GLcontext *ctx, +_mesa_clip_copytexsubimage(const struct gl_context *ctx, GLint *destX, GLint *destY, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height) @@ -5937,7 +5937,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1, * \return GL_TRUE if anything is left to draw, GL_FALSE if totally clipped */ GLboolean -_mesa_clip_blit(GLcontext *ctx, +_mesa_clip_blit(struct gl_context *ctx, GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1, GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1) { diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index 672dbf2823..ed5ffa368c 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -52,7 +52,7 @@ extern GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ); extern GLboolean -_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ); +_mesa_is_legal_format_and_type( struct gl_context *ctx, GLenum format, GLenum type ); extern GLboolean _mesa_is_color_format(GLenum format); @@ -82,7 +82,7 @@ extern GLboolean _mesa_is_integer_format(GLenum format); extern GLboolean -_mesa_is_compressed_format(GLcontext *ctx, GLenum format); +_mesa_is_compressed_format(struct gl_context *ctx, GLenum format); extern GLvoid * _mesa_image_address( GLuint dimensions, @@ -161,7 +161,7 @@ _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], GLfloat bBias, GLfloat aBias); extern void -_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); +_mesa_map_rgba(const struct gl_context *ctx, GLuint n, GLfloat rgba[][4]); extern void _mesa_lookup_rgba_float(const struct gl_color_table *table, @@ -173,47 +173,47 @@ _mesa_lookup_rgba_ubyte(const struct gl_color_table *table, extern void -_mesa_map_ci_to_rgba(const GLcontext *ctx, +_mesa_map_ci_to_rgba(const struct gl_context *ctx, GLuint n, const GLuint index[], GLfloat rgba[][4]); extern void -_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[], +_mesa_map_ci8_to_rgba8(const struct gl_context *ctx, GLuint n, const GLubyte index[], GLubyte rgba[][4]); extern void -_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, +_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n, GLfloat depthValues[]); extern void -_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, +_mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n, GLuint depthValues[]); extern void -_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, +_mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps, GLuint n, GLfloat rgba[][4]); extern void -_mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps, +_mesa_apply_ci_transfer_ops(const struct gl_context *ctx, GLbitfield transferOps, GLuint n, GLuint indexes[]); extern void -_mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, +_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n, GLstencil stencil[]); extern void -_mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4], +_mesa_pack_rgba_span_float( struct gl_context *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, GLbitfield transferOps ); extern void -_mesa_unpack_color_span_chan( GLcontext *ctx, +_mesa_unpack_color_span_chan( struct gl_context *ctx, GLuint n, GLenum dstFormat, GLchan dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -222,7 +222,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx, extern void -_mesa_unpack_color_span_float( GLcontext *ctx, +_mesa_unpack_color_span_float( struct gl_context *ctx, GLuint n, GLenum dstFormat, GLfloat dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -230,7 +230,7 @@ _mesa_unpack_color_span_float( GLcontext *ctx, GLbitfield transferOps ); extern void -_mesa_unpack_dudv_span_byte( GLcontext *ctx, +_mesa_unpack_dudv_span_byte( struct gl_context *ctx, GLuint n, GLenum dstFormat, GLbyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -238,7 +238,7 @@ _mesa_unpack_dudv_span_byte( GLcontext *ctx, GLbitfield transferOps ); extern void -_mesa_unpack_index_span( const GLcontext *ctx, GLuint n, +_mesa_unpack_index_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, @@ -246,39 +246,39 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, extern void -_mesa_pack_index_span( const GLcontext *ctx, GLuint n, +_mesa_pack_index_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLuint *source, const struct gl_pixelstore_attrib *dstPacking, GLbitfield transferOps ); extern void -_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, +_mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps ); extern void -_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, +_mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLstencil *source, const struct gl_pixelstore_attrib *dstPacking ); extern void -_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, +_mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLuint depthMax, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking ); extern void -_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, +_mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest, GLenum dstType, const GLfloat *depthSpan, const struct gl_pixelstore_attrib *dstPacking ); extern void -_mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest, +_mesa_pack_depth_stencil_span(const struct gl_context *ctx, GLuint n, GLuint *dest, const GLfloat *depthVals, const GLstencil *stencilVals, const struct gl_pixelstore_attrib *dstPacking); @@ -298,20 +298,20 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src, extern GLboolean -_mesa_clip_drawpixels(const GLcontext *ctx, +_mesa_clip_drawpixels(const struct gl_context *ctx, GLint *destX, GLint *destY, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *unpack); extern GLboolean -_mesa_clip_readpixels(const GLcontext *ctx, +_mesa_clip_readpixels(const struct gl_context *ctx, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *pack); extern GLboolean -_mesa_clip_copytexsubimage(const GLcontext *ctx, +_mesa_clip_copytexsubimage(const struct gl_context *ctx, GLint *destX, GLint *destY, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height); @@ -323,7 +323,7 @@ _mesa_clip_to_region(GLint xmin, GLint ymin, GLsizei *width, GLsizei *height ); extern GLboolean -_mesa_clip_blit(GLcontext *ctx, +_mesa_clip_blit(struct gl_context *ctx, GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1, GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1); diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 46e5c932d0..bcca4edc1a 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -882,7 +882,7 @@ error_string( GLenum error ) * previous errors which were accumulated. */ static void -flush_delayed_errors( GLcontext *ctx ) +flush_delayed_errors( struct gl_context *ctx ) { char s[MAXSTRING]; @@ -906,7 +906,7 @@ flush_delayed_errors( GLcontext *ctx ) * \param fmtString printf()-like format string. */ void -_mesa_warning( GLcontext *ctx, const char *fmtString, ... ) +_mesa_warning( struct gl_context *ctx, const char *fmtString, ... ) { char str[MAXSTRING]; va_list args; @@ -929,7 +929,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) * \param fmtString problem description string. */ void -_mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) +_mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) { va_list args; char str[MAXSTRING]; @@ -957,7 +957,7 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) * \param fmtString printf() style format string, followed by optional args */ void -_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) +_mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) { static GLint debug = -1; @@ -1014,7 +1014,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) * \param fmtString printf()-style format string, followed by optional args. */ void -_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) +_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) { #ifdef DEBUG char s[MAXSTRING]; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a56e0af9b5..30fc152389 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -568,19 +568,19 @@ _mesa_str_checksum(const char *str); extern int _mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4); -struct __GLcontextRec; +struct gl_context; extern void -_mesa_warning( struct __GLcontextRec *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); +_mesa_warning( struct gl_context *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_problem( const struct __GLcontextRec *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); +_mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_error( struct __GLcontextRec *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4); +_mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4); extern void -_mesa_debug( const struct __GLcontextRec *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); +_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); #if defined(_MSC_VER) && !defined(snprintf) diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 43ae28c25a..c27cf1dd38 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -103,7 +103,7 @@ _mesa_ProvokingVertexEXT(GLenum mode) * Also, all error checking should have already been done. */ void -_mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params) +_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params) { struct gl_light *light; @@ -569,7 +569,7 @@ _mesa_LightModelf( GLenum pname, GLfloat param ) * of the targeted material values. */ GLuint -_mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, +_mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname, GLuint legal, const char *where ) { GLuint bitmask = 0; @@ -643,7 +643,7 @@ _mesa_copy_materials( struct gl_material *dst, /* Update derived values following a change in ctx->Light.Material */ void -_mesa_update_material( GLcontext *ctx, GLuint bitmask ) +_mesa_update_material( struct gl_context *ctx, GLuint bitmask ) { struct gl_light *light, *list = &ctx->Light.EnabledList; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; @@ -728,7 +728,7 @@ _mesa_update_material( GLcontext *ctx, GLuint bitmask ) * set by glColorMaterial(). */ void -_mesa_update_color_material( GLcontext *ctx, const GLfloat color[4] ) +_mesa_update_color_material( struct gl_context *ctx, const GLfloat color[4] ) { GLuint bitmask = ctx->Light.ColorMaterialBitmask; struct gl_material *mat = &ctx->Light.Material; @@ -972,7 +972,7 @@ validate_spot_exp_table( struct gl_light *l ) * by keeping a MRU cache of shine tables for various shine values. */ void -_mesa_invalidate_shine_table( GLcontext *ctx, GLuint side ) +_mesa_invalidate_shine_table( struct gl_context *ctx, GLuint side ) { ASSERT(side < 2); if (ctx->_ShineTable[side]) @@ -982,7 +982,7 @@ _mesa_invalidate_shine_table( GLcontext *ctx, GLuint side ) static void -validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess ) +validate_shine_table( struct gl_context *ctx, GLuint side, GLfloat shininess ) { struct gl_shine_tab *list = ctx->_ShineTabList; struct gl_shine_tab *s; @@ -1034,7 +1034,7 @@ validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess ) void -_mesa_validate_all_lighting_tables( GLcontext *ctx ) +_mesa_validate_all_lighting_tables( struct gl_context *ctx ) { GLuint i; GLfloat shininess; @@ -1060,7 +1060,7 @@ _mesa_validate_all_lighting_tables( GLcontext *ctx ) * source and material ambient, diffuse and specular coefficients. */ void -_mesa_update_lighting( GLcontext *ctx ) +_mesa_update_lighting( struct gl_context *ctx ) { struct gl_light *light; ctx->Light._NeedEyeCoords = GL_FALSE; @@ -1123,7 +1123,7 @@ _mesa_update_lighting( GLcontext *ctx ) * Also update on lighting space changes. */ static void -compute_light_positions( GLcontext *ctx ) +compute_light_positions( struct gl_context *ctx ) { struct gl_light *light; static const GLfloat eye_z[3] = { 0, 0, 1 }; @@ -1210,7 +1210,7 @@ compute_light_positions( GLcontext *ctx ) static void -update_modelview_scale( GLcontext *ctx ) +update_modelview_scale( struct gl_context *ctx ) { ctx->_ModelViewInvScale = 1.0F; if (!_math_matrix_is_length_preserving(ctx->ModelviewMatrixStack.Top)) { @@ -1229,7 +1229,7 @@ update_modelview_scale( GLcontext *ctx ) * Bring up to date any state that relies on _NeedEyeCoords. */ void -_mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ) +_mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state ) { const GLuint oldneedeyecoords = ctx->_NeedEyeCoords; @@ -1278,7 +1278,7 @@ _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ) * light-in-modelspace optimization. It's also useful for debugging. */ void -_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ) +_mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag ) { ctx->_ForceEyeCoords = !flag; ctx->NewState |= _NEW_POINT; /* one of the bits from @@ -1370,7 +1370,7 @@ init_material( struct gl_material *m ) * Initialize all lighting state for the given context. */ void -_mesa_init_lighting( GLcontext *ctx ) +_mesa_init_lighting( struct gl_context *ctx ) { GLuint i; @@ -1418,7 +1418,7 @@ _mesa_init_lighting( GLcontext *ctx ) * Deallocate malloc'd lighting state attached to given context. */ void -_mesa_free_lighting_data( GLcontext *ctx ) +_mesa_free_lighting_data( struct gl_context *ctx ) { struct gl_shine_tab *s, *tmps; diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h index b3436114d4..021f5ea193 100644 --- a/src/mesa/main/light.h +++ b/src/mesa/main/light.h @@ -79,7 +79,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ); extern void -_mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params); +_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params); /* Lerp between adjacent values in the f(x) lookup table, giving a @@ -100,36 +100,36 @@ do { \ } while (0) -extern GLuint _mesa_material_bitmask( GLcontext *ctx, +extern GLuint _mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname, GLuint legal, const char * ); extern void _mesa_invalidate_spot_exp_table( struct gl_light *l ); -extern void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint i ); +extern void _mesa_invalidate_shine_table( struct gl_context *ctx, GLuint i ); -extern void _mesa_validate_all_lighting_tables( GLcontext *ctx ); +extern void _mesa_validate_all_lighting_tables( struct gl_context *ctx ); -extern void _mesa_update_lighting( GLcontext *ctx ); +extern void _mesa_update_lighting( struct gl_context *ctx ); -extern void _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ); +extern void _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state ); -extern void _mesa_update_material( GLcontext *ctx, +extern void _mesa_update_material( struct gl_context *ctx, GLuint bitmask ); extern void _mesa_copy_materials( struct gl_material *dst, const struct gl_material *src, GLuint bitmask ); -extern void _mesa_update_color_material( GLcontext *ctx, +extern void _mesa_update_color_material( struct gl_context *ctx, const GLfloat rgba[4] ); -extern void _mesa_init_lighting( GLcontext *ctx ); +extern void _mesa_init_lighting( struct gl_context *ctx ); -extern void _mesa_free_lighting_data( GLcontext *ctx ); +extern void _mesa_free_lighting_data( struct gl_context *ctx ); -extern void _mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ); +extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag ); #else #define _mesa_update_color_material( c, r ) ((void)0) diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index cc63a759ec..505f840ba5 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -102,11 +102,11 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) * * \param ctx GL context. * - * Initializes __GLcontextRec::Line and line related constants in - * __GLcontextRec::Const. + * Initializes __struct gl_contextRec::Line and line related constants in + * __struct gl_contextRec::Const. */ void GLAPIENTRY -_mesa_init_line( GLcontext * ctx ) +_mesa_init_line( struct gl_context * ctx ) { ctx->Line.SmoothFlag = GL_FALSE; ctx->Line.StippleFlag = GL_FALSE; diff --git a/src/mesa/main/lines.h b/src/mesa/main/lines.h index 5a47e9858d..3accdd7800 100644 --- a/src/mesa/main/lines.h +++ b/src/mesa/main/lines.h @@ -43,6 +43,6 @@ extern void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ); extern void GLAPIENTRY -_mesa_init_line( GLcontext * ctx ); +_mesa_init_line( struct gl_context * ctx ); #endif diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 8ed718cd38..105d4a327f 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -59,7 +59,7 @@ * * Flushes vertices and validates parameters. Calls _math_matrix_frustum() with * the top matrix of the current matrix stack and sets - * __GLcontextRec::NewState. + * __struct gl_contextRec::NewState. */ void GLAPIENTRY _mesa_Frustum( GLdouble left, GLdouble right, @@ -101,7 +101,7 @@ _mesa_Frustum( GLdouble left, GLdouble right, * * Flushes vertices and validates parameters. Calls _math_matrix_ortho() with * the top matrix of the current matrix stack and sets - * __GLcontextRec::NewState. + * __struct gl_contextRec::NewState. */ void GLAPIENTRY _mesa_Ortho( GLdouble left, GLdouble right, @@ -139,7 +139,7 @@ _mesa_Ortho( GLdouble left, GLdouble right, * \sa glMatrixMode(). * * Flushes the vertices, validates the parameter and updates - * __GLcontextRec::CurrentStack and gl_transform_attrib::MatrixMode with the + * __struct gl_contextRec::CurrentStack and gl_transform_attrib::MatrixMode with the * specified matrix stack. */ void GLAPIENTRY @@ -231,7 +231,7 @@ _mesa_MatrixMode( GLenum mode ) * \sa glPushMatrix(). * * Verifies the current matrix stack is not full, and duplicates the top-most - * matrix in the stack. Marks __GLcontextRec::NewState with the stack dirty + * matrix in the stack. Marks __struct gl_contextRec::NewState with the stack dirty * flag. */ void GLAPIENTRY @@ -271,7 +271,7 @@ _mesa_PushMatrix( void ) * \sa glPopMatrix(). * * Flushes the vertices, verifies the current matrix stack is not empty, and - * moves the stack head down. Marks __GLcontextRec::NewState with the dirty + * moves the stack head down. Marks __struct gl_contextRec::NewState with the dirty * stack flag. */ void GLAPIENTRY @@ -309,7 +309,7 @@ _mesa_PopMatrix( void ) * \sa glLoadIdentity(). * * Flushes the vertices and calls _math_matrix_set_identity() with the top-most - * matrix in the current stack. Marks __GLcontextRec::NewState with the stack + * matrix in the current stack. Marks __struct gl_contextRec::NewState with the stack * dirty flag. */ void GLAPIENTRY @@ -334,7 +334,7 @@ _mesa_LoadIdentity( void ) * \sa glLoadMatrixf(). * * Flushes the vertices and calls _math_matrix_loadf() with the top-most matrix - * in the current stack and the given matrix. Marks __GLcontextRec::NewState + * in the current stack and the given matrix. Marks __struct gl_contextRec::NewState * with the dirty stack flag. */ void GLAPIENTRY @@ -365,7 +365,7 @@ _mesa_LoadMatrixf( const GLfloat *m ) * * Flushes the vertices and calls _math_matrix_mul_floats() with the top-most * matrix in the current stack and the given matrix. Marks - * __GLcontextRec::NewState with the dirty stack flag. + * __struct gl_contextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_MultMatrixf( const GLfloat *m ) @@ -397,7 +397,7 @@ _mesa_MultMatrixf( const GLfloat *m ) * * Flushes the vertices and calls _math_matrix_rotate() with the top-most * matrix in the current stack and the given parameters. Marks - * __GLcontextRec::NewState with the dirty stack flag. + * __struct gl_contextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) @@ -422,7 +422,7 @@ _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) * * Flushes the vertices and calls _math_matrix_scale() with the top-most * matrix in the current stack and the given parameters. Marks - * __GLcontextRec::NewState with the dirty stack flag. + * __struct gl_contextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) @@ -445,7 +445,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) * * Flushes the vertices and calls _math_matrix_translate() with the top-most * matrix in the current stack and the given parameters. Marks - * __GLcontextRec::NewState with the dirty stack flag. + * __struct gl_contextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) @@ -559,13 +559,13 @@ _mesa_MultTransposeMatrixdARB( const GLdouble *m ) * Calls _math_matrix_analyse() with the top-matrix of the projection matrix * stack, and recomputes user clip positions if necessary. * - * \note This routine references __GLcontextRec::Tranform attribute values to + * \note This routine references __struct gl_contextRec::Tranform attribute values to * compute userclip positions in clip space, but is only called on * _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values up to - * date across changes to the __GLcontextRec::Transform attributes. + * date across changes to the __struct gl_contextRec::Transform attributes. */ static void -update_projection( GLcontext *ctx ) +update_projection( struct gl_context *ctx ) { _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); @@ -593,11 +593,11 @@ update_projection( GLcontext *ctx ) * \param ctx GL context. * * Multiplies the top matrices of the projection and model view stacks into - * __GLcontextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and + * __struct gl_contextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and * analyzes the resulting matrix via _math_matrix_analyse(). */ static void -calculate_model_project_matrix( GLcontext *ctx ) +calculate_model_project_matrix( struct gl_context *ctx ) { _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, ctx->ProjectionMatrixStack.Top, @@ -618,7 +618,7 @@ calculate_model_project_matrix( GLcontext *ctx ) * calculate_model_project_matrix() to recalculate the modelview-projection * matrix. */ -void _mesa_update_modelview_project( GLcontext *ctx, GLuint new_state ) +void _mesa_update_modelview_project( struct gl_context *ctx, GLuint new_state ) { if (new_state & _NEW_MODELVIEW) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); @@ -712,7 +712,7 @@ free_matrix_stack( struct gl_matrix_stack *stack ) * Initializes each of the matrix stacks and the combined modelview-projection * matrix. */ -void _mesa_init_matrix( GLcontext * ctx ) +void _mesa_init_matrix( struct gl_context * ctx ) { GLint i; @@ -742,7 +742,7 @@ void _mesa_init_matrix( GLcontext * ctx ) * Frees each of the matrix stacks and the combined modelview-projection * matrix. */ -void _mesa_free_matrix_data( GLcontext *ctx ) +void _mesa_free_matrix_data( struct gl_context *ctx ) { GLint i; @@ -765,7 +765,7 @@ void _mesa_free_matrix_data( GLcontext *ctx ) * * \todo Move this to a new file with other 'transform' routines. */ -void _mesa_init_transform( GLcontext *ctx ) +void _mesa_init_transform( struct gl_context *ctx ) { GLint i; diff --git a/src/mesa/main/matrix.h b/src/mesa/main/matrix.h index a53d1045c7..38fd235b11 100644 --- a/src/mesa/main/matrix.h +++ b/src/mesa/main/matrix.h @@ -97,16 +97,16 @@ _mesa_MultTransposeMatrixdARB( const GLdouble *m ); extern void -_mesa_init_matrix( GLcontext * ctx ); +_mesa_init_matrix( struct gl_context * ctx ); extern void -_mesa_init_transform( GLcontext *ctx ); +_mesa_init_transform( struct gl_context *ctx ); extern void -_mesa_free_matrix_data( GLcontext *ctx ); +_mesa_free_matrix_data( struct gl_context *ctx ); extern void -_mesa_update_modelview_project( GLcontext *ctx, GLuint newstate ); +_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate ); #endif diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 3d1a4c49c4..d65aecdf3e 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1504,7 +1504,7 @@ next_mipmap_level_size(GLenum target, GLint border, * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP. */ void -_mesa_generate_mipmap(GLcontext *ctx, GLenum target, +_mesa_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { const struct gl_texture_image *srcImage; diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index 22094c3437..4c7ee635ae 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -42,7 +42,7 @@ _mesa_generate_mipmap_level(GLenum target, extern void -_mesa_generate_mipmap(GLcontext *ctx, GLenum target, +_mesa_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 806a19d02a..aace09d6ef 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -123,8 +123,8 @@ struct gl_program_cache; struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; +struct gl_context; struct st_context; -typedef struct __GLcontextRec GLcontext; /*@}*/ @@ -2324,38 +2324,38 @@ struct gl_renderbuffer void (*Delete)(struct gl_renderbuffer *rb); /* Allocate new storage for this renderbuffer */ - GLboolean (*AllocStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, + GLboolean (*AllocStorage)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height); /* Lock/Unlock are called before/after calling the Get/Put functions. * Not sure this is the right place for these yet. - void (*Lock)(GLcontext *ctx, struct gl_renderbuffer *rb); - void (*Unlock)(GLcontext *ctx, struct gl_renderbuffer *rb); + void (*Lock)(struct gl_context *ctx, struct gl_renderbuffer *rb); + void (*Unlock)(struct gl_context *ctx, struct gl_renderbuffer *rb); */ /* Return a pointer to the element/pixel at (x,y). * Should return NULL if the buffer memory can't be directly addressed. */ - void *(*GetPointer)(GLcontext *ctx, struct gl_renderbuffer *rb, + void *(*GetPointer)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y); /* Get/Read a row of values. * The values will be of format _BaseFormat and type DataType. */ - void (*GetRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + void (*GetRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values); /* Get/Read values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ - void (*GetValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + void (*GetValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values); /* Put/Write a row of values. * The values will be of format _BaseFormat and type DataType. */ - void (*PutRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + void (*PutRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask); /* Put/Write a row of RGB values. This is a special-case routine that's @@ -2363,26 +2363,26 @@ struct gl_renderbuffer * a common case for glDrawPixels and some triangle routines. * The values will be of format GL_RGB and type DataType. */ - void (*PutRowRGB)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + void (*PutRowRGB)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask); /* Put/Write a row of identical values. * The values will be of format _BaseFormat and type DataType. */ - void (*PutMonoRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + void (*PutMonoRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask); /* Put/Write values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ - void (*PutValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + void (*PutValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask); /* Put/Write identical values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ - void (*PutMonoValues)(GLcontext *ctx, struct gl_renderbuffer *rb, + void (*PutMonoValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask); }; @@ -2787,7 +2787,7 @@ struct gl_matrix_stack /** * \name Bits for image transfer operations - * \sa __GLcontextRec::ImageTransferState. + * \sa __struct gl_contextRec::ImageTransferState. */ /*@{*/ #define IMAGE_SCALE_BIAS_BIT 0x1 @@ -2807,34 +2807,34 @@ struct gl_matrix_stack * 4 unused flags. */ /*@{*/ -#define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */ -#define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */ -#define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */ -#define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */ -#define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */ -#define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */ -#define _NEW_EVAL 0x80 /**< __GLcontextRec::Eval, __GLcontextRec::EvalMap */ -#define _NEW_FOG 0x100 /**< __GLcontextRec::Fog */ -#define _NEW_HINT 0x200 /**< __GLcontextRec::Hint */ -#define _NEW_LIGHT 0x400 /**< __GLcontextRec::Light */ -#define _NEW_LINE 0x800 /**< __GLcontextRec::Line */ -#define _NEW_PIXEL 0x1000 /**< __GLcontextRec::Pixel */ -#define _NEW_POINT 0x2000 /**< __GLcontextRec::Point */ -#define _NEW_POLYGON 0x4000 /**< __GLcontextRec::Polygon */ -#define _NEW_POLYGONSTIPPLE 0x8000 /**< __GLcontextRec::PolygonStipple */ -#define _NEW_SCISSOR 0x10000 /**< __GLcontextRec::Scissor */ -#define _NEW_STENCIL 0x20000 /**< __GLcontextRec::Stencil */ -#define _NEW_TEXTURE 0x40000 /**< __GLcontextRec::Texture */ -#define _NEW_TRANSFORM 0x80000 /**< __GLcontextRec::Transform */ -#define _NEW_VIEWPORT 0x100000 /**< __GLcontextRec::Viewport */ -#define _NEW_PACKUNPACK 0x200000 /**< __GLcontextRec::Pack, __GLcontextRec::Unpack */ -#define _NEW_ARRAY 0x400000 /**< __GLcontextRec::Array */ -#define _NEW_RENDERMODE 0x800000 /**< __GLcontextRec::RenderMode, __GLcontextRec::Feedback, __GLcontextRec::Select */ -#define _NEW_BUFFERS 0x1000000 /**< __GLcontextRec::Visual, __GLcontextRec::DrawBuffer, */ -#define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */ -#define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */ -#define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ -#define _NEW_CURRENT_ATTRIB 0x10000000 /**< __GLcontextRec::Current */ +#define _NEW_MODELVIEW 0x1 /**< __struct gl_contextRec::ModelView */ +#define _NEW_PROJECTION 0x2 /**< __struct gl_contextRec::Projection */ +#define _NEW_TEXTURE_MATRIX 0x4 /**< __struct gl_contextRec::TextureMatrix */ +#define _NEW_ACCUM 0x10 /**< __struct gl_contextRec::Accum */ +#define _NEW_COLOR 0x20 /**< __struct gl_contextRec::Color */ +#define _NEW_DEPTH 0x40 /**< __struct gl_contextRec::Depth */ +#define _NEW_EVAL 0x80 /**< __struct gl_contextRec::Eval, __struct gl_contextRec::EvalMap */ +#define _NEW_FOG 0x100 /**< __struct gl_contextRec::Fog */ +#define _NEW_HINT 0x200 /**< __struct gl_contextRec::Hint */ +#define _NEW_LIGHT 0x400 /**< __struct gl_contextRec::Light */ +#define _NEW_LINE 0x800 /**< __struct gl_contextRec::Line */ +#define _NEW_PIXEL 0x1000 /**< __struct gl_contextRec::Pixel */ +#define _NEW_POINT 0x2000 /**< __struct gl_contextRec::Point */ +#define _NEW_POLYGON 0x4000 /**< __struct gl_contextRec::Polygon */ +#define _NEW_POLYGONSTIPPLE 0x8000 /**< __struct gl_contextRec::PolygonStipple */ +#define _NEW_SCISSOR 0x10000 /**< __struct gl_contextRec::Scissor */ +#define _NEW_STENCIL 0x20000 /**< __struct gl_contextRec::Stencil */ +#define _NEW_TEXTURE 0x40000 /**< __struct gl_contextRec::Texture */ +#define _NEW_TRANSFORM 0x80000 /**< __struct gl_contextRec::Transform */ +#define _NEW_VIEWPORT 0x100000 /**< __struct gl_contextRec::Viewport */ +#define _NEW_PACKUNPACK 0x200000 /**< __struct gl_contextRec::Pack, __struct gl_contextRec::Unpack */ +#define _NEW_ARRAY 0x400000 /**< __struct gl_contextRec::Array */ +#define _NEW_RENDERMODE 0x800000 /**< __struct gl_contextRec::RenderMode, __struct gl_contextRec::Feedback, __struct gl_contextRec::Select */ +#define _NEW_BUFFERS 0x1000000 /**< __struct gl_contextRec::Visual, __struct gl_contextRec::DrawBuffer, */ +#define _NEW_MULTISAMPLE 0x2000000 /**< __struct gl_contextRec::Multisample */ +#define _NEW_TRACK_MATRIX 0x4000000 /**< __struct gl_contextRec::VertexProgram */ +#define _NEW_PROGRAM 0x8000000 /**< __struct gl_contextRec::VertexProgram */ +#define _NEW_CURRENT_ATTRIB 0x10000000 /**< __struct gl_contextRec::Current */ #define _NEW_PROGRAM_CONSTANTS 0x20000000 #define _NEW_BUFFER_OBJECT 0x40000000 #define _NEW_ALL ~0 @@ -2877,7 +2877,7 @@ struct gl_matrix_stack /** * \name A bunch of flags that we think might be useful to drivers. * - * Set in the __GLcontextRec::_TriangleCaps bitfield. + * Set in the __struct gl_contextRec::_TriangleCaps bitfield. */ /*@{*/ #define DD_FLATSHADE 0x1 @@ -3045,9 +3045,9 @@ typedef enum { * Think of this as a base class from which device drivers will derive * sub classes. * - * The GLcontext typedef names this structure. + * The struct gl_context typedef names this structure. */ -struct __GLcontextRec +struct gl_context { /** State possibly shared with other contexts in the address space */ struct gl_shared_state *Shared; diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 01b68df7af..5487d45f56 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -50,7 +50,7 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) * \param ctx the GL context. */ void -_mesa_init_multisample(GLcontext *ctx) +_mesa_init_multisample(struct gl_context *ctx) { ctx->Multisample.Enabled = GL_TRUE; ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h index 998488ef42..c7cc432daa 100644 --- a/src/mesa/main/multisample.h +++ b/src/mesa/main/multisample.h @@ -33,7 +33,7 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); extern void -_mesa_init_multisample(GLcontext *ctx); +_mesa_init_multisample(struct gl_context *ctx); #endif diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index 3a570b7dda..833bf916ec 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -511,7 +511,7 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) } void -_mesa_emit_nv_temp_initialization(GLcontext *ctx, +_mesa_emit_nv_temp_initialization(struct gl_context *ctx, struct gl_program *program) { struct prog_instruction *inst; @@ -559,7 +559,7 @@ _mesa_emit_nv_temp_initialization(GLcontext *ctx, } void -_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program) +_mesa_setup_nv_temporary_count(struct gl_context *ctx, struct gl_program *program) { GLuint i; diff --git a/src/mesa/main/nvprogram.h b/src/mesa/main/nvprogram.h index 260a25ba9e..035f2fe242 100644 --- a/src/mesa/main/nvprogram.h +++ b/src/mesa/main/nvprogram.h @@ -106,10 +106,10 @@ _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); extern void -_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program); +_mesa_setup_nv_temporary_count(struct gl_context *ctx, struct gl_program *program); extern void -_mesa_emit_nv_temp_initialization(GLcontext *ctx, +_mesa_emit_nv_temp_initialization(struct gl_context *ctx, struct gl_program *program); #endif diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 1d378e4d9f..5f824b3429 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -69,7 +69,7 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) * Return pointer to a pixelmap by name. */ static struct gl_pixelmap * -get_pixelmap(GLcontext *ctx, GLenum map) +get_pixelmap(struct gl_context *ctx, GLenum map) { switch (map) { case GL_PIXEL_MAP_I_TO_I: @@ -102,7 +102,7 @@ get_pixelmap(GLcontext *ctx, GLenum map) * Helper routine used by the other _mesa_PixelMap() functions. */ static void -store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, +store_pixelmap(struct gl_context *ctx, GLenum map, GLsizei mapsize, const GLfloat *values) { GLint i; @@ -143,7 +143,7 @@ store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, * Convenience wrapper for _mesa_validate_pbo_access() for gl[Get]PixelMap(). */ static GLboolean -validate_pbo_access(GLcontext *ctx, struct gl_pixelstore_attrib *pack, +validate_pbo_access(struct gl_context *ctx, struct gl_pixelstore_attrib *pack, GLsizei mapsize, GLenum format, GLenum type, const GLvoid *ptr) { @@ -590,7 +590,7 @@ _mesa_PixelTransferi( GLenum pname, GLint param ) * pixel transfer operations are enabled. */ static void -update_image_transfer_state(GLcontext *ctx) +update_image_transfer_state(struct gl_context *ctx) { GLuint mask = 0; @@ -613,7 +613,7 @@ update_image_transfer_state(GLcontext *ctx) /** * Update mesa pixel transfer derived state. */ -void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) +void _mesa_update_pixel( struct gl_context *ctx, GLuint new_state ) { if (new_state & _MESA_NEW_TRANSFER_STATE) update_image_transfer_state(ctx); @@ -655,7 +655,7 @@ init_pixelmap(struct gl_pixelmap *map) * Initialize the context's PIXEL attribute group. */ void -_mesa_init_pixel( GLcontext *ctx ) +_mesa_init_pixel( struct gl_context *ctx ) { /* Pixel group */ ctx->Pixel.RedBias = 0.0; diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index f4d3f1efdb..03560835a8 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -39,7 +39,7 @@ #if FEATURE_pixel_transfer extern void -_mesa_update_pixel( GLcontext *ctx, GLuint newstate ); +_mesa_update_pixel( struct gl_context *ctx, GLuint newstate ); extern void _mesa_init_pixel_dispatch( struct _glapi_table * disp ); @@ -47,7 +47,7 @@ _mesa_init_pixel_dispatch( struct _glapi_table * disp ); #else /* FEATURE_pixel_transfer */ static INLINE void -_mesa_update_pixel(GLcontext *ctx, GLuint newstate) +_mesa_update_pixel(struct gl_context *ctx, GLuint newstate) { } @@ -60,7 +60,7 @@ _mesa_init_pixel_dispatch(struct _glapi_table *disp) extern void -_mesa_init_pixel( GLcontext * ctx ); +_mesa_init_pixel( struct gl_context * ctx ); /*@}*/ diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c index ec585ef0cc..b16d27a4ea 100644 --- a/src/mesa/main/pixelstore.c +++ b/src/mesa/main/pixelstore.c @@ -228,7 +228,7 @@ _mesa_PixelStoref( GLenum pname, GLfloat param ) * Initialize the context's pixel store state. */ void -_mesa_init_pixelstore( GLcontext *ctx ) +_mesa_init_pixelstore( struct gl_context *ctx ) { /* Pixel transfer */ ctx->Pack.Alignment = 4; diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h index 47bff4276d..cdef7de261 100644 --- a/src/mesa/main/pixelstore.h +++ b/src/mesa/main/pixelstore.h @@ -45,7 +45,7 @@ _mesa_PixelStoref( GLenum pname, GLfloat param ); extern void -_mesa_init_pixelstore( GLcontext *ctx ); +_mesa_init_pixelstore( struct gl_context *ctx ); #endif diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index eab9d13d6d..87bfae27eb 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -245,11 +245,11 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) * * \param ctx GL context. * - * Initializes __GLcontextRec::Point and point related constants in - * __GLcontextRec::Const. + * Initializes __struct gl_contextRec::Point and point related constants in + * __struct gl_contextRec::Const. */ void -_mesa_init_point(GLcontext *ctx) +_mesa_init_point(struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h index 156641eab9..b222379b1b 100644 --- a/src/mesa/main/points.h +++ b/src/mesa/main/points.h @@ -51,7 +51,7 @@ extern void GLAPIENTRY _mesa_PointParameterfv( GLenum pname, const GLfloat *params ); extern void -_mesa_init_point( GLcontext * ctx ); +_mesa_init_point( struct gl_context * ctx ); #endif diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 30e4a606bb..970020048d 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -190,7 +190,7 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) * too. */ void -_mesa_polygon_stipple(GLcontext *ctx, const GLubyte *pattern) +_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern) { pattern = _mesa_map_validate_pbo_source(ctx, 2, &ctx->Unpack, 32, 32, 1, @@ -293,10 +293,10 @@ _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) * * \param ctx GL context. * - * Initializes __GLcontextRec::Polygon and __GLcontextRec::PolygonStipple + * Initializes __struct gl_contextRec::Polygon and __struct gl_contextRec::PolygonStipple * attribute groups. */ -void _mesa_init_polygon( GLcontext * ctx ) +void _mesa_init_polygon( struct gl_context * ctx ) { /* Polygon group */ ctx->Polygon.CullFlag = GL_FALSE; diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h index 78e8394d05..ad0ac4cc3a 100644 --- a/src/mesa/main/polygon.h +++ b/src/mesa/main/polygon.h @@ -36,7 +36,7 @@ extern void -_mesa_polygon_stipple(GLcontext *ctx, const GLubyte *pattern); +_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern); extern void GLAPIENTRY @@ -61,6 +61,6 @@ extern void GLAPIENTRY _mesa_GetPolygonStipple( GLubyte *mask ); extern void -_mesa_init_polygon( GLcontext * ctx ); +_mesa_init_polygon( struct gl_context * ctx ); #endif diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index a907dac836..8874397720 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -43,7 +43,7 @@ * \return pointer to new query_object object or NULL if out of memory. */ static struct gl_query_object * -_mesa_new_query_object(GLcontext *ctx, GLuint id) +_mesa_new_query_object(struct gl_context *ctx, GLuint id) { struct gl_query_object *q = MALLOC_STRUCT(gl_query_object); (void) ctx; @@ -62,7 +62,7 @@ _mesa_new_query_object(GLcontext *ctx, GLuint id) * Called via ctx->Driver.BeginQuery(). */ static void -_mesa_begin_query(GLcontext *ctx, struct gl_query_object *q) +_mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q) { /* no-op */ } @@ -73,7 +73,7 @@ _mesa_begin_query(GLcontext *ctx, struct gl_query_object *q) * Called via ctx->Driver.EndQuery(). */ static void -_mesa_end_query(GLcontext *ctx, struct gl_query_object *q) +_mesa_end_query(struct gl_context *ctx, struct gl_query_object *q) { q->Ready = GL_TRUE; } @@ -84,7 +84,7 @@ _mesa_end_query(GLcontext *ctx, struct gl_query_object *q) * Called via ctx->Driver.WaitQuery(). */ static void -_mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) +_mesa_wait_query(struct gl_context *ctx, struct gl_query_object *q) { /* For software drivers, _mesa_end_query() should have completed the query. * For real hardware, implement a proper WaitQuery() driver function, @@ -99,7 +99,7 @@ _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) * Called via ctx->Driver.CheckQuery(). */ static void -_mesa_check_query(GLcontext *ctx, struct gl_query_object *q) +_mesa_check_query(struct gl_context *ctx, struct gl_query_object *q) { /* No-op for sw rendering. * HW drivers may need to flush at this time. @@ -112,7 +112,7 @@ _mesa_check_query(GLcontext *ctx, struct gl_query_object *q) * Not removed from hash table here. */ static void -_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q) +_mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q) { free(q); } @@ -135,7 +135,7 @@ _mesa_init_query_object_functions(struct dd_function_table *driver) * \return NULL if invalid target, else the address of binding point */ static struct gl_query_object ** -get_query_binding_point(GLcontext *ctx, GLenum target) +get_query_binding_point(struct gl_context *ctx, GLenum target) { switch (target) { case GL_SAMPLES_PASSED_ARB: @@ -535,7 +535,7 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp) * Allocate/init the context state related to query objects. */ void -_mesa_init_queryobj(GLcontext *ctx) +_mesa_init_queryobj(struct gl_context *ctx) { ctx->Query.QueryObjects = _mesa_NewHashTable(); ctx->Query.CurrentOcclusionObject = NULL; @@ -549,7 +549,7 @@ static void delete_queryobj_cb(GLuint id, void *data, void *userData) { struct gl_query_object *q= (struct gl_query_object *) data; - GLcontext *ctx = (GLcontext *)userData; + struct gl_context *ctx = (struct gl_context *)userData; ctx->Driver.DeleteQuery(ctx, q); } @@ -558,7 +558,7 @@ delete_queryobj_cb(GLuint id, void *data, void *userData) * Free the context state related to query objects. */ void -_mesa_free_queryobj_data(GLcontext *ctx) +_mesa_free_queryobj_data(struct gl_context *ctx) { _mesa_HashDeleteAll(ctx->Query.QueryObjects, delete_queryobj_cb, ctx); _mesa_DeleteHashTable(ctx->Query.QueryObjects); diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index 8746ed15e9..e289625731 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -34,7 +34,7 @@ #if FEATURE_queryobj static INLINE struct gl_query_object * -_mesa_lookup_query_object(GLcontext *ctx, GLuint id) +_mesa_lookup_query_object(struct gl_context *ctx, GLuint id) { return (struct gl_query_object *) _mesa_HashLookup(ctx->Query.QueryObjects, id); @@ -68,7 +68,7 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp); #else /* FEATURE_queryobj */ static INLINE struct gl_query_object * -_mesa_lookup_query_object(GLcontext *ctx, GLuint id) +_mesa_lookup_query_object(struct gl_context *ctx, GLuint id) { return NULL; } @@ -86,10 +86,10 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp) #endif /* FEATURE_queryobj */ extern void -_mesa_init_queryobj(GLcontext *ctx); +_mesa_init_queryobj(struct gl_context *ctx); extern void -_mesa_free_queryobj_data(GLcontext *ctx); +_mesa_free_queryobj_data(struct gl_context *ctx); #endif /* QUERYOBJ_H */ diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 75c67f2693..6f52f07dfa 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -545,10 +545,10 @@ _mesa_init_rastpos_dispatch(struct _glapi_table *disp) * \param ctx GL context. * * Initialize the current raster position information in - * __GLcontextRec::Current, and adds the extension entry points to the + * __struct gl_contextRec::Current, and adds the extension entry points to the * dispatcher. */ -void _mesa_init_rastpos( GLcontext * ctx ) +void _mesa_init_rastpos( struct gl_context * ctx ) { int i; diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h index 4994616d40..9b508eaedf 100644 --- a/src/mesa/main/rastpos.h +++ b/src/mesa/main/rastpos.h @@ -50,7 +50,7 @@ _mesa_init_rastpos_dispatch(struct _glapi_table *disp) #endif /* FEATURE_rastpos */ extern void -_mesa_init_rastpos(GLcontext *ctx); +_mesa_init_rastpos(struct gl_context *ctx); /*@}*/ diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index bb3fb9eb66..0043c8adc4 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -40,7 +40,7 @@ * \return GL_TRUE if error detected, GL_FALSE if no errors */ GLboolean -_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, +_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type, GLboolean drawing) { const char *readDraw = drawing ? "Draw" : "Read"; diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h index 1bf02fb8e4..0753e619fe 100644 --- a/src/mesa/main/readpix.h +++ b/src/mesa/main/readpix.h @@ -31,7 +31,7 @@ extern GLboolean -_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, +_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type, GLboolean drawing); extern void GLAPIENTRY diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 118fb52bb2..dc8bc74787 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -61,7 +61,7 @@ */ static void * -get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, +get_pointer_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) @@ -75,7 +75,7 @@ get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLubyte *src = (const GLubyte *) rb->Data + y * rb->Width + x; @@ -85,7 +85,7 @@ get_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -get_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLubyte *dst = (GLubyte *) values; @@ -99,7 +99,7 @@ get_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; @@ -120,7 +120,7 @@ put_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLubyte val = *((const GLubyte *) value); @@ -144,7 +144,7 @@ put_mono_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -161,7 +161,7 @@ put_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -183,7 +183,7 @@ put_mono_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, */ static void * -get_pointer_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, +get_pointer_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) @@ -195,7 +195,7 @@ get_pointer_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const void *src = rb->GetPointer(ctx, rb, x, y); @@ -205,7 +205,7 @@ get_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -get_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLushort *dst = (GLushort *) values; @@ -219,7 +219,7 @@ get_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLushort *src = (const GLushort *) values; @@ -240,7 +240,7 @@ put_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLushort val = *((const GLushort *) value); @@ -264,7 +264,7 @@ put_mono_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -281,7 +281,7 @@ put_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, +put_mono_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -312,7 +312,7 @@ put_mono_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, */ static void * -get_pointer_uint(GLcontext *ctx, struct gl_renderbuffer *rb, +get_pointer_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) @@ -324,7 +324,7 @@ get_pointer_uint(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const void *src = rb->GetPointer(ctx, rb, x, y); @@ -335,7 +335,7 @@ get_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -get_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLuint *dst = (GLuint *) values; @@ -350,7 +350,7 @@ get_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLuint *src = (const GLuint *) values; @@ -372,7 +372,7 @@ put_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLuint val = *((const GLuint *) value); @@ -397,7 +397,7 @@ put_mono_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -415,7 +415,7 @@ put_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -440,7 +440,7 @@ put_mono_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, */ static void * -get_pointer_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, +get_pointer_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { ASSERT(rb->Format == MESA_FORMAT_RGB888); @@ -452,7 +452,7 @@ get_pointer_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x); @@ -470,7 +470,7 @@ get_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -get_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLubyte *dst = (GLubyte *) values; @@ -489,7 +489,7 @@ get_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* note: incoming values are RGB+A! */ @@ -509,7 +509,7 @@ put_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_rgb_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_rgb_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* note: incoming values are RGB+A! */ @@ -529,7 +529,7 @@ put_row_rgb_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { /* note: incoming value is RGB+A! */ @@ -557,7 +557,7 @@ put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -578,7 +578,7 @@ put_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, +put_mono_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -606,7 +606,7 @@ put_mono_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, */ static void * -get_pointer_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, +get_pointer_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) @@ -618,7 +618,7 @@ get_pointer_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x); @@ -629,7 +629,7 @@ get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -get_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { /* treat 4*GLubyte as 1*GLuint */ @@ -645,7 +645,7 @@ get_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* treat 4*GLubyte as 1*GLuint */ @@ -668,7 +668,7 @@ put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_rgb_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_rgb_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* Store RGB values in RGBA buffer */ @@ -689,7 +689,7 @@ put_row_rgb_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { /* treat 4*GLubyte as 1*GLuint */ @@ -722,7 +722,7 @@ put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -741,7 +741,7 @@ put_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, +put_mono_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -765,7 +765,7 @@ put_mono_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, */ static void * -get_pointer_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, +get_pointer_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) @@ -776,7 +776,7 @@ get_pointer_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLshort *src = (const GLshort *) rb->Data + 4 * (y * rb->Width + x); @@ -786,7 +786,7 @@ get_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -get_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +get_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLushort *dst = (GLushort *) values; @@ -801,7 +801,7 @@ get_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLushort *src = (const GLushort *) values; @@ -825,7 +825,7 @@ put_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_row_rgb_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_row_rgb_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* Put RGB values in RGBA buffer */ @@ -850,7 +850,7 @@ put_row_rgb_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_mono_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLushort val0 = ((const GLushort *) value)[0]; @@ -878,7 +878,7 @@ put_mono_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +put_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -898,7 +898,7 @@ put_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -put_mono_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, +put_mono_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -936,7 +936,7 @@ put_mono_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, * Get/PutValues functions. */ GLboolean -_mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -1145,7 +1145,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, static GLboolean -alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, +alloc_storage_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(arb != arb->Wrapped); @@ -1195,7 +1195,7 @@ delete_renderbuffer_alpha8(struct gl_renderbuffer *arb) static void * -get_pointer_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, +get_pointer_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLint x, GLint y) { return NULL; /* don't allow direct access! */ @@ -1203,7 +1203,7 @@ get_pointer_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, static void -get_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, +get_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, void *values) { /* NOTE: 'values' is RGBA format! */ @@ -1222,7 +1222,7 @@ get_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, static void -get_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, +get_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, const GLint x[], const GLint y[], void *values) { GLubyte *dst = (GLubyte *) values; @@ -1240,7 +1240,7 @@ get_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, static void -put_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, +put_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; @@ -1260,7 +1260,7 @@ put_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, static void -put_row_rgb_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, +put_row_rgb_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; @@ -1280,7 +1280,7 @@ put_row_rgb_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, static void -put_mono_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, +put_mono_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLubyte val = ((const GLubyte *) value)[3]; @@ -1305,7 +1305,7 @@ put_mono_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, static void -put_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, +put_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -1326,7 +1326,7 @@ put_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, static void -put_mono_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, +put_mono_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -1368,7 +1368,7 @@ copy_buffer_alpha8(struct gl_renderbuffer* dst, struct gl_renderbuffer* src) * direct buffer access is not supported. */ static void * -nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) +nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { return NULL; } @@ -1422,7 +1422,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name) * renderbuffers or window-system renderbuffers. */ struct gl_renderbuffer * -_mesa_new_renderbuffer(GLcontext *ctx, GLuint name) +_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name) { struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer); if (rb) { @@ -1453,7 +1453,7 @@ _mesa_delete_renderbuffer(struct gl_renderbuffer *rb) * This would not be used for hardware-based renderbuffers. */ struct gl_renderbuffer * -_mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name) +_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name) { struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name); if (rb) { @@ -1476,7 +1476,7 @@ _mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name) * rendering! */ GLboolean -_mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint rgbBits, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight) @@ -1540,7 +1540,7 @@ _mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, * rendering! */ GLboolean -_mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight) @@ -1624,7 +1624,7 @@ _mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, * copy the back buffer alpha channel into the front buffer alpha channel. */ void -_mesa_copy_soft_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb) +_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb) { if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer && fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer) @@ -1648,7 +1648,7 @@ _mesa_copy_soft_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb) * rendering! */ GLboolean -_mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint depthBits) { struct gl_renderbuffer *rb; @@ -1696,7 +1696,7 @@ _mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, * rendering! */ GLboolean -_mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint stencilBits) { struct gl_renderbuffer *rb; @@ -1735,7 +1735,7 @@ _mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, * rendering! */ GLboolean -_mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint redBits, GLuint greenBits, GLuint blueBits, GLuint alphaBits) { @@ -1776,7 +1776,7 @@ _mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, * NOTE: color-index aux buffers not supported. */ GLboolean -_mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint colorBits, GLuint numBuffers) { GLuint i; @@ -1990,7 +1990,7 @@ _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr, * \return new depth/stencil renderbuffer */ struct gl_renderbuffer * -_mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name) +_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name) { struct gl_renderbuffer *dsrb; diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h index bc92b26982..8791369dbe 100644 --- a/src/mesa/main/renderbuffer.h +++ b/src/mesa/main/renderbuffer.h @@ -36,52 +36,52 @@ extern void _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name); extern struct gl_renderbuffer * -_mesa_new_renderbuffer(GLcontext *ctx, GLuint name); +_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name); extern void _mesa_delete_renderbuffer(struct gl_renderbuffer *rb); extern struct gl_renderbuffer * -_mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name); +_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name); extern GLboolean -_mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height); extern GLboolean -_mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint rgbBits, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight); extern GLboolean -_mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight); extern void -_mesa_copy_soft_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb); +_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb); extern GLboolean -_mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint depthBits); extern GLboolean -_mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint stencilBits); extern GLboolean -_mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint redBits, GLuint greenBits, GLuint blueBits, GLuint alphaBits); extern GLboolean -_mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, +_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint bits, GLuint numBuffers); extern void @@ -105,7 +105,7 @@ _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr, struct gl_renderbuffer *rb); extern struct gl_renderbuffer * -_mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name); +_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name); #endif /* RENDERBUFFER_H */ diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c index 523f3c3ab8..4cf0bc2528 100644 --- a/src/mesa/main/scissor.c +++ b/src/mesa/main/scissor.c @@ -58,12 +58,12 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) * * \sa glScissor(). * - * Verifies the parameters and updates __GLcontextRec::Scissor. On a + * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a * change flushes the vertices and notifies the driver via * the dd_function_table::Scissor callback. */ void -_mesa_set_scissor(GLcontext *ctx, +_mesa_set_scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { if (x == ctx->Scissor.X && @@ -88,7 +88,7 @@ _mesa_set_scissor(GLcontext *ctx, * \param ctx the GL context. */ void -_mesa_init_scissor(GLcontext *ctx) +_mesa_init_scissor(struct gl_context *ctx) { /* Scissor group */ ctx->Scissor.Enabled = GL_FALSE; diff --git a/src/mesa/main/scissor.h b/src/mesa/main/scissor.h index b852a2122d..bd909019db 100644 --- a/src/mesa/main/scissor.h +++ b/src/mesa/main/scissor.h @@ -35,12 +35,12 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); extern void -_mesa_set_scissor(GLcontext *ctx, +_mesa_set_scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height); extern void -_mesa_init_scissor(GLcontext *ctx); +_mesa_init_scissor(struct gl_context *ctx); #endif diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index c25d2a1974..9a2a42e50e 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -89,7 +89,7 @@ get_shader_flags(void) * Initialize context's shader state. */ void -_mesa_init_shader_state(GLcontext *ctx) +_mesa_init_shader_state(struct gl_context *ctx) { /* Device drivers may override these to control what kind of instructions * are generated by the GLSL compiler. @@ -114,7 +114,7 @@ _mesa_init_shader_state(GLcontext *ctx) * Free the per-context shader-related state. */ void -_mesa_free_shader_state(GLcontext *ctx) +_mesa_free_shader_state(struct gl_context *ctx) { _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, NULL); } @@ -221,7 +221,7 @@ longest_feedback_varying_name(const struct gl_shader_program *shProg) static GLboolean -is_program(GLcontext *ctx, GLuint name) +is_program(struct gl_context *ctx, GLuint name) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name); return shProg ? GL_TRUE : GL_FALSE; @@ -229,7 +229,7 @@ is_program(GLcontext *ctx, GLuint name) static GLboolean -is_shader(GLcontext *ctx, GLuint name) +is_shader(struct gl_context *ctx, GLuint name) { struct gl_shader *shader = _mesa_lookup_shader(ctx, name); return shader ? GL_TRUE : GL_FALSE; @@ -240,7 +240,7 @@ is_shader(GLcontext *ctx, GLuint name) * Attach shader to a shader program. */ static void -attach_shader(GLcontext *ctx, GLuint program, GLuint shader) +attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) { struct gl_shader_program *shProg; struct gl_shader *sh; @@ -287,7 +287,7 @@ attach_shader(GLcontext *ctx, GLuint program, GLuint shader) static GLint -get_attrib_location(GLcontext *ctx, GLuint program, const GLchar *name) +get_attrib_location(struct gl_context *ctx, GLuint program, const GLchar *name) { struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation"); @@ -320,7 +320,7 @@ get_attrib_location(GLcontext *ctx, GLuint program, const GLchar *name) static void -bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, +bind_attrib_location(struct gl_context *ctx, GLuint program, GLuint index, const GLchar *name) { struct gl_shader_program *shProg; @@ -371,7 +371,7 @@ bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, static GLuint -create_shader(GLcontext *ctx, GLenum type) +create_shader(struct gl_context *ctx, GLenum type) { struct gl_shader *sh; GLuint name; @@ -396,7 +396,7 @@ create_shader(GLcontext *ctx, GLenum type) static GLuint -create_shader_program(GLcontext *ctx) +create_shader_program(struct gl_context *ctx) { GLuint name; struct gl_shader_program *shProg; @@ -418,7 +418,7 @@ create_shader_program(GLcontext *ctx) * DeleteProgramARB. */ static void -delete_shader_program(GLcontext *ctx, GLuint name) +delete_shader_program(struct gl_context *ctx, GLuint name) { /* * NOTE: deleting shaders/programs works a bit differently than @@ -442,7 +442,7 @@ delete_shader_program(GLcontext *ctx, GLuint name) static void -delete_shader(GLcontext *ctx, GLuint shader) +delete_shader(struct gl_context *ctx, GLuint shader) { struct gl_shader *sh; @@ -458,7 +458,7 @@ delete_shader(GLcontext *ctx, GLuint shader) static void -detach_shader(GLcontext *ctx, GLuint program, GLuint shader) +detach_shader(struct gl_context *ctx, GLuint program, GLuint shader) { struct gl_shader_program *shProg; GLuint n; @@ -526,7 +526,7 @@ detach_shader(GLcontext *ctx, GLuint program, GLuint shader) static void -get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, +get_active_attrib(struct gl_context *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) { @@ -561,7 +561,7 @@ get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, * Return list of shaders attached to shader program. */ static void -get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, +get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj) { struct gl_shader_program *shProg = @@ -581,7 +581,7 @@ get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, * glGetHandleARB() - return ID/name of currently bound shader program. */ static GLuint -get_handle(GLcontext *ctx, GLenum pname) +get_handle(struct gl_context *ctx, GLenum pname) { if (pname == GL_PROGRAM_OBJECT_ARB) { if (ctx->Shader.CurrentProgram) @@ -602,7 +602,7 @@ get_handle(GLcontext *ctx, GLenum pname) * programs (see glGetProgramivARB). */ static void -get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) +get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *params) { const struct gl_program_parameter_list *attribs; struct gl_shader_program *shProg @@ -684,7 +684,7 @@ get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) * glGetShaderiv() - get GLSL shader state */ static void -get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) +get_shaderiv(struct gl_context *ctx, GLuint name, GLenum pname, GLint *params) { struct gl_shader *shader = _mesa_lookup_shader_err(ctx, name, "glGetShaderiv"); @@ -717,7 +717,7 @@ get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) static void -get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, +get_program_info_log(struct gl_context *ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { struct gl_shader_program *shProg @@ -731,7 +731,7 @@ get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, static void -get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, +get_shader_info_log(struct gl_context *ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); @@ -747,7 +747,7 @@ get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, * Return shader source code. */ static void -get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, +get_shader_source(struct gl_context *ctx, GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *sourceOut) { struct gl_shader *sh; @@ -763,7 +763,7 @@ get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, * Set/replace shader source code. */ static void -shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) +shader_source(struct gl_context *ctx, GLuint shader, const GLchar *source) { struct gl_shader *sh; @@ -787,7 +787,7 @@ shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) * Compile a shader. */ static void -compile_shader(GLcontext *ctx, GLuint shaderObj) +compile_shader(struct gl_context *ctx, GLuint shaderObj) { struct gl_shader *sh; struct gl_shader_compiler_options *options; @@ -812,7 +812,7 @@ compile_shader(GLcontext *ctx, GLuint shaderObj) * Link a program's shaders. */ static void -link_program(GLcontext *ctx, GLuint program) +link_program(struct gl_context *ctx, GLuint program) { struct gl_shader_program *shProg; struct gl_transform_feedback_object *obj = @@ -888,7 +888,7 @@ print_shader_info(const struct gl_shader_program *shProg) * Use the named shader program for subsequent rendering. */ void -_mesa_use_program(GLcontext *ctx, GLuint program) +_mesa_use_program(struct gl_context *ctx, GLuint program) { struct gl_shader_program *shProg; struct gl_transform_feedback_object *obj = @@ -943,7 +943,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program) * \return GL_TRUE if valid, GL_FALSE if invalid */ static GLboolean -validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg) +validate_samplers(struct gl_context *ctx, const struct gl_program *prog, char *errMsg) { static const char *targetName[] = { "TEXTURE_2D_ARRAY", @@ -995,7 +995,7 @@ validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg) * \return GL_TRUE if valid, GL_FALSE if invalid (and set errMsg) */ static GLboolean -validate_shader_program(GLcontext *ctx, +validate_shader_program(struct gl_context *ctx, const struct gl_shader_program *shProg, char *errMsg) { @@ -1041,7 +1041,7 @@ validate_shader_program(GLcontext *ctx, * Called via glValidateProgram() */ static void -validate_program(GLcontext *ctx, GLuint program) +validate_program(struct gl_context *ctx, GLuint program) { struct gl_shader_program *shProg; char errMsg[100]; diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h index 16e22530de..b55d7ca8b2 100644 --- a/src/mesa/main/shaderapi.h +++ b/src/mesa/main/shaderapi.h @@ -39,7 +39,7 @@ _mesa_copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src); extern void -_mesa_use_program(GLcontext *ctx, GLuint program); +_mesa_use_program(struct gl_context *ctx, GLuint program); extern void diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 2de8f27981..e0ffa2f289 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -50,7 +50,7 @@ * Then set ptr to point to sh, incrementing its refcount. */ void -_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, +_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, struct gl_shader *sh) { assert(ptr); @@ -88,7 +88,7 @@ _mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, } void -_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader) +_mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader) { shader->RefCount = 1; } @@ -98,7 +98,7 @@ _mesa_init_shader(GLcontext *ctx, struct gl_shader *shader) * Called via ctx->Driver.NewShader() */ struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) +_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) { struct gl_shader *shader; assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER || @@ -118,7 +118,7 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) * Called via ctx->Driver.DeleteShader(). */ static void -_mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh) +_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh) { if (sh->Source) free((void *) sh->Source); @@ -131,7 +131,7 @@ _mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh) * Lookup a GLSL shader object. */ struct gl_shader * -_mesa_lookup_shader(GLcontext *ctx, GLuint name) +_mesa_lookup_shader(struct gl_context *ctx, GLuint name) { if (name) { struct gl_shader *sh = (struct gl_shader *) @@ -153,7 +153,7 @@ _mesa_lookup_shader(GLcontext *ctx, GLuint name) * As above, but record an error if shader is not found. */ struct gl_shader * -_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller) +_mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller) { if (!name) { _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller); @@ -188,7 +188,7 @@ _mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller) * Then set ptr to point to shProg, incrementing its refcount. */ void -_mesa_reference_shader_program(GLcontext *ctx, +_mesa_reference_shader_program(struct gl_context *ctx, struct gl_shader_program **ptr, struct gl_shader_program *shProg) { @@ -230,7 +230,7 @@ _mesa_reference_shader_program(GLcontext *ctx, } void -_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog) +_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog) { prog->Type = GL_SHADER_PROGRAM_MESA; prog->RefCount = 1; @@ -247,7 +247,7 @@ _mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog) * Called via ctx->Driver.NewShaderProgram() */ static struct gl_shader_program * -_mesa_new_shader_program(GLcontext *ctx, GLuint name) +_mesa_new_shader_program(struct gl_context *ctx, GLuint name) { struct gl_shader_program *shProg; shProg = talloc_zero(NULL, struct gl_shader_program); @@ -263,7 +263,7 @@ _mesa_new_shader_program(GLcontext *ctx, GLuint name) * Clear (free) the shader program state that gets produced by linking. */ void -_mesa_clear_shader_program_data(GLcontext *ctx, +_mesa_clear_shader_program_data(struct gl_context *ctx, struct gl_shader_program *shProg) { _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); @@ -287,7 +287,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, * object itself. */ void -_mesa_free_shader_program_data(GLcontext *ctx, +_mesa_free_shader_program_data(struct gl_context *ctx, struct gl_shader_program *shProg) { GLuint i; @@ -338,7 +338,7 @@ _mesa_free_shader_program_data(GLcontext *ctx, * Called via ctx->Driver.DeleteShaderProgram(). */ static void -_mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) +_mesa_delete_shader_program(struct gl_context *ctx, struct gl_shader_program *shProg) { _mesa_free_shader_program_data(ctx, shProg); @@ -350,7 +350,7 @@ _mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) * Lookup a GLSL program object. */ struct gl_shader_program * -_mesa_lookup_shader_program(GLcontext *ctx, GLuint name) +_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name) { struct gl_shader_program *shProg; if (name) { @@ -373,7 +373,7 @@ _mesa_lookup_shader_program(GLcontext *ctx, GLuint name) * As above, but record an error if program is not found. */ struct gl_shader_program * -_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name, +_mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name, const char *caller) { if (!name) { diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index cbe7ae7b06..cf1b4c27bd 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -39,50 +39,50 @@ extern "C" { */ extern void -_mesa_init_shader_state(GLcontext * ctx); +_mesa_init_shader_state(struct gl_context * ctx); extern void -_mesa_free_shader_state(GLcontext *ctx); +_mesa_free_shader_state(struct gl_context *ctx); extern void -_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, +_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, struct gl_shader *sh); extern struct gl_shader * -_mesa_lookup_shader(GLcontext *ctx, GLuint name); +_mesa_lookup_shader(struct gl_context *ctx, GLuint name); extern struct gl_shader * -_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller); +_mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller); extern void -_mesa_reference_shader_program(GLcontext *ctx, +_mesa_reference_shader_program(struct gl_context *ctx, struct gl_shader_program **ptr, struct gl_shader_program *shProg); extern void -_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader); +_mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader); extern struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); +_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); extern void -_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog); +_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog); extern struct gl_shader_program * -_mesa_lookup_shader_program(GLcontext *ctx, GLuint name); +_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name); extern struct gl_shader_program * -_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name, +_mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name, const char *caller); extern void -_mesa_clear_shader_program_data(GLcontext *ctx, +_mesa_clear_shader_program_data(struct gl_context *ctx, struct gl_shader_program *shProg); extern void -_mesa_free_shader_program_data(GLcontext *ctx, +_mesa_free_shader_program_data(struct gl_context *ctx, struct gl_shader_program *shProg); @@ -91,10 +91,10 @@ extern void _mesa_init_shader_object_functions(struct dd_function_table *driver); extern void -_mesa_init_shader_state(GLcontext *ctx); +_mesa_init_shader_state(struct gl_context *ctx); extern void -_mesa_free_shader_state(GLcontext *ctx); +_mesa_free_shader_state(struct gl_context *ctx); static INLINE GLuint _mesa_shader_type_to_index(GLenum v) diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index a56c70fa7f..3abee0178e 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -52,7 +52,7 @@ * failure. */ struct gl_shared_state * -_mesa_alloc_shared_state(GLcontext *ctx) +_mesa_alloc_shared_state(struct gl_context *ctx) { struct gl_shared_state *shared; GLuint i; @@ -133,7 +133,7 @@ static void delete_displaylist_cb(GLuint id, void *data, void *userData) { struct gl_display_list *list = (struct gl_display_list *) data; - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; _mesa_delete_list(ctx, list); } @@ -145,7 +145,7 @@ static void delete_texture_cb(GLuint id, void *data, void *userData) { struct gl_texture_object *texObj = (struct gl_texture_object *) data; - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; ctx->Driver.DeleteTexture(ctx, texObj); } @@ -157,7 +157,7 @@ static void delete_program_cb(GLuint id, void *data, void *userData) { struct gl_program *prog = (struct gl_program *) data; - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; if(prog != &_mesa_DummyProgram) { ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */ prog->RefCount = 0; /* now going away */ @@ -175,7 +175,7 @@ static void delete_fragshader_cb(GLuint id, void *data, void *userData) { struct ati_fragment_shader *shader = (struct ati_fragment_shader *) data; - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; _mesa_delete_ati_fragment_shader(ctx, shader); } #endif @@ -188,7 +188,7 @@ static void delete_bufferobj_cb(GLuint id, void *data, void *userData) { struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data; - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; if (_mesa_bufferobj_mapped(bufObj)) { ctx->Driver.UnmapBuffer(ctx, 0, bufObj); bufObj->Pointer = NULL; @@ -204,7 +204,7 @@ delete_bufferobj_cb(GLuint id, void *data, void *userData) static void free_shader_program_data_cb(GLuint id, void *data, void *userData) { - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; struct gl_shader_program *shProg = (struct gl_shader_program *) data; if (shProg->Type == GL_SHADER_PROGRAM_MESA) { @@ -220,7 +220,7 @@ free_shader_program_data_cb(GLuint id, void *data, void *userData) static void delete_shader_cb(GLuint id, void *data, void *userData) { - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; struct gl_shader *sh = (struct gl_shader *) data; if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) { ctx->Driver.DeleteShader(ctx, sh); @@ -280,7 +280,7 @@ delete_renderbuffer_cb(GLuint id, void *data, void *userData) * \sa alloc_shared_state(). */ static void -free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) +free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) { GLuint i; @@ -373,7 +373,7 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) * \sa free_shared_state(). */ void -_mesa_release_shared_state(GLcontext *ctx, struct gl_shared_state *shared) +_mesa_release_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) { GLint RefCount; diff --git a/src/mesa/main/shared.h b/src/mesa/main/shared.h index 5166a0ce51..43f8a388e6 100644 --- a/src/mesa/main/shared.h +++ b/src/mesa/main/shared.h @@ -28,11 +28,11 @@ #include "mtypes.h" struct gl_shared_state * -_mesa_alloc_shared_state(GLcontext *ctx); +_mesa_alloc_shared_state(struct gl_context *ctx); void -_mesa_release_shared_state(GLcontext *ctx, struct gl_shared_state *shared); +_mesa_release_shared_state(struct gl_context *ctx, struct gl_shared_state *shared); #endif diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4a3dffe4cf..5529732de0 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -27,7 +27,7 @@ * \file state.c * State management. * - * This file manages recalculation of derived values in GLcontext. + * This file manages recalculation of derived values in struct gl_context. */ @@ -51,7 +51,7 @@ static void -update_separate_specular(GLcontext *ctx) +update_separate_specular(struct gl_context *ctx) { if (NEED_SECONDARY_COLOR(ctx)) ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; @@ -107,7 +107,7 @@ update_min(GLuint min, struct gl_client_array *array) * Need to do this upon new array state or new buffer object state. */ static void -update_arrays( GLcontext *ctx ) +update_arrays( struct gl_context *ctx ) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i, min = ~0; @@ -219,7 +219,7 @@ update_arrays( GLcontext *ctx ) * This needs to be done before texture state validation. */ static void -update_program_enables(GLcontext *ctx) +update_program_enables(struct gl_context *ctx) { /* These _Enabled flags indicate if the program is enabled AND valid. */ ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled @@ -245,7 +245,7 @@ update_program_enables(GLcontext *ctx) * or fragment program is being used. */ static GLbitfield -update_program(GLcontext *ctx) +update_program(struct gl_context *ctx) { const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current; @@ -362,7 +362,7 @@ update_program(GLcontext *ctx) * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0. */ static GLbitfield -update_program_constants(GLcontext *ctx) +update_program_constants(struct gl_context *ctx) { GLbitfield new_state = 0x0; @@ -399,7 +399,7 @@ update_program_constants(GLcontext *ctx) static void -update_viewport_matrix(GLcontext *ctx) +update_viewport_matrix(struct gl_context *ctx) { const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; @@ -421,7 +421,7 @@ update_viewport_matrix(GLcontext *ctx) * Update derived multisample state. */ static void -update_multisample(GLcontext *ctx) +update_multisample(struct gl_context *ctx) { ctx->Multisample._Enabled = GL_FALSE; if (ctx->Multisample.Enabled && @@ -435,7 +435,7 @@ update_multisample(GLcontext *ctx) * Update derived color/blend/logicop state. */ static void -update_color(GLcontext *ctx) +update_color(struct gl_context *ctx) { /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. @@ -449,7 +449,7 @@ update_color(GLcontext *ctx) * in ctx->_TriangleCaps if needed. */ static void -update_polygon(GLcontext *ctx) +update_polygon(struct gl_context *ctx) { ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET); @@ -471,7 +471,7 @@ update_polygon(GLcontext *ctx) */ #if 0 static void -update_tricaps(GLcontext *ctx, GLbitfield new_state) +update_tricaps(struct gl_context *ctx, GLbitfield new_state) { ctx->_TriangleCaps = 0; @@ -540,7 +540,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state) /** * Compute derived GL state. - * If __GLcontextRec::NewState is non-zero then this function \b must + * If __struct gl_contextRec::NewState is non-zero then this function \b must * be called before rendering anything. * * Calls dd_function_table::UpdateState to perform any internal state @@ -551,7 +551,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state) * _mesa_update_lighting() and _mesa_update_tnl_spaces(). */ void -_mesa_update_state_locked( GLcontext *ctx ) +_mesa_update_state_locked( struct gl_context *ctx ) { GLbitfield new_state = ctx->NewState; GLbitfield prog_flags = _NEW_PROGRAM; @@ -670,7 +670,7 @@ _mesa_update_state_locked( GLcontext *ctx ) /* This is the usual entrypoint for state updates: */ void -_mesa_update_state( GLcontext *ctx ) +_mesa_update_state( struct gl_context *ctx ) { _mesa_lock_context_textures(ctx); _mesa_update_state_locked(ctx); @@ -703,7 +703,7 @@ _mesa_update_state( GLcontext *ctx ) * Otherwise, the fp should track them as state values instead. */ void -_mesa_set_varying_vp_inputs( GLcontext *ctx, +_mesa_set_varying_vp_inputs( struct gl_context *ctx, GLbitfield varying_inputs ) { if (ctx->varying_vp_inputs != varying_inputs) { @@ -721,7 +721,7 @@ _mesa_set_varying_vp_inputs( GLcontext *ctx, * of ordinary varyings/inputs. */ void -_mesa_set_vp_override(GLcontext *ctx, GLboolean flag) +_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag) { if (ctx->VertexProgram._Overriden != flag) { ctx->VertexProgram._Overriden = flag; diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 29db08a0b9..f0eb43d8ee 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -29,21 +29,21 @@ #include "mtypes.h" extern void -_mesa_update_state(GLcontext *ctx); +_mesa_update_state(struct gl_context *ctx); /* As above but can only be called between _mesa_lock_context_textures() and * _mesa_unlock_context_textures(). */ extern void -_mesa_update_state_locked(GLcontext *ctx); +_mesa_update_state_locked(struct gl_context *ctx); extern void -_mesa_set_varying_vp_inputs(GLcontext *ctx, GLbitfield varying_inputs); +_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield varying_inputs); extern void -_mesa_set_vp_override(GLcontext *ctx, GLboolean flag); +_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag); #endif diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 15c98e2015..93e2e97ce0 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -56,7 +56,7 @@ static GLboolean -validate_stencil_op(GLcontext *ctx, GLenum op) +validate_stencil_op(struct gl_context *ctx, GLenum op) { switch (op) { case GL_KEEP: @@ -79,7 +79,7 @@ validate_stencil_op(GLcontext *ctx, GLenum op) static GLboolean -validate_stencil_func(GLcontext *ctx, GLenum func) +validate_stencil_func(struct gl_context *ctx, GLenum func) { switch (func) { case GL_NEVER: @@ -137,7 +137,7 @@ _mesa_ClearStencil( GLint s ) * \sa glStencilFunc(). * * Verifies the parameters and updates the respective values in - * __GLcontextRec::Stencil. On change flushes the vertices and notifies the + * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilFunc callback. */ void GLAPIENTRY @@ -192,7 +192,7 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui * \sa glStencilFunc(). * * Verifies the parameters and updates the respective values in - * __GLcontextRec::Stencil. On change flushes the vertices and notifies the + * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilFunc callback. */ void GLAPIENTRY @@ -312,7 +312,7 @@ _mesa_StencilMask( GLuint mask ) * \sa glStencilOp(). * * Verifies the parameters and updates the respective fields in - * __GLcontextRec::Stencil. On change flushes the vertices and notifies the + * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilOp callback. */ void GLAPIENTRY @@ -532,7 +532,7 @@ _mesa_StencilMaskSeparate(GLenum face, GLuint mask) * Update derived stencil state. */ void -_mesa_update_stencil(GLcontext *ctx) +_mesa_update_stencil(struct gl_context *ctx) { const GLint face = ctx->Stencil._BackFace; @@ -556,10 +556,10 @@ _mesa_update_stencil(GLcontext *ctx) * * \param ctx GL context. * - * Initializes __GLcontextRec::Stencil attribute group. + * Initializes __struct gl_contextRec::Stencil attribute group. */ void -_mesa_init_stencil(GLcontext *ctx) +_mesa_init_stencil(struct gl_context *ctx) { ctx->Stencil.Enabled = GL_FALSE; ctx->Stencil.TestTwoSide = GL_FALSE; diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 252ac932ac..38a7183a81 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -71,10 +71,10 @@ _mesa_StencilMaskSeparate(GLenum face, GLuint mask); extern void -_mesa_update_stencil(GLcontext *ctx); +_mesa_update_stencil(struct gl_context *ctx); extern void -_mesa_init_stencil( GLcontext * ctx ); +_mesa_init_stencil( struct gl_context * ctx ); #endif diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index ac948cc1ef..2c8bcbeaf7 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -66,7 +66,7 @@ #include "syncobj.h" static struct gl_sync_object * -_mesa_new_sync_object(GLcontext *ctx, GLenum type) +_mesa_new_sync_object(struct gl_context *ctx, GLenum type) { struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object); (void) ctx; @@ -77,7 +77,7 @@ _mesa_new_sync_object(GLcontext *ctx, GLenum type) static void -_mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { (void) ctx; free(syncObj); @@ -85,7 +85,7 @@ _mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) static void -_mesa_fence_sync(GLcontext *ctx, struct gl_sync_object *syncObj, +_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, GLenum condition, GLbitfield flags) { (void) ctx; @@ -97,7 +97,7 @@ _mesa_fence_sync(GLcontext *ctx, struct gl_sync_object *syncObj, static void -_mesa_check_sync(GLcontext *ctx, struct gl_sync_object *syncObj) +_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) { (void) ctx; (void) syncObj; @@ -109,7 +109,7 @@ _mesa_check_sync(GLcontext *ctx, struct gl_sync_object *syncObj) static void -_mesa_wait_sync(GLcontext *ctx, struct gl_sync_object *syncObj, +_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, GLbitfield flags, GLuint64 timeout) { (void) ctx; @@ -155,7 +155,7 @@ _mesa_init_sync_dispatch(struct _glapi_table *disp) * Allocate/init the context state related to sync objects. */ void -_mesa_init_sync(GLcontext *ctx) +_mesa_init_sync(struct gl_context *ctx) { (void) ctx; } @@ -165,7 +165,7 @@ _mesa_init_sync(GLcontext *ctx) * Free the context state related to sync objects. */ void -_mesa_free_sync_data(GLcontext *ctx) +_mesa_free_sync_data(struct gl_context *ctx) { (void) ctx; } @@ -181,7 +181,7 @@ _mesa_validate_sync(struct gl_sync_object *syncObj) void -_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { _glthread_LOCK_MUTEX(ctx->Shared->Mutex); syncObj->RefCount++; @@ -190,7 +190,7 @@ _mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) void -_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { _glthread_LOCK_MUTEX(ctx->Shared->Mutex); syncObj->RefCount--; diff --git a/src/mesa/main/syncobj.h b/src/mesa/main/syncobj.h index 82e141d408..f3c0046cf3 100644 --- a/src/mesa/main/syncobj.h +++ b/src/mesa/main/syncobj.h @@ -44,16 +44,16 @@ extern void _mesa_init_sync_dispatch(struct _glapi_table *disp); extern void -_mesa_init_sync(GLcontext *); +_mesa_init_sync(struct gl_context *); extern void -_mesa_free_sync_data(GLcontext *); +_mesa_free_sync_data(struct gl_context *); extern void -_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj); +_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); extern void -_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj); +_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); extern GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync); @@ -89,23 +89,23 @@ _mesa_init_sync_dispatch(struct _glapi_table *disp) } static INLINE void -_mesa_init_sync(GLcontext *ctx) +_mesa_init_sync(struct gl_context *ctx) { } static INLINE void -_mesa_free_sync_data(GLcontext *ctx) +_mesa_free_sync_data(struct gl_context *ctx) { } static INLINE void -_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { ASSERT_NO_FEATURE(); } static INLINE void -_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { ASSERT_NO_FEATURE(); } diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index e911524cbc..e3d2a786b3 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -50,7 +50,7 @@ * \return number of formats. */ GLuint -_mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) +_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean all) { GLuint n = 0; if (ctx->Extensions.TDFX_texture_compression_FXT1) { @@ -178,7 +178,7 @@ _mesa_glenum_to_compressed_format(GLenum format) * internal format unchanged. */ GLenum -_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat) +_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat) { switch (mesaFormat) { #if FEATURE_texture_fxt1 diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 5e73a3149b..83856429c5 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -31,13 +31,13 @@ #if _HAVE_FULL_GL extern GLuint -_mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all); +_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean all); extern gl_format _mesa_glenum_to_compressed_format(GLenum format); extern GLenum -_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat); +_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat); extern GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 534a4247cf..0e893a59fa 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -104,7 +104,7 @@ static void *dxtlibhandle = NULL; void -_mesa_init_texture_s3tc( GLcontext *ctx ) +_mesa_init_texture_s3tc( struct gl_context *ctx ) { /* called during context initialization */ ctx->Mesa_DXTn = GL_FALSE; diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h index 2e7688d366..d0a5b186b7 100644 --- a/src/mesa/main/texcompress_s3tc.h +++ b/src/mesa/main/texcompress_s3tc.h @@ -76,7 +76,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel); extern void -_mesa_init_texture_s3tc(GLcontext *ctx); +_mesa_init_texture_s3tc(struct gl_context *ctx); #else /* FEATURE_texture_s3tc */ @@ -97,7 +97,7 @@ _mesa_init_texture_s3tc(GLcontext *ctx); #define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL static INLINE void -_mesa_init_texture_s3tc(GLcontext *ctx) +_mesa_init_texture_s3tc(struct gl_context *ctx) { } diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 3a55128c73..508dbf4887 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -44,7 +44,7 @@ /** Set texture env mode */ static void -set_env_mode(GLcontext *ctx, +set_env_mode(struct gl_context *ctx, struct gl_texture_unit *texUnit, GLenum mode) { @@ -89,7 +89,7 @@ set_env_mode(GLcontext *ctx, static void -set_env_color(GLcontext *ctx, +set_env_color(struct gl_context *ctx, struct gl_texture_unit *texUnit, const GLfloat *color) { @@ -107,7 +107,7 @@ set_env_color(GLcontext *ctx, /** Set an RGB or A combiner mode/function */ static void -set_combiner_mode(GLcontext *ctx, +set_combiner_mode(struct gl_context *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum mode) { @@ -181,7 +181,7 @@ set_combiner_mode(GLcontext *ctx, /** Set an RGB or A combiner source term */ static void -set_combiner_source(GLcontext *ctx, +set_combiner_source(struct gl_context *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum param) { @@ -274,7 +274,7 @@ set_combiner_source(GLcontext *ctx, /** Set an RGB or A combiner operand term */ static void -set_combiner_operand(GLcontext *ctx, +set_combiner_operand(struct gl_context *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum param) { @@ -360,7 +360,7 @@ set_combiner_operand(GLcontext *ctx, static void -set_combiner_scale(GLcontext *ctx, +set_combiner_scale(struct gl_context *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLfloat scale) { @@ -595,7 +595,7 @@ _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) * \return value of queried pname or -1 if error. */ static GLint -get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit, +get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, GLenum pname) { switch (pname) { diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 20f02cefe9..4647a9c440 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -62,7 +62,7 @@ struct texenvprog_cache_item }; static GLboolean -texenv_doing_secondary_color(GLcontext *ctx) +texenv_doing_secondary_color(struct gl_context *ctx) { if (ctx->Light.Enabled && (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) @@ -307,7 +307,7 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) * has access to. The bitmask is later reduced to just those which * are actually referenced. */ -static GLbitfield get_fp_input_mask( GLcontext *ctx ) +static GLbitfield get_fp_input_mask( struct gl_context *ctx ) { /* _NEW_PROGRAM */ const GLboolean vertexShader = (ctx->Shader.CurrentProgram && @@ -407,7 +407,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) * Examine current texture environment state and generate a unique * key to identify it. */ -static GLuint make_state_key( GLcontext *ctx, struct state_key *key ) +static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) { GLuint i, j; GLbitfield inputs_referenced = FRAG_BIT_COL0; @@ -663,7 +663,7 @@ static void reserve_temp( struct texenv_fragment_program *p, struct ureg r ) } -static void release_temps(GLcontext *ctx, struct texenv_fragment_program *p ) +static void release_temps(struct gl_context *ctx, struct texenv_fragment_program *p ) { GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps; @@ -1415,7 +1415,7 @@ load_texunit_bumpmap( struct texenv_fragment_program *p, GLuint unit ) * current texture env/combine mode. */ static void -create_new_program(GLcontext *ctx, struct state_key *key, +create_new_program(struct gl_context *ctx, struct state_key *key, struct gl_fragment_program *program) { struct prog_instruction instBuffer[MAX_INSTRUCTIONS]; @@ -1526,7 +1526,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef); if (key->fog_enabled) { - /* Pull fog mode from GLcontext, the value in the state key is + /* Pull fog mode from struct gl_context, the value in the state key is * a reduced value and not what is expected in FogOption */ p.program->FogOption = ctx->Fog.Mode; @@ -1590,7 +1590,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, * fixed-function texture, fog and color-sum operations. */ struct gl_fragment_program * -_mesa_get_fixed_func_fragment_program(GLcontext *ctx) +_mesa_get_fixed_func_fragment_program(struct gl_context *ctx) { struct gl_fragment_program *prog; struct state_key key; diff --git a/src/mesa/main/texenvprogram.h b/src/mesa/main/texenvprogram.h index 0a162d2e7a..abfb916d21 100644 --- a/src/mesa/main/texenvprogram.h +++ b/src/mesa/main/texenvprogram.h @@ -30,6 +30,6 @@ #include "mtypes.h" extern struct gl_fragment_program * -_mesa_get_fixed_func_fragment_program(GLcontext *ctx); +_mesa_get_fixed_func_fragment_program(struct gl_context *ctx); #endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 24efb108bb..894c0130b4 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -54,7 +54,7 @@ * will typically override this function with a specialized version. */ gl_format -_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, +_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { (void) format; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index bda5fd6d8c..8bd1507675 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -32,7 +32,7 @@ extern gl_format -_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, +_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ); diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 00134ea9ff..30d1062a41 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -63,7 +63,7 @@ type_with_negative_values(GLenum type) * glGetTexImage for color index pixels. */ static void -get_tex_color_index(GLcontext *ctx, GLuint dimensions, +get_tex_color_index(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -111,7 +111,7 @@ get_tex_color_index(GLcontext *ctx, GLuint dimensions, * glGetTexImage for depth/Z pixels. */ static void -get_tex_depth(GLcontext *ctx, GLuint dimensions, +get_tex_depth(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -141,7 +141,7 @@ get_tex_depth(GLcontext *ctx, GLuint dimensions, * glGetTexImage for depth/stencil pixels. */ static void -get_tex_depth_stencil(GLcontext *ctx, GLuint dimensions, +get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -171,7 +171,7 @@ get_tex_depth_stencil(GLcontext *ctx, GLuint dimensions, * glGetTexImage for YCbCr pixels. */ static void -get_tex_ycbcr(GLcontext *ctx, GLuint dimensions, +get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -234,7 +234,7 @@ linear_to_nonlinear(GLfloat cl) * glGetTexImagefor sRGB pixels; */ static void -get_tex_srgb(GLcontext *ctx, GLuint dimensions, +get_tex_srgb(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -285,7 +285,7 @@ get_tex_srgb(GLcontext *ctx, GLuint dimensions, static INLINE void -get_tex_srgb(GLcontext *ctx, GLuint dimensions, +get_tex_srgb(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -301,7 +301,7 @@ get_tex_srgb(GLcontext *ctx, GLuint dimensions, * This is the slow way since we use texture sampling. */ static void -get_tex_rgba(GLcontext *ctx, GLuint dimensions, +get_tex_rgba(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_image *texImage) { @@ -371,7 +371,7 @@ get_tex_rgba(GLcontext *ctx, GLuint dimensions, * \return GL_TRUE if done, GL_FALSE otherwise */ static GLboolean -get_tex_memcpy(GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels, +get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage) { @@ -451,7 +451,7 @@ get_tex_memcpy(GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels, * The texture image must be mapped. */ void -_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, +_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -528,7 +528,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, * All error checking will have been done before this routine is called. */ void -_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, +_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *img, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -585,7 +585,7 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, * \return GL_TRUE if any error, GL_FALSE if no errors. */ static GLboolean -getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, +getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { struct gl_texture_object *texObj; @@ -771,7 +771,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, * \return GL_TRUE if any error, GL_FALSE if no errors. */ static GLboolean -getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level, +getcompressedteximage_error_check(struct gl_context *ctx, GLenum target, GLint level, GLvoid *img) { struct gl_texture_object *texObj; diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h index 866ab70494..81a3bbbd9a 100644 --- a/src/mesa/main/texgetimage.h +++ b/src/mesa/main/texgetimage.h @@ -30,14 +30,14 @@ #include "mtypes.h" extern void -_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, +_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void -_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, +_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *img, struct gl_texture_object *texObj, struct gl_texture_image *texImage); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 6c3f49f667..08f9f5f3f8 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -127,7 +127,7 @@ logbase2( int n ) * XXX this could be static */ GLint -_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) +_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) { switch (internalFormat) { case GL_ALPHA: @@ -558,7 +558,7 @@ _mesa_set_tex_image(struct gl_texture_object *tObj, * zero. */ struct gl_texture_image * -_mesa_new_texture_image( GLcontext *ctx ) +_mesa_new_texture_image( struct gl_context *ctx ) { (void) ctx; return CALLOC_STRUCT(gl_texture_image); @@ -574,7 +574,7 @@ _mesa_new_texture_image( GLcontext *ctx ) * Free the texture image data if it's not marked as client data. */ void -_mesa_free_texture_image_data(GLcontext *ctx, +_mesa_free_texture_image_data(struct gl_context *ctx, struct gl_texture_image *texImage) { (void) ctx; @@ -596,7 +596,7 @@ _mesa_free_texture_image_data(GLcontext *ctx, * Free the texture image structure and the associated image data. */ void -_mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage ) +_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *texImage ) { /* Free texImage->Data and/or any other driver-specific texture * image storage. @@ -646,7 +646,7 @@ _mesa_is_proxy_texture(GLenum target) * \sa gl_texture_unit. */ struct gl_texture_object * -_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, +_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit, GLenum target) { switch (target) { @@ -703,7 +703,7 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, * Return pointer to texture object for given target on current texture unit. */ struct gl_texture_object * -_mesa_get_current_tex_object(GLcontext *ctx, GLenum target) +_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target) { struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); return _mesa_select_tex_object(ctx, texUnit, target); @@ -723,7 +723,7 @@ _mesa_get_current_tex_object(GLcontext *ctx, GLenum target) * \return pointer to the texture image structure, or NULL on failure. */ struct gl_texture_image * -_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, +_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj, GLenum target, GLint level) { const GLuint face = _mesa_tex_target_to_face(target); @@ -742,7 +742,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, * out of memory. */ struct gl_texture_image * -_mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj, +_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target, GLint level) { struct gl_texture_image *texImage; @@ -772,7 +772,7 @@ _mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj, * level, or out of memory. */ struct gl_texture_image * -_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level) +_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) { struct gl_texture_image *texImage; GLuint texIndex; @@ -847,7 +847,7 @@ _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level) * \sa gl_constants. */ GLint -_mesa_max_texture_levels(GLcontext *ctx, GLenum target) +_mesa_max_texture_levels(struct gl_context *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: @@ -993,7 +993,7 @@ clear_teximage_fields(struct gl_texture_image *img) * Note: width, height and depth include the border. */ void -_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, +_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat) @@ -1084,7 +1084,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, * fields are cleared so that its parent object will test incomplete. */ void -_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage) +_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage) { ctx->Driver.FreeTexImageData(ctx, texImage); clear_teximage_fields(texImage); @@ -1116,7 +1116,7 @@ _mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage) * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable. */ GLboolean -_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, +_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border) { @@ -1228,7 +1228,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, * Helper function to determine whether a target supports compressed textures */ static GLboolean -target_can_be_compressed(GLcontext *ctx, GLenum target) +target_can_be_compressed(struct gl_context *ctx, GLenum target) { return (((target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D)) || ((ctx->Extensions.ARB_texture_cube_map && @@ -1259,11 +1259,11 @@ target_can_be_compressed(GLcontext *ctx, GLenum target) * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in - * __GLcontextRec::Const and the supported extensions, and according to the + * __struct gl_contextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean -texture_error_check( GLcontext *ctx, GLenum target, +texture_error_check( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLuint dimensions, @@ -1506,11 +1506,11 @@ texture_error_check( GLcontext *ctx, GLenum target, * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in - * __GLcontextRec::Const and the supported extensions, and according to the + * __struct gl_contextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean -subtexture_error_check( GLcontext *ctx, GLuint dimensions, +subtexture_error_check( struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, @@ -1603,7 +1603,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, * \return GL_TRUE if error recorded, GL_FALSE otherwise */ static GLboolean -subtexture_error_check2( GLcontext *ctx, GLuint dimensions, +subtexture_error_check2( struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, @@ -1701,11 +1701,11 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions, * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in - * __GLcontextRec::Const and the supported extensions, and according to the + * __struct gl_contextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean -copytexture_error_check( GLcontext *ctx, GLuint dimensions, +copytexture_error_check( struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border ) { @@ -1880,7 +1880,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. */ static GLboolean -copytexsubimage_error_check1( GLcontext *ctx, GLuint dimensions, +copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level) { /* Check that the source buffer is complete */ @@ -1954,7 +1954,7 @@ copytexsubimage_error_check1( GLcontext *ctx, GLuint dimensions, * \param height image height given by the user. */ static GLboolean -copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, +copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, @@ -2081,7 +2081,7 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, /** Callback info for walking over FBO hash table */ struct cb_info { - GLcontext *ctx; + struct gl_context *ctx; struct gl_texture_object *texObj; GLuint level, face; }; @@ -2095,7 +2095,7 @@ check_rtt_cb(GLuint key, void *data, void *userData) { struct gl_framebuffer *fb = (struct gl_framebuffer *) data; const struct cb_info *info = (struct cb_info *) userData; - GLcontext *ctx = info->ctx; + struct gl_context *ctx = info->ctx; const struct gl_texture_object *texObj = info->texObj; const GLuint level = info->level, face = info->face; @@ -2127,7 +2127,7 @@ check_rtt_cb(GLuint key, void *data, void *userData) * Any FBOs rendering into the texture must be re-validated. */ static void -update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj, +update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj, GLuint face, GLuint level) { /* Only check this texture if it's been marked as RenderToTexture */ @@ -2148,7 +2148,7 @@ update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj, * mipmap levels now. */ static INLINE void -check_gen_mipmap(GLcontext *ctx, GLenum target, +check_gen_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLint level) { ASSERT(target != GL_TEXTURE_CUBE_MAP); @@ -2214,7 +2214,7 @@ override_internal_format(GLenum internalFormat, GLint width, GLint height) * comes up during automatic mipmap generation. */ void -_mesa_choose_texture_format(GLcontext *ctx, +_mesa_choose_texture_format(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLenum target, GLint level, @@ -3158,7 +3158,7 @@ get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh) * \return error code or GL_NO_ERROR. */ static GLenum -compressed_texture_error_check(GLcontext *ctx, GLint dimensions, +compressed_texture_error_check(struct gl_context *ctx, GLint dimensions, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, @@ -3265,7 +3265,7 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, * \return error code or GL_NO_ERROR. */ static GLenum -compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, +compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, @@ -3349,7 +3349,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, * \return GL_TRUE if error found, GL_FALSE otherwise. */ static GLboolean -compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims, +compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims, GLsizei width, GLsizei height, GLsizei depth, GLenum format, struct gl_texture_image *texImage) diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 0dcacab3cd..d4317c301b 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -46,7 +46,7 @@ _mesa_free_texmemory(void *m); /*@{*/ extern GLint -_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ); +_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ); extern GLboolean @@ -54,26 +54,26 @@ _mesa_is_proxy_texture(GLenum target); extern struct gl_texture_image * -_mesa_new_texture_image( GLcontext *ctx ); +_mesa_new_texture_image( struct gl_context *ctx ); extern void -_mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *teximage ); +_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *teximage ); extern void -_mesa_free_texture_image_data( GLcontext *ctx, +_mesa_free_texture_image_data( struct gl_context *ctx, struct gl_texture_image *texImage ); extern void -_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, +_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat); extern void -_mesa_choose_texture_format(GLcontext *ctx, +_mesa_choose_texture_format(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLenum target, GLint level, @@ -81,7 +81,7 @@ _mesa_choose_texture_format(GLcontext *ctx, extern void -_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage); +_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage); extern void @@ -91,33 +91,33 @@ _mesa_set_tex_image(struct gl_texture_object *tObj, extern struct gl_texture_object * -_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, +_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit, GLenum target); extern struct gl_texture_object * -_mesa_get_current_tex_object(GLcontext *ctx, GLenum target); +_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target); extern struct gl_texture_image * -_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, +_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj, GLenum target, GLint level); extern struct gl_texture_image * -_mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj, +_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target, GLint level); extern struct gl_texture_image * -_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level); +_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level); extern GLint -_mesa_max_texture_levels(GLcontext *ctx, GLenum target); +_mesa_max_texture_levels(struct gl_context *ctx, GLenum target); extern GLboolean -_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, +_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border); @@ -130,7 +130,7 @@ _mesa_tex_target_to_face(GLenum target); * Lock a texture for updating. See also _mesa_lock_context_textures(). */ static INLINE void -_mesa_lock_texture(GLcontext *ctx, struct gl_texture_object *texObj) +_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj) { _glthread_LOCK_MUTEX(ctx->Shared->TexMutex); ctx->Shared->TextureStateStamp++; @@ -138,7 +138,7 @@ _mesa_lock_texture(GLcontext *ctx, struct gl_texture_object *texObj) } static INLINE void -_mesa_unlock_texture(GLcontext *ctx, struct gl_texture_object *texObj) +_mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj) { _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex); } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 1fedc87028..e08df0f7fe 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -53,7 +53,7 @@ * Return the gl_texture_object for a given ID. */ struct gl_texture_object * -_mesa_lookup_texture(GLcontext *ctx, GLuint id) +_mesa_lookup_texture(struct gl_context *ctx, GLuint id) { return (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, id); @@ -77,7 +77,7 @@ _mesa_lookup_texture(GLcontext *ctx, GLuint id) * \return pointer to new texture object. */ struct gl_texture_object * -_mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target ) +_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; (void) ctx; @@ -149,7 +149,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, * target it's getting bound to (GL_TEXTURE_1D/2D/etc). */ static void -finish_texture_init(GLcontext *ctx, GLenum target, +finish_texture_init(struct gl_context *ctx, GLenum target, struct gl_texture_object *obj) { assert(obj->Target == 0); @@ -181,7 +181,7 @@ finish_texture_init(GLcontext *ctx, GLenum target, * \param texObj the texture object to delete. */ void -_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) +_mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *texObj ) { GLuint i, face; @@ -265,7 +265,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, * \sa _mesa_clear_texture_image(). */ void -_mesa_clear_texture_object(GLcontext *ctx, struct gl_texture_object *texObj) +_mesa_clear_texture_object(struct gl_context *ctx, struct gl_texture_object *texObj) { GLuint i, j; @@ -404,7 +404,7 @@ incomplete(const struct gl_texture_object *t, const char *why) * present and has the expected size. */ void -_mesa_test_texobj_completeness( const GLcontext *ctx, +_mesa_test_texobj_completeness( const struct gl_context *ctx, struct gl_texture_object *t ) { const GLint baseLevel = t->BaseLevel; @@ -696,7 +696,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, * \param invalidate_state also invalidate context state. */ void -_mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj, +_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj, GLboolean invalidate_state) { texObj->_Complete = GL_FALSE; @@ -712,7 +712,7 @@ _mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj, * incomplete texture. */ struct gl_texture_object * -_mesa_get_fallback_texture(GLcontext *ctx) +_mesa_get_fallback_texture(struct gl_context *ctx) { if (!ctx->Shared->FallbackTex) { /* create fallback texture now */ @@ -830,7 +830,7 @@ _mesa_GenTextures( GLsizei n, GLuint *textures ) * read framebuffer. If so, Unbind it. */ static void -unbind_texobj_from_fbo(GLcontext *ctx, struct gl_texture_object *texObj) +unbind_texobj_from_fbo(struct gl_context *ctx, struct gl_texture_object *texObj) { const GLuint n = (ctx->DrawBuffer == ctx->ReadBuffer) ? 1 : 2; GLuint i; @@ -855,7 +855,7 @@ unbind_texobj_from_fbo(GLcontext *ctx, struct gl_texture_object *texObj) * unbind it if so (revert to default textures). */ static void -unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) +unbind_texobj_from_texunits(struct gl_context *ctx, struct gl_texture_object *texObj) { GLuint u, tex; @@ -1214,7 +1214,7 @@ _mesa_IsTexture( GLuint texture ) * See also _mesa_lock/unlock_texture() in teximage.h */ void -_mesa_lock_context_textures( GLcontext *ctx ) +_mesa_lock_context_textures( struct gl_context *ctx ) { _glthread_LOCK_MUTEX(ctx->Shared->TexMutex); @@ -1226,7 +1226,7 @@ _mesa_lock_context_textures( GLcontext *ctx ) void -_mesa_unlock_context_textures( GLcontext *ctx ) +_mesa_unlock_context_textures( struct gl_context *ctx ) { assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp); _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex); diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 9bfebd45c8..821b35caa3 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -41,45 +41,45 @@ /*@{*/ extern struct gl_texture_object * -_mesa_lookup_texture(GLcontext *ctx, GLuint id); +_mesa_lookup_texture(struct gl_context *ctx, GLuint id); extern struct gl_texture_object * -_mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target ); +_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target ); extern void _mesa_initialize_texture_object( struct gl_texture_object *obj, GLuint name, GLenum target ); extern void -_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *obj ); +_mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *obj ); extern void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ); extern void -_mesa_clear_texture_object(GLcontext *ctx, struct gl_texture_object *obj); +_mesa_clear_texture_object(struct gl_context *ctx, struct gl_texture_object *obj); extern void _mesa_reference_texobj(struct gl_texture_object **ptr, struct gl_texture_object *tex); extern void -_mesa_test_texobj_completeness( const GLcontext *ctx, +_mesa_test_texobj_completeness( const struct gl_context *ctx, struct gl_texture_object *obj ); extern void -_mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj, +_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj, GLboolean invalidate_state); extern struct gl_texture_object * -_mesa_get_fallback_texture(GLcontext *ctx); +_mesa_get_fallback_texture(struct gl_context *ctx); extern void -_mesa_unlock_context_textures( GLcontext *ctx ); +_mesa_unlock_context_textures( struct gl_context *ctx ); extern void -_mesa_lock_context_textures( GLcontext *ctx ); +_mesa_lock_context_textures( struct gl_context *ctx ); /*@}*/ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index e96ace7340..d5c83de97f 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -47,7 +47,7 @@ * \return GL_TRUE if legal, GL_FALSE otherwise */ static GLboolean -validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) +validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap) { const struct gl_extensions * const e = & ctx->Extensions; @@ -83,7 +83,7 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) * Only the glGetTexLevelParameter() functions accept proxy targets. */ static struct gl_texture_object * -get_texobj(GLcontext *ctx, GLenum target, GLboolean get) +get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) { struct gl_texture_unit *texUnit; @@ -178,7 +178,7 @@ set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz) * per-texture derived state gets recomputed. */ static INLINE void -flush(GLcontext *ctx, struct gl_texture_object *texObj) +flush(struct gl_context *ctx, struct gl_texture_object *texObj) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->_Complete = GL_FALSE; @@ -190,7 +190,7 @@ flush(GLcontext *ctx, struct gl_texture_object *texObj) * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise */ static GLboolean -set_tex_parameteri(GLcontext *ctx, +set_tex_parameteri(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum pname, const GLint *params) { @@ -430,7 +430,7 @@ set_tex_parameteri(GLcontext *ctx, * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise */ static GLboolean -set_tex_parameterf(GLcontext *ctx, +set_tex_parameterf(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params) { diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index c68105b395..8961b92648 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -31,7 +31,7 @@ struct texture_renderbuffer * Get row of values from the renderbuffer that wraps a texture image. */ static void -texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const struct texture_renderbuffer *trb @@ -100,7 +100,7 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { const struct texture_renderbuffer *trb @@ -167,7 +167,7 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, * Put row of values into a renderbuffer that wraps a texture image. */ static void -texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +texture_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const struct texture_renderbuffer *trb @@ -229,7 +229,7 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, * Put row of RGB values into a renderbuffer that wraps a texture image. */ static void -texture_put_row_rgb(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +texture_put_row_rgb(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const struct texture_renderbuffer *trb @@ -289,7 +289,7 @@ texture_put_row_rgb(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +texture_put_mono_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const struct texture_renderbuffer *trb @@ -348,7 +348,7 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, +texture_put_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { @@ -407,7 +407,7 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, static void -texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb, +texture_put_mono_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { @@ -486,7 +486,7 @@ delete_texture_wrapper(struct gl_renderbuffer *rb) * This allows rendering into the texture as if it were a renderbuffer. */ static void -wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att) +wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { struct texture_renderbuffer *trb; const GLuint name = 0; @@ -525,7 +525,7 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att) * update the internal format info, etc. */ static void -update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) +update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment *att) { struct texture_renderbuffer *trb = (struct texture_renderbuffer *) att->Renderbuffer; @@ -609,7 +609,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) * \sa _mesa_framebuffer_renderbuffer */ void -_mesa_render_texture(GLcontext *ctx, +_mesa_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { @@ -623,7 +623,7 @@ _mesa_render_texture(GLcontext *ctx, void -_mesa_finish_render_texture(GLcontext *ctx, +_mesa_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { /* do nothing */ diff --git a/src/mesa/main/texrender.h b/src/mesa/main/texrender.h index 1e87d594a2..5e68fb03b5 100644 --- a/src/mesa/main/texrender.h +++ b/src/mesa/main/texrender.h @@ -4,12 +4,12 @@ #include "mtypes.h" extern void -_mesa_render_texture(GLcontext *ctx, +_mesa_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att); extern void -_mesa_finish_render_texture(GLcontext *ctx, +_mesa_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 30c978c1cd..1b0d760fae 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -63,7 +63,7 @@ static const struct gl_tex_env_combine_state default_combine_state = { * Used by glXCopyContext to copy texture state from one context to another. */ void -_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) +_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst ) { GLuint u, tex; @@ -119,7 +119,7 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) * For debugging */ void -_mesa_print_texunit_state( GLcontext *ctx, GLuint unit ) +_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit ) { const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit; printf("Texture Unit %d\n", unit); @@ -363,7 +363,7 @@ _mesa_ClientActiveTextureARB(GLenum texture) * \param ctx GL context. */ static void -update_texture_matrices( GLcontext *ctx ) +update_texture_matrices( struct gl_context *ctx ) { GLuint u; @@ -386,7 +386,7 @@ update_texture_matrices( GLcontext *ctx ) * Examine texture unit's combine/env state to update derived state. */ static void -update_tex_combine(GLcontext *ctx, struct gl_texture_unit *texUnit) +update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit) { struct gl_tex_env_combine_state *combine; @@ -489,7 +489,7 @@ update_tex_combine(GLcontext *ctx, struct gl_texture_unit *texUnit) * \param ctx GL context. */ static void -update_texture_state( GLcontext *ctx ) +update_texture_state( struct gl_context *ctx ) { GLuint unit; struct gl_fragment_program *fprog = NULL; @@ -653,7 +653,7 @@ update_texture_state( GLcontext *ctx ) * Update texture-related derived state. */ void -_mesa_update_texture( GLcontext *ctx, GLuint new_state ) +_mesa_update_texture( struct gl_context *ctx, GLuint new_state ) { if (new_state & _NEW_TEXTURE_MATRIX) update_texture_matrices( ctx ); @@ -678,7 +678,7 @@ _mesa_update_texture( GLcontext *ctx, GLuint new_state ) * GL_FALSE. */ static GLboolean -alloc_proxy_textures( GLcontext *ctx ) +alloc_proxy_textures( struct gl_context *ctx ) { static const GLenum targets[] = { GL_TEXTURE_1D, @@ -716,7 +716,7 @@ alloc_proxy_textures( GLcontext *ctx ) * \param unit texture unit number to be initialized. */ static void -init_texture_unit( GLcontext *ctx, GLuint unit ) +init_texture_unit( struct gl_context *ctx, GLuint unit ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint tex; @@ -764,7 +764,7 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) * Initialize texture state for the given context. */ GLboolean -_mesa_init_texture(GLcontext *ctx) +_mesa_init_texture(struct gl_context *ctx) { GLuint u; @@ -796,7 +796,7 @@ _mesa_init_texture(GLcontext *ctx) * Free dynamically-allocted texture data attached to the given context. */ void -_mesa_free_texture_data(GLcontext *ctx) +_mesa_free_texture_data(struct gl_context *ctx) { GLuint u, tgt; @@ -825,7 +825,7 @@ _mesa_free_texture_data(GLcontext *ctx) * shared state. */ void -_mesa_update_default_objects_texture(GLcontext *ctx) +_mesa_update_default_objects_texture(struct gl_context *ctx) { GLuint u, tex; diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 912cb67798..987123036a 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -41,7 +41,7 @@ * This the texture unit set by glActiveTexture(), not glClientActiveTexture(). */ static INLINE struct gl_texture_unit * -_mesa_get_current_tex_unit(GLcontext *ctx) +_mesa_get_current_tex_unit(struct gl_context *ctx) { ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit)); return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]); @@ -49,10 +49,10 @@ _mesa_get_current_tex_unit(GLcontext *ctx) extern void -_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ); +_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst ); extern void -_mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); +_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit ); @@ -76,16 +76,16 @@ _mesa_ClientActiveTextureARB( GLenum target ); /*@{*/ extern void -_mesa_update_texture( GLcontext *ctx, GLuint new_state ); +_mesa_update_texture( struct gl_context *ctx, GLuint new_state ); extern GLboolean -_mesa_init_texture( GLcontext *ctx ); +_mesa_init_texture( struct gl_context *ctx ); extern void -_mesa_free_texture_data( GLcontext *ctx ); +_mesa_free_texture_data( struct gl_context *ctx ); extern void -_mesa_update_default_objects_texture(GLcontext *ctx); +_mesa_update_default_objects_texture(struct gl_context *ctx); /*@}*/ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index cc902bcb1a..f5f94bbf1a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -307,7 +307,7 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat, * \return resulting image with format = textureBaseFormat and type = GLfloat. */ static GLfloat * -make_temp_float_image(GLcontext *ctx, GLuint dims, +make_temp_float_image(struct gl_context *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, @@ -440,7 +440,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, * \return resulting image with format = textureBaseFormat and type = GLchan. */ GLchan * -_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, +_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, @@ -725,7 +725,7 @@ byteswap_mapping( GLboolean swapBytes, * Transfer a GLubyte texture image with component swizzling. */ static void -_mesa_swizzle_ubyte_image(GLcontext *ctx, +_mesa_swizzle_ubyte_image(struct gl_context *ctx, GLuint dimensions, GLenum srcFormat, GLenum srcType, @@ -812,7 +812,7 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, * 1D, 2D and 3D images supported. */ static void -memcpy_texture(GLcontext *ctx, +memcpy_texture(struct gl_context *ctx, GLuint dimensions, gl_format dstFormat, GLvoid *dstAddr, @@ -3939,7 +3939,7 @@ _mesa_texstore(TEXSTORE_PARAMS) * The caller _must_ call _mesa_unmap_teximage_pbo() too! */ const GLvoid * -_mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, +_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack, @@ -3976,7 +3976,7 @@ _mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, * The caller _must_ call _mesa_unmap_teximage_pbo() too! */ const GLvoid * -_mesa_validate_pbo_compressed_teximage(GLcontext *ctx, +_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, GLsizei imageSize, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName) @@ -4010,7 +4010,7 @@ _mesa_validate_pbo_compressed_teximage(GLcontext *ctx, * functions. It unmaps the PBO buffer if it was mapped earlier. */ void -_mesa_unmap_teximage_pbo(GLcontext *ctx, +_mesa_unmap_teximage_pbo(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack) { if (_mesa_is_bufferobj(unpack->BufferObj)) { @@ -4047,7 +4047,7 @@ texture_row_stride(const struct gl_texture_image *texImage) * \sa _mesa_store_teximage2d() */ void -_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -4101,7 +4101,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, * than VRAM. Device driver's can easily plug in their own replacement. */ void -_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const void *pixels, @@ -4154,7 +4154,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, * \sa _mesa_store_teximage2d() */ void -_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const void *pixels, @@ -4207,7 +4207,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, * and Driver.CopyTexSubImage1D(). */ void -_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, @@ -4245,7 +4245,7 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, * and Driver.CopyTexSubImage2D(). */ void -_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const void *pixels, @@ -4283,7 +4283,7 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, * and Driver.CopyTexSubImage3D(). */ void -_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -4321,7 +4321,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, * Fallback for Driver.CompressedTexImage1D() */ void -_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLsizei imageSize, const GLvoid *data, @@ -4344,7 +4344,7 @@ _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, * Fallback for Driver.CompressedTexImage2D() */ void -_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -4388,7 +4388,7 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, * Fallback for Driver.CompressedTexImage3D() */ void -_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, @@ -4413,7 +4413,7 @@ _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, * Fallback for Driver.CompressedTexSubImage1D() */ void -_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, +_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, @@ -4436,7 +4436,7 @@ _mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, * Fallback for Driver.CompressedTexSubImage2D() */ void -_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, +_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -4497,7 +4497,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, * Fallback for Driver.CompressedTexSubImage3D() */ void -_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, +_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 3211086dd6..177ede423f 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -56,7 +56,7 @@ * \param srcPacking source image packing parameters */ #define TEXSTORE_PARAMS \ - GLcontext *ctx, GLuint dims, \ + struct gl_context *ctx, GLuint dims, \ GLenum baseInternalFormat, \ gl_format dstFormat, \ GLvoid *dstAddr, \ @@ -73,7 +73,7 @@ _mesa_texstore(TEXSTORE_PARAMS); extern GLchan * -_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, +_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, @@ -83,7 +83,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, extern void -_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -93,7 +93,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -103,7 +103,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -113,7 +113,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, @@ -122,7 +122,7 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const GLvoid *pixels, @@ -132,7 +132,7 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *pixels, @@ -142,7 +142,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLsizei imageSize, const GLvoid *data, @@ -150,7 +150,7 @@ _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage); extern void -_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -158,7 +158,7 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage); extern void -_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, @@ -168,7 +168,7 @@ _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, +_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, @@ -177,7 +177,7 @@ _mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, struct gl_texture_image *texImage); extern void -_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, +_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -187,7 +187,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, struct gl_texture_image *texImage); extern void -_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, +_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, @@ -198,20 +198,20 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, extern const GLvoid * -_mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, +_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack, const char *funcName); extern const GLvoid * -_mesa_validate_pbo_compressed_teximage(GLcontext *ctx, +_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, GLsizei imageSize, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName); extern void -_mesa_unmap_teximage_pbo(GLcontext *ctx, +_mesa_unmap_teximage_pbo(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack); diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 5c8c1fd225..d297b5ed71 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -95,7 +95,7 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr, * \return GL_TRUE if the mode is OK, GL_FALSE otherwise. */ GLboolean -_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode) +_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode) { if (ctx->TransformFeedback.CurrentObject->Active) { switch (mode) { @@ -120,7 +120,7 @@ _mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode) * \return GL_TRUE for success, GL_FALSE if error */ GLboolean -_mesa_validate_transform_feedback_buffers(GLcontext *ctx) +_mesa_validate_transform_feedback_buffers(struct gl_context *ctx) { /* XXX to do */ return GL_TRUE; @@ -132,7 +132,7 @@ _mesa_validate_transform_feedback_buffers(GLcontext *ctx) * Per-context init for transform feedback. */ void -_mesa_init_transform_feedback(GLcontext *ctx) +_mesa_init_transform_feedback(struct gl_context *ctx) { /* core mesa expects this, even a dummy one, to be available */ ASSERT(ctx->Driver.NewTransformFeedback); @@ -162,7 +162,7 @@ _mesa_init_transform_feedback(GLcontext *ctx) static void delete_cb(GLuint key, void *data, void *userData) { - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; struct gl_transform_feedback_object *obj = (struct gl_transform_feedback_object *) data; @@ -174,7 +174,7 @@ delete_cb(GLuint key, void *data, void *userData) * Per-context free/clean-up for transform feedback. */ void -_mesa_free_transform_feedback(GLcontext *ctx) +_mesa_free_transform_feedback(struct gl_context *ctx) { /* core mesa expects this, even a dummy one, to be available */ ASSERT(ctx->Driver.NewTransformFeedback); @@ -200,15 +200,15 @@ _mesa_free_transform_feedback(GLcontext *ctx) /* forward declarations */ static struct gl_transform_feedback_object * -new_transform_feedback(GLcontext *ctx, GLuint name); +new_transform_feedback(struct gl_context *ctx, GLuint name); static void -delete_transform_feedback(GLcontext *ctx, +delete_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj); /* dummy per-context init/clean-up for transform feedback */ void -_mesa_init_transform_feedback(GLcontext *ctx) +_mesa_init_transform_feedback(struct gl_context *ctx) { ctx->TransformFeedback.DefaultObject = new_transform_feedback(ctx, 0); ctx->TransformFeedback.CurrentObject = ctx->TransformFeedback.DefaultObject; @@ -218,7 +218,7 @@ _mesa_init_transform_feedback(GLcontext *ctx) } void -_mesa_free_transform_feedback(GLcontext *ctx) +_mesa_free_transform_feedback(struct gl_context *ctx) { _mesa_reference_buffer_object(ctx, &ctx->TransformFeedback.CurrentBuffer, @@ -232,7 +232,7 @@ _mesa_free_transform_feedback(GLcontext *ctx) /** Default fallback for ctx->Driver.NewTransformFeedback() */ static struct gl_transform_feedback_object * -new_transform_feedback(GLcontext *ctx, GLuint name) +new_transform_feedback(struct gl_context *ctx, GLuint name) { struct gl_transform_feedback_object *obj; obj = CALLOC_STRUCT(gl_transform_feedback_object); @@ -245,7 +245,7 @@ new_transform_feedback(GLcontext *ctx, GLuint name) /** Default fallback for ctx->Driver.DeleteTransformFeedback() */ static void -delete_transform_feedback(GLcontext *ctx, +delete_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { GLuint i; @@ -263,7 +263,7 @@ delete_transform_feedback(GLcontext *ctx, /** Default fallback for ctx->Driver.BeginTransformFeedback() */ static void -begin_transform_feedback(GLcontext *ctx, GLenum mode, +begin_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj) { /* nop */ @@ -271,7 +271,7 @@ begin_transform_feedback(GLcontext *ctx, GLenum mode, /** Default fallback for ctx->Driver.EndTransformFeedback() */ static void -end_transform_feedback(GLcontext *ctx, +end_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { /* nop */ @@ -279,7 +279,7 @@ end_transform_feedback(GLcontext *ctx, /** Default fallback for ctx->Driver.PauseTransformFeedback() */ static void -pause_transform_feedback(GLcontext *ctx, +pause_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { /* nop */ @@ -287,7 +287,7 @@ pause_transform_feedback(GLcontext *ctx, /** Default fallback for ctx->Driver.ResumeTransformFeedback() */ static void -resume_transform_feedback(GLcontext *ctx, +resume_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { /* nop */ @@ -295,7 +295,7 @@ resume_transform_feedback(GLcontext *ctx, /** Default fallback for ctx->Driver.DrawTransformFeedback() */ static void -draw_transform_feedback(GLcontext *ctx, GLenum mode, +draw_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj) { /* XXX to do */ @@ -399,7 +399,7 @@ _mesa_EndTransformFeedback(void) * Helper used by BindBufferRange() and BindBufferBase(). */ static void -bind_buffer_range(GLcontext *ctx, GLuint index, +bind_buffer_range(struct gl_context *ctx, GLuint index, struct gl_buffer_object *bufObj, GLintptr offset, GLsizeiptr size) { @@ -698,7 +698,7 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, static struct gl_transform_feedback_object * -lookup_transform_feedback_object(GLcontext *ctx, GLuint name) +lookup_transform_feedback_object(struct gl_context *ctx, GLuint name) { if (name == 0) { return ctx->TransformFeedback.DefaultObject; diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h index 4d38522d6d..752cd4e201 100644 --- a/src/mesa/main/transformfeedback.h +++ b/src/mesa/main/transformfeedback.h @@ -29,18 +29,18 @@ extern void -_mesa_init_transform_feedback(GLcontext *ctx); +_mesa_init_transform_feedback(struct gl_context *ctx); extern void -_mesa_free_transform_feedback(GLcontext *ctx); +_mesa_free_transform_feedback(struct gl_context *ctx); #if FEATURE_EXT_transform_feedback extern GLboolean -_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode); +_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode); extern GLboolean -_mesa_validate_transform_feedback_buffers(GLcontext *ctx); +_mesa_validate_transform_feedback_buffers(struct gl_context *ctx); extern void @@ -106,13 +106,13 @@ _mesa_DrawTransformFeedback(GLenum mode, GLuint name); #else /* FEATURE_EXT_transform_feedback */ static INLINE GLboolean -_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode) +_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode) { return GL_TRUE; } static INLINE GLboolean -_mesa_validate_transform_feedback_buffers(GLcontext *ctx) +_mesa_validate_transform_feedback_buffers(struct gl_context *ctx) { return GL_TRUE; } diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 87ce6e4938..9359db1892 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -384,7 +384,7 @@ get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index) * Called by glGetActiveUniform(). */ static void -_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, +_mesa_get_active_uniform(struct gl_context *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) { @@ -527,7 +527,7 @@ get_uniform_rows_cols(const struct gl_program_parameter *p, * to the shader program and return the program parameter position. */ static void -lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location, +lookup_uniform_parameter(struct gl_context *ctx, GLuint program, GLint location, struct gl_program **progOut, GLint *paramPosOut) { struct gl_shader_program *shProg @@ -620,7 +620,7 @@ split_location_offset(GLint *location, GLint *offset) * Called via glGetUniformfv(). */ static void -_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, +_mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location, GLfloat *params) { struct gl_program *prog; @@ -653,7 +653,7 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, * \sa _mesa_get_uniformfv, only difference is a cast. */ static void -_mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location, +_mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location, GLint *params) { struct gl_program *prog; @@ -688,7 +688,7 @@ _mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location, * offset (used for arrays, structs). */ GLint -_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg, +_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg, const GLchar *name) { GLint offset = 0, location = -1; @@ -837,7 +837,7 @@ compatible_types(GLenum userType, GLenum targetType) * \param values the new values, of datatype 'type' */ static void -set_program_uniform(GLcontext *ctx, struct gl_program *program, +set_program_uniform(struct gl_context *ctx, struct gl_program *program, GLint index, GLint offset, GLenum type, GLsizei count, GLint elems, const void *values) @@ -980,7 +980,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, * Called via glUniform*() functions. */ void -_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shProg, +_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, GLint location, GLsizei count, const GLvoid *values, GLenum type) { @@ -1084,7 +1084,7 @@ _mesa_uniform(GLcontext *ctx, struct gl_shader_program *shProg, * Set a matrix-valued program parameter. */ static void -set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, +set_program_uniform_matrix(struct gl_context *ctx, struct gl_program *program, GLuint index, GLuint offset, GLuint count, GLuint rows, GLuint cols, GLboolean transpose, const GLfloat *values) @@ -1152,7 +1152,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, * Note: cols=2, rows=4 ==> array[2] of vec4 */ void -_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg, +_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, GLint cols, GLint rows, GLint location, GLsizei count, GLboolean transpose, const GLfloat *values) diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index ac2cf30d97..6447436305 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -152,16 +152,16 @@ extern GLint GLAPIENTRY _mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *); GLint -_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg, +_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg, const GLchar *name); void -_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shader_program, +_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program, GLint location, GLsizei count, const GLvoid *values, GLenum type); void -_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg, +_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, GLint cols, GLint rows, GLint location, GLsizei count, GLboolean transpose, const GLfloat *values); diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index d19de7ff62..acab9e0e92 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -54,7 +54,7 @@ * \param ptr the address (or offset inside VBO) of the array data */ static void -update_array(GLcontext *ctx, struct gl_client_array *array, +update_array(struct gl_context *ctx, struct gl_client_array *array, GLbitfield dirtyBit, GLsizei elementSize, GLint size, GLenum type, GLenum format, GLsizei stride, GLboolean normalized, const GLvoid *ptr) @@ -778,7 +778,7 @@ _mesa_DisableVertexAttribArrayARB(GLuint index) * not handle the 4-element GL_CURRENT_VERTEX_ATTRIB_ARB query. */ static GLuint -get_vertex_array_attrib(GLcontext *ctx, GLuint index, GLenum pname, +get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, const char *caller) { const struct gl_client_array *array; @@ -1339,7 +1339,7 @@ _mesa_PrimitiveRestartIndex(GLuint index) * Copy one client vertex array to another. */ void -_mesa_copy_client_array(GLcontext *ctx, +_mesa_copy_client_array(struct gl_context *ctx, struct gl_client_array *dst, struct gl_client_array *src) { @@ -1380,7 +1380,7 @@ print_array(const char *name, GLint index, const struct gl_client_array *array) * Print current vertex object/array info. For debug. */ void -_mesa_print_arrays(GLcontext *ctx) +_mesa_print_arrays(struct gl_context *ctx) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i; @@ -1408,7 +1408,7 @@ _mesa_print_arrays(GLcontext *ctx) * Initialize vertex array state for given context. */ void -_mesa_init_varray(GLcontext *ctx) +_mesa_init_varray(struct gl_context *ctx) { ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, @@ -1426,7 +1426,7 @@ static void delete_arrayobj_cb(GLuint id, void *data, void *userData) { struct gl_array_object *arrayObj = (struct gl_array_object *) data; - GLcontext *ctx = (GLcontext *) userData; + struct gl_context *ctx = (struct gl_context *) userData; _mesa_delete_array_object(ctx, arrayObj); } @@ -1435,7 +1435,7 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData) * Free vertex array state for given context. */ void -_mesa_free_varray_data(GLcontext *ctx) +_mesa_free_varray_data(struct gl_context *ctx) { _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx); _mesa_DeleteHashTable(ctx->Array.Objects); diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index c7c3e3ec70..a5fa33fa00 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -216,19 +216,19 @@ _mesa_PrimitiveRestartIndex(GLuint index); extern void -_mesa_copy_client_array(GLcontext *ctx, +_mesa_copy_client_array(struct gl_context *ctx, struct gl_client_array *dst, struct gl_client_array *src); extern void -_mesa_print_arrays(GLcontext *ctx); +_mesa_print_arrays(struct gl_context *ctx); extern void -_mesa_init_varray( GLcontext * ctx ); +_mesa_init_varray( struct gl_context * ctx ); extern void -_mesa_free_varray_data(GLcontext *ctx); +_mesa_free_varray_data(struct gl_context *ctx); #else diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 692e8733c6..69a28da84c 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -32,7 +32,7 @@ * Return major and minor version numbers. */ static void -compute_version(GLcontext *ctx) +compute_version(struct gl_context *ctx) { GLuint major, minor; static const int max = 100; @@ -187,7 +187,7 @@ compute_version(GLcontext *ctx) } static void -compute_version_es1(GLcontext *ctx) +compute_version_es1(struct gl_context *ctx) { static const int max = 100; @@ -223,7 +223,7 @@ compute_version_es1(GLcontext *ctx) } static void -compute_version_es2(GLcontext *ctx) +compute_version_es2(struct gl_context *ctx) { static const int max = 100; @@ -264,7 +264,7 @@ compute_version_es2(GLcontext *ctx) * or to perform version check for GLX_ARB_create_context_profile. */ void -_mesa_compute_version(GLcontext *ctx) +_mesa_compute_version(struct gl_context *ctx) { if (ctx->VersionMajor) return; diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 004036de98..6552a3a784 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -54,7 +54,7 @@ extern void -_mesa_compute_version(GLcontext *ctx); +_mesa_compute_version(struct gl_context *ctx); #endif /* VERSION_H */ diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index 309308c983..4747022d0b 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -60,7 +60,7 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) * \param height height of the viewport rectangle. */ void -_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y, +_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { if (MESA_VERBOSE & VERBOSE_API) @@ -151,7 +151,7 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval) * Initialize the context viewport attribute group. * \param ctx the GL context. */ -void _mesa_init_viewport(GLcontext *ctx) +void _mesa_init_viewport(struct gl_context *ctx) { GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ @@ -173,7 +173,7 @@ void _mesa_init_viewport(GLcontext *ctx) * Free the context viewport attribute group data. * \param ctx the GL context. */ -void _mesa_free_viewport_data(GLcontext *ctx) +void _mesa_free_viewport_data(struct gl_context *ctx) { _math_matrix_dtr(&ctx->Viewport._WindowMap); } diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h index ec054a7c59..ccfa37588b 100644 --- a/src/mesa/main/viewport.h +++ b/src/mesa/main/viewport.h @@ -35,7 +35,7 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); extern void -_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y, +_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height); @@ -44,11 +44,11 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval); extern void -_mesa_init_viewport(GLcontext *ctx); +_mesa_init_viewport(struct gl_context *ctx); extern void -_mesa_free_viewport_data(GLcontext *ctx); +_mesa_free_viewport_data(struct gl_context *ctx); #endif diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index ca352e88e6..284e77798c 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -165,27 +165,27 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) } -void _mesa_init_exec_vtxfmt( GLcontext *ctx ) +void _mesa_init_exec_vtxfmt( struct gl_context *ctx ) { install_vtxfmt( ctx->Exec, &neutral_vtxfmt ); ctx->TnlModule.SwapCount = 0; } -void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ) { ctx->TnlModule.Current = vfmt; _mesa_restore_exec_vtxfmt( ctx ); } -void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ) { install_vtxfmt( ctx->Save, vfmt ); } -void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) +void _mesa_restore_exec_vtxfmt( struct gl_context *ctx ) { struct gl_tnl_module *tnl = &(ctx->TnlModule); GLuint i; diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h index aad38b87c3..401eb80a0a 100644 --- a/src/mesa/main/vtxfmt.h +++ b/src/mesa/main/vtxfmt.h @@ -38,32 +38,32 @@ #if FEATURE_beginend -extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); +extern void _mesa_init_exec_vtxfmt( struct gl_context *ctx ); -extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); -extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); +extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ); +extern void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ); -extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx ); +extern void _mesa_restore_exec_vtxfmt( struct gl_context *ctx ); #else /* FEATURE_beginend */ static INLINE void -_mesa_init_exec_vtxfmt( GLcontext *ctx ) +_mesa_init_exec_vtxfmt( struct gl_context *ctx ) { } static INLINE void -_mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +_mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ) { } static INLINE void -_mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +_mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ) { } static INLINE void -_mesa_restore_exec_vtxfmt( GLcontext *ctx ) +_mesa_restore_exec_vtxfmt( struct gl_context *ctx ) { } diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c index f834aaf568..ca63e72c08 100644 --- a/src/mesa/program/arbprogparse.c +++ b/src/mesa/program/arbprogparse.c @@ -64,7 +64,7 @@ having three separate program parameter arrays. void -_mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, +_mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target, const GLvoid *str, GLsizei len, struct gl_fragment_program *program) { @@ -162,7 +162,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, * object unchanged. */ void -_mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, +_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, const GLvoid *str, GLsizei len, struct gl_vertex_program *program) { diff --git a/src/mesa/program/arbprogparse.h b/src/mesa/program/arbprogparse.h index 980d39fb9f..08e25a1c16 100644 --- a/src/mesa/program/arbprogparse.h +++ b/src/mesa/program/arbprogparse.h @@ -29,12 +29,12 @@ #include "main/mtypes.h" extern void -_mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, +_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, const GLvoid *str, GLsizei len, struct gl_vertex_program *program); extern void -_mesa_parse_arb_fragment_program(GLcontext *ctx, GLenum target, +_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target, const GLvoid *str, GLsizei len, struct gl_fragment_program *program); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index da0d8106df..cd609653fb 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -183,7 +183,7 @@ public: function_entry *current_function; - GLcontext *ctx; + struct gl_context *ctx; struct gl_program *prog; struct gl_shader_program *shader_program; struct gl_shader_compiler_options *options; @@ -2162,7 +2162,7 @@ add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, } static void -set_uniform_initializer(GLcontext *ctx, void *mem_ctx, +set_uniform_initializer(struct gl_context *ctx, void *mem_ctx, struct gl_shader_program *shader_program, const char *name, const glsl_type *type, ir_constant *val) @@ -2232,7 +2232,7 @@ set_uniform_initializer(GLcontext *ctx, void *mem_ctx, } static void -set_uniform_initializers(GLcontext *ctx, +set_uniform_initializers(struct gl_context *ctx, struct gl_shader_program *shader_program) { void *mem_ctx = NULL; @@ -2262,7 +2262,7 @@ set_uniform_initializers(GLcontext *ctx, * Convert a shader's GLSL IR into a Mesa gl_program. */ struct gl_program * -get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, +get_mesa_program(struct gl_context *ctx, struct gl_shader_program *shader_program, struct gl_shader *shader) { ir_to_mesa_visitor v; @@ -2446,7 +2446,7 @@ extern "C" { * XXX can we remove the ctx->Driver.CompileShader() hook? */ GLboolean -_mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader) +_mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader) { assert(shader->CompileStatus); (void) ctx; @@ -2462,7 +2462,7 @@ _mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader) * code lowering and other optimizations. */ GLboolean -_mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +_mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { assert(prog->LinkStatus); @@ -2544,7 +2544,7 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) * Compile a GLSL shader. Called via glCompileShader(). */ void -_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) +_mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader) { struct _mesa_glsl_parse_state *state = new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader); @@ -2632,7 +2632,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) * Link a GLSL shader program. Called via glLinkProgram(). */ void -_mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +_mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { unsigned int i; diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h index ecaacde4bb..7197615f94 100644 --- a/src/mesa/program/ir_to_mesa.h +++ b/src/mesa/program/ir_to_mesa.h @@ -28,10 +28,10 @@ extern "C" { #include "main/config.h" #include "main/mtypes.h" -void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh); -void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog); -GLboolean _mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader); -GLboolean _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog); +void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *sh); +void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); +GLboolean _mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader); +GLboolean _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); #ifdef __cplusplus } diff --git a/src/mesa/program/nvfragparse.c b/src/mesa/program/nvfragparse.c index 0de3c5804d..8516b5fc1f 100644 --- a/src/mesa/program/nvfragparse.c +++ b/src/mesa/program/nvfragparse.c @@ -141,7 +141,7 @@ static const struct instruction_pattern Instructions[] = { * _successfully_ parsed the program text. */ struct parse_state { - GLcontext *ctx; + struct gl_context *ctx; const GLubyte *start; /* start of program string */ const GLubyte *pos; /* current position */ const GLubyte *curLine; @@ -1463,7 +1463,7 @@ Parse_InstructionSequence(struct parse_state *parseState, * indicates the position of the error in 'str'. */ void -_mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, +_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, struct gl_fragment_program *program) { diff --git a/src/mesa/program/nvfragparse.h b/src/mesa/program/nvfragparse.h index e28a6c4934..3e85dd2c30 100644 --- a/src/mesa/program/nvfragparse.h +++ b/src/mesa/program/nvfragparse.h @@ -33,7 +33,7 @@ #include "main/mtypes.h" extern void -_mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target, +_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target, const GLubyte *str, GLsizei len, struct gl_fragment_program *program); diff --git a/src/mesa/program/nvvertparse.c b/src/mesa/program/nvvertparse.c index 1ac83d0e59..bdd44a4513 100644 --- a/src/mesa/program/nvvertparse.c +++ b/src/mesa/program/nvvertparse.c @@ -54,7 +54,7 @@ * program attributes. */ struct parse_state { - GLcontext *ctx; + struct gl_context *ctx; const GLubyte *start; const GLubyte *pos; const GLubyte *curLine; @@ -1282,7 +1282,7 @@ Parse_Program(struct parse_state *parseState, * indicates the position of the error in 'str'. */ void -_mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, +_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, struct gl_vertex_program *program) { diff --git a/src/mesa/program/nvvertparse.h b/src/mesa/program/nvvertparse.h index 91ef79e6c3..e98e867320 100644 --- a/src/mesa/program/nvvertparse.h +++ b/src/mesa/program/nvvertparse.h @@ -32,7 +32,7 @@ #include "main/mtypes.h" extern void -_mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target, +_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target, const GLubyte *str, GLsizei len, struct gl_vertex_program *program); diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c index 8af689754b..56ca59890d 100644 --- a/src/mesa/program/prog_cache.c +++ b/src/mesa/program/prog_cache.c @@ -104,7 +104,7 @@ rehash(struct gl_program_cache *cache) static void -clear_cache(GLcontext *ctx, struct gl_program_cache *cache) +clear_cache(struct gl_context *ctx, struct gl_program_cache *cache) { struct cache_item *c, *next; GLuint i; @@ -145,7 +145,7 @@ _mesa_new_program_cache(void) void -_mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *cache) +_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache) { clear_cache(ctx, cache); free(cache->items); @@ -178,7 +178,7 @@ _mesa_search_program_cache(struct gl_program_cache *cache, void -_mesa_program_cache_insert(GLcontext *ctx, +_mesa_program_cache_insert(struct gl_context *ctx, struct gl_program_cache *cache, const void *key, GLuint keysize, struct gl_program *program) diff --git a/src/mesa/program/prog_cache.h b/src/mesa/program/prog_cache.h index bfe8f99d44..4907ae3030 100644 --- a/src/mesa/program/prog_cache.h +++ b/src/mesa/program/prog_cache.h @@ -41,7 +41,7 @@ extern struct gl_program_cache * _mesa_new_program_cache(void); extern void -_mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *pc); +_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *pc); extern struct gl_program * @@ -49,7 +49,7 @@ _mesa_search_program_cache(struct gl_program_cache *cache, const void *key, GLuint keysize); extern void -_mesa_program_cache_insert(GLcontext *ctx, +_mesa_program_cache_insert(struct gl_context *ctx, struct gl_program_cache *cache, const void *key, GLuint keysize, struct gl_program *program); diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 2ae5bc572a..1d97a077f5 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -296,7 +296,7 @@ fetch_vector4ui(const struct prog_src_register *source, * XXX this currently only works for fragment program input attribs. */ static void -fetch_vector4_deriv(GLcontext * ctx, +fetch_vector4_deriv(struct gl_context * ctx, const struct prog_src_register *source, const struct gl_program_machine *machine, char xOrY, GLfloat result[4]) @@ -380,7 +380,7 @@ fetch_vector1ui(const struct prog_src_register *source, * Fetch texel from texture. Use partial derivatives when possible. */ static INLINE void -fetch_texel(GLcontext *ctx, +fetch_texel(struct gl_context *ctx, const struct gl_program_machine *machine, const struct prog_instruction *inst, const GLfloat texcoord[4], GLfloat lodBias, @@ -630,7 +630,7 @@ store_vector4ui(const struct prog_instruction *inst, * \return GL_TRUE if program completed or GL_FALSE if program executed KIL. */ GLboolean -_mesa_execute_program(GLcontext * ctx, +_mesa_execute_program(struct gl_context * ctx, const struct gl_program *program, struct gl_program_machine *machine) { diff --git a/src/mesa/program/prog_execute.h b/src/mesa/program/prog_execute.h index f59b65176f..cefd468c36 100644 --- a/src/mesa/program/prog_execute.h +++ b/src/mesa/program/prog_execute.h @@ -29,10 +29,10 @@ #include "main/mtypes.h" -typedef void (*FetchTexelLodFunc)(GLcontext *ctx, const GLfloat texcoord[4], +typedef void (*FetchTexelLodFunc)(struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]); -typedef void (*FetchTexelDerivFunc)(GLcontext *ctx, const GLfloat texcoord[4], +typedef void (*FetchTexelDerivFunc)(struct gl_context *ctx, const GLfloat texcoord[4], const GLfloat texdx[4], const GLfloat texdy[4], GLfloat lodBias, @@ -74,11 +74,11 @@ struct gl_program_machine extern void -_mesa_get_program_register(GLcontext *ctx, gl_register_file file, +_mesa_get_program_register(struct gl_context *ctx, gl_register_file file, GLuint index, GLfloat val[4]); extern GLboolean -_mesa_execute_program(GLcontext *ctx, +_mesa_execute_program(struct gl_context *ctx, const struct gl_program *program, struct gl_program_machine *machine); diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c index 0dc779073d..96971f2eda 100644 --- a/src/mesa/program/prog_optimize.c +++ b/src/mesa/program/prog_optimize.c @@ -1216,7 +1216,7 @@ _mesa_reallocate_registers(struct gl_program *prog) #if 0 static void -print_it(GLcontext *ctx, struct gl_program *program, const char *txt) { +print_it(struct gl_context *ctx, struct gl_program *program, const char *txt) { fprintf(stderr, "%s (%u inst):\n", txt, program->NumInstructions); _mesa_print_program(program); _mesa_print_program_parameters(ctx, program); @@ -1230,7 +1230,7 @@ print_it(GLcontext *ctx, struct gl_program *program, const char *txt) { * instructions, temp regs, etc. */ void -_mesa_optimize_program(GLcontext *ctx, struct gl_program *program) +_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program) { GLboolean any_change; diff --git a/src/mesa/program/prog_optimize.h b/src/mesa/program/prog_optimize.h index 06cd9cb2c2..00f1080449 100644 --- a/src/mesa/program/prog_optimize.h +++ b/src/mesa/program/prog_optimize.h @@ -41,6 +41,6 @@ _mesa_find_temp_intervals(const struct prog_instruction *instructions, GLint intEnd[MAX_PROGRAM_TEMPS]); extern void -_mesa_optimize_program(GLcontext *ctx, struct gl_program *program); +_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program); #endif diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 00aa6de963..79c01020eb 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -909,7 +909,7 @@ binary(GLbitfield64 val) */ static void _mesa_fprint_program_parameters(FILE *f, - GLcontext *ctx, + struct gl_context *ctx, const struct gl_program *prog) { GLuint i; @@ -951,7 +951,7 @@ _mesa_fprint_program_parameters(FILE *f, * Print all of a program's parameters/fields to stderr. */ void -_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) +_mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog) { _mesa_fprint_program_parameters(stderr, ctx, prog); } diff --git a/src/mesa/program/prog_print.h b/src/mesa/program/prog_print.h index 78b90aeb4d..f080b3fd2e 100644 --- a/src/mesa/program/prog_print.h +++ b/src/mesa/program/prog_print.h @@ -100,7 +100,7 @@ _mesa_fprint_program_opt(FILE *f, GLboolean lineNumbers); extern void -_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog); +_mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog); extern void _mesa_print_parameter_list(const struct gl_program_parameter_list *list); diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c index c6fb42b9a6..baac29ff0d 100644 --- a/src/mesa/program/prog_statevars.c +++ b/src/mesa/program/prog_statevars.c @@ -46,7 +46,7 @@ * The program parser will produce the state[] values. */ static void -_mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], +_mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], GLfloat *value) { switch (state[0]) { @@ -1049,7 +1049,7 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) * This would be called at glBegin time when using a fragment program. */ void -_mesa_load_state_parameters(GLcontext *ctx, +_mesa_load_state_parameters(struct gl_context *ctx, struct gl_program_parameter_list *paramList) { GLuint i; @@ -1103,7 +1103,7 @@ load_transpose_matrix(GLfloat registers[][4], GLuint pos, * glBegin/glEnd, not per-vertex. */ void -_mesa_load_tracked_matrices(GLcontext *ctx) +_mesa_load_tracked_matrices(struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h index cfce226fb4..6e5be53630 100644 --- a/src/mesa/program/prog_statevars.h +++ b/src/mesa/program/prog_statevars.h @@ -125,7 +125,7 @@ typedef enum gl_state_index_ { extern void -_mesa_load_state_parameters(GLcontext *ctx, +_mesa_load_state_parameters(struct gl_context *ctx, struct gl_program_parameter_list *paramList); @@ -138,7 +138,7 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]); extern void -_mesa_load_tracked_matrices(GLcontext *ctx); +_mesa_load_tracked_matrices(struct gl_context *ctx); #endif /* PROG_STATEVARS_H */ diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index 06b9539bda..cdcf4ec265 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -49,7 +49,7 @@ struct gl_program _mesa_DummyProgram; * Init context's vertex/fragment program state */ void -_mesa_init_program(GLcontext *ctx) +_mesa_init_program(struct gl_context *ctx) { GLuint i; @@ -128,7 +128,7 @@ _mesa_init_program(GLcontext *ctx) * Free a context's vertex/fragment program state */ void -_mesa_free_program_data(GLcontext *ctx) +_mesa_free_program_data(struct gl_context *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); @@ -161,7 +161,7 @@ _mesa_free_program_data(GLcontext *ctx) * shared state. */ void -_mesa_update_default_objects_program(GLcontext *ctx) +_mesa_update_default_objects_program(struct gl_context *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, @@ -203,7 +203,7 @@ _mesa_update_default_objects_program(GLcontext *ctx) * This is generally called from within the parsers. */ void -_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string) +_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string) { ctx->Program.ErrorPos = pos; free((void *) ctx->Program.ErrorString); @@ -260,7 +260,7 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, * Initialize a new vertex/fragment program object. */ static struct gl_program * -_mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, +_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog, GLenum target, GLuint id) { (void) ctx; @@ -286,7 +286,7 @@ _mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, * Initialize a new fragment program object. */ struct gl_program * -_mesa_init_fragment_program( GLcontext *ctx, struct gl_fragment_program *prog, +_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog, GLenum target, GLuint id) { if (prog) @@ -300,7 +300,7 @@ _mesa_init_fragment_program( GLcontext *ctx, struct gl_fragment_program *prog, * Initialize a new vertex program object. */ struct gl_program * -_mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, +_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog, GLenum target, GLuint id) { if (prog) @@ -314,7 +314,7 @@ _mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, * Initialize a new geometry program object. */ struct gl_program * -_mesa_init_geometry_program( GLcontext *ctx, struct gl_geometry_program *prog, +_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog, GLenum target, GLuint id) { if (prog) @@ -337,7 +337,7 @@ _mesa_init_geometry_program( GLcontext *ctx, struct gl_geometry_program *prog, * \return pointer to new program object */ struct gl_program * -_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) +_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id) { struct gl_program *prog; switch (target) { @@ -372,7 +372,7 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) * by a device driver function. */ void -_mesa_delete_program(GLcontext *ctx, struct gl_program *prog) +_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog) { (void) ctx; ASSERT(prog); @@ -406,7 +406,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) * casts elsewhere. */ struct gl_program * -_mesa_lookup_program(GLcontext *ctx, GLuint id) +_mesa_lookup_program(struct gl_context *ctx, GLuint id) { if (id) return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id); @@ -419,7 +419,7 @@ _mesa_lookup_program(GLcontext *ctx, GLuint id) * Reference counting for vertex/fragment programs */ void -_mesa_reference_program(GLcontext *ctx, +_mesa_reference_program(struct gl_context *ctx, struct gl_program **ptr, struct gl_program *prog) { @@ -486,7 +486,7 @@ _mesa_reference_program(GLcontext *ctx, * made by a device driver. */ struct gl_program * -_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) +_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog) { struct gl_program *clone; @@ -729,7 +729,7 @@ adjust_param_indexes(struct prog_instruction *inst, GLuint numInst, * the first program go to the inputs of the second program. */ struct gl_program * -_mesa_combine_programs(GLcontext *ctx, +_mesa_combine_programs(struct gl_context *ctx, const struct gl_program *progA, const struct gl_program *progB) { @@ -923,7 +923,7 @@ _mesa_find_free_register(const GLboolean used[], * behaviour. */ void -_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog) +_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog) { static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 }; GLuint i; diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h index 03b1066f32..70cc2c3aae 100644 --- a/src/mesa/program/program.h +++ b/src/mesa/program/program.h @@ -48,16 +48,16 @@ extern struct gl_program _mesa_DummyProgram; extern void -_mesa_init_program(GLcontext *ctx); +_mesa_init_program(struct gl_context *ctx); extern void -_mesa_free_program_data(GLcontext *ctx); +_mesa_free_program_data(struct gl_context *ctx); extern void -_mesa_update_default_objects_program(GLcontext *ctx); +_mesa_update_default_objects_program(struct gl_context *ctx); extern void -_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string); +_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string); extern const GLubyte * _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, @@ -65,36 +65,36 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, extern struct gl_program * -_mesa_init_vertex_program(GLcontext *ctx, +_mesa_init_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog, GLenum target, GLuint id); extern struct gl_program * -_mesa_init_fragment_program(GLcontext *ctx, +_mesa_init_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog, GLenum target, GLuint id); extern struct gl_program * -_mesa_init_geometry_program(GLcontext *ctx, +_mesa_init_geometry_program(struct gl_context *ctx, struct gl_geometry_program *prog, GLenum target, GLuint id); extern struct gl_program * -_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id); +_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id); extern void -_mesa_delete_program(GLcontext *ctx, struct gl_program *prog); +_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog); extern struct gl_program * -_mesa_lookup_program(GLcontext *ctx, GLuint id); +_mesa_lookup_program(struct gl_context *ctx, GLuint id); extern void -_mesa_reference_program(GLcontext *ctx, +_mesa_reference_program(struct gl_context *ctx, struct gl_program **ptr, struct gl_program *prog); static INLINE void -_mesa_reference_vertprog(GLcontext *ctx, +_mesa_reference_vertprog(struct gl_context *ctx, struct gl_vertex_program **ptr, struct gl_vertex_program *prog) { @@ -103,7 +103,7 @@ _mesa_reference_vertprog(GLcontext *ctx, } static INLINE void -_mesa_reference_fragprog(GLcontext *ctx, +_mesa_reference_fragprog(struct gl_context *ctx, struct gl_fragment_program **ptr, struct gl_fragment_program *prog) { @@ -112,7 +112,7 @@ _mesa_reference_fragprog(GLcontext *ctx, } static INLINE void -_mesa_reference_geomprog(GLcontext *ctx, +_mesa_reference_geomprog(struct gl_context *ctx, struct gl_geometry_program **ptr, struct gl_geometry_program *prog) { @@ -121,24 +121,24 @@ _mesa_reference_geomprog(GLcontext *ctx, } extern struct gl_program * -_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog); +_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog); static INLINE struct gl_vertex_program * -_mesa_clone_vertex_program(GLcontext *ctx, +_mesa_clone_vertex_program(struct gl_context *ctx, const struct gl_vertex_program *prog) { return (struct gl_vertex_program *) _mesa_clone_program(ctx, &prog->Base); } static INLINE struct gl_geometry_program * -_mesa_clone_geometry_program(GLcontext *ctx, +_mesa_clone_geometry_program(struct gl_context *ctx, const struct gl_geometry_program *prog) { return (struct gl_geometry_program *) _mesa_clone_program(ctx, &prog->Base); } static INLINE struct gl_fragment_program * -_mesa_clone_fragment_program(GLcontext *ctx, +_mesa_clone_fragment_program(struct gl_context *ctx, const struct gl_fragment_program *prog) { return (struct gl_fragment_program *) _mesa_clone_program(ctx, &prog->Base); @@ -152,7 +152,7 @@ extern GLboolean _mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count); extern struct gl_program * -_mesa_combine_programs(GLcontext *ctx, +_mesa_combine_programs(struct gl_context *ctx, const struct gl_program *progA, const struct gl_program *progB); @@ -166,7 +166,7 @@ _mesa_find_free_register(const GLboolean used[], GLuint maxRegs, GLuint firstReg); extern void -_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog); +_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog); /* keep these in the same order as TGSI_PROCESSOR_* */ diff --git a/src/mesa/program/program_parse.tab.c b/src/mesa/program/program_parse.tab.c index 08ead30def..baef311d0c 100644 --- a/src/mesa/program/program_parse.tab.c +++ b/src/mesa/program/program_parse.tab.c @@ -5604,7 +5604,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) GLboolean -_mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, +_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str, GLsizei len, struct asm_parser_state *state) { struct asm_instruction *inst; diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index cf621ae424..784ea28c17 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -2643,7 +2643,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) GLboolean -_mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, +_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str, GLsizei len, struct asm_parser_state *state) { struct asm_instruction *inst; diff --git a/src/mesa/program/program_parser.h b/src/mesa/program/program_parser.h index be952d4b9c..d689eef795 100644 --- a/src/mesa/program/program_parser.h +++ b/src/mesa/program/program_parser.h @@ -24,10 +24,7 @@ #include "main/config.h" -#ifndef MTYPES_H -struct __GLcontextRec; -typedef struct __GLcontextRec GLcontext; -#endif +struct gl_context; enum asm_type { at_none, @@ -131,7 +128,7 @@ struct asm_instruction { struct asm_parser_state { - GLcontext *ctx; + struct gl_context *ctx; struct gl_program *prog; /** @@ -237,7 +234,7 @@ typedef struct YYLTYPE { #define YYLTYPE_IS_TRIVIAL 1 -extern GLboolean _mesa_parse_arb_program(GLcontext *ctx, GLenum target, +extern GLboolean _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str, GLsizei len, struct asm_parser_state *state); diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c index fb2ebe6338..f92881f833 100644 --- a/src/mesa/program/programopt.c +++ b/src/mesa/program/programopt.c @@ -46,7 +46,7 @@ * May be used to implement the position_invariant option. */ static void -_mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog) +_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vprog) { struct prog_instruction *newInst; const GLuint origLen = vprog->Base.NumInstructions; @@ -114,7 +114,7 @@ _mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog) static void -_mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog) +_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vprog) { struct prog_instruction *newInst; const GLuint origLen = vprog->Base.NumInstructions; @@ -216,7 +216,7 @@ _mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog) void -_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) +_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) { if (ctx->mvp_with_dp4) _mesa_insert_mvp_dp4_code( ctx, vprog ); @@ -238,7 +238,7 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) * to vertex programs too. */ void -_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) +_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog) { static const gl_state_index fogPStateOpt[STATE_LENGTH] = { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 }; @@ -585,7 +585,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) * This is for debug/test purposes. */ void -_mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog) +_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog) { struct prog_instruction *inst; GLuint inputAttr; @@ -626,7 +626,7 @@ _mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog) * transforms vertex position and emits color. */ void -_mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog) +_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog) { struct prog_instruction *inst; GLuint inputAttr; diff --git a/src/mesa/program/programopt.h b/src/mesa/program/programopt.h index 4af6357f97..ef6f1bd079 100644 --- a/src/mesa/program/programopt.h +++ b/src/mesa/program/programopt.h @@ -29,10 +29,10 @@ #include "main/mtypes.h" extern void -_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog); +_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog); extern void -_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog); +_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog); extern void _mesa_count_texture_indirections(struct gl_program *prog); @@ -44,10 +44,10 @@ extern void _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type); extern void -_mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog); +_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog); extern void -_mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog); +_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog); #endif /* PROGRAMOPT_H */ diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index e389e57346..e29ab46ef9 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -109,7 +109,7 @@ static void xor_states( struct st_state_flags *result, */ static void check_program_state( struct st_context *st ) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; if (ctx->VertexProgram._Current != &st->vp->Base) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index 2140360580..a8ec4adce7 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -156,7 +156,7 @@ translate_logicop(GLenum logicop) * Figure out if colormasks are different per rt. */ static GLboolean -colormask_per_rt(GLcontext *ctx) +colormask_per_rt(struct gl_context *ctx) { /* a bit suboptimal have to compare lots of values */ unsigned i; @@ -172,7 +172,7 @@ colormask_per_rt(GLcontext *ctx) * Figure out if blend enables are different per rt. */ static GLboolean -blend_per_rt(GLcontext *ctx) +blend_per_rt(struct gl_context *ctx) { if (ctx->Color.BlendEnabled && (ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) { diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 1616e945fe..aaee432a21 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -97,7 +97,7 @@ update_depth_stencil_alpha(struct st_context *st) { struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil; struct pipe_stencil_ref sr; - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; memset(dsa, 0, sizeof(*dsa)); memset(&sr, 0, sizeof(sr)); diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 081b6b3e23..6be03376d0 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -69,7 +69,7 @@ struct state_key }; static void -make_state_key(GLcontext *ctx, struct state_key *key) +make_state_key(struct gl_context *ctx, struct state_key *key) { memset(key, 0, sizeof(*key)); @@ -85,7 +85,7 @@ make_state_key(GLcontext *ctx, struct state_key *key) static struct pipe_resource * -create_color_map_texture(GLcontext *ctx) +create_color_map_texture(struct gl_context *ctx) { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; @@ -108,7 +108,7 @@ create_color_map_texture(GLcontext *ctx) * Update the pixelmap texture with the contents of the R/G/B/A pixel maps. */ static void -load_color_map_texture(GLcontext *ctx, struct pipe_resource *pt) +load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt) { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; @@ -157,7 +157,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_resource *pt) * Returns a fragment program which implements the current pixel transfer ops. */ static struct gl_fragment_program * -get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) +get_pixel_transfer_program(struct gl_context *ctx, const struct state_key *key) { struct st_context *st = st_context(ctx); struct prog_instruction inst[MAX_INST]; @@ -320,7 +320,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) static void update_pixel_transfer(struct st_context *st) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; struct state_key key; struct gl_fragment_program *fp; diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 0fe333ae8a..451299cef0 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -57,7 +57,7 @@ static GLuint translate_fill( GLenum mode ) static void update_raster_state( struct st_context *st ) { - GLcontext *ctx = st->ctx; + struct gl_context *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; diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 0b6c34ca2c..d10f1840df 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -41,7 +41,7 @@ static void update_viewport( struct st_context *st ) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; GLfloat yScale, yBias; /* _NEW_BUFFERS diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 425e7987d3..6c5caf42e3 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -55,7 +55,7 @@ void -st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) +st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *acc_strb = st_renderbuffer(rb); const GLint xpos = ctx->DrawBuffer->_Xmin; @@ -96,7 +96,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) /** For ADD/MULT */ static void -accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, +accum_mad(struct gl_context *ctx, GLfloat scale, GLfloat bias, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb) { @@ -219,7 +219,7 @@ accum_load(struct st_context *st, GLfloat value, static void -accum_return(GLcontext *ctx, GLfloat value, +accum_return(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb, struct st_renderbuffer *color_strb) @@ -286,7 +286,7 @@ accum_return(GLcontext *ctx, GLfloat value, static void -st_Accum(GLcontext *ctx, GLenum op, GLfloat value) +st_Accum(struct gl_context *ctx, GLenum op, GLfloat value) { struct st_context *st = st_context(ctx); struct st_renderbuffer *acc_strb diff --git a/src/mesa/state_tracker/st_cb_accum.h b/src/mesa/state_tracker/st_cb_accum.h index 06425dc8a3..b8c9c35003 100644 --- a/src/mesa/state_tracker/st_cb_accum.h +++ b/src/mesa/state_tracker/st_cb_accum.h @@ -35,7 +35,7 @@ #if FEATURE_accum extern void -st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb); +st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb); extern void st_init_accum_functions(struct dd_function_table *functions); @@ -44,7 +44,7 @@ extern void st_init_accum_functions(struct dd_function_table *functions); #include "main/compiler.h" static INLINE void -st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) +st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { ASSERT_NO_FEATURE(); } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 8da5cbb5e6..3c0ee6c288 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -113,7 +113,7 @@ struct bitmap_cache * This program will be combined with the user's fragment program. */ static struct st_fragment_program * -make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) +make_bitmap_fragment_program(struct gl_context *ctx, GLuint samplerIndex) { struct st_context *st = st_context(ctx); struct st_fragment_program *stfp; @@ -187,7 +187,7 @@ find_free_bit(uint bitfield) * Combine basic bitmap fragment program with the user-defined program. */ static struct st_fragment_program * -combined_bitmap_fragment_program(GLcontext *ctx) +combined_bitmap_fragment_program(struct gl_context *ctx) { struct st_context *st = st_context(ctx); struct st_fragment_program *stfp = st->fp; @@ -256,7 +256,7 @@ unpack_bitmap(struct st_context *st, * Create a texture which represents a bitmap image. */ static struct pipe_resource * -make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, +make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap) { @@ -403,7 +403,7 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized, * Render a glBitmap by drawing a textured quad */ static void -draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, +draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, GLsizei width, GLsizei height, struct pipe_sampler_view *sv, const GLfloat *color) @@ -737,7 +737,7 @@ accum_bitmap(struct st_context *st, * Called via ctx->Driver.Bitmap() */ static void -st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, +st_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) { struct st_context *st = st_context(ctx); diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 536748402f..af41835326 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -61,7 +61,7 @@ st_destroy_blit(struct st_context *st) #if FEATURE_EXT_framebuffer_blit static void -st_BlitFramebuffer(GLcontext *ctx, +st_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 7991a93a1e..27540c36ce 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -51,7 +51,7 @@ * internal structure where somehow shared. */ static struct gl_buffer_object * -st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target) +st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target) { struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object); @@ -70,7 +70,7 @@ st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target) * Called via glDeleteBuffersARB(). */ static void -st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj) +st_bufferobj_free(struct gl_context *ctx, struct gl_buffer_object *obj) { struct st_buffer_object *st_obj = st_buffer_object(obj); @@ -92,7 +92,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj) * Called via glBufferSubDataARB(). */ static void -st_bufferobj_subdata(GLcontext *ctx, +st_bufferobj_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -132,7 +132,7 @@ st_bufferobj_subdata(GLcontext *ctx, * Called via glGetBufferSubDataARB(). */ static void -st_bufferobj_get_subdata(GLcontext *ctx, +st_bufferobj_get_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -161,7 +161,7 @@ st_bufferobj_get_subdata(GLcontext *ctx, * \return GL_TRUE for success, GL_FALSE if out of memory */ static GLboolean -st_bufferobj_data(GLcontext *ctx, +st_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, @@ -214,7 +214,7 @@ st_bufferobj_data(GLcontext *ctx, * Called via glMapBufferARB(). */ static void * -st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, +st_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { struct st_buffer_object *st_obj = st_buffer_object(obj); @@ -257,7 +257,7 @@ st_bufferobj_zero_length_range = 0; * Called via glMapBufferRange(). */ static void * -st_bufferobj_map_range(GLcontext *ctx, GLenum target, +st_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *obj) { @@ -317,7 +317,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, static void -st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, +st_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj) { @@ -342,7 +342,7 @@ st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, * Called via glUnmapBufferARB(). */ static GLboolean -st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj) +st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj) { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); @@ -362,7 +362,7 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj) * Called via glCopyBufferSubData(). */ static void -st_copy_buffer_subdata(GLcontext *ctx, +st_copy_buffer_subdata(struct gl_context *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, GLintptr readOffset, GLintptr writeOffset, diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 246ab2e957..bd1dd78b23 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -191,7 +191,7 @@ draw_quad(struct st_context *st, * ctx->DrawBuffer->_X/Ymin/max fields. */ static void -clear_with_quad(GLcontext *ctx, +clear_with_quad(struct gl_context *ctx, GLboolean color, GLboolean depth, GLboolean stencil) { struct st_context *st = st_context(ctx); @@ -316,7 +316,7 @@ clear_with_quad(GLcontext *ctx, * Determine if we need to clear the depth buffer by drawing a quad. */ static INLINE GLboolean -check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) +check_clear_color_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb) { if (ctx->Scissor.Enabled && (ctx->Scissor.X != 0 || @@ -340,7 +340,7 @@ check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) * drawing a quad. */ static INLINE GLboolean -check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) +check_clear_depth_stencil_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb) { const GLuint stencilMax = 0xff; GLboolean maskStencil @@ -368,7 +368,7 @@ check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) * Determine if we need to clear the depth buffer by drawing a quad. */ static INLINE GLboolean -check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb, +check_clear_depth_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb, boolean ds_separate) { const struct st_renderbuffer *strb = st_renderbuffer(rb); @@ -392,7 +392,7 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb, * Determine if we need to clear the stencil buffer by drawing a quad. */ static INLINE GLboolean -check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb, +check_clear_stencil_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb, boolean ds_separate) { const struct st_renderbuffer *strb = st_renderbuffer(rb); @@ -447,7 +447,7 @@ st_flush_clear(struct st_context *st) * Called via ctx->Driver.Clear() */ static void -st_Clear(GLcontext *ctx, GLbitfield mask) +st_Clear(struct gl_context *ctx, GLbitfield mask) { static const GLbitfield BUFFER_BITS_DS = (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL); diff --git a/src/mesa/state_tracker/st_cb_condrender.c b/src/mesa/state_tracker/st_cb_condrender.c index b509d43b7c..7766ead48b 100644 --- a/src/mesa/state_tracker/st_cb_condrender.c +++ b/src/mesa/state_tracker/st_cb_condrender.c @@ -47,7 +47,7 @@ * Called via ctx->Driver.BeginConditionalRender() */ static void -st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q, +st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q, GLenum mode) { struct st_query_object *stq = st_query_object(q); @@ -80,7 +80,7 @@ st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q, * Called via ctx->Driver.BeginConditionalRender() */ static void -st_EndConditionalRender(GLcontext *ctx, struct gl_query_object *q) +st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q) { struct pipe_context *pipe = st_context(ctx)->pipe; (void) q; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 74a95b92bd..6deb01949f 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -96,7 +96,7 @@ is_passthrough_program(const struct gl_fragment_program *prog) * \return pointer to Gallium driver fragment shader */ static void * -combined_drawpix_fragment_program(GLcontext *ctx) +combined_drawpix_fragment_program(struct gl_context *ctx) { struct st_context *st = st_context(ctx); struct st_fragment_program *stfp; @@ -170,7 +170,7 @@ combined_drawpix_fragment_program(GLcontext *ctx) static void * make_fragment_shader_z(struct st_context *st, GLboolean write_depth, GLboolean write_stencil) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; struct gl_program *p; GLuint ic = 0; @@ -333,7 +333,7 @@ make_texture(struct st_context *st, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; struct pipe_context *pipe = st->pipe; gl_format mformat; struct pipe_resource *pt; @@ -418,7 +418,7 @@ make_texture(struct st_context *st, * \param invertTex if true, flip texcoords vertically */ static void -draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, +draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z, GLfloat x1, GLfloat y1, const GLfloat *color, GLboolean invertTex, GLfloat maxXcoord, GLfloat maxYcoord) { @@ -508,7 +508,7 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, static void -draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, +draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, GLsizei width, GLsizei height, GLfloat zoomX, GLfloat zoomY, struct pipe_sampler_view **sv, @@ -650,7 +650,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, static void -draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, +draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) @@ -799,7 +799,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, * Called via ctx->Driver.DrawPixels() */ static void -st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, +st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { @@ -893,7 +893,7 @@ stencil_fallback: static void -copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, +copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty) { @@ -1000,7 +1000,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, static void -st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, +st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type) { diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index c99a8d792e..6cad7d3216 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -100,7 +100,7 @@ lookup_shader(struct pipe_context *pipe, } static void -st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, +st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) { struct st_context *st = ctx->st; diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 3145416383..298f8a5b12 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -71,7 +71,7 @@ st_pipe_format_to_base_format(enum pipe_format format) } static void -st_egl_image_target_renderbuffer_storage(GLcontext *ctx, +st_egl_image_target_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLeglImageOES image_handle) { @@ -98,7 +98,7 @@ st_egl_image_target_renderbuffer_storage(GLcontext *ctx, } static void -st_bind_surface(GLcontext *ctx, GLenum target, +st_bind_surface(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, struct pipe_surface *ps) @@ -139,7 +139,7 @@ st_bind_surface(GLcontext *ctx, GLenum target, } static void -st_egl_image_target_texture_2d(GLcontext *ctx, GLenum target, +st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLeglImageOES image_handle) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index dd4e92e3c0..9425f07aee 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -60,7 +60,7 @@ * during window resize. */ static GLboolean -st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -164,7 +164,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb) * gl_renderbuffer::GetPointer() */ static void * -null_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb, +null_get_pointer(struct gl_context * ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { /* By returning NULL we force all software rendering to go through @@ -181,7 +181,7 @@ null_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb, * Called via ctx->Driver.NewFramebuffer() */ static struct gl_framebuffer * -st_new_framebuffer(GLcontext *ctx, GLuint name) +st_new_framebuffer(struct gl_context *ctx, GLuint name) { /* XXX not sure we need to subclass gl_framebuffer for pipe */ return _mesa_new_framebuffer(ctx, name); @@ -192,7 +192,7 @@ st_new_framebuffer(GLcontext *ctx, GLuint name) * Called via ctx->Driver.NewRenderbuffer() */ static struct gl_renderbuffer * -st_new_renderbuffer(GLcontext *ctx, GLuint name) +st_new_renderbuffer(struct gl_context *ctx, GLuint name) { struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer); if (strb) { @@ -297,7 +297,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) * Called via ctx->Driver.BindFramebufferEXT(). */ static void -st_bind_framebuffer(GLcontext *ctx, GLenum target, +st_bind_framebuffer(struct gl_context *ctx, GLenum target, struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { @@ -307,7 +307,7 @@ st_bind_framebuffer(GLcontext *ctx, GLenum target, * Called by ctx->Driver.FramebufferRenderbuffer */ static void -st_framebuffer_renderbuffer(GLcontext *ctx, +st_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) @@ -321,7 +321,7 @@ st_framebuffer_renderbuffer(GLcontext *ctx, * Called by ctx->Driver.RenderTexture */ static void -st_render_texture(GLcontext *ctx, +st_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { @@ -411,7 +411,7 @@ st_render_texture(GLcontext *ctx, * Called via ctx->Driver.FinishRenderTexture. */ static void -st_finish_render_texture(GLcontext *ctx, +st_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { struct st_context *st = st_context(ctx); @@ -490,7 +490,7 @@ st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth, * For Gallium we only supports combined Z+stencil, not separate buffers. */ static void -st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) { struct st_context *st = st_context(ctx); struct pipe_screen *screen = st->pipe->screen; @@ -544,7 +544,7 @@ st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) * Called via glDrawBuffer. */ static void -st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers) +st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers) { struct st_context *st = st_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -565,7 +565,7 @@ st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers) * Called via glReadBuffer. */ static void -st_ReadBuffer(GLcontext *ctx, GLenum buffer) +st_ReadBuffer(struct gl_context *ctx, GLenum buffer) { struct st_context *st = st_context(ctx); struct gl_framebuffer *fb = ctx->ReadBuffer; diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index e57730b5ec..5c01856f03 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -62,7 +62,7 @@ struct feedback_stage { struct draw_stage stage; /**< Base class */ - GLcontext *ctx; /**< Rendering context */ + struct gl_context *ctx; /**< Rendering context */ GLboolean reset_stipple_counter; }; @@ -79,7 +79,7 @@ feedback_stage( struct draw_stage *stage ) static void -feedback_vertex(GLcontext *ctx, const struct draw_context *draw, +feedback_vertex(struct gl_context *ctx, const struct draw_context *draw, const struct vertex_header *v) { const struct st_context *st = st_context(ctx); @@ -179,7 +179,7 @@ feedback_destroy( struct draw_stage *stage ) * Create GL feedback drawing stage. */ static struct draw_stage * -draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw) +draw_glfeedback_stage(struct gl_context *ctx, struct draw_context *draw) { struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); @@ -252,7 +252,7 @@ select_destroy( struct draw_stage *stage ) * Create GL selection mode drawing stage. */ static struct draw_stage * -draw_glselect_stage(GLcontext *ctx, struct draw_context *draw) +draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw) { struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); @@ -271,7 +271,7 @@ draw_glselect_stage(GLcontext *ctx, struct draw_context *draw) static void -st_RenderMode(GLcontext *ctx, GLenum newMode ) +st_RenderMode(struct gl_context *ctx, GLenum newMode ) { struct st_context *st = st_context(ctx); struct draw_context *draw = st->draw; diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 7b247e0a32..5a2343d3ae 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -113,7 +113,7 @@ void st_finish( struct st_context *st ) /** * Called via ctx->Driver.Flush() */ -static void st_glFlush(GLcontext *ctx) +static void st_glFlush(struct gl_context *ctx) { struct st_context *st = st_context(ctx); @@ -133,7 +133,7 @@ static void st_glFlush(GLcontext *ctx) /** * Called via ctx->Driver.Finish() */ -static void st_glFinish(GLcontext *ctx) +static void st_glFinish(struct gl_context *ctx) { struct st_context *st = st_context(ctx); diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 6aa7e79af9..4d83fcc6cc 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -53,7 +53,7 @@ static GLuint SerialNo = 1; * Called via ctx->Driver.BindProgram() to bind an ARB vertex or * fragment program. */ -static void st_bind_program( GLcontext *ctx, +static void st_bind_program( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -77,7 +77,7 @@ static void st_bind_program( GLcontext *ctx, * Called via ctx->Driver.UseProgram() to bind a linked GLSL program * (vertex shader + fragment shader). */ -static void st_use_program( GLcontext *ctx, struct gl_shader_program *shProg) +static void st_use_program( struct gl_context *ctx, struct gl_shader_program *shProg) { struct st_context *st = st_context(ctx); @@ -92,7 +92,7 @@ static void st_use_program( GLcontext *ctx, struct gl_shader_program *shProg) * Called via ctx->Driver.NewProgram() to allocate a new vertex or * fragment program. */ -static struct gl_program *st_new_program( GLcontext *ctx, +static struct gl_program *st_new_program( struct gl_context *ctx, GLenum target, GLuint id ) { @@ -139,7 +139,7 @@ static struct gl_program *st_new_program( GLcontext *ctx, void -st_delete_program(GLcontext *ctx, struct gl_program *prog) +st_delete_program(struct gl_context *ctx, struct gl_program *prog) { struct st_context *st = st_context(ctx); @@ -195,7 +195,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } -static GLboolean st_is_program_native( GLcontext *ctx, +static GLboolean st_is_program_native( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -203,7 +203,7 @@ static GLboolean st_is_program_native( GLcontext *ctx, } -static GLboolean st_program_string_notify( GLcontext *ctx, +static GLboolean st_program_string_notify( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { diff --git a/src/mesa/state_tracker/st_cb_program.h b/src/mesa/state_tracker/st_cb_program.h index 0fd179ef3d..004afb6d81 100644 --- a/src/mesa/state_tracker/st_cb_program.h +++ b/src/mesa/state_tracker/st_cb_program.h @@ -37,7 +37,7 @@ extern void st_init_program_functions(struct dd_function_table *functions); extern void -st_delete_program(GLcontext *ctx, struct gl_program *prog); +st_delete_program(struct gl_context *ctx, struct gl_program *prog); #endif diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index e423d9d8a5..724464a33f 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -46,7 +46,7 @@ #if FEATURE_queryobj static struct gl_query_object * -st_NewQueryObject(GLcontext *ctx, GLuint id) +st_NewQueryObject(struct gl_context *ctx, GLuint id) { struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object); if (stq) { @@ -62,7 +62,7 @@ st_NewQueryObject(GLcontext *ctx, GLuint id) static void -st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q) +st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q) { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_query_object *stq = st_query_object(q); @@ -77,7 +77,7 @@ st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q) static void -st_BeginQuery(GLcontext *ctx, struct gl_query_object *q) +st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q) { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_query_object *stq = st_query_object(q); @@ -121,7 +121,7 @@ st_BeginQuery(GLcontext *ctx, struct gl_query_object *q) static void -st_EndQuery(GLcontext *ctx, struct gl_query_object *q) +st_EndQuery(struct gl_context *ctx, struct gl_query_object *q) { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_query_object *stq = st_query_object(q); @@ -131,7 +131,7 @@ st_EndQuery(GLcontext *ctx, struct gl_query_object *q) static void -st_WaitQuery(GLcontext *ctx, struct gl_query_object *q) +st_WaitQuery(struct gl_context *ctx, struct gl_query_object *q) { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_query_object *stq = st_query_object(q); @@ -153,7 +153,7 @@ st_WaitQuery(GLcontext *ctx, struct gl_query_object *q) static void -st_CheckQuery(GLcontext *ctx, struct gl_query_object *q) +st_CheckQuery(struct gl_context *ctx, struct gl_query_object *q) { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_query_object *stq = st_query_object(q); diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index e5f7b6f91e..15a4f602d1 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -57,7 +57,7 @@ struct rastpos_stage { struct draw_stage stage; /**< Base class */ - GLcontext *ctx; /**< Rendering context */ + struct gl_context *ctx; /**< Rendering context */ /* vertex attrib info we can setup once and re-use */ struct gl_client_array array[VERT_ATTRIB_MAX]; @@ -110,7 +110,7 @@ rastpos_destroy(struct draw_stage *stage) * else copy the current attrib. */ static void -update_attrib(GLcontext *ctx, const GLuint *outputMapping, +update_attrib(struct gl_context *ctx, const GLuint *outputMapping, const struct vertex_header *vert, GLfloat *dest, GLuint result, GLuint defaultAttrib) @@ -132,7 +132,7 @@ static void rastpos_point(struct draw_stage *stage, struct prim_header *prim) { struct rastpos_stage *rs = rastpos_stage(stage); - GLcontext *ctx = rs->ctx; + struct gl_context *ctx = rs->ctx; struct st_context *st = st_context(ctx); const GLfloat height = (GLfloat) ctx->DrawBuffer->Height; const GLuint *outputMapping = st->vertex_result_to_slot; @@ -177,7 +177,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) * Create rasterpos "drawing" stage. */ static struct rastpos_stage * -new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) +new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) { struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); GLuint i; @@ -219,7 +219,7 @@ new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) static void -st_RasterPos(GLcontext *ctx, const GLfloat v[4]) +st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) { struct st_context *st = st_context(ctx); struct draw_context *draw = st->draw; diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index d9e9a527f6..0aad733e34 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -55,7 +55,7 @@ * For color/depth we use get_tile(). For stencil, map the stencil buffer. */ void -st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, +st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -174,7 +174,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, * commands. */ struct st_renderbuffer * -st_get_color_read_renderbuffer(GLcontext *ctx) +st_get_color_read_renderbuffer(struct gl_context *ctx) { struct gl_framebuffer *fb = ctx->ReadBuffer; struct st_renderbuffer *strb = @@ -189,7 +189,7 @@ st_get_color_read_renderbuffer(GLcontext *ctx) * \return GL_TRUE for success, GL_FALSE for failure */ static GLboolean -st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, +st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -320,7 +320,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, * Image transfer ops are done in software too. */ static void -st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, +st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid *dest) diff --git a/src/mesa/state_tracker/st_cb_readpixels.h b/src/mesa/state_tracker/st_cb_readpixels.h index 9e1f7b4925..83c9b659e3 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.h +++ b/src/mesa/state_tracker/st_cb_readpixels.h @@ -34,10 +34,10 @@ struct dd_function_table; extern struct st_renderbuffer * -st_get_color_read_renderbuffer(GLcontext *ctx); +st_get_color_read_renderbuffer(struct gl_context *ctx); extern void -st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, +st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c index 0fcb427f30..21323798fd 100644 --- a/src/mesa/state_tracker/st_cb_strings.c +++ b/src/mesa/state_tracker/st_cb_strings.c @@ -42,7 +42,7 @@ #define ST_VERSION_STRING "0.4" static const GLubyte * -st_get_string(GLcontext * ctx, GLenum name) +st_get_string(struct gl_context * ctx, GLenum name) { struct st_context *st = st_context(ctx); struct pipe_screen *screen = st->pipe->screen; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 9d232d417e..062dd34865 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -94,7 +94,7 @@ gl_target_to_pipe(GLenum target) /** called via ctx->Driver.NewTextureImage() */ static struct gl_texture_image * -st_NewTextureImage(GLcontext * ctx) +st_NewTextureImage(struct gl_context * ctx) { DBG("%s\n", __FUNCTION__); (void) ctx; @@ -104,7 +104,7 @@ st_NewTextureImage(GLcontext * ctx) /** called via ctx->Driver.NewTextureObject() */ static struct gl_texture_object * -st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target) +st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object); @@ -116,7 +116,7 @@ st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target) /** called via ctx->Driver.DeleteTextureObject() */ static void -st_DeleteTextureObject(GLcontext *ctx, +st_DeleteTextureObject(struct gl_context *ctx, struct gl_texture_object *texObj) { struct st_context *st = st_context(ctx); @@ -140,7 +140,7 @@ st_DeleteTextureObject(GLcontext *ctx, /** called via ctx->Driver.FreeTexImageData() */ static void -st_FreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) +st_FreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage) { struct st_texture_image *stImage = st_texture_image(texImage); @@ -411,7 +411,7 @@ strip_texture_border(GLint border, * \return GL_TRUE for success, GL_FALSE for failure */ static GLboolean -compress_with_blit(GLcontext * ctx, +compress_with_blit(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, @@ -522,7 +522,7 @@ compress_with_blit(GLcontext * ctx, * Do glTexImage1/2/3D(). */ static void -st_TexImage(GLcontext * ctx, +st_TexImage(struct gl_context * ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, @@ -779,7 +779,7 @@ done: static void -st_TexImage3D(GLcontext * ctx, +st_TexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, @@ -796,7 +796,7 @@ st_TexImage3D(GLcontext * ctx, static void -st_TexImage2D(GLcontext * ctx, +st_TexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, @@ -811,7 +811,7 @@ st_TexImage2D(GLcontext * ctx, static void -st_TexImage1D(GLcontext * ctx, +st_TexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, @@ -826,7 +826,7 @@ st_TexImage1D(GLcontext * ctx, static void -st_CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, +st_CompressedTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -844,7 +844,7 @@ st_CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, * a textured quad. Store the results in the user's buffer. */ static void -decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, +decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -940,7 +940,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, * then unmap it. */ static void -st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, +st_get_tex_image(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLboolean compressed_dst) @@ -1031,7 +1031,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, static void -st_GetTexImage(GLcontext * ctx, GLenum target, GLint level, +st_GetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -1042,7 +1042,7 @@ st_GetTexImage(GLcontext * ctx, GLenum target, GLint level, static void -st_GetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +st_GetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -1054,7 +1054,7 @@ st_GetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, static void -st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, +st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -1160,7 +1160,7 @@ done: static void -st_TexSubImage3D(GLcontext *ctx, GLenum target, GLint level, +st_TexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, @@ -1175,7 +1175,7 @@ st_TexSubImage3D(GLcontext *ctx, GLenum target, GLint level, static void -st_TexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +st_TexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels, @@ -1190,7 +1190,7 @@ st_TexSubImage2D(GLcontext *ctx, GLenum target, GLint level, static void -st_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +st_TexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels, const struct gl_pixelstore_attrib *packing, @@ -1203,7 +1203,7 @@ st_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level, static void -st_CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +st_CompressedTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, @@ -1215,7 +1215,7 @@ st_CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, static void -st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, @@ -1270,7 +1270,7 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, static void -st_CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, +st_CompressedTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLint height, GLint depth, GLenum format, @@ -1291,7 +1291,7 @@ st_CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, * Note: srcY=0=TOP of renderbuffer */ static void -fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, +fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level, struct st_renderbuffer *strb, struct st_texture_image *stImage, GLenum baseFormat, @@ -1416,7 +1416,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, * If the src/dest are incompatible, return 0. */ static unsigned -compatible_src_dst_formats(GLcontext *ctx, +compatible_src_dst_formats(struct gl_context *ctx, const struct gl_renderbuffer *src, const struct gl_texture_image *dst) { @@ -1483,7 +1483,7 @@ compatible_src_dst_formats(GLcontext *ctx, * Note: srcY=0=Bottom of renderbuffer (GL convention) */ static void -st_copy_texsubimage(GLcontext *ctx, +st_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level, GLint destX, GLint destY, GLint destZ, GLint srcX, GLint srcY, @@ -1670,7 +1670,7 @@ st_copy_texsubimage(GLcontext *ctx, static void -st_CopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, +st_CopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { @@ -1696,7 +1696,7 @@ st_CopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, static void -st_CopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, +st_CopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) @@ -1723,7 +1723,7 @@ st_CopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, static void -st_CopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +st_CopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { const GLint yoffset = 0, zoffset = 0; @@ -1735,7 +1735,7 @@ st_CopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, static void -st_CopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +st_CopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { @@ -1747,7 +1747,7 @@ st_CopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, static void -st_CopyTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, +st_CopyTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { @@ -1812,7 +1812,7 @@ copy_image_data_to_texture(struct st_context *st, * \return GL_TRUE for success, GL_FALSE for failure (out of mem) */ GLboolean -st_finalize_texture(GLcontext *ctx, +st_finalize_texture(struct gl_context *ctx, struct pipe_context *pipe, struct gl_texture_object *tObj) { diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h index 6942478e81..60987055eb 100644 --- a/src/mesa/state_tracker/st_cb_texture.h +++ b/src/mesa/state_tracker/st_cb_texture.h @@ -38,7 +38,7 @@ struct pipe_context; struct st_context; extern GLboolean -st_finalize_texture(GLcontext *ctx, +st_finalize_texture(struct gl_context *ctx, struct pipe_context *pipe, struct gl_texture_object *tObj); diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c index c4076b665c..049755e45c 100644 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ b/src/mesa/state_tracker/st_cb_viewport.c @@ -46,7 +46,7 @@ st_ws_framebuffer(struct gl_framebuffer *fb) return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL); } -static void st_viewport(GLcontext * ctx, GLint x, GLint y, +static void st_viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { struct st_context *st = ctx->st; diff --git a/src/mesa/state_tracker/st_cb_xformfb.c b/src/mesa/state_tracker/st_cb_xformfb.c index 749e88e8db..838a0a4a93 100644 --- a/src/mesa/state_tracker/st_cb_xformfb.c +++ b/src/mesa/state_tracker/st_cb_xformfb.c @@ -44,7 +44,7 @@ #if 0 static struct gl_transform_feedback_object * -st_new_transform_feedback(GLcontext *ctx, GLuint name) +st_new_transform_feedback(struct gl_context *ctx, GLuint name) { struct gl_transform_feedback_object *obj; obj = CALLOC_STRUCT(gl_transform_feedback_object); @@ -58,7 +58,7 @@ st_new_transform_feedback(GLcontext *ctx, GLuint name) #if 0 static void -st_delete_transform_feedback(GLcontext *ctx, +st_delete_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { GLuint i; @@ -73,7 +73,7 @@ st_delete_transform_feedback(GLcontext *ctx, static void -st_begin_transform_feedback(GLcontext *ctx, GLenum mode, +st_begin_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj) { /* to-do */ @@ -81,7 +81,7 @@ st_begin_transform_feedback(GLcontext *ctx, GLenum mode, static void -st_end_transform_feedback(GLcontext *ctx, +st_end_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { /* to-do */ @@ -89,7 +89,7 @@ st_end_transform_feedback(GLcontext *ctx, static void -st_pause_transform_feedback(GLcontext *ctx, +st_pause_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { /* to-do */ @@ -97,7 +97,7 @@ st_pause_transform_feedback(GLcontext *ctx, static void -st_resume_transform_feedback(GLcontext *ctx, +st_resume_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { /* to-do */ @@ -105,7 +105,7 @@ st_resume_transform_feedback(GLcontext *ctx, static void -st_draw_transform_feedback(GLcontext *ctx, GLenum mode, +st_draw_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj) { /* XXX to do */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index b0ec198e24..75fd69540f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -69,7 +69,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE) /** * Called via ctx->Driver.UpdateState() */ -void st_invalidate_state(GLcontext * ctx, GLuint new_state) +void st_invalidate_state(struct gl_context * ctx, GLuint new_state) { struct st_context *st = st_context(ctx); @@ -97,7 +97,7 @@ st_get_msaa(void) static struct st_context * -st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) +st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe ) { uint i; struct st_context *st = ST_CALLOC_STRUCT( st_context ); @@ -166,8 +166,8 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, const struct gl_config *visual, struct st_context *share) { - GLcontext *ctx; - GLcontext *shareCtx = share ? share->ctx : NULL; + struct gl_context *ctx; + struct gl_context *shareCtx = share ? share->ctx : NULL; struct dd_function_table funcs; memset(&funcs, 0, sizeof(funcs)); @@ -221,7 +221,7 @@ void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; GLuint i; /* need to unbind and destroy CSO objects before anything else */ diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index ef75c2c4b1..89483ac04c 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -68,7 +68,7 @@ struct st_context { struct st_context_iface iface; - GLcontext *ctx; + struct gl_context *ctx; struct pipe_context *pipe; @@ -195,7 +195,7 @@ struct st_context /* Need this so that we can implement Mesa callbacks in this module. */ -static INLINE struct st_context *st_context(GLcontext *ctx) +static INLINE struct st_context *st_context(struct gl_context *ctx) { return ctx->st; } @@ -219,7 +219,7 @@ struct st_framebuffer extern void st_init_driver_functions(struct dd_function_table *functions); -void st_invalidate_state(GLcontext * ctx, GLuint new_state); +void st_invalidate_state(struct gl_context * ctx, GLuint new_state); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 318e08886c..f6f5bb1793 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -341,7 +341,7 @@ get_arrays_bounds(const struct st_vertex_program *vp, * \param velements returns vertex element info */ static void -setup_interleaved_attribs(GLcontext *ctx, +setup_interleaved_attribs(struct gl_context *ctx, const struct st_vertex_program *vp, const struct st_vp_varient *vpv, const struct gl_client_array **arrays, @@ -407,7 +407,7 @@ setup_interleaved_attribs(GLcontext *ctx, * \param velements returns vertex element info */ static void -setup_non_interleaved_attribs(GLcontext *ctx, +setup_non_interleaved_attribs(struct gl_context *ctx, const struct st_vertex_program *vp, const struct st_vp_varient *vpv, const struct gl_client_array **arrays, @@ -496,7 +496,7 @@ setup_non_interleaved_attribs(GLcontext *ctx, static void -setup_index_buffer(GLcontext *ctx, +setup_index_buffer(struct gl_context *ctx, const struct _mesa_index_buffer *ib, struct pipe_index_buffer *ibuffer) { @@ -545,7 +545,7 @@ setup_index_buffer(GLcontext *ctx, * issue a warning. */ static void -check_uniforms(GLcontext *ctx) +check_uniforms(struct gl_context *ctx) { const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; if (shProg && shProg->LinkStatus) { @@ -567,7 +567,7 @@ check_uniforms(GLcontext *ctx) * the corresponding Gallium type. */ static unsigned -translate_prim(const GLcontext *ctx, unsigned prim) +translate_prim(const struct gl_context *ctx, unsigned prim) { /* GL prims should match Gallium prims, spot-check a few */ assert(GL_POINTS == PIPE_PRIM_POINTS); @@ -595,7 +595,7 @@ translate_prim(const GLcontext *ctx, unsigned prim) * Basically, translate the information into the format expected by gallium. */ void -st_draw_vbo(GLcontext *ctx, +st_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, @@ -736,7 +736,7 @@ st_draw_vbo(GLcontext *ctx, void st_init_draw( struct st_context *st ) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; vbo_set_draw_func(ctx, st_draw_vbo); diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h index f36184487a..2e4c468cff 100644 --- a/src/mesa/state_tracker/st_draw.h +++ b/src/mesa/state_tracker/st_draw.h @@ -47,7 +47,7 @@ void st_init_draw( struct st_context *st ); void st_destroy_draw( struct st_context *st ); extern void -st_draw_vbo(GLcontext *ctx, +st_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, @@ -57,7 +57,7 @@ st_draw_vbo(GLcontext *ctx, GLuint max_index); extern void -st_feedback_draw_vbo(GLcontext *ctx, +st_feedback_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index df05c7f70d..7f392fc491 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -52,7 +52,7 @@ * GL_SELECT or GL_FEEDBACK mode or for glRasterPos. */ static void -set_feedback_vertex_format(GLcontext *ctx) +set_feedback_vertex_format(struct gl_context *ctx) { #if 0 struct st_context *st = st_context(ctx); @@ -90,7 +90,7 @@ set_feedback_vertex_format(GLcontext *ctx) * Might move this into the failover module some day. */ void -st_feedback_draw_vbo(GLcontext *ctx, +st_feedback_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 0a9614f754..96e4efcafa 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -204,7 +204,7 @@ void st_init_limits(struct st_context *st) void st_init_extensions(struct st_context *st) { struct pipe_screen *screen = st->pipe->screen; - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; /* * Extensions that are supported by all Gallium drivers: diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index cc585f9ce2..4e90bd01a3 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -781,7 +781,7 @@ st_choose_renderbuffer_format(struct pipe_screen *screen, * Called via ctx->Driver.chooseTextureFormat(). */ gl_format -st_ChooseTextureFormat_renderable(GLcontext *ctx, GLint internalFormat, +st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type, GLboolean renderable) { struct pipe_screen *screen = st_context(ctx)->pipe->screen; @@ -821,7 +821,7 @@ st_ChooseTextureFormat_renderable(GLcontext *ctx, GLint internalFormat, } gl_format -st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, +st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type) { return st_ChooseTextureFormat_renderable(ctx, internalFormat, diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 4e3a9b1d83..43fa59b100 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -60,11 +60,11 @@ st_choose_renderbuffer_format(struct pipe_screen *screen, gl_format -st_ChooseTextureFormat_renderable(GLcontext *ctx, GLint internalFormat, +st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type, GLboolean renderable); extern gl_format -st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat, +st_ChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 2d587df605..fe31418ddd 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -155,7 +155,7 @@ compress_image(enum pipe_format format, * Software fallback for generate mipmap levels. */ static void -fallback_generate_mipmap(GLcontext *ctx, GLenum target, +fallback_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -276,7 +276,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, * levels should be generated. */ static GLuint -compute_num_levels(GLcontext *ctx, +compute_num_levels(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target) { @@ -311,7 +311,7 @@ compute_num_levels(GLcontext *ctx, * Called via ctx->Driver.GenerateMipmap(). */ void -st_generate_mipmap(GLcontext *ctx, GLenum target, +st_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { struct st_context *st = st_context(ctx); diff --git a/src/mesa/state_tracker/st_gen_mipmap.h b/src/mesa/state_tracker/st_gen_mipmap.h index 016bf3f4bb..3ba091da15 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.h +++ b/src/mesa/state_tracker/st_gen_mipmap.h @@ -43,7 +43,7 @@ st_destroy_generate_mipmap(struct st_context *st); extern void -st_generate_mipmap(GLcontext *ctx, GLenum target, +st_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index a307bb9dc1..183477a3f3 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -516,7 +516,7 @@ st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target struct pipe_resource *tex, boolean mipmap) { struct st_context *st = (struct st_context *) stctxi; - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj; struct gl_texture_image *texImage; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 582ca6f173..c5c239b2c9 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -924,7 +924,7 @@ emit_edgeflags( struct st_translate *t, */ enum pipe_error st_translate_mesa_program( - GLcontext *ctx, + struct gl_context *ctx, uint procType, struct ureg_program *ureg, const struct gl_program *program, diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index ca076ce362..9bfd4960b6 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -44,7 +44,7 @@ struct gl_program; enum pipe_error st_translate_mesa_program( - GLcontext *ctx, + struct gl_context *ctx, uint procType, struct ureg_program *ureg, const struct gl_program *program, diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 733cdd0ac9..95e6bd7dac 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -716,7 +716,7 @@ st_translate_geometry_program(struct st_context *st, * Debug- print current shader text */ void -st_print_shaders(GLcontext *ctx) +st_print_shaders(struct gl_context *ctx) { struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; if (shProg) { diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 3805b9a725..72dbc715fe 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -223,7 +223,7 @@ st_vp_release_varients( struct st_context *st, struct st_vertex_program *stvp ); extern void -st_print_shaders(GLcontext *ctx); +st_print_shaders(struct gl_context *ctx); #endif diff --git a/src/mesa/swrast/NOTES b/src/mesa/swrast/NOTES index f906e41b95..ea373aa127 100644 --- a/src/mesa/swrast/NOTES +++ b/src/mesa/swrast/NOTES @@ -21,24 +21,24 @@ STATE To create and destroy the module: - GLboolean _swrast_CreateContext( GLcontext *ctx ); - void _swrast_DestroyContext( GLcontext *ctx ); + GLboolean _swrast_CreateContext( struct gl_context *ctx ); + void _swrast_DestroyContext( struct gl_context *ctx ); This module tracks state changes internally and maintains derived values based on the current state. For this to work, the driver ensure the following funciton is called whenever the state changes and the swsetup module is 'awake': - void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state ); + void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state ); There is no explicit call to put the swrast module to sleep. CUSTOMIZATION - void (*choose_point)( GLcontext * ); - void (*choose_line)( GLcontext * ); - void (*choose_triangle)( GLcontext * ); + void (*choose_point)( struct gl_context * ); + void (*choose_line)( struct gl_context * ); + void (*choose_triangle)( struct gl_context * ); Drivers may add additional triangle/line/point functions to swrast by overriding these functions. It is necessary for the driver to be very diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index 6ba4604e69..65b9af06af 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -323,7 +323,7 @@ compute_coveragef(const struct LineInfo *info, } -typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, +typedef void (*plot_func)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy); @@ -332,7 +332,7 @@ typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, * Draw an AA line segment (called many times per line when stippling) */ static void -segment(GLcontext *ctx, +segment(struct gl_context *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1) @@ -472,7 +472,7 @@ segment(GLcontext *ctx, void -_swrast_choose_aa_line_function(GLcontext *ctx) +_swrast_choose_aa_line_function(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/swrast/s_aaline.h b/src/mesa/swrast/s_aaline.h index 922eb230e5..f7d92c5241 100644 --- a/src/mesa/swrast/s_aaline.h +++ b/src/mesa/swrast/s_aaline.h @@ -32,7 +32,7 @@ extern void -_swrast_choose_aa_line_function(GLcontext *ctx); +_swrast_choose_aa_line_function(struct gl_context *ctx); #endif diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index c28d47a671..d99d9d3d90 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -34,7 +34,7 @@ * \param iy - integer fragment window Y coordiante */ static void -NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) +NAME(plot)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat fx = (GLfloat) ix; @@ -103,7 +103,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) * Line setup */ static void -NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) +NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat tStart, tEnd; /* segment start, end along line length */ diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index 175316790d..c597808e40 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -268,7 +268,7 @@ compute_coveragef(const GLfloat v0[3], const GLfloat v1[3], static void -rgba_aa_tri(GLcontext *ctx, +rgba_aa_tri(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) @@ -279,7 +279,7 @@ rgba_aa_tri(GLcontext *ctx, static void -general_aa_tri(GLcontext *ctx, +general_aa_tri(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) @@ -296,7 +296,7 @@ general_aa_tri(GLcontext *ctx, * appropriate antialiased triangle rasterizer function. */ void -_swrast_set_aa_triangle_function(GLcontext *ctx) +_swrast_set_aa_triangle_function(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/swrast/s_aatriangle.h b/src/mesa/swrast/s_aatriangle.h index 9aed41a191..746e456f5f 100644 --- a/src/mesa/swrast/s_aatriangle.h +++ b/src/mesa/swrast/s_aatriangle.h @@ -32,7 +32,7 @@ extern void -_swrast_set_aa_triangle_function(GLcontext *ctx); +_swrast_set_aa_triangle_function(struct gl_context *ctx); #endif diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 5c1c6d9044..91d4f7a10a 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -36,7 +36,7 @@ * DO_ATTRIBS - if defined, compute texcoords, varying, etc. */ -/*void triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ +/*void triangle( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat *p0 = v0->attrib[FRAG_ATTRIB_WPOS]; diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index 854e106b7f..88d107a17d 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -78,7 +78,7 @@ * representing the range[-1, 1]. */ static void -rescale_accum( GLcontext *ctx ) +rescale_accum( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb @@ -125,7 +125,7 @@ rescale_accum( GLcontext *ctx ) * Clear the accumulation Buffer. */ void -_swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +_swrast_clear_accum_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint x, y, width, height; @@ -179,7 +179,7 @@ _swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) static void -accum_add(GLcontext *ctx, GLfloat value, +accum_add(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -222,7 +222,7 @@ accum_add(GLcontext *ctx, GLfloat value, static void -accum_mult(GLcontext *ctx, GLfloat mult, +accum_mult(struct gl_context *ctx, GLfloat mult, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -265,7 +265,7 @@ accum_mult(GLcontext *ctx, GLfloat mult, static void -accum_accum(GLcontext *ctx, GLfloat value, +accum_accum(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -341,7 +341,7 @@ accum_accum(GLcontext *ctx, GLfloat value, static void -accum_load(GLcontext *ctx, GLfloat value, +accum_load(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -423,7 +423,7 @@ accum_load(GLcontext *ctx, GLfloat value, static void -accum_return(GLcontext *ctx, GLfloat value, +accum_return(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -540,7 +540,7 @@ accum_return(GLcontext *ctx, GLfloat value, * Software fallback for glAccum. */ void -_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value) +_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint xpos, ypos, width, height; diff --git a/src/mesa/swrast/s_accum.h b/src/mesa/swrast/s_accum.h index 42e38cf02b..071644b64f 100644 --- a/src/mesa/swrast/s_accum.h +++ b/src/mesa/swrast/s_accum.h @@ -31,7 +31,7 @@ extern void -_swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb); +_swrast_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb); #endif diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c index 509477433a..df2181ba96 100644 --- a/src/mesa/swrast/s_alpha.c +++ b/src/mesa/swrast/s_alpha.c @@ -90,7 +90,7 @@ do { \ * 1 if one or more pixels passed the alpha test. */ GLint -_swrast_alpha_test(const GLcontext *ctx, SWspan *span) +_swrast_alpha_test(const struct gl_context *ctx, SWspan *span) { const GLuint n = span->end; GLubyte *mask = span->array->mask; diff --git a/src/mesa/swrast/s_alpha.h b/src/mesa/swrast/s_alpha.h index 239484a974..7cd6d800b2 100644 --- a/src/mesa/swrast/s_alpha.h +++ b/src/mesa/swrast/s_alpha.h @@ -33,7 +33,7 @@ extern GLint -_swrast_alpha_test( const GLcontext *ctx, SWspan *span ); +_swrast_alpha_test( const struct gl_context *ctx, SWspan *span ); #endif diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 1338b6802d..1eb026e009 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -43,7 +43,7 @@ struct atifs_machine * Fetch a texel. */ static void -fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda, +fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -272,7 +272,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst, } static void -handle_sample_op(GLcontext * ctx, struct atifs_machine *machine, +handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, struct atifs_setupinst *texinst, const SWspan *span, GLuint column, GLuint idx) { @@ -311,7 +311,7 @@ do { \ * \param column - which pixel [i] we're operating on in the span */ static void -execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader, +execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader, struct atifs_machine *machine, const SWspan *span, GLuint column) { @@ -555,7 +555,7 @@ execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader, * Init fragment shader virtual machine state. */ static void -init_machine(GLcontext * ctx, struct atifs_machine *machine, +init_machine(struct gl_context * ctx, struct atifs_machine *machine, const struct ati_fragment_shader *shader, const SWspan *span, GLuint col) { @@ -577,7 +577,7 @@ init_machine(GLcontext * ctx, struct atifs_machine *machine, * Execute the current ATI shader program, operating on the given span. */ void -_swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span) +_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) { const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; struct atifs_machine machine; diff --git a/src/mesa/swrast/s_atifragshader.h b/src/mesa/swrast/s_atifragshader.h index cce455a046..39a6e64ed9 100644 --- a/src/mesa/swrast/s_atifragshader.h +++ b/src/mesa/swrast/s_atifragshader.h @@ -32,7 +32,7 @@ extern void -_swrast_exec_fragment_shader( GLcontext *ctx, SWspan *span ); +_swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span ); #endif diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index da730213ac..21488d3ba3 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -45,7 +45,7 @@ * All parameter error checking will have been done before this is called. */ void -_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, +_swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) @@ -144,7 +144,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, * draw or skip. */ void -_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, +_swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c index 5b090c72c7..1a550c445d 100644 --- a/src/mesa/swrast/s_blend.c +++ b/src/mesa/swrast/s_blend.c @@ -70,7 +70,7 @@ * Any chanType ok. */ static void _BLENDAPI -blend_noop(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_noop(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLint bytes; @@ -98,7 +98,7 @@ blend_noop(GLcontext *ctx, GLuint n, const GLubyte mask[], * Any chanType ok. */ static void _BLENDAPI -blend_replace(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_replace(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); @@ -118,7 +118,7 @@ blend_replace(GLcontext *ctx, GLuint n, const GLubyte mask[], * glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). */ static void _BLENDAPI -blend_transparency_ubyte(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_transparency_ubyte(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLubyte (*rgba)[4] = (GLubyte (*)[4]) src; @@ -163,7 +163,7 @@ blend_transparency_ubyte(GLcontext *ctx, GLuint n, const GLubyte mask[], static void _BLENDAPI -blend_transparency_ushort(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_transparency_ushort(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLushort (*rgba)[4] = (GLushort (*)[4]) src; @@ -201,7 +201,7 @@ blend_transparency_ushort(GLcontext *ctx, GLuint n, const GLubyte mask[], static void _BLENDAPI -blend_transparency_float(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_transparency_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLfloat (*rgba)[4] = (GLfloat (*)[4]) src; @@ -243,7 +243,7 @@ blend_transparency_float(GLcontext *ctx, GLuint n, const GLubyte mask[], * Any chanType ok. */ static void _BLENDAPI -blend_add(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLuint i; @@ -309,7 +309,7 @@ blend_add(GLcontext *ctx, GLuint n, const GLubyte mask[], * Any chanType ok. */ static void _BLENDAPI -blend_min(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLuint i; @@ -362,7 +362,7 @@ blend_min(GLcontext *ctx, GLuint n, const GLubyte mask[], * Any chanType ok. */ static void _BLENDAPI -blend_max(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLuint i; @@ -416,7 +416,7 @@ blend_max(GLcontext *ctx, GLuint n, const GLubyte mask[], * Any chanType ok. */ static void _BLENDAPI -blend_modulate(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_modulate(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLuint i; @@ -471,7 +471,7 @@ blend_modulate(GLcontext *ctx, GLuint n, const GLubyte mask[], * \param dest array of pixels from the dest color buffer */ static void -blend_general_float(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLfloat rgba[][4], GLfloat dest[][4], GLenum chanType) { @@ -816,7 +816,7 @@ blend_general_float(GLcontext *ctx, GLuint n, const GLubyte mask[], * Do any blending operation, any chanType. */ static void -blend_general(GLcontext *ctx, GLuint n, const GLubyte mask[], +blend_general(struct gl_context *ctx, GLuint n, const GLubyte mask[], void *src, const void *dst, GLenum chanType) { GLfloat rgbaF[MAX_WIDTH][4], destF[MAX_WIDTH][4]; @@ -892,7 +892,7 @@ blend_general(GLcontext *ctx, GLuint n, const GLubyte mask[], * Result: the ctx->Color.BlendFunc pointer is updated. */ void -_swrast_choose_blend_func(GLcontext *ctx, GLenum chanType) +_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLenum eq = ctx->Color.BlendEquationRGB; @@ -985,7 +985,7 @@ _swrast_choose_blend_func(GLcontext *ctx, GLenum chanType) * pixel coordinates. */ void -_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, SWspan *span) +_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span) { SWcontext *swrast = SWRAST_CONTEXT(ctx); void *rbPixels; diff --git a/src/mesa/swrast/s_blend.h b/src/mesa/swrast/s_blend.h index 9cedde3bf2..8b06dd5031 100644 --- a/src/mesa/swrast/s_blend.h +++ b/src/mesa/swrast/s_blend.h @@ -32,11 +32,11 @@ extern void -_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, SWspan *span); +_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); extern void -_swrast_choose_blend_func(GLcontext *ctx, GLenum chanType); +_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType); #endif diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c index 753f3136f5..d943e09b29 100644 --- a/src/mesa/swrast/s_blit.c +++ b/src/mesa/swrast/s_blit.c @@ -103,7 +103,7 @@ RESAMPLE(resample_row_16, GLuint, 4) * Blit color, depth or stencil with GL_NEAREST filtering. */ static void -blit_nearest(GLcontext *ctx, +blit_nearest(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield buffer) @@ -316,7 +316,7 @@ resample_linear_row_ub(GLint srcWidth, GLint dstWidth, * Bilinear filtered blit (color only). */ static void -blit_linear(GLcontext *ctx, +blit_linear(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1) { @@ -455,7 +455,7 @@ blit_linear(GLcontext *ctx, * XXX we could easily support vertical flipping here. */ static void -simple_blit(GLcontext *ctx, +simple_blit(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield buffer) @@ -556,7 +556,7 @@ simple_blit(GLcontext *ctx, * Software fallback for glBlitFramebufferEXT(). */ void -_swrast_BlitFramebuffer(GLcontext *ctx, +_swrast_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c index efe500ae2b..75805f9605 100644 --- a/src/mesa/swrast/s_clear.c +++ b/src/mesa/swrast/s_clear.c @@ -40,7 +40,7 @@ * Clear the color buffer when glColorMask is in effect. */ static void -clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb, +clear_rgba_buffer_with_masking(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint buf) { const GLint x = ctx->DrawBuffer->_Xmin; @@ -106,7 +106,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb, * Clear an rgba color buffer without channel masking. */ static void -clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf) +clear_rgba_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint buf) { const GLint x = ctx->DrawBuffer->_Xmin; const GLint y = ctx->DrawBuffer->_Ymin; @@ -159,7 +159,7 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf) * clear its own color buffers for some reason (such as with masking). */ static void -clear_color_buffers(GLcontext *ctx) +clear_color_buffers(struct gl_context *ctx) { GLuint buf; @@ -186,7 +186,7 @@ clear_color_buffers(GLcontext *ctx) * \param all if GL_TRUE, clear whole buffer, else clear specified region. */ void -_swrast_Clear(GLcontext *ctx, GLbitfield buffers) +_swrast_Clear(struct gl_context *ctx, GLbitfield buffers) { #ifdef DEBUG_FOO { diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index f76a2b68ec..491fcfcdbb 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -50,7 +50,7 @@ * stenciling, logic-op, fog, etc?). */ static void -_swrast_update_rasterflags( GLcontext *ctx ) +_swrast_update_rasterflags( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLbitfield rasterMask = 0; @@ -129,7 +129,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) * factors in. */ static void -_swrast_update_polygon( GLcontext *ctx ) +_swrast_update_polygon( struct gl_context *ctx ) { GLfloat backface_sign; @@ -165,7 +165,7 @@ _swrast_update_polygon( GLcontext *ctx ) * fog blend factors (from the fog coords) per-fragment. */ static void -_swrast_update_fog_hint( GLcontext *ctx ) +_swrast_update_fog_hint( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); swrast->_PreferPixelFog = (!swrast->AllowVertexFog || @@ -180,7 +180,7 @@ _swrast_update_fog_hint( GLcontext *ctx ) * Update the swrast->_TextureCombinePrimary flag. */ static void -_swrast_update_texture_env( GLcontext *ctx ) +_swrast_update_texture_env( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; @@ -211,7 +211,7 @@ _swrast_update_texture_env( GLcontext *ctx ) * lots of fragments. */ static void -_swrast_update_deferred_texture(GLcontext *ctx) +_swrast_update_deferred_texture(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (ctx->Color.AlphaEnabled) { @@ -243,7 +243,7 @@ _swrast_update_deferred_texture(GLcontext *ctx) * Update swrast->_FogColor and swrast->_FogEnable values. */ static void -_swrast_update_fog_state( GLcontext *ctx ) +_swrast_update_fog_state( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; @@ -268,7 +268,7 @@ _swrast_update_fog_state( GLcontext *ctx ) * program parameters with current state values. */ static void -_swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState) +_swrast_update_fragment_program(struct gl_context *ctx, GLbitfield newState) { const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; if (fp) { @@ -282,7 +282,7 @@ _swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState) * add per vertex instead of per-fragment. */ static void -_swrast_update_specular_vertex_add(GLcontext *ctx) +_swrast_update_specular_vertex_add(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLboolean separateSpecular = ctx->Fog.ColorSumEnabled || @@ -346,7 +346,7 @@ _swrast_update_specular_vertex_add(GLcontext *ctx) * after a state change. */ static void -_swrast_validate_triangle( GLcontext *ctx, +_swrast_validate_triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) @@ -371,7 +371,7 @@ _swrast_validate_triangle( GLcontext *ctx, * line routine. Then call it. */ static void -_swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) +_swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -392,7 +392,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) * point routine. Then call it. */ static void -_swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) +_swrast_validate_point( struct gl_context *ctx, const SWvertex *v0 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -413,7 +413,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) * function, then call it. */ static void _ASMAPI -_swrast_validate_blend_func(GLcontext *ctx, GLuint n, const GLubyte mask[], +_swrast_validate_blend_func(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType ) { @@ -431,7 +431,7 @@ _swrast_validate_blend_func(GLcontext *ctx, GLuint n, const GLubyte mask[], * for subsequent rendering. */ static void -_swrast_validate_texture_images(GLcontext *ctx) +_swrast_validate_texture_images(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint u; @@ -470,7 +470,7 @@ _swrast_validate_texture_images(GLcontext *ctx) * from software to hardware rendering. */ void -_swrast_eject_texture_images(GLcontext *ctx) +_swrast_eject_texture_images(struct gl_context *ctx) { GLuint u; @@ -504,14 +504,14 @@ _swrast_eject_texture_images(GLcontext *ctx) static void -_swrast_sleep( GLcontext *ctx, GLbitfield new_state ) +_swrast_sleep( struct gl_context *ctx, GLbitfield new_state ) { (void) ctx; (void) new_state; } static void -_swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state ) +_swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; @@ -546,7 +546,7 @@ _swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state ) void -_swrast_update_texture_samplers(GLcontext *ctx) +_swrast_update_texture_samplers(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint u; @@ -569,7 +569,7 @@ _swrast_update_texture_samplers(GLcontext *ctx) * swrast->_ActiveAtttribMask. */ static void -_swrast_update_active_attribs(GLcontext *ctx) +_swrast_update_active_attribs(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint attribsMask; @@ -626,7 +626,7 @@ _swrast_update_active_attribs(GLcontext *ctx) void -_swrast_validate_derived( GLcontext *ctx ) +_swrast_validate_derived( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -681,7 +681,7 @@ _swrast_validate_derived( GLcontext *ctx ) /* Public entrypoints: See also s_accum.c, s_bitmap.c, etc. */ void -_swrast_Quad( GLcontext *ctx, +_swrast_Quad( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2, const SWvertex *v3 ) { @@ -697,7 +697,7 @@ _swrast_Quad( GLcontext *ctx, } void -_swrast_Triangle( GLcontext *ctx, const SWvertex *v0, +_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { if (SWRAST_DEBUG) { @@ -710,7 +710,7 @@ _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, } void -_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) +_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_Line\n"); @@ -721,7 +721,7 @@ _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) } void -_swrast_Point( GLcontext *ctx, const SWvertex *v0 ) +_swrast_Point( struct gl_context *ctx, const SWvertex *v0 ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_Point\n"); @@ -731,7 +731,7 @@ _swrast_Point( GLcontext *ctx, const SWvertex *v0 ) } void -_swrast_InvalidateState( GLcontext *ctx, GLbitfield new_state ) +_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_InvalidateState\n"); @@ -740,7 +740,7 @@ _swrast_InvalidateState( GLcontext *ctx, GLbitfield new_state ) } void -_swrast_ResetLineStipple( GLcontext *ctx ) +_swrast_ResetLineStipple( struct gl_context *ctx ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_ResetLineStipple\n"); @@ -749,13 +749,13 @@ _swrast_ResetLineStipple( GLcontext *ctx ) } void -_swrast_SetFacing(GLcontext *ctx, GLuint facing) +_swrast_SetFacing(struct gl_context *ctx, GLuint facing) { SWRAST_CONTEXT(ctx)->PointLineFacing = facing; } void -_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) +_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value); @@ -765,7 +765,7 @@ _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) } void -_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) +_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value); @@ -776,7 +776,7 @@ _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) GLboolean -_swrast_CreateContext( GLcontext *ctx ) +_swrast_CreateContext( struct gl_context *ctx ) { GLuint i; SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext)); @@ -848,7 +848,7 @@ _swrast_CreateContext( GLcontext *ctx ) } void -_swrast_DestroyContext( GLcontext *ctx ) +_swrast_DestroyContext( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -867,14 +867,14 @@ _swrast_DestroyContext( GLcontext *ctx ) struct swrast_device_driver * -_swrast_GetDeviceDriverReference( GLcontext *ctx ) +_swrast_GetDeviceDriverReference( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); return &swrast->Driver; } void -_swrast_flush( GLcontext *ctx ) +_swrast_flush( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); /* flush any pending fragments from rendering points */ @@ -885,7 +885,7 @@ _swrast_flush( GLcontext *ctx ) } void -_swrast_render_primitive( GLcontext *ctx, GLenum prim ) +_swrast_render_primitive( struct gl_context *ctx, GLenum prim ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) { @@ -896,7 +896,7 @@ _swrast_render_primitive( GLcontext *ctx, GLenum prim ) void -_swrast_render_start( GLcontext *ctx ) +_swrast_render_start( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Driver.SpanRenderStart) @@ -905,7 +905,7 @@ _swrast_render_start( GLcontext *ctx ) } void -_swrast_render_finish( GLcontext *ctx ) +_swrast_render_finish( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Driver.SpanRenderFinish) @@ -918,7 +918,7 @@ _swrast_render_finish( GLcontext *ctx ) #define SWRAST_DEBUG_VERTICES 0 void -_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) +_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) { GLuint i; diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index 6d81f74768..5dbdd609ad 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -50,26 +50,26 @@ #include "s_span.h" -typedef void (*texture_sample_func)(GLcontext *ctx, +typedef void (*texture_sample_func)(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]); -typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, +typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType); -typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *); +typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *); -typedef void (*swrast_line_func)( GLcontext *ctx, +typedef void (*swrast_line_func)( struct gl_context *ctx, const SWvertex *, const SWvertex *); -typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, +typedef void (*swrast_tri_func)( struct gl_context *ctx, const SWvertex *, const SWvertex *, const SWvertex *); -typedef void (*validate_texture_image_func)(GLcontext *ctx, +typedef void (*validate_texture_image_func)(struct gl_context *ctx, struct gl_texture_object *texObj, GLuint face, GLuint level); @@ -160,7 +160,7 @@ typedef struct GLenum Primitive; /* current primitive being drawn (ala glBegin) */ GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */ - void (*InvalidateState)( GLcontext *ctx, GLbitfield new_state ); + void (*InvalidateState)( struct gl_context *ctx, GLbitfield new_state ); /** * When the NewState mask intersects these masks, we invalidate the @@ -177,9 +177,9 @@ typedef struct * Will be called when the GL state change mask intersects the above masks. */ /*@{*/ - void (*choose_point)( GLcontext * ); - void (*choose_line)( GLcontext * ); - void (*choose_triangle)( GLcontext * ); + void (*choose_point)( struct gl_context * ); + void (*choose_line)( struct gl_context * ); + void (*choose_triangle)( struct gl_context * ); /*@}*/ /** @@ -234,22 +234,22 @@ typedef struct extern void -_swrast_validate_derived( GLcontext *ctx ); +_swrast_validate_derived( struct gl_context *ctx ); extern void -_swrast_update_texture_samplers(GLcontext *ctx); +_swrast_update_texture_samplers(struct gl_context *ctx); -/** Return SWcontext for the given GLcontext */ +/** Return SWcontext for the given struct gl_context */ static INLINE SWcontext * -SWRAST_CONTEXT(GLcontext *ctx) +SWRAST_CONTEXT(struct gl_context *ctx) { return (SWcontext *) ctx->swrast_context; } /** const version of above */ static INLINE const SWcontext * -CONST_SWRAST_CONTEXT(const GLcontext *ctx) +CONST_SWRAST_CONTEXT(const struct gl_context *ctx) { return (const SWcontext *) ctx->swrast_context; } @@ -261,7 +261,7 @@ CONST_SWRAST_CONTEXT(const GLcontext *ctx) * driver's opportunity to map renderbuffers and textures. */ static INLINE void -swrast_render_start(GLcontext *ctx) +swrast_render_start(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Driver.SpanRenderStart) @@ -271,7 +271,7 @@ swrast_render_start(GLcontext *ctx) /** Called after framebuffer reading/writing */ static INLINE void -swrast_render_finish(GLcontext *ctx) +swrast_render_finish(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Driver.SpanRenderFinish) diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index c35494e385..86fe3e0a89 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -96,7 +96,7 @@ regions_overlap(GLint srcx, GLint srcy, * RGBA copypixels */ static void -copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, +copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty) { GLfloat *tmpImage, *p; @@ -205,7 +205,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, * Z scale and bias. */ static void -scale_and_bias_z(GLcontext *ctx, GLuint width, +scale_and_bias_z(struct gl_context *ctx, GLuint width, const GLfloat depth[], GLuint z[]) { const GLuint depthMax = ctx->DrawBuffer->_DepthMax; @@ -240,7 +240,7 @@ scale_and_bias_z(GLcontext *ctx, GLuint width, * TODO: Optimize!!!! */ static void -copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, +copy_depth_pixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { @@ -334,7 +334,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, static void -copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, +copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { @@ -427,7 +427,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, * CopyPixels function. */ static void -copy_depth_stencil_pixels(GLcontext *ctx, +copy_depth_stencil_pixels(struct gl_context *ctx, const GLint srcX, const GLint srcY, const GLint width, const GLint height, const GLint destX, const GLint destY) @@ -602,7 +602,7 @@ copy_depth_stencil_pixels(GLcontext *ctx, * Try to do a fast copy pixels. */ static GLboolean -fast_copy_pixels(GLcontext *ctx, +fast_copy_pixels(struct gl_context *ctx, GLint srcX, GLint srcY, GLsizei width, GLsizei height, GLint dstX, GLint dstY, GLenum type) { @@ -684,7 +684,7 @@ fast_copy_pixels(GLcontext *ctx, * By time we get here, all parameters will have been error-checked. */ void -_swrast_CopyPixels( GLcontext *ctx, +_swrast_CopyPixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index f952fd6baa..58440cb97b 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -40,7 +40,7 @@ * Return: number of fragments which pass the test. */ static GLuint -depth_test_span16( GLcontext *ctx, GLuint n, +depth_test_span16( struct gl_context *ctx, GLuint n, GLushort zbuffer[], const GLuint z[], GLubyte mask[] ) { GLuint passed = 0; @@ -269,7 +269,7 @@ depth_test_span16( GLcontext *ctx, GLuint n, static GLuint -depth_test_span32( GLcontext *ctx, GLuint n, +depth_test_span32( struct gl_context *ctx, GLuint n, GLuint zbuffer[], const GLuint z[], GLubyte mask[] ) { GLuint passed = 0; @@ -506,7 +506,7 @@ depth_test_span32( GLcontext *ctx, GLuint n, * [0,1] range. */ void -_swrast_depth_clamp_span( GLcontext *ctx, SWspan *span ) +_swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span ) { struct gl_framebuffer *fb = ctx->DrawBuffer; const GLuint count = span->end; @@ -552,7 +552,7 @@ _swrast_depth_clamp_span( GLcontext *ctx, SWspan *span ) * Apply depth test to span of fragments. */ static GLuint -depth_test_span( GLcontext *ctx, SWspan *span) +depth_test_span( struct gl_context *ctx, SWspan *span) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->_DepthBuffer; @@ -610,7 +610,7 @@ depth_test_span( GLcontext *ctx, SWspan *span) * Do depth testing for an array of fragments at assorted locations. */ static void -direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride, +direct_depth_test_pixels16(struct gl_context *ctx, GLushort *zStart, GLuint stride, GLuint n, const GLint x[], const GLint y[], const GLuint z[], GLubyte mask[] ) { @@ -856,7 +856,7 @@ direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride, * Do depth testing for an array of fragments with direct access to zbuffer. */ static void -direct_depth_test_pixels32(GLcontext *ctx, GLuint *zStart, GLuint stride, +direct_depth_test_pixels32(struct gl_context *ctx, GLuint *zStart, GLuint stride, GLuint n, const GLint x[], const GLint y[], const GLuint z[], GLubyte mask[] ) { @@ -1100,7 +1100,7 @@ direct_depth_test_pixels32(GLcontext *ctx, GLuint *zStart, GLuint stride, static GLuint -depth_test_pixels( GLcontext *ctx, SWspan *span ) +depth_test_pixels( struct gl_context *ctx, SWspan *span ) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->_DepthBuffer; @@ -1150,7 +1150,7 @@ depth_test_pixels( GLcontext *ctx, SWspan *span ) * \return approx number of pixels that passed (only zero is reliable) */ GLuint -_swrast_depth_test_span( GLcontext *ctx, SWspan *span) +_swrast_depth_test_span( struct gl_context *ctx, SWspan *span) { if (span->arrayMask & SPAN_XY) return depth_test_pixels(ctx, span); @@ -1167,7 +1167,7 @@ _swrast_depth_test_span( GLcontext *ctx, SWspan *span) * \return GL_TRUE if any fragments pass, GL_FALSE if no fragments pass */ GLboolean -_swrast_depth_bounds_test( GLcontext *ctx, SWspan *span ) +_swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span ) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->_DepthBuffer; @@ -1252,7 +1252,7 @@ _swrast_depth_bounds_test( GLcontext *ctx, SWspan *span ) * _swrast_ReadPixels. */ void -_swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLfloat depth[] ) { const GLfloat scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; @@ -1318,7 +1318,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, * As above, but return 32-bit GLuint values. */ void -_swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLuint depth[] ) { GLuint depthBits; @@ -1400,7 +1400,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, * Clear the given z/depth renderbuffer. */ void -_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +_swrast_clear_depth_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb ) { GLuint clearValue; GLint x, y, width, height; diff --git a/src/mesa/swrast/s_depth.h b/src/mesa/swrast/s_depth.h index 878d242f5e..e5dae7ef86 100644 --- a/src/mesa/swrast/s_depth.h +++ b/src/mesa/swrast/s_depth.h @@ -32,27 +32,27 @@ extern GLuint -_swrast_depth_test_span( GLcontext *ctx, SWspan *span); +_swrast_depth_test_span( struct gl_context *ctx, SWspan *span); extern void -_swrast_depth_clamp_span( GLcontext *ctx, SWspan *span ); +_swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span ); extern GLboolean -_swrast_depth_bounds_test( GLcontext *ctx, SWspan *span ); +_swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span ); extern void -_swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLfloat depth[] ); extern void -_swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLuint depth[] ); extern void -_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ); +_swrast_clear_depth_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb ); #endif diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 7778820c5c..4e7cd9414f 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -44,7 +44,7 @@ * Return: GL_TRUE if success, GL_FALSE if slow path must be used instead */ static GLboolean -fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, +fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *userUnpack, @@ -310,7 +310,7 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, * Draw stencil image. */ static void -draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, +draw_stencil_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -354,7 +354,7 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, * Draw depth image. */ static void -draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, +draw_depth_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -460,7 +460,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, * Draw RGBA image. */ static void -draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, +draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -557,7 +557,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, * color buffer(s). */ static void -draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y, +draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) @@ -687,7 +687,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y, * By time we get here, all error checking will have been done. */ void -_swrast_DrawPixels( GLcontext *ctx, +_swrast_DrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 6ac8ac73b0..00f92d463c 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -34,7 +34,7 @@ static void -feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv) +feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv) { GLfloat win[4]; const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0]; @@ -53,7 +53,7 @@ feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv) * Put triangle in feedback buffer. */ void -_swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0, +_swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (!_swrast_culltriangle(ctx, v0, v1, v2)) { @@ -75,7 +75,7 @@ _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0, void -_swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, +_swrast_feedback_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { GLenum token = GL_LINE_TOKEN; @@ -100,7 +100,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, void -_swrast_feedback_point(GLcontext *ctx, const SWvertex *v) +_swrast_feedback_point(struct gl_context *ctx, const SWvertex *v) { _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); feedback_vertex(ctx, v, v); @@ -108,7 +108,7 @@ _swrast_feedback_point(GLcontext *ctx, const SWvertex *v) void -_swrast_select_triangle(GLcontext *ctx, const SWvertex *v0, +_swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (!_swrast_culltriangle(ctx, v0, v1, v2)) { @@ -122,7 +122,7 @@ _swrast_select_triangle(GLcontext *ctx, const SWvertex *v0, void -_swrast_select_line(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) +_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); @@ -131,7 +131,7 @@ _swrast_select_line(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) void -_swrast_select_point(GLcontext *ctx, const SWvertex *v) +_swrast_select_point(struct gl_context *ctx, const SWvertex *v) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); diff --git a/src/mesa/swrast/s_feedback.h b/src/mesa/swrast/s_feedback.h index 9feab75dbb..6bfd49735c 100644 --- a/src/mesa/swrast/s_feedback.h +++ b/src/mesa/swrast/s_feedback.h @@ -31,20 +31,20 @@ #include "swrast.h" -extern void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ); +extern void _swrast_feedback_point( struct gl_context *ctx, const SWvertex *v ); -extern void _swrast_feedback_line( GLcontext *ctx, +extern void _swrast_feedback_line( struct gl_context *ctx, const SWvertex *v1, const SWvertex *v2 ); -extern void _swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0, +extern void _swrast_feedback_triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); -extern void _swrast_select_point( GLcontext *ctx, const SWvertex *v ); +extern void _swrast_select_point( struct gl_context *ctx, const SWvertex *v ); -extern void _swrast_select_line( GLcontext *ctx, +extern void _swrast_select_line( struct gl_context *ctx, const SWvertex *v1, const SWvertex *v2 ); -extern void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, +extern void _swrast_select_triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); #endif diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c index 689500a613..d808e2b2a2 100644 --- a/src/mesa/swrast/s_fog.c +++ b/src/mesa/swrast/s_fog.c @@ -35,7 +35,7 @@ * Used to convert current raster distance to a fog factor in [0,1]. */ GLfloat -_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z) +_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z) { GLfloat d, f; @@ -129,7 +129,7 @@ else { \ * _PreferPixelFog should be in sync with that state! */ void -_swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span ) +_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) { const SWcontext *swrast = CONST_SWRAST_CONTEXT(ctx); GLfloat rFog, gFog, bFog; diff --git a/src/mesa/swrast/s_fog.h b/src/mesa/swrast/s_fog.h index a496746d10..ebc3513f49 100644 --- a/src/mesa/swrast/s_fog.h +++ b/src/mesa/swrast/s_fog.h @@ -33,9 +33,9 @@ extern GLfloat -_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z); +_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z); extern void -_swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span ); +_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ); #endif diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 9facb44d9b..e421d218d7 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -62,7 +62,7 @@ swizzle_texel(const GLfloat texel[4], GLfloat colorOut[4], GLuint swizzle) * Called via machine->FetchTexelLod() */ static void -fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, +fetch_texel_lod( struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4] ) { const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; @@ -92,7 +92,7 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, * otherwise zero. */ static void -fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], +fetch_texel_deriv( struct gl_context *ctx, const GLfloat texcoord[4], const GLfloat texdx[4], const GLfloat texdy[4], GLfloat lodBias, GLuint unit, GLfloat color[4] ) { @@ -140,7 +140,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], * \param col which element (column) of the span we'll operate on */ static void -init_machine(GLcontext *ctx, struct gl_program_machine *machine, +init_machine(struct gl_context *ctx, struct gl_program_machine *machine, const struct gl_fragment_program *program, const SWspan *span, GLuint col) { @@ -194,7 +194,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, * Run fragment program on the pixels in span from 'start' to 'end' - 1. */ static void -run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) +run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_fragment_program *program = ctx->FragmentProgram._Current; @@ -253,7 +253,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) * in the given span. */ void -_swrast_exec_fragment_program( GLcontext *ctx, SWspan *span ) +_swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span ) { const struct gl_fragment_program *program = ctx->FragmentProgram._Current; diff --git a/src/mesa/swrast/s_fragprog.h b/src/mesa/swrast/s_fragprog.h index 92b9d01e17..689d3fc82e 100644 --- a/src/mesa/swrast/s_fragprog.h +++ b/src/mesa/swrast/s_fragprog.h @@ -32,7 +32,7 @@ extern void -_swrast_exec_fragment_program(GLcontext *ctx, SWspan *span); +_swrast_exec_fragment_program(struct gl_context *ctx, SWspan *span); #endif /* S_FRAGPROG_H */ diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index 7db5af4ae1..95a2a5d96f 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -38,7 +38,7 @@ * Init the mask[] array to implement a line stipple. */ static void -compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) +compute_stipple_mask( struct gl_context *ctx, GLuint len, GLubyte mask[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; @@ -60,7 +60,7 @@ compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) * To draw a wide line we can simply redraw the span N times, side by side. */ static void -draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) +draw_wide_line( struct gl_context *ctx, SWspan *span, GLboolean xMajor ) { const GLint width = (GLint) CLAMP(ctx->Line.Width, ctx->Const.MinLineWidth, @@ -160,7 +160,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) void -_swrast_add_spec_terms_line(GLcontext *ctx, +_swrast_add_spec_terms_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { SWvertex *ncv0 = (SWvertex *)v0; @@ -222,7 +222,7 @@ do { \ * tests to this code. */ void -_swrast_choose_line( GLcontext *ctx ) +_swrast_choose_line( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLboolean specular = (ctx->Fog.ColorSumEnabled || diff --git a/src/mesa/swrast/s_lines.h b/src/mesa/swrast/s_lines.h index 22979a02b6..a4c98a8558 100644 --- a/src/mesa/swrast/s_lines.h +++ b/src/mesa/swrast/s_lines.h @@ -30,10 +30,10 @@ #include "swrast.h" void -_swrast_choose_line( GLcontext *ctx ); +_swrast_choose_line( struct gl_context *ctx ); void -_swrast_add_spec_terms_line( GLcontext *ctx, +_swrast_add_spec_terms_line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 ); diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index 033431df23..f9f2d29341 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -63,7 +63,7 @@ static void -NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) +NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c index c36a16e665..b93b4b7af3 100644 --- a/src/mesa/swrast/s_logic.c +++ b/src/mesa/swrast/s_logic.c @@ -158,7 +158,7 @@ do { \ static INLINE void -logicop_uint1(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], +logicop_uint1(struct gl_context *ctx, GLuint n, GLuint src[], const GLuint dest[], const GLubyte mask[]) { LOGIC_OP_LOOP(ctx->Color.LogicOp, 1); @@ -166,7 +166,7 @@ logicop_uint1(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], static INLINE void -logicop_uint2(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], +logicop_uint2(struct gl_context *ctx, GLuint n, GLuint src[], const GLuint dest[], const GLubyte mask[]) { LOGIC_OP_LOOP(ctx->Color.LogicOp, 2); @@ -174,7 +174,7 @@ logicop_uint2(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], static INLINE void -logicop_uint4(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], +logicop_uint4(struct gl_context *ctx, GLuint n, GLuint src[], const GLuint dest[], const GLubyte mask[]) { LOGIC_OP_LOOP(ctx->Color.LogicOp, 4); @@ -188,7 +188,7 @@ logicop_uint4(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], * pixel coordinates. */ void -_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span) { void *rbPixels; diff --git a/src/mesa/swrast/s_logic.h b/src/mesa/swrast/s_logic.h index d609513348..95c7fe3e15 100644 --- a/src/mesa/swrast/s_logic.h +++ b/src/mesa/swrast/s_logic.h @@ -31,7 +31,7 @@ #include "s_span.h" extern void -_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c index e38d90f199..2e68f8c4bd 100644 --- a/src/mesa/swrast/s_masking.c +++ b/src/mesa/swrast/s_masking.c @@ -40,7 +40,7 @@ * Apply the color mask to a span of rgba values. */ void -_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span, GLuint buf) { const GLuint n = span->end; diff --git a/src/mesa/swrast/s_masking.h b/src/mesa/swrast/s_masking.h index cb000da0fd..3712c82163 100644 --- a/src/mesa/swrast/s_masking.h +++ b/src/mesa/swrast/s_masking.h @@ -32,7 +32,7 @@ extern void -_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span, GLuint buf); #endif diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index 12431662c4..06c6ef4ef7 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -52,7 +52,7 @@ * Must also clamp to user-defined range and implmentation limits. */ static INLINE GLfloat -get_size(const GLcontext *ctx, const SWvertex *vert, GLboolean smoothed) +get_size(const struct gl_context *ctx, const SWvertex *vert, GLboolean smoothed) { GLfloat size; @@ -80,7 +80,7 @@ get_size(const GLcontext *ctx, const SWvertex *vert, GLboolean smoothed) * Draw a point sprite */ static void -sprite_point(GLcontext *ctx, const SWvertex *vert) +sprite_point(struct gl_context *ctx, const SWvertex *vert) { SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; @@ -240,7 +240,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert) * Draw smooth/antialiased point. RGB or CI mode. */ static void -smooth_point(GLcontext *ctx, const SWvertex *vert) +smooth_point(struct gl_context *ctx, const SWvertex *vert) { SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; @@ -360,7 +360,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert) * Draw large (size >= 1) non-AA point. RGB or CI mode. */ static void -large_point(GLcontext *ctx, const SWvertex *vert) +large_point(struct gl_context *ctx, const SWvertex *vert) { SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; @@ -449,7 +449,7 @@ large_point(GLcontext *ctx, const SWvertex *vert) * Draw size=1, single-pixel point */ static void -pixel_point(GLcontext *ctx, const SWvertex *vert) +pixel_point(struct gl_context *ctx, const SWvertex *vert) { SWcontext *swrast = SWRAST_CONTEXT(ctx); /* @@ -513,7 +513,7 @@ pixel_point(GLcontext *ctx, const SWvertex *vert) * primary color. */ void -_swrast_add_spec_terms_point(GLcontext *ctx, const SWvertex *v0) +_swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0) { SWvertex *ncv0 = (SWvertex *) v0; /* cast away const */ GLfloat rSum, gSum, bSum; @@ -539,7 +539,7 @@ _swrast_add_spec_terms_point(GLcontext *ctx, const SWvertex *v0) * Examine current state to determine which point drawing function to use. */ void -_swrast_choose_point(GLcontext *ctx) +_swrast_choose_point(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat size = CLAMP(ctx->Point.Size, diff --git a/src/mesa/swrast/s_points.h b/src/mesa/swrast/s_points.h index 9e39c601ef..0b6550e801 100644 --- a/src/mesa/swrast/s_points.h +++ b/src/mesa/swrast/s_points.h @@ -30,10 +30,10 @@ #include "swrast.h" extern void -_swrast_choose_point( GLcontext *ctx ); +_swrast_choose_point( struct gl_context *ctx ); extern void -_swrast_add_spec_terms_point( GLcontext *ctx, +_swrast_add_spec_terms_point( struct gl_context *ctx, const SWvertex *v0 ); #endif diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index b0a3d36420..55fa60749e 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -43,7 +43,7 @@ * Read pixels for format=GL_DEPTH_COMPONENT. */ static void -read_depth_pixels( GLcontext *ctx, +read_depth_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, GLvoid *pixels, @@ -139,7 +139,7 @@ read_depth_pixels( GLcontext *ctx, * Read pixels for format=GL_STENCIL_INDEX. */ static void -read_stencil_pixels( GLcontext *ctx, +read_stencil_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, GLvoid *pixels, @@ -177,7 +177,7 @@ read_stencil_pixels( GLcontext *ctx, * \return GL_TRUE if success, GL_FALSE if unable to do the readpixels */ static GLboolean -fast_read_rgba_pixels( GLcontext *ctx, +fast_read_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -297,7 +297,7 @@ adjust_colors(const struct gl_framebuffer *fb, GLuint n, GLfloat rgba[][4]) * Read R, G, B, A, RGB, L, or LA pixels. */ static void -read_rgba_pixels( GLcontext *ctx, +read_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, @@ -362,7 +362,7 @@ read_rgba_pixels( GLcontext *ctx, * depth and stencil buffers really exist. */ static void -read_depth_stencil_pixels(GLcontext *ctx, +read_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, GLvoid *pixels, @@ -453,7 +453,7 @@ read_depth_stencil_pixels(GLcontext *ctx, * By time we get here, all error checking will have been done. */ void -_swrast_ReadPixels( GLcontext *ctx, +_swrast_ReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 28c82990e0..3240b13577 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -57,7 +57,7 @@ * and glBitmap. */ void -_swrast_span_default_attribs(GLcontext *ctx, SWspan *span) +_swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) { GLchan r, g, b, a; /* Z*/ @@ -163,7 +163,7 @@ _swrast_span_default_attribs(GLcontext *ctx, SWspan *span) * should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]! */ static INLINE void -interpolate_active_attribs(GLcontext *ctx, SWspan *span, GLbitfield attrMask) +interpolate_active_attribs(struct gl_context *ctx, SWspan *span, GLbitfield attrMask) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -210,7 +210,7 @@ interpolate_active_attribs(GLcontext *ctx, SWspan *span, GLbitfield attrMask) * color array. */ static INLINE void -interpolate_int_colors(GLcontext *ctx, SWspan *span) +interpolate_int_colors(struct gl_context *ctx, SWspan *span) { const GLuint n = span->end; GLuint i; @@ -370,7 +370,7 @@ interpolate_float_colors(SWspan *span) * Fill in the span.zArray array from the span->z, zStep values. */ void -_swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span ) +_swrast_span_interpolate_z( const struct gl_context *ctx, SWspan *span ) { const GLuint n = span->end; GLuint i; @@ -460,7 +460,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, * texels with (s/q, t/q, r/q). */ static void -interpolate_texcoords(GLcontext *ctx, SWspan *span) +interpolate_texcoords(struct gl_context *ctx, SWspan *span) { const GLuint maxUnit = (ctx->Texture._EnabledCoordUnits > 1) ? ctx->Const.MaxTextureUnits : 1; @@ -601,7 +601,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span) * Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array. */ static INLINE void -interpolate_wpos(GLcontext *ctx, SWspan *span) +interpolate_wpos(struct gl_context *ctx, SWspan *span) { GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS]; GLuint i; @@ -635,7 +635,7 @@ interpolate_wpos(GLcontext *ctx, SWspan *span) * Apply the current polygon stipple pattern to a span of pixels. */ static INLINE void -stipple_polygon_span(GLcontext *ctx, SWspan *span) +stipple_polygon_span(struct gl_context *ctx, SWspan *span) { GLubyte *mask = span->array->mask; @@ -680,7 +680,7 @@ stipple_polygon_span(GLcontext *ctx, SWspan *span) * GL_FALSE nothing visible */ static INLINE GLuint -clip_span( GLcontext *ctx, SWspan *span ) +clip_span( struct gl_context *ctx, SWspan *span ) { const GLint xmin = ctx->DrawBuffer->_Xmin; const GLint xmax = ctx->DrawBuffer->_Xmax; @@ -807,7 +807,7 @@ clip_span( GLcontext *ctx, SWspan *span ) * Result is float color array (FRAG_ATTRIB_COL0). */ static INLINE void -add_specular(GLcontext *ctx, SWspan *span) +add_specular(struct gl_context *ctx, SWspan *span) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLubyte *mask = span->array->mask; @@ -951,7 +951,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) * Apply fragment shader, fragment program or normal texturing to span. */ static INLINE void -shade_texture_span(GLcontext *ctx, SWspan *span) +shade_texture_span(struct gl_context *ctx, SWspan *span) { GLbitfield inputsRead; @@ -1029,7 +1029,7 @@ shade_texture_span(GLcontext *ctx, SWspan *span) * to their original values before returning. */ void -_swrast_write_rgba_span( GLcontext *ctx, SWspan *span) +_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLuint *colorMask = (GLuint *) ctx->Color.ColorMask; @@ -1304,7 +1304,7 @@ end: * \param rgba the returned colors */ void -_swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_rgba_span( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLenum dstType, GLvoid *rgba) { @@ -1373,7 +1373,7 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, * values array. */ void -_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values, GLuint valueSize) { @@ -1409,7 +1409,7 @@ _swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, * \param valueSize size of each value (pixel) in bytes */ void -_swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const GLvoid *values, GLuint valueSize) { @@ -1444,7 +1444,7 @@ _swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, * \param valueSize size of each value (pixel) in bytes */ void -_swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, GLvoid *values, GLuint valueSize) { @@ -1479,7 +1479,7 @@ _swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, * \return pointer to the colors we read. */ void * -_swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span) { const GLuint pixelSize = RGBA_PIXEL_SIZE(span->array->ChanType); diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h index aaf1fec2a8..18e275ec8a 100644 --- a/src/mesa/swrast/s_span.h +++ b/src/mesa/swrast/s_span.h @@ -176,10 +176,10 @@ do { \ extern void -_swrast_span_default_attribs(GLcontext *ctx, SWspan *span); +_swrast_span_default_attribs(struct gl_context *ctx, SWspan *span); extern void -_swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span ); +_swrast_span_interpolate_z( const struct gl_context *ctx, SWspan *span ); extern GLfloat _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, @@ -188,31 +188,31 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, extern void -_swrast_write_rgba_span( GLcontext *ctx, SWspan *span); +_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span); extern void -_swrast_read_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLenum type, GLvoid *rgba); extern void -_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values, GLuint valueSize); extern void -_swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const GLvoid *values, GLuint valueSize); extern void -_swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, GLvoid *values, GLuint valueSize); extern void * -_swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); #endif diff --git a/src/mesa/swrast/s_spantemp.h b/src/mesa/swrast/s_spantemp.h index 2948a90f6b..8a9485085e 100644 --- a/src/mesa/swrast/s_spantemp.h +++ b/src/mesa/swrast/s_spantemp.h @@ -51,7 +51,7 @@ static void -NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values ) { #ifdef SPAN_VARS @@ -69,7 +69,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values ) { #ifdef SPAN_VARS @@ -86,7 +86,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { @@ -115,7 +115,7 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_row_rgb)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { @@ -140,7 +140,7 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_mono_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -169,7 +169,7 @@ NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) { @@ -190,7 +190,7 @@ NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_mono_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte mask[] ) { diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index aa74b21ee8..5bec71c057 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -61,7 +61,7 @@ ENDIF * Output: stencil - modified values */ static void -apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, +apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face, GLuint n, GLstencil stencil[], const GLubyte mask[] ) { const GLstencil ref = ctx->Stencil.Ref[face]; @@ -225,7 +225,7 @@ apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, * Return: GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed. */ static GLboolean -do_stencil_test( GLcontext *ctx, GLuint face, GLuint n, GLstencil stencil[], +do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stencil[], GLubyte mask[] ) { GLubyte fail[MAX_WIDTH]; @@ -418,7 +418,7 @@ compute_pass_fail_masks(GLuint n, const GLubyte origMask[], * */ static GLboolean -stencil_and_ztest_span(GLcontext *ctx, SWspan *span, GLuint face) +stencil_and_ztest_span(struct gl_context *ctx, SWspan *span, GLuint face) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->_StencilBuffer; @@ -524,7 +524,7 @@ stencil_and_ztest_span(GLcontext *ctx, SWspan *span, GLuint face) * mask - array [n] of flag: 1=apply operator, 0=don't apply operator */ static void -apply_stencil_op_to_pixels( GLcontext *ctx, +apply_stencil_op_to_pixels( struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLenum oper, GLuint face, const GLubyte mask[] ) { @@ -698,7 +698,7 @@ apply_stencil_op_to_pixels( GLcontext *ctx, * \return GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed. */ static GLboolean -stencil_test_pixels( GLcontext *ctx, GLuint face, GLuint n, +stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n, const GLint x[], const GLint y[], GLubyte mask[] ) { const struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -897,7 +897,7 @@ stencil_test_pixels( GLcontext *ctx, GLuint face, GLuint n, * GL_TRUE - one or more fragments passed the testing */ static GLboolean -stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face ) +stencil_and_ztest_pixels( struct gl_context *ctx, SWspan *span, GLuint face ) { GLubyte passMask[MAX_WIDTH], failMask[MAX_WIDTH], origMask[MAX_WIDTH]; struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -990,7 +990,7 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face ) * GL_FALSE = all fragments failed. */ GLboolean -_swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span) +_swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span) { const GLuint face = (span->facing == 0) ? 0 : ctx->Stencil._BackFace; @@ -1042,7 +1042,7 @@ clip_span(GLuint bufferWidth, GLuint bufferHeight, * Output: stencil - the array of stencil values */ void -_swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLstencil stencil[]) { if (y < 0 || y >= (GLint) rb->Height || @@ -1079,7 +1079,7 @@ _swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, * stencil - the array of stencil values */ void -_swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y, +_swrast_write_stencil_span(struct gl_context *ctx, GLint n, GLint x, GLint y, const GLstencil stencil[] ) { struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -1128,7 +1128,7 @@ _swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y, * Clear the stencil buffer. */ void -_swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +_swrast_clear_stencil_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb ) { const GLubyte stencilBits = ctx->DrawBuffer->Visual.stencilBits; const GLuint mask = ctx->Stencil.WriteMask[0]; diff --git a/src/mesa/swrast/s_stencil.h b/src/mesa/swrast/s_stencil.h index c076ebbe2a..00f5179e04 100644 --- a/src/mesa/swrast/s_stencil.h +++ b/src/mesa/swrast/s_stencil.h @@ -33,21 +33,21 @@ extern GLboolean -_swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span); +_swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span); extern void -_swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, +_swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLstencil stencil[]); extern void -_swrast_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, +_swrast_write_stencil_span( struct gl_context *ctx, GLint n, GLint x, GLint y, const GLstencil stencil[] ); extern void -_swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ); +_swrast_clear_stencil_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb ); #endif diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 2ac0aaa246..1775810eff 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -72,7 +72,7 @@ get_texel_array(SWcontext *swrast, GLuint unit) * \param rgba incoming/result fragment colors */ static void -texture_combine( GLcontext *ctx, GLuint unit, GLuint n, +texture_combine( struct gl_context *ctx, GLuint unit, GLuint n, const float4_array primary_rgba, const GLfloat *texelBuffer, GLchan (*rgbaChan)[4] ) @@ -556,7 +556,7 @@ swizzle_texels(GLuint swizzle, GLuint count, float4_array texels) * Apply texture mapping to a span of fragments. */ void -_swrast_texture_span( GLcontext *ctx, SWspan *span ) +_swrast_texture_span( struct gl_context *ctx, SWspan *span ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat primary_rgba[MAX_WIDTH][4]; diff --git a/src/mesa/swrast/s_texcombine.h b/src/mesa/swrast/s_texcombine.h index 4f5dfbe1af..5f47ebecbf 100644 --- a/src/mesa/swrast/s_texcombine.h +++ b/src/mesa/swrast/s_texcombine.h @@ -31,6 +31,6 @@ #include "s_span.h" extern void -_swrast_texture_span( GLcontext *ctx, SWspan *span ); +_swrast_texture_span( struct gl_context *ctx, SWspan *span ); #endif diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index e5ffe8fa5c..ec281776d0 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -798,7 +798,7 @@ get_border_color(const struct gl_texture_object *tObj, * Return the texture sample for coordinate (s) using GL_NEAREST filter. */ static INLINE void -sample_1d_nearest(GLcontext *ctx, +sample_1d_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) @@ -822,7 +822,7 @@ sample_1d_nearest(GLcontext *ctx, * Return the texture sample for coordinate (s) using GL_LINEAR filter. */ static INLINE void -sample_1d_linear(GLcontext *ctx, +sample_1d_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) @@ -863,7 +863,7 @@ sample_1d_linear(GLcontext *ctx, static void -sample_1d_nearest_mipmap_nearest(GLcontext *ctx, +sample_1d_nearest_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -878,7 +878,7 @@ sample_1d_nearest_mipmap_nearest(GLcontext *ctx, static void -sample_1d_linear_mipmap_nearest(GLcontext *ctx, +sample_1d_linear_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -893,7 +893,7 @@ sample_1d_linear_mipmap_nearest(GLcontext *ctx, static void -sample_1d_nearest_mipmap_linear(GLcontext *ctx, +sample_1d_nearest_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -918,7 +918,7 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx, static void -sample_1d_linear_mipmap_linear(GLcontext *ctx, +sample_1d_linear_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -944,7 +944,7 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx, /** Sample 1D texture, nearest filtering for both min/magnification */ static void -sample_nearest_1d( GLcontext *ctx, +sample_nearest_1d( struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4] ) @@ -960,7 +960,7 @@ sample_nearest_1d( GLcontext *ctx, /** Sample 1D texture, linear filtering for both min/magnification */ static void -sample_linear_1d( GLcontext *ctx, +sample_linear_1d( struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4] ) @@ -976,7 +976,7 @@ sample_linear_1d( GLcontext *ctx, /** Sample 1D texture, using lambda to choose between min/magnification */ static void -sample_lambda_1d( GLcontext *ctx, +sample_lambda_1d( struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4] ) @@ -1055,7 +1055,7 @@ sample_lambda_1d( GLcontext *ctx, * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. */ static INLINE void -sample_2d_nearest(GLcontext *ctx, +sample_2d_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -1088,7 +1088,7 @@ sample_2d_nearest(GLcontext *ctx, * New sampling code contributed by Lynn Quam . */ static INLINE void -sample_2d_linear(GLcontext *ctx, +sample_2d_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -1152,7 +1152,7 @@ sample_2d_linear(GLcontext *ctx, * We don't have to worry about the texture border. */ static INLINE void -sample_2d_linear_repeat(GLcontext *ctx, +sample_2d_linear_repeat(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -1185,7 +1185,7 @@ sample_2d_linear_repeat(GLcontext *ctx, static void -sample_2d_nearest_mipmap_nearest(GLcontext *ctx, +sample_2d_nearest_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1199,7 +1199,7 @@ sample_2d_nearest_mipmap_nearest(GLcontext *ctx, static void -sample_2d_linear_mipmap_nearest(GLcontext *ctx, +sample_2d_linear_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1214,7 +1214,7 @@ sample_2d_linear_mipmap_nearest(GLcontext *ctx, static void -sample_2d_nearest_mipmap_linear(GLcontext *ctx, +sample_2d_nearest_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1239,7 +1239,7 @@ sample_2d_nearest_mipmap_linear(GLcontext *ctx, static void -sample_2d_linear_mipmap_linear( GLcontext *ctx, +sample_2d_linear_mipmap_linear( struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4] ) @@ -1264,7 +1264,7 @@ sample_2d_linear_mipmap_linear( GLcontext *ctx, static void -sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx, +sample_2d_linear_mipmap_linear_repeat(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1294,7 +1294,7 @@ sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx, /** Sample 2D texture, nearest filtering for both min/magnification */ static void -sample_nearest_2d(GLcontext *ctx, +sample_nearest_2d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1310,7 +1310,7 @@ sample_nearest_2d(GLcontext *ctx, /** Sample 2D texture, linear filtering for both min/magnification */ static void -sample_linear_2d(GLcontext *ctx, +sample_linear_2d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1343,7 +1343,7 @@ sample_linear_2d(GLcontext *ctx, * Format = GL_RGB */ static void -opt_sample_rgb_2d(GLcontext *ctx, +opt_sample_rgb_2d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1384,7 +1384,7 @@ opt_sample_rgb_2d(GLcontext *ctx, * Format = GL_RGBA */ static void -opt_sample_rgba_2d(GLcontext *ctx, +opt_sample_rgba_2d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1419,7 +1419,7 @@ opt_sample_rgba_2d(GLcontext *ctx, /** Sample 2D texture, using lambda to choose between min/magnification */ static void -sample_lambda_2d(GLcontext *ctx, +sample_lambda_2d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1540,7 +1540,7 @@ sample_lambda_2d(GLcontext *ctx, * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ static INLINE void -sample_3d_nearest(GLcontext *ctx, +sample_3d_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -1572,7 +1572,7 @@ sample_3d_nearest(GLcontext *ctx, * Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. */ static void -sample_3d_linear(GLcontext *ctx, +sample_3d_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -1666,7 +1666,7 @@ sample_3d_linear(GLcontext *ctx, static void -sample_3d_nearest_mipmap_nearest(GLcontext *ctx, +sample_3d_nearest_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4] ) @@ -1680,7 +1680,7 @@ sample_3d_nearest_mipmap_nearest(GLcontext *ctx, static void -sample_3d_linear_mipmap_nearest(GLcontext *ctx, +sample_3d_linear_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1695,7 +1695,7 @@ sample_3d_linear_mipmap_nearest(GLcontext *ctx, static void -sample_3d_nearest_mipmap_linear(GLcontext *ctx, +sample_3d_nearest_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1720,7 +1720,7 @@ sample_3d_nearest_mipmap_linear(GLcontext *ctx, static void -sample_3d_linear_mipmap_linear(GLcontext *ctx, +sample_3d_linear_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1746,7 +1746,7 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx, /** Sample 3D texture, nearest filtering for both min/magnification */ static void -sample_nearest_3d(GLcontext *ctx, +sample_nearest_3d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1762,7 +1762,7 @@ sample_nearest_3d(GLcontext *ctx, /** Sample 3D texture, linear filtering for both min/magnification */ static void -sample_linear_3d(GLcontext *ctx, +sample_linear_3d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1778,7 +1778,7 @@ sample_linear_3d(GLcontext *ctx, /** Sample 3D texture, using lambda to choose between min/magnification */ static void -sample_lambda_3d(GLcontext *ctx, +sample_lambda_3d(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1933,7 +1933,7 @@ choose_cube_face(const struct gl_texture_object *texObj, static void -sample_nearest_cube(GLcontext *ctx, +sample_nearest_cube(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1951,7 +1951,7 @@ sample_nearest_cube(GLcontext *ctx, static void -sample_linear_cube(GLcontext *ctx, +sample_linear_cube(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1969,7 +1969,7 @@ sample_linear_cube(GLcontext *ctx, static void -sample_cube_nearest_mipmap_nearest(GLcontext *ctx, +sample_cube_nearest_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -1998,7 +1998,7 @@ sample_cube_nearest_mipmap_nearest(GLcontext *ctx, static void -sample_cube_linear_mipmap_nearest(GLcontext *ctx, +sample_cube_linear_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2017,7 +2017,7 @@ sample_cube_linear_mipmap_nearest(GLcontext *ctx, static void -sample_cube_nearest_mipmap_linear(GLcontext *ctx, +sample_cube_nearest_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2046,7 +2046,7 @@ sample_cube_nearest_mipmap_linear(GLcontext *ctx, static void -sample_cube_linear_mipmap_linear(GLcontext *ctx, +sample_cube_linear_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2076,7 +2076,7 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx, /** Sample cube texture, using lambda to choose between min/magnification */ static void -sample_lambda_cube(GLcontext *ctx, +sample_lambda_cube(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2150,7 +2150,7 @@ sample_lambda_cube(GLcontext *ctx, static void -sample_nearest_rect(GLcontext *ctx, +sample_nearest_rect(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2184,7 +2184,7 @@ sample_nearest_rect(GLcontext *ctx, static void -sample_linear_rect(GLcontext *ctx, +sample_linear_rect(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2250,7 +2250,7 @@ sample_linear_rect(GLcontext *ctx, /** Sample Rect texture, using lambda to choose between min/magnification */ static void -sample_lambda_rect(GLcontext *ctx, +sample_lambda_rect(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2294,7 +2294,7 @@ sample_lambda_rect(GLcontext *ctx, * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ static void -sample_2d_array_nearest(GLcontext *ctx, +sample_2d_array_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -2327,7 +2327,7 @@ sample_2d_array_nearest(GLcontext *ctx, * Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. */ static void -sample_2d_array_linear(GLcontext *ctx, +sample_2d_array_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -2397,7 +2397,7 @@ sample_2d_array_linear(GLcontext *ctx, static void -sample_2d_array_nearest_mipmap_nearest(GLcontext *ctx, +sample_2d_array_nearest_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2412,7 +2412,7 @@ sample_2d_array_nearest_mipmap_nearest(GLcontext *ctx, static void -sample_2d_array_linear_mipmap_nearest(GLcontext *ctx, +sample_2d_array_linear_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2428,7 +2428,7 @@ sample_2d_array_linear_mipmap_nearest(GLcontext *ctx, static void -sample_2d_array_nearest_mipmap_linear(GLcontext *ctx, +sample_2d_array_nearest_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2455,7 +2455,7 @@ sample_2d_array_nearest_mipmap_linear(GLcontext *ctx, static void -sample_2d_array_linear_mipmap_linear(GLcontext *ctx, +sample_2d_array_linear_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2483,7 +2483,7 @@ sample_2d_array_linear_mipmap_linear(GLcontext *ctx, /** Sample 2D Array texture, nearest filtering for both min/magnification */ static void -sample_nearest_2d_array(GLcontext *ctx, +sample_nearest_2d_array(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2500,7 +2500,7 @@ sample_nearest_2d_array(GLcontext *ctx, /** Sample 2D Array texture, linear filtering for both min/magnification */ static void -sample_linear_2d_array(GLcontext *ctx, +sample_linear_2d_array(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2516,7 +2516,7 @@ sample_linear_2d_array(GLcontext *ctx, /** Sample 2D Array texture, using lambda to choose between min/magnification */ static void -sample_lambda_2d_array(GLcontext *ctx, +sample_lambda_2d_array(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2604,7 +2604,7 @@ sample_lambda_2d_array(GLcontext *ctx, * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ static void -sample_1d_array_nearest(GLcontext *ctx, +sample_1d_array_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -2634,7 +2634,7 @@ sample_1d_array_nearest(GLcontext *ctx, * Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. */ static void -sample_1d_array_linear(GLcontext *ctx, +sample_1d_array_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], @@ -2683,7 +2683,7 @@ sample_1d_array_linear(GLcontext *ctx, static void -sample_1d_array_nearest_mipmap_nearest(GLcontext *ctx, +sample_1d_array_nearest_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2698,7 +2698,7 @@ sample_1d_array_nearest_mipmap_nearest(GLcontext *ctx, static void -sample_1d_array_linear_mipmap_nearest(GLcontext *ctx, +sample_1d_array_linear_mipmap_nearest(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2714,7 +2714,7 @@ sample_1d_array_linear_mipmap_nearest(GLcontext *ctx, static void -sample_1d_array_nearest_mipmap_linear(GLcontext *ctx, +sample_1d_array_nearest_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2739,7 +2739,7 @@ sample_1d_array_nearest_mipmap_linear(GLcontext *ctx, static void -sample_1d_array_linear_mipmap_linear(GLcontext *ctx, +sample_1d_array_linear_mipmap_linear(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2765,7 +2765,7 @@ sample_1d_array_linear_mipmap_linear(GLcontext *ctx, /** Sample 1D Array texture, nearest filtering for both min/magnification */ static void -sample_nearest_1d_array(GLcontext *ctx, +sample_nearest_1d_array(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2781,7 +2781,7 @@ sample_nearest_1d_array(GLcontext *ctx, /** Sample 1D Array texture, linear filtering for both min/magnification */ static void -sample_linear_1d_array(GLcontext *ctx, +sample_linear_1d_array(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2797,7 +2797,7 @@ sample_linear_1d_array(GLcontext *ctx, /** Sample 1D Array texture, using lambda to choose between min/magnification */ static void -sample_lambda_1d_array(GLcontext *ctx, +sample_lambda_1d_array(struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -2995,7 +2995,7 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda) * check for minification vs. magnification, etc. */ static void -sample_depth_texture( GLcontext *ctx, +sample_depth_texture( struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat texel[][4] ) @@ -3164,7 +3164,7 @@ sample_depth_texture( GLcontext *ctx, * Note: fragment programs don't observe the texture enable/disable flags. */ static void -null_sample_func( GLcontext *ctx, +null_sample_func( struct gl_context *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) @@ -3187,7 +3187,7 @@ null_sample_func( GLcontext *ctx, * Choose the texture sampling function for the given texture object. */ texture_sample_func -_swrast_choose_texture_sample_func( GLcontext *ctx, +_swrast_choose_texture_sample_func( struct gl_context *ctx, const struct gl_texture_object *t ) { if (!t || !t->_Complete) { diff --git a/src/mesa/swrast/s_texfilter.h b/src/mesa/swrast/s_texfilter.h index eceab59658..34520f2294 100644 --- a/src/mesa/swrast/s_texfilter.h +++ b/src/mesa/swrast/s_texfilter.h @@ -32,7 +32,7 @@ extern texture_sample_func -_swrast_choose_texture_sample_func( GLcontext *ctx, +_swrast_choose_texture_sample_func( struct gl_context *ctx, const struct gl_texture_object *tObj ); diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index d1b369bcdf..85513e1f20 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -49,7 +49,7 @@ * \return GL_TRUE if the triangle is to be culled, GL_FALSE otherwise. */ GLboolean -_swrast_culltriangle( GLcontext *ctx, +_swrast_culltriangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) @@ -256,7 +256,7 @@ ilerp_2d(GLint ia, GLint ib, GLint v00, GLint v10, GLint v01, GLint v11) * texture env modes. */ static INLINE void -affine_span(GLcontext *ctx, SWspan *span, +affine_span(struct gl_context *ctx, SWspan *span, struct affine_info *info) { GLchan sample[4]; /* the filtered texture sample */ @@ -591,7 +591,7 @@ struct persp_info static INLINE void -fast_persp_span(GLcontext *ctx, SWspan *span, +fast_persp_span(struct gl_context *ctx, SWspan *span, struct persp_info *info) { GLchan sample[4]; /* the filtered texture sample */ @@ -903,7 +903,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, static void -nodraw_triangle( GLcontext *ctx, +nodraw_triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) @@ -919,7 +919,7 @@ nodraw_triangle( GLcontext *ctx, * Inefficient, but seldom needed. */ void -_swrast_add_spec_terms_triangle(GLcontext *ctx, const SWvertex *v0, +_swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */ @@ -992,7 +992,7 @@ do { \ * remove tests to this code. */ void -_swrast_choose_triangle( GLcontext *ctx ) +_swrast_choose_triangle( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/swrast/s_triangle.h b/src/mesa/swrast/s_triangle.h index b81932c730..46e23d4208 100644 --- a/src/mesa/swrast/s_triangle.h +++ b/src/mesa/swrast/s_triangle.h @@ -32,16 +32,16 @@ extern GLboolean -_swrast_culltriangle( GLcontext *ctx, +_swrast_culltriangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2); extern void -_swrast_choose_triangle( GLcontext *ctx ); +_swrast_choose_triangle( struct gl_context *ctx ); extern void -_swrast_add_spec_terms_triangle( GLcontext *ctx, +_swrast_add_spec_terms_triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 0aa8739f4f..4d6309b82a 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -108,7 +108,7 @@ do { \ #endif -static void NAME(GLcontext *ctx, const SWvertex *v0, +static void NAME(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index f224627d50..4e04691cd7 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -45,7 +45,7 @@ * \return GL_TRUE if any zoomed pixels visible, GL_FALSE if totally clipped */ static GLboolean -compute_zoomed_bounds(GLcontext *ctx, GLint imageX, GLint imageY, +compute_zoomed_bounds(struct gl_context *ctx, GLint imageX, GLint imageY, GLint spanX, GLint spanY, GLint width, GLint *x0, GLint *x1, GLint *y0, GLint *y1) { @@ -127,7 +127,7 @@ unzoom_x(GLfloat zoomX, GLint imageX, GLint zx) * index/depth_span(). */ static void -zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, +zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *src, GLenum format ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -320,7 +320,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span, void -_swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_rgba_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *rgba) { zoom_span(ctx, imgX, imgY, span, rgba, GL_RGBA); @@ -328,7 +328,7 @@ _swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY, void -_swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_rgb_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *rgb) { zoom_span(ctx, imgX, imgY, span, rgb, GL_RGB); @@ -336,7 +336,7 @@ _swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY, void -_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span) { zoom_span(ctx, imgX, imgY, span, @@ -349,7 +349,7 @@ _swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY, * No per-fragment operations are applied. */ void -_swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, const GLstencil stencil[]) { @@ -386,7 +386,7 @@ _swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY, * No per-fragment operations are applied. */ void -_swrast_write_zoomed_z_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, const GLvoid *z) { diff --git a/src/mesa/swrast/s_zoom.h b/src/mesa/swrast/s_zoom.h index 09f624efad..581ea178e8 100644 --- a/src/mesa/swrast/s_zoom.h +++ b/src/mesa/swrast/s_zoom.h @@ -30,25 +30,25 @@ extern void -_swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_rgba_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *rgba); extern void -_swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_rgb_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, const GLvoid *rgb); extern void -_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span); extern void -_swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, const GLstencil stencil[]); extern void -_swrast_write_zoomed_z_span(GLcontext *ctx, GLint imgX, GLint imgY, +_swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY, GLint width, GLint spanX, GLint spanY, const GLvoid *z); diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index c01cf7d1f0..9b88c70220 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -85,32 +85,32 @@ struct swrast_device_driver; */ extern GLboolean -_swrast_CreateContext( GLcontext *ctx ); +_swrast_CreateContext( struct gl_context *ctx ); extern void -_swrast_DestroyContext( GLcontext *ctx ); +_swrast_DestroyContext( struct gl_context *ctx ); /* Get a (non-const) reference to the device driver struct for swrast. */ extern struct swrast_device_driver * -_swrast_GetDeviceDriverReference( GLcontext *ctx ); +_swrast_GetDeviceDriverReference( struct gl_context *ctx ); extern void -_swrast_Bitmap( GLcontext *ctx, +_swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); extern void -_swrast_CopyPixels( GLcontext *ctx, +_swrast_CopyPixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLint destx, GLint desty, GLsizei width, GLsizei height, GLenum type ); extern void -_swrast_DrawPixels( GLcontext *ctx, +_swrast_DrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -118,37 +118,37 @@ _swrast_DrawPixels( GLcontext *ctx, const GLvoid *pixels ); extern void -_swrast_ReadPixels( GLcontext *ctx, +_swrast_ReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *pixels ); extern void -_swrast_BlitFramebuffer(GLcontext *ctx, +_swrast_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); extern void -_swrast_Clear(GLcontext *ctx, GLbitfield buffers); +_swrast_Clear(struct gl_context *ctx, GLbitfield buffers); extern void -_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value); +_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value); /* Reset the stipple counter */ extern void -_swrast_ResetLineStipple( GLcontext *ctx ); +_swrast_ResetLineStipple( struct gl_context *ctx ); /** * Indicates front/back facing for subsequent points/lines when drawing * unfilled polygons. Needed for two-side stencil. */ extern void -_swrast_SetFacing(GLcontext *ctx, GLuint facing); +_swrast_SetFacing(struct gl_context *ctx, GLuint facing); /* These will always render the correct point/line/triangle for the * current state. @@ -156,54 +156,54 @@ _swrast_SetFacing(GLcontext *ctx, GLuint facing); * For flatshaded primitives, the provoking vertex is the final one. */ extern void -_swrast_Point( GLcontext *ctx, const SWvertex *v ); +_swrast_Point( struct gl_context *ctx, const SWvertex *v ); extern void -_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ); +_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 ); extern void -_swrast_Triangle( GLcontext *ctx, const SWvertex *v0, +_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); extern void -_swrast_Quad( GLcontext *ctx, +_swrast_Quad( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2, const SWvertex *v3); extern void -_swrast_flush( GLcontext *ctx ); +_swrast_flush( struct gl_context *ctx ); extern void -_swrast_render_primitive( GLcontext *ctx, GLenum mode ); +_swrast_render_primitive( struct gl_context *ctx, GLenum mode ); extern void -_swrast_render_start( GLcontext *ctx ); +_swrast_render_start( struct gl_context *ctx ); extern void -_swrast_render_finish( GLcontext *ctx ); +_swrast_render_finish( struct gl_context *ctx ); /* Tell the software rasterizer about core state changes. */ extern void -_swrast_InvalidateState( GLcontext *ctx, GLbitfield new_state ); +_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state ); /* Configure software rasterizer to match hardware rasterizer characteristics: */ extern void -_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ); +_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value ); extern void -_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ); +_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value ); /* Debug: */ extern void -_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); +_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ); extern void -_swrast_eject_texture_images(GLcontext *ctx); +_swrast_eject_texture_images(struct gl_context *ctx); @@ -223,8 +223,8 @@ struct swrast_device_driver { * these functions. Locking in that case must be organized by the * driver by other mechanisms. */ - void (*SpanRenderStart)(GLcontext *ctx); - void (*SpanRenderFinish)(GLcontext *ctx); + void (*SpanRenderStart)(struct gl_context *ctx); + void (*SpanRenderFinish)(struct gl_context *ctx); }; diff --git a/src/mesa/swrast_setup/NOTES b/src/mesa/swrast_setup/NOTES index c6cb4ab348..bdf57c39ef 100644 --- a/src/mesa/swrast_setup/NOTES +++ b/src/mesa/swrast_setup/NOTES @@ -28,15 +28,15 @@ STATE To create and destroy the module: - GLboolean _swsetup_CreateContext( GLcontext *ctx ); - void _swsetup_DestroyContext( GLcontext *ctx ); + GLboolean _swsetup_CreateContext( struct gl_context *ctx ); + void _swsetup_DestroyContext( struct gl_context *ctx ); The module is not active by default, and must be installed by calling _swrast_Wakeup(). This function installs internal swrast_setup functions into all the tnl->Driver.Render driver hooks, thus taking over the task of rasterization entirely: - void _swrast_Wakeup( GLcontext *ctx ); + void _swrast_Wakeup( struct gl_context *ctx ); This module tracks state changes internally and maintains derived @@ -44,7 +44,7 @@ values based on the current state. For this to work, the driver ensure the following funciton is called whenever the state changes and the swsetup module is 'awake': - void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ); + void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); There is no explicit call to put the swsetup module to sleep. Simply install other function pointers into all the tnl->Driver.Render.* @@ -54,8 +54,8 @@ DRIVER INTERFACE The module offers a minimal driver interface: - void (*Start)( GLcontext *ctx ); - void (*Finish)( GLcontext *ctx ); + void (*Start)( struct gl_context *ctx ); + void (*Finish)( struct gl_context *ctx ); These are called before and after the completion of all swrast drawing activity. As swrast doesn't call callbacks during triangle, line or diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index 0fcb7c77af..5da2e1eabe 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -47,7 +47,7 @@ GLboolean -_swsetup_CreateContext( GLcontext *ctx ) +_swsetup_CreateContext( struct gl_context *ctx ) { SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext)); @@ -67,7 +67,7 @@ _swsetup_CreateContext( GLcontext *ctx ) } void -_swsetup_DestroyContext( GLcontext *ctx ) +_swsetup_DestroyContext( struct gl_context *ctx ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); @@ -80,7 +80,7 @@ _swsetup_DestroyContext( GLcontext *ctx ) } static void -_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) +_swsetup_RenderPrimitive( struct gl_context *ctx, GLenum mode ) { SWSETUP_CONTEXT(ctx)->render_prim = mode; _swrast_render_primitive( ctx, mode ); @@ -108,7 +108,7 @@ do { \ * _tnl_install_attrs(). */ static void -setup_vertex_format(GLcontext *ctx) +setup_vertex_format(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); SScontext *swsetup = SWSETUP_CONTEXT(ctx); @@ -184,7 +184,7 @@ setup_vertex_format(GLcontext *ctx) * Called via tnl->Driver.Render.Start. */ static void -_swsetup_RenderStart( GLcontext *ctx ) +_swsetup_RenderStart( struct gl_context *ctx ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -217,13 +217,13 @@ _swsetup_RenderStart( GLcontext *ctx ) * It's called when we finish rendering a vertex buffer. */ static void -_swsetup_RenderFinish( GLcontext *ctx ) +_swsetup_RenderFinish( struct gl_context *ctx ) { _swrast_render_finish( ctx ); } void -_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) +_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); swsetup->NewState |= new_state; @@ -232,7 +232,7 @@ _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) void -_swsetup_Wakeup( GLcontext *ctx ) +_swsetup_Wakeup( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); SScontext *swsetup = SWSETUP_CONTEXT(ctx); @@ -267,7 +267,7 @@ _swsetup_Wakeup( GLcontext *ctx ) * Populate a swrast SWvertex from an attrib-style vertex. */ void -_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) +_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ) { const GLfloat *m = ctx->Viewport._WindowMap.m; GLfloat tmp[4]; diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index f22bc52f0a..5d1c70e948 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -47,7 +47,7 @@ static tnl_quad_func quad_tab[SS_MAX_TRIFUNC]; /* * Render a triangle respecting edge flags. */ -typedef void (* swsetup_edge_render_prim_tri)(GLcontext *ctx, +typedef void (* swsetup_edge_render_prim_tri)(struct gl_context *ctx, const GLubyte *ef, GLuint e0, GLuint e1, @@ -60,7 +60,7 @@ typedef void (* swsetup_edge_render_prim_tri)(GLcontext *ctx, * Render a triangle using lines and respecting edge flags. */ static void -_swsetup_edge_render_line_tri(GLcontext *ctx, +_swsetup_edge_render_line_tri(struct gl_context *ctx, const GLubyte *ef, GLuint e0, GLuint e1, @@ -86,7 +86,7 @@ _swsetup_edge_render_line_tri(GLcontext *ctx, * Render a triangle using points and respecting edge flags. */ static void -_swsetup_edge_render_point_tri(GLcontext *ctx, +_swsetup_edge_render_point_tri(struct gl_context *ctx, const GLubyte *ef, GLuint e0, GLuint e1, @@ -105,7 +105,7 @@ _swsetup_edge_render_point_tri(GLcontext *ctx, /* * Render a triangle respecting cull and shade model. */ -static void _swsetup_render_tri(GLcontext *ctx, +static void _swsetup_render_tri(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2, @@ -195,7 +195,7 @@ static void _swsetup_render_tri(GLcontext *ctx, #include "ss_tritmp.h" -void _swsetup_trifuncs_init( GLcontext *ctx ) +void _swsetup_trifuncs_init( struct gl_context *ctx ) { (void) ctx; @@ -210,7 +210,7 @@ void _swsetup_trifuncs_init( GLcontext *ctx ) } -static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last ) +static void swsetup_points( struct gl_context *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; @@ -228,7 +228,7 @@ static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last ) } } -static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 ) +static void swsetup_line( struct gl_context *ctx, GLuint v0, GLuint v1 ) { SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; _swrast_Line( ctx, &verts[v0], &verts[v1] ); @@ -236,7 +236,7 @@ static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 ) -void _swsetup_choose_trifuncs( GLcontext *ctx ) +void _swsetup_choose_trifuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint ind = 0; diff --git a/src/mesa/swrast_setup/ss_triangle.h b/src/mesa/swrast_setup/ss_triangle.h index ac553cbd01..05110865da 100644 --- a/src/mesa/swrast_setup/ss_triangle.h +++ b/src/mesa/swrast_setup/ss_triangle.h @@ -32,7 +32,7 @@ #include "main/mtypes.h" -void _swsetup_trifuncs_init( GLcontext *ctx ); -void _swsetup_choose_trifuncs( GLcontext *ctx ); +void _swsetup_trifuncs_init( struct gl_context *ctx ); +void _swsetup_choose_trifuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 8e9fa1bd55..5844ad594c 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -30,7 +30,7 @@ * This is where we handle assigning vertex colors based on front/back * facing, compute polygon offset and handle glPolygonMode(). */ -static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) +static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2 ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; SScontext *swsetup = SWSETUP_CONTEXT(ctx); @@ -213,7 +213,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) /* Need to fixup edgeflags when decomposing to triangles: */ -static void TAG(quadfunc)( GLcontext *ctx, GLuint v0, +static void TAG(quadfunc)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) { if (IND & SS_UNFILLED_BIT) { diff --git a/src/mesa/swrast_setup/ss_vb.h b/src/mesa/swrast_setup/ss_vb.h index 944a3b78d8..b8322f35a3 100644 --- a/src/mesa/swrast_setup/ss_vb.h +++ b/src/mesa/swrast_setup/ss_vb.h @@ -31,7 +31,7 @@ #include "main/mtypes.h" -void _swsetup_vb_init( GLcontext *ctx ); -void _swsetup_choose_rastersetup_func( GLcontext *ctx ); +void _swsetup_vb_init( struct gl_context *ctx ); +void _swsetup_choose_rastersetup_func( struct gl_context *ctx ); #endif diff --git a/src/mesa/swrast_setup/swrast_setup.h b/src/mesa/swrast_setup/swrast_setup.h index 5dcbe2675b..1d87ec1082 100644 --- a/src/mesa/swrast_setup/swrast_setup.h +++ b/src/mesa/swrast_setup/swrast_setup.h @@ -41,21 +41,21 @@ #include "swrast/swrast.h" extern GLboolean -_swsetup_CreateContext( GLcontext *ctx ); +_swsetup_CreateContext( struct gl_context *ctx ); extern void -_swsetup_DestroyContext( GLcontext *ctx ); +_swsetup_DestroyContext( struct gl_context *ctx ); extern void -_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ); +_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); extern void -_swsetup_Wakeup( GLcontext *ctx ); +_swsetup_Wakeup( struct gl_context *ctx ); /* Helper function to translate a hardware vertex (as understood by * the tnl/t_vertex.c code) to a swrast vertex. */ extern void -_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ); +_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ); #endif diff --git a/src/mesa/tnl/NOTES b/src/mesa/tnl/NOTES index c39b43485e..aac5884da8 100644 --- a/src/mesa/tnl/NOTES +++ b/src/mesa/tnl/NOTES @@ -17,16 +17,16 @@ STATE To create and destroy the module: - GLboolean _tnl_CreateContext( GLcontext *ctx ); - void _tnl_DestroyContext( GLcontext *ctx ); + GLboolean _tnl_CreateContext( struct gl_context *ctx ); + void _tnl_DestroyContext( struct gl_context *ctx ); The module is not active by default, and must be installed by calling _tnl_Wakeup(). This function installs internal tnl functions into all the vtxfmt dispatch hooks, thus taking over the task of transformation and lighting entirely: - void _tnl_wakeup_exec( GLcontext *ctx ); - void _tnl_wakeup_save_exec( GLcontext *ctx ); + void _tnl_wakeup_exec( struct gl_context *ctx ); + void _tnl_wakeup_save_exec( struct gl_context *ctx ); This module tracks state changes internally and maintains derived @@ -34,7 +34,7 @@ values based on the current state. For this to work, the driver ensure the following funciton is called whenever the state changes and the swsetup module is 'awake': - void _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ); + void _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ); There is no explicit call to put the tnl module to sleep. Simply install other function pointers into all the vtxfmt dispatch slots, @@ -58,13 +58,13 @@ higher-level primitives (for example the radeon driver). In addition, the following functions provide further tweaks: extern void -_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag ); +_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag ); - Direct the default vertex transformation stage to produce/not produce projected clip coordinates. extern void -_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag ); +_tnl_need_dlist_loopback( struct gl_context *ctx, GLboolean flag ); - Direct the display list component of the tnl module to replay display lists as 'glVertex' type calls, rather than @@ -76,7 +76,7 @@ _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag ); extern void -_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag ); +_tnl_need_dlist_norm_lengths( struct gl_context *ctx, GLboolean flag ); - Direct the display list component to enable/disable caching 1/length values for display list normals. Doing so is @@ -88,7 +88,7 @@ DRIVER INTERFACE The module itself offers a minimal driver interface: - void (*RunPipeline)( GLcontext *ctx ); + void (*RunPipeline)( struct gl_context *ctx ); Normally this is set to _tnl_RunPipeline(), however the driver can use this hook to wrap checks or other code around this call. diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index f27c8ad9d6..47aeeb8859 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -42,7 +42,7 @@ #include "vbo/vbo.h" GLboolean -_tnl_CreateContext( GLcontext *ctx ) +_tnl_CreateContext( struct gl_context *ctx ) { TNLcontext *tnl; @@ -90,7 +90,7 @@ _tnl_CreateContext( GLcontext *ctx ) void -_tnl_DestroyContext( GLcontext *ctx ) +_tnl_DestroyContext( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -102,7 +102,7 @@ _tnl_DestroyContext( GLcontext *ctx ) void -_tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) +_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) { TNLcontext *tnl = TNL_CONTEXT(ctx); const struct gl_vertex_program *vp = ctx->VertexProgram._Current; @@ -173,7 +173,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) void -_tnl_wakeup( GLcontext *ctx ) +_tnl_wakeup( struct gl_context *ctx ) { /* Assume we haven't been getting state updates either: */ @@ -196,14 +196,14 @@ _tnl_wakeup( GLcontext *ctx ) * we should "Divide-by-W". Software renders will want that. */ void -_tnl_need_projected_coords( GLcontext *ctx, GLboolean mode ) +_tnl_need_projected_coords( struct gl_context *ctx, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->NeedNdcCoords = mode; } void -_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ) +_tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->AllowVertexFog = value; @@ -213,7 +213,7 @@ _tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ) } void -_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ) +_tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->AllowPixelFog = value; diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 258906f795..bc01646247 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -235,7 +235,7 @@ struct tnl_pipeline_stage /* Allocate private data */ - GLboolean (*create)( GLcontext *ctx, struct tnl_pipeline_stage * ); + GLboolean (*create)( struct gl_context *ctx, struct tnl_pipeline_stage * ); /* Free private data. */ @@ -244,7 +244,7 @@ struct tnl_pipeline_stage /* Called on any statechange or input array size change or * input array change to/from zero stride. */ - void (*validate)( GLcontext *ctx, struct tnl_pipeline_stage * ); + void (*validate)( struct gl_context *ctx, struct tnl_pipeline_stage * ); /* Called from _tnl_run_pipeline(). The stage.changed_inputs value * encodes all inputs to thee struct which have changed. If @@ -254,7 +254,7 @@ struct tnl_pipeline_stage * Return value: GL_TRUE - keep going * GL_FALSE - finished pipeline */ - GLboolean (*run)( GLcontext *ctx, struct tnl_pipeline_stage * ); + GLboolean (*run)( struct gl_context *ctx, struct tnl_pipeline_stage * ); }; @@ -284,7 +284,7 @@ typedef void (*tnl_insert_func)( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ); -typedef void (*tnl_emit_func)( GLcontext *ctx, +typedef void (*tnl_emit_func)( struct gl_context *ctx, GLuint count, GLubyte *dest ); @@ -311,19 +311,19 @@ struct tnl_clipspace_attr -typedef void (*tnl_points_func)( GLcontext *ctx, GLuint first, GLuint last ); -typedef void (*tnl_line_func)( GLcontext *ctx, GLuint v1, GLuint v2 ); -typedef void (*tnl_triangle_func)( GLcontext *ctx, +typedef void (*tnl_points_func)( struct gl_context *ctx, GLuint first, GLuint last ); +typedef void (*tnl_line_func)( struct gl_context *ctx, GLuint v1, GLuint v2 ); +typedef void (*tnl_triangle_func)( struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3 ); -typedef void (*tnl_quad_func)( GLcontext *ctx, GLuint v1, GLuint v2, +typedef void (*tnl_quad_func)( struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4 ); -typedef void (*tnl_render_func)( GLcontext *ctx, GLuint start, GLuint count, +typedef void (*tnl_render_func)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ); -typedef void (*tnl_interp_func)( GLcontext *ctx, +typedef void (*tnl_interp_func)( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ); -typedef void (*tnl_copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src ); -typedef void (*tnl_setup_func)( GLcontext *ctx, +typedef void (*tnl_copy_pv_func)( struct gl_context *ctx, GLuint dst, GLuint src ); +typedef void (*tnl_setup_func)( struct gl_context *ctx, GLuint start, GLuint end, GLuint new_inputs); @@ -377,7 +377,7 @@ struct tnl_clipspace struct tnl_clipspace_fastpath *fastpath; - void (*codegen_emit)( GLcontext *ctx ); + void (*codegen_emit)( struct gl_context *ctx ); }; @@ -387,13 +387,13 @@ struct tnl_device_driver *** TNL Pipeline ***/ - void (*RunPipeline)(GLcontext *ctx); + void (*RunPipeline)(struct gl_context *ctx); /* Replaces PipelineStart/PipelineFinish -- intended to allow * drivers to wrap _tnl_run_pipeline() with code to validate state * and grab/release hardware locks. */ - void (*NotifyMaterialChange)(GLcontext *ctx); + void (*NotifyMaterialChange)(struct gl_context *ctx); /* Alert tnl-aware drivers of changes to material. */ @@ -402,14 +402,14 @@ struct tnl_device_driver ***/ struct { - void (*Start)(GLcontext *ctx); - void (*Finish)(GLcontext *ctx); + void (*Start)(struct gl_context *ctx); + void (*Finish)(struct gl_context *ctx); /* Called before and after all rendering operations, including DrawPixels, * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. * These are a suitable place for grabbing/releasing hardware locks. */ - void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode); + void (*PrimitiveNotify)(struct gl_context *ctx, GLenum mode); /* Called between RenderStart() and RenderFinish() to indicate the * type of primitive we're about to draw. Mode will be one of the * modes accepted by glBegin(). @@ -427,12 +427,12 @@ struct tnl_device_driver * vertex attributes should be copied. */ - void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n ); + void (*ClippedPolygon)( struct gl_context *ctx, const GLuint *elts, GLuint n ); /* Render a polygon with vertices whose indexes are in the * array. */ - void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 ); + void (*ClippedLine)( struct gl_context *ctx, GLuint v0, GLuint v1 ); /* Render a line between the two vertices given by indexes v0 and v1. */ tnl_points_func Points; /* must now respect vb->elts */ @@ -452,7 +452,7 @@ struct tnl_device_driver * vertices. */ - void (*ResetLineStipple)( GLcontext *ctx ); + void (*ResetLineStipple)( struct gl_context *ctx ); /* Reset the hardware's line stipple counter. */ @@ -467,7 +467,7 @@ struct tnl_device_driver */ - GLboolean (*Multipass)( GLcontext *ctx, GLuint passno ); + GLboolean (*Multipass)( struct gl_context *ctx, GLuint passno ); /* Driver may request additional render passes by returning GL_TRUE * when this function is called. This function will be called * after the first pass, and passes will be made until the function @@ -539,7 +539,7 @@ typedef struct extern void -tnl_clip_prepare(GLcontext *ctx); +tnl_clip_prepare(struct gl_context *ctx); #endif diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index fdde294257..30f1bf323c 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -38,7 +38,7 @@ -static GLubyte *get_space(GLcontext *ctx, GLuint bytes) +static GLubyte *get_space(struct gl_context *ctx, GLuint bytes) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLubyte *space = malloc(bytes); @@ -48,7 +48,7 @@ static GLubyte *get_space(GLcontext *ctx, GLuint bytes) } -static void free_space(GLcontext *ctx) +static void free_space(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; @@ -128,7 +128,7 @@ convert_half_to_float(const struct gl_client_array *input, /* Adjust pointer to point at first requested element, convert to * floating point, populate VB->AttribPtr[]. */ -static void _tnl_import_array( GLcontext *ctx, +static void _tnl_import_array( struct gl_context *ctx, GLuint attrib, GLuint count, const struct gl_client_array *input, @@ -202,7 +202,7 @@ static void _tnl_import_array( GLcontext *ctx, #define CLIPVERTS ((6 + MAX_CLIP_PLANES) * 2) -static GLboolean *_tnl_import_edgeflag( GLcontext *ctx, +static GLboolean *_tnl_import_edgeflag( struct gl_context *ctx, const GLvector4f *input, GLuint count) { @@ -221,7 +221,7 @@ static GLboolean *_tnl_import_edgeflag( GLcontext *ctx, } -static void bind_inputs( GLcontext *ctx, +static void bind_inputs( struct gl_context *ctx, const struct gl_client_array *inputs[], GLint count, struct gl_buffer_object **bo, @@ -292,7 +292,7 @@ static void bind_inputs( GLcontext *ctx, /* Translate indices to GLuints and store in VB->Elts. */ -static void bind_indices( GLcontext *ctx, +static void bind_indices( struct gl_context *ctx, const struct _mesa_index_buffer *ib, struct gl_buffer_object **bo, GLuint *nr_bo) @@ -345,7 +345,7 @@ static void bind_indices( GLcontext *ctx, } } -static void bind_prims( GLcontext *ctx, +static void bind_prims( struct gl_context *ctx, const struct _mesa_prim *prim, GLuint nr_prims ) { @@ -356,7 +356,7 @@ static void bind_prims( GLcontext *ctx, VB->PrimitiveCount = nr_prims; } -static void unmap_vbos( GLcontext *ctx, +static void unmap_vbos( struct gl_context *ctx, struct gl_buffer_object **bo, GLuint nr_bo ) { @@ -369,7 +369,7 @@ static void unmap_vbos( GLcontext *ctx, } -void _tnl_vbo_draw_prims(GLcontext *ctx, +void _tnl_vbo_draw_prims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -388,7 +388,7 @@ void _tnl_vbo_draw_prims(GLcontext *ctx, * module. In a regular swtnl driver, this can be plugged straight * into the vbo->Driver.DrawPrims() callback. */ -void _tnl_draw_prims( GLcontext *ctx, +void _tnl_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 36fcd074cd..18f095f0d4 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -35,7 +35,7 @@ #include "t_vp_build.h" #include "t_vertex.h" -void _tnl_install_pipeline( GLcontext *ctx, +void _tnl_install_pipeline( struct gl_context *ctx, const struct tnl_pipeline_stage **stages ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -55,7 +55,7 @@ void _tnl_install_pipeline( GLcontext *ctx, tnl->pipeline.nr_stages = i; } -void _tnl_destroy_pipeline( GLcontext *ctx ) +void _tnl_destroy_pipeline( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; @@ -71,7 +71,7 @@ void _tnl_destroy_pipeline( GLcontext *ctx ) -static GLuint check_input_changes( GLcontext *ctx ) +static GLuint check_input_changes( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; @@ -89,7 +89,7 @@ static GLuint check_input_changes( GLcontext *ctx ) } -static GLuint check_output_changes( GLcontext *ctx ) +static GLuint check_output_changes( struct gl_context *ctx ) { #if 0 TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -113,7 +113,7 @@ static GLuint check_output_changes( GLcontext *ctx ) } -void _tnl_run_pipeline( GLcontext *ctx ) +void _tnl_run_pipeline( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); unsigned short __tmp; diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h index a6429869cb..0eb03395c3 100644 --- a/src/mesa/tnl/t_pipeline.h +++ b/src/mesa/tnl/t_pipeline.h @@ -33,11 +33,11 @@ #include "main/mtypes.h" #include "t_context.h" -extern void _tnl_run_pipeline( GLcontext *ctx ); +extern void _tnl_run_pipeline( struct gl_context *ctx ); -extern void _tnl_destroy_pipeline( GLcontext *ctx ); +extern void _tnl_destroy_pipeline( struct gl_context *ctx ); -extern void _tnl_install_pipeline( GLcontext *ctx, +extern void _tnl_install_pipeline( struct gl_context *ctx, const struct tnl_pipeline_stage **stages ); @@ -64,10 +64,10 @@ extern const struct tnl_pipeline_stage *_tnl_vp_pipeline[]; extern tnl_render_func _tnl_render_tab_elts[]; extern tnl_render_func _tnl_render_tab_verts[]; -extern void _tnl_RenderClippedPolygon( GLcontext *ctx, +extern void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ); -extern void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ); +extern void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ); #endif diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c index d82d5b5073..0492490dfc 100644 --- a/src/mesa/tnl/t_rasterpos.c +++ b/src/mesa/tnl/t_rasterpos.c @@ -84,7 +84,7 @@ viewclip_point_z( const GLfloat v[] ) * \return zero if the point was clipped, or one otherwise. */ static GLuint -userclip_point( GLcontext *ctx, const GLfloat v[] ) +userclip_point( struct gl_context *ctx, const GLfloat v[] ) { GLuint p; @@ -114,7 +114,7 @@ userclip_point( GLcontext *ctx, const GLfloat v[] ) * \param Rindex returned color index */ static void -shade_rastpos(GLcontext *ctx, +shade_rastpos(struct gl_context *ctx, const GLfloat vertex[4], const GLfloat normal[3], GLfloat Rcolor[4], @@ -263,7 +263,7 @@ shade_rastpos(GLcontext *ctx, * \param texcoord incoming texcoord and resulting texcoord */ static void -compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], +compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye[4], const GLfloat normal[3], GLuint unit, GLfloat texcoord[4]) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -373,7 +373,7 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], * \param vObj vertex position in object space */ void -_tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]) +_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]) { if (ctx->VertexProgram._Enabled) { /* XXX implement this */ diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index 8cc36e666d..d593193435 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -115,7 +115,7 @@ do { \ /* Clip a line against the viewport and user clip planes. */ static INLINE void -TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask ) +TAG(clip_line)( struct gl_context *ctx, GLuint v0, GLuint v1, GLubyte mask ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -184,7 +184,7 @@ TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask ) /* Clip a triangle against the viewport and user clip planes. */ static INLINE void -TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) +TAG(clip_tri)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -263,7 +263,7 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) /* Clip a quad against the viewport and user clip planes. */ static INLINE void -TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, +TAG(clip_quad)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLubyte mask ) { TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index 9faae24ec6..cbd8dfc967 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -94,7 +94,7 @@ init_static_data( void ) * Fog blend factors are in the range [0,1]. */ static void -compute_fog_blend_factors(GLcontext *ctx, GLvector4f *out, const GLvector4f *in) +compute_fog_blend_factors(struct gl_context *ctx, GLvector4f *out, const GLvector4f *in) { GLfloat end = ctx->Fog.End; GLfloat *v = in->start; @@ -140,7 +140,7 @@ compute_fog_blend_factors(GLcontext *ctx, GLvector4f *out, const GLvector4f *in) static GLboolean -run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +run_fog_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -235,7 +235,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) /* Called the first time stage->run() is invoked. */ static GLboolean -alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) +alloc_fog_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct fog_stage_data *store; diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index e7309aaac6..3acedf6e57 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -41,7 +41,7 @@ #define LIGHT_MATERIAL 0x2 #define MAX_LIGHT_FUNC 0x4 -typedef void (*light_func)( GLcontext *ctx, +typedef void (*light_func)( struct gl_context *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ); @@ -85,7 +85,7 @@ struct light_stage_data { * It's called per-vertex in the lighting loop. */ static void -update_materials(GLcontext *ctx, struct light_stage_data *store) +update_materials(struct gl_context *ctx, struct light_stage_data *store) { GLuint i; @@ -110,7 +110,7 @@ update_materials(GLcontext *ctx, struct light_stage_data *store) * Return number of material attributes which will track vertex color. */ static GLuint -prepare_materials(GLcontext *ctx, +prepare_materials(struct gl_context *ctx, struct vertex_buffer *VB, struct light_stage_data *store) { GLuint i; @@ -192,7 +192,7 @@ static void init_lighting_tables( void ) } -static GLboolean run_lighting( GLcontext *ctx, +static GLboolean run_lighting( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); @@ -250,7 +250,7 @@ static GLboolean run_lighting( GLcontext *ctx, /* Called in place of do_lighting when the light table may have changed. */ -static void validate_lighting( GLcontext *ctx, +static void validate_lighting( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { light_func *tab; @@ -284,7 +284,7 @@ static void validate_lighting( GLcontext *ctx, /* Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ -static GLboolean init_lighting( GLcontext *ctx, +static GLboolean init_lighting( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index 0a98c6b02a..aae1d18ff7 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -44,7 +44,7 @@ * stage is the lighting stage-private data * input is the vector of eye or object-space vertex coordinates */ -static void TAG(light_rgba_spec)( GLcontext *ctx, +static void TAG(light_rgba_spec)( struct gl_context *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) @@ -232,7 +232,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, } -static void TAG(light_rgba)( GLcontext *ctx, +static void TAG(light_rgba)( struct gl_context *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) @@ -421,7 +421,7 @@ static void TAG(light_rgba)( GLcontext *ctx, /* As below, but with just a single light. */ -static void TAG(light_fast_rgba_single)( GLcontext *ctx, +static void TAG(light_fast_rgba_single)( struct gl_context *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) @@ -529,7 +529,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, /* Light infinite lights */ -static void TAG(light_fast_rgba)( GLcontext *ctx, +static void TAG(light_fast_rgba)( struct gl_context *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c index c2aa655674..c19b48e51e 100644 --- a/src/mesa/tnl/t_vb_normals.c +++ b/src/mesa/tnl/t_vb_normals.c @@ -47,7 +47,7 @@ struct normal_stage_data { static GLboolean -run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +run_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -89,7 +89,7 @@ run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) * to point to the appropriate normal transformation routine. */ static void -validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +validate_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); @@ -146,7 +146,7 @@ validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) * Allocate stage's private data (storage for transformed normals). */ static GLboolean -alloc_normal_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) +alloc_normal_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct normal_stage_data *store; diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c index 20634c80d1..9edbbc708e 100644 --- a/src/mesa/tnl/t_vb_points.c +++ b/src/mesa/tnl/t_vb_points.c @@ -47,7 +47,7 @@ struct point_stage_data { * disabled. */ static GLboolean -run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +run_point_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { if (ctx->Point._Attenuated && !ctx->VertexProgram._Current) { struct point_stage_data *store = POINT_STAGE_DATA(stage); @@ -77,7 +77,7 @@ run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) static GLboolean -alloc_point_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) +alloc_point_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct point_stage_data *store; diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index f3a338ef1e..76f8fde3f5 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -74,7 +74,7 @@ struct vp_stage_data { static void -userclip( GLcontext *ctx, +userclip( struct gl_context *ctx, GLvector4f *clip, GLubyte *clipmask, GLubyte *clipormask, @@ -120,7 +120,7 @@ userclip( GLcontext *ctx, static GLboolean -do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) +do_ndc_cliptest(struct gl_context *ctx, struct vp_stage_data *store) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -187,7 +187,7 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) * moved into main/ someday. */ static void -vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, +vp_fetch_texel(struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -204,7 +204,7 @@ vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, * string has been parsed. */ GLboolean -_tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program) +_tnl_program_string(struct gl_context *ctx, GLenum target, struct gl_program *program) { /* No-op. * If we had derived anything from the program that was private to this @@ -218,7 +218,7 @@ _tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program) * Initialize virtual machine state prior to executing vertex program. */ static void -init_machine(GLcontext *ctx, struct gl_program_machine *machine) +init_machine(struct gl_context *ctx, struct gl_program_machine *machine) { /* Input registers get initialized from the current vertex attribs */ memcpy(machine->VertAttribs, ctx->Current.Attrib, @@ -261,7 +261,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine) * Map the texture images which the vertex program will access (if any). */ static void -map_textures(GLcontext *ctx, const struct gl_vertex_program *vp) +map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp) { GLuint u; @@ -283,7 +283,7 @@ map_textures(GLcontext *ctx, const struct gl_vertex_program *vp) * Unmap the texture images which were used by the vertex program (if any). */ static void -unmap_textures(GLcontext *ctx, const struct gl_vertex_program *vp) +unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp) { GLuint u; @@ -305,7 +305,7 @@ unmap_textures(GLcontext *ctx, const struct gl_vertex_program *vp) * This function executes vertex programs */ static GLboolean -run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) +run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vp_stage_data *store = VP_STAGE_DATA(stage); @@ -493,7 +493,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) * allocate data until the first time the stage is run. */ static GLboolean -init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage) +init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &(tnl->vb); @@ -546,7 +546,7 @@ dtr(struct tnl_pipeline_stage *stage) static void -validate_vp_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +validate_vp_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { if (ctx->VertexProgram._Current) { _swrast_update_texture_samplers(ctx); diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index 7d991009a1..cb31921324 100644 --- a/src/mesa/tnl/t_vb_render.c +++ b/src/mesa/tnl/t_vb_render.c @@ -146,7 +146,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -235,7 +235,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -246,7 +246,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -259,7 +259,7 @@ void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) /**********************************************************************/ -static GLboolean run_render( GLcontext *ctx, +static GLboolean run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h index 75f6f55bdc..4ed485a7bf 100644 --- a/src/mesa/tnl/t_vb_rendertmp.h +++ b/src/mesa/tnl/t_vb_rendertmp.h @@ -57,7 +57,7 @@ #define RENDER_TAB_QUALIFIER static #endif -static void TAG(render_points)( GLcontext *ctx, +static void TAG(render_points)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -70,7 +70,7 @@ static void TAG(render_points)( GLcontext *ctx, POSTFIX; } -static void TAG(render_lines)( GLcontext *ctx, +static void TAG(render_lines)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -91,7 +91,7 @@ static void TAG(render_lines)( GLcontext *ctx, } -static void TAG(render_line_strip)( GLcontext *ctx, +static void TAG(render_line_strip)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -116,7 +116,7 @@ static void TAG(render_line_strip)( GLcontext *ctx, } -static void TAG(render_line_loop)( GLcontext *ctx, +static void TAG(render_line_loop)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -156,7 +156,7 @@ static void TAG(render_line_loop)( GLcontext *ctx, } -static void TAG(render_triangles)( GLcontext *ctx, +static void TAG(render_triangles)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -189,7 +189,7 @@ static void TAG(render_triangles)( GLcontext *ctx, -static void TAG(render_tri_strip)( GLcontext *ctx, +static void TAG(render_tri_strip)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -239,7 +239,7 @@ static void TAG(render_tri_strip)( GLcontext *ctx, } -static void TAG(render_tri_fan)( GLcontext *ctx, +static void TAG(render_tri_fan)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -286,7 +286,7 @@ static void TAG(render_tri_fan)( GLcontext *ctx, } -static void TAG(render_poly)( GLcontext *ctx, +static void TAG(render_poly)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -355,7 +355,7 @@ static void TAG(render_poly)( GLcontext *ctx, POSTFIX; } -static void TAG(render_quads)( GLcontext *ctx, +static void TAG(render_quads)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -388,7 +388,7 @@ static void TAG(render_quads)( GLcontext *ctx, POSTFIX; } -static void TAG(render_quad_strip)( GLcontext *ctx, +static void TAG(render_quad_strip)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -436,7 +436,7 @@ static void TAG(render_quad_strip)( GLcontext *ctx, POSTFIX; } -static void TAG(render_noop)( GLcontext *ctx, +static void TAG(render_noop)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -444,7 +444,7 @@ static void TAG(render_noop)( GLcontext *ctx, (void)(ctx && start && count && flags); } -RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, +RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(struct gl_context *, GLuint, GLuint, GLuint) = diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index 950e0f54e9..61430c396d 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -54,7 +54,7 @@ struct texgen_stage_data; -typedef void (*texgen_func)( GLcontext *ctx, +typedef void (*texgen_func)( struct gl_context *ctx, struct texgen_stage_data *store, GLuint unit); @@ -248,7 +248,7 @@ static build_f_func build_f_tab[5] = { /* Special case texgen functions. */ -static void texgen_reflection_map_nv( GLcontext *ctx, +static void texgen_reflection_map_nv( struct gl_context *ctx, struct texgen_stage_data *store, GLuint unit ) { @@ -270,7 +270,7 @@ static void texgen_reflection_map_nv( GLcontext *ctx, -static void texgen_normal_map_nv( GLcontext *ctx, +static void texgen_normal_map_nv( struct gl_context *ctx, struct texgen_stage_data *store, GLuint unit ) { @@ -298,7 +298,7 @@ static void texgen_normal_map_nv( GLcontext *ctx, } -static void texgen_sphere_map( GLcontext *ctx, +static void texgen_sphere_map( struct gl_context *ctx, struct texgen_stage_data *store, GLuint unit ) { @@ -331,7 +331,7 @@ static void texgen_sphere_map( GLcontext *ctx, -static void texgen( GLcontext *ctx, +static void texgen( struct gl_context *ctx, struct texgen_stage_data *store, GLuint unit ) { @@ -480,7 +480,7 @@ static void texgen( GLcontext *ctx, -static GLboolean run_texgen_stage( GLcontext *ctx, +static GLboolean run_texgen_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -505,7 +505,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx, } -static void validate_texgen_stage( GLcontext *ctx, +static void validate_texgen_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); @@ -555,7 +555,7 @@ static void validate_texgen_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_texgen_data( GLcontext *ctx, +static GLboolean alloc_texgen_data( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c index 985d137e5c..38aa51fc49 100644 --- a/src/mesa/tnl/t_vb_texmat.c +++ b/src/mesa/tnl/t_vb_texmat.c @@ -53,7 +53,7 @@ struct texmat_stage_data { -static GLboolean run_texmat_stage( GLcontext *ctx, +static GLboolean run_texmat_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); @@ -82,7 +82,7 @@ static GLboolean run_texmat_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_texmat_data( GLcontext *ctx, +static GLboolean alloc_texmat_data( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 453479227b..26e8ae065d 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -58,7 +58,7 @@ struct vertex_stage_data { * t_render_clip.h. */ #define USER_CLIPTEST(NAME, SZ) \ -static void NAME( GLcontext *ctx, \ +static void NAME( struct gl_context *ctx, \ GLvector4f *clip, \ GLubyte *clipmask, \ GLubyte *clipormask, \ @@ -105,7 +105,7 @@ USER_CLIPTEST(userclip2, 2) USER_CLIPTEST(userclip3, 3) USER_CLIPTEST(userclip4, 4) -static void (*(usercliptab[5]))( GLcontext *, +static void (*(usercliptab[5]))( struct gl_context *, GLvector4f *, GLubyte *, GLubyte *, GLubyte * ) = { @@ -118,7 +118,7 @@ static void (*(usercliptab[5]))( GLcontext *, void -tnl_clip_prepare(GLcontext *ctx) +tnl_clip_prepare(struct gl_context *ctx) { /* Neither the x86 nor sparc asm cliptest functions have been updated * for ARB_depth_clamp, so force the C paths. @@ -134,7 +134,7 @@ tnl_clip_prepare(GLcontext *ctx) -static GLboolean run_vertex_stage( GLcontext *ctx, +static GLboolean run_vertex_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; @@ -229,7 +229,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, } -static GLboolean init_vertex_stage( GLcontext *ctx, +static GLboolean init_vertex_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index c1b1570232..f1cb795cd6 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -106,7 +106,7 @@ void _tnl_register_fastpath( struct tnl_clipspace *vtx, /*********************************************************************** * Build codegen functions or return generic ones: */ -static void choose_emit_func( GLcontext *ctx, GLuint count, GLubyte *dest) +static void choose_emit_func( struct gl_context *ctx, GLuint count, GLubyte *dest) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -150,7 +150,7 @@ static void choose_emit_func( GLcontext *ctx, GLuint count, GLubyte *dest) -static void choose_interp_func( GLcontext *ctx, +static void choose_interp_func( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) @@ -168,7 +168,7 @@ static void choose_interp_func( GLcontext *ctx, } -static void choose_copy_pv_func( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void choose_copy_pv_func( struct gl_context *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -190,7 +190,7 @@ static void choose_copy_pv_func( GLcontext *ctx, GLuint edst, GLuint esrc ) /* Interpolate between two vertices to produce a third: */ -void _tnl_interp( GLcontext *ctx, +void _tnl_interp( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) @@ -201,7 +201,7 @@ void _tnl_interp( GLcontext *ctx, /* Copy colors from one vertex to another: */ -void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) +void _tnl_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); vtx->copy_pv( ctx, edst, esrc ); @@ -212,7 +212,7 @@ void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) * reverse any viewport transformation, swizzling or other conversions * which may have been applied: */ -void _tnl_get_attr( GLcontext *ctx, const void *vin, +void _tnl_get_attr( struct gl_context *ctx, const void *vin, GLenum attr, GLfloat *dest ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -231,7 +231,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin, */ if (attr == _TNL_ATTRIB_POINTSIZE) { /* If the hardware vertex doesn't have point size then use size from - * GLcontext. XXX this will be wrong if drawing attenuated points! + * struct gl_context. XXX this will be wrong if drawing attenuated points! */ dest[0] = ctx->Point.Size; } @@ -243,7 +243,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin, /* Complementary operation to the above. */ -void _tnl_set_attr( GLcontext *ctx, void *vout, +void _tnl_set_attr( struct gl_context *ctx, void *vout, GLenum attr, const GLfloat *src ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -260,14 +260,14 @@ void _tnl_set_attr( GLcontext *ctx, void *vout, } -void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ) +void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); return vtx->vertex_buf + nr * vtx->vertex_size; } -void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state ) +void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state ) { if (new_state & (_DD_NEW_TRI_LIGHT_TWOSIDE|_DD_NEW_TRI_UNFILLED) ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -285,7 +285,7 @@ static void invalidate_funcs( struct tnl_clipspace *vtx ) vtx->new_inputs = ~0; } -GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, +GLuint _tnl_install_attrs( struct gl_context *ctx, const struct tnl_attr_map *map, GLuint nr, const GLfloat *vp, GLuint unpacked_size ) { @@ -360,7 +360,7 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, -void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ) +void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); vtx->new_inputs |= newinputs; @@ -370,14 +370,14 @@ void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ) /* This event has broader use beyond this file - will move elsewhere * and probably invoke a driver callback. */ -void _tnl_notify_pipeline_output_change( GLcontext *ctx ) +void _tnl_notify_pipeline_output_change( struct gl_context *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); invalidate_funcs(vtx); } -static void adjust_input_ptrs( GLcontext *ctx, GLint diff) +static void adjust_input_ptrs( struct gl_context *ctx, GLint diff) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -392,7 +392,7 @@ static void adjust_input_ptrs( GLcontext *ctx, GLint diff) } } -static void update_input_ptrs( GLcontext *ctx, GLuint start ) +static void update_input_ptrs( struct gl_context *ctx, GLuint start ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -424,7 +424,7 @@ static void update_input_ptrs( GLcontext *ctx, GLuint start ) } -void _tnl_build_vertices( GLcontext *ctx, +void _tnl_build_vertices( struct gl_context *ctx, GLuint start, GLuint end, GLuint newinputs ) @@ -439,7 +439,7 @@ void _tnl_build_vertices( GLcontext *ctx, /* Emit VB vertices start..end to dest. Note that VB vertex at * postion start will be emitted to dest at position zero. */ -void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, +void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx, GLuint start, GLuint end, void *dest ) @@ -457,7 +457,7 @@ void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, * postion start will be emitted to dest at position zero. */ -void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx, +void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx, const GLuint *elts, GLuint start, GLuint end, @@ -482,7 +482,7 @@ void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx, } -void _tnl_init_vertices( GLcontext *ctx, +void _tnl_init_vertices( struct gl_context *ctx, GLuint vb_size, GLuint max_vertex_size ) { @@ -533,7 +533,7 @@ void _tnl_init_vertices( GLcontext *ctx, } -void _tnl_free_vertices( GLcontext *ctx ) +void _tnl_free_vertices( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); if (tnl) { diff --git a/src/mesa/tnl/t_vertex.h b/src/mesa/tnl/t_vertex.h index 2dfd7b57f0..252f2f7c29 100644 --- a/src/mesa/tnl/t_vertex.h +++ b/src/mesa/tnl/t_vertex.h @@ -78,43 +78,43 @@ extern const struct tnl_format_info _tnl_format_info[EMIT_MAX]; /* Interpolate between two vertices to produce a third: */ -extern void _tnl_interp( GLcontext *ctx, +extern void _tnl_interp( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ); /* Copy colors from one vertex to another: */ -extern void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); +extern void _tnl_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ); /* Extract a named attribute from a hardware vertex. Will have to * reverse any viewport transformation, swizzling or other conversions * which may have been applied: */ -extern void _tnl_get_attr( GLcontext *ctx, const void *vertex, GLenum attrib, +extern void _tnl_get_attr( struct gl_context *ctx, const void *vertex, GLenum attrib, GLfloat *dest ); /* Complementary to the above. */ -extern void _tnl_set_attr( GLcontext *ctx, void *vout, GLenum attrib, +extern void _tnl_set_attr( struct gl_context *ctx, void *vout, GLenum attrib, const GLfloat *src ); -extern void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ); +extern void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr ); -extern GLuint _tnl_install_attrs( GLcontext *ctx, +extern GLuint _tnl_install_attrs( struct gl_context *ctx, const struct tnl_attr_map *map, GLuint nr, const GLfloat *vp, GLuint unpacked_size ); -extern void _tnl_free_vertices( GLcontext *ctx ); +extern void _tnl_free_vertices( struct gl_context *ctx ); -extern void _tnl_init_vertices( GLcontext *ctx, +extern void _tnl_init_vertices( struct gl_context *ctx, GLuint vb_size, GLuint max_vertex_size ); -extern void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, +extern void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx, GLuint start, GLuint end, void *dest ); @@ -124,23 +124,23 @@ extern void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, * the same functionality. */ -extern void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx, +extern void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx, const GLuint *elts, GLuint start, GLuint end, void *dest ); -extern void _tnl_build_vertices( GLcontext *ctx, +extern void _tnl_build_vertices( struct gl_context *ctx, GLuint start, GLuint end, GLuint newinputs ); -extern void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ); +extern void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs ); -extern void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state ); +extern void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state ); -extern void _tnl_notify_pipeline_output_change( GLcontext *ctx ); +extern void _tnl_notify_pipeline_output_change( struct gl_context *ctx ); #define GET_VERTEX_STATE(ctx) &(TNL_CONTEXT(ctx)->clipspace) @@ -153,29 +153,29 @@ void _tnl_register_fastpath( struct tnl_clipspace *vtx, /* t_vertex_generic.c -- Internal functions for t_vertex.c */ -void _tnl_generic_copy_pv_extras( GLcontext *ctx, +void _tnl_generic_copy_pv_extras( struct gl_context *ctx, GLuint dst, GLuint src ); -void _tnl_generic_interp_extras( GLcontext *ctx, +void _tnl_generic_interp_extras( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ); -void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); +void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ); -void _tnl_generic_interp( GLcontext *ctx, +void _tnl_generic_interp( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ); -void _tnl_generic_emit( GLcontext *ctx, +void _tnl_generic_emit( struct gl_context *ctx, GLuint count, GLubyte *v ); -void _tnl_generate_hardwired_emit( GLcontext *ctx ); +void _tnl_generate_hardwired_emit( struct gl_context *ctx ); /* t_vertex_sse.c -- Internal functions for t_vertex.c */ -void _tnl_generate_sse_emit( GLcontext *ctx ); +void _tnl_generate_sse_emit( struct gl_context *ctx ); #endif diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c index b1ea142464..12da30f5eb 100644 --- a/src/mesa/tnl/t_vertex_generic.c +++ b/src/mesa/tnl/t_vertex_generic.c @@ -866,7 +866,7 @@ const struct tnl_format_info _tnl_format_info[EMIT_MAX] = * vertices */ #define EMIT5(NR, F0, F1, F2, F3, F4, NAME) \ -static void NAME( GLcontext *ctx, \ +static void NAME( struct gl_context *ctx, \ GLuint count, \ GLubyte *v ) \ { \ @@ -929,7 +929,7 @@ EMIT4(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_xyzw4_rg /* Use the codegen paths to select one of a number of hardwired * fastpaths. */ -void _tnl_generate_hardwired_emit( GLcontext *ctx ) +void _tnl_generate_hardwired_emit( struct gl_context *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); tnl_emit_func func = NULL; @@ -987,7 +987,7 @@ void _tnl_generate_hardwired_emit( GLcontext *ctx ) * vertices */ -void _tnl_generic_emit( GLcontext *ctx, +void _tnl_generic_emit( struct gl_context *ctx, GLuint count, GLubyte *v ) { @@ -1007,7 +1007,7 @@ void _tnl_generic_emit( GLcontext *ctx, } -void _tnl_generic_interp( GLcontext *ctx, +void _tnl_generic_interp( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) @@ -1061,7 +1061,7 @@ void _tnl_generic_interp( GLcontext *ctx, /* Extract color attributes from one vertex and insert them into * another. (Shortcircuit extract/insert with memcpy). */ -void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) +void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); GLubyte *vsrc = vtx->vertex_buf + esrc * vtx->vertex_size; @@ -1085,7 +1085,7 @@ void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) /* Helper functions for hardware which doesn't put back colors and/or * edgeflags into vertices. */ -void _tnl_generic_interp_extras( GLcontext *ctx, +void _tnl_generic_interp_extras( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) @@ -1128,7 +1128,7 @@ void _tnl_generic_interp_extras( GLcontext *ctx, _tnl_generic_interp(ctx, t, dst, out, in, force_boundary); } -void _tnl_generic_copy_pv_extras( GLcontext *ctx, +void _tnl_generic_copy_pv_extras( struct gl_context *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c index 98058f3bda..93189656f7 100644 --- a/src/mesa/tnl/t_vertex_sse.c +++ b/src/mesa/tnl/t_vertex_sse.c @@ -54,7 +54,7 @@ struct x86_program { struct x86_function func; - GLcontext *ctx; + struct gl_context *ctx; GLboolean inputs_safe; GLboolean outputs_safe; GLboolean have_sse2; @@ -342,7 +342,7 @@ static void update_src_ptr( struct x86_program *p, */ static GLboolean build_vertex_emit( struct x86_program *p ) { - GLcontext *ctx = p->ctx; + struct gl_context *ctx = p->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); GLuint j = 0; @@ -638,7 +638,7 @@ static GLboolean build_vertex_emit( struct x86_program *p ) -void _tnl_generate_sse_emit( GLcontext *ctx ) +void _tnl_generate_sse_emit( struct gl_context *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct x86_program p; @@ -676,7 +676,7 @@ void _tnl_generate_sse_emit( GLcontext *ctx ) #else -void _tnl_generate_sse_emit( GLcontext *ctx ) +void _tnl_generate_sse_emit( struct gl_context *ctx ) { /* Dummy version for when USE_SSE_ASM not defined */ } diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 735937bbe2..421ec88a45 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -39,7 +39,7 @@ /** * XXX This should go away someday, but still referenced by some drivers... */ -void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) +void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ) { const struct gl_vertex_program *prev = ctx->VertexProgram._Current; diff --git a/src/mesa/tnl/t_vp_build.h b/src/mesa/tnl/t_vp_build.h index d6ebc66c04..1d10ff245d 100644 --- a/src/mesa/tnl/t_vp_build.h +++ b/src/mesa/tnl/t_vp_build.h @@ -37,6 +37,6 @@ _NEW_FOG | \ _NEW_POINT) -extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); +extern void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ); #endif diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index 2c0d1fef73..702efdc5cc 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -37,43 +37,43 @@ * itself.) */ extern GLboolean -_tnl_CreateContext( GLcontext *ctx ); +_tnl_CreateContext( struct gl_context *ctx ); extern void -_tnl_DestroyContext( GLcontext *ctx ); +_tnl_DestroyContext( struct gl_context *ctx ); extern void -_tnl_InvalidateState( GLcontext *ctx, GLuint new_state ); +_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ); /* Functions to revive the tnl module after being unhooked from * dispatch and/or driver callbacks. */ extern void -_tnl_wakeup( GLcontext *ctx ); +_tnl_wakeup( struct gl_context *ctx ); /* Driver configuration options: */ extern void -_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag ); +_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag ); /* Control whether T&L does per-vertex fog */ extern void -_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ); +_tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value ); extern void -_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ); +_tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value ); extern GLboolean -_tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program); +_tnl_program_string(struct gl_context *ctx, GLenum target, struct gl_program *program); struct _mesa_prim; struct _mesa_index_buffer; void -_tnl_draw_prims( GLcontext *ctx, +_tnl_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -82,7 +82,7 @@ _tnl_draw_prims( GLcontext *ctx, GLuint max_index); void -_tnl_vbo_draw_prims( GLcontext *ctx, +_tnl_vbo_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -92,9 +92,9 @@ _tnl_vbo_draw_prims( GLcontext *ctx, GLuint max_index); extern void -_mesa_load_tracked_matrices(GLcontext *ctx); +_mesa_load_tracked_matrices(struct gl_context *ctx); extern void -_tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]); +_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]); #endif diff --git a/src/mesa/tnl_dd/imm/t_dd_imm_primtmp.h b/src/mesa/tnl_dd/imm/t_dd_imm_primtmp.h index 97dca3fd42..7103db5355 100644 --- a/src/mesa/tnl_dd/imm/t_dd_imm_primtmp.h +++ b/src/mesa/tnl_dd/imm/t_dd_imm_primtmp.h @@ -46,7 +46,7 @@ * GL_POINTS */ -static void TAG(flush_point_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_point_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { if ( !v0->mask ) { LOCAL_VARS; @@ -59,16 +59,16 @@ static void TAG(flush_point_0)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_LINES */ -static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_line_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; FLUSH_VERTEX = TAG(flush_line_1); ACTIVE_VERTEX = IMM_VERTICES( 1 ); } -static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v1 = v0 - 1; @@ -85,10 +85,10 @@ static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_LINE_LOOP */ -static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_loop_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_loop_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_line_loop_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_loop_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -107,7 +107,7 @@ static void TAG(flush_line_loop_0)( GLcontext *ctx, TNL_VERTEX *v0 ) EMIT_VERTEX( b ); \ } -static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_loop_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v1 = v0 - 1; @@ -116,7 +116,7 @@ static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 ) DRAW_LINELOOP_LINE( v1, v0 ); } -static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_loop_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v1 = v0 + 1; @@ -125,7 +125,7 @@ static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 ) DRAW_LINELOOP_LINE( v1, v0 ); } -static void TAG(end_line_loop)( GLcontext *ctx ) +static void TAG(end_line_loop)( struct gl_context *ctx ) { LOCAL_VARS; @@ -142,10 +142,10 @@ static void TAG(end_line_loop)( GLcontext *ctx ) * GL_LINE_STRIP */ -static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_line_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_strip_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -154,7 +154,7 @@ static void TAG(flush_line_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) } -static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v1 = v0 - 1; @@ -173,7 +173,7 @@ static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) } } -static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_line_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v1 = v0 + 1; @@ -198,10 +198,10 @@ static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_TRIANGLES */ -static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_triangle_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_triangle_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_triangle_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_triangle_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -212,7 +212,7 @@ static void TAG(flush_triangle_0)( GLcontext *ctx, TNL_VERTEX *v0 ) BEGIN_PRIM( GL_TRIANGLES, 0 ); } -static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_triangle_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -222,7 +222,7 @@ static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 ) FLUSH_VERTEX = TAG(flush_triangle_2); } -static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_triangle_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v2 = v0 - 2; @@ -249,18 +249,18 @@ static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_TRIANGLE_STRIP */ -static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_tri_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_strip_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 1 ); FLUSH_VERTEX = TAG(flush_tri_strip_1); } -static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 2 ); @@ -283,7 +283,7 @@ static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) EMIT_VERTEX( v0 ); \ } -static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; FLUSH_VERTEX = TAG(flush_tri_strip_3); @@ -291,7 +291,7 @@ static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) DO_TRISTRIP_TRI( 0, 1 ); } -static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; FLUSH_VERTEX = TAG(flush_tri_strip_4); @@ -299,7 +299,7 @@ static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ) DO_TRISTRIP_TRI( 1, 2 ); } -static void TAG(flush_tri_strip_4)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_strip_4)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; FLUSH_VERTEX = TAG(flush_tri_strip_5); @@ -307,7 +307,7 @@ static void TAG(flush_tri_strip_4)( GLcontext *ctx, TNL_VERTEX *v0 ) DO_TRISTRIP_TRI( 2, 3 ); } -static void TAG(flush_tri_strip_5)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_strip_5)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; FLUSH_VERTEX = TAG(flush_tri_strip_2); @@ -321,10 +321,10 @@ static void TAG(flush_tri_strip_5)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_TRIANGLE_FAN */ -static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_fan_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_fan_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_tri_fan_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_fan_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -332,7 +332,7 @@ static void TAG(flush_tri_fan_0)( GLcontext *ctx, TNL_VERTEX *v0 ) FLUSH_VERTEX = TAG(flush_tri_fan_1); } -static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_fan_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -356,7 +356,7 @@ static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 ) EMIT_VERTEX( v0 ); \ } -static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_fan_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 1 ); @@ -364,7 +364,7 @@ static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 ) DO_TRIFAN_TRI( 0, 1 ); } -static void TAG(flush_tri_fan_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_tri_fan_3)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 2 ); @@ -378,32 +378,32 @@ static void TAG(flush_tri_fan_3)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_QUADS */ -static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_quad_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_quad_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_3)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_quad_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; IMM_VERTEX( v0 ) = v0 + 1; FLUSH_VERTEX = TAG(flush_quad_1); } -static void TAG(flush_quad_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; IMM_VERTEX( v0 ) = v0 + 1; FLUSH_VERTEX = TAG(flush_quad_2); } -static void TAG(flush_quad_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; IMM_VERTEX( v0 ) = v0 + 1; FLUSH_VERTEX = TAG(flush_quad_3); } -static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_3)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v3 = v0 - 3; @@ -431,11 +431,11 @@ static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_QUAD_STRIP */ -static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_quad_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_strip_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -444,7 +444,7 @@ static void TAG(flush_quad_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) FLUSH_VERTEX = TAG(flush_quad_strip_1); } -static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -453,7 +453,7 @@ static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) FLUSH_VERTEX = TAG(flush_quad_strip_2); } -static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; @@ -462,7 +462,7 @@ static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) FLUSH_VERTEX = TAG(flush_quad_strip_3); } -static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_quad_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; TNL_VERTEX *v3 = IMM_VERTEX( v3 ); @@ -489,17 +489,17 @@ static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ) * GL_POLYGON */ -static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_poly_2)( struct gl_context *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_poly_1)( struct gl_context *ctx, TNL_VERTEX *v0 ); -static void TAG(flush_poly_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_poly_0)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 1 ); FLUSH_VERTEX = TAG(flush_poly_1); } -static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_poly_1)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 2 ); @@ -522,7 +522,7 @@ static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 ) EMIT_VERTEX( v0 ); \ } -static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_poly_2)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 1 ); @@ -530,7 +530,7 @@ static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 ) DO_POLY_TRI( 0, 1 ); } -static void TAG(flush_poly_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +static void TAG(flush_poly_3)( struct gl_context *ctx, TNL_VERTEX *v0 ) { LOCAL_VARS; ACTIVE_VERTEX = IMM_VERTICES( 2 ); @@ -539,7 +539,7 @@ static void TAG(flush_poly_3)( GLcontext *ctx, TNL_VERTEX *v0 ) } -void (*TAG(flush_tab)[GL_POLYGON+1])( GLcontext *, TNL_VERTEX * ) = +void (*TAG(flush_tab)[GL_POLYGON+1])( struct gl_context *, TNL_VERTEX * ) = { TAG(flush_point), TAG(flush_line_0), diff --git a/src/mesa/tnl_dd/imm/t_dd_imm_vb.c b/src/mesa/tnl_dd/imm/t_dd_imm_vb.c index 0c4462f556..5081d92dba 100644 --- a/src/mesa/tnl_dd/imm/t_dd_imm_vb.c +++ b/src/mesa/tnl_dd/imm/t_dd_imm_vb.c @@ -113,7 +113,7 @@ do { \ /* Clip a line against the viewport and user clip planes. */ -static void TAG(clip_draw_line)( GLcontext *ctx, +static void TAG(clip_draw_line)( struct gl_context *ctx, TNL_VERTEX *I, TNL_VERTEX *J, GLuint mask ) @@ -140,7 +140,7 @@ static void TAG(clip_draw_line)( GLcontext *ctx, /* Clip a triangle against the viewport and user clip planes. */ -static void TAG(clip_draw_triangle)( GLcontext *ctx, +static void TAG(clip_draw_triangle)( struct gl_context *ctx, TNL_VERTEX *v0, TNL_VERTEX *v1, TNL_VERTEX *v2, @@ -173,7 +173,7 @@ static void TAG(clip_draw_triangle)( GLcontext *ctx, } -static __inline void TAG(draw_triangle)( GLcontext *ctx, +static __inline void TAG(draw_triangle)( struct gl_context *ctx, TNL_VERTEX *v0, TNL_VERTEX *v1, TNL_VERTEX *v2 ) @@ -188,7 +188,7 @@ static __inline void TAG(draw_triangle)( GLcontext *ctx, } } -static __inline void TAG(draw_line)( GLcontext *ctx, +static __inline void TAG(draw_line)( struct gl_context *ctx, TNL_VERTEX *v0, TNL_VERTEX *v1 ) { diff --git a/src/mesa/tnl_dd/imm/t_dd_imm_vbtmp.h b/src/mesa/tnl_dd/imm/t_dd_imm_vbtmp.h index 2f76553cff..bb394622fa 100644 --- a/src/mesa/tnl_dd/imm/t_dd_imm_vbtmp.h +++ b/src/mesa/tnl_dd/imm/t_dd_imm_vbtmp.h @@ -41,7 +41,7 @@ /* COPY_VERTEX_FROM_CURRENT in t_dd_imm_vapi.c */ -static void TAG(emit_vfmt)( GLcontext *ctx, VERTEX *v ) +static void TAG(emit_vfmt)( struct gl_context *ctx, VERTEX *v ) { LOCALVARS ; @@ -132,7 +132,7 @@ static void TAG(emit_vfmt)( GLcontext *ctx, VERTEX *v ) -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, TNL_VERTEX *dst, TNL_VERTEX *in, @@ -240,7 +240,7 @@ static void TAG(interp)( GLcontext *ctx, } -static __inline void TAG(copy_pv)( GLcontext *ctx, +static __inline void TAG(copy_pv)( struct gl_context *ctx, TNL_VERTEX *dst, TNL_VERTEX *src ) { diff --git a/src/mesa/tnl_dd/t_dd.c b/src/mesa/tnl_dd/t_dd.c index 731da5c320..214ebd4280 100644 --- a/src/mesa/tnl_dd/t_dd.c +++ b/src/mesa/tnl_dd/t_dd.c @@ -26,7 +26,7 @@ * Keith Whitwell */ -static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv_rgba4_spec5( struct gl_context *ctx, GLuint edst, GLuint esrc ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); GLubyte *i810verts = (GLubyte *)imesa->verts; @@ -37,7 +37,7 @@ static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) dst->ui[5] = src->ui[5]; } -static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv_rgba4( struct gl_context *ctx, GLuint edst, GLuint esrc ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); GLubyte *i810verts = (GLubyte *)imesa->verts; @@ -47,7 +47,7 @@ static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc ) dst->ui[4] = src->ui[4]; } -static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv_rgba3( struct gl_context *ctx, GLuint edst, GLuint esrc ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); GLubyte *i810verts = (GLubyte *)imesa->verts; diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h index 2424204b88..997fc0b20c 100644 --- a/src/mesa/tnl_dd/t_dd_dmatmp.h +++ b/src/mesa/tnl_dd/t_dd_dmatmp.h @@ -73,7 +73,7 @@ do { \ #if (HAVE_ELTS) -static void *TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr, +static void *TAG(emit_elts)( struct gl_context *ctx, GLuint *elts, GLuint nr, void *buf) { GLint i; @@ -94,7 +94,7 @@ static void *TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr, } #endif -static __inline void *TAG(emit_verts)( GLcontext *ctx, GLuint start, +static __inline void *TAG(emit_verts)( struct gl_context *ctx, GLuint start, GLuint count, void *buf ) { return EMIT_VERTS(ctx, start, count, buf); @@ -104,7 +104,7 @@ static __inline void *TAG(emit_verts)( GLcontext *ctx, GLuint start, * Render non-indexed primitives. ***********************************************************************/ -static void TAG(render_points_verts)( GLcontext *ctx, +static void TAG(render_points_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -133,7 +133,7 @@ static void TAG(render_points_verts)( GLcontext *ctx, } } -static void TAG(render_lines_verts)( GLcontext *ctx, +static void TAG(render_lines_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -169,7 +169,7 @@ static void TAG(render_lines_verts)( GLcontext *ctx, } -static void TAG(render_line_strip_verts)( GLcontext *ctx, +static void TAG(render_line_strip_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -201,7 +201,7 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx, } -static void TAG(render_line_loop_verts)( GLcontext *ctx, +static void TAG(render_line_loop_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -267,7 +267,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, } -static void TAG(render_triangles_verts)( GLcontext *ctx, +static void TAG(render_triangles_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -298,7 +298,7 @@ static void TAG(render_triangles_verts)( GLcontext *ctx, -static void TAG(render_tri_strip_verts)( GLcontext *ctx, +static void TAG(render_tri_strip_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -336,7 +336,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, } } -static void TAG(render_tri_fan_verts)( GLcontext *ctx, +static void TAG(render_tri_fan_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -376,7 +376,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx, } -static void TAG(render_poly_verts)( GLcontext *ctx, +static void TAG(render_poly_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -414,7 +414,7 @@ static void TAG(render_poly_verts)( GLcontext *ctx, } } -static void TAG(render_quad_strip_verts)( GLcontext *ctx, +static void TAG(render_quad_strip_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -540,7 +540,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, } -static void TAG(render_quads_verts)( GLcontext *ctx, +static void TAG(render_quads_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -649,7 +649,7 @@ static void TAG(render_quads_verts)( GLcontext *ctx, } } -static void TAG(render_noop)( GLcontext *ctx, +static void TAG(render_noop)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -680,7 +680,7 @@ static tnl_render_func TAG(render_tab_verts)[GL_POLYGON+2] = ****************************************************************************/ #if (HAVE_ELTS) -static void TAG(render_points_elts)( GLcontext *ctx, +static void TAG(render_points_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -712,7 +712,7 @@ static void TAG(render_points_elts)( GLcontext *ctx, -static void TAG(render_lines_elts)( GLcontext *ctx, +static void TAG(render_lines_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -749,7 +749,7 @@ static void TAG(render_lines_elts)( GLcontext *ctx, } -static void TAG(render_line_strip_elts)( GLcontext *ctx, +static void TAG(render_line_strip_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -783,7 +783,7 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx, } -static void TAG(render_line_loop_elts)( GLcontext *ctx, +static void TAG(render_line_loop_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -855,7 +855,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, * buffers. For elts, this is probably no better (worse?) than the * standard path. */ -static void TAG(render_triangles_elts)( GLcontext *ctx, +static void TAG(render_triangles_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -889,7 +889,7 @@ static void TAG(render_triangles_elts)( GLcontext *ctx, -static void TAG(render_tri_strip_elts)( GLcontext *ctx, +static void TAG(render_tri_strip_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -927,7 +927,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx, } } -static void TAG(render_tri_fan_elts)( GLcontext *ctx, +static void TAG(render_tri_fan_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -965,7 +965,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx, } -static void TAG(render_poly_elts)( GLcontext *ctx, +static void TAG(render_poly_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -1003,7 +1003,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx, } } -static void TAG(render_quad_strip_elts)( GLcontext *ctx, +static void TAG(render_quad_strip_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -1071,7 +1071,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, } -static void TAG(render_quads_elts)( GLcontext *ctx, +static void TAG(render_quads_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -1173,7 +1173,7 @@ static tnl_render_func TAG(render_tab_elts)[GL_POLYGON+2] = /* Pre-check the primitives in the VB to prevent the need for * fallbacks later on. */ -static GLboolean TAG(validate_render)( GLcontext *ctx, +static GLboolean TAG(validate_render)( struct gl_context *ctx, struct vertex_buffer *VB ) { GLint i; diff --git a/src/mesa/tnl_dd/t_dd_dmatmp2.h b/src/mesa/tnl_dd/t_dd_dmatmp2.h index cd225b6343..8836bde09f 100644 --- a/src/mesa/tnl_dd/t_dd_dmatmp2.h +++ b/src/mesa/tnl_dd/t_dd_dmatmp2.h @@ -70,7 +70,7 @@ do { \ /**********************************************************************/ -static ELT_TYPE *TAG(emit_elts)( GLcontext *ctx, +static ELT_TYPE *TAG(emit_elts)( struct gl_context *ctx, ELT_TYPE *dest, GLuint *elts, GLuint nr ) { @@ -89,7 +89,7 @@ static ELT_TYPE *TAG(emit_elts)( GLcontext *ctx, return dest; } -static ELT_TYPE *TAG(emit_consecutive_elts)( GLcontext *ctx, +static ELT_TYPE *TAG(emit_consecutive_elts)( struct gl_context *ctx, ELT_TYPE *dest, GLuint start, GLuint nr ) { @@ -114,7 +114,7 @@ static ELT_TYPE *TAG(emit_consecutive_elts)( GLcontext *ctx, -static void TAG(render_points_verts)( GLcontext *ctx, +static void TAG(render_points_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -126,7 +126,7 @@ static void TAG(render_points_verts)( GLcontext *ctx, } } -static void TAG(render_lines_verts)( GLcontext *ctx, +static void TAG(render_lines_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -150,7 +150,7 @@ static void TAG(render_lines_verts)( GLcontext *ctx, } -static void TAG(render_line_strip_verts)( GLcontext *ctx, +static void TAG(render_line_strip_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -197,7 +197,7 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx, } -static void TAG(render_line_loop_verts)( GLcontext *ctx, +static void TAG(render_line_loop_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -286,7 +286,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, } -static void TAG(render_triangles_verts)( GLcontext *ctx, +static void TAG(render_triangles_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -307,7 +307,7 @@ static void TAG(render_triangles_verts)( GLcontext *ctx, -static void TAG(render_tri_strip_verts)( GLcontext *ctx, +static void TAG(render_tri_strip_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -352,7 +352,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, EMIT_PRIM( ctx, GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0, start, count ); } -static void TAG(render_tri_fan_verts)( GLcontext *ctx, +static void TAG(render_tri_fan_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -395,7 +395,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx, } -static void TAG(render_poly_verts)( GLcontext *ctx, +static void TAG(render_poly_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -409,7 +409,7 @@ static void TAG(render_poly_verts)( GLcontext *ctx, EMIT_PRIM( ctx, GL_POLYGON, HW_POLYGON, start, count ); } -static void TAG(render_quad_strip_verts)( GLcontext *ctx, +static void TAG(render_quad_strip_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -460,7 +460,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, } -static void TAG(render_quads_verts)( GLcontext *ctx, +static void TAG(render_quads_verts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -509,7 +509,7 @@ static void TAG(render_quads_verts)( GLcontext *ctx, } } -static void TAG(render_noop)( GLcontext *ctx, +static void TAG(render_noop)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -539,7 +539,7 @@ static tnl_render_func TAG(render_tab_verts)[GL_POLYGON+2] = * Render elts using hardware indexed verts * ****************************************************************************/ -static void TAG(render_points_elts)( GLcontext *ctx, +static void TAG(render_points_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -563,7 +563,7 @@ static void TAG(render_points_elts)( GLcontext *ctx, -static void TAG(render_lines_elts)( GLcontext *ctx, +static void TAG(render_lines_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -602,7 +602,7 @@ static void TAG(render_lines_elts)( GLcontext *ctx, } -static void TAG(render_line_strip_elts)( GLcontext *ctx, +static void TAG(render_line_strip_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -631,7 +631,7 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx, } -static void TAG(render_line_loop_elts)( GLcontext *ctx, +static void TAG(render_line_loop_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -683,7 +683,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, } -static void TAG(render_triangles_elts)( GLcontext *ctx, +static void TAG(render_triangles_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -716,7 +716,7 @@ static void TAG(render_triangles_elts)( GLcontext *ctx, -static void TAG(render_tri_strip_elts)( GLcontext *ctx, +static void TAG(render_tri_strip_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -746,7 +746,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx, } } -static void TAG(render_tri_fan_elts)( GLcontext *ctx, +static void TAG(render_tri_fan_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -773,7 +773,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx, } -static void TAG(render_poly_elts)( GLcontext *ctx, +static void TAG(render_poly_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -799,7 +799,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx, } } -static void TAG(render_quad_strip_elts)( GLcontext *ctx, +static void TAG(render_quad_strip_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -861,7 +861,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, } -static void TAG(render_quads_elts)( GLcontext *ctx, +static void TAG(render_quads_elts)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) diff --git a/src/mesa/tnl_dd/t_dd_rendertmp.h b/src/mesa/tnl_dd/t_dd_rendertmp.h index b9f030195d..692b4d1fd7 100644 --- a/src/mesa/tnl_dd/t_dd_rendertmp.h +++ b/src/mesa/tnl_dd/t_dd_rendertmp.h @@ -63,7 +63,7 @@ #define RENDER_TAB_QUALIFIER static #endif -static void TAG(render_points)( GLcontext *ctx, +static void TAG(render_points)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -77,7 +77,7 @@ static void TAG(render_points)( GLcontext *ctx, POSTFIX; } -static void TAG(render_lines)( GLcontext *ctx, +static void TAG(render_lines)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -96,7 +96,7 @@ static void TAG(render_lines)( GLcontext *ctx, } -static void TAG(render_line_strip)( GLcontext *ctx, +static void TAG(render_line_strip)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -118,7 +118,7 @@ static void TAG(render_line_strip)( GLcontext *ctx, } -static void TAG(render_line_loop)( GLcontext *ctx, +static void TAG(render_line_loop)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -150,7 +150,7 @@ static void TAG(render_line_loop)( GLcontext *ctx, } -static void TAG(render_triangles)( GLcontext *ctx, +static void TAG(render_triangles)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -177,7 +177,7 @@ static void TAG(render_triangles)( GLcontext *ctx, -static void TAG(render_tri_strip)( GLcontext *ctx, +static void TAG(render_tri_strip)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -213,7 +213,7 @@ static void TAG(render_tri_strip)( GLcontext *ctx, } -static void TAG(render_tri_fan)( GLcontext *ctx, +static void TAG(render_tri_fan)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -252,7 +252,7 @@ static void TAG(render_tri_fan)( GLcontext *ctx, } -static void TAG(render_poly)( GLcontext *ctx, +static void TAG(render_poly)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -321,7 +321,7 @@ static void TAG(render_poly)( GLcontext *ctx, POSTFIX; } -static void TAG(render_quads)( GLcontext *ctx, +static void TAG(render_quads)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -346,7 +346,7 @@ static void TAG(render_quads)( GLcontext *ctx, POSTFIX; } -static void TAG(render_quad_strip)( GLcontext *ctx, +static void TAG(render_quad_strip)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -384,7 +384,7 @@ static void TAG(render_quad_strip)( GLcontext *ctx, POSTFIX; } -static void TAG(render_noop)( GLcontext *ctx, +static void TAG(render_noop)( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -392,7 +392,7 @@ static void TAG(render_noop)( GLcontext *ctx, (void)(ctx && start && count && flags); } -RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, +RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(struct gl_context *, GLuint, GLuint, GLuint) = diff --git a/src/mesa/tnl_dd/t_dd_triemit.h b/src/mesa/tnl_dd/t_dd_triemit.h index f5979ee9a7..39c9d26481 100644 --- a/src/mesa/tnl_dd/t_dd_triemit.h +++ b/src/mesa/tnl_dd/t_dd_triemit.h @@ -136,7 +136,7 @@ static __inline void TAG(point)( CTX_ARG, #endif -static void TAG(fast_clipped_poly)( GLcontext *ctx, const GLuint *elts, +static void TAG(fast_clipped_poly)( struct gl_context *ctx, const GLuint *elts, GLuint n ) { LOCAL_VARS diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h index 2c36d845ab..022f0c6c60 100644 --- a/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/src/mesa/tnl_dd/t_dd_tritmp.h @@ -111,7 +111,7 @@ #endif #if DO_TRI -static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) +static void TAG(triangle)( struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2 ) { struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; VERTEX *v[3]; @@ -335,7 +335,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) #if DO_QUAD #if DO_FULL_QUAD -static void TAG(quadr)( GLcontext *ctx, +static void TAG(quadr)( struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) { struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; @@ -575,7 +575,7 @@ static void TAG(quadr)( GLcontext *ctx, } } #else -static void TAG(quadr)( GLcontext *ctx, GLuint e0, +static void TAG(quadr)( struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) { if (DO_UNFILLED) { @@ -597,7 +597,7 @@ static void TAG(quadr)( GLcontext *ctx, GLuint e0, #endif #if DO_LINE -static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) +static void TAG(line)( struct gl_context *ctx, GLuint e0, GLuint e1 ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; VERTEX *v[2]; @@ -628,7 +628,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) #endif #if DO_POINTS -static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) +static void TAG(points)( struct gl_context *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; GLuint i; diff --git a/src/mesa/tnl_dd/t_dd_unfilled.h b/src/mesa/tnl_dd/t_dd_unfilled.h index 9c467291a1..9856a36d6f 100644 --- a/src/mesa/tnl_dd/t_dd_unfilled.h +++ b/src/mesa/tnl_dd/t_dd_unfilled.h @@ -32,7 +32,7 @@ #define VERT_RESTORE_SPEC( idx ) #endif -static void TAG(unfilled_tri)( GLcontext *ctx, +static void TAG(unfilled_tri)( struct gl_context *ctx, GLenum mode, GLuint e0, GLuint e1, GLuint e2 ) { @@ -95,7 +95,7 @@ static void TAG(unfilled_tri)( GLcontext *ctx, } -static void TAG(unfilled_quad)( GLcontext *ctx, +static void TAG(unfilled_quad)( struct gl_context *ctx, GLenum mode, GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c index a8a0a69768..543b0a5685 100644 --- a/src/mesa/tnl_dd/t_dd_vb.c +++ b/src/mesa/tnl_dd/t_dd_vb.c @@ -46,7 +46,7 @@ * really convenient to put them. Need to build some actual .o files in * this directory? */ -static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv_rgba4_spec5( struct gl_context *ctx, GLuint edst, GLuint esrc ) { LOCALVARS GLubyte *verts = GET_VERTEX_STORE(); @@ -57,7 +57,7 @@ static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) dst[5] = src[5]; } -static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv_rgba4( struct gl_context *ctx, GLuint edst, GLuint esrc ) { LOCALVARS GLubyte *verts = GET_VERTEX_STORE(); @@ -67,7 +67,7 @@ static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc ) dst[4] = src[4]; } -static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv_rgba3( struct gl_context *ctx, GLuint edst, GLuint esrc ) { LOCALVARS GLubyte *verts = GET_VERTEX_STORE(); @@ -78,7 +78,7 @@ static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) } -void TAG(translate_vertex)(GLcontext *ctx, +void TAG(translate_vertex)(struct gl_context *ctx, const VERTEX *src, SWvertex *dst) { @@ -189,10 +189,10 @@ void TAG(translate_vertex)(GLcontext *ctx, /* prototype to silence warning */ -void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ); +void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v ); -void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) +void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v ) { LOCALVARS GLuint format = GET_VERTEX_FORMAT(); @@ -289,7 +289,7 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) #define GET_COLOR(ptr, idx) ((ptr)->data[idx]) -INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, +INTERP_QUALIFIER void TAG(interp_extras)( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) @@ -320,7 +320,7 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, INTERP_VERTEX(ctx, t, dst, out, in, force_boundary); } -INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx, +INTERP_QUALIFIER void TAG(copy_pv_extras)( struct gl_context *ctx, GLuint dst, GLuint src ) { LOCALVARS diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h index 85101b9ceb..d19137b767 100644 --- a/src/mesa/tnl_dd/t_dd_vbtmp.h +++ b/src/mesa/tnl_dd/t_dd_vbtmp.h @@ -117,7 +117,7 @@ #if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES) -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) @@ -338,7 +338,7 @@ static void TAG(emit)( GLcontext *ctx, #error "cannot use tiny vertices with hw perspective divide" #endif -static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) { LOCALVARS @@ -403,7 +403,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, #if (HAVE_PTEX_VERTICES) -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -431,7 +431,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) return GL_TRUE; } #else -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -472,7 +472,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) #endif /* ptex */ -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 30b1448b8a..7b8da8eb84 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -61,12 +61,12 @@ struct _mesa_index_buffer { -GLboolean _vbo_CreateContext( GLcontext *ctx ); -void _vbo_DestroyContext( GLcontext *ctx ); -void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state ); +GLboolean _vbo_CreateContext( struct gl_context *ctx ); +void _vbo_DestroyContext( struct gl_context *ctx ); +void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ); -typedef void (*vbo_draw_func)( GLcontext *ctx, +typedef void (*vbo_draw_func)( struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, @@ -92,7 +92,7 @@ struct split_limits { }; -void vbo_split_prims( GLcontext *ctx, +void vbo_split_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -108,7 +108,7 @@ void vbo_split_prims( GLcontext *ctx, GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] ); GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] ); -void vbo_rebase_prims( GLcontext *ctx, +void vbo_rebase_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -117,14 +117,14 @@ void vbo_rebase_prims( GLcontext *ctx, GLuint max_index, vbo_draw_func draw ); void -vbo_get_minmax_index(GLcontext *ctx, const struct _mesa_prim *prim, +vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint *min_index, GLuint *max_index); -void vbo_use_buffer_objects(GLcontext *ctx); +void vbo_use_buffer_objects(struct gl_context *ctx); -void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func); +void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func); void GLAPIENTRY diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 580850574c..9992cc3473 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -49,7 +49,7 @@ static GLuint check_size( const GLfloat *attr ) } -static void init_legacy_currval(GLcontext *ctx) +static void init_legacy_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct gl_client_array *arrays = vbo->legacy_currval; @@ -78,7 +78,7 @@ static void init_legacy_currval(GLcontext *ctx) } -static void init_generic_currval(GLcontext *ctx) +static void init_generic_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct gl_client_array *arrays = vbo->generic_currval; @@ -104,7 +104,7 @@ static void init_generic_currval(GLcontext *ctx) } -static void init_mat_currval(GLcontext *ctx) +static void init_mat_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct gl_client_array *arrays = vbo->mat_currval; @@ -149,7 +149,7 @@ static void init_mat_currval(GLcontext *ctx) } -GLboolean _vbo_CreateContext( GLcontext *ctx ) +GLboolean _vbo_CreateContext( struct gl_context *ctx ) { struct vbo_context *vbo = CALLOC_STRUCT(vbo_context); @@ -207,14 +207,14 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) } -void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state ) +void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ) { _ae_invalidate_state(ctx, new_state); vbo_exec_invalidate_state(ctx, new_state); } -void _vbo_DestroyContext( GLcontext *ctx ) +void _vbo_DestroyContext( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); @@ -239,7 +239,7 @@ void _vbo_DestroyContext( GLcontext *ctx ) } -void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func) +void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func) { struct vbo_context *vbo = vbo_context(ctx); vbo->draw_prims = func; diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 00cfc522a0..8d6f2a7ce6 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -85,7 +85,7 @@ struct vbo_context { }; -static INLINE struct vbo_context *vbo_context(GLcontext *ctx) +static INLINE struct vbo_context *vbo_context(struct gl_context *ctx) { return (struct vbo_context *)(ctx->swtnl_im); } @@ -96,7 +96,7 @@ static INLINE struct vbo_context *vbo_context(GLcontext *ctx) * vertex transformation, an NV vertex program or ARB vertex program/shader. */ static INLINE enum vp_mode -get_program_mode( GLcontext *ctx ) +get_program_mode( struct gl_context *ctx ) { if (!ctx->VertexProgram._Current) return VP_NONE; diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index 046fa8105b..e8d5b39b3f 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -34,7 +34,7 @@ -void vbo_exec_init( GLcontext *ctx ) +void vbo_exec_init( struct gl_context *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -62,7 +62,7 @@ void vbo_exec_init( GLcontext *ctx ) } -void vbo_exec_destroy( GLcontext *ctx ) +void vbo_exec_destroy( struct gl_context *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -81,7 +81,7 @@ void vbo_exec_destroy( GLcontext *ctx ) * invoked according to the state flags. That will have to wait for a * mesa rework: */ -void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state ) +void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 33494f0cea..47e51f09c9 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -79,7 +79,7 @@ typedef void (*vbo_attrfv_func)( const GLfloat * ); struct vbo_exec_context { - GLcontext *ctx; + struct gl_context *ctx; GLvertexformat vtxfmt; struct { @@ -148,13 +148,13 @@ struct vbo_exec_context /* External API: */ -void vbo_exec_init( GLcontext *ctx ); -void vbo_exec_destroy( GLcontext *ctx ); -void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state ); -void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ); +void vbo_exec_init( struct gl_context *ctx ); +void vbo_exec_destroy( struct gl_context *ctx ); +void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ); +void vbo_exec_FlushVertices_internal( struct gl_context *ctx, GLboolean unmap ); -void vbo_exec_BeginVertices( GLcontext *ctx ); -void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ); +void vbo_exec_BeginVertices( struct gl_context *ctx ); +void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ); /* Internal functions: diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 9df75a8406..5070b35c11 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -142,7 +142,7 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ) */ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLuint i; @@ -193,7 +193,7 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) static void vbo_exec_copy_from_current( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLint i; @@ -217,7 +217,7 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec, GLuint attr, GLuint newsz ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLint lastcount = exec->vtx.vert_count; GLfloat *tmp; @@ -318,7 +318,7 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec, } -static void vbo_exec_fixup_vertex( GLcontext *ctx, +static void vbo_exec_fixup_vertex( struct gl_context *ctx, GLuint attr, GLuint sz ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -740,7 +740,7 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) * This replaces the malloced buffer which was created in * vb_exec_vtx_init() below. */ -void vbo_use_buffer_objects(GLcontext *ctx) +void vbo_use_buffer_objects(struct gl_context *ctx) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; /* Any buffer name but 0 can be used here since this bufferobj won't @@ -769,7 +769,7 @@ void vbo_use_buffer_objects(GLcontext *ctx) void vbo_exec_vtx_init( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLuint i; @@ -827,7 +827,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) { /* using a real VBO for vertex data */ - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; unsigned i; /* True VBOs should already be unmapped @@ -858,7 +858,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); } -void vbo_exec_BeginVertices( GLcontext *ctx ) +void vbo_exec_BeginVertices( struct gl_context *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; if (0) printf("%s\n", __FUNCTION__); @@ -868,7 +868,7 @@ void vbo_exec_BeginVertices( GLcontext *ctx ) exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; } -void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ) +void vbo_exec_FlushVertices_internal( struct gl_context *ctx, GLboolean unmap ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -886,7 +886,7 @@ void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ) /** * \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT */ -void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) +void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 1759e57887..f46ba636fe 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -43,7 +43,7 @@ * glDraw[Range]Elements() calls. */ void -vbo_get_minmax_index(GLcontext *ctx, +vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint *min_index, GLuint *max_index) @@ -115,7 +115,7 @@ vbo_get_minmax_index(GLcontext *ctx, * For debugging purposes; not normally used. */ static void -check_array_data(GLcontext *ctx, struct gl_client_array *array, +check_array_data(struct gl_context *ctx, struct gl_client_array *array, GLuint attrib, GLuint j) { if (array->Enabled) { @@ -161,7 +161,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array, * Unmap the buffer object referenced by given array, if mapped. */ static void -unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) +unmap_array_buffer(struct gl_context *ctx, struct gl_client_array *array) { if (array->Enabled && _mesa_is_bufferobj(array->BufferObj) && @@ -176,7 +176,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) * For debug purposes; not normally used. */ static void -check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, +check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, const void *elements, GLint basevertex) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; @@ -244,7 +244,7 @@ check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, * Check array data, looking for NaNs, etc. */ static void -check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) +check_draw_arrays_data(struct gl_context *ctx, GLint start, GLsizei count) { /* TO DO */ } @@ -254,7 +254,7 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) * Print info/data for glDrawArrays(), for debugging. */ static void -print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, +print_draw_arrays(struct gl_context *ctx, struct vbo_exec_context *exec, GLenum mode, GLint start, GLsizei count) { int i; @@ -303,7 +303,7 @@ print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, * Just translate the arrayobj into a sane layout. */ static void -bind_array_obj(GLcontext *ctx) +bind_array_obj(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -348,7 +348,7 @@ bind_array_obj(GLcontext *ctx) * to point at a zero-stride current value "array". */ static void -recalculate_input_bindings(GLcontext *ctx) +recalculate_input_bindings(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -464,7 +464,7 @@ recalculate_input_bindings(GLcontext *ctx) * must be done after this call. */ static void -bind_arrays(GLcontext *ctx) +bind_arrays(struct gl_context *ctx) { bind_array_obj(ctx); recalculate_input_bindings(ctx); @@ -599,7 +599,7 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, * For debugging. */ static void -dump_element_buffer(GLcontext *ctx, GLenum type) +dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLvoid *map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, @@ -657,7 +657,7 @@ dump_element_buffer(GLcontext *ctx, GLenum type) * we've validated buffer bounds, etc. */ static void -vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, +vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, GLboolean index_bounds_valid, GLuint start, GLuint end, GLsizei count, GLenum type, @@ -939,7 +939,7 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, * This does the actual rendering after we've checked array indexes, etc. */ static void -vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, +vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, const GLint *basevertex) diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 84ae1b87f9..71ac0066ca 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -154,7 +154,7 @@ vbo_copy_vertices( struct vbo_exec_context *exec ) /* TODO: populate these as the vertex is defined: */ static void -vbo_exec_bind_arrays( GLcontext *ctx ) +vbo_exec_bind_arrays( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -260,7 +260,7 @@ vbo_exec_vtx_unmap( struct vbo_exec_context *exec ) GLenum target = GL_ARRAY_BUFFER_ARB; if (_mesa_is_bufferobj(exec->vtx.bufferobj)) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; if (ctx->Driver.FlushMappedBufferRange) { GLintptr offset = exec->vtx.buffer_used - exec->vtx.bufferobj->Offset; @@ -289,7 +289,7 @@ vbo_exec_vtx_unmap( struct vbo_exec_context *exec ) void vbo_exec_vtx_map( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; const GLenum target = GL_ARRAY_BUFFER_ARB; const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */ const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */ @@ -363,7 +363,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) exec->vtx.copied.nr = vbo_copy_vertices( exec ); if (exec->vtx.copied.nr != exec->vtx.vert_count) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; /* Before the update_state() as this may raise _NEW_ARRAY * from _mesa_set_varying_vp_inputs(). diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index 23ad12608f..1e8c3c45bb 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -67,7 +67,7 @@ static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint void vbo_exec_eval_update( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; GLuint attr; /* Vertex program maps have priority over conventional attribs */ diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index e75253f862..9068ae240a 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -116,7 +116,7 @@ GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] ) * - can't save time by trying to upload half a vbo - typically it is * all or nothing. */ -void vbo_rebase_prims( GLcontext *ctx, +void vbo_rebase_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index dd5570689e..4e7bcddc97 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -36,7 +36,7 @@ #if FEATURE_dlist -static void vbo_save_callback_init( GLcontext *ctx ) +static void vbo_save_callback_init( struct gl_context *ctx ) { ctx->Driver.NewList = vbo_save_NewList; ctx->Driver.EndList = vbo_save_EndList; @@ -48,7 +48,7 @@ static void vbo_save_callback_init( GLcontext *ctx ) -void vbo_save_init( GLcontext *ctx ) +void vbo_save_init( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; @@ -79,7 +79,7 @@ void vbo_save_init( GLcontext *ctx ) } -void vbo_save_destroy( GLcontext *ctx ) +void vbo_save_destroy( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; @@ -108,7 +108,7 @@ void vbo_save_destroy( GLcontext *ctx ) /* Note that this can occur during the playback of a display list: */ -void vbo_save_fallback( GLcontext *ctx, GLboolean fallback ) +void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback ) { struct vbo_save_context *save = &vbo_context(ctx)->save; diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 82ba6c8afe..f5a407ced1 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -117,7 +117,7 @@ struct vbo_save_primitive_store { struct vbo_save_context { - GLcontext *ctx; + struct gl_context *ctx; GLvertexformat vtxfmt; struct gl_client_array arrays[VBO_ATTRIB_MAX]; const struct gl_client_array *inputs[VBO_ATTRIB_MAX]; @@ -155,13 +155,13 @@ struct vbo_save_context { #if FEATURE_dlist -void vbo_save_init( GLcontext *ctx ); -void vbo_save_destroy( GLcontext *ctx ); -void vbo_save_fallback( GLcontext *ctx, GLboolean fallback ); +void vbo_save_init( struct gl_context *ctx ); +void vbo_save_destroy( struct gl_context *ctx ); +void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback ); /* save_loopback.c: */ -void vbo_loopback_vertex_list( GLcontext *ctx, +void vbo_loopback_vertex_list( struct gl_context *ctx, const GLfloat *buffer, const GLubyte *attrsz, const struct _mesa_prim *prim, @@ -171,26 +171,26 @@ void vbo_loopback_vertex_list( GLcontext *ctx, /* Callbacks: */ -void vbo_save_EndList( GLcontext *ctx ); -void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ); -void vbo_save_EndCallList( GLcontext *ctx ); -void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *list ); -void vbo_save_SaveFlushVertices( GLcontext *ctx ); -GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ); +void vbo_save_EndList( struct gl_context *ctx ); +void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode ); +void vbo_save_EndCallList( struct gl_context *ctx ); +void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *list ); +void vbo_save_SaveFlushVertices( struct gl_context *ctx ); +GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode ); -void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ); +void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data ); void vbo_save_api_init( struct vbo_save_context *save ); #else /* FEATURE_dlist */ static INLINE void -vbo_save_init( GLcontext *ctx ) +vbo_save_init( struct gl_context *ctx ) { } static INLINE void -vbo_save_destroy( GLcontext *ctx ) +vbo_save_destroy( struct gl_context *ctx ) { } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index c3727cb52a..8d66e14ab3 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -99,7 +99,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * NOTE: Old 'parity' issue is gone, but copying can still be * wrong-footed on replay. */ -static GLuint _save_copy_vertices( GLcontext *ctx, +static GLuint _save_copy_vertices( struct gl_context *ctx, const struct vbo_save_vertex_list *node, const GLfloat *src_buffer) { @@ -170,7 +170,7 @@ static GLuint _save_copy_vertices( GLcontext *ctx, } -static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx ) +static struct vbo_save_vertex_store *alloc_vertex_store( struct gl_context *ctx ) { struct vbo_save_vertex_store *vertex_store = CALLOC_STRUCT(vbo_save_vertex_store); @@ -198,7 +198,7 @@ static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx ) return vertex_store; } -static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store ) +static void free_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store ) { assert(!vertex_store->buffer); @@ -209,7 +209,7 @@ static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *ver FREE( vertex_store ); } -static GLfloat *map_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store ) +static GLfloat *map_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store ) { assert(vertex_store->bufferobj); assert(!vertex_store->buffer); @@ -222,14 +222,14 @@ static GLfloat *map_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store * return vertex_store->buffer + vertex_store->used; } -static void unmap_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store ) +static void unmap_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store ) { ctx->Driver.UnmapBuffer( ctx, GL_ARRAY_BUFFER_ARB, vertex_store->bufferobj ); vertex_store->buffer = NULL; } -static struct vbo_save_primitive_store *alloc_prim_store( GLcontext *ctx ) +static struct vbo_save_primitive_store *alloc_prim_store( struct gl_context *ctx ) { struct vbo_save_primitive_store *store = CALLOC_STRUCT(vbo_save_primitive_store); (void) ctx; @@ -238,7 +238,7 @@ static struct vbo_save_primitive_store *alloc_prim_store( GLcontext *ctx ) return store; } -static void _save_reset_counters( GLcontext *ctx ) +static void _save_reset_counters( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -264,7 +264,7 @@ static void _save_reset_counters( GLcontext *ctx ) /* Insert the active immediate struct onto the display list currently * being built. */ -static void _save_compile_vertex_list( GLcontext *ctx ) +static void _save_compile_vertex_list( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; struct vbo_save_vertex_list *node; @@ -391,7 +391,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) /* TODO -- If no new vertices have been stored, don't bother saving * it. */ -static void _save_wrap_buffers( GLcontext *ctx ) +static void _save_wrap_buffers( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i = save->prim_count - 1; @@ -430,7 +430,7 @@ static void _save_wrap_buffers( GLcontext *ctx ) /* Called only when buffers are wrapped as the result of filling the * vertex_store struct. */ -static void _save_wrap_filled_vertex( GLcontext *ctx ) +static void _save_wrap_filled_vertex( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLfloat *data = save->copied.buffer; @@ -453,7 +453,7 @@ static void _save_wrap_filled_vertex( GLcontext *ctx ) } -static void _save_copy_to_current( GLcontext *ctx ) +static void _save_copy_to_current( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLuint i; @@ -469,7 +469,7 @@ static void _save_copy_to_current( GLcontext *ctx ) } -static void _save_copy_from_current( GLcontext *ctx ) +static void _save_copy_from_current( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i; @@ -490,7 +490,7 @@ static void _save_copy_from_current( GLcontext *ctx ) /* Flush existing data, set new attrib size, replay copied vertices. */ -static void _save_upgrade_vertex( GLcontext *ctx, +static void _save_upgrade_vertex( struct gl_context *ctx, GLuint attr, GLuint newsz ) { @@ -586,7 +586,7 @@ static void _save_upgrade_vertex( GLcontext *ctx, } } -static void save_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) +static void save_fixup_vertex( struct gl_context *ctx, GLuint attr, GLuint sz ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -610,7 +610,7 @@ static void save_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) save->active_sz[attr] = sz; } -static void _save_reset_vertex( GLcontext *ctx ) +static void _save_reset_vertex( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLuint i; @@ -673,7 +673,7 @@ do { \ * -- Flush current buffer * -- Fallback to opcodes for the rest of the begin/end object. */ -static void DO_FALLBACK( GLcontext *ctx ) +static void DO_FALLBACK( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -763,7 +763,7 @@ static void GLAPIENTRY _save_CallLists( GLsizei n, GLenum type, const GLvoid *v /* This begin is hooked into ... Updating of * ctx->Driver.CurrentSavePrimitive is already taken care of. */ -GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ) +GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -989,7 +989,7 @@ static void GLAPIENTRY _save_OBE_DrawRangeElements(GLenum mode, -static void _save_vtxfmt_init( GLcontext *ctx ) +static void _save_vtxfmt_init( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLvertexformat *vfmt = &save->vtxfmt; @@ -1074,7 +1074,7 @@ static void _save_vtxfmt_init( GLcontext *ctx ) } -void vbo_save_SaveFlushVertices( GLcontext *ctx ) +void vbo_save_SaveFlushVertices( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1094,7 +1094,7 @@ void vbo_save_SaveFlushVertices( GLcontext *ctx ) ctx->Driver.SaveNeedFlush = 0; } -void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ) +void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1113,7 +1113,7 @@ void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ) ctx->Driver.SaveNeedFlush = 0; } -void vbo_save_EndList( GLcontext *ctx ) +void vbo_save_EndList( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1147,13 +1147,13 @@ void vbo_save_EndList( GLcontext *ctx ) assert(save->vertex_size == 0); } -void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *dlist ) +void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *dlist ) { struct vbo_save_context *save = &vbo_context(ctx)->save; save->replay_flags |= dlist->Flags; } -void vbo_save_EndCallList( GLcontext *ctx ) +void vbo_save_EndCallList( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1166,7 +1166,7 @@ void vbo_save_EndCallList( GLcontext *ctx ) } -static void vbo_destroy_vertex_list( GLcontext *ctx, void *data ) +static void vbo_destroy_vertex_list( struct gl_context *ctx, void *data ) { struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *)data; (void) ctx; @@ -1184,7 +1184,7 @@ static void vbo_destroy_vertex_list( GLcontext *ctx, void *data ) } -static void vbo_print_vertex_list( GLcontext *ctx, void *data ) +static void vbo_print_vertex_list( struct gl_context *ctx, void *data ) { struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *)data; GLuint i; @@ -1209,7 +1209,7 @@ static void vbo_print_vertex_list( GLcontext *ctx, void *data ) } -static void _save_current_init( GLcontext *ctx ) +static void _save_current_init( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i; @@ -1234,7 +1234,7 @@ static void _save_current_init( GLcontext *ctx ) */ void vbo_save_api_init( struct vbo_save_context *save ) { - GLcontext *ctx = save->ctx; + struct gl_context *ctx = save->ctx; GLuint i; save->opcode_vertex_list = diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 297fd8705b..533c150a91 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -46,7 +46,7 @@ * last vertex to the saved state */ static void -_playback_copy_to_current(GLcontext *ctx, +_playback_copy_to_current(struct gl_context *ctx, const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); @@ -124,7 +124,7 @@ _playback_copy_to_current(GLcontext *ctx, * Treat the vertex storage as a VBO, define vertex arrays pointing * into it: */ -static void vbo_bind_vertex_list(GLcontext *ctx, +static void vbo_bind_vertex_list(struct gl_context *ctx, const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); @@ -209,7 +209,7 @@ static void vbo_bind_vertex_list(GLcontext *ctx, static void -vbo_save_loopback_vertex_list(GLcontext *ctx, +vbo_save_loopback_vertex_list(struct gl_context *ctx, const struct vbo_save_vertex_list *list) { const char *buffer = ctx->Driver.MapBuffer(ctx, @@ -236,7 +236,7 @@ vbo_save_loopback_vertex_list(GLcontext *ctx, * a drawing command. */ void -vbo_save_playback_vertex_list(GLcontext *ctx, void *data) +vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) { const struct vbo_save_vertex_list *node = (const struct vbo_save_vertex_list *) data; diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c index 5d1c7e4810..b1cfa9c2a8 100644 --- a/src/mesa/vbo/vbo_save_loopback.c +++ b/src/mesa/vbo/vbo_save_loopback.c @@ -39,29 +39,29 @@ #if FEATURE_dlist -typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * ); +typedef void (*attr_func)( struct gl_context *ctx, GLint target, const GLfloat * ); /* This file makes heavy use of the aliasing of NV vertex attributes * with the legacy attributes, and also with ARB and Material * attributes as currently implemented. */ -static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib1fvNV(ctx->Exec, (target, v)); } -static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib2fvNV(ctx->Exec, (target, v)); } -static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib3fvNV(ctx->Exec, (target, v)); } -static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib4fvNV(ctx->Exec, (target, v)); } @@ -83,7 +83,7 @@ struct loopback_attr { * wrapped vertices. If we get here, it's probably because the * precalculated wrapping is wrong. */ -static void loopback_prim( GLcontext *ctx, +static void loopback_prim( struct gl_context *ctx, const GLfloat *buffer, const struct _mesa_prim *prim, GLuint wrap_count, @@ -138,7 +138,7 @@ static void loopback_prim( GLcontext *ctx, * normally, otherwise need to track and discard the generated * primitives. */ -static void loopback_weak_prim( GLcontext *ctx, +static void loopback_weak_prim( struct gl_context *ctx, const struct _mesa_prim *prim ) { /* Use the prim_weak flag to ensure that if this primitive @@ -155,7 +155,7 @@ static void loopback_weak_prim( GLcontext *ctx, } -void vbo_loopback_vertex_list( GLcontext *ctx, +void vbo_loopback_vertex_list( struct gl_context *ctx, const GLfloat *buffer, const GLubyte *attrsz, const struct _mesa_prim *prim, diff --git a/src/mesa/vbo/vbo_split.c b/src/mesa/vbo/vbo_split.c index ce40cbbcc3..54b2539b8e 100644 --- a/src/mesa/vbo/vbo_split.c +++ b/src/mesa/vbo/vbo_split.c @@ -98,7 +98,7 @@ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr) -void vbo_split_prims( GLcontext *ctx, +void vbo_split_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_split.h b/src/mesa/vbo/vbo_split.h index 05888d048c..b7f0a9c576 100644 --- a/src/mesa/vbo/vbo_split.h +++ b/src/mesa/vbo/vbo_split.h @@ -49,7 +49,7 @@ */ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr); -void vbo_split_inplace( GLcontext *ctx, +void vbo_split_inplace( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -61,7 +61,7 @@ void vbo_split_inplace( GLcontext *ctx, /* Requires ib != NULL: */ -void vbo_split_copy( GLcontext *ctx, +void vbo_split_copy( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 2ec7d9b0fe..26d0046e83 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -49,7 +49,7 @@ */ struct copy_context { - GLcontext *ctx; + struct gl_context *ctx; const struct gl_client_array **array; const struct _mesa_prim *prim; GLuint nr_prims; @@ -137,7 +137,7 @@ check_flush( struct copy_context *copy ) * Dump the parameters/info for a vbo->draw() call. */ static void -dump_draw_info(GLcontext *ctx, +dump_draw_info(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, @@ -419,7 +419,7 @@ replay_elts( struct copy_context *copy ) static void replay_init( struct copy_context *copy ) { - GLcontext *ctx = copy->ctx; + struct gl_context *ctx = copy->ctx; GLuint i; GLuint offset; const GLvoid *srcptr; @@ -548,7 +548,7 @@ replay_init( struct copy_context *copy ) static void replay_finish( struct copy_context *copy ) { - GLcontext *ctx = copy->ctx; + struct gl_context *ctx = copy->ctx; GLuint i; /* Free our vertex and index buffers: @@ -577,7 +577,7 @@ replay_finish( struct copy_context *copy ) /** * Split VBO into smaller pieces, draw the pieces. */ -void vbo_split_copy( GLcontext *ctx, +void vbo_split_copy( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index 2fc866c577..789cf31364 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -41,7 +41,7 @@ * that. */ struct split_context { - GLcontext *ctx; + struct gl_context *ctx; const struct gl_client_array **array; const struct _mesa_prim *prim; GLuint nr_prims; @@ -249,7 +249,7 @@ static void split_prims( struct split_context *split) } -void vbo_split_inplace( GLcontext *ctx, +void vbo_split_inplace( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 14cfa910aa..648bf8787d 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -84,22 +84,22 @@ int main( int argc, char **argv ) printf( "\n" ); - /* GLcontext offsets: + /* struct gl_context offsets: */ - OFFSET_HEADER( "GLcontext" ); + OFFSET_HEADER( "struct gl_context" ); - OFFSET( "CTX_DRIVER_CTX ", GLcontext, DriverCtx ); + OFFSET( "CTX_DRIVER_CTX ", struct gl_context, DriverCtx ); printf( "\n" ); - OFFSET( "CTX_LIGHT_ENABLED ", GLcontext, Light.Enabled ); - OFFSET( "CTX_LIGHT_SHADE_MODEL ", GLcontext, Light.ShadeModel ); - OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", GLcontext, Light.ColorMaterialFace ); - OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", GLcontext, Light.ColorMaterialMode ); - OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", GLcontext, Light.ColorMaterialBitmask ); - OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", GLcontext, Light.ColorMaterialEnabled ); - OFFSET( "CTX_LIGHT_ENABLED_LIST ", GLcontext, Light.EnabledList ); - OFFSET( "CTX_LIGHT_NEED_VERTS ", GLcontext, Light._NeedVertices ); - OFFSET( "CTX_LIGHT_FLAGS ", GLcontext, Light._Flags ); - OFFSET( "CTX_LIGHT_BASE_COLOR ", GLcontext, Light._BaseColor ); + OFFSET( "CTX_LIGHT_ENABLED ", struct gl_context, Light.Enabled ); + OFFSET( "CTX_LIGHT_SHADE_MODEL ", struct gl_context, Light.ShadeModel ); + OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", struct gl_context, Light.ColorMaterialFace ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", struct gl_context, Light.ColorMaterialMode ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", struct gl_context, Light.ColorMaterialBitmask ); + OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", struct gl_context, Light.ColorMaterialEnabled ); + OFFSET( "CTX_LIGHT_ENABLED_LIST ", struct gl_context, Light.EnabledList ); + OFFSET( "CTX_LIGHT_NEED_VERTS ", struct gl_context, Light._NeedVertices ); + OFFSET( "CTX_LIGHT_FLAGS ", struct gl_context, Light._Flags ); + OFFSET( "CTX_LIGHT_BASE_COLOR ", struct gl_context, Light._BaseColor ); /* struct vertex_buffer offsets: diff --git a/src/mesa/x86/mmx.h b/src/mesa/x86/mmx.h index 47a0d4b54d..d4bda07ead 100644 --- a/src/mesa/x86/mmx.h +++ b/src/mesa/x86/mmx.h @@ -30,27 +30,27 @@ #include "main/mtypes.h" extern void _ASMAPI -_mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], +_mesa_mmx_blend_transparency( struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *rgba, const GLvoid *dest, GLenum chanType ); extern void _ASMAPI -_mesa_mmx_blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], +_mesa_mmx_blend_add( struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *rgba, const GLvoid *dest, GLenum chanType ); extern void _ASMAPI -_mesa_mmx_blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[], +_mesa_mmx_blend_min( struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *rgba, const GLvoid *dest, GLenum chanType ); extern void _ASMAPI -_mesa_mmx_blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[], +_mesa_mmx_blend_max( struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *rgba, const GLvoid *dest, GLenum chanType ); extern void _ASMAPI -_mesa_mmx_blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[], +_mesa_mmx_blend_modulate( struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *rgba, const GLvoid *dest, GLenum chanType ); diff --git a/src/mesa/x86/mmx_blendtmp.h b/src/mesa/x86/mmx_blendtmp.h index c2fdeb62b3..8534792e29 100644 --- a/src/mesa/x86/mmx_blendtmp.h +++ b/src/mesa/x86/mmx_blendtmp.h @@ -4,7 +4,7 @@ /* - * void _mesa_mmx_blend( GLcontext *ctx, + * void _mesa_mmx_blend( struct gl_context *ctx, * GLuint n, * const GLubyte mask[], * GLchan rgba[][4], -- cgit v1.2.3 From 95c18abb03b035c6fa029cd0852f07fb39951279 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 13 Oct 2010 14:28:51 +0100 Subject: llvmpipe: Unbreak Z32_FLOAT. Z32_FLOAT uses <4 x float> as intermediate/destination type, instead of <4 x i32>. The necessary bitcasts got removed with commit 5b7eb868fde98388d80601d8dea39e679828f42f Also use depth/stencil type and build contexts consistently, and make the depth pointer argument a ordinary , to catch this sort of issues in the future (and also to pave way for Z16 and Z32_FLOAT_S8_X24 support). --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 130 ++++++++++++++++------------ src/gallium/drivers/llvmpipe/lp_bld_depth.h | 6 ++ src/gallium/drivers/llvmpipe/lp_state_fs.c | 21 +++-- 3 files changed, 93 insertions(+), 64 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 264fce8d6a..3162f3e1c2 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -458,9 +458,9 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef *zs_value, boolean do_branch) { - struct lp_type type; - struct lp_build_context bld; - struct lp_build_context sbld; + struct lp_type z_type; + struct lp_build_context z_bld; + struct lp_build_context s_bld; struct lp_type s_type; LLVMValueRef zs_dst, z_dst = NULL; LLVMValueRef stencil_vals = NULL; @@ -483,28 +483,31 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, /* We know the values in z_dst are all >= 0, so allow * lp_build_compare to use signed compare intrinsics: */ - type.floating = 0; - type.fixed = 0; - type.sign = 1; - type.norm = 1; - type.width = 32; - type.length = z_src_type.length; + z_type.floating = 0; + z_type.fixed = 0; + z_type.sign = 1; + z_type.norm = 1; + z_type.width = 32; + z_type.length = z_src_type.length; int32_vec_type = LLVMVectorType(LLVMInt32Type(), z_src_type.length); - const_8_int = lp_build_const_int_vec(type, 8); + const_8_int = lp_build_const_int_vec(z_type, 8); const_ffffff_float = lp_build_const_vec(z_src_type, (float)0xffffff); zscaled = LLVMBuildFMul(builder, z_src, const_ffffff_float, "zscaled"); z_src = LLVMBuildFPToSI(builder, zscaled, int32_vec_type, "z_src"); /* Load current z/stencil value from z/stencil buffer */ + zs_dst_ptr = LLVMBuildBitCast(builder, + zs_dst_ptr, + LLVMPointerType(int32_vec_type, 0), ""); z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval"); z_dst = LLVMBuildLShr(builder, z_dst, const_8_int, "z_dst"); /* compare src Z to dst Z, returning 'pass' mask */ z_pass = lp_build_compare(builder, - type, + z_type, depth->func, z_src, z_dst); lp_build_mask_update(mask, z_pass); @@ -517,10 +520,10 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, * storage. */ if (depth->writemask) { - type.sign = 1; - lp_build_context_init(&bld, builder, type); + z_type.sign = 1; + lp_build_context_init(&z_bld, builder, z_type); - z_dst = lp_build_select(&bld, lp_build_mask_value(mask), z_src, z_dst); + z_dst = lp_build_select(&z_bld, lp_build_mask_value(mask), z_src, z_dst); z_dst = LLVMBuildShl(builder, z_dst, const_8_int, "z_dst"); *zs_value = z_dst; } @@ -543,19 +546,14 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } /* Pick the depth type. */ - type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length); + z_type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length); /* FIXME: Cope with a depth test type with a different bit width. */ - assert(type.width == z_src_type.width); - assert(type.length == z_src_type.length); + assert(z_type.width == z_src_type.width); + assert(z_type.length == z_src_type.length); /* Convert fragment Z from float to integer */ - lp_build_conv(builder, z_src_type, type, &z_src, 1, &z_src, 1); - - zs_dst_ptr = LLVMBuildBitCast(builder, - zs_dst_ptr, - LLVMPointerType(lp_build_vec_type(type), 0), ""); - + lp_build_conv(builder, z_src_type, z_type, &z_src, 1, &z_src, 1); /* Sanity checking */ @@ -578,8 +576,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } assert(z_swizzle < 4); - assert(format_desc->block.bits == type.width); - if (type.floating) { + assert(format_desc->block.bits == z_type.width); + if (z_type.floating) { assert(z_swizzle == 0); assert(format_desc->channel[z_swizzle].type == UTIL_FORMAT_TYPE_FLOAT); @@ -590,21 +588,24 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, assert(format_desc->channel[z_swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED); assert(format_desc->channel[z_swizzle].normalized); - assert(!type.fixed); - assert(!type.sign); - assert(type.norm); + assert(!z_type.fixed); + assert(!z_type.sign); + assert(z_type.norm); } } /* Setup build context for Z vals */ - lp_build_context_init(&bld, builder, type); + lp_build_context_init(&z_bld, builder, z_type); /* Setup build context for stencil vals */ - s_type = lp_type_int_vec(type.width); - lp_build_context_init(&sbld, builder, s_type); + s_type = lp_type_int_vec(z_type.width); + lp_build_context_init(&s_bld, builder, s_type); /* Load current z/stencil value from z/stencil buffer */ + zs_dst_ptr = LLVMBuildBitCast(builder, + zs_dst_ptr, + LLVMPointerType(z_bld.vec_type, 0), ""); zs_dst = LLVMBuildLoad(builder, zs_dst_ptr, ""); lp_build_name(zs_dst, "zsbufval"); @@ -618,12 +619,12 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, if (get_z_shift_and_mask(format_desc, &z_shift, &z_mask)) { if (z_shift) { - LLVMValueRef shift = lp_build_const_int_vec(type, z_shift); + LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift); z_src = LLVMBuildLShr(builder, z_src, shift, ""); } if (z_mask != 0xffffffff) { - LLVMValueRef mask = lp_build_const_int_vec(type, z_mask); + LLVMValueRef mask = lp_build_const_int_vec(z_type, z_mask); z_src = LLVMBuildAnd(builder, z_src, mask, ""); z_dst = LLVMBuildAnd(builder, zs_dst, mask, ""); z_bitmask = mask; /* used below */ @@ -637,7 +638,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, if (get_s_shift_and_mask(format_desc, &s_shift, &s_mask)) { if (s_shift) { - LLVMValueRef shift = lp_build_const_int_vec(type, s_shift); + LLVMValueRef shift = lp_build_const_int_vec(s_type, s_shift); stencil_vals = LLVMBuildLShr(builder, zs_dst, shift, ""); stencil_shift = shift; /* used below */ } @@ -646,7 +647,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } if (s_mask != 0xffffffff) { - LLVMValueRef mask = lp_build_const_int_vec(type, s_mask); + LLVMValueRef mask = lp_build_const_int_vec(s_type, s_mask); stencil_vals = LLVMBuildAnd(builder, stencil_vals, mask, ""); } @@ -662,24 +663,24 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, /* front_facing = face > 0.0 ? ~0 : 0 */ front_facing = LLVMBuildFCmp(builder, LLVMRealUGT, face, zero, ""); front_facing = LLVMBuildSExt(builder, front_facing, - LLVMIntType(bld.type.length*bld.type.width), + LLVMIntType(s_bld.type.length*s_bld.type.width), ""); front_facing = LLVMBuildBitCast(builder, front_facing, - bld.int_vec_type, ""); + s_bld.int_vec_type, ""); } /* convert scalar stencil refs into vectors */ - stencil_refs[0] = lp_build_broadcast_scalar(&bld, stencil_refs[0]); - stencil_refs[1] = lp_build_broadcast_scalar(&bld, stencil_refs[1]); + stencil_refs[0] = lp_build_broadcast_scalar(&s_bld, stencil_refs[0]); + stencil_refs[1] = lp_build_broadcast_scalar(&s_bld, stencil_refs[1]); - s_pass_mask = lp_build_stencil_test(&sbld, stencil, + s_pass_mask = lp_build_stencil_test(&s_bld, stencil, stencil_refs, stencil_vals, front_facing); /* apply stencil-fail operator */ { - LLVMValueRef s_fail_mask = lp_build_andnot(&bld, orig_mask, s_pass_mask); - stencil_vals = lp_build_stencil_op(&sbld, stencil, S_FAIL_OP, + LLVMValueRef s_fail_mask = lp_build_andnot(&s_bld, orig_mask, s_pass_mask); + stencil_vals = lp_build_stencil_op(&s_bld, stencil, S_FAIL_OP, stencil_refs, stencil_vals, s_fail_mask, front_facing); } @@ -687,7 +688,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, if (depth->enabled) { /* compare src Z to dst Z, returning 'pass' mask */ - z_pass = lp_build_cmp(&bld, depth->func, z_src, z_dst); + z_pass = lp_build_cmp(&z_bld, depth->func, z_src, z_dst); if (!stencil[0].enabled) { /* We can potentially skip all remaining operations here, but only @@ -721,7 +722,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, /* Mix the old and new Z buffer values. * z_dst[i] = (zselectmask[i] & z_src[i]) | (~zselectmask[i] & z_dst[i]) */ - z_dst = lp_build_select_bitwise(&bld, zselectmask, z_src, z_dst); + z_dst = lp_build_select_bitwise(&z_bld, zselectmask, z_src, z_dst); } if (stencil[0].enabled) { @@ -729,14 +730,14 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef z_fail_mask, z_pass_mask; /* apply Z-fail operator */ - z_fail_mask = lp_build_andnot(&bld, orig_mask, z_pass); - stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_FAIL_OP, + z_fail_mask = lp_build_andnot(&z_bld, orig_mask, z_pass); + stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_FAIL_OP, stencil_refs, stencil_vals, z_fail_mask, front_facing); /* apply Z-pass operator */ - z_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, z_pass, ""); - stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP, + z_pass_mask = LLVMBuildAnd(z_bld.builder, orig_mask, z_pass, ""); + stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP, stencil_refs, stencil_vals, z_pass_mask, front_facing); } @@ -745,8 +746,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, /* No depth test: apply Z-pass operator to stencil buffer values which * passed the stencil test. */ - s_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, s_pass_mask, ""); - stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP, + s_pass_mask = LLVMBuildAnd(s_bld.builder, orig_mask, s_pass_mask, ""); + stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP, stencil_refs, stencil_vals, s_pass_mask, front_facing); } @@ -755,7 +756,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, * stencil bits before ORing Z with Stencil to make the final pixel value. */ if (stencil_vals && stencil_shift) - stencil_vals = LLVMBuildShl(bld.builder, stencil_vals, + stencil_vals = LLVMBuildShl(s_bld.builder, stencil_vals, stencil_shift, ""); /* Finally, merge/store the z/stencil values */ @@ -763,7 +764,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, (stencil[0].enabled && stencil[0].writemask)) { if (z_dst && stencil_vals) - zs_dst = LLVMBuildOr(bld.builder, z_dst, stencil_vals, ""); + zs_dst = LLVMBuildOr(z_bld.builder, z_dst, stencil_vals, ""); else if (z_dst) zs_dst = z_dst; else @@ -784,6 +785,18 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } +void +lp_build_depth_write(LLVMBuilderRef builder, + const struct util_format_description *format_desc, + LLVMValueRef zs_dst_ptr, + LLVMValueRef zs_value) +{ + zs_dst_ptr = LLVMBuildBitCast(builder, zs_dst_ptr, + LLVMPointerType(LLVMTypeOf(zs_value), 0), ""); + + LLVMBuildStore(builder, zs_value, zs_dst_ptr); +} + void lp_build_deferred_depth_write(LLVMBuilderRef builder, @@ -793,17 +806,20 @@ lp_build_deferred_depth_write(LLVMBuilderRef builder, LLVMValueRef zs_dst_ptr, LLVMValueRef zs_value) { - struct lp_type type; - struct lp_build_context bld; + struct lp_type z_type; + struct lp_build_context z_bld; LLVMValueRef z_dst; /* XXX: pointlessly redo type logic: */ - type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length); - lp_build_context_init(&bld, builder, type); + z_type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length); + lp_build_context_init(&z_bld, builder, z_type); + + zs_dst_ptr = LLVMBuildBitCast(builder, zs_dst_ptr, + LLVMPointerType(z_bld.vec_type, 0), ""); z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval"); - z_dst = lp_build_select(&bld, lp_build_mask_value(mask), zs_value, z_dst); + z_dst = lp_build_select(&z_bld, lp_build_mask_value(mask), zs_value, z_dst); LLVMBuildStore(builder, z_dst, zs_dst_ptr); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.h b/src/gallium/drivers/llvmpipe/lp_bld_depth.h index 0f89668123..a54ef3a711 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.h @@ -64,6 +64,12 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef *zs_value, boolean do_branch); +void +lp_build_depth_write(LLVMBuilderRef builder, + const struct util_format_description *format_desc, + LLVMValueRef zs_dst_ptr, + LLVMValueRef zs_value); + void lp_build_deferred_depth_write(LLVMBuilderRef builder, struct lp_type z_src_type, diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 6872f2d3c6..c09835635d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -325,8 +325,9 @@ generate_fs(struct llvmpipe_context *lp, &zs_value, !simple_shader); - if (depth_mode & EARLY_DEPTH_WRITE) - LLVMBuildStore(builder, zs_value, depth_ptr); + if (depth_mode & EARLY_DEPTH_WRITE) { + lp_build_depth_write(builder, zs_format_desc, depth_ptr, zs_value); + } } lp_build_interp_soa_update_inputs(interp, i); @@ -379,8 +380,9 @@ generate_fs(struct llvmpipe_context *lp, &zs_value, !simple_shader); /* Late Z write */ - if (depth_mode & LATE_DEPTH_WRITE) - LLVMBuildStore(builder, zs_value, depth_ptr); + if (depth_mode & LATE_DEPTH_WRITE) { + lp_build_depth_write(builder, zs_format_desc, depth_ptr, zs_value); + } } else if ((depth_mode & EARLY_DEPTH_TEST) && (depth_mode & LATE_DEPTH_WRITE)) @@ -534,6 +536,7 @@ generate_fragment(struct llvmpipe_context *lp, LLVMValueRef blend_mask; LLVMValueRef function; LLVMValueRef facing; + const struct util_format_description *zs_format_desc; unsigned num_fs; unsigned i; unsigned chan; @@ -579,7 +582,7 @@ generate_fragment(struct llvmpipe_context *lp, arg_types[5] = LLVMPointerType(fs_elem_type, 0); /* dadx */ arg_types[6] = LLVMPointerType(fs_elem_type, 0); /* dady */ arg_types[7] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0); /* color */ - arg_types[8] = LLVMPointerType(fs_int_vec_type, 0); /* depth */ + arg_types[8] = LLVMPointerType(LLVMInt8Type(), 0); /* depth */ arg_types[9] = LLVMInt32Type(); /* mask_input */ arg_types[10] = LLVMPointerType(LLVMInt32Type(), 0);/* counter */ @@ -648,12 +651,16 @@ generate_fragment(struct llvmpipe_context *lp, sampler = lp_llvm_sampler_soa_create(key->sampler, context_ptr); /* loop over quads in the block */ + zs_format_desc = util_format_description(key->zsbuf_format); + for(i = 0; i < num_fs; ++i) { - LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0); + LLVMValueRef depth_offset = LLVMConstInt(LLVMInt32Type(), + i*fs_type.length*zs_format_desc->block.bits/8, + 0); LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS]; LLVMValueRef depth_ptr_i; - depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &index, 1, ""); + depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &depth_offset, 1, ""); generate_fs(lp, shader, key, builder, -- cgit v1.2.3 From bee22ed6b9425fa4681211e84d0a61467975195f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 13 Oct 2010 11:18:40 -0700 Subject: gallivm: Remove unnecessary header. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c index d1f8261002..ad514463de 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c @@ -29,7 +29,6 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "tgsi/tgsi_parse.h" -#include "tgsi/tgsi_text.h" #include "tgsi/tgsi_util.h" #include "tgsi/tgsi_dump.h" #include "lp_bld_debug.h" -- cgit v1.2.3 From e487b665aa6f3d6f290916d1205107dd2dea971d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 Oct 2010 12:35:38 -0600 Subject: gallivm: work-around trilinear mipmap filtering regression with LLVM 2.8 The bug only happens on the AOS / fixed-pt path. --- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 641d24b5b6..d3e3b242af 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -873,6 +873,26 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld, lod_fpart = LLVMBuildTrunc(builder, lod_fpart, h16_bld.elem_type, ""); lod_fpart = lp_build_broadcast_scalar(&h16_bld, lod_fpart); +#if HAVE_LLVM == 0x208 + /* This is a work-around for a bug in LLVM 2.8. + * Evidently, something goes wrong in the construction of the + * lod_fpart short[8] vector. Adding this no-effect shuffle seems + * to force the vector to be properly constructed. + * Tested with mesa-demos/src/tests/mipmap_limits.c (press t, f). + */ + { + LLVMValueRef shuffles[8], shuffle; + int i; + assert(h16_bld.type.length <= Elements(shuffles)); + for (i = 0; i < h16_bld.type.length; i++) + shuffles[i] = lp_build_const_int32(2 * (i & 1)); + shuffle = LLVMConstVector(shuffles, h16_bld.type.length); + lod_fpart = LLVMBuildShuffleVector(builder, + lod_fpart, lod_fpart, + shuffle, ""); + } +#endif + colors0_lo = lp_build_lerp(&h16_bld, lod_fpart, colors0_lo, colors1_lo); colors0_hi = lp_build_lerp(&h16_bld, lod_fpart, -- cgit v1.2.3 From 60c5d4735d5fa5642c84f6d7c3847ac213efcb53 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 13 Oct 2010 15:45:24 +0100 Subject: gallivm: More accurate float -> 24bit & 32bit unorm conversion. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 126 +++++++++++++++++++--------- 1 file changed, 86 insertions(+), 40 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 20aa93e778..6967dd2622 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -97,58 +97,104 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder, LLVMTypeRef int_vec_type = lp_build_int_vec_type(src_type); LLVMValueRef res; unsigned mantissa; - unsigned n; - unsigned long long ubound; - unsigned long long mask; - double scale; - double bias; assert(src_type.floating); + assert(dst_width <= src_type.width); + src_type.sign = FALSE; mantissa = lp_mantissa(src_type); - /* We cannot carry more bits than the mantissa */ - n = MIN2(mantissa, dst_width); + if (dst_width <= mantissa) { + /* + * Apply magic coefficients that will make the desired result to appear + * in the lowest significant bits of the mantissa, with correct rounding. + * + * This only works if the destination width fits in the mantissa. + */ - /* This magic coefficients will make the desired result to appear in the - * lowest significant bits of the mantissa. - */ - ubound = ((unsigned long long)1 << n); - mask = ubound - 1; - scale = (double)mask/ubound; - bias = (double)((unsigned long long)1 << (mantissa - n)); + unsigned long long ubound; + unsigned long long mask; + double scale; + double bias; + + ubound = (1ULL << dst_width); + mask = ubound - 1; + scale = (double)mask/ubound; + bias = (double)(1ULL << (mantissa - dst_width)); + + res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), ""); + res = LLVMBuildFAdd(builder, res, lp_build_const_vec(src_type, bias), ""); + res = LLVMBuildBitCast(builder, res, int_vec_type, ""); + res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), ""); + } + else if (dst_width == (mantissa + 1)) { + /* + * The destination width matches exactly what can be represented in + * floating point (i.e., mantissa + 1 bits). So do a straight + * multiplication followed by casting. No further rounding is necessary. + */ - res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), ""); - res = LLVMBuildFAdd(builder, res, lp_build_const_vec(src_type, bias), ""); - res = LLVMBuildBitCast(builder, res, int_vec_type, ""); + double scale; - if(dst_width > n) { - int shift = dst_width - n; - res = LLVMBuildShl(builder, res, lp_build_const_int_vec(src_type, shift), ""); + scale = (double)((1ULL << dst_width) - 1); - /* TODO: Fill in the empty lower bits for additional precision? */ - /* YES: this fixes progs/trivial/tri-z-eq.c. - * Otherwise vertex Z=1.0 values get converted to something like - * 0xfffffb00 and the test for equality with 0xffffffff fails. + res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), ""); + res = LLVMBuildFPToSI(builder, res, int_vec_type, ""); + } + else { + /* + * The destination exceeds what can be represented in the floating point. + * So multiply by the largest power two we get away with, and when + * subtract the most significant bit to rescale to normalized values. + * + * The largest power of two factor we can get away is + * (1 << (src_type.width - 1)), because we need to use signed . In theory it + * should be (1 << (src_type.width - 2)), but IEEE 754 rules states + * INT_MIN should be returned in FPToSI, which is the correct result for + * values near 1.0! + * + * This means we get (src_type.width - 1) correct bits for values near 0.0, + * and (mantissa + 1) correct bits for values near 1.0. Equally or more + * important, we also get exact results for 0.0 and 1.0. */ -#if 0 - { - LLVMValueRef msb; - msb = LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, dst_width - 1), ""); - msb = LLVMBuildShl(builder, msb, lp_build_const_int_vec(src_type, shift), ""); - msb = LLVMBuildSub(builder, msb, lp_build_const_int_vec(src_type, 1), ""); - res = LLVMBuildOr(builder, res, msb, ""); - } -#elif 0 - while(shift > 0) { - res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, n), ""), ""); - shift -= n; - n *= 2; + + unsigned n = MIN2(src_type.width - 1, dst_width); + + double scale = (double)(1ULL << n); + unsigned lshift = dst_width - n; + unsigned rshift = n; + LLVMValueRef lshifted; + LLVMValueRef rshifted; + + res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), ""); + res = LLVMBuildFPToSI(builder, res, int_vec_type, ""); + + /* + * Align the most significant bit to its final place. + * + * This will cause 1.0 to overflow to 0, but the later adjustment will + * get it right. + */ + if (lshift) { + lshifted = LLVMBuildShl(builder, res, + lp_build_const_int_vec(src_type, lshift), ""); + } else { + lshifted = res; } -#endif + + /* + * Align the most significant bit to the right. + */ + rshifted = LLVMBuildAShr(builder, res, + lp_build_const_int_vec(src_type, rshift), ""); + + /* + * Subtract the MSB to the LSB, therefore re-scaling from + * (1 << dst_width) to ((1 << dst_width) - 1). + */ + + res = LLVMBuildSub(builder, lshifted, rshifted, ""); } - else - res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), ""); return res; } -- cgit v1.2.3 From ae00e34e4b0d3be247b0538b60810176397c7915 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 13 Oct 2010 20:25:17 +0100 Subject: llvmpipe: Generalize the x8z24 fast path to all depth formats. Together with the previous commit, this generalize the benefits of d2cf757f44f4ee5554243f3279483a25886d9927 to all depth formats, in particular: - simpler float -> 24unorm conversion - avoid unsigned comparisons (not directly supported on SSE) by aligning to the least significant bit - avoid unecessary/repeated mask ANDing Verified with trivial/tri-z that the exact same assembly is produced for X8Z24. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 193 ++++++++++++---------------- 1 file changed, 82 insertions(+), 111 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 3162f3e1c2..e4cfa97aa3 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -304,8 +304,13 @@ lp_depth_type(const struct util_format_description *format_desc, } else if(format_desc->channel[swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED) { assert(format_desc->block.bits <= 32); - if(format_desc->channel[swizzle].normalized) - type.norm = TRUE; + assert(format_desc->channel[swizzle].normalized); + if (format_desc->channel[swizzle].size < format_desc->block.bits) { + /* Prefer signed integers when possible, as SSE has less support + * for unsigned comparison; + */ + type.sign = TRUE; + } } else assert(0); @@ -325,9 +330,9 @@ lp_depth_type(const struct util_format_description *format_desc, * in the Z buffer (typically 0xffffff00 or 0x00ffffff). That lets us * get by with fewer bit twiddling steps. */ -static boolean +static void get_z_shift_and_mask(const struct util_format_description *format_desc, - unsigned *shift, unsigned *mask) + unsigned *shift, unsigned *width, unsigned *mask) { const unsigned total_bits = format_desc->block.bits; unsigned z_swizzle; @@ -340,15 +345,16 @@ get_z_shift_and_mask(const struct util_format_description *format_desc, z_swizzle = format_desc->swizzle[0]; - if (z_swizzle == UTIL_FORMAT_SWIZZLE_NONE) - return FALSE; + assert(z_swizzle != UTIL_FORMAT_SWIZZLE_NONE); + + *width = format_desc->channel[z_swizzle].size; padding_right = 0; for (chan = 0; chan < z_swizzle; ++chan) padding_right += format_desc->channel[chan].size; padding_left = - total_bits - (padding_right + format_desc->channel[z_swizzle].size); + total_bits - (padding_right + *width); if (padding_left || padding_right) { unsigned long long mask_left = (1ULL << (total_bits - padding_left)) - 1; @@ -359,9 +365,7 @@ get_z_shift_and_mask(const struct util_format_description *format_desc, *mask = 0xffffffff; } - *shift = padding_left; - - return TRUE; + *shift = padding_right; } @@ -462,6 +466,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, struct lp_build_context z_bld; struct lp_build_context s_bld; struct lp_type s_type; + unsigned z_shift, z_width, z_mask; LLVMValueRef zs_dst, z_dst = NULL; LLVMValueRef stencil_vals = NULL; LLVMValueRef z_bitmask = NULL, stencil_shift = NULL; @@ -469,67 +474,6 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMValueRef orig_mask = lp_build_mask_value(mask); LLVMValueRef front_facing = NULL; - /* Prototype a simpler path: - */ - if (z_src_type.floating && - format_desc->format == PIPE_FORMAT_X8Z24_UNORM && - depth->enabled) - { - LLVMValueRef zscaled; - LLVMValueRef const_ffffff_float; - LLVMValueRef const_8_int; - LLVMTypeRef int32_vec_type; - - /* We know the values in z_dst are all >= 0, so allow - * lp_build_compare to use signed compare intrinsics: - */ - z_type.floating = 0; - z_type.fixed = 0; - z_type.sign = 1; - z_type.norm = 1; - z_type.width = 32; - z_type.length = z_src_type.length; - - int32_vec_type = LLVMVectorType(LLVMInt32Type(), z_src_type.length); - - const_8_int = lp_build_const_int_vec(z_type, 8); - const_ffffff_float = lp_build_const_vec(z_src_type, (float)0xffffff); - - zscaled = LLVMBuildFMul(builder, z_src, const_ffffff_float, "zscaled"); - z_src = LLVMBuildFPToSI(builder, zscaled, int32_vec_type, "z_src"); - - /* Load current z/stencil value from z/stencil buffer */ - zs_dst_ptr = LLVMBuildBitCast(builder, - zs_dst_ptr, - LLVMPointerType(int32_vec_type, 0), ""); - z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval"); - z_dst = LLVMBuildLShr(builder, z_dst, const_8_int, "z_dst"); - - /* compare src Z to dst Z, returning 'pass' mask */ - z_pass = lp_build_compare(builder, - z_type, - depth->func, z_src, z_dst); - - lp_build_mask_update(mask, z_pass); - - if (do_branch) - lp_build_mask_check(mask); - - /* No need to worry about old stencil contents, just blend the - * old and new values and shift into the correct position for - * storage. - */ - if (depth->writemask) { - z_type.sign = 1; - lp_build_context_init(&z_bld, builder, z_type); - - z_dst = lp_build_select(&z_bld, lp_build_mask_value(mask), z_src, z_dst); - z_dst = LLVMBuildShl(builder, z_dst, const_8_int, "z_dst"); - *zs_value = z_dst; - } - - return; - } /* * Depths are expected to be between 0 and 1, even if they are stored in @@ -552,10 +496,6 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, assert(z_type.width == z_src_type.width); assert(z_type.length == z_src_type.length); - /* Convert fragment Z from float to integer */ - lp_build_conv(builder, z_src_type, z_type, &z_src, 1, &z_src, 1); - - /* Sanity checking */ { const unsigned z_swizzle = format_desc->swizzle[0]; @@ -589,8 +529,6 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, UTIL_FORMAT_TYPE_UNSIGNED); assert(format_desc->channel[z_swizzle].normalized); assert(!z_type.fixed); - assert(!z_type.sign); - assert(z_type.norm); } } @@ -608,34 +546,14 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, LLVMPointerType(z_bld.vec_type, 0), ""); zs_dst = LLVMBuildLoad(builder, zs_dst_ptr, ""); - lp_build_name(zs_dst, "zsbufval"); + lp_build_name(zs_dst, "zs_dst"); /* Compute and apply the Z/stencil bitmasks and shifts. */ { - unsigned z_shift, z_mask; unsigned s_shift, s_mask; - if (get_z_shift_and_mask(format_desc, &z_shift, &z_mask)) { - if (z_shift) { - LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift); - z_src = LLVMBuildLShr(builder, z_src, shift, ""); - } - - if (z_mask != 0xffffffff) { - LLVMValueRef mask = lp_build_const_int_vec(z_type, z_mask); - z_src = LLVMBuildAnd(builder, z_src, mask, ""); - z_dst = LLVMBuildAnd(builder, zs_dst, mask, ""); - z_bitmask = mask; /* used below */ - } - else { - z_dst = zs_dst; - } - - lp_build_name(z_dst, "zsbuf.z"); - } - if (get_s_shift_and_mask(format_desc, &s_shift, &s_mask)) { if (s_shift) { LLVMValueRef shift = lp_build_const_int_vec(s_type, s_shift); @@ -651,7 +569,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, stencil_vals = LLVMBuildAnd(builder, stencil_vals, mask, ""); } - lp_build_name(stencil_vals, "stencil"); + lp_build_name(stencil_vals, "s_dst"); } } @@ -687,6 +605,62 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } if (depth->enabled) { + get_z_shift_and_mask(format_desc, &z_shift, &z_width, &z_mask); + + /* + * Convert fragment Z to the desired type, aligning the LSB to the right. + */ + + assert(z_type.width == z_src_type.width); + assert(z_type.length == z_src_type.length); + assert(lp_check_value(z_src_type, z_src)); + if (z_src_type.floating) { + /* + * Convert from floating point values + */ + + if (!z_type.floating) { + z_src = lp_build_clamped_float_to_unsigned_norm(builder, + z_src_type, + z_width, + z_src); + } + } else { + /* + * Convert from unsigned normalized values. + */ + + assert(!z_src_type.sign); + assert(!z_src_type.fixed); + assert(z_src_type.norm); + assert(!z_type.floating); + if (z_src_type.width > z_width) { + LLVMValueRef shift = lp_build_const_int_vec(z_src_type, + z_src_type.width - z_width); + z_src = LLVMBuildLShr(builder, z_src, shift, ""); + } + } + assert(lp_check_value(z_type, z_src)); + + lp_build_name(z_src, "z_src"); + + if (z_mask != 0xffffffff) { + z_bitmask = lp_build_const_int_vec(z_type, z_mask); + } + + /* + * Align the framebuffer Z 's LSB to the right. + */ + if (z_shift) { + LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift); + z_dst = LLVMBuildLShr(builder, zs_dst, shift, "z_dst"); + } else if (z_bitmask) { + z_dst = LLVMBuildAnd(builder, zs_dst, z_bitmask, "z_dst"); + } else { + z_dst = zs_dst; + lp_build_name(z_dst, "z_dst"); + } + /* compare src Z to dst Z, returning 'pass' mask */ z_pass = lp_build_cmp(&z_bld, depth->func, z_src, z_dst); @@ -704,25 +678,20 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } if (depth->writemask) { - LLVMValueRef zselectmask = lp_build_mask_value(mask); + LLVMValueRef zselectmask; /* mask off bits that failed Z test */ - zselectmask = LLVMBuildAnd(builder, zselectmask, z_pass, ""); + zselectmask = LLVMBuildAnd(builder, orig_mask, z_pass, ""); /* mask off bits that failed stencil test */ if (s_pass_mask) { zselectmask = LLVMBuildAnd(builder, zselectmask, s_pass_mask, ""); } - /* if combined Z/stencil format, mask off the stencil bits */ - if (z_bitmask) { - zselectmask = LLVMBuildAnd(builder, zselectmask, z_bitmask, ""); - } - /* Mix the old and new Z buffer values. - * z_dst[i] = (zselectmask[i] & z_src[i]) | (~zselectmask[i] & z_dst[i]) + * z_dst[i] = zselectmask[i] ? z_src[i] : z_dst[i] */ - z_dst = lp_build_select_bitwise(&z_bld, zselectmask, z_src, z_dst); + z_dst = lp_build_select(&z_bld, zselectmask, z_src, z_dst); } if (stencil[0].enabled) { @@ -752,9 +721,11 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, s_pass_mask, front_facing); } - /* The Z bits are already in the right place but we may need to shift the - * stencil bits before ORing Z with Stencil to make the final pixel value. - */ + /* Put Z and ztencil bits in the right place */ + if (z_dst && z_shift) { + LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift); + z_dst = LLVMBuildShl(builder, z_dst, shift, ""); + } if (stencil_vals && stencil_shift) stencil_vals = LLVMBuildShl(s_bld.builder, stencil_vals, stencil_shift, ""); -- cgit v1.2.3 From 26dacce2c0b33a2a6aff77e6094c06e385e1a541 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 09:10:16 +1000 Subject: r600g: drop unused context members --- src/gallium/drivers/r600/r600_pipe.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 8731786769..47a1b3070e 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -123,8 +123,6 @@ struct r600_pipe_context { 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_resource; struct r600_pipe_state *ps_resource; struct r600_pipe_state config; -- cgit v1.2.3 From a21a2748beb1f42d21e14858eee9a1323d85a00f Mon Sep 17 00:00:00 2001 From: Fredrik Höglund Date: Wed, 13 Oct 2010 17:49:15 +0200 Subject: r600g: Fix texture sampling with swizzled coords Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 470f355cde..4a9d9beaba 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1860,7 +1860,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) 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 = src_gpr; - alu.src[0].chan = i; + alu.src[0].chan = tgsi_chan(&inst->Src[0], i); alu.dst.sel = ctx->temp_reg; alu.dst.chan = i; if (i == 3) -- cgit v1.2.3 From 8a9f02c5d503089bdcc90ff934f6269e59356d52 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 13:29:11 +1000 Subject: r600g: only pick centroid coordinate when asked. TGSI tells us when to use this, its not hooked up from GLSL to MESA to TGSI yet though. --- src/gallium/drivers/r600/r600_shader.c | 4 +++- src/gallium/drivers/r600/r600_shader.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 4a9d9beaba..512cc4a32f 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -115,7 +115,8 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade for (i = 0; i < rshader->ninput; 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].centroid) + 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 || @@ -439,6 +440,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) ctx->shader->input[i].name = d->Semantic.Name; ctx->shader->input[i].sid = d->Semantic.Index; ctx->shader->input[i].interpolate = d->Declaration.Interpolate; + ctx->shader->input[i].centroid = d->Declaration.Centroid; ctx->shader->input[i].gpr = ctx->file_offset[TGSI_FILE_INPUT] + i; if (ctx->type == TGSI_PROCESSOR_VERTEX) { /* turn input into fetch */ diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index 6e2620f201..a341cca083 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -31,6 +31,7 @@ struct r600_shader_io { unsigned done; int sid; unsigned interpolate; + boolean centroid; }; struct r600_shader { -- cgit v1.2.3 From 1e82c28fcf76bf79ceb5a1eaf29b3d6d25909ddd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 14:14:22 +1000 Subject: r600g: fixup pos/face ena/address properly --- src/gallium/drivers/r600/r600_shader.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 512cc4a32f..42878a43f3 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -107,8 +107,8 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade 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; + unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1; + int pos_index = -1, face_index = -1; /* clear previous register */ rstate->nregs = 0; @@ -118,14 +118,14 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade if (rshader->input[i].centroid) tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) - have_pos = TRUE; + pos_index = i; 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; + face_index = 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); @@ -163,13 +163,22 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade 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); + if (pos_index != -1) { + spi_ps_in_control_0 |= (S_0286CC_POSITION_ENA(1) | + S_0286CC_POSITION_CENTROID(rshader->input[pos_index].centroid) | + S_0286CC_POSITION_ADDR(rshader->input[pos_index].gpr) | + S_0286CC_BARYC_SAMPLE_CNTL(1)); spi_input_z |= 1; } + + spi_ps_in_control_1 = 0; + if (face_index != -1) { + spi_ps_in_control_1 |= S_0286D0_FRONT_FACE_ENA(1) | + S_286D0_FRONT_FACE_ADDR(rshader->input[face_index].gpr); + } + 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_0286D0_SPI_PS_IN_CONTROL_1, spi_ps_in_control_1, 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, -- cgit v1.2.3 From 0637044add50b3a4aee8e915b84c18813c9130f3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 14:19:37 +1000 Subject: r600g: fixup typo in macro name --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 42878a43f3..d6f73cb743 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -174,7 +174,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade spi_ps_in_control_1 = 0; if (face_index != -1) { spi_ps_in_control_1 |= S_0286D0_FRONT_FACE_ENA(1) | - S_286D0_FRONT_FACE_ADDR(rshader->input[face_index].gpr); + S_0286D0_FRONT_FACE_ADDR(rshader->input[face_index].gpr); } r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL); -- cgit v1.2.3 From 68014c8d19559576d368e158932278df05fe659b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 14:27:34 +1000 Subject: r600g: select linear interpolate if tgsi input requests it --- src/gallium/drivers/r600/r600_shader.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d6f73cb743..141adcc54b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -117,6 +117,9 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i)); if (rshader->input[i].centroid) tmp |= S_028644_SEL_CENTROID(1); + if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR) + tmp |= S_028644_SEL_LINEAR(1); + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) pos_index = i; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || -- cgit v1.2.3 From c97c77d8698ddab1c8a2900fe7c82e1d111ccb8a Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 14 Oct 2010 17:06:21 +0800 Subject: st/egl: Access _EGLConfig directly. Drop the use of SET_CONFIG_ATTRIB. Fix the value of EGL_SAMPLE_BUFFERS along the way. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 57 +++++++++++-------------- 1 file changed, 26 insertions(+), 31 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index bfbb431058..aaa2ff6bb2 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -194,53 +194,48 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf, if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) surface_type |= EGL_PBUFFER_BIT; - SET_CONFIG_ATTRIB(conf, EGL_CONFORMANT, api_mask); - SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, api_mask); + conf->Conformant = api_mask; + conf->RenderableType = api_mask; - SET_CONFIG_ATTRIB(conf, EGL_RED_SIZE, rgba[0]); - SET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE, rgba[1]); - SET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE, rgba[2]); - SET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE, rgba[3]); - SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, buffer_size); + conf->RedSize = rgba[0]; + conf->GreenSize = rgba[1]; + conf->BlueSize = rgba[2]; + conf->AlphaSize = rgba[3]; + conf->BufferSize = buffer_size; - SET_CONFIG_ATTRIB(conf, EGL_DEPTH_SIZE, depth_stencil[0]); - SET_CONFIG_ATTRIB(conf, EGL_STENCIL_SIZE, depth_stencil[1]); + conf->DepthSize = depth_stencil[0]; + conf->StencilSize = depth_stencil[1]; - SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type); + conf->SurfaceType = surface_type; - SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, EGL_TRUE); + conf->NativeRenderable = EGL_TRUE; if (surface_type & EGL_WINDOW_BIT) { - SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, nconf->native_visual_id); - SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, - nconf->native_visual_type); + conf->NativeVisualID = nconf->native_visual_id; + conf->NativeVisualType = nconf->native_visual_type; } if (surface_type & EGL_PBUFFER_BIT) { - SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE); + conf->BindToTextureRGB = EGL_TRUE; if (rgba[3]) - SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE); + conf->BindToTextureRGBA = EGL_TRUE; - SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_WIDTH, 4096); - SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_HEIGHT, 4096); - SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_PIXELS, 4096 * 4096); + conf->MaxPbufferWidth = 4096; + conf->MaxPbufferHeight = 4096; + conf->MaxPbufferPixels = 4096 * 4096; } - SET_CONFIG_ATTRIB(conf, EGL_LEVEL, nconf->level); - SET_CONFIG_ATTRIB(conf, EGL_SAMPLES, nconf->samples); - SET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS, 1); + conf->Level = nconf->level; + conf->Samples = nconf->samples; + conf->SampleBuffers = 0; if (nconf->slow_config) - SET_CONFIG_ATTRIB(conf, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG); + conf->ConfigCaveat = EGL_SLOW_CONFIG; if (nconf->transparent_rgb) { - rgba[0] = nconf->transparent_rgb_values[0]; - rgba[1] = nconf->transparent_rgb_values[1]; - rgba[2] = nconf->transparent_rgb_values[2]; - - SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RGB); - SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE, rgba[0]); - SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE, rgba[1]); - SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE, rgba[2]); + conf->TransparentType = EGL_TRANSPARENT_RGB; + conf->TransparentRedValue = nconf->transparent_rgb_values[0]; + conf->TransparentGreenValue = nconf->transparent_rgb_values[1]; + conf->TransparentBlueValue = nconf->transparent_rgb_values[2]; } return _eglValidateConfig(conf, EGL_FALSE); -- cgit v1.2.3 From d6de1f44a0cdcc739d3b319b5f102e1733e5b4e3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 14 Oct 2010 17:13:36 +0800 Subject: st/egl: Do not finish a fence that is NULL. i915g would dereference the NULL pointer. --- src/gallium/state_trackers/egl/common/egl_g3d_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index c0164daf9c..3bde39737b 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -609,8 +609,10 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) gctx->stctxi->flush(gctx->stctxi, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); - screen->fence_finish(screen, fence, 0); - screen->fence_reference(screen, &fence, NULL); + if (fence) { + screen->fence_finish(screen, fence, 0); + screen->fence_reference(screen, &fence, NULL); + } return EGL_TRUE; } -- cgit v1.2.3 From f0bd76f28d17da6eabf977a7e619e4ff943a70c7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Oct 2010 13:15:28 +0100 Subject: llvmpipe: don't try to emit non-existent color outputs --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index c09835635d..6e3c27e78e 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -406,14 +406,15 @@ generate_fs(struct llvmpipe_context *lp, if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) { unsigned cbuf = shader->info.base.output_semantic_index[attrib]; - for(chan = 0; chan < NUM_CHANNELS; ++chan) - { - /* XXX: just initialize outputs to point at colors[] and - * skip this. - */ - LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], ""); - lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]); - LLVMBuildStore(builder, out, color[cbuf][chan]); + for(chan = 0; chan < NUM_CHANNELS; ++chan) { + if(outputs[attrib][chan]) { + /* XXX: just initialize outputs to point at colors[] and + * skip this. + */ + LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], ""); + lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]); + LLVMBuildStore(builder, out, color[cbuf][chan]); + } } } } -- cgit v1.2.3 From cbf2fb55432b8239ea9792338ee1d2fea89648ea Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Oct 2010 16:42:38 +0100 Subject: r600/drm: fix segfaults in winsys create failure path Would try to destroy radeon->cman, radeon->kman both which were still NULL. Signed-off-by: Dave Airlie --- src/gallium/winsys/r600/drm/r600_drm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 5f175a4df9..4916843fd6 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -179,9 +179,15 @@ struct radeon *radeon_decref(struct radeon *radeon) return NULL; } - radeon->cman->destroy(radeon->cman); - radeon->kman->destroy(radeon->kman); - drmClose(radeon->fd); + if (radeon->cman) + radeon->cman->destroy(radeon->cman); + + if (radeon->kman) + radeon->kman->destroy(radeon->kman); + + if (radeon->fd >= 0) + drmClose(radeon->fd); + free(radeon); return NULL; } -- cgit v1.2.3 From c28f7645722ed3da1a04d3187f9cfa5d8e5e489d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Oct 2010 16:42:39 +0100 Subject: r600g: emit hardware linewidth Tested with demos/pixeltest - line rasterization doesn't seem to be set up for GL conventions yet, but at least width is respected now. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 7b0aaef770..2c0a2005cf 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -499,7 +499,10 @@ static void *r600_create_rs_state(struct pipe_context *ctx, 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); + + tmp = (unsigned)(state->line_width * 8.0); + r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, S_028A08_WIDTH(tmp), 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); -- cgit v1.2.3 From 8260ab93461eca3e18f9c17a9ca1961a11372071 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Oct 2010 17:19:00 +0100 Subject: r600g: handle absolute modifier in shader translator This was being classed as unsupported in one place but used in others. Enabling it seems to work fine. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 141adcc54b..b53d478071 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -389,11 +389,9 @@ static int tgsi_is_supported(struct r600_shader_ctx *ctx) } #endif for (j = 0; j < i->Instruction.NumSrcRegs; j++) { - if (i->Src[j].Register.Dimension || - i->Src[j].Register.Absolute) { - R600_ERR("unsupported src %d (dimension %d|absolute %d)\n", j, - i->Src[j].Register.Dimension, - i->Src[j].Register.Absolute); + if (i->Src[j].Register.Dimension) { + R600_ERR("unsupported src %d (dimension %d)\n", j, + i->Src[j].Register.Dimension); return -EINVAL; } } @@ -760,6 +758,7 @@ static int tgsi_src(struct r600_shader_ctx *ctx, if (tgsi_src->Register.Indirect) r600_src->rel = V_SQ_REL_RELATIVE; r600_src->neg = tgsi_src->Register.Negate; + r600_src->abs = tgsi_src->Register.Absolute; r600_src->sel += ctx->file_offset[tgsi_src->Register.File]; return 0; } -- cgit v1.2.3 From 510c503762a228db2b3d6804f5f5c7af9be1a920 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 15 Oct 2010 08:46:16 +1000 Subject: r300g: clean up warning due to unknown cap. --- src/gallium/drivers/r300/r300_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 7f41ff0e2e..b448924f85 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -124,6 +124,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_INDEP_BLEND_FUNC: case PIPE_CAP_DEPTH_CLAMP: /* XXX implemented, but breaks Regnum Online */ case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: + case PIPE_CAP_SHADER_STENCIL_EXPORT: return 0; /* Texturing. */ -- cgit v1.2.3 From 62450b3c490e3f16aa18135d5b1767911861ae4a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 Oct 2010 16:21:32 -0600 Subject: gallivm: add compile-time option to emit inst addrs and/or line numbers Disabling address printing is helpful for diffing. --- src/gallium/auxiliary/gallivm/lp_bld_debug.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.c b/src/gallium/auxiliary/gallivm/lp_bld_debug.c index 8c1df0d8e3..93e56553d7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.c @@ -57,6 +57,8 @@ lp_disassemble(const void* func) #ifdef HAVE_UDIS86 ud_t ud_obj; uint64_t max_jmp_pc; + uint inst_no; + boolean emit_addrs = TRUE, emit_line_nos = FALSE; ud_init(&ud_obj); @@ -76,13 +78,18 @@ lp_disassemble(const void* func) while (ud_disassemble(&ud_obj)) { + if (emit_addrs) { #ifdef PIPE_ARCH_X86 - debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj)); + debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj)); #endif #ifdef PIPE_ARCH_X86_64 - debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj)); + debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj)); #endif - + } + else if (emit_line_nos) { + debug_printf("%6d:\t", inst_no); + inst_no++; + } #if 0 debug_printf("%-16s ", ud_insn_hex(&ud_obj)); #endif -- cgit v1.2.3 From 3d7479d70568c84354338d0da0b7bed4d296c169 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 Oct 2010 16:31:54 -0600 Subject: llvmpipe: code to dump bytecode to file (disabled) --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 6e3c27e78e..d2fbe27708 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -99,6 +99,7 @@ #include +#include static unsigned fs_no = 0; @@ -778,6 +779,11 @@ generate_fragment(struct llvmpipe_context *lp, debug_printf("\n"); } + /* Dump byte code to a file */ + if (0) { + LLVMWriteBitcodeToFile(lp_build_module, "llvmpipe.bc"); + } + /* * Translate the LLVM IR into machine code. */ -- cgit v1.2.3 From 07a30e3d18a528a2dc8a247af5c43e7428be1743 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 14:40:24 +1000 Subject: tgsi: add scanner support for centroid inputs --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 1 + src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 538274887b..6585da3e83 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -147,6 +147,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens, info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name; info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index; info->input_interpolate[reg] = (ubyte)fulldecl->Declaration.Interpolate; + info->input_centroid[reg] = (ubyte)fulldecl->Declaration.Centroid; info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Declaration.CylindricalWrap; info->num_inputs++; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 374c7ed551..104097fbc0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -45,6 +45,7 @@ struct tgsi_shader_info ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */ ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS]; + ubyte input_centroid[PIPE_MAX_SHADER_INPUTS]; ubyte input_usage_mask[PIPE_MAX_SHADER_INPUTS]; ubyte input_cylindrical_wrap[PIPE_MAX_SHADER_INPUTS]; ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */ -- cgit v1.2.3 From fc6caef4cb67fb13642c5ebccee53019d1764df6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 Oct 2010 14:40:51 +1000 Subject: r600g: evergreen interpolation support. On evergreen, interpolation has moved into the fragment shader, with the interpolation parmaters being passed via GPRs and LDS entries. This works out the number of interps required and reserves GPR/LDS storage for them, it also correctly routes face/position values which aren't interpolated from the vertex shader. Also if we noticed nothing is to be interpolated we always setup perspective interpolation for one value otherwise the GPU appears to lockup. This fixes about 15 piglit tests on evergreen. --- src/gallium/drivers/r600/evergreen_state.c | 74 ++++++++++++++++++----- src/gallium/drivers/r600/r600_shader.c | 95 ++++++++++++++++++++++++++++-- src/gallium/drivers/r600/r600_shader.h | 2 + 3 files changed, 149 insertions(+), 22 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 542df11db6..935496c04a 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1529,23 +1529,39 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_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; + unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1; + int pos_index = -1, face_index = -1; + int ninterp = 0; + boolean have_linear = FALSE, have_centroid = FALSE, have_perspective = FALSE; + unsigned spi_baryc_cntl; /* clear previous register */ rstate->nregs = 0; for (i = 0; i < rshader->ninput; i++) { tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i)); + /* evergreen NUM_INTERP only contains values interpolated into the LDS, + POSITION goes via GPRs from the SC so isn't counted */ if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) - have_pos = TRUE; + pos_index = i; + else if (rshader->input[i].name == TGSI_SEMANTIC_FACE) + face_index = i; + else { + if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR || + rshader->input[i].interpolate == TGSI_INTERPOLATE_PERSPECTIVE) + ninterp++; + if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR) + have_linear = TRUE; + if (rshader->input[i].interpolate == TGSI_INTERPOLATE_PERSPECTIVE) + have_perspective = TRUE; + if (rshader->input[i].centroid) + have_centroid = 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); @@ -1568,7 +1584,8 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader exports_ps = 0; num_cout = 0; for (i = 0; i < rshader->noutput; i++) { - if (rshader->output[i].name == TGSI_SEMANTIC_POSITION || rshader->output[i].name == TGSI_SEMANTIC_STENCIL) + if (rshader->output[i].name == TGSI_SEMANTIC_POSITION || + rshader->output[i].name == TGSI_SEMANTIC_STENCIL) exports_ps |= 1; else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) { num_cout++; @@ -1580,18 +1597,48 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader exports_ps = 2; } - spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) | - S_0286CC_PERSP_GRADIENT_ENA(1); + if (ninterp == 0) { + ninterp = 1; + have_perspective = TRUE; + } + + spi_ps_in_control_0 = S_0286CC_NUM_INTERP(ninterp) | + S_0286CC_PERSP_GRADIENT_ENA(have_perspective) | + S_0286CC_LINEAR_GRADIENT_ENA(have_linear); spi_input_z = 0; - if (have_pos) { - spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1); + if (pos_index != -1) { + spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1) | + S_0286CC_POSITION_CENTROID(rshader->input[pos_index].centroid) | + S_0286CC_POSITION_ADDR(rshader->input[pos_index].gpr); spi_input_z |= 1; } + + spi_ps_in_control_1 = 0; + if (face_index != -1) { + spi_ps_in_control_1 |= S_0286D0_FRONT_FACE_ENA(1) | + S_0286D0_FRONT_FACE_ADDR(rshader->input[face_index].gpr); + } + + spi_baryc_cntl = 0; + if (have_perspective) + spi_baryc_cntl |= S_0286E0_PERSP_CENTER_ENA(1) | + S_0286E0_PERSP_CENTROID_ENA(have_centroid); + if (have_linear) + spi_baryc_cntl |= S_0286E0_LINEAR_CENTER_ENA(1) | + S_0286E0_LINEAR_CENTROID_ENA(have_centroid); + 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); + spi_ps_in_control_1, 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_0286E4_SPI_PS_IN_CONTROL_2, + 0, 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_0286E0_SPI_BARYC_CNTL, + spi_baryc_cntl, + 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028840_SQ_PGM_START_PS, (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo); @@ -1607,11 +1654,6 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader r600_pipe_state_add_reg(rstate, R_02884C_SQ_PGM_EXPORTS_PS, exports_ps, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, - R_0286E0_SPI_BARYC_CNTL, - 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 */ diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index b53d478071..94c9cbd923 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -357,6 +357,11 @@ struct r600_shader_ctx { u32 *literals; u32 nliterals; u32 max_driver_temp_used; + /* needed for evergreen interpolation */ + boolean input_centroid; + boolean input_linear; + boolean input_perspective; + int num_interp_gpr; }; struct r600_shader_tgsi_instruction { @@ -404,10 +409,33 @@ static int tgsi_is_supported(struct r600_shader_ctx *ctx) return 0; } -static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int gpr) +static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int input) { int i, r; struct r600_bc_alu alu; + int gpr = 0, base_chan = 0; + int ij_index = 0; + + if (ctx->shader->input[input].interpolate == TGSI_INTERPOLATE_PERSPECTIVE) { + ij_index = 0; + if (ctx->shader->input[input].centroid) + ij_index++; + } else if (ctx->shader->input[input].interpolate == TGSI_INTERPOLATE_LINEAR) { + ij_index = 0; + /* if we have perspective add one */ + if (ctx->input_perspective) { + ij_index++; + /* if we have perspective centroid */ + if (ctx->input_centroid) + ij_index++; + } + if (ctx->shader->input[input].centroid) + ij_index++; + } + + /* work out gpr and base_chan from index */ + gpr = ij_index / 2; + base_chan = (2 * (ij_index % 2)) + 1; for (i = 0; i < 8; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); @@ -418,13 +446,16 @@ static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int gpr) alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY; if ((i > 1) && (i < 6)) { - alu.dst.sel = ctx->shader->input[gpr].gpr; + alu.dst.sel = ctx->shader->input[input].gpr; alu.dst.write = 1; } alu.dst.chan = i % 4; - alu.src[0].chan = (1 - (i % 2)); - alu.src[1].sel = V_SQ_ALU_SRC_PARAM_BASE + gpr; + + alu.src[0].sel = gpr; + alu.src[0].chan = (base_chan - (i % 2)); + + alu.src[1].sel = V_SQ_ALU_SRC_PARAM_BASE + ctx->shader->input[input].lds_pos; alu.bank_swizzle_force = SQ_ALU_VEC_210; if ((i % 4) == 3) @@ -474,7 +505,12 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) } if (ctx->type == TGSI_PROCESSOR_FRAGMENT && ctx->bc->chiprev == 2) { /* turn input into interpolate on EG */ - evergreen_interp_alu(ctx, i); + if (ctx->shader->input[i].name != TGSI_SEMANTIC_POSITION) { + if (ctx->shader->input[i].interpolate > 0) { + ctx->shader->input[i].lds_pos = ctx->shader->nlds++; + evergreen_interp_alu(ctx, i); + } + } } break; case TGSI_FILE_OUTPUT: @@ -501,6 +537,53 @@ static int r600_get_temp(struct r600_shader_ctx *ctx) return ctx->temp_reg + ctx->max_driver_temp_used++; } +/* + * for evergreen we need to scan the shader to find the number of GPRs we need to + * reserve for interpolation. + * + * we need to know if we are going to emit + * any centroid inputs + * if perspective and linear are required +*/ +static int evergreen_gpr_count(struct r600_shader_ctx *ctx) +{ + int i; + int num_baryc; + + ctx->input_linear = FALSE; + ctx->input_perspective = FALSE; + ctx->input_centroid = FALSE; + ctx->num_interp_gpr = 1; + + /* any centroid inputs */ + for (i = 0; i < ctx->info.num_inputs; i++) { + /* skip position/face */ + if (ctx->info.input_semantic_name[i] == TGSI_SEMANTIC_POSITION || + ctx->info.input_semantic_name[i] == TGSI_SEMANTIC_FACE) + continue; + if (ctx->info.input_interpolate[i] == TGSI_INTERPOLATE_LINEAR) + ctx->input_linear = TRUE; + if (ctx->info.input_interpolate[i] == TGSI_INTERPOLATE_PERSPECTIVE) + ctx->input_perspective = TRUE; + if (ctx->info.input_centroid[i]) + ctx->input_centroid = TRUE; + } + + num_baryc = 0; + /* ignoring sample for now */ + if (ctx->input_perspective) + num_baryc++; + if (ctx->input_linear) + num_baryc++; + if (ctx->input_centroid) + num_baryc *= 2; + + ctx->num_interp_gpr += (num_baryc + 1) >> 1; + + /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */ + return ctx->num_interp_gpr; +} + int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader) { struct tgsi_full_immediate *immediate; @@ -547,7 +630,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s 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_INPUT] = evergreen_gpr_count(&ctx); } ctx.file_offset[TGSI_FILE_OUTPUT] = ctx.file_offset[TGSI_FILE_INPUT] + ctx.info.file_count[TGSI_FILE_INPUT]; diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index a341cca083..f8bc595139 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -32,6 +32,7 @@ struct r600_shader_io { int sid; unsigned interpolate; boolean centroid; + unsigned lds_pos; /* for evergreen */ }; struct r600_shader { @@ -40,6 +41,7 @@ struct r600_shader { boolean flat_shade; unsigned ninput; unsigned noutput; + unsigned nlds; struct r600_shader_io input[32]; struct r600_shader_io output[32]; enum radeon_family family; -- cgit v1.2.3 From 4195febeecd2d2f5571afdb90cbb185a4759f50a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Oct 2010 23:28:10 +0100 Subject: llvmpipe: reintroduce SET_STATE binner command But bin lazily only into bins which are receiving geometry. --- src/gallium/drivers/llvmpipe/lp_rast.c | 13 +++++-- src/gallium/drivers/llvmpipe/lp_rast.h | 6 ++-- src/gallium/drivers/llvmpipe/lp_rast_debug.c | 35 +++++++++++------- src/gallium/drivers/llvmpipe/lp_rast_priv.h | 7 +++- src/gallium/drivers/llvmpipe/lp_scene.c | 4 ++- src/gallium/drivers/llvmpipe/lp_scene.h | 28 ++++++++++++++- src/gallium/drivers/llvmpipe/lp_setup_line.c | 1 - src/gallium/drivers/llvmpipe/lp_setup_point.c | 1 - src/gallium/drivers/llvmpipe/lp_setup_tri.c | 51 +++++++++++++++------------ 9 files changed, 100 insertions(+), 46 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index db9b2f9b12..35e2f731e8 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -334,7 +334,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, { const struct lp_scene *scene = task->scene; const struct lp_rast_shader_inputs *inputs = arg.shade_tile; - const struct lp_rast_state *state = inputs->state; + const struct lp_rast_state *state = task->state; struct lp_fragment_shader_variant *variant = state->variant; const unsigned tile_x = task->x, tile_y = task->y; unsigned x, y; @@ -414,7 +414,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, unsigned x, unsigned y, unsigned mask) { - const struct lp_rast_state *state = inputs->state; + const struct lp_rast_state *state = task->state; struct lp_fragment_shader_variant *variant = state->variant; const struct lp_scene *scene = task->scene; uint8_t *color[PIPE_MAX_COLOR_BUFS]; @@ -490,6 +490,14 @@ lp_rast_end_query(struct lp_rasterizer_task *task, } +void +lp_rast_set_state(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + task->state = arg.state; +} + + /** * Set top row and left column of the tile's pixels to white. For debugging. @@ -602,6 +610,7 @@ static lp_rast_cmd_func dispatch[LP_RAST_OP_MAX] = lp_rast_shade_tile_opaque, lp_rast_begin_query, lp_rast_end_query, + lp_rast_set_state, }; diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index e2bcc45016..f74b198a66 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -85,8 +85,6 @@ struct lp_rast_shader_inputs { float (*a0)[4]; float (*dadx)[4]; float (*dady)[4]; - - const struct lp_rast_state *state; }; /* Note: the order of these values is important as they are loaded by @@ -154,6 +152,7 @@ union lp_rast_cmd_arg { uint32_t value; uint32_t mask; } clear_zstencil; + const struct lp_rast_state *state; struct lp_fence *fence; struct llvmpipe_query *query_obj; }; @@ -245,8 +244,9 @@ lp_rast_arg_null( void ) #define LP_RAST_OP_SHADE_TILE_OPAQUE 0xe #define LP_RAST_OP_BEGIN_QUERY 0xf #define LP_RAST_OP_END_QUERY 0x10 +#define LP_RAST_OP_SET_STATE 0x11 -#define LP_RAST_OP_MAX 0x11 +#define LP_RAST_OP_MAX 0x12 #define LP_RAST_OP_MASK 0xff void diff --git a/src/gallium/drivers/llvmpipe/lp_rast_debug.c b/src/gallium/drivers/llvmpipe/lp_rast_debug.c index 6f4ba1c6fe..3113e196c4 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_debug.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_debug.c @@ -12,6 +12,7 @@ static INLINE int u_bit_scan(unsigned *mask) struct tile { int coverage; int overdraw; + const struct lp_rast_state *state; char data[TILE_SIZE][TILE_SIZE]; }; @@ -47,6 +48,7 @@ static const char *cmd_names[LP_RAST_OP_MAX] = "shade_tile_opaque", "begin_query", "end_query", + "set_state", }; static const char *cmd_name(unsigned cmd) @@ -56,31 +58,31 @@ static const char *cmd_name(unsigned cmd) } static const struct lp_fragment_shader_variant * -get_variant( const struct cmd_block *block, - int k ) +get_variant( const struct lp_rast_state *state, + const struct cmd_block *block, + int k ) { if (block->cmd[k] == LP_RAST_OP_SHADE_TILE || - block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE) - return block->arg[k].shade_tile->state->variant; - - if (block->cmd[k] == LP_RAST_OP_TRIANGLE_1 || + block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE || + block->cmd[k] == LP_RAST_OP_TRIANGLE_1 || block->cmd[k] == LP_RAST_OP_TRIANGLE_2 || block->cmd[k] == LP_RAST_OP_TRIANGLE_3 || block->cmd[k] == LP_RAST_OP_TRIANGLE_4 || block->cmd[k] == LP_RAST_OP_TRIANGLE_5 || block->cmd[k] == LP_RAST_OP_TRIANGLE_6 || block->cmd[k] == LP_RAST_OP_TRIANGLE_7) - return block->arg[k].triangle.tri->inputs.state->variant; + return state->variant; return NULL; } static boolean -is_blend( const struct cmd_block *block, +is_blend( const struct lp_rast_state *state, + const struct cmd_block *block, int k ) { - const struct lp_fragment_shader_variant *variant = get_variant(block, k); + const struct lp_fragment_shader_variant *variant = get_variant(state, block, k); if (variant) return variant->key.blend.rt[0].blend_enable; @@ -93,6 +95,7 @@ is_blend( const struct cmd_block *block, static void debug_bin( const struct cmd_bin *bin ) { + const struct lp_rast_state *state; const struct cmd_block *head = bin->head; int i, j = 0; @@ -100,9 +103,12 @@ debug_bin( const struct cmd_bin *bin ) while (head) { for (i = 0; i < head->count; i++, j++) { + if (head->cmd[i] == LP_RAST_OP_SET_STATE) + state = head->arg[i].state; + debug_printf("%d: %s %s\n", j, cmd_name(head->cmd[i]), - is_blend(head, i) ? "blended" : ""); + is_blend(state, head, i) ? "blended" : ""); } head = head->next; } @@ -134,7 +140,7 @@ debug_shade_tile(int x, int y, char val) { const struct lp_rast_shader_inputs *inputs = arg.shade_tile; - boolean blend = inputs->state->variant->key.blend.rt[0].blend_enable; + boolean blend = tile->state->variant->key.blend.rt[0].blend_enable; unsigned i,j; if (inputs->disable) @@ -176,7 +182,7 @@ debug_triangle(int tilex, int tiley, int x, y; int count = 0; unsigned i, nr_planes = 0; - boolean blend = tri->inputs.state->variant->key.blend.rt[0].blend_enable; + boolean blend = tile->state->variant->key.blend.rt[0].blend_enable; if (tri->inputs.disable) { /* This triangle was partially binned and has been disabled */ @@ -236,12 +242,15 @@ do_debug_bin( struct tile *tile, for (block = bin->head; block; block = block->next) { for (k = 0; k < block->count; k++, j++) { - boolean blend = is_blend(block, k); + boolean blend = is_blend(tile->state, block, k); char val = get_label(j); int count = 0; if (print_cmds) debug_printf("%c: %15s", val, cmd_name(block->cmd[k])); + + if (block->cmd[k] == LP_RAST_OP_SET_STATE) + tile->state = block->arg[k].state; if (block->cmd[k] == LP_RAST_OP_CLEAR_COLOR || block->cmd[k] == LP_RAST_OP_CLEAR_ZSTENCIL) diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 104000a040..7ffd735def 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -77,6 +77,7 @@ struct cmd_bin; struct lp_rasterizer_task { const struct cmd_bin *bin; + const struct lp_rast_state *state; struct lp_scene *scene; unsigned x, y; /**< Pos of this tile in framebuffer, in pixels */ @@ -244,7 +245,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, unsigned x, unsigned y ) { const struct lp_scene *scene = task->scene; - const struct lp_rast_state *state = inputs->state; + const struct lp_rast_state *state = task->state; struct lp_fragment_shader_variant *variant = state->variant; uint8_t *color[PIPE_MAX_COLOR_BUFS]; void *depth; @@ -297,6 +298,10 @@ void lp_rast_triangle_3_16( struct lp_rasterizer_task *, void lp_rast_triangle_4_16( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); +void +lp_rast_set_state(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg); + void lp_debug_bin( const struct cmd_bin *bin ); diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index 8b504f23a3..a4fdf7cff3 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -203,7 +203,9 @@ lp_scene_end_rasterization(struct lp_scene *scene ) for (i = 0; i < scene->tiles_x; i++) { for (j = 0; j < scene->tiles_y; j++) { struct cmd_bin *bin = lp_scene_get_bin(scene, i, j); - bin->head = bin->tail = NULL; + bin->head = NULL; + bin->tail = NULL; + bin->last_state = NULL; } } diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h index dbef7692e4..622c522f11 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.h +++ b/src/gallium/drivers/llvmpipe/lp_scene.h @@ -41,6 +41,7 @@ #include "lp_debug.h" struct lp_scene_queue; +struct lp_rast_state; /* We're limited to 2K by 2K for 32bit fixed point rasterization. * Will need a 64-bit version for larger framebuffers. @@ -94,6 +95,7 @@ struct data_block { struct cmd_bin { ushort x; ushort y; + const struct lp_rast_state *last_state; /* most recent state set in bin */ struct cmd_block *head; struct cmd_block *tail; }; @@ -297,7 +299,7 @@ lp_scene_bin_command( struct lp_scene *scene, assert(x < scene->tiles_x); assert(y < scene->tiles_y); - assert(cmd <= LP_RAST_OP_END_QUERY); + assert(cmd < LP_RAST_OP_MAX); if (tail == NULL || tail->count == CMD_BLOCK_MAX) { tail = lp_scene_new_cmd_block( scene, bin ); @@ -318,6 +320,30 @@ lp_scene_bin_command( struct lp_scene *scene, } +static INLINE boolean +lp_scene_bin_cmd_with_state( struct lp_scene *scene, + unsigned x, unsigned y, + const struct lp_rast_state *state, + unsigned cmd, + union lp_rast_cmd_arg arg ) +{ + struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); + + if (state != bin->last_state) { + bin->last_state = state; + if (!lp_scene_bin_command(scene, x, y, + LP_RAST_OP_SET_STATE, + lp_rast_arg_state(state))) + return FALSE; + } + + if (!lp_scene_bin_command( scene, x, y, cmd, arg )) + return FALSE; + + return TRUE; +} + + /* Add a command to all active bins. */ static INLINE boolean diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 693ac28175..e4cff9aa42 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -597,7 +597,6 @@ try_setup_line( struct lp_setup_context *setup, setup_line_coefficients( setup, line, &info); line->inputs.facing = 1.0F; - line->inputs.state = setup->fs.stored; line->inputs.disable = FALSE; line->inputs.opaque = FALSE; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 64b24a88d5..93c3efe347 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -374,7 +374,6 @@ try_setup_point( struct lp_setup_context *setup, setup_point_coefficients(setup, point, &info); point->inputs.facing = 1.0F; - point->inputs.state = setup->fs.stored; point->inputs.disable = FALSE; point->inputs.opaque = FALSE; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 8fd034666c..bc48eb8d1b 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -200,14 +200,16 @@ lp_setup_whole_tile(struct lp_setup_context *setup, } LP_COUNT(nr_shade_opaque_64); - return lp_scene_bin_command( scene, tx, ty, - LP_RAST_OP_SHADE_TILE_OPAQUE, - lp_rast_arg_inputs(inputs) ); + return lp_scene_bin_cmd_with_state( scene, tx, ty, + setup->fs.stored, + LP_RAST_OP_SHADE_TILE_OPAQUE, + lp_rast_arg_inputs(inputs) ); } else { LP_COUNT(nr_shade_64); - return lp_scene_bin_command( scene, tx, ty, - LP_RAST_OP_SHADE_TILE, - lp_rast_arg_inputs(inputs) ); + return lp_scene_bin_cmd_with_state( scene, tx, ty, + setup->fs.stored, + LP_RAST_OP_SHADE_TILE, + lp_rast_arg_inputs(inputs) ); } } @@ -320,7 +322,6 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->inputs.facing = frontfacing ? 1.0F : -1.0F; tri->inputs.disable = FALSE; tri->inputs.opaque = setup->fs.current.variant->opaque; - tri->inputs.state = setup->fs.stored; for (i = 0; i < 3; i++) { @@ -491,34 +492,36 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, { /* Triangle is contained in a single 4x4 stamp: */ - - return lp_scene_bin_command( scene, ix0, iy0, - LP_RAST_OP_TRIANGLE_3_4, - lp_rast_arg_triangle(tri, mask) ); + return lp_scene_bin_cmd_with_state( scene, ix0, iy0, + setup->fs.stored, + LP_RAST_OP_TRIANGLE_3_4, + lp_rast_arg_triangle(tri, mask) ); } if (sz < 16) { /* Triangle is contained in a single 16x16 block: */ - return lp_scene_bin_command( scene, ix0, iy0, - LP_RAST_OP_TRIANGLE_3_16, - lp_rast_arg_triangle(tri, mask) ); + return lp_scene_bin_cmd_with_state( scene, ix0, iy0, + setup->fs.stored, + LP_RAST_OP_TRIANGLE_3_16, + lp_rast_arg_triangle(tri, mask) ); } } else if (nr_planes == 4 && sz < 16) { - return lp_scene_bin_command( scene, ix0, iy0, - LP_RAST_OP_TRIANGLE_4_16, - lp_rast_arg_triangle(tri, mask) ); + return lp_scene_bin_cmd_with_state(scene, ix0, iy0, + setup->fs.stored, + LP_RAST_OP_TRIANGLE_4_16, + lp_rast_arg_triangle(tri, mask) ); } /* Triangle is contained in a single tile: */ - return lp_scene_bin_command( scene, ix0, iy0, - lp_rast_tri_tab[nr_planes], - lp_rast_arg_triangle(tri, (1<fs.stored, + lp_rast_tri_tab[nr_planes], + lp_rast_arg_triangle(tri, (1<fs.stored, + lp_rast_tri_tab[count], + lp_rast_arg_triangle(tri, partial) )) goto fail; LP_COUNT(nr_partially_covered_64); -- cgit v1.2.3 From 0a1c9001037a13b69b157994e7983aa3dee158d3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 00:12:19 +0100 Subject: llvmpipe: don't pass frontfacing as a float --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 8 ++++---- src/gallium/drivers/llvmpipe/lp_jit.h | 2 +- src/gallium/drivers/llvmpipe/lp_rast.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_rast.h | 2 +- src/gallium/drivers/llvmpipe/lp_rast_priv.h | 2 +- src/gallium/drivers/llvmpipe/lp_setup_line.c | 2 +- src/gallium/drivers/llvmpipe/lp_setup_point.c | 2 +- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index e4cfa97aa3..ddf7da0b14 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -446,7 +446,7 @@ lp_build_occlusion_count(LLVMBuilderRef builder, * \param stencil_refs the front/back stencil ref values (scalar) * \param z_src the incoming depth/stencil values (a 2x2 quad, float32) * \param zs_dst_ptr pointer to depth/stencil values in framebuffer - * \param facing contains float value indicating front/back facing polygon + * \param facing contains boolean value indicating front/back facing polygon */ void lp_build_depth_stencil_test(LLVMBuilderRef builder, @@ -576,10 +576,10 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, if (stencil[0].enabled) { if (face) { - LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0); + LLVMValueRef zero = LLVMConstInt(LLVMInt32Type(), 0, 0); - /* front_facing = face > 0.0 ? ~0 : 0 */ - front_facing = LLVMBuildFCmp(builder, LLVMRealUGT, face, zero, ""); + /* front_facing = face != 0 ? ~0 : 0 */ + front_facing = LLVMBuildICmp(builder, LLVMIntNE, face, zero, ""); front_facing = LLVMBuildSExt(builder, front_facing, LLVMIntType(s_bld.type.length*s_bld.type.width), ""); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 16e04fce0c..114f21f2d1 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -144,7 +144,7 @@ typedef void (*lp_jit_frag_func)(const struct lp_jit_context *context, uint32_t x, uint32_t y, - float facing, + uint32_t facing, const void *a0, const void *dadx, const void *dady, diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 35e2f731e8..8e9be755e0 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -365,7 +365,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, BEGIN_JIT_CALL(state); variant->jit_function[RAST_WHOLE]( &state->jit_context, tile_x + x, tile_y + y, - inputs->facing, + inputs->frontfacing, inputs->a0, inputs->dadx, inputs->dady, @@ -446,7 +446,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, BEGIN_JIT_CALL(state); variant->jit_function[RAST_EDGE_TEST](&state->jit_context, x, y, - inputs->facing, + inputs->frontfacing, inputs->a0, inputs->dadx, inputs->dady, diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index f74b198a66..c5fb15484c 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -78,7 +78,7 @@ struct lp_rast_state { * These pointers point into the bin data buffer. */ struct lp_rast_shader_inputs { - float facing; /** Positive for front-facing, negative for back-facing */ + unsigned frontfacing; /** One for front-facing */ unsigned disable:1; /** Partially binned, disable this command */ unsigned opaque:1; /** Is opaque */ diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 7ffd735def..e5d04c65b0 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -261,7 +261,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, BEGIN_JIT_CALL(state); variant->jit_function[RAST_WHOLE]( &state->jit_context, x, y, - inputs->facing, + inputs->frontfacing, inputs->a0, inputs->dadx, inputs->dady, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index e4cff9aa42..efc48eecfe 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -596,7 +596,7 @@ try_setup_line( struct lp_setup_context *setup, */ setup_line_coefficients( setup, line, &info); - line->inputs.facing = 1.0F; + line->inputs.frontfacing = TRUE; line->inputs.disable = FALSE; line->inputs.opaque = FALSE; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 93c3efe347..108c831e66 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -373,7 +373,7 @@ try_setup_point( struct lp_setup_context *setup, */ setup_point_coefficients(setup, point, &info); - point->inputs.facing = 1.0F; + point->inputs.frontfacing = TRUE; point->inputs.disable = FALSE; point->inputs.opaque = FALSE; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index bc48eb8d1b..3bf0b2d252 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -319,7 +319,7 @@ do_triangle_ccw(struct lp_setup_context *setup, */ lp_setup_tri_coef( setup, &tri->inputs, v0, v1, v2, frontfacing ); - tri->inputs.facing = frontfacing ? 1.0F : -1.0F; + tri->inputs.frontfacing = frontfacing; tri->inputs.disable = FALSE; tri->inputs.opaque = setup->fs.current.variant->opaque; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index d2fbe27708..8df807cec8 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -579,7 +579,7 @@ generate_fragment(struct llvmpipe_context *lp, arg_types[0] = screen->context_ptr_type; /* context */ arg_types[1] = LLVMInt32Type(); /* x */ arg_types[2] = LLVMInt32Type(); /* y */ - arg_types[3] = LLVMFloatType(); /* facing */ + arg_types[3] = LLVMInt32Type(); /* facing */ arg_types[4] = LLVMPointerType(fs_elem_type, 0); /* a0 */ arg_types[5] = LLVMPointerType(fs_elem_type, 0); /* dadx */ arg_types[6] = LLVMPointerType(fs_elem_type, 0); /* dady */ -- cgit v1.2.3 From 9bf8a55c4b29d55320fc2e7875ecf0e9ca164ee8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 12:23:22 +0100 Subject: llvmpipe: slightly shrink the size of a binned triangle --- src/gallium/drivers/llvmpipe/lp_rast.c | 12 +- src/gallium/drivers/llvmpipe/lp_rast.h | 30 ++-- src/gallium/drivers/llvmpipe/lp_rast_debug.c | 3 +- src/gallium/drivers/llvmpipe/lp_rast_priv.h | 6 +- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 4 +- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 7 +- src/gallium/drivers/llvmpipe/lp_setup_coef.c | 67 ++++----- src/gallium/drivers/llvmpipe/lp_setup_coef.h | 4 + .../drivers/llvmpipe/lp_setup_coef_intrin.c | 52 ++++--- src/gallium/drivers/llvmpipe/lp_setup_line.c | 154 +++++++++++---------- src/gallium/drivers/llvmpipe/lp_setup_point.c | 141 ++++++++++--------- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 128 ++++++++--------- 12 files changed, 316 insertions(+), 292 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 8e9be755e0..d358a98394 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -366,9 +366,9 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, variant->jit_function[RAST_WHOLE]( &state->jit_context, tile_x + x, tile_y + y, inputs->frontfacing, - inputs->a0, - inputs->dadx, - inputs->dady, + GET_A0(inputs), + GET_DADX(inputs), + GET_DADY(inputs), color, depth, 0xffff, @@ -447,9 +447,9 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, variant->jit_function[RAST_EDGE_TEST](&state->jit_context, x, y, inputs->frontfacing, - inputs->a0, - inputs->dadx, - inputs->dady, + GET_A0(inputs), + GET_DADX(inputs), + GET_DADY(inputs), color, depth, mask, diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index c5fb15484c..8d8b6210ec 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -78,13 +78,14 @@ struct lp_rast_state { * These pointers point into the bin data buffer. */ struct lp_rast_shader_inputs { - unsigned frontfacing; /** One for front-facing */ - unsigned disable:1; /** Partially binned, disable this command */ - unsigned opaque:1; /** Is opaque */ - - float (*a0)[4]; - float (*dadx)[4]; - float (*dady)[4]; + unsigned frontfacing:1; /** True for front-facing */ + unsigned disable:1; /** Partially binned, disable this command */ + unsigned opaque:1; /** Is opaque */ + unsigned pad0:29; /* wasted space */ + unsigned stride; /* how much to advance data between a0, dadx, dady */ + unsigned pad2; /* wasted space */ + unsigned pad3; /* wasted space */ + /* followed by a0, dadx, dady and planes[] */ }; /* Note: the order of these values is important as they are loaded by @@ -111,17 +112,24 @@ struct lp_rast_plane { * Objects of this type are put into the lp_setup_context::data buffer. */ struct lp_rast_triangle { - /* inputs for the shader */ - struct lp_rast_shader_inputs inputs; - #ifdef DEBUG float v[3][2]; + float pad0; + float pad1; #endif - struct lp_rast_plane plane[8]; /* NOTE: may allocate fewer planes */ + /* inputs for the shader */ + struct lp_rast_shader_inputs inputs; + /* planes are also allocated here */ }; +#define GET_A0(inputs) ((float (*)[4])((inputs)+1)) +#define GET_DADX(inputs) ((float (*)[4])((char *)((inputs) + 1) + (inputs)->stride)) +#define GET_DADY(inputs) ((float (*)[4])((char *)((inputs) + 1) + 2 * (inputs)->stride)) +#define GET_PLANES(tri) ((struct lp_rast_plane *)((char *)(&(tri)->inputs + 1) + 3 * (tri)->inputs.stride)) + + struct lp_rasterizer * lp_rast_create( unsigned num_threads ); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_debug.c b/src/gallium/drivers/llvmpipe/lp_rast_debug.c index 3113e196c4..e2783aa568 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_debug.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_debug.c @@ -178,6 +178,7 @@ debug_triangle(int tilex, int tiley, { const struct lp_rast_triangle *tri = arg.triangle.tri; unsigned plane_mask = arg.triangle.plane_mask; + const struct lp_rast_plane *tri_plane = GET_PLANES(tri); struct lp_rast_plane plane[8]; int x, y; int count = 0; @@ -190,7 +191,7 @@ debug_triangle(int tilex, int tiley, } while (plane_mask) { - plane[nr_planes] = tri->plane[u_bit_scan(&plane_mask)]; + plane[nr_planes] = tri_plane[u_bit_scan(&plane_mask)]; plane[nr_planes].c = (plane[nr_planes].c + plane[nr_planes].dcdy * tiley - plane[nr_planes].dcdx * tilex); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index e5d04c65b0..b30408f097 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -262,9 +262,9 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, variant->jit_function[RAST_WHOLE]( &state->jit_context, x, y, inputs->frontfacing, - inputs->a0, - inputs->dadx, - inputs->dady, + GET_A0(inputs), + GET_DADX(inputs), + GET_DADY(inputs), color, depth, 0xffff, diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index bae772b9c5..5bdf19712f 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -311,7 +311,7 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg) { const struct lp_rast_triangle *tri = arg.triangle.tri; - const struct lp_rast_plane *plane = tri->plane; + const struct lp_rast_plane *plane = GET_PLANES(tri); int x = (arg.triangle.plane_mask & 0xff) + task->x; int y = (arg.triangle.plane_mask >> 8) + task->y; unsigned i, j; @@ -421,7 +421,7 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg) { const struct lp_rast_triangle *tri = arg.triangle.tri; - const struct lp_rast_plane *plane = tri->plane; + const struct lp_rast_plane *plane = GET_PLANES(tri); int x = (arg.triangle.plane_mask & 0xff) + task->x; int y = (arg.triangle.plane_mask >> 8) + task->y; diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 2f03229512..9976996719 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -156,6 +156,7 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, { const struct lp_rast_triangle *tri = arg.triangle.tri; unsigned plane_mask = arg.triangle.plane_mask; + const struct lp_rast_plane *tri_plane = GET_PLANES(tri); const int x = task->x, y = task->y; struct lp_rast_plane plane[NR_PLANES]; int c[NR_PLANES]; @@ -172,7 +173,7 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, while (plane_mask) { int i = ffs(plane_mask) - 1; - plane[j] = tri->plane[i]; + plane[j] = tri_plane[i]; plane_mask &= ~(1 << i); c[j] = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x; @@ -255,7 +256,7 @@ TRI_16(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg) { const struct lp_rast_triangle *tri = arg.triangle.tri; - const struct lp_rast_plane *plane = tri->plane; + const struct lp_rast_plane *plane = GET_PLANES(tri); unsigned mask = arg.triangle.plane_mask; unsigned outmask, partial_mask; unsigned j; @@ -328,7 +329,7 @@ TRI_4(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg) { const struct lp_rast_triangle *tri = arg.triangle.tri; - const struct lp_rast_plane *plane = tri->plane; + const struct lp_rast_plane *plane = GET_PLANES(tri); unsigned mask = arg.triangle.plane_mask; const int x = task->x + (mask & 0xff); const int y = task->y + (mask >> 8); diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.c b/src/gallium/drivers/llvmpipe/lp_setup_coef.c index 8dc2688ddb..a835df6af2 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_coef.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.c @@ -42,20 +42,19 @@ /** * Compute a0 for a constant-valued coefficient (GL_FLAT shading). */ -static void constant_coef( struct lp_rast_shader_inputs *inputs, +static void constant_coef( struct lp_tri_info *info, unsigned slot, const float value, unsigned i ) { - inputs->a0[slot][i] = value; - inputs->dadx[slot][i] = 0.0f; - inputs->dady[slot][i] = 0.0f; + info->a0[slot][i] = value; + info->dadx[slot][i] = 0.0f; + info->dady[slot][i] = 0.0f; } -static void linear_coef( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void linear_coef( struct lp_tri_info *info, unsigned slot, unsigned vert_attr, unsigned i) @@ -69,8 +68,8 @@ static void linear_coef( struct lp_rast_shader_inputs *inputs, float dadx = (da01 * info->dy20_ooa - info->dy01_ooa * da20); float dady = (da20 * info->dx01_ooa - info->dx20_ooa * da01); - inputs->dadx[slot][i] = dadx; - inputs->dady[slot][i] = dady; + info->dadx[slot][i] = dadx; + info->dady[slot][i] = dady; /* calculate a0 as the value which would be sampled for the * fragment at (0,0), taking into account that we want to sample at @@ -84,7 +83,7 @@ static void linear_coef( struct lp_rast_shader_inputs *inputs, * to define a0 as the sample at a pixel center somewhere near vmin * instead - i'll switch to this later. */ - inputs->a0[slot][i] = a0 - (dadx * info->x0_center + + info->a0[slot][i] = a0 - (dadx * info->x0_center + dady * info->y0_center); } @@ -97,8 +96,7 @@ static void linear_coef( struct lp_rast_shader_inputs *inputs, * Later, when we compute the value at a particular fragment position we'll * divide the interpolated value by the interpolated W at that fragment. */ -static void perspective_coef( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void perspective_coef( struct lp_tri_info *info, unsigned slot, unsigned vert_attr, unsigned i) @@ -113,9 +111,9 @@ static void perspective_coef( struct lp_rast_shader_inputs *inputs, float dadx = da01 * info->dy20_ooa - info->dy01_ooa * da20; float dady = da20 * info->dx01_ooa - info->dx20_ooa * da01; - inputs->dadx[slot][i] = dadx; - inputs->dady[slot][i] = dady; - inputs->a0[slot][i] = a0 - (dadx * info->x0_center + + info->dadx[slot][i] = dadx; + info->dady[slot][i] = dady; + info->a0[slot][i] = a0 - (dadx * info->x0_center + dady * info->y0_center); } @@ -127,23 +125,22 @@ static void perspective_coef( struct lp_rast_shader_inputs *inputs, * We could do a bit less work if we'd examine gl_FragCoord's swizzle mask. */ static void -setup_fragcoord_coef(struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +setup_fragcoord_coef(struct lp_tri_info *info, unsigned slot, unsigned usage_mask) { /*X*/ if (usage_mask & TGSI_WRITEMASK_X) { - inputs->a0[slot][0] = 0.0; - inputs->dadx[slot][0] = 1.0; - inputs->dady[slot][0] = 0.0; + info->a0[slot][0] = 0.0; + info->dadx[slot][0] = 1.0; + info->dady[slot][0] = 0.0; } /*Y*/ if (usage_mask & TGSI_WRITEMASK_Y) { - inputs->a0[slot][1] = 0.0; - inputs->dadx[slot][1] = 0.0; - inputs->dady[slot][1] = 1.0; + info->a0[slot][1] = 0.0; + info->dadx[slot][1] = 0.0; + info->dady[slot][1] = 1.0; } /*Z*/ @@ -162,23 +159,23 @@ setup_fragcoord_coef(struct lp_rast_shader_inputs *inputs, * Setup the fragment input attribute with the front-facing value. * \param frontface is the triangle front facing? */ -static void setup_facing_coef( struct lp_rast_shader_inputs *inputs, +static void setup_facing_coef( struct lp_tri_info *info, unsigned slot, boolean frontface, unsigned usage_mask) { /* convert TRUE to 1.0 and FALSE to -1.0 */ if (usage_mask & TGSI_WRITEMASK_X) - constant_coef( inputs, slot, 2.0f * frontface - 1.0f, 0 ); + constant_coef( info, slot, 2.0f * frontface - 1.0f, 0 ); if (usage_mask & TGSI_WRITEMASK_Y) - constant_coef( inputs, slot, 0.0f, 1 ); /* wasted */ + constant_coef( info, slot, 0.0f, 1 ); /* wasted */ if (usage_mask & TGSI_WRITEMASK_Z) - constant_coef( inputs, slot, 0.0f, 2 ); /* wasted */ + constant_coef( info, slot, 0.0f, 2 ); /* wasted */ if (usage_mask & TGSI_WRITEMASK_W) - constant_coef( inputs, slot, 0.0f, 3 ); /* wasted */ + constant_coef( info, slot, 0.0f, 3 ); /* wasted */ } @@ -212,6 +209,10 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, info.dx20_ooa = dx20 * oneoverarea; info.dy01_ooa = dy01 * oneoverarea; info.dy20_ooa = dy20 * oneoverarea; + info.a0 = GET_A0(inputs); + info.dadx = GET_DADX(inputs); + info.dady = GET_DADY(inputs); + /* setup interpolation for all the remaining attributes: @@ -225,25 +226,25 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, if (setup->flatshade_first) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - constant_coef(inputs, slot+1, info.v0[vert_attr][i], i); + constant_coef(&info, slot+1, info.v0[vert_attr][i], i); } else { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - constant_coef(inputs, slot+1, info.v2[vert_attr][i], i); + constant_coef(&info, slot+1, info.v2[vert_attr][i], i); } break; case LP_INTERP_LINEAR: for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - linear_coef(inputs, &info, slot+1, vert_attr, i); + linear_coef(&info, slot+1, vert_attr, i); break; case LP_INTERP_PERSPECTIVE: for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - perspective_coef(inputs, &info, slot+1, vert_attr, i); + perspective_coef(&info, slot+1, vert_attr, i); fragcoord_usage_mask |= TGSI_WRITEMASK_W; break; @@ -257,7 +258,7 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, break; case LP_INTERP_FACING: - setup_facing_coef(inputs, slot+1, info.frontfacing, usage_mask); + setup_facing_coef(&info, slot+1, info.frontfacing, usage_mask); break; default: @@ -267,7 +268,7 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, /* The internal position input is in slot zero: */ - setup_fragcoord_coef(inputs, &info, 0, fragcoord_usage_mask); + setup_fragcoord_coef(&info, 0, fragcoord_usage_mask); } #else diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.h b/src/gallium/drivers/llvmpipe/lp_setup_coef.h index 87a3255ccc..7b5b78edd5 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_coef.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.h @@ -52,6 +52,10 @@ struct lp_tri_info { const float (*v2)[4]; boolean frontfacing; /* remove eventually */ + + float (*a0)[4]; + float (*dadx)[4]; + float (*dady)[4]; }; void lp_setup_tri_coef( struct lp_setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c index 3742fd672b..29714e2768 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c @@ -40,14 +40,13 @@ #include -static void constant_coef4( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void constant_coef4( struct lp_tri_info *info, unsigned slot, const float *attr) { - *(__m128 *)inputs->a0[slot] = *(__m128 *)attr; - *(__m128 *)inputs->dadx[slot] = _mm_set1_ps(0.0); - *(__m128 *)inputs->dady[slot] = _mm_set1_ps(0.0); + *(__m128 *)info->a0[slot] = *(__m128 *)attr; + *(__m128 *)info->dadx[slot] = _mm_set1_ps(0.0); + *(__m128 *)info->dady[slot] = _mm_set1_ps(0.0); } @@ -56,8 +55,7 @@ static void constant_coef4( struct lp_rast_shader_inputs *inputs, * Setup the fragment input attribute with the front-facing value. * \param frontface is the triangle front facing? */ -static void setup_facing_coef( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void setup_facing_coef( struct lp_tri_info *info, unsigned slot ) { /* XXX: just pass frontface directly to the shader, don't bother @@ -66,15 +64,14 @@ static void setup_facing_coef( struct lp_rast_shader_inputs *inputs, __m128 a0 = _mm_setr_ps(info->frontfacing ? 1.0 : -1.0, 0, 0, 0); - *(__m128 *)inputs->a0[slot] = a0; - *(__m128 *)inputs->dadx[slot] = _mm_set1_ps(0.0); - *(__m128 *)inputs->dady[slot] = _mm_set1_ps(0.0); + *(__m128 *)info->a0[slot] = a0; + *(__m128 *)info->dadx[slot] = _mm_set1_ps(0.0); + *(__m128 *)info->dady[slot] = _mm_set1_ps(0.0); } -static void calc_coef4( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void calc_coef4( const struct lp_tri_info *info, unsigned slot, __m128 a0, __m128 a1, @@ -96,14 +93,13 @@ static void calc_coef4( struct lp_rast_shader_inputs *inputs, __m128 attr_v0 = _mm_add_ps(dadx_x0, dady_y0); __m128 attr_0 = _mm_sub_ps(a0, attr_v0); - *(__m128 *)inputs->a0[slot] = attr_0; - *(__m128 *)inputs->dadx[slot] = dadx; - *(__m128 *)inputs->dady[slot] = dady; + *(__m128 *)info->a0[slot] = attr_0; + *(__m128 *)info->dadx[slot] = dadx; + *(__m128 *)info->dady[slot] = dady; } -static void linear_coef( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void linear_coef( struct lp_tri_info *info, unsigned slot, unsigned vert_attr) { @@ -111,7 +107,7 @@ static void linear_coef( struct lp_rast_shader_inputs *inputs, __m128 a1 = *(const __m128 *)info->v1[vert_attr]; __m128 a2 = *(const __m128 *)info->v2[vert_attr]; - calc_coef4(inputs, info, slot, a0, a1, a2); + calc_coef4(info, slot, a0, a1, a2); } @@ -124,8 +120,7 @@ static void linear_coef( struct lp_rast_shader_inputs *inputs, * Later, when we compute the value at a particular fragment position we'll * divide the interpolated value by the interpolated W at that fragment. */ -static void perspective_coef( struct lp_rast_shader_inputs *inputs, - const struct lp_tri_info *info, +static void perspective_coef( const struct lp_tri_info *info, unsigned slot, unsigned vert_attr) { @@ -139,7 +134,7 @@ static void perspective_coef( struct lp_rast_shader_inputs *inputs, __m128 a1_oow = _mm_mul_ps(a1, _mm_set1_ps(info->v1[0][3])); __m128 a2_oow = _mm_mul_ps(a2, _mm_set1_ps(info->v2[0][3])); - calc_coef4(inputs, info, slot, a0_oow, a1_oow, a2_oow); + calc_coef4(info, slot, a0_oow, a1_oow, a2_oow); } @@ -174,11 +169,14 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, info.dx20_ooa = dx20 * oneoverarea; info.dy01_ooa = dy01 * oneoverarea; info.dy20_ooa = dy20 * oneoverarea; + info.a0 = GET_A0(inputs); + info.dadx = GET_DADX(inputs); + info.dady = GET_DADY(inputs); /* The internal position input is in slot zero: */ - linear_coef(inputs, &info, 0, 0); + linear_coef(&info, 0, 0); /* setup interpolation for all the remaining attributes: */ @@ -188,19 +186,19 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, switch (setup->fs.input[slot].interp) { case LP_INTERP_CONSTANT: if (setup->flatshade_first) { - constant_coef4(inputs, &info, slot+1, info.v0[vert_attr]); + constant_coef4(&info, slot+1, info.v0[vert_attr]); } else { - constant_coef4(inputs, &info, slot+1, info.v2[vert_attr]); + constant_coef4(&info, slot+1, info.v2[vert_attr]); } break; case LP_INTERP_LINEAR: - linear_coef(inputs, &info, slot+1, vert_attr); + linear_coef(&info, slot+1, vert_attr); break; case LP_INTERP_PERSPECTIVE: - perspective_coef(inputs, &info, slot+1, vert_attr); + perspective_coef(&info, slot+1, vert_attr); break; case LP_INTERP_POSITION: @@ -211,7 +209,7 @@ void lp_setup_tri_coef( struct lp_setup_context *setup, break; case LP_INTERP_FACING: - setup_facing_coef(inputs, &info, slot+1); + setup_facing_coef(&info, slot+1); break; default: diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index efc48eecfe..2fd9f2e2f2 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -46,6 +46,10 @@ struct lp_line_info { const float (*v1)[4]; const float (*v2)[4]; + + float (*a0)[4]; + float (*dadx)[4]; + float (*dady)[4]; }; @@ -53,14 +57,14 @@ struct lp_line_info { * Compute a0 for a constant-valued coefficient (GL_FLAT shading). */ static void constant_coef( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, + struct lp_line_info *info, unsigned slot, const float value, unsigned i ) { - tri->inputs.a0[slot][i] = value; - tri->inputs.dadx[slot][i] = 0.0f; - tri->inputs.dady[slot][i] = 0.0f; + info->a0[slot][i] = value; + info->dadx[slot][i] = 0.0f; + info->dady[slot][i] = 0.0f; } @@ -69,7 +73,6 @@ static void constant_coef( struct lp_setup_context *setup, * for a triangle. */ static void linear_coef( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, struct lp_line_info *info, unsigned slot, unsigned vert_attr, @@ -82,10 +85,10 @@ static void linear_coef( struct lp_setup_context *setup, float dadx = da21 * info->dx * info->oneoverarea; float dady = da21 * info->dy * info->oneoverarea; - tri->inputs.dadx[slot][i] = dadx; - tri->inputs.dady[slot][i] = dady; + info->dadx[slot][i] = dadx; + info->dady[slot][i] = dady; - tri->inputs.a0[slot][i] = (a1 - + info->a0[slot][i] = (a1 - (dadx * (info->v1[0][0] - setup->pixel_offset) + dady * (info->v1[0][1] - setup->pixel_offset))); } @@ -100,7 +103,6 @@ static void linear_coef( struct lp_setup_context *setup, * divide the interpolated value by the interpolated W at that fragment. */ static void perspective_coef( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, struct lp_line_info *info, unsigned slot, unsigned vert_attr, @@ -115,43 +117,42 @@ static void perspective_coef( struct lp_setup_context *setup, float dadx = da21 * info->dx * info->oneoverarea; float dady = da21 * info->dy * info->oneoverarea; - tri->inputs.dadx[slot][i] = dadx; - tri->inputs.dady[slot][i] = dady; + info->dadx[slot][i] = dadx; + info->dady[slot][i] = dady; - tri->inputs.a0[slot][i] = (a1 - - (dadx * (info->v1[0][0] - setup->pixel_offset) + - dady * (info->v1[0][1] - setup->pixel_offset))); + info->a0[slot][i] = (a1 - + (dadx * (info->v1[0][0] - setup->pixel_offset) + + dady * (info->v1[0][1] - setup->pixel_offset))); } static void setup_fragcoord_coef( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, struct lp_line_info *info, unsigned slot, unsigned usage_mask) { /*X*/ if (usage_mask & TGSI_WRITEMASK_X) { - tri->inputs.a0[slot][0] = 0.0; - tri->inputs.dadx[slot][0] = 1.0; - tri->inputs.dady[slot][0] = 0.0; + info->a0[slot][0] = 0.0; + info->dadx[slot][0] = 1.0; + info->dady[slot][0] = 0.0; } /*Y*/ if (usage_mask & TGSI_WRITEMASK_Y) { - tri->inputs.a0[slot][1] = 0.0; - tri->inputs.dadx[slot][1] = 0.0; - tri->inputs.dady[slot][1] = 1.0; + info->a0[slot][1] = 0.0; + info->dadx[slot][1] = 0.0; + info->dady[slot][1] = 1.0; } /*Z*/ if (usage_mask & TGSI_WRITEMASK_Z) { - linear_coef(setup, tri, info, slot, 0, 2); + linear_coef(setup, info, slot, 0, 2); } /*W*/ if (usage_mask & TGSI_WRITEMASK_W) { - linear_coef(setup, tri, info, slot, 0, 3); + linear_coef(setup, info, slot, 0, 3); } } @@ -159,7 +160,6 @@ setup_fragcoord_coef( struct lp_setup_context *setup, * Compute the tri->coef[] array dadx, dady, a0 values. */ static void setup_line_coefficients( struct lp_setup_context *setup, - struct lp_rast_triangle *tri, struct lp_line_info *info) { unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; @@ -177,25 +177,25 @@ static void setup_line_coefficients( struct lp_setup_context *setup, if (setup->flatshade_first) { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - constant_coef(setup, tri, slot+1, info->v1[vert_attr][i], i); + constant_coef(setup, info, slot+1, info->v1[vert_attr][i], i); } else { for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - constant_coef(setup, tri, slot+1, info->v2[vert_attr][i], i); + constant_coef(setup, info, slot+1, info->v2[vert_attr][i], i); } break; case LP_INTERP_LINEAR: for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - linear_coef(setup, tri, info, slot+1, vert_attr, i); + linear_coef(setup, info, slot+1, vert_attr, i); break; case LP_INTERP_PERSPECTIVE: for (i = 0; i < NUM_CHANNELS; i++) if (usage_mask & (1 << i)) - perspective_coef(setup, tri, info, slot+1, vert_attr, i); + perspective_coef(setup, info, slot+1, vert_attr, i); fragcoord_usage_mask |= TGSI_WRITEMASK_W; break; @@ -211,7 +211,7 @@ static void setup_line_coefficients( struct lp_setup_context *setup, 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); + constant_coef(setup, info, slot+1, 1.0, i); break; default: @@ -221,7 +221,7 @@ static void setup_line_coefficients( struct lp_setup_context *setup, /* The internal position input is in slot zero: */ - setup_fragcoord_coef(setup, tri, info, 0, + setup_fragcoord_coef(setup, info, 0, fragcoord_usage_mask); } @@ -276,6 +276,7 @@ try_setup_line( struct lp_setup_context *setup, { struct lp_scene *scene = setup->scene; struct lp_rast_triangle *line; + struct lp_rast_plane *plane; struct lp_line_info info; float width = MAX2(1.0, setup->line_width); struct u_rect bbox; @@ -581,32 +582,35 @@ try_setup_line( struct lp_setup_context *setup, #endif /* calculate the deltas */ - line->plane[0].dcdy = x[0] - x[1]; - line->plane[1].dcdy = x[1] - x[2]; - line->plane[2].dcdy = x[2] - x[3]; - line->plane[3].dcdy = x[3] - x[0]; + plane = GET_PLANES(line); + plane[0].dcdy = x[0] - x[1]; + plane[1].dcdy = x[1] - x[2]; + plane[2].dcdy = x[2] - x[3]; + plane[3].dcdy = x[3] - x[0]; - line->plane[0].dcdx = y[0] - y[1]; - line->plane[1].dcdx = y[1] - y[2]; - line->plane[2].dcdx = y[2] - y[3]; - line->plane[3].dcdx = y[3] - y[0]; + plane[0].dcdx = y[0] - y[1]; + plane[1].dcdx = y[1] - y[2]; + plane[2].dcdx = y[2] - y[3]; + plane[3].dcdx = y[3] - y[0]; /* Setup parameter interpolants: */ - setup_line_coefficients( setup, line, &info); + info.a0 = GET_A0(&line->inputs); + info.dadx = GET_DADX(&line->inputs); + info.dady = GET_DADY(&line->inputs); + setup_line_coefficients(setup, &info); line->inputs.frontfacing = TRUE; line->inputs.disable = FALSE; line->inputs.opaque = FALSE; for (i = 0; i < 4; i++) { - struct lp_rast_plane *plane = &line->plane[i]; /* half-edge constants, will be interated over the whole render * target. */ - plane->c = plane->dcdx * x[i] - plane->dcdy * y[i]; + plane[i].c = plane[i].dcdx * x[i] - plane[i].dcdy * y[i]; /* correct for top-left vs. bottom-left fill convention. @@ -622,38 +626,38 @@ try_setup_line( struct lp_setup_context *setup, * to its usual method, in which case it will probably want * to use the opposite, top-left convention. */ - if (plane->dcdx < 0) { + if (plane[i].dcdx < 0) { /* both fill conventions want this - adjust for left edges */ - plane->c++; + plane[i].c++; } - else if (plane->dcdx == 0) { + else if (plane[i].dcdx == 0) { if (setup->pixel_offset == 0) { /* correct for top-left fill convention: */ - if (plane->dcdy > 0) plane->c++; + if (plane[i].dcdy > 0) plane[i].c++; } else { /* correct for bottom-left fill convention: */ - if (plane->dcdy < 0) plane->c++; + if (plane[i].dcdy < 0) plane[i].c++; } } - plane->dcdx *= FIXED_ONE; - plane->dcdy *= FIXED_ONE; + plane[i].dcdx *= FIXED_ONE; + plane[i].dcdy *= FIXED_ONE; /* find trivial reject offsets for each edge for a single-pixel * sized block. These will be scaled up at each recursive level to * match the active blocksize. Scaling in this way works best if * the blocks are square. */ - plane->eo = 0; - if (plane->dcdx < 0) plane->eo -= plane->dcdx; - if (plane->dcdy > 0) plane->eo += plane->dcdy; + plane[i].eo = 0; + if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx; + if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy; /* Calculate trivial accept offsets from the above. */ - plane->ei = plane->dcdy - plane->dcdx - plane->eo; + plane[i].ei = plane[i].dcdy - plane[i].dcdx - plane[i].eo; } @@ -676,29 +680,29 @@ try_setup_line( struct lp_setup_context *setup, * these planes elsewhere. */ if (nr_planes == 8) { - line->plane[4].dcdx = -1; - line->plane[4].dcdy = 0; - line->plane[4].c = 1-bbox.x0; - line->plane[4].ei = 0; - line->plane[4].eo = 1; - - line->plane[5].dcdx = 1; - line->plane[5].dcdy = 0; - line->plane[5].c = bbox.x1+1; - line->plane[5].ei = -1; - line->plane[5].eo = 0; - - line->plane[6].dcdx = 0; - line->plane[6].dcdy = 1; - line->plane[6].c = 1-bbox.y0; - line->plane[6].ei = 0; - line->plane[6].eo = 1; - - line->plane[7].dcdx = 0; - line->plane[7].dcdy = -1; - line->plane[7].c = bbox.y1+1; - line->plane[7].ei = -1; - line->plane[7].eo = 0; + plane[4].dcdx = -1; + plane[4].dcdy = 0; + plane[4].c = 1-bbox.x0; + plane[4].ei = 0; + plane[4].eo = 1; + + plane[5].dcdx = 1; + plane[5].dcdy = 0; + plane[5].c = bbox.x1+1; + plane[5].ei = -1; + plane[5].eo = 0; + + plane[6].dcdx = 0; + plane[6].dcdy = 1; + plane[6].c = 1-bbox.y0; + plane[6].ei = 0; + plane[6].eo = 1; + + plane[7].dcdx = 0; + plane[7].dcdy = -1; + plane[7].c = bbox.y1+1; + plane[7].ei = -1; + plane[7].eo = 0; } return lp_setup_bin_triangle(setup, line, &bbox, nr_planes); diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 108c831e66..e30e70e16d 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -45,6 +45,10 @@ struct point_info { int dx01, dx12; const float (*v0)[4]; + + float (*a0)[4]; + float (*dadx)[4]; + float (*dady)[4]; }; @@ -53,20 +57,19 @@ struct point_info { */ static void constant_coef(struct lp_setup_context *setup, - struct lp_rast_triangle *point, + struct point_info *info, 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; + info->a0[slot][i] = value; + info->dadx[slot][i] = 0.0f; + info->dady[slot][i] = 0.0f; } static void point_persp_coeff(struct lp_setup_context *setup, - struct lp_rast_triangle *point, const struct point_info *info, unsigned slot, unsigned i) @@ -82,9 +85,9 @@ point_persp_coeff(struct lp_setup_context *setup, 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; + info->a0[slot][i] = info->v0[slot][i]*w0; + info->dadx[slot][i] = 0.0f; + info->dady[slot][i] = 0.0f; } @@ -98,7 +101,6 @@ point_persp_coeff(struct lp_setup_context *setup, */ static void texcoord_coef(struct lp_setup_context *setup, - struct lp_rast_triangle *point, const struct point_info *info, unsigned slot, unsigned i, @@ -115,14 +117,14 @@ texcoord_coef(struct lp_setup_context *setup, 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); + info->dadx[slot][0] = dadx; + info->dady[slot][0] = dady; + info->a0[slot][0] = 0.5 - (dadx * x0 + dady * y0); if (perspective) { - point->inputs.dadx[slot][0] *= w0; - point->inputs.dady[slot][0] *= w0; - point->inputs.a0[slot][0] *= w0; + info->dadx[slot][0] *= w0; + info->dady[slot][0] *= w0; + info->a0[slot][0] *= w0; } } else if (i == 1) { @@ -135,25 +137,25 @@ texcoord_coef(struct lp_setup_context *setup, dady = -dady; } - point->inputs.dadx[slot][1] = dadx; - point->inputs.dady[slot][1] = dady; - point->inputs.a0[slot][1] = 0.5 - (dadx * x0 + dady * y0); + info->dadx[slot][1] = dadx; + info->dady[slot][1] = dady; + info->a0[slot][1] = 0.5 - (dadx * x0 + dady * y0); if (perspective) { - point->inputs.dadx[slot][1] *= w0; - point->inputs.dady[slot][1] *= w0; - point->inputs.a0[slot][1] *= w0; + info->dadx[slot][1] *= w0; + info->dady[slot][1] *= w0; + info->a0[slot][1] *= w0; } } else if (i == 2) { - point->inputs.a0[slot][2] = 0.0f; - point->inputs.dadx[slot][2] = 0.0f; - point->inputs.dady[slot][2] = 0.0f; + info->a0[slot][2] = 0.0f; + info->dadx[slot][2] = 0.0f; + info->dady[slot][2] = 0.0f; } else { - point->inputs.a0[slot][3] = perspective ? w0 : 1.0f; - point->inputs.dadx[slot][3] = 0.0f; - point->inputs.dady[slot][3] = 0.0f; + info->a0[slot][3] = perspective ? w0 : 1.0f; + info->dadx[slot][3] = 0.0f; + info->dady[slot][3] = 0.0f; } } @@ -166,33 +168,32 @@ texcoord_coef(struct lp_setup_context *setup, */ static void setup_point_fragcoord_coef(struct lp_setup_context *setup, - struct lp_rast_triangle *point, - const struct point_info *info, + struct point_info *info, unsigned slot, unsigned usage_mask) { /*X*/ if (usage_mask & TGSI_WRITEMASK_X) { - point->inputs.a0[slot][0] = 0.0; - point->inputs.dadx[slot][0] = 1.0; - point->inputs.dady[slot][0] = 0.0; + info->a0[slot][0] = 0.0; + info->dadx[slot][0] = 1.0; + info->dady[slot][0] = 0.0; } /*Y*/ if (usage_mask & TGSI_WRITEMASK_Y) { - point->inputs.a0[slot][1] = 0.0; - point->inputs.dadx[slot][1] = 0.0; - point->inputs.dady[slot][1] = 1.0; + info->a0[slot][1] = 0.0; + info->dadx[slot][1] = 0.0; + info->dady[slot][1] = 1.0; } /*Z*/ if (usage_mask & TGSI_WRITEMASK_Z) { - constant_coef(setup, point, slot, info->v0[0][2], 2); + constant_coef(setup, info, slot, info->v0[0][2], 2); } /*W*/ if (usage_mask & TGSI_WRITEMASK_W) { - constant_coef(setup, point, slot, info->v0[0][3], 3); + constant_coef(setup, info, slot, info->v0[0][3], 3); } } @@ -202,8 +203,7 @@ setup_point_fragcoord_coef(struct lp_setup_context *setup, */ static void setup_point_coefficients( struct lp_setup_context *setup, - struct lp_rast_triangle *point, - const struct point_info *info) + struct point_info *info) { const struct lp_fragment_shader *shader = setup->fs.current.variant->shader; unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ; @@ -248,7 +248,7 @@ setup_point_coefficients( struct lp_setup_context *setup, (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, + texcoord_coef(setup, info, slot + 1, i, setup->sprite_coord_origin, perspective); } @@ -261,10 +261,10 @@ setup_point_coefficients( struct lp_setup_context *setup, for (i = 0; i < NUM_CHANNELS; i++) { if (usage_mask & (1 << i)) { if (perspective) { - point_persp_coeff(setup, point, info, slot+1, i); + point_persp_coeff(setup, info, slot+1, i); } else { - constant_coef(setup, point, slot+1, info->v0[vert_attr][i], i); + constant_coef(setup, info, slot+1, info->v0[vert_attr][i], i); } } } @@ -273,7 +273,7 @@ setup_point_coefficients( struct lp_setup_context *setup, 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); + constant_coef(setup, info, slot+1, 1.0, i); break; default: @@ -284,7 +284,7 @@ setup_point_coefficients( struct lp_setup_context *setup, /* The internal position input is in slot zero: */ - setup_point_fragcoord_coef(setup, point, info, 0, + setup_point_fragcoord_coef(setup, info, 0, fragcoord_usage_mask); } @@ -368,39 +368,44 @@ try_setup_point( struct lp_setup_context *setup, info.dx12 = fixed_width; info.dy01 = fixed_width; info.dy12 = 0; + info.a0 = GET_A0(&point->inputs); + info.dadx = GET_DADX(&point->inputs); + info.dady = GET_DADY(&point->inputs); /* Setup parameter interpolants: */ - setup_point_coefficients(setup, point, &info); + setup_point_coefficients(setup, &info); point->inputs.frontfacing = TRUE; point->inputs.disable = FALSE; point->inputs.opaque = FALSE; { - point->plane[0].dcdx = -1; - point->plane[0].dcdy = 0; - point->plane[0].c = 1-bbox.x0; - point->plane[0].ei = 0; - point->plane[0].eo = 1; - - point->plane[1].dcdx = 1; - point->plane[1].dcdy = 0; - point->plane[1].c = bbox.x1+1; - point->plane[1].ei = -1; - point->plane[1].eo = 0; - - point->plane[2].dcdx = 0; - point->plane[2].dcdy = 1; - point->plane[2].c = 1-bbox.y0; - point->plane[2].ei = 0; - point->plane[2].eo = 1; - - point->plane[3].dcdx = 0; - point->plane[3].dcdy = -1; - point->plane[3].c = bbox.y1+1; - point->plane[3].ei = -1; - point->plane[3].eo = 0; + struct lp_rast_plane *plane = GET_PLANES(point); + + plane[0].dcdx = -1; + plane[0].dcdy = 0; + plane[0].c = 1-bbox.x0; + plane[0].ei = 0; + plane[0].eo = 1; + + plane[1].dcdx = 1; + plane[1].dcdy = 0; + plane[1].c = bbox.x1+1; + plane[1].ei = -1; + plane[1].eo = 0; + + plane[2].dcdx = 0; + plane[2].dcdy = 1; + plane[2].c = 1-bbox.y0; + plane[2].ei = 0; + plane[2].eo = 1; + + plane[3].dcdx = 0; + plane[3].dcdy = -1; + plane[3].c = bbox.y1+1; + plane[3].ei = -1; + plane[3].eo = 0; } return lp_setup_bin_triangle(setup, point, &bbox, nr_planes); diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 3bf0b2d252..937821b4c3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -75,24 +75,25 @@ lp_setup_alloc_triangle(struct lp_scene *scene, unsigned *tri_size) { unsigned input_array_sz = NUM_CHANNELS * (nr_inputs + 1) * sizeof(float); + unsigned plane_sz = nr_planes * sizeof(struct lp_rast_plane); struct lp_rast_triangle *tri; - unsigned tri_bytes, bytes; - char *inputs; - tri_bytes = align(Offset(struct lp_rast_triangle, plane[nr_planes]), 16); - bytes = tri_bytes + (3 * input_array_sz); - - tri = lp_scene_alloc_aligned( scene, bytes, 16 ); + *tri_size = (sizeof(struct lp_rast_triangle) + + 3 * input_array_sz + + plane_sz); + tri = lp_scene_alloc_aligned( scene, *tri_size, 16 ); if (tri) { - inputs = ((char *)tri) + tri_bytes; - tri->inputs.a0 = (float (*)[4]) inputs; - tri->inputs.dadx = (float (*)[4]) (inputs + input_array_sz); - tri->inputs.dady = (float (*)[4]) (inputs + 2 * input_array_sz); + tri->inputs.stride = input_array_sz; + } - *tri_size = bytes; + { + char *a = (char *)tri; + char *b = (char *)&GET_PLANES(tri)[nr_planes]; + assert(b - a == *tri_size); } + return tri; } @@ -228,6 +229,7 @@ do_triangle_ccw(struct lp_setup_context *setup, { struct lp_scene *scene = setup->scene; struct lp_rast_triangle *tri; + struct lp_rast_plane *plane; int x[3]; int y[3]; struct u_rect bbox; @@ -296,7 +298,7 @@ do_triangle_ccw(struct lp_setup_context *setup, if (!tri) return FALSE; -#ifdef DEBUG +#if 0 tri->v[0][0] = v0[0][0]; tri->v[1][0] = v1[0][0]; tri->v[2][0] = v2[0][0]; @@ -305,13 +307,14 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->v[2][1] = v2[0][1]; #endif - tri->plane[0].dcdy = x[0] - x[1]; - tri->plane[1].dcdy = x[1] - x[2]; - tri->plane[2].dcdy = x[2] - x[0]; + plane = GET_PLANES(tri); + plane[0].dcdy = x[0] - x[1]; + plane[1].dcdy = x[1] - x[2]; + plane[2].dcdy = x[2] - x[0]; - tri->plane[0].dcdx = y[0] - y[1]; - tri->plane[1].dcdx = y[1] - y[2]; - tri->plane[2].dcdx = y[2] - y[0]; + plane[0].dcdx = y[0] - y[1]; + plane[1].dcdx = y[1] - y[2]; + plane[2].dcdx = y[2] - y[0]; LP_COUNT(nr_tris); @@ -325,12 +328,10 @@ do_triangle_ccw(struct lp_setup_context *setup, for (i = 0; i < 3; i++) { - struct lp_rast_plane *plane = &tri->plane[i]; - /* half-edge constants, will be interated over the whole render * target. */ - plane->c = plane->dcdx * x[i] - plane->dcdy * y[i]; + plane[i].c = plane[i].dcdx * x[i] - plane[i].dcdy * y[i]; /* correct for top-left vs. bottom-left fill convention. * @@ -345,38 +346,38 @@ do_triangle_ccw(struct lp_setup_context *setup, * to its usual method, in which case it will probably want * to use the opposite, top-left convention. */ - if (plane->dcdx < 0) { + if (plane[i].dcdx < 0) { /* both fill conventions want this - adjust for left edges */ - plane->c++; + plane[i].c++; } - else if (plane->dcdx == 0) { + else if (plane[i].dcdx == 0) { if (setup->pixel_offset == 0) { /* correct for top-left fill convention: */ - if (plane->dcdy > 0) plane->c++; + if (plane[i].dcdy > 0) plane[i].c++; } else { /* correct for bottom-left fill convention: */ - if (plane->dcdy < 0) plane->c++; + if (plane[i].dcdy < 0) plane[i].c++; } } - plane->dcdx *= FIXED_ONE; - plane->dcdy *= FIXED_ONE; + plane[i].dcdx *= FIXED_ONE; + plane[i].dcdy *= FIXED_ONE; /* find trivial reject offsets for each edge for a single-pixel * sized block. These will be scaled up at each recursive level to * match the active blocksize. Scaling in this way works best if * the blocks are square. */ - plane->eo = 0; - if (plane->dcdx < 0) plane->eo -= plane->dcdx; - if (plane->dcdy > 0) plane->eo += plane->dcdy; + plane[i].eo = 0; + if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx; + if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy; /* Calculate trivial accept offsets from the above. */ - plane->ei = plane->dcdy - plane->dcdx - plane->eo; + plane[i].ei = plane[i].dcdy - plane[i].dcdx - plane[i].eo; } @@ -399,29 +400,29 @@ do_triangle_ccw(struct lp_setup_context *setup, * these planes elsewhere. */ if (nr_planes == 7) { - tri->plane[3].dcdx = -1; - tri->plane[3].dcdy = 0; - tri->plane[3].c = 1-bbox.x0; - tri->plane[3].ei = 0; - tri->plane[3].eo = 1; - - tri->plane[4].dcdx = 1; - tri->plane[4].dcdy = 0; - tri->plane[4].c = bbox.x1+1; - tri->plane[4].ei = -1; - tri->plane[4].eo = 0; - - tri->plane[5].dcdx = 0; - tri->plane[5].dcdy = 1; - tri->plane[5].c = 1-bbox.y0; - tri->plane[5].ei = 0; - tri->plane[5].eo = 1; - - tri->plane[6].dcdx = 0; - tri->plane[6].dcdy = -1; - tri->plane[6].c = bbox.y1+1; - tri->plane[6].ei = -1; - tri->plane[6].eo = 0; + plane[3].dcdx = -1; + plane[3].dcdy = 0; + plane[3].c = 1-bbox.x0; + plane[3].ei = 0; + plane[3].eo = 1; + + plane[4].dcdx = 1; + plane[4].dcdy = 0; + plane[4].c = bbox.x1+1; + plane[4].ei = -1; + plane[4].eo = 0; + + plane[5].dcdx = 0; + plane[5].dcdy = 1; + plane[5].c = 1-bbox.y0; + plane[5].ei = 0; + plane[5].eo = 1; + + plane[6].dcdx = 0; + plane[6].dcdy = -1; + plane[6].c = bbox.y1+1; + plane[6].ei = -1; + plane[6].eo = 0; } return lp_setup_bin_triangle( setup, tri, &bbox, nr_planes ); @@ -525,6 +526,7 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, } else { + struct lp_rast_plane *plane = GET_PLANES(tri); int c[MAX_PLANES]; int ei[MAX_PLANES]; int eo[MAX_PLANES]; @@ -538,14 +540,14 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, int iy1 = bbox->y1 / TILE_SIZE; for (i = 0; i < nr_planes; i++) { - c[i] = (tri->plane[i].c + - tri->plane[i].dcdy * iy0 * TILE_SIZE - - tri->plane[i].dcdx * ix0 * TILE_SIZE); - - ei[i] = tri->plane[i].ei << TILE_ORDER; - eo[i] = tri->plane[i].eo << TILE_ORDER; - xstep[i] = -(tri->plane[i].dcdx << TILE_ORDER); - ystep[i] = tri->plane[i].dcdy << TILE_ORDER; + c[i] = (plane[i].c + + plane[i].dcdy * iy0 * TILE_SIZE - + plane[i].dcdx * ix0 * TILE_SIZE); + + ei[i] = plane[i].ei << TILE_ORDER; + eo[i] = plane[i].eo << TILE_ORDER; + xstep[i] = -(plane[i].dcdx << TILE_ORDER); + ystep[i] = plane[i].dcdy << TILE_ORDER; } -- cgit v1.2.3 From 8965f042b327ad8697963e757f4607f4bb13a045 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 13:04:19 +0100 Subject: llvmpipe: don't store plane.ei value in binned data Further reduce the size of a binned triangle. --- src/gallium/drivers/llvmpipe/lp_rast.h | 3 --- src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h | 6 ++++-- src/gallium/drivers/llvmpipe/lp_setup_line.c | 8 -------- src/gallium/drivers/llvmpipe/lp_setup_point.c | 4 ---- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 13 ++++--------- 5 files changed, 8 insertions(+), 26 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 8d8b6210ec..a64c152cf8 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -100,9 +100,6 @@ struct lp_rast_plane { /* one-pixel sized trivial reject offsets for each plane */ int eo; - - /* one-pixel sized trivial accept offsets for each plane */ - int ei; }; /** diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 9976996719..4825d651c0 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h @@ -82,7 +82,8 @@ TAG(do_block_16)(struct lp_rasterizer_task *task, const int dcdx = -plane[j].dcdx * 4; const int dcdy = plane[j].dcdy * 4; const int cox = plane[j].eo * 4; - const int cio = plane[j].ei * 4 - 1; + const int ei = plane[j].dcdy - plane[j].dcdx - plane[j].eo; + const int cio = ei * 4 - 1; build_masks(c[j] + cox, cio - cox, @@ -181,7 +182,8 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task, const int dcdx = -plane[j].dcdx * 16; const int dcdy = plane[j].dcdy * 16; const int cox = plane[j].eo * 16; - const int cio = plane[j].ei * 16 - 1; + const int ei = plane[j].dcdy - plane[j].dcdx - plane[j].eo; + const int cio = ei * 16 - 1; build_masks(c[j] + cox, cio - cox, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 2fd9f2e2f2..ece8638b5a 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -654,10 +654,6 @@ try_setup_line( struct lp_setup_context *setup, plane[i].eo = 0; if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx; if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy; - - /* Calculate trivial accept offsets from the above. - */ - plane[i].ei = plane[i].dcdy - plane[i].dcdx - plane[i].eo; } @@ -683,25 +679,21 @@ try_setup_line( struct lp_setup_context *setup, plane[4].dcdx = -1; plane[4].dcdy = 0; plane[4].c = 1-bbox.x0; - plane[4].ei = 0; plane[4].eo = 1; plane[5].dcdx = 1; plane[5].dcdy = 0; plane[5].c = bbox.x1+1; - plane[5].ei = -1; plane[5].eo = 0; plane[6].dcdx = 0; plane[6].dcdy = 1; plane[6].c = 1-bbox.y0; - plane[6].ei = 0; plane[6].eo = 1; plane[7].dcdx = 0; plane[7].dcdy = -1; plane[7].c = bbox.y1+1; - plane[7].ei = -1; plane[7].eo = 0; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index e30e70e16d..16d21df35e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -386,25 +386,21 @@ try_setup_point( struct lp_setup_context *setup, plane[0].dcdx = -1; plane[0].dcdy = 0; plane[0].c = 1-bbox.x0; - plane[0].ei = 0; plane[0].eo = 1; plane[1].dcdx = 1; plane[1].dcdy = 0; plane[1].c = bbox.x1+1; - plane[1].ei = -1; plane[1].eo = 0; plane[2].dcdx = 0; plane[2].dcdy = 1; plane[2].c = 1-bbox.y0; - plane[2].ei = 0; plane[2].eo = 1; plane[3].dcdx = 0; plane[3].dcdy = -1; plane[3].c = bbox.y1+1; - plane[3].ei = -1; plane[3].eo = 0; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 937821b4c3..6ceda80a71 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -374,10 +374,6 @@ do_triangle_ccw(struct lp_setup_context *setup, plane[i].eo = 0; if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx; if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy; - - /* Calculate trivial accept offsets from the above. - */ - plane[i].ei = plane[i].dcdy - plane[i].dcdx - plane[i].eo; } @@ -403,25 +399,21 @@ do_triangle_ccw(struct lp_setup_context *setup, plane[3].dcdx = -1; plane[3].dcdy = 0; plane[3].c = 1-bbox.x0; - plane[3].ei = 0; plane[3].eo = 1; plane[4].dcdx = 1; plane[4].dcdy = 0; plane[4].c = bbox.x1+1; - plane[4].ei = -1; plane[4].eo = 0; plane[5].dcdx = 0; plane[5].dcdy = 1; plane[5].c = 1-bbox.y0; - plane[5].ei = 0; plane[5].eo = 1; plane[6].dcdx = 0; plane[6].dcdy = -1; plane[6].c = bbox.y1+1; - plane[6].ei = -1; plane[6].eo = 0; } @@ -544,7 +536,10 @@ lp_setup_bin_triangle( struct lp_setup_context *setup, plane[i].dcdy * iy0 * TILE_SIZE - plane[i].dcdx * ix0 * TILE_SIZE); - ei[i] = plane[i].ei << TILE_ORDER; + ei[i] = (plane[i].dcdy - + plane[i].dcdx - + plane[i].eo) << TILE_ORDER; + eo[i] = plane[i].eo << TILE_ORDER; xstep[i] = -(plane[i].dcdx << TILE_ORDER); ystep[i] = plane[i].dcdy << TILE_ORDER; -- cgit v1.2.3 From 15f4e3a8b98b5f4ca2833c02192ed9e6c237c5c7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 18:58:05 +0100 Subject: gallium: move some intrinsics helpers to u_sse.h --- src/gallium/auxiliary/util/u_sse.h | 74 ++++++++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_rast_tri.c | 58 ----------------------- 2 files changed, 74 insertions(+), 58 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index 8fd0e52a3a..1df6c87267 100644 --- a/src/gallium/auxiliary/util/u_sse.h +++ b/src/gallium/auxiliary/util/u_sse.h @@ -71,6 +71,12 @@ _mm_castps_si128(__m128 a) #endif /* defined(_MSC_VER) && _MSC_VER < 1500 */ +union m128i { + __m128i m; + ubyte ub[16]; + ushort us[8]; + uint ui[4]; +}; static INLINE void u_print_epi8(const char *name, __m128i r) { @@ -149,6 +155,12 @@ static INLINE void u_print_ps(const char *name, __m128 r) } +#define U_DUMP_EPI32(a) u_print_epi32(#a, a) +#define U_DUMP_EPI16(a) u_print_epi16(#a, a) +#define U_DUMP_EPI8(a) u_print_epi8(#a, a) +#define U_DUMP_PS(a) u_print_ps(#a, a) + + #if defined(PIPE_ARCH_SSSE3) @@ -176,6 +188,68 @@ _mm_shuffle_epi8(__m128i a, __m128i mask) #endif /* !PIPE_ARCH_SSSE3 */ + + +/* Provide an SSE2 implementation of _mm_mullo_epi32() in terms of + * _mm_mul_epu32(). + * + * I suspect this works fine for us because one of our operands is + * always positive, but not sure that this can be used for general + * signed integer multiplication. + * + * This seems close enough to the speed of SSE4 and the real + * _mm_mullo_epi32() intrinsic as to not justify adding an sse4 + * dependency at this point. + */ +static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) +{ + __m128i a4 = _mm_srli_epi64(a, 32); /* shift by one dword */ + __m128i b4 = _mm_srli_epi64(b, 32); /* shift by one dword */ + __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */ + __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */ + + /* Interleave the results, either with shuffles or (slightly + * faster) direct bit operations: + */ +#if 0 + __m128i ba8 = _mm_shuffle_epi32(ba, 8); + __m128i b4a48 = _mm_shuffle_epi32(b4a4, 8); + __m128i result = _mm_unpacklo_epi32(ba8, b4a48); +#else + __m128i mask = _mm_setr_epi32(~0,0,~0,0); + __m128i ba_mask = _mm_and_si128(ba, mask); + __m128i b4a4_mask_shift = _mm_slli_epi64(b4a4, 32); + __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift); +#endif + + return result; +} + + +static INLINE void +transpose4_epi32(const __m128i * restrict a, + const __m128i * restrict b, + const __m128i * restrict c, + const __m128i * restrict d, + __m128i * restrict o, + __m128i * restrict p, + __m128i * restrict q, + __m128i * restrict r) +{ + __m128i t0 = _mm_unpacklo_epi32(*a, *b); + __m128i t1 = _mm_unpacklo_epi32(*c, *d); + __m128i t2 = _mm_unpackhi_epi32(*a, *b); + __m128i t3 = _mm_unpackhi_epi32(*c, *d); + + *o = _mm_unpacklo_epi64(t0, t1); + *p = _mm_unpackhi_epi64(t0, t1); + *q = _mm_unpacklo_epi64(t2, t3); + *r = _mm_unpackhi_epi64(t2, t3); +} + +#define SCALAR_EPI32(m, i) _mm_shuffle_epi32((m), _MM_SHUFFLE(i,i,i,i)) + + #endif /* PIPE_ARCH_SSE */ #endif /* U_SSE_H_ */ diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 5bdf19712f..659eb1cac3 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -240,68 +240,10 @@ sign_bits4(const __m128i *cstep, int cdiff) } -static INLINE void -transpose4_epi32(const __m128i * restrict a, - const __m128i * restrict b, - const __m128i * restrict c, - const __m128i * restrict d, - __m128i * restrict o, - __m128i * restrict p, - __m128i * restrict q, - __m128i * restrict r) -{ - __m128i t0 = _mm_unpacklo_epi32(*a, *b); - __m128i t1 = _mm_unpacklo_epi32(*c, *d); - __m128i t2 = _mm_unpackhi_epi32(*a, *b); - __m128i t3 = _mm_unpackhi_epi32(*c, *d); - - *o = _mm_unpacklo_epi64(t0, t1); - *p = _mm_unpackhi_epi64(t0, t1); - *q = _mm_unpacklo_epi64(t2, t3); - *r = _mm_unpackhi_epi64(t2, t3); -} - - -#define SCALAR_EPI32(m, i) _mm_shuffle_epi32((m), _MM_SHUFFLE(i,i,i,i)) - #define NR_PLANES 3 -/* Provide an SSE2 implementation of _mm_mullo_epi32() in terms of - * _mm_mul_epu32(). - * - * I suspect this works fine for us because one of our operands is - * always positive, but not sure that this can be used for general - * signed integer multiplication. - * - * This seems close enough to the speed of SSE4 and the real - * _mm_mullo_epi32() intrinsic as to not justify adding an sse4 - * dependency at this point. - */ -static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) -{ - __m128i a4 = _mm_srli_epi64(a, 32); /* shift by one dword */ - __m128i b4 = _mm_srli_epi64(b, 32); /* shift by one dword */ - __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */ - __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */ - - /* Interleave the results, either with shuffles or (slightly - * faster) direct bit operations: - */ -#if 0 - __m128i ba8 = _mm_shuffle_epi32(ba, 8); - __m128i b4a48 = _mm_shuffle_epi32(b4a4, 8); - __m128i result = _mm_unpacklo_epi32(ba8, b4a48); -#else - __m128i mask = _mm_setr_epi32(~0,0,~0,0); - __m128i ba_mask = _mm_and_si128(ba, mask); - __m128i b4a4_mask_shift = _mm_slli_epi64(b4a4, 32); - __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift); -#endif - - return result; -} -- cgit v1.2.3 From 9f9a17eba8d6080bf30f17c8a7eaed97b10a559f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 12 Oct 2010 18:59:15 +0100 Subject: llvmpipe: do plane calculations with intrinsics This is a step towards moving this code into the rasterizer. --- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 205 ++++++++++++++++++++-------- 1 file changed, 148 insertions(+), 57 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 6ceda80a71..49ded9e045 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -32,6 +32,7 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_rect.h" +#include "util/u_sse.h" #include "lp_perf.h" #include "lp_setup_context.h" #include "lp_setup_coef.h" @@ -40,7 +41,9 @@ #define NUM_CHANNELS 4 - +#if defined(PIPE_ARCH_SSE) +#include +#endif static INLINE int subpixel_snap(float a) @@ -230,11 +233,10 @@ do_triangle_ccw(struct lp_setup_context *setup, struct lp_scene *scene = setup->scene; struct lp_rast_triangle *tri; struct lp_rast_plane *plane; - int x[3]; - int y[3]; + int x[4]; + int y[4]; struct u_rect bbox; unsigned tri_bytes; - int i; int nr_planes = 3; if (0) @@ -251,10 +253,12 @@ do_triangle_ccw(struct lp_setup_context *setup, x[0] = subpixel_snap(v0[0][0] - setup->pixel_offset); x[1] = subpixel_snap(v1[0][0] - setup->pixel_offset); x[2] = subpixel_snap(v2[0][0] - setup->pixel_offset); + x[3] = 0; y[0] = subpixel_snap(v0[0][1] - setup->pixel_offset); y[1] = subpixel_snap(v1[0][1] - setup->pixel_offset); y[2] = subpixel_snap(v2[0][1] - setup->pixel_offset); - + y[3] = 0; + /* Bounding rectangle (in pixels) */ { @@ -307,15 +311,6 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->v[2][1] = v2[0][1]; #endif - plane = GET_PLANES(tri); - plane[0].dcdy = x[0] - x[1]; - plane[1].dcdy = x[1] - x[2]; - plane[2].dcdy = x[2] - x[0]; - - plane[0].dcdx = y[0] - y[1]; - plane[1].dcdx = y[1] - y[2]; - plane[2].dcdx = y[2] - y[0]; - LP_COUNT(nr_tris); /* Setup parameter interpolants: @@ -326,54 +321,150 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->inputs.disable = FALSE; tri->inputs.opaque = setup->fs.current.variant->opaque; - - for (i = 0; i < 3; i++) { - /* half-edge constants, will be interated over the whole render - * target. + plane = GET_PLANES(tri); + +#if defined(PIPE_ARCH_SSE) + { + __m128i vertx, verty; + __m128i shufx, shufy; + __m128i dcdx, dcdy, c; + __m128i unused; + __m128i dcdx_neg_mask; + __m128i dcdy_neg_mask; + __m128i dcdx_zero_mask; + __m128i top_left_flag; + __m128i c_inc_mask, c_inc; + __m128i eo, p0, p1, p2; + __m128i zero = _mm_setzero_si128(); + + vertx = _mm_loadu_si128((__m128i *)x); /* vertex x coords */ + verty = _mm_loadu_si128((__m128i *)y); /* vertex y coords */ + + shufx = _mm_shuffle_epi32(vertx, _MM_SHUFFLE(3,0,2,1)); + shufy = _mm_shuffle_epi32(verty, _MM_SHUFFLE(3,0,2,1)); + + dcdx = _mm_sub_epi32(verty, shufy); + dcdy = _mm_sub_epi32(vertx, shufx); + + dcdx_neg_mask = _mm_srai_epi32(dcdx, 31); + dcdx_zero_mask = _mm_cmpeq_epi32(dcdx, zero); + dcdy_neg_mask = _mm_srai_epi32(dcdy, 31); + + top_left_flag = _mm_set1_epi32((setup->pixel_offset == 0) ? ~0 : 0); + + c_inc_mask = _mm_or_si128(dcdx_neg_mask, + _mm_and_si128(dcdx_zero_mask, + _mm_xor_si128(dcdy_neg_mask, + top_left_flag))); + + c_inc = _mm_srli_epi32(c_inc_mask, 31); + + c = _mm_sub_epi32(mm_mullo_epi32(dcdx, vertx), + mm_mullo_epi32(dcdy, verty)); + + c = _mm_add_epi32(c, c_inc); + + /* Scale up to match c: */ - plane[i].c = plane[i].dcdx * x[i] - plane[i].dcdy * y[i]; - - /* correct for top-left vs. bottom-left fill convention. - * - * note that we're overloading gl_rasterization_rules to mean - * both (0.5,0.5) pixel centers *and* bottom-left filling - * convention. - * - * GL actually has a top-left filling convention, but GL's - * notion of "top" differs from gallium's... - * - * Also, sometimes (in FBO cases) GL will render upside down - * to its usual method, in which case it will probably want - * to use the opposite, top-left convention. - */ - if (plane[i].dcdx < 0) { - /* both fill conventions want this - adjust for left edges */ - plane[i].c++; - } - else if (plane[i].dcdx == 0) { - if (setup->pixel_offset == 0) { - /* correct for top-left fill convention: - */ - if (plane[i].dcdy > 0) plane[i].c++; + dcdx = _mm_slli_epi32(dcdx, FIXED_ORDER); + dcdy = _mm_slli_epi32(dcdy, FIXED_ORDER); + + /* Calculate trivial reject values: + */ + eo = _mm_sub_epi32(_mm_andnot_si128(dcdy_neg_mask, dcdy), + _mm_and_si128(dcdx_neg_mask, dcdx)); + + /* ei = _mm_sub_epi32(_mm_sub_epi32(dcdy, dcdx), eo); */ + + /* Pointless transpose which gets undone immediately in + * rasterization: + */ + transpose4_epi32(&c, &dcdx, &dcdy, &eo, + &p0, &p1, &p2, &unused); + + _mm_storeu_si128((__m128i *)&plane[0], p0); + _mm_storeu_si128((__m128i *)&plane[1], p1); + _mm_storeu_si128((__m128i *)&plane[2], p2); + } +#else + { + int i; + plane[0].dcdy = x[0] - x[1]; + plane[1].dcdy = x[1] - x[2]; + plane[2].dcdy = x[2] - x[0]; + plane[0].dcdx = y[0] - y[1]; + plane[1].dcdx = y[1] - y[2]; + plane[2].dcdx = y[2] - y[0]; + + for (i = 0; i < 3; i++) { + /* half-edge constants, will be interated over the whole render + * target. + */ + plane[i].c = plane[i].dcdx * x[i] - plane[i].dcdy * y[i]; + + /* correct for top-left vs. bottom-left fill convention. + * + * note that we're overloading gl_rasterization_rules to mean + * both (0.5,0.5) pixel centers *and* bottom-left filling + * convention. + * + * GL actually has a top-left filling convention, but GL's + * notion of "top" differs from gallium's... + * + * Also, sometimes (in FBO cases) GL will render upside down + * to its usual method, in which case it will probably want + * to use the opposite, top-left convention. + */ + if (plane[i].dcdx < 0) { + /* both fill conventions want this - adjust for left edges */ + plane[i].c++; } - else { - /* correct for bottom-left fill convention: - */ - if (plane[i].dcdy < 0) plane[i].c++; + else if (plane[i].dcdx == 0) { + if (setup->pixel_offset == 0) { + /* correct for top-left fill convention: + */ + if (plane[i].dcdy > 0) plane[i].c++; + } + else { + /* correct for bottom-left fill convention: + */ + if (plane[i].dcdy < 0) plane[i].c++; + } } - } - plane[i].dcdx *= FIXED_ONE; - plane[i].dcdy *= FIXED_ONE; + plane[i].dcdx *= FIXED_ONE; + plane[i].dcdy *= FIXED_ONE; - /* find trivial reject offsets for each edge for a single-pixel - * sized block. These will be scaled up at each recursive level to - * match the active blocksize. Scaling in this way works best if - * the blocks are square. - */ - plane[i].eo = 0; - if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx; - if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy; + /* find trivial reject offsets for each edge for a single-pixel + * sized block. These will be scaled up at each recursive level to + * match the active blocksize. Scaling in this way works best if + * the blocks are square. + */ + plane[i].eo = 0; + if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx; + if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy; + } + } +#endif + + if (0) { + debug_printf("p0: %08x/%08x/%08x/%08x\n", + plane[0].c, + plane[0].dcdx, + plane[0].dcdy, + plane[0].eo); + + debug_printf("p1: %08x/%08x/%08x/%08x\n", + plane[1].c, + plane[1].dcdx, + plane[1].dcdy, + plane[1].eo); + + debug_printf("p0: %08x/%08x/%08x/%08x\n", + plane[2].c, + plane[2].dcdx, + plane[2].dcdy, + plane[2].eo); } -- cgit v1.2.3 From 392b0954c265fdd66b2de99ab677d2e662935682 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 13:52:00 +0100 Subject: llvmpipe: use aligned loads/stores for plane values --- src/gallium/drivers/llvmpipe/lp_rast_tri.c | 12 ++++++------ src/gallium/drivers/llvmpipe/lp_setup_tri.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 659eb1cac3..042c315635 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -261,9 +261,9 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task, struct { unsigned mask:16; unsigned i:8; unsigned j:8; } out[16]; unsigned nr = 0; - __m128i p0 = _mm_loadu_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */ - __m128i p1 = _mm_loadu_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */ - __m128i p2 = _mm_loadu_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */ + __m128i p0 = _mm_load_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */ + __m128i p1 = _mm_load_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */ + __m128i p2 = _mm_load_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */ __m128i zero = _mm_setzero_si128(); __m128i c; @@ -367,9 +367,9 @@ lp_rast_triangle_3_4(struct lp_rasterizer_task *task, int x = (arg.triangle.plane_mask & 0xff) + task->x; int y = (arg.triangle.plane_mask >> 8) + task->y; - __m128i p0 = _mm_loadu_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */ - __m128i p1 = _mm_loadu_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */ - __m128i p2 = _mm_loadu_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */ + __m128i p0 = _mm_load_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */ + __m128i p1 = _mm_load_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */ + __m128i p2 = _mm_load_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */ __m128i zero = _mm_setzero_si128(); __m128i c; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 49ded9e045..c6cb9afda4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -382,9 +382,9 @@ do_triangle_ccw(struct lp_setup_context *setup, transpose4_epi32(&c, &dcdx, &dcdy, &eo, &p0, &p1, &p2, &unused); - _mm_storeu_si128((__m128i *)&plane[0], p0); - _mm_storeu_si128((__m128i *)&plane[1], p1); - _mm_storeu_si128((__m128i *)&plane[2], p2); + _mm_store_si128((__m128i *)&plane[0], p0); + _mm_store_si128((__m128i *)&plane[1], p1); + _mm_store_si128((__m128i *)&plane[2], p2); } #else { -- cgit v1.2.3 From 39185efd3a891b0d66b1ded10d165dd9aee94464 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 14:11:22 +0100 Subject: llvmpipe: fix non-sse build after recent changes --- src/gallium/drivers/llvmpipe/lp_setup_coef.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.c b/src/gallium/drivers/llvmpipe/lp_setup_coef.c index a835df6af2..95d6615bb9 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_coef.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.c @@ -145,12 +145,12 @@ setup_fragcoord_coef(struct lp_tri_info *info, /*Z*/ if (usage_mask & TGSI_WRITEMASK_Z) { - linear_coef(inputs, info, slot, 0, 2); + linear_coef(info, slot, 0, 2); } /*W*/ if (usage_mask & TGSI_WRITEMASK_W) { - linear_coef(inputs, info, slot, 0, 3); + linear_coef(info, slot, 0, 3); } } -- cgit v1.2.3 From ffab84c9a27a229e6fa14c3de63868bb843c0f3e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 13:23:05 +0100 Subject: llvmpipe: check shader outputs are non-null before using --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 8df807cec8..c4b1b868b6 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -345,7 +345,7 @@ generate_fs(struct llvmpipe_context *lp, TGSI_SEMANTIC_COLOR, 0); - if (color0 != -1) { + if (color0 != -1 && outputs[color0][3]) { LLVMValueRef alpha = LLVMBuildLoad(builder, outputs[color0][3], "alpha"); LLVMValueRef alpha_ref_value; @@ -364,7 +364,7 @@ generate_fs(struct llvmpipe_context *lp, TGSI_SEMANTIC_POSITION, 0); - if (pos0 != -1) { + if (pos0 != -1 && outputs[pos0][2]) { z = LLVMBuildLoad(builder, outputs[pos0][2], "z"); lp_build_name(z, "output%u.%u.%c", i, pos0, "xyzw"[chan]); } -- cgit v1.2.3 From ac98519c4eed0daf770a9ba380056978e4420352 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Oct 2010 13:23:30 +0100 Subject: llvmpipe: validate color outputs against key->nr_cbufs --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index c4b1b868b6..c070b55d3d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -404,7 +404,8 @@ generate_fs(struct llvmpipe_context *lp, /* Color write */ for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib) { - if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) + if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR && + shader->info.base.output_semantic_index[attrib] < key->nr_cbufs) { unsigned cbuf = shader->info.base.output_semantic_index[attrib]; for(chan = 0; chan < NUM_CHANNELS; ++chan) { -- cgit v1.2.3 From 9c439e3c7af7fd1704d44e3ba1a013de7febde37 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 15 Oct 2010 15:53:13 +0200 Subject: nv50: apply layout_mask to tile_flags The tile_flags now store more than just nv50 page table entry bits. --- src/gallium/drivers/nv50/nv50_context.h | 3 +++ src/gallium/drivers/nv50/nv50_surface.c | 2 +- src/gallium/drivers/nv50/nv50_transfer.c | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index ac69c7848e..bf6a577188 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -26,6 +26,9 @@ #define NOUVEAU_MSG(fmt, args...) \ fprintf(stderr, "nouveau: "fmt, ##args); +#define nouveau_bo_tile_layout(nvbo) \ + ((nvbo)->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) + /* Constant buffer assignment */ #define NV50_CB_PMISC 0 #define NV50_CB_PVP 1 diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 3f3166261b..f70c138fe1 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -92,7 +92,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) return 1; } - if (!bo->tile_flags) { + if (!nouveau_bo_tile_layout(bo)) { BEGIN_RING(chan, eng2d, mthd, 2); OUT_RING (chan, format); OUT_RING (chan, 1); diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index f973cf24b9..0cc2f4a837 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -45,7 +45,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, WAIT_RING (chan, 14); - if (!src_bo->tile_flags) { + if (!nouveau_bo_tile_layout(src_bo)) { BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN, 1); OUT_RING (chan, 1); @@ -64,7 +64,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, OUT_RING (chan, sz); /* copying only 1 zslice per call */ } - if (!dst_bo->tile_flags) { + if (!nouveau_bo_tile_layout(dst_bo)) { BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT, 1); OUT_RING (chan, 1); @@ -95,14 +95,14 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 2); OUT_RELOCl(chan, src_bo, src_offset, src_reloc); OUT_RELOCl(chan, dst_bo, dst_offset, dst_reloc); - if (src_bo->tile_flags) { + if (nouveau_bo_tile_layout(src_bo)) { BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN, 1); OUT_RING (chan, (sy << 16) | (sx * cpp)); } else { src_offset += (line_count * src_pitch); } - if (dst_bo->tile_flags) { + if (nouveau_bo_tile_layout(dst_bo)) { BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT, 1); OUT_RING (chan, (dy << 16) | (dx * cpp)); @@ -280,7 +280,7 @@ nv50_upload_sifc(struct nv50_context *nv50, MARK_RING (chan, 32, 2); /* flush on lack of space or relocs */ - if (bo->tile_flags) { + if (nouveau_bo_tile_layout(bo)) { BEGIN_RING(chan, eng2d, NV50_2D_DST_FORMAT, 5); OUT_RING (chan, dst_format); OUT_RING (chan, 0); -- cgit v1.2.3 From 992e7c72797545e5d7dac11c4714c107be07d41c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 12 Oct 2010 18:41:24 +0100 Subject: llvmpipe: Move makefile include to before targets Or plain make inside of the directory wont build libllvmpipe.a --- src/gallium/drivers/llvmpipe/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index 55b877b4ab..d71f09eeb3 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -63,12 +63,12 @@ PROGS := lp_test_format \ # Need this for the lp_test_*.o files CLEAN_EXTRA = *.o +include ../../Makefile.template + lp_test_sincos.o : sse_mathfun.h PROGS_DEPS := ../../auxiliary/libgallium.a -include ../../Makefile.template - lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_pack.py ../../auxiliary/util/u_format.csv python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@ -- cgit v1.2.3 From f8f3baa43a3954b7078e5e24b41ae123f398bff8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 Oct 2010 15:38:29 +0100 Subject: wrapper: Fix spelling --- src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h | 2 +- src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 2 +- src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h index 0b4e740403..f686da6ac8 100644 --- a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h @@ -15,7 +15,7 @@ sw_screen_wrap(struct pipe_screen *screen) struct sw_winsys *sws; struct pipe_screen *sw_screen; - sws = wrapper_sw_winsys_warp_pipe_screen(screen); + sws = wrapper_sw_winsys_wrap_pipe_screen(screen); if (!sws) goto err; diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 3a76098b65..38cf29e605 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -272,7 +272,7 @@ wsw_destroy(struct sw_winsys *ws) } struct sw_winsys * -wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen) +wrapper_sw_winsys_wrap_pipe_screen(struct pipe_screen *screen) { struct wrapper_sw_winsys *wsw = CALLOC_STRUCT(wrapper_sw_winsys); diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h index b5c25a3c50..8a7086f19f 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h @@ -30,6 +30,6 @@ struct sw_winsys; struct pipe_screen; -struct sw_winsys *wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen); +struct sw_winsys *wrapper_sw_winsys_wrap_pipe_screen(struct pipe_screen *screen); #endif -- cgit v1.2.3 From 44207ff71b3d53b30cf6c3e52c84ddc5cd44b424 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 Oct 2010 15:57:55 +0100 Subject: wrapper: Add a way to dewrap a pipe screen without destroying it --- .../auxiliary/target-helpers/inline_wrapper_sw_helper.h | 4 ++-- src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 13 +++++++++++++ src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h index f686da6ac8..f27e34a300 100644 --- a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h @@ -26,9 +26,9 @@ sw_screen_wrap(struct pipe_screen *screen) return sw_screen; err_winsys: - sws->destroy(sws); + return wrapper_sw_winsys_dewrap_pipe_screen(sws); err: - return screen; + return screen; } #endif diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 38cf29e605..bc2623e7b7 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -304,3 +304,16 @@ err_free: err: return NULL; } + +struct pipe_screen * +wrapper_sw_winsys_dewrap_pipe_screen(struct sw_winsys *ws) +{ + struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws); + struct pipe_screen *screen = wsw->screen; + + wsw->pipe->destroy(wsw->pipe); + /* don't destroy the screen its needed later on */ + + FREE(wsw); + return screen; +} diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h index 8a7086f19f..ae0196c432 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h @@ -30,6 +30,15 @@ struct sw_winsys; struct pipe_screen; +/* + * Wrap a pipe screen. + */ struct sw_winsys *wrapper_sw_winsys_wrap_pipe_screen(struct pipe_screen *screen); +/* + * Destroy the sw_winsys and return the wrapped pipe_screen. + * Not destroying it as sw_winsys::destroy does. + */ +struct pipe_screen *wrapper_sw_winsys_dewrap_pipe_screen(struct sw_winsys *sw_winsys); + #endif -- cgit v1.2.3 From af729571eb4242bbe2e952e67a7dd54faf3245a8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 Oct 2010 15:58:54 +0100 Subject: egl: Remove unnecessary headers --- src/gallium/targets/egl/pipe_i915.c | 1 - src/gallium/targets/egl/pipe_i965.c | 1 - 2 files changed, 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/targets/egl/pipe_i915.c b/src/gallium/targets/egl/pipe_i915.c index 758a921b48..cd74044d8c 100644 --- a/src/gallium/targets/egl/pipe_i915.c +++ b/src/gallium/targets/egl/pipe_i915.c @@ -1,5 +1,4 @@ -#include "target-helpers/inline_wrapper_sw_helper.h" #include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "i915/drm/i915_drm_public.h" diff --git a/src/gallium/targets/egl/pipe_i965.c b/src/gallium/targets/egl/pipe_i965.c index 43bf646e82..ae452128b0 100644 --- a/src/gallium/targets/egl/pipe_i965.c +++ b/src/gallium/targets/egl/pipe_i965.c @@ -1,5 +1,4 @@ -#include "target-helpers/inline_wrapper_sw_helper.h" #include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "i965/drm/i965_drm_public.h" -- cgit v1.2.3 From eb7cf3d2a64875d594e1c71b835a9e9704b7a8d6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 Oct 2010 15:46:10 +0100 Subject: target-helpers: Remove per target software wrapper check Instead of having a NAME_SOFTWARE check just use the GALLIUM_DRIVER instead but set the default to native which is the same as not wrapped. --- .../auxiliary/target-helpers/inline_sw_helper.h | 39 +++++++++++++--------- .../target-helpers/inline_wrapper_sw_helper.h | 12 +++++-- src/gallium/targets/dri-i915/target.c | 3 +- src/gallium/targets/dri-i965/target.c | 3 +- src/gallium/targets/egl/pipe_i965.c | 3 +- src/gallium/targets/xorg-i965/intel_target.c | 3 +- 6 files changed, 37 insertions(+), 26 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h index 036c1ee48a..34bfa527db 100644 --- a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h @@ -23,25 +23,12 @@ #include "cell/ppu/cell_public.h" #endif + static INLINE struct pipe_screen * -sw_screen_create(struct sw_winsys *winsys) +sw_screen_create_named(struct sw_winsys *winsys, const char *driver) { - const char *default_driver; - const char *driver; struct pipe_screen *screen = NULL; -#if defined(GALLIUM_CELL) - default_driver = "cell"; -#elif defined(GALLIUM_LLVMPIPE) - default_driver = "llvmpipe"; -#elif defined(GALLIUM_SOFTPIPE) - default_driver = "softpipe"; -#else - default_driver = ""; -#endif - - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - #if defined(GALLIUM_CELL) if (screen == NULL && strcmp(driver, "cell") == 0) screen = cell_create_screen(winsys); @@ -60,4 +47,26 @@ sw_screen_create(struct sw_winsys *winsys) return screen; } + +static INLINE struct pipe_screen * +sw_screen_create(struct sw_winsys *winsys) +{ + const char *default_driver; + const char *driver; + +#if defined(GALLIUM_CELL) + default_driver = "cell"; +#elif defined(GALLIUM_LLVMPIPE) + default_driver = "llvmpipe"; +#elif defined(GALLIUM_SOFTPIPE) + default_driver = "softpipe"; +#else + default_driver = ""; +#endif + + driver = debug_get_option("GALLIUM_DRIVER", default_driver); + return sw_screen_create_named(winsys, driver); +} + + #endif diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h index f27e34a300..e4effa713e 100644 --- a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h @@ -13,14 +13,20 @@ static INLINE struct pipe_screen * sw_screen_wrap(struct pipe_screen *screen) { struct sw_winsys *sws; - struct pipe_screen *sw_screen; + struct pipe_screen *sw_screen = NULL; + const char *driver; + + driver = debug_get_option("GALLIUM_DRIVER", "native"); + if (strcmp(driver, "native") == 0) + return screen; sws = wrapper_sw_winsys_wrap_pipe_screen(screen); if (!sws) goto err; - sw_screen = sw_screen_create(sws); - if (sw_screen == screen) + sw_screen = sw_screen_create_named(sws, driver); + + if (!sw_screen) goto err_winsys; return sw_screen; diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c index 5ae6ca367d..a27b7bd6d8 100644 --- a/src/gallium/targets/dri-i915/target.c +++ b/src/gallium/targets/dri-i915/target.c @@ -19,8 +19,7 @@ create_screen(int fd) if (!screen) return NULL; - if (debug_get_bool_option("I915_SOFTWARE", FALSE)) - screen = sw_screen_wrap(screen); + screen = sw_screen_wrap(screen); screen = debug_screen_wrap(screen); diff --git a/src/gallium/targets/dri-i965/target.c b/src/gallium/targets/dri-i965/target.c index ce97f82027..0632b97bea 100644 --- a/src/gallium/targets/dri-i965/target.c +++ b/src/gallium/targets/dri-i965/target.c @@ -19,8 +19,7 @@ create_screen(int fd) if (!screen) return NULL; - if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) - screen = sw_screen_wrap(screen); + screen = sw_screen_wrap(screen); screen = debug_screen_wrap(screen); diff --git a/src/gallium/targets/egl/pipe_i965.c b/src/gallium/targets/egl/pipe_i965.c index ae452128b0..6b886fb3f1 100644 --- a/src/gallium/targets/egl/pipe_i965.c +++ b/src/gallium/targets/egl/pipe_i965.c @@ -18,8 +18,7 @@ create_screen(int fd) if (!screen) return NULL; - if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) - screen = sw_screen_wrap(screen); + screen = sw_screen_wrap(screen); screen = debug_screen_wrap(screen); diff --git a/src/gallium/targets/xorg-i965/intel_target.c b/src/gallium/targets/xorg-i965/intel_target.c index ce97f82027..0632b97bea 100644 --- a/src/gallium/targets/xorg-i965/intel_target.c +++ b/src/gallium/targets/xorg-i965/intel_target.c @@ -19,8 +19,7 @@ create_screen(int fd) if (!screen) return NULL; - if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) - screen = sw_screen_wrap(screen); + screen = sw_screen_wrap(screen); screen = debug_screen_wrap(screen); -- cgit v1.2.3 From 991f0c27638c4bc03a0c609244bf755a0820d46f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 Oct 2010 08:41:31 -0600 Subject: gallivm: added lp_build_print_vec4() --- src/gallium/auxiliary/gallivm/lp_bld_printf.c | 20 ++++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_printf.h | 4 ++++ 2 files changed, 24 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 153ba5b15b..0c16bcf347 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -29,6 +29,7 @@ #include "util/u_debug.h" #include "util/u_memory.h" +#include "lp_bld_const.h" #include "lp_bld_printf.h" @@ -119,3 +120,22 @@ lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...) return LLVMBuildCall(builder, func_printf, params, argcount + 1, ""); } + + +/** + * Print a float[4] vector. + */ +LLVMValueRef +lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec) +{ + char format[1000]; + LLVMValueRef x, y, z, w; + + x = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(0), ""); + y = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(1), ""); + z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(2), ""); + w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(3), ""); + + snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg); + return lp_build_printf(builder, format, x, y, z, w); +} diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.h b/src/gallium/auxiliary/gallivm/lp_bld_printf.h index 83bd8f1d55..b6222c62eb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.h @@ -35,5 +35,9 @@ LLVMValueRef lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len); LLVMValueRef lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...); +LLVMValueRef +lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec); + + #endif -- cgit v1.2.3 From fb8f3d7711557d34d8a171304c589891d5bda047 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 Oct 2010 11:55:21 -0600 Subject: gallivm: added lp_build_load_volatile() There's no LLVM C LLVMBuildLoadVolatile() function so roll our own. Not used anywhere at this time but can come in handy during debugging. --- src/gallium/auxiliary/gallivm/lp_bld_init.h | 6 ++++++ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.h b/src/gallium/auxiliary/gallivm/lp_bld_init.h index f26fdac466..0b4b1ca7d1 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.h @@ -47,4 +47,10 @@ lp_build_init(void); extern void lp_func_delete_body(LLVMValueRef func); + +extern LLVMValueRef +lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal, + const char *Name); + + #endif /* !LP_BLD_INIT_H */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 48baf7c425..f56ddee7fd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -178,3 +178,13 @@ lp_func_delete_body(LLVMValueRef FF) llvm::Function *func = llvm::unwrap(FF); func->deleteBody(); } + + +extern "C" +LLVMValueRef +lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal, + const char *Name) +{ + return llvm::wrap(llvm::unwrap(B)->CreateLoad(llvm::unwrap(PointerVal), true, Name)); +} + -- cgit v1.2.3 From 46c2ee4fad7d960fb0ff396caff4430df6a4611e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 Oct 2010 17:32:23 -0600 Subject: gallivm: use util_snprintf() --- src/gallium/auxiliary/gallivm/lp_bld_printf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 0c16bcf347..f418e96aff 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -29,6 +29,7 @@ #include "util/u_debug.h" #include "util/u_memory.h" +#include "util/u_string.h" #include "lp_bld_const.h" #include "lp_bld_printf.h" @@ -136,6 +137,6 @@ lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec) z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(2), ""); w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(3), ""); - snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg); + util_snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg); return lp_build_printf(builder, format, x, y, z, w); } -- cgit v1.2.3 From 98b3f27439ba3a48286ed0d6a4467e5482b41fec Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 17 Oct 2010 16:45:15 +1000 Subject: r600g: add evergreen ARL support. Thanks to Alex Deucher for pointing out the FLT to int conversion is necessary and writing an initial patch, this brings about 20 piglits, and I think this is the last piece to make evergreen and r600 equal in terms of features. --- src/gallium/drivers/r600/r600_opcodes.h | 8 ++----- src/gallium/drivers/r600/r600_shader.c | 39 ++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 9 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_opcodes.h b/src/gallium/drivers/r600/r600_opcodes.h index 0cf9c1c401..4f9b39a7fd 100644 --- a/src/gallium/drivers/r600/r600_opcodes.h +++ b/src/gallium/drivers/r600/r600_opcodes.h @@ -233,12 +233,6 @@ #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CEIL 0x00000012 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE 0x00000013 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR 0x00000014 -/* same up to here */ -/* -#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA 0x00000015 -#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR 0x00000016 -#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x00000018 -*/ #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT 0x00000015 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT 0x00000016 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT 0x00000017 @@ -336,9 +330,11 @@ #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED_64 0x00000098 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_64 0x00000099 /* TODO Fill in more ALU */ +#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR 0x000000B1 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 0x000000BE #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE 0x000000BF #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE 0x000000C0 +#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x000000CC #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY 0x000000D6 #define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW 0x000000D7 diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 94c9cbd923..d1143985ea 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -2610,7 +2610,40 @@ static int tgsi_log(struct r600_shader_ctx *ctx) } /* r6/7 only for now */ -static int tgsi_arl(struct r600_shader_ctx *ctx) +static int tgsi_eg_arl(struct r600_shader_ctx *ctx) +{ + struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + struct r600_bc_alu alu; + int r; + + memset(&alu, 0, sizeof(struct r600_bc_alu)); + + alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].chan = tgsi_chan(&inst->Src[0], 0); + alu.last = 1; + alu.dst.chan = 0; + alu.dst.sel = ctx->temp_reg; + alu.dst.write = 1; + r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU)); + if (r) + return r; + memset(&alu, 0, sizeof(struct r600_bc_alu)); + alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT; + r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]); + if (r) + return r; + alu.src[0].sel = ctx->temp_reg; + alu.src[0].chan = 0; + alu.last = 1; + r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU)); + if (r) + return r; + return 0; +} +static int tgsi_r600_arl(struct r600_shader_ctx *ctx) { /* TODO from r600c, ar values don't persist between clauses */ struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; @@ -2955,7 +2988,7 @@ static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx) } static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { - {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_arl}, + {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_r600_arl}, {TGSI_OPCODE_MOV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, {TGSI_OPCODE_LIT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit}, @@ -3119,7 +3152,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { }; static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = { - {TGSI_OPCODE_ARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported}, + {TGSI_OPCODE_ARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_eg_arl}, {TGSI_OPCODE_MOV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2}, {TGSI_OPCODE_LIT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit}, {TGSI_OPCODE_RCP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, tgsi_trans_srcx_replicate}, -- cgit v1.2.3 From 914b0d34e89ee53ef3d7d8aac4baa794492a2064 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 17 Oct 2010 07:15:58 -0700 Subject: llvmpipe: Fix depth-stencil regression. If stencil is enabled then we need to load the z_dst, even if depth testing is disabled. This fixes reflect mesa demo. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 47 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index ddf7da0b14..167ac0ed2e 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -330,7 +330,7 @@ lp_depth_type(const struct util_format_description *format_desc, * in the Z buffer (typically 0xffffff00 or 0x00ffffff). That lets us * get by with fewer bit twiddling steps. */ -static void +static boolean get_z_shift_and_mask(const struct util_format_description *format_desc, unsigned *shift, unsigned *width, unsigned *mask) { @@ -345,7 +345,8 @@ get_z_shift_and_mask(const struct util_format_description *format_desc, z_swizzle = format_desc->swizzle[0]; - assert(z_swizzle != UTIL_FORMAT_SWIZZLE_NONE); + if (z_swizzle == UTIL_FORMAT_SWIZZLE_NONE) + return FALSE; *width = format_desc->channel[z_swizzle].size; @@ -366,6 +367,8 @@ get_z_shift_and_mask(const struct util_format_description *format_desc, } *shift = padding_right; + + return TRUE; } @@ -554,6 +557,27 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, { unsigned s_shift, s_mask; + if (get_z_shift_and_mask(format_desc, &z_shift, &z_width, &z_mask)) { + if (z_mask != 0xffffffff) { + z_bitmask = lp_build_const_int_vec(z_type, z_mask); + } + + /* + * Align the framebuffer Z 's LSB to the right. + */ + if (z_shift) { + LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift); + z_dst = LLVMBuildLShr(builder, zs_dst, shift, "z_dst"); + } else if (z_bitmask) { + /* TODO: Instead of loading a mask from memory and ANDing, it's + * probably faster to just shake the bits with two shifts. */ + z_dst = LLVMBuildAnd(builder, zs_dst, z_bitmask, "z_dst"); + } else { + z_dst = zs_dst; + lp_build_name(z_dst, "z_dst"); + } + } + if (get_s_shift_and_mask(format_desc, &s_shift, &s_mask)) { if (s_shift) { LLVMValueRef shift = lp_build_const_int_vec(s_type, s_shift); @@ -605,8 +629,6 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, } if (depth->enabled) { - get_z_shift_and_mask(format_desc, &z_shift, &z_width, &z_mask); - /* * Convert fragment Z to the desired type, aligning the LSB to the right. */ @@ -644,23 +666,6 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, lp_build_name(z_src, "z_src"); - if (z_mask != 0xffffffff) { - z_bitmask = lp_build_const_int_vec(z_type, z_mask); - } - - /* - * Align the framebuffer Z 's LSB to the right. - */ - if (z_shift) { - LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift); - z_dst = LLVMBuildLShr(builder, zs_dst, shift, "z_dst"); - } else if (z_bitmask) { - z_dst = LLVMBuildAnd(builder, zs_dst, z_bitmask, "z_dst"); - } else { - z_dst = zs_dst; - lp_build_name(z_dst, "z_dst"); - } - /* compare src Z to dst Z, returning 'pass' mask */ z_pass = lp_build_cmp(&z_bld, depth->func, z_src, z_dst); -- cgit v1.2.3 From 709699d2e25146ac16af7e939de4398fdc50307e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 17 Oct 2010 07:45:08 -0700 Subject: llvmpipe: Ensure z_shift and z_width is initialized. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 167ac0ed2e..7eb76d4fb3 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -469,7 +469,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder, struct lp_build_context z_bld; struct lp_build_context s_bld; struct lp_type s_type; - unsigned z_shift, z_width, z_mask; + unsigned z_shift = 0, z_width = 0, z_mask = 0; LLVMValueRef zs_dst, z_dst = NULL; LLVMValueRef stencil_vals = NULL; LLVMValueRef z_bitmask = NULL, stencil_shift = NULL; -- cgit v1.2.3 From dc5bdbe0f96d288bc84d318d25a59dc13c1e81de Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 17 Oct 2010 09:32:41 -0700 Subject: gallivm: Fix SoA cubemap derivative computation. Derivatives are now scalar. Broken since 17dbd41cf23e7e7de2f27e5e9252d7f792d932f3. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 8c03284621..53cc0c5f34 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -963,12 +963,12 @@ lp_build_sample_general(struct lp_build_sample_context *bld, r = lp_build_broadcast_scalar(&bld->int_coord_bld, face); /* vec */ /* recompute ddx, ddy using the new (s,t) face texcoords */ - face_ddx[0] = lp_build_ddx(&bld->coord_bld, s); - face_ddx[1] = lp_build_ddx(&bld->coord_bld, t); + face_ddx[0] = lp_build_scalar_ddx(&bld->coord_bld, s); + face_ddx[1] = lp_build_scalar_ddx(&bld->coord_bld, t); face_ddx[2] = NULL; face_ddx[3] = NULL; - face_ddy[0] = lp_build_ddy(&bld->coord_bld, s); - face_ddy[1] = lp_build_ddy(&bld->coord_bld, t); + face_ddy[0] = lp_build_scalar_ddy(&bld->coord_bld, s); + face_ddy[1] = lp_build_scalar_ddy(&bld->coord_bld, t); face_ddy[2] = NULL; face_ddy[3] = NULL; ddx = face_ddx; -- cgit v1.2.3 From a0add0446ca9dce6d4a96014c42ba6cf3a73a44a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 17 Oct 2010 09:58:04 -0700 Subject: llvmpipe: Fix bad refactoring. 'i' and 'chan' have random values here, which could cause a buffer overflow in debug builds, if chan > 4. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index c070b55d3d..7acbe7e86c 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -365,8 +365,7 @@ generate_fs(struct llvmpipe_context *lp, 0); if (pos0 != -1 && outputs[pos0][2]) { - z = LLVMBuildLoad(builder, outputs[pos0][2], "z"); - lp_build_name(z, "output%u.%u.%c", i, pos0, "xyzw"[chan]); + z = LLVMBuildLoad(builder, outputs[pos0][2], "output.z"); } lp_build_depth_stencil_test(builder, -- cgit v1.2.3 From 4afad7d3edcaaa62b748cc9bd4d88a626ac0920a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 17 Oct 2010 10:15:15 -0700 Subject: llvmpipe: Initialize bld ctx via lp_build_context_init instead of ad-hoc and broken code. --- src/gallium/drivers/llvmpipe/lp_test_round.c | 5 +---- src/gallium/drivers/llvmpipe/lp_test_sincos.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_test_round.c b/src/gallium/drivers/llvmpipe/lp_test_round.c index 57b0ee5776..0770c7ab9a 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_round.c +++ b/src/gallium/drivers/llvmpipe/lp_test_round.c @@ -75,10 +75,7 @@ add_test(LLVMModuleRef module, const char *name, lp_func_t lp_func) LLVMValueRef ret; struct lp_build_context bld; - bld.builder = builder; - bld.type.floating = 1; - bld.type.width = 32; - bld.type.length = 4; + lp_build_context_init(&bld, builder, lp_float32_vec4_type()); LLVMSetFunctionCallConv(func, LLVMCCallConv); diff --git a/src/gallium/drivers/llvmpipe/lp_test_sincos.c b/src/gallium/drivers/llvmpipe/lp_test_sincos.c index 7ab357f162..79939b1a39 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_sincos.c +++ b/src/gallium/drivers/llvmpipe/lp_test_sincos.c @@ -72,10 +72,7 @@ add_sincos_test(LLVMModuleRef module, boolean sin) LLVMValueRef ret; struct lp_build_context bld; - bld.builder = builder; - bld.type.floating = 1; - bld.type.width = 32; - bld.type.length = 4; + lp_build_context_init(&bld, builder, lp_float32_vec4_type()); LLVMSetFunctionCallConv(func, LLVMCCallConv); -- cgit v1.2.3 From c9d297162ad7efb87ab3e29c14259147d891baf9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 17 Oct 2010 14:09:53 -0700 Subject: llvmpipe: Return non-zero exit code for lp_test_round failures. --- src/gallium/drivers/llvmpipe/lp_test_round.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_test_round.c b/src/gallium/drivers/llvmpipe/lp_test_round.c index 0770c7ab9a..0ca2791592 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_round.c +++ b/src/gallium/drivers/llvmpipe/lp_test_round.c @@ -97,9 +97,10 @@ printv(char* string, v4sf value) f[0], f[1], f[2], f[3]); } -static void +static boolean compare(v4sf x, v4sf y) { + boolean success = TRUE; float *xp = (float *) &x; float *yp = (float *) &y; if (xp[0] != yp[0] || @@ -107,7 +108,9 @@ compare(v4sf x, v4sf y) xp[2] != yp[2] || xp[3] != yp[3]) { printf(" Incorrect result! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n"); + success = FALSE; } + return success; } @@ -188,7 +191,7 @@ test_round(unsigned verbose, FILE *fp) y = round_func(x); printv("C round(x) ", ref); printv("LLVM round(x)", y); - compare(ref, y); + success = success && compare(ref, y); refp[0] = trunc(xp[0]); refp[1] = trunc(xp[1]); @@ -197,7 +200,7 @@ test_round(unsigned verbose, FILE *fp) y = trunc_func(x); printv("C trunc(x) ", ref); printv("LLVM trunc(x)", y); - compare(ref, y); + success = success && compare(ref, y); refp[0] = floor(xp[0]); refp[1] = floor(xp[1]); @@ -206,7 +209,7 @@ test_round(unsigned verbose, FILE *fp) y = floor_func(x); printv("C floor(x) ", ref); printv("LLVM floor(x)", y); - compare(ref, y); + success = success && compare(ref, y); refp[0] = ceil(xp[0]); refp[1] = ceil(xp[1]); @@ -215,7 +218,7 @@ test_round(unsigned verbose, FILE *fp) y = ceil_func(x); printv("C ceil(x) ", ref); printv("LLVM ceil(x) ", y); - compare(ref, y); + success = success && compare(ref, y); } LLVMFreeMachineCodeForFunction(engine, test_round); @@ -244,11 +247,7 @@ test_round(unsigned verbose, FILE *fp) boolean test_all(unsigned verbose, FILE *fp) { - boolean success = TRUE; - - test_round(verbose, fp); - - return success; + return test_round(verbose, fp); } -- cgit v1.2.3 From 82114ac02a2d5a764ce69711fc0a71f559ee9137 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Oct 2010 12:49:26 +1000 Subject: r600g: switch to a common formats.h file since they are in different regs --- src/gallium/drivers/r600/eg_state_inlines.h | 37 +++++++++--------- src/gallium/drivers/r600/evergreend.h | 39 ------------------- src/gallium/drivers/r600/r600_formats.h | 56 +++++++++++++++++++++++++++ src/gallium/drivers/r600/r600_state_inlines.h | 47 +++++++++++----------- src/gallium/drivers/r600/r600_texture.c | 41 ++++++++++---------- src/gallium/drivers/r600/r600d.h | 40 +------------------ 6 files changed, 121 insertions(+), 139 deletions(-) create mode 100644 src/gallium/drivers/r600/r600_formats.h (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 5a4e00aac3..be81c28b43 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -25,6 +25,7 @@ #include "util/u_format.h" #include "evergreend.h" +#include "r600_formats.h" static INLINE uint32_t r600_translate_blend_function(int blend_func) { @@ -523,32 +524,32 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) case 16: switch (desc->nr_channels) { case 1: - result = V_030008_FMT_16_FLOAT; + result = FMT_16_FLOAT; break; case 2: - result = V_030008_FMT_16_16_FLOAT; + result = FMT_16_16_FLOAT; break; case 3: - result = V_030008_FMT_16_16_16_FLOAT; + result = FMT_16_16_16_FLOAT; break; case 4: - result = V_030008_FMT_16_16_16_16_FLOAT; + result = FMT_16_16_16_16_FLOAT; break; } break; case 32: switch (desc->nr_channels) { case 1: - result = V_030008_FMT_32_FLOAT; + result = FMT_32_FLOAT; break; case 2: - result = V_030008_FMT_32_32_FLOAT; + result = FMT_32_32_FLOAT; break; case 3: - result = V_030008_FMT_32_32_32_FLOAT; + result = FMT_32_32_32_FLOAT; break; case 4: - result = V_030008_FMT_32_32_32_32_FLOAT; + result = FMT_32_32_32_32_FLOAT; break; } break; @@ -564,48 +565,48 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) case 8: switch (desc->nr_channels) { case 1: - result = V_030008_FMT_8; + result = FMT_8; break; case 2: - result = V_030008_FMT_8_8; + result = 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; + result = FMT_8_8_8_8; break; } break; case 16: switch (desc->nr_channels) { case 1: - result = V_030008_FMT_16; + result = FMT_16; break; case 2: - result = V_030008_FMT_16_16; + result = 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; + result = FMT_16_16_16_16; break; } break; case 32: switch (desc->nr_channels) { case 1: - result = V_030008_FMT_32; + result = FMT_32; break; case 2: - result = V_030008_FMT_32_32; + result = FMT_32_32; break; case 3: - result = V_030008_FMT_32_32_32; + result = FMT_32_32_32; break; case 4: - result = V_030008_FMT_32_32_32_32; + result = FMT_32_32_32_32; break; } break; diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 5d07f532f0..8e96f9355e 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1050,45 +1050,6 @@ #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_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_formats.h b/src/gallium/drivers/r600/r600_formats.h new file mode 100644 index 0000000000..0c91a21238 --- /dev/null +++ b/src/gallium/drivers/r600/r600_formats.h @@ -0,0 +1,56 @@ +#ifndef R600_FORMATS_H +#define R600_FORMATS_H + +/* list of formats from R700 ISA document - apply across GPUs in different registers */ +#define FMT_INVALID 0x00000000 +#define FMT_8 0x00000001 +#define FMT_4_4 0x00000002 +#define FMT_3_3_2 0x00000003 +#define FMT_16 0x00000005 +#define FMT_16_FLOAT 0x00000006 +#define FMT_8_8 0x00000007 +#define FMT_5_6_5 0x00000008 +#define FMT_6_5_5 0x00000009 +#define FMT_1_5_5_5 0x0000000A +#define FMT_4_4_4_4 0x0000000B +#define FMT_5_5_5_1 0x0000000C +#define FMT_32 0x0000000D +#define FMT_32_FLOAT 0x0000000E +#define FMT_16_16 0x0000000F +#define FMT_16_16_FLOAT 0x00000010 +#define FMT_8_24 0x00000011 +#define FMT_8_24_FLOAT 0x00000012 +#define FMT_24_8 0x00000013 +#define FMT_24_8_FLOAT 0x00000014 +#define FMT_10_11_11 0x00000015 +#define FMT_10_11_11_FLOAT 0x00000016 +#define FMT_11_11_10 0x00000017 +#define FMT_11_11_10_FLOAT 0x00000018 +#define FMT_2_10_10_10 0x00000019 +#define FMT_8_8_8_8 0x0000001A +#define FMT_10_10_10_2 0x0000001B +#define FMT_X24_8_32_FLOAT 0x0000001C +#define FMT_32_32 0x0000001D +#define FMT_32_32_FLOAT 0x0000001E +#define FMT_16_16_16_16 0x0000001F +#define FMT_16_16_16_16_FLOAT 0x00000020 +#define FMT_32_32_32_32 0x00000022 +#define FMT_32_32_32_32_FLOAT 0x00000023 +#define FMT_1 0x00000025 +#define FMT_GB_GR 0x00000027 +#define FMT_BG_RG 0x00000028 +#define FMT_32_AS_8 0x00000029 +#define FMT_32_AS_8_8 0x0000002a +#define FMT_5_9_9_9_SHAREDEXP 0x0000002b +#define FMT_8_8_8 0x0000002c +#define FMT_16_16_16 0x0000002d +#define FMT_16_16_16_FLOAT 0x0000002e +#define FMT_32_32_32 0x0000002f +#define FMT_32_32_32_FLOAT 0x00000030 +#define FMT_BC1 0x00000031 +#define FMT_BC2 0x00000032 +#define FMT_BC3 0x00000033 +#define FMT_BC4 0x00000034 +#define FMT_BC5 0x00000035 + +#endif diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 29a29d87cd..1c1978f8ab 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -25,6 +25,7 @@ #include "util/u_format.h" #include "r600d.h" +#include "r600_formats.h" static INLINE uint32_t r600_translate_blend_function(int blend_func) { @@ -352,13 +353,13 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format) /* 64-bit buffers. */ case PIPE_FORMAT_R16G16B16A16_UNORM: case PIPE_FORMAT_R16G16B16A16_SNORM: - // return V_0280A0_COLOR_16_16_16_16; + // return FMT_16_16_16_16; case PIPE_FORMAT_R16G16B16A16_FLOAT: - // return V_0280A0_COLOR_16_16_16_16_FLOAT; + // return FMT_16_16_16_16_FLOAT; /* 128-bit buffers. */ case PIPE_FORMAT_R32G32B32A32_FLOAT: - // return V_0280A0_COLOR_32_32_32_32_FLOAT; + // return FMT_32_32_32_32_FLOAT; return 0; default: R600_ERR("unsupported colorswap format %d\n", format); @@ -522,32 +523,32 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) case 16: switch (desc->nr_channels) { case 1: - result = V_038008_FMT_16_FLOAT; + result = FMT_16_FLOAT; break; case 2: - result = V_038008_FMT_16_16_FLOAT; + result = FMT_16_16_FLOAT; break; case 3: - result = V_038008_FMT_16_16_16_FLOAT; + result = FMT_16_16_16_FLOAT; break; case 4: - result = V_038008_FMT_16_16_16_16_FLOAT; + result = FMT_16_16_16_16_FLOAT; break; } break; case 32: switch (desc->nr_channels) { case 1: - result = V_038008_FMT_32_FLOAT; + result = FMT_32_FLOAT; break; case 2: - result = V_038008_FMT_32_32_FLOAT; + result = FMT_32_32_FLOAT; break; case 3: - result = V_038008_FMT_32_32_32_FLOAT; + result = FMT_32_32_32_FLOAT; break; case 4: - result = V_038008_FMT_32_32_32_32_FLOAT; + result = FMT_32_32_32_32_FLOAT; break; } break; @@ -563,48 +564,48 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format) case 8: switch (desc->nr_channels) { case 1: - result = V_038008_FMT_8; + result = FMT_8; break; case 2: - result = V_038008_FMT_8_8; + result = FMT_8_8; break; case 3: - // result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */ + // result = FMT_8_8_8; /* fails piglit draw-vertices test */ // break; case 4: - result = V_038008_FMT_8_8_8_8; + result = FMT_8_8_8_8; break; } break; case 16: switch (desc->nr_channels) { case 1: - result = V_038008_FMT_16; + result = FMT_16; break; case 2: - result = V_038008_FMT_16_16; + result = FMT_16_16; break; case 3: - // result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */ + // result = FMT_16_16_16; /* fails piglit draw-vertices test */ // break; case 4: - result = V_038008_FMT_16_16_16_16; + result = FMT_16_16_16_16; break; } break; case 32: switch (desc->nr_channels) { case 1: - result = V_038008_FMT_32; + result = FMT_32; break; case 2: - result = V_038008_FMT_32_32; + result = FMT_32_32; break; case 3: - result = V_038008_FMT_32_32_32; + result = FMT_32_32_32; break; case 4: - result = V_038008_FMT_32_32_32_32; + result = FMT_32_32_32_32; break; } break; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 22fe8bf0f3..152cd9210f 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -35,6 +35,7 @@ #include "r600_resource.h" #include "r600_state_inlines.h" #include "r600d.h" +#include "r600_formats.h" extern struct u_resource_vtbl r600_texture_vtbl; @@ -565,19 +566,19 @@ uint32_t r600_translate_texformat(enum pipe_format format, case UTIL_FORMAT_COLORSPACE_ZS: switch (format) { case PIPE_FORMAT_Z16_UNORM: - result = V_0280A0_COLOR_16; + result = FMT_16; goto out_word4; case PIPE_FORMAT_X24S8_USCALED: word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT); case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - result = V_0280A0_COLOR_8_24; + result = FMT_8_24; goto out_word4; case PIPE_FORMAT_S8X24_USCALED: word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT); case PIPE_FORMAT_X8Z24_UNORM: case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - result = V_0280A0_COLOR_24_8; + result = FMT_24_8; goto out_word4; case PIPE_FORMAT_S8_USCALED: result = V_0280A0_COLOR_8; @@ -635,7 +636,7 @@ uint32_t r600_translate_texformat(enum pipe_format format, if (desc->channel[0].size == 5 && desc->channel[1].size == 6 && desc->channel[2].size == 5) { - result = V_0280A0_COLOR_5_6_5; + result = FMT_5_6_5; goto out_word4; } goto out_unknown; @@ -644,14 +645,14 @@ uint32_t r600_translate_texformat(enum pipe_format format, desc->channel[1].size == 5 && desc->channel[2].size == 5 && desc->channel[3].size == 1) { - result = V_0280A0_COLOR_1_5_5_5; + result = FMT_1_5_5_5; goto out_word4; } if (desc->channel[0].size == 10 && desc->channel[1].size == 10 && desc->channel[2].size == 10 && desc->channel[3].size == 2) { - result = V_0280A0_COLOR_10_10_10_2; + result = FMT_10_10_10_2; goto out_word4; } goto out_unknown; @@ -682,36 +683,36 @@ uint32_t r600_translate_texformat(enum pipe_format format, case 4: switch (desc->nr_channels) { case 2: - result = V_0280A0_COLOR_4_4; + result = FMT_4_4; goto out_word4; case 4: - result = V_0280A0_COLOR_4_4_4_4; + result = FMT_4_4_4_4; goto out_word4; } goto out_unknown; case 8: switch (desc->nr_channels) { case 1: - result = V_0280A0_COLOR_8; + result = FMT_8; goto out_word4; case 2: - result = V_0280A0_COLOR_8_8; + result = FMT_8_8; goto out_word4; case 4: - result = V_0280A0_COLOR_8_8_8_8; + result = FMT_8_8_8_8; goto out_word4; } goto out_unknown; case 16: switch (desc->nr_channels) { case 1: - result = V_0280A0_COLOR_16; + result = FMT_16; goto out_word4; case 2: - result = V_0280A0_COLOR_16_16; + result = FMT_16_16; goto out_word4; case 4: - result = V_0280A0_COLOR_16_16_16_16; + result = FMT_16_16_16_16; goto out_word4; } } @@ -722,26 +723,26 @@ uint32_t r600_translate_texformat(enum pipe_format format, case 16: switch (desc->nr_channels) { case 1: - result = V_0280A0_COLOR_16_FLOAT; + result = FMT_16_FLOAT; goto out_word4; case 2: - result = V_0280A0_COLOR_16_16_FLOAT; + result = FMT_16_16_FLOAT; goto out_word4; case 4: - result = V_0280A0_COLOR_16_16_16_16_FLOAT; + result = FMT_16_16_16_16_FLOAT; goto out_word4; } goto out_unknown; case 32: switch (desc->nr_channels) { case 1: - result = V_0280A0_COLOR_32_FLOAT; + result = FMT_32_FLOAT; goto out_word4; case 2: - result = V_0280A0_COLOR_32_32_FLOAT; + result = FMT_32_32_FLOAT; goto out_word4; case 4: - result = V_0280A0_COLOR_32_32_32_32_FLOAT; + result = FMT_32_32_32_32_FLOAT; goto out_word4; } } diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index f32f5286c9..76df62ffc3 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -1028,45 +1028,7 @@ #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_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 e8e20313afbdf3a38e5a10e6fa566864452eeb2c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 11:56:12 +1000 Subject: r600g: add defines for tiling --- src/gallium/drivers/r600/r600d.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 76df62ffc3..a3cb5b8600 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -904,6 +904,10 @@ #define S_038000_TILE_MODE(x) (((x) & 0xF) << 3) #define G_038000_TILE_MODE(x) (((x) >> 3) & 0xF) #define C_038000_TILE_MODE 0xFFFFFF87 +#define V_038000_ARRAY_LINEAR_GENERAL 0x00000000 +#define V_038000_ARRAY_LINEAR_ALIGNED 0x00000001 +#define V_038000_ARRAY_1D_TILED_THIN1 0x00000002 +#define V_038000_ARRAY_2D_TILED_THIN1 0x00000004 #define S_038000_TILE_TYPE(x) (((x) & 0x1) << 7) #define G_038000_TILE_TYPE(x) (((x) >> 7) & 0x1) #define C_038000_TILE_TYPE 0xFFFFFF7F -- cgit v1.2.3 From 7b3fa038830663de9bceded1b0dd2d64b8cf39c4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 11:56:43 +1000 Subject: r600g: get tiling info from kernel --- src/gallium/drivers/r600/r600.h | 7 ++++ src/gallium/drivers/r600/r600_pipe.c | 2 ++ src/gallium/drivers/r600/r600_pipe.h | 1 + src/gallium/winsys/r600/drm/r600.c | 5 +++ src/gallium/winsys/r600/drm/r600_drm.c | 62 +++++++++++++++++++++++++++++++++ src/gallium/winsys/r600/drm/r600_priv.h | 1 + 6 files changed, 78 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 24e25cec0d..15ee001106 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -99,8 +99,15 @@ enum chip_class { EVERGREEN, }; +struct r600_tiling_info { + unsigned num_channels; + unsigned num_banks; + unsigned group_bytes; +}; + enum radeon_family r600_get_family(struct radeon *rw); enum chip_class r600_get_family_class(struct radeon *radeon); +struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon); /* r600_bo.c */ struct r600_bo; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 8eb9799323..dd8fa4fcd7 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -443,5 +443,7 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon) r600_init_screen_texture_functions(&rscreen->screen); r600_init_screen_resource_functions(&rscreen->screen); + rscreen->tiling_info = r600_get_tiling_info(radeon); + return &rscreen->screen; } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 47a1b3070e..35548329e4 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -58,6 +58,7 @@ enum r600_pipe_state_id { struct r600_screen { struct pipe_screen screen; struct radeon *radeon; + struct r600_tiling_info *tiling_info; }; struct r600_pipe_sampler_view { diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c index 496547ca99..0a4d2e791d 100644 --- a/src/gallium/winsys/r600/drm/r600.c +++ b/src/gallium/winsys/r600/drm/r600.c @@ -40,6 +40,11 @@ enum chip_class r600_get_family_class(struct radeon *radeon) return radeon->chip_class; } +struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon) +{ + return &radeon->tiling_info; +} + static int r600_get_device(struct radeon *r600) { struct drm_radeon_info info; diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 4916843fd6..c9de95ffc0 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -37,6 +37,9 @@ #include "xf86drm.h" #include "radeon_drm.h" +#ifndef RADEON_INFO_TILING_CONFIG +#define RADEON_INFO_TILING_CONFIG 0x6 +#endif static int radeon_get_device(struct radeon *radeon) { struct drm_radeon_info info; @@ -50,6 +53,61 @@ static int radeon_get_device(struct radeon *radeon) return r; } +static int radeon_drm_get_tiling(struct radeon *radeon) +{ + struct drm_radeon_info info; + int r; + uint32_t tiling_config; + + info.request = RADEON_INFO_TILING_CONFIG; + info.value = (uintptr_t)&tiling_config; + r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info, + sizeof(struct drm_radeon_info)); + + if (r) + return r; + + switch ((tiling_config & 0xe) >> 1) { + case 0: + radeon->tiling_info.num_channels = 1; + break; + case 1: + radeon->tiling_info.num_channels = 2; + break; + case 2: + radeon->tiling_info.num_channels = 4; + break; + case 3: + radeon->tiling_info.num_channels = 8; + break; + default: + return -EINVAL; + } + + switch ((tiling_config & 0x30) >> 4) { + case 0: + radeon->tiling_info.num_banks = 4; + break; + case 1: + radeon->tiling_info.num_banks = 8; + break; + default: + return -EINVAL; + + } + switch ((tiling_config & 0xc0) >> 6) { + case 0: + radeon->tiling_info.group_bytes = 256; + break; + case 1: + radeon->tiling_info.group_bytes = 512; + break; + default: + return -EINVAL; + } + return 0; +} + struct radeon *radeon_new(int fd, unsigned device) { struct radeon *radeon; @@ -157,6 +215,10 @@ struct radeon *radeon_new(int fd, unsigned device) break; } + if (radeon->chip_class == R600 || radeon->chip_class == R700) { + if (radeon_drm_get_tiling(radeon)) + return NULL; + } radeon->kman = radeon_bo_pbmgr_create(radeon); if (!radeon->kman) return NULL; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index e3868d3cb9..08e243b00d 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -42,6 +42,7 @@ struct radeon { enum chip_class chip_class; struct pb_manager *kman; /* kernel bo manager */ struct pb_manager *cman; /* cached bo manager */ + struct r600_tiling_info tiling_info; }; struct radeon *r600_new(int fd, unsigned device); -- cgit v1.2.3 From 5b966f58e3d87fc271cc429be969cf98eec991ca Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 8 Oct 2010 11:57:04 +1000 Subject: r600g: set tiling bits in hw state --- src/gallium/drivers/r600/r600_state.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 2c0a2005cf..00234f956a 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -657,6 +657,10 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c bo[1] = rbuffer->bo; } pitch = align(tmp->pitch_in_pixels[0], 8); + if (tmp->tiled) { + array_mode = tmp->array_mode; + tile_type = tmp->tile_type; + } /* FIXME properly handle first level != 0 */ r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, @@ -957,6 +961,7 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta swap = r600_translate_colorswap(rtex->resource.base.b.format); color_info = S_0280A0_FORMAT(format) | S_0280A0_COMP_SWAP(swap) | + S_0280A0_ARRAY_MODE(rtex->array_mode); S_0280A0_BLEND_CLAMP(1) | S_0280A0_NUMBER_TYPE(ntype); if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) -- cgit v1.2.3 From 4dfb43c6a655574a9b59b552d05408c027d8cfaa Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 17 Oct 2010 13:41:45 -0700 Subject: gallivm: Comment lp_build_insert_new_block(). --- src/gallium/auxiliary/gallivm/lp_bld_flow.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index f9d061fcb4..a2cee199a0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -39,6 +39,14 @@ /** + * Insert a new block, right where builder is pointing to. + * + * This is useful important not only for aesthetic reasons, but also for + * performance reasons, as frequently run blocks should be laid out next to + * each other and fall-throughs maximized. + * + * See also llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp. + * * Note: this function has no dependencies on the flow code and could * be used elsewhere. */ -- cgit v1.2.3 From ca2b2ac131933b4171b519813df1aaa3a81621cd Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 17 Oct 2010 18:48:11 -0700 Subject: llvmpipe: fail cleanly on malloc failure in lp_setup_alloc_triangle --- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index c6cb9afda4..15c414d8c3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -86,9 +86,10 @@ lp_setup_alloc_triangle(struct lp_scene *scene, plane_sz); tri = lp_scene_alloc_aligned( scene, *tri_size, 16 ); - if (tri) { - tri->inputs.stride = input_array_sz; - } + if (tri == NULL) + return NULL; + + tri->inputs.stride = input_array_sz; { char *a = (char *)tri; @@ -96,7 +97,6 @@ lp_setup_alloc_triangle(struct lp_scene *scene, assert(b - a == *tri_size); } - return tri; } -- cgit v1.2.3