summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-03-22 18:11:12 -0600
committerBrian Paul <[email protected]>2009-03-22 18:11:12 -0600
commitbab6d6bfe928687717a5e5f274110fe1838f99ba (patch)
tree1e738091f7a951b84e9971415efa9204cc0bf004
parent0f82aa5f15479aea692613fb56643bf3b769cf37 (diff)
softpipe: reformatting, comments, minor clean-ups
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c17
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_llvm.c14
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c25
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_fs.c21
4 files changed, 47 insertions, 30 deletions
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 0c14d92864f..9ee86fe7878 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -25,22 +25,29 @@
*
**************************************************************************/
+/**
+ * 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 */
};
@@ -106,8 +113,6 @@ exec_prepare( const struct sp_fragment_shader *base,
}
-
-
/* TODO: hide the machine struct in here somewhere, remove from this
* interface:
*/
@@ -116,7 +121,6 @@ exec_run( const struct sp_fragment_shader *base,
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,
@@ -126,7 +130,6 @@ exec_run( const struct sp_fragment_shader *base,
}
-
static void
exec_delete( struct sp_fragment_shader *base )
{
@@ -135,9 +138,6 @@ 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)
@@ -160,4 +160,3 @@ softpipe_create_fs_exec(struct softpipe_context *softpipe,
return &shader->base;
}
-
diff --git a/src/gallium/drivers/softpipe/sp_fs_llvm.c b/src/gallium/drivers/softpipe/sp_fs_llvm.c
index f33b3e32854..95c0d982d12 100644
--- a/src/gallium/drivers/softpipe/sp_fs_llvm.c
+++ b/src/gallium/drivers/softpipe/sp_fs_llvm.c
@@ -25,7 +25,9 @@
*
**************************************************************************/
-/* Authors:
+/**
+ * Execute fragment shader using LLVM code generation.
+ * Authors:
* Zack Rusin
*/
@@ -33,7 +35,6 @@
#include "sp_state.h"
#include "sp_fs.h"
-
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
@@ -41,11 +42,16 @@
#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)
@@ -160,7 +166,7 @@ delete_llvm_fs( struct sp_fragment_shader *base )
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;
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index 366abe2ed49..31c3ca21c51 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -25,13 +25,15 @@
*
**************************************************************************/
+/**
+ * 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"
@@ -56,14 +58,25 @@ typedef void (PIPE_CDECL *codegen_function)(
);
-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,
@@ -83,7 +96,7 @@ fs_sse_run( 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,
@@ -110,7 +123,7 @@ fs_sse_run( const struct sp_fragment_shader *base,
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);
@@ -156,7 +169,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe,
#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,
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c
index adca5df73d8..ca637a1d6a4 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -65,14 +65,11 @@ quad_shade_stage(struct quad_stage *qs)
}
-
/**
* 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;
@@ -85,9 +82,7 @@ shade_quad(
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;
@@ -135,15 +130,17 @@ shade_quad(
}
/* 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;
@@ -157,7 +154,8 @@ static void shade_begin(struct quad_stage *qs)
}
-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;
@@ -168,7 +166,8 @@ static void shade_destroy(struct quad_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);