*
**************************************************************************/
+/**
+ * Execute fragment shader using the TGSI interpreter.
+ */
#include "sp_context.h"
#include "sp_state.h"
#include "sp_fs.h"
#include "sp_quad.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_parse.h"
+
+/**
+ * Subclass of sp_fragment_shader
+ */
struct sp_exec_fragment_shader
{
struct sp_fragment_shader base;
+ /* No other members for now */
};
}
-
-
/* TODO: hide the machine struct in here somewhere, remove from this
* interface:
*/
struct tgsi_exec_machine *machine,
struct quad_header *quad )
{
-
/* Compute X, Y, Z, W vals for this quad */
sp_setup_pos_vector(quad->posCoef,
(float)quad->input.x0, (float)quad->input.y0,
}
-
static void
exec_delete( struct sp_fragment_shader *base )
{
}
-
-
-
struct sp_fragment_shader *
softpipe_create_fs_exec(struct softpipe_context *softpipe,
const struct pipe_shader_state *templ)
return &shader->base;
}
-
*
**************************************************************************/
-/* Authors:
+/**
+ * Execute fragment shader using LLVM code generation.
+ * Authors:
* Zack Rusin
*/
#include "sp_state.h"
#include "sp_fs.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#if 0
-struct sp_llvm_fragment_shader {
+/**
+ * Subclass of sp_fragment_shader
+ */
+struct sp_llvm_fragment_shader
+{
struct sp_fragment_shader base;
struct gallivm_prog *llvm_prog;
};
+
static void
shade_quad_llvm(struct quad_stage *qs,
struct quad_header *quad)
struct sp_fragment_shader *
softpipe_create_fs_llvm(struct softpipe_context *softpipe,
- const struct pipe_shader_state *templ)
+ const struct pipe_shader_state *templ)
{
struct sp_llvm_fragment_shader *shader = NULL;
*
**************************************************************************/
+/**
+ * Execute fragment shader using runtime SSE code generation.
+ */
#include "sp_context.h"
#include "sp_state.h"
#include "sp_fs.h"
#include "sp_quad.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
);
-struct sp_sse_fragment_shader {
+/**
+ * Subclass of sp_fragment_shader
+ */
+struct sp_sse_fragment_shader
+{
struct sp_fragment_shader base;
- struct x86_function sse2_program;
+ struct x86_function sse2_program;
codegen_function func;
float immediates[TGSI_EXEC_NUM_IMMEDIATES][4];
};
+/** cast wrapper */
+static INLINE struct sp_sse_fragment_shader *
+sp_sse_fragment_shader(const struct sp_fragment_shader *base)
+{
+ return (struct sp_sse_fragment_shader *) base;
+}
+
static void
fs_sse_prepare( const struct sp_fragment_shader *base,
struct tgsi_exec_machine *machine,
struct quad_header *quad )
{
- struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+ struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base);
/* Compute X, Y, Z, W vals for this quad -- place in temp[0] for now */
sp_setup_pos_vector(quad->posCoef,
static void
fs_sse_delete( struct sp_fragment_shader *base )
{
- struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+ struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base);
x86_release_func( &shader->sse2_program );
FREE(shader);
#else
-/* Maybe put this varient in the header file.
+/* Maybe put this variant in the header file.
*/
struct sp_fragment_shader *
softpipe_create_fs_sse(struct softpipe_context *softpipe,
}
-
/**
* Execute fragment shader for the four fragments in the quad.
*/
static void
-shade_quad(
- struct quad_stage *qs,
- struct quad_header *quad )
+shade_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct quad_shade_stage *qss = quad_shade_stage( qs );
struct softpipe_context *softpipe = qs->softpipe;
machine->InterpCoefs = quad->coef;
/* run shader */
- quad->inout.mask &= softpipe->fs->run( softpipe->fs,
- &qss->machine,
- quad );
+ quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad );
/* store outputs */
z_written = FALSE;
}
/* shader may cull fragments */
- if( quad->inout.mask ) {
+ if (quad->inout.mask) {
qs->next->run( qs->next, quad );
}
}
+
/**
* Per-primitive (or per-begin?) setup
*/
-static void shade_begin(struct quad_stage *qs)
+static void
+shade_begin(struct quad_stage *qs)
{
struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
}
-static void shade_destroy(struct quad_stage *qs)
+static void
+shade_destroy(struct quad_stage *qs)
{
struct quad_shade_stage *qss = (struct quad_shade_stage *) qs;
}
-struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe )
+struct quad_stage *
+sp_quad_shade_stage( struct softpipe_context *softpipe )
{
struct quad_shade_stage *qss = CALLOC_STRUCT(quad_shade_stage);