cell_state_shader.c File Reference

Include dependency graph for cell_state_shader.c:

Go to the source code of this file.

Functions

static struct
cell_fragment_shader_state
cell_fragment_shader_state (void *shader)
 cast wrapper
static struct
cell_vertex_shader_state
cell_vertex_shader_state (void *shader)
 cast wrapper
static void * cell_create_fs_state (struct pipe_context *pipe, const struct pipe_shader_state *templ)
 Create fragment shader state.
static void cell_bind_fs_state (struct pipe_context *pipe, void *fs)
 Called via pipe->bind_fs_state().
static void cell_delete_fs_state (struct pipe_context *pipe, void *fs)
 Called via pipe->delete_fs_state().
static void * cell_create_vs_state (struct pipe_context *pipe, const struct pipe_shader_state *templ)
 Create vertex shader state.
static void cell_bind_vs_state (struct pipe_context *pipe, void *vs)
 Called via pipe->bind_vs_state().
static void cell_delete_vs_state (struct pipe_context *pipe, void *vs)
 Called via pipe->delete_vs_state().
static void cell_set_constant_buffer (struct pipe_context *pipe, uint shader, uint index, const struct pipe_constant_buffer *buf)
 Called via pipe->set_constant_buffer().
void cell_init_shader_functions (struct cell_context *cell)


Function Documentation

static void cell_bind_fs_state ( struct pipe_context pipe,
void *  fs 
) [static]

Called via pipe->bind_fs_state().

Definition at line 89 of file cell_state_shader.c.

References cell_context(), cell_fragment_shader_state(), CELL_NEW_FS, cell_context::dirty, and cell_context::fs.

00090 {
00091    struct cell_context *cell = cell_context(pipe);
00092 
00093    cell->fs = cell_fragment_shader_state(fs);
00094 
00095    cell->dirty |= CELL_NEW_FS;
00096 }

static void cell_bind_vs_state ( struct pipe_context pipe,
void *  vs 
) [static]

Called via pipe->bind_vs_state().

Definition at line 152 of file cell_state_shader.c.

References cell_context(), CELL_NEW_VS, cell_vertex_shader_state(), cell_context::dirty, cell_context::draw, draw_bind_vertex_shader(), cell_vertex_shader_state::draw_data, and cell_context::vs.

00153 {
00154    struct cell_context *cell = cell_context(pipe);
00155 
00156    cell->vs = cell_vertex_shader_state(vs);
00157 
00158    draw_bind_vertex_shader(cell->draw,
00159                            (cell->vs ? cell->vs->draw_data : NULL));
00160 
00161    cell->dirty |= CELL_NEW_VS;
00162 }

static void* cell_create_fs_state ( struct pipe_context pipe,
const struct pipe_shader_state templ 
) [static]

Create fragment shader state.

Called via pipe->create_fs_state()

Definition at line 61 of file cell_state_shader.c.

References CALLOC_STRUCT, cell_context(), cell_gen_fragment_program(), cell_fragment_shader_state::code, FREE, cell_fragment_shader_state::info, cell_fragment_shader_state::shader, tgsi_dup_tokens(), tgsi_scan_shader(), and pipe_shader_state::tokens.

00063 {
00064    struct cell_context *cell = cell_context(pipe);
00065    struct cell_fragment_shader_state *cfs;
00066 
00067    cfs = CALLOC_STRUCT(cell_fragment_shader_state);
00068    if (!cfs)
00069       return NULL;
00070 
00071    cfs->shader.tokens = tgsi_dup_tokens(templ->tokens);
00072    if (!cfs->shader.tokens) {
00073       FREE(cfs);
00074       return NULL;
00075    }
00076 
00077    tgsi_scan_shader(templ->tokens, &cfs->info);
00078 
00079    cell_gen_fragment_program(cell, cfs->shader.tokens, &cfs->code);
00080 
00081    return cfs;
00082 }

static void* cell_create_vs_state ( struct pipe_context pipe,
const struct pipe_shader_state templ 
) [static]

Create vertex shader state.

Called via pipe->create_vs_state()

Definition at line 119 of file cell_state_shader.c.

References CALLOC_STRUCT, cell_context(), cell_context::draw, draw_create_vertex_shader(), cell_vertex_shader_state::draw_data, FREE, cell_vertex_shader_state::info, cell_vertex_shader_state::shader, tgsi_dup_tokens(), tgsi_scan_shader(), and pipe_shader_state::tokens.

00121 {
00122    struct cell_context *cell = cell_context(pipe);
00123    struct cell_vertex_shader_state *cvs;
00124 
00125    cvs = CALLOC_STRUCT(cell_vertex_shader_state);
00126    if (!cvs)
00127       return NULL;
00128 
00129    cvs->shader.tokens = tgsi_dup_tokens(templ->tokens);
00130    if (!cvs->shader.tokens) {
00131       FREE(cvs);
00132       return NULL;
00133    }
00134 
00135    tgsi_scan_shader(templ->tokens, &cvs->info);
00136 
00137    cvs->draw_data = draw_create_vertex_shader(cell->draw, &cvs->shader);
00138    if (cvs->draw_data == NULL) {
00139       FREE( (void *) cvs->shader.tokens );
00140       FREE( cvs );
00141       return NULL;
00142    }
00143 
00144    return cvs;
00145 }

static void cell_delete_fs_state ( struct pipe_context pipe,
void *  fs 
) [static]

Called via pipe->delete_fs_state().

Definition at line 103 of file cell_state_shader.c.

References cell_fragment_shader_state(), cell_fragment_shader_state::code, FREE, cell_fragment_shader_state::shader, spe_release_func(), and pipe_shader_state::tokens.

00104 {
00105    struct cell_fragment_shader_state *cfs = cell_fragment_shader_state(fs);
00106 
00107    spe_release_func(&cfs->code);
00108 
00109    FREE((void *) cfs->shader.tokens);
00110    FREE(cfs);
00111 }

static void cell_delete_vs_state ( struct pipe_context pipe,
void *  vs 
) [static]

Called via pipe->delete_vs_state().

Definition at line 169 of file cell_state_shader.c.

References cell_context(), cell_vertex_shader_state(), cell_context::draw, cell_vertex_shader_state::draw_data, draw_delete_vertex_shader(), FREE, cell_vertex_shader_state::shader, and pipe_shader_state::tokens.

00170 {
00171    struct cell_context *cell = cell_context(pipe);
00172    struct cell_vertex_shader_state *cvs = cell_vertex_shader_state(vs);
00173 
00174    draw_delete_vertex_shader(cell->draw, cvs->draw_data);
00175    FREE( (void *) cvs->shader.tokens );
00176    FREE( cvs );
00177 }

static struct cell_fragment_shader_state* cell_fragment_shader_state ( void *  shader  )  [static, read]

cast wrapper

Definition at line 42 of file cell_state_shader.c.

00043 {
00044    return (struct cell_fragment_shader_state *) shader;
00045 }

void cell_init_shader_functions ( struct cell_context cell  ) 

Definition at line 205 of file cell_state_shader.c.

References pipe_context::bind_fs_state, pipe_context::bind_vs_state, cell_bind_fs_state(), cell_bind_vs_state(), cell_create_fs_state(), cell_create_vs_state(), cell_delete_fs_state(), cell_delete_vs_state(), cell_set_constant_buffer(), pipe_context::create_fs_state, pipe_context::create_vs_state, pipe_context::delete_fs_state, pipe_context::delete_vs_state, cell_context::pipe, and pipe_context::set_constant_buffer.

static void cell_set_constant_buffer ( struct pipe_context pipe,
uint  shader,
uint  index,
const struct pipe_constant_buffer buf 
) [static]

Called via pipe->set_constant_buffer().

Definition at line 184 of file cell_state_shader.c.

References assert, pipe_constant_buffer::buffer, cell_context(), CELL_NEW_CONSTANTS, cell_context::constants, cell_context::dirty, PIPE_SHADER_TYPES, pipe_constant_buffer::size, pipe_context::winsys, and winsys_buffer_reference().

00187 {
00188    struct cell_context *cell = cell_context(pipe);
00189    struct pipe_winsys *ws = pipe->winsys;
00190 
00191    assert(shader < PIPE_SHADER_TYPES);
00192    assert(index == 0);
00193 
00194    /* note: reference counting */
00195    winsys_buffer_reference(ws,
00196                         &cell->constants[shader].buffer,
00197                         buf->buffer);
00198    cell->constants[shader].size = buf->size;
00199 
00200    cell->dirty |= CELL_NEW_CONSTANTS;
00201 }

static struct cell_vertex_shader_state* cell_vertex_shader_state ( void *  shader  )  [static, read]

cast wrapper

Definition at line 50 of file cell_state_shader.c.

00051 {
00052    return (struct cell_vertex_shader_state *) shader;
00053 }


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