sp_state_fs.c File Reference

Include dependency graph for sp_state_fs.c:

Go to the source code of this file.

Functions

void * softpipe_create_fs_state (struct pipe_context *pipe, const struct pipe_shader_state *templ)
void softpipe_bind_fs_state (struct pipe_context *pipe, void *fs)
void softpipe_delete_fs_state (struct pipe_context *pipe, void *fs)
void * softpipe_create_vs_state (struct pipe_context *pipe, const struct pipe_shader_state *templ)
void softpipe_bind_vs_state (struct pipe_context *pipe, void *vs)
void softpipe_delete_vs_state (struct pipe_context *pipe, void *vs)
void softpipe_set_constant_buffer (struct pipe_context *pipe, uint shader, uint index, const struct pipe_constant_buffer *buf)


Function Documentation

void softpipe_bind_fs_state ( struct pipe_context pipe,
void *  fs 
)

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_vs_state ( struct pipe_context pipe,
void *  vs 
)

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_fs_state ( struct pipe_context pipe,
const struct pipe_shader_state templ 
)

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_vs_state ( struct pipe_context pipe,
const struct pipe_shader_state templ 
)

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_fs_state ( struct pipe_context pipe,
void *  fs 
)

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_vs_state ( struct pipe_context pipe,
void *  vs 
)

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 }

void softpipe_set_constant_buffer ( struct pipe_context pipe,
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 }


Generated on Tue Sep 29 06:25:41 2009 for Gallium3D by  doxygen 1.5.4