#include "cell_context.h"
#include "cell_state.h"
-
+#include "cell_gen_fp.h"
/** cast wrapper */
static INLINE struct cell_fragment_shader_state *
cell_fragment_shader_state(void *shader)
{
- return (struct pipe_shader_state *) shader;
+ return (struct cell_fragment_shader_state *) shader;
}
static INLINE struct cell_vertex_shader_state *
cell_vertex_shader_state(void *shader)
{
- return (struct pipe_shader_state *) shader;
+ return (struct cell_vertex_shader_state *) shader;
}
-
+/**
+ * Create fragment shader state.
+ * Called via pipe->create_fs_state()
+ */
static void *
cell_create_fs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
{
- /*struct cell_context *cell = cell_context(pipe);*/
+ struct cell_context *cell = cell_context(pipe);
struct cell_fragment_shader_state *cfs;
cfs = CALLOC_STRUCT(cell_fragment_shader_state);
tgsi_scan_shader(templ->tokens, &cfs->info);
+ cell_gen_fragment_program(cell, cfs->shader.tokens, &cfs->code);
+
return cfs;
}
+/**
+ * Called via pipe->bind_fs_state()
+ */
static void
cell_bind_fs_state(struct pipe_context *pipe, void *fs)
{
}
+/**
+ * Called via pipe->delete_fs_state()
+ */
static void
cell_delete_fs_state(struct pipe_context *pipe, void *fs)
{
struct cell_fragment_shader_state *cfs = cell_fragment_shader_state(fs);
+ spe_release_func(&cfs->code);
+
FREE((void *) cfs->shader.tokens);
FREE(cfs);
}
+/**
+ * Create vertex shader state.
+ * Called via pipe->create_vs_state()
+ */
static void *
cell_create_vs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
}
+/**
+ * Called via pipe->bind_vs_state()
+ */
static void
cell_bind_vs_state(struct pipe_context *pipe, void *vs)
{
}
+/**
+ * Called via pipe->delete_vs_state()
+ */
static void
cell_delete_vs_state(struct pipe_context *pipe, void *vs)
{
}
+/**
+ * Called via pipe->set_constant_buffer()
+ */
static void
cell_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
assert(index == 0);
/* note: reference counting */
- pipe_buffer_reference(ws,
+ winsys_buffer_reference(ws,
&cell->constants[shader].buffer,
buf->buffer);
cell->constants[shader].size = buf->size;
- cell->dirty |= CELL_NEW_CONSTANTS;
+ if (shader == PIPE_SHADER_VERTEX)
+ cell->dirty |= CELL_NEW_VS_CONSTANTS;
+ else if (shader == PIPE_SHADER_FRAGMENT)
+ cell->dirty |= CELL_NEW_FS_CONSTANTS;
}