Go to the source code of this file.
Data Structures | |
struct | sp_fragment_shader |
Subclass of pipe_shader_state (though it doesn't really need to be). More... | |
struct | sp_vertex_shader |
Subclass of pipe_shader_state. More... | |
Defines | |
#define | SP_NEW_VIEWPORT 0x1 |
#define | SP_NEW_RASTERIZER 0x2 |
#define | SP_NEW_FS 0x4 |
#define | SP_NEW_BLEND 0x8 |
#define | SP_NEW_CLIP 0x10 |
#define | SP_NEW_SCISSOR 0x20 |
#define | SP_NEW_STIPPLE 0x40 |
#define | SP_NEW_FRAMEBUFFER 0x80 |
#define | SP_NEW_DEPTH_STENCIL_ALPHA 0x100 |
#define | SP_NEW_CONSTANTS 0x200 |
#define | SP_NEW_SAMPLER 0x400 |
#define | SP_NEW_TEXTURE 0x800 |
#define | SP_NEW_VERTEX 0x1000 |
#define | SP_NEW_VS 0x2000 |
#define | SP_NEW_QUERY 0x4000 |
Functions | |
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_create_sampler_state (struct pipe_context *, const struct pipe_sampler_state *) |
void | softpipe_bind_sampler_states (struct pipe_context *, unsigned, void **) |
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 *) |
XXX move someday? Or consolidate all these simple state setters into one file. | |
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 *) |
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 *) |
XXX this might get moved someday Set the framebuffer surface info: color buffers, zbuffer, stencil buffer. | |
void | softpipe_set_blend_color (struct pipe_context *pipe, const struct pipe_blend_color *blend_color) |
void | softpipe_set_clip_state (struct pipe_context *, const struct pipe_clip_state *) |
void | softpipe_set_constant_buffer (struct pipe_context *, uint shader, uint index, const struct pipe_constant_buffer *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_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_sampler_textures (struct pipe_context *, unsigned num, struct pipe_texture **) |
void | softpipe_set_viewport_state (struct pipe_context *, const struct pipe_viewport_state *) |
void | softpipe_set_vertex_elements (struct pipe_context *, unsigned count, const struct pipe_vertex_element *) |
void | softpipe_set_vertex_buffers (struct pipe_context *, unsigned count, const struct pipe_vertex_buffer *) |
void | softpipe_update_derived (struct softpipe_context *softpipe) |
boolean | softpipe_draw_arrays (struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) |
boolean | softpipe_draw_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned mode, unsigned start, unsigned count) |
boolean | softpipe_draw_range_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned min_index, unsigned max_index, unsigned mode, unsigned start, unsigned count) |
Draw vertex arrays, with optional indexing. | |
void | softpipe_set_edgeflags (struct pipe_context *pipe, const unsigned *edgeflags) |
void | softpipe_map_surfaces (struct softpipe_context *sp) |
Map any drawing surfaces which aren't already mapped. | |
void | softpipe_unmap_surfaces (struct softpipe_context *sp) |
Unmap any mapped drawing surfaces. | |
void | softpipe_map_texture_surfaces (struct softpipe_context *sp) |
void | softpipe_unmap_texture_surfaces (struct softpipe_context *sp) |
struct vertex_info * | softpipe_get_vertex_info (struct softpipe_context *softpipe) |
The vertex info describes how to convert the post-transformed vertices (simple float[][4]) used by the 'draw' module into vertices for rasterization. | |
struct vertex_info * | softpipe_get_vbuf_vertex_info (struct softpipe_context *softpipe) |
Called from vbuf module. |
#define SP_NEW_BLEND 0x8 |
Definition at line 41 of file sp_state.h.
#define SP_NEW_CLIP 0x10 |
Definition at line 42 of file sp_state.h.
#define SP_NEW_CONSTANTS 0x200 |
Definition at line 47 of file sp_state.h.
#define SP_NEW_DEPTH_STENCIL_ALPHA 0x100 |
Definition at line 46 of file sp_state.h.
#define SP_NEW_FRAMEBUFFER 0x80 |
Definition at line 45 of file sp_state.h.
#define SP_NEW_FS 0x4 |
Definition at line 40 of file sp_state.h.
#define SP_NEW_QUERY 0x4000 |
Definition at line 52 of file sp_state.h.
#define SP_NEW_RASTERIZER 0x2 |
Definition at line 39 of file sp_state.h.
#define SP_NEW_SAMPLER 0x400 |
Definition at line 48 of file sp_state.h.
#define SP_NEW_SCISSOR 0x20 |
Definition at line 43 of file sp_state.h.
#define SP_NEW_STIPPLE 0x40 |
Definition at line 44 of file sp_state.h.
#define SP_NEW_TEXTURE 0x800 |
Definition at line 49 of file sp_state.h.
#define SP_NEW_VERTEX 0x1000 |
Definition at line 50 of file sp_state.h.
#define SP_NEW_VIEWPORT 0x1 |
Definition at line 38 of file sp_state.h.
#define SP_NEW_VS 0x2000 |
Definition at line 51 of file sp_state.h.
void softpipe_bind_blend_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 43 of file sp_state_blend.c.
References softpipe_context::blend, softpipe_context::dirty, softpipe_context(), and SP_NEW_BLEND.
00045 { 00046 struct softpipe_context *softpipe = softpipe_context(pipe); 00047 00048 softpipe->blend = (const struct pipe_blend_state *)blend; 00049 00050 softpipe->dirty |= SP_NEW_BLEND; 00051 }
void softpipe_bind_depth_stencil_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 84 of file sp_state_blend.c.
References softpipe_context::depth_stencil, softpipe_context::dirty, softpipe_context(), and SP_NEW_DEPTH_STENCIL_ALPHA.
00086 { 00087 struct softpipe_context *softpipe = softpipe_context(pipe); 00088 00089 softpipe->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; 00090 00091 softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; 00092 }
void softpipe_bind_fs_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 72 of file sp_state_fs.c.
References softpipe_context::dirty, softpipe_context::fs, softpipe_context(), and SP_NEW_FS.
00073 { 00074 struct softpipe_context *softpipe = softpipe_context(pipe); 00075 00076 softpipe->fs = (struct sp_fragment_shader *) fs; 00077 00078 softpipe->dirty |= SP_NEW_FS; 00079 }
void softpipe_bind_rasterizer_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 43 of file sp_state_rasterizer.c.
References softpipe_context::dirty, softpipe_context::draw, draw_set_rasterizer_state(), softpipe_context::rasterizer, softpipe_context(), and SP_NEW_RASTERIZER.
00045 { 00046 struct softpipe_context *softpipe = softpipe_context(pipe); 00047 00048 /* pass-through to draw module */ 00049 draw_set_rasterizer_state(softpipe->draw, setup); 00050 00051 softpipe->rasterizer = (struct pipe_rasterizer_state *)setup; 00052 00053 softpipe->dirty |= SP_NEW_RASTERIZER; 00054 }
void softpipe_bind_sampler_states | ( | struct pipe_context * | , | |
unsigned | , | |||
void ** | ||||
) |
Definition at line 55 of file sp_state_sampler.c.
References assert, softpipe_context::dirty, softpipe_context::draw, draw_flush(), softpipe_context::num_samplers, PIPE_MAX_SAMPLERS, softpipe_context::sampler, softpipe_context(), and SP_NEW_SAMPLER.
00057 { 00058 struct softpipe_context *softpipe = softpipe_context(pipe); 00059 unsigned i; 00060 00061 assert(num <= PIPE_MAX_SAMPLERS); 00062 00063 /* Check for no-op */ 00064 if (num == softpipe->num_samplers && 00065 !memcmp(softpipe->sampler, sampler, num * sizeof(void *))) 00066 return; 00067 00068 draw_flush(softpipe->draw); 00069 00070 for (i = 0; i < num; ++i) 00071 softpipe->sampler[i] = sampler[i]; 00072 for (i = num; i < PIPE_MAX_SAMPLERS; ++i) 00073 softpipe->sampler[i] = NULL; 00074 00075 softpipe->num_samplers = num; 00076 00077 softpipe->dirty |= SP_NEW_SAMPLER; 00078 }
void softpipe_bind_vs_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 116 of file sp_state_fs.c.
References softpipe_context::dirty, softpipe_context::draw, draw_bind_vertex_shader(), sp_vertex_shader::draw_data, softpipe_context(), SP_NEW_VS, and softpipe_context::vs.
00117 { 00118 struct softpipe_context *softpipe = softpipe_context(pipe); 00119 00120 softpipe->vs = (const struct sp_vertex_shader *)vs; 00121 00122 draw_bind_vertex_shader(softpipe->draw, 00123 (softpipe->vs ? softpipe->vs->draw_data : NULL)); 00124 00125 softpipe->dirty |= SP_NEW_VS; 00126 }
void* softpipe_create_blend_state | ( | struct pipe_context * | , | |
const struct pipe_blend_state * | ||||
) |
Definition at line 37 of file sp_state_blend.c.
References mem_dup().
00039 { 00040 return mem_dup(blend, sizeof(*blend)); 00041 }
void* softpipe_create_depth_stencil_state | ( | struct pipe_context * | , | |
const struct pipe_depth_stencil_alpha_state * | ||||
) |
XXX move someday? Or consolidate all these simple state setters into one file.
Definition at line 77 of file sp_state_blend.c.
References mem_dup().
00079 { 00080 return mem_dup(depth_stencil, sizeof(*depth_stencil)); 00081 }
void* softpipe_create_fs_state | ( | struct pipe_context * | , | |
const struct pipe_shader_state * | ||||
) |
Definition at line 43 of file sp_state_fs.c.
References assert, softpipe_context::dump_fs, sp_fragment_shader::info, softpipe_context(), softpipe_create_fs_exec(), softpipe_create_fs_llvm(), softpipe_create_fs_sse(), tgsi_dump(), tgsi_scan_shader(), and pipe_shader_state::tokens.
00045 { 00046 struct softpipe_context *softpipe = softpipe_context(pipe); 00047 struct sp_fragment_shader *state; 00048 00049 /* debug */ 00050 if (softpipe->dump_fs) 00051 tgsi_dump(templ->tokens, 0); 00052 00053 /* codegen */ 00054 state = softpipe_create_fs_llvm( softpipe, templ ); 00055 if (!state) { 00056 state = softpipe_create_fs_sse( softpipe, templ ); 00057 if (!state) { 00058 state = softpipe_create_fs_exec( softpipe, templ ); 00059 } 00060 } 00061 00062 assert(state); 00063 00064 /* get/save the summary info for this shader */ 00065 tgsi_scan_shader(templ->tokens, &state->info); 00066 00067 return state; 00068 }
void* softpipe_create_rasterizer_state | ( | struct pipe_context * | , | |
const struct pipe_rasterizer_state * | ||||
) |
Definition at line 37 of file sp_state_rasterizer.c.
References mem_dup().
00039 { 00040 return mem_dup(rast, sizeof(*rast)); 00041 }
void* softpipe_create_sampler_state | ( | struct pipe_context * | , | |
const struct pipe_sampler_state * | ||||
) |
Definition at line 47 of file sp_state_sampler.c.
References mem_dup().
00049 { 00050 return mem_dup(sampler, sizeof(*sampler)); 00051 }
void* softpipe_create_vs_state | ( | struct pipe_context * | , | |
const struct pipe_shader_state * | ||||
) |
Definition at line 94 of file sp_state_fs.c.
References CALLOC_STRUCT, softpipe_context::draw, draw_create_vertex_shader(), sp_vertex_shader::draw_data, FREE, and softpipe_context().
00096 { 00097 struct softpipe_context *softpipe = softpipe_context(pipe); 00098 struct sp_vertex_shader *state; 00099 00100 state = CALLOC_STRUCT(sp_vertex_shader); 00101 if (state == NULL ) { 00102 return NULL; 00103 } 00104 00105 state->draw_data = draw_create_vertex_shader(softpipe->draw, templ); 00106 if (state->draw_data == NULL) { 00107 FREE( state ); 00108 return NULL; 00109 } 00110 00111 return state; 00112 }
void softpipe_delete_blend_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 53 of file sp_state_blend.c.
References FREE.
00055 { 00056 FREE( blend ); 00057 }
void softpipe_delete_depth_stencil_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 95 of file sp_state_blend.c.
References FREE.
00096 { 00097 FREE( depth ); 00098 }
void softpipe_delete_fs_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 83 of file sp_state_fs.c.
References assert, sp_fragment_shader::delete, and softpipe_context().
00084 { 00085 struct sp_fragment_shader *state = fs; 00086 00087 assert(fs != softpipe_context(pipe)->fs); 00088 00089 state->delete( state ); 00090 }
void softpipe_delete_rasterizer_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 56 of file sp_state_rasterizer.c.
References FREE.
00058 { 00059 FREE( rasterizer ); 00060 }
void softpipe_delete_sampler_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 111 of file sp_state_sampler.c.
References FREE.
00113 { 00114 FREE( sampler ); 00115 }
void softpipe_delete_vs_state | ( | struct pipe_context * | , | |
void * | ||||
) |
Definition at line 130 of file sp_state_fs.c.
References softpipe_context::draw, sp_vertex_shader::draw_data, draw_delete_vertex_shader(), FREE, and softpipe_context().
00131 { 00132 struct softpipe_context *softpipe = softpipe_context(pipe); 00133 00134 struct sp_vertex_shader *state = 00135 (struct sp_vertex_shader *)vs; 00136 00137 draw_delete_vertex_shader(softpipe->draw, state->draw_data); 00138 FREE( state ); 00139 }
boolean softpipe_draw_arrays | ( | struct pipe_context * | pipe, | |
unsigned | mode, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Definition at line 98 of file sp_draw_arrays.c.
References softpipe_draw_elements().
00100 { 00101 return softpipe_draw_elements(pipe, NULL, 0, mode, start, count); 00102 }
boolean softpipe_draw_elements | ( | struct pipe_context * | pipe, | |
struct pipe_buffer * | indexBuffer, | |||
unsigned | indexSize, | |||
unsigned | mode, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Definition at line 183 of file sp_draw_arrays.c.
References softpipe_draw_range_elements().
00187 { 00188 return softpipe_draw_range_elements( pipe, indexBuffer, 00189 indexSize, 00190 0, 0xffffffff, 00191 mode, start, count ); 00192 }
boolean softpipe_draw_range_elements | ( | struct pipe_context * | pipe, | |
struct pipe_buffer * | indexBuffer, | |||
unsigned | indexSize, | |||
unsigned | min_index, | |||
unsigned | max_index, | |||
unsigned | mode, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Draw vertex arrays, with optional indexing.
Basically, map the vertex buffers (and drawing surfaces), then hand off the drawing to the 'draw' module.
XXX should the element buffer be specified/bound with a separate function?
Definition at line 115 of file sp_draw_arrays.c.
References pipe_vertex_buffer::buffer, softpipe_context::dirty, softpipe_context::draw, draw, draw_arrays(), draw_set_mapped_element_buffer(), draw_set_mapped_element_buffer_range(), draw_set_mapped_vertex_buffer(), softpipe_context::num_vertex_buffers, pipe_buffer_map(), pipe_buffer_unmap(), PIPE_BUFFER_USAGE_CPU_READ, softpipe_context::reduced_api_prim, reduced_prim, pipe_context::screen, softpipe_context(), softpipe_map_constant_buffers(), softpipe_map_surfaces(), softpipe_unmap_constant_buffers(), softpipe_update_derived(), TRUE, and softpipe_context::vertex_buffer.
00121 { 00122 struct softpipe_context *sp = softpipe_context(pipe); 00123 struct draw_context *draw = sp->draw; 00124 unsigned i; 00125 00126 sp->reduced_api_prim = reduced_prim[mode]; 00127 00128 if (sp->dirty) 00129 softpipe_update_derived( sp ); 00130 00131 softpipe_map_surfaces(sp); 00132 softpipe_map_constant_buffers(sp); 00133 00134 /* 00135 * Map vertex buffers 00136 */ 00137 for (i = 0; i < sp->num_vertex_buffers; i++) { 00138 void *buf 00139 = pipe_buffer_map(pipe->screen, 00140 sp->vertex_buffer[i].buffer, 00141 PIPE_BUFFER_USAGE_CPU_READ); 00142 draw_set_mapped_vertex_buffer(draw, i, buf); 00143 } 00144 /* Map index buffer, if present */ 00145 if (indexBuffer) { 00146 void *mapped_indexes 00147 = pipe_buffer_map(pipe->screen, indexBuffer, 00148 PIPE_BUFFER_USAGE_CPU_READ); 00149 draw_set_mapped_element_buffer_range(draw, indexSize, 00150 min_index, 00151 max_index, 00152 mapped_indexes); 00153 } 00154 else { 00155 /* no index/element buffer */ 00156 draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL); 00157 } 00158 00159 00160 /* draw! */ 00161 draw_arrays(draw, mode, start, count); 00162 00163 /* 00164 * unmap vertex/index buffers - will cause draw module to flush 00165 */ 00166 for (i = 0; i < sp->num_vertex_buffers; i++) { 00167 draw_set_mapped_vertex_buffer(draw, i, NULL); 00168 pipe_buffer_unmap(pipe->screen, sp->vertex_buffer[i].buffer); 00169 } 00170 if (indexBuffer) { 00171 draw_set_mapped_element_buffer(draw, 0, NULL); 00172 pipe_buffer_unmap(pipe->screen, indexBuffer); 00173 } 00174 00175 00176 /* Note: leave drawing surfaces mapped */ 00177 softpipe_unmap_constant_buffers(sp); 00178 00179 return TRUE; 00180 }
struct vertex_info* softpipe_get_vbuf_vertex_info | ( | struct softpipe_context * | softpipe | ) | [read] |
Called from vbuf module.
Note that there's actually two different vertex layouts in softpipe.
The normal one is computed in softpipe_get_vertex_info() above and is used by the point/line/tri "setup" code.
The other one (this one) is only used by the vbuf module (which is not normally used by default but used in testing). For the vbuf module, we basically want to pass-through the draw module's vertex layout as-is. When the softpipe vbuf code begins drawing, the normal vertex layout will come into play again.
Definition at line 153 of file sp_state_derived.c.
References softpipe_get_vertex_info(), and softpipe_context::vertex_info_vbuf.
00154 { 00155 (void) softpipe_get_vertex_info(softpipe); 00156 return &softpipe->vertex_info_vbuf; 00157 }
struct vertex_info* softpipe_get_vertex_info | ( | struct softpipe_context * | softpipe | ) | [read] |
The vertex info describes how to convert the post-transformed vertices (simple float[][4]) used by the 'draw' module into vertices for rasterization.
This function validates the vertex layout and returns a pointer to a vertex_info object.
Definition at line 59 of file sp_state_derived.c.
References assert, softpipe_context::draw, draw_compute_vertex_size(), draw_emit_vertex_attr(), draw_find_vs_output(), draw_num_vs_outputs(), EMIT_4F, pipe_rasterizer_state::flatshade, softpipe_context::fs, sp_fragment_shader::info, tgsi_shader_info::input_semantic_index, tgsi_shader_info::input_semantic_name, INTERP_CONSTANT, INTERP_LINEAR, INTERP_PERSPECTIVE, INTERP_POS, vertex_info::num_attribs, tgsi_shader_info::num_inputs, softpipe_context::psize_slot, softpipe_context::rasterizer, TGSI_SEMANTIC_COLOR, TGSI_SEMANTIC_FOG, TGSI_SEMANTIC_GENERIC, TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_PSIZE, softpipe_context::vbuf, softpipe_context::vertex_info, and softpipe_context::vertex_info_vbuf.
00060 { 00061 struct vertex_info *vinfo = &softpipe->vertex_info; 00062 00063 if (vinfo->num_attribs == 0) { 00064 /* compute vertex layout now */ 00065 const struct sp_fragment_shader *spfs = softpipe->fs; 00066 const enum interp_mode colorInterp 00067 = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; 00068 uint i; 00069 00070 if (softpipe->vbuf) { 00071 /* if using the post-transform vertex buffer, tell draw_vbuf to 00072 * simply emit the whole post-xform vertex as-is: 00073 */ 00074 struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; 00075 const uint num = draw_num_vs_outputs(softpipe->draw); 00076 uint i; 00077 00078 /* No longer any need to try and emit draw vertex_header info. 00079 */ 00080 vinfo_vbuf->num_attribs = 0; 00081 for (i = 0; i < num; i++) { 00082 draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i); 00083 } 00084 draw_compute_vertex_size(vinfo_vbuf); 00085 } 00086 00087 /* 00088 * Loop over fragment shader inputs, searching for the matching output 00089 * from the vertex shader. 00090 */ 00091 vinfo->num_attribs = 0; 00092 for (i = 0; i < spfs->info.num_inputs; i++) { 00093 int src; 00094 switch (spfs->info.input_semantic_name[i]) { 00095 case TGSI_SEMANTIC_POSITION: 00096 src = draw_find_vs_output(softpipe->draw, 00097 TGSI_SEMANTIC_POSITION, 0); 00098 draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); 00099 break; 00100 00101 case TGSI_SEMANTIC_COLOR: 00102 src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_COLOR, 00103 spfs->info.input_semantic_index[i]); 00104 draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); 00105 break; 00106 00107 case TGSI_SEMANTIC_FOG: 00108 src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_FOG, 0); 00109 draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); 00110 break; 00111 00112 case TGSI_SEMANTIC_GENERIC: 00113 /* this includes texcoords and varying vars */ 00114 src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC, 00115 spfs->info.input_semantic_index[i]); 00116 draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); 00117 break; 00118 00119 default: 00120 assert(0); 00121 } 00122 } 00123 00124 softpipe->psize_slot = draw_find_vs_output(softpipe->draw, 00125 TGSI_SEMANTIC_PSIZE, 0); 00126 if (softpipe->psize_slot > 0) { 00127 draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, 00128 softpipe->psize_slot); 00129 } 00130 00131 draw_compute_vertex_size(vinfo); 00132 } 00133 00134 return vinfo; 00135 }
void softpipe_map_surfaces | ( | struct softpipe_context * | sp | ) |
Map any drawing surfaces which aren't already mapped.
Definition at line 55 of file sp_context.c.
References softpipe_context::cbuf_cache, softpipe_context::framebuffer, pipe_framebuffer_state::num_cbufs, sp_tile_cache_map_surfaces(), and softpipe_context::zsbuf_cache.
00056 { 00057 unsigned i; 00058 00059 for (i = 0; i < sp->framebuffer.num_cbufs; i++) { 00060 sp_tile_cache_map_surfaces(sp->cbuf_cache[i]); 00061 } 00062 00063 sp_tile_cache_map_surfaces(sp->zsbuf_cache); 00064 }
void softpipe_map_texture_surfaces | ( | struct softpipe_context * | sp | ) |
void softpipe_set_blend_color | ( | struct pipe_context * | pipe, | |
const struct pipe_blend_color * | blend_color | |||
) |
Definition at line 60 of file sp_state_blend.c.
References softpipe_context::blend_color, softpipe_context::dirty, softpipe_context(), and SP_NEW_BLEND.
00062 { 00063 struct softpipe_context *softpipe = softpipe_context(pipe); 00064 00065 softpipe->blend_color = *blend_color; 00066 00067 softpipe->dirty |= SP_NEW_BLEND; 00068 }
void softpipe_set_clip_state | ( | struct pipe_context * | , | |
const struct pipe_clip_state * | ||||
) |
Definition at line 35 of file sp_state_clip.c.
References softpipe_context::draw, draw_set_clip_state(), and softpipe_context().
00037 { 00038 struct softpipe_context *softpipe = softpipe_context(pipe); 00039 00040 /* pass the clip state to the draw module */ 00041 draw_set_clip_state(softpipe->draw, clip); 00042 }
void softpipe_set_constant_buffer | ( | struct pipe_context * | , | |
uint | shader, | |||
uint | index, | |||
const struct pipe_constant_buffer * | buf | |||
) |
Definition at line 144 of file sp_state_fs.c.
References assert, pipe_constant_buffer::buffer, softpipe_context::constants, softpipe_context::dirty, PIPE_SHADER_TYPES, pipe_constant_buffer::size, softpipe_context(), SP_NEW_CONSTANTS, pipe_context::winsys, and winsys_buffer_reference().
00147 { 00148 struct softpipe_context *softpipe = softpipe_context(pipe); 00149 struct pipe_winsys *ws = pipe->winsys; 00150 00151 assert(shader < PIPE_SHADER_TYPES); 00152 assert(index == 0); 00153 00154 /* note: reference counting */ 00155 winsys_buffer_reference(ws, 00156 &softpipe->constants[shader].buffer, 00157 buf ? buf->buffer : NULL); 00158 softpipe->constants[shader].size = buf ? buf->size : 0; 00159 00160 softpipe->dirty |= SP_NEW_CONSTANTS; 00161 }
void softpipe_set_edgeflags | ( | struct pipe_context * | pipe, | |
const unsigned * | edgeflags | |||
) |
Definition at line 197 of file sp_draw_arrays.c.
References softpipe_context::draw, draw_set_edgeflags(), and softpipe_context().
00198 { 00199 struct softpipe_context *sp = softpipe_context(pipe); 00200 draw_set_edgeflags(sp->draw, edgeflags); 00201 }
void softpipe_set_framebuffer_state | ( | struct pipe_context * | pipe, | |
const struct pipe_framebuffer_state * | fb | |||
) |
XXX this might get moved someday Set the framebuffer surface info: color buffers, zbuffer, stencil buffer.
Here, we flush the old surfaces and update the tile cache to point to the new surfaces.
Definition at line 47 of file sp_state_surface.c.
References softpipe_context::cbuf_cache, pipe_framebuffer_state::cbufs, softpipe_context::dirty, softpipe_context::draw, draw_set_mrd(), pipe_surface::format, softpipe_context::framebuffer, pipe_framebuffer_state::height, pipe_framebuffer_state::num_cbufs, pf_get_component_bits(), PIPE_FORMAT_COMP_Z, PIPE_MAX_COLOR_BUFS, softpipe_context(), sp_flush_tile_cache(), SP_NEW_FRAMEBUFFER, sp_tile_cache_set_surface(), pipe_framebuffer_state::width, pipe_framebuffer_state::zsbuf, and softpipe_context::zsbuf_cache.
00049 { 00050 struct softpipe_context *sp = softpipe_context(pipe); 00051 uint i; 00052 00053 for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { 00054 /* check if changing cbuf */ 00055 if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) { 00056 /* flush old */ 00057 sp_flush_tile_cache(sp, sp->cbuf_cache[i]); 00058 00059 /* assign new */ 00060 sp->framebuffer.cbufs[i] = fb->cbufs[i]; 00061 00062 /* update cache */ 00063 sp_tile_cache_set_surface(sp->cbuf_cache[i], fb->cbufs[i]); 00064 } 00065 } 00066 00067 sp->framebuffer.num_cbufs = fb->num_cbufs; 00068 00069 /* zbuf changing? */ 00070 if (sp->framebuffer.zsbuf != fb->zsbuf) { 00071 /* flush old */ 00072 sp_flush_tile_cache(sp, sp->zsbuf_cache); 00073 00074 /* assign new */ 00075 sp->framebuffer.zsbuf = fb->zsbuf; 00076 00077 /* update cache */ 00078 sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf); 00079 } 00080 00081 #if 0 00082 /* XXX combined depth/stencil here */ 00083 00084 /* sbuf changing? */ 00085 if (sp->framebuffer.sbuf != fb->sbuf) { 00086 /* flush old */ 00087 sp_flush_tile_cache(sp, sp->sbuf_cache_sep); 00088 00089 /* assign new */ 00090 sp->framebuffer.sbuf = fb->sbuf; 00091 00092 /* update cache */ 00093 if (fb->sbuf != fb->zbuf) { 00094 /* separate stencil buf */ 00095 sp->sbuf_cache = sp->sbuf_cache_sep; 00096 sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf); 00097 } 00098 else { 00099 /* combined depth/stencil */ 00100 sp->sbuf_cache = sp->zbuf_cache; 00101 sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf); 00102 } 00103 } 00104 #endif 00105 00106 /* Tell draw module how deep the Z/depth buffer is */ 00107 { 00108 int depth_bits; 00109 double mrd; 00110 if (sp->framebuffer.zsbuf) { 00111 depth_bits = pf_get_component_bits(sp->framebuffer.zsbuf->format, 00112 PIPE_FORMAT_COMP_Z); 00113 } 00114 else { 00115 depth_bits = 0; 00116 } 00117 if (depth_bits > 16) { 00118 mrd = 0.0000001; 00119 } 00120 else { 00121 mrd = 0.00002; 00122 } 00123 draw_set_mrd(sp->draw, mrd); 00124 } 00125 00126 sp->framebuffer.width = fb->width; 00127 sp->framebuffer.height = fb->height; 00128 00129 sp->dirty |= SP_NEW_FRAMEBUFFER; 00130 }
void softpipe_set_polygon_stipple | ( | struct pipe_context * | , | |
const struct pipe_poly_stipple * | ||||
) |
Definition at line 70 of file sp_state_clip.c.
References softpipe_context::dirty, softpipe_context::draw, draw_flush(), softpipe_context::poly_stipple, softpipe_context(), and SP_NEW_STIPPLE.
00072 { 00073 struct softpipe_context *softpipe = softpipe_context(pipe); 00074 00075 draw_flush(softpipe->draw); 00076 00077 softpipe->poly_stipple = *stipple; /* struct copy */ 00078 softpipe->dirty |= SP_NEW_STIPPLE; 00079 }
void softpipe_set_sampler_textures | ( | struct pipe_context * | , | |
unsigned | num, | |||
struct pipe_texture ** | ||||
) |
Definition at line 82 of file sp_state_sampler.c.
References assert, softpipe_context::dirty, softpipe_context::draw, draw_flush(), softpipe_context::num_textures, PIPE_MAX_SAMPLERS, pipe_texture_reference(), softpipe_context(), SP_NEW_TEXTURE, sp_tile_cache_set_texture(), softpipe_context::tex_cache, and softpipe_context::texture.
00084 { 00085 struct softpipe_context *softpipe = softpipe_context(pipe); 00086 uint i; 00087 00088 assert(num <= PIPE_MAX_SAMPLERS); 00089 00090 /* Check for no-op */ 00091 if (num == softpipe->num_textures && 00092 !memcmp(softpipe->texture, texture, num * sizeof(struct pipe_texture *))) 00093 return; 00094 00095 draw_flush(softpipe->draw); 00096 00097 for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { 00098 struct pipe_texture *tex = i < num ? texture[i] : NULL; 00099 00100 pipe_texture_reference(&softpipe->texture[i], tex); 00101 sp_tile_cache_set_texture(pipe, softpipe->tex_cache[i], tex); 00102 } 00103 00104 softpipe->num_textures = num; 00105 00106 softpipe->dirty |= SP_NEW_TEXTURE; 00107 }
void softpipe_set_scissor_state | ( | struct pipe_context * | , | |
const struct pipe_scissor_state * | ||||
) |
Definition at line 58 of file sp_state_clip.c.
References softpipe_context::dirty, softpipe_context::draw, draw_flush(), softpipe_context::scissor, softpipe_context(), and SP_NEW_SCISSOR.
00060 { 00061 struct softpipe_context *softpipe = softpipe_context(pipe); 00062 00063 draw_flush(softpipe->draw); 00064 00065 softpipe->scissor = *scissor; /* struct copy */ 00066 softpipe->dirty |= SP_NEW_SCISSOR; 00067 }
void softpipe_set_vertex_buffers | ( | struct pipe_context * | , | |
unsigned | count, | |||
const struct pipe_vertex_buffer * | ||||
) |
Definition at line 59 of file sp_state_vertex.c.
References assert, softpipe_context::dirty, softpipe_context::draw, draw_set_vertex_buffers(), softpipe_context::num_vertex_buffers, PIPE_MAX_ATTRIBS, softpipe_context(), SP_NEW_VERTEX, and softpipe_context::vertex_buffer.
00062 { 00063 struct softpipe_context *softpipe = softpipe_context(pipe); 00064 00065 assert(count <= PIPE_MAX_ATTRIBS); 00066 00067 memcpy(softpipe->vertex_buffer, buffers, count * sizeof(buffers[0])); 00068 softpipe->num_vertex_buffers = count; 00069 00070 softpipe->dirty |= SP_NEW_VERTEX; 00071 00072 draw_set_vertex_buffers(softpipe->draw, count, buffers); 00073 }
void softpipe_set_vertex_elements | ( | struct pipe_context * | , | |
unsigned | count, | |||
const struct pipe_vertex_element * | ||||
) |
Definition at line 40 of file sp_state_vertex.c.
References assert, softpipe_context::dirty, softpipe_context::draw, draw_set_vertex_elements(), softpipe_context::num_vertex_elements, PIPE_MAX_ATTRIBS, softpipe_context(), SP_NEW_VERTEX, and softpipe_context::vertex_element.
00043 { 00044 struct softpipe_context *softpipe = softpipe_context(pipe); 00045 00046 assert(count <= PIPE_MAX_ATTRIBS); 00047 00048 memcpy(softpipe->vertex_element, attribs, 00049 count * sizeof(struct pipe_vertex_element)); 00050 softpipe->num_vertex_elements = count; 00051 00052 softpipe->dirty |= SP_NEW_VERTEX; 00053 00054 draw_set_vertex_elements(softpipe->draw, count, attribs); 00055 }
void softpipe_set_viewport_state | ( | struct pipe_context * | , | |
const struct pipe_viewport_state * | ||||
) |
Definition at line 45 of file sp_state_clip.c.
References softpipe_context::dirty, softpipe_context::draw, draw_set_viewport_state(), softpipe_context(), SP_NEW_VIEWPORT, and softpipe_context::viewport.
00047 { 00048 struct softpipe_context *softpipe = softpipe_context(pipe); 00049 00050 /* pass the viewport info to the draw module */ 00051 draw_set_viewport_state(softpipe->draw, viewport); 00052 00053 softpipe->viewport = *viewport; /* struct copy */ 00054 softpipe->dirty |= SP_NEW_VIEWPORT; 00055 }
void softpipe_unmap_surfaces | ( | struct softpipe_context * | sp | ) |
Unmap any mapped drawing surfaces.
Definition at line 71 of file sp_context.c.
References softpipe_context::cbuf_cache, softpipe_context::framebuffer, pipe_framebuffer_state::num_cbufs, sp_flush_tile_cache(), sp_tile_cache_unmap_surfaces(), and softpipe_context::zsbuf_cache.
00072 { 00073 uint i; 00074 00075 for (i = 0; i < sp->framebuffer.num_cbufs; i++) 00076 sp_flush_tile_cache(sp, sp->cbuf_cache[i]); 00077 sp_flush_tile_cache(sp, sp->zsbuf_cache); 00078 00079 for (i = 0; i < sp->framebuffer.num_cbufs; i++) { 00080 sp_tile_cache_unmap_surfaces(sp->cbuf_cache[i]); 00081 } 00082 sp_tile_cache_unmap_surfaces(sp->zsbuf_cache); 00083 }
void softpipe_unmap_texture_surfaces | ( | struct softpipe_context * | sp | ) |
void softpipe_update_derived | ( | struct softpipe_context * | softpipe | ) |
Definition at line 189 of file sp_state_derived.c.
References compute_cliprect(), softpipe_context::dirty, invalidate_vertex_layout(), sp_build_quad_pipeline(), SP_NEW_BLEND, SP_NEW_DEPTH_STENCIL_ALPHA, SP_NEW_FRAMEBUFFER, SP_NEW_FS, SP_NEW_QUERY, SP_NEW_RASTERIZER, SP_NEW_SCISSOR, and SP_NEW_VS.
00190 { 00191 if (softpipe->dirty & (SP_NEW_RASTERIZER | 00192 SP_NEW_FS | 00193 SP_NEW_VS)) 00194 invalidate_vertex_layout( softpipe ); 00195 00196 if (softpipe->dirty & (SP_NEW_SCISSOR | 00197 SP_NEW_DEPTH_STENCIL_ALPHA | 00198 SP_NEW_FRAMEBUFFER)) 00199 compute_cliprect(softpipe); 00200 00201 if (softpipe->dirty & (SP_NEW_BLEND | 00202 SP_NEW_DEPTH_STENCIL_ALPHA | 00203 SP_NEW_FRAMEBUFFER | 00204 SP_NEW_RASTERIZER | 00205 SP_NEW_FS | 00206 SP_NEW_QUERY)) 00207 sp_build_quad_pipeline(softpipe); 00208 00209 softpipe->dirty = 0; 00210 }