summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2009-12-14 18:36:33 +0100
committerRoland Scheidegger <[email protected]>2009-12-14 18:36:33 +0100
commita0127b6ced257919180ba3a1bf534b68d9c750be (patch)
tree2b7393c210947a009b654c07da9c4732cc51bade /src/mesa
parenta08e348a84f57ed5e8bf5888f1ce13934d2ce8fa (diff)
gallium: more work for edgeflags changes
fixes, cleanups, etc. not working yet
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c4
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c10
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.h4
-rw-r--r--src/mesa/state_tracker/st_program.c15
4 files changed, 19 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index e209634c904..629bf8953eb 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -113,8 +113,8 @@ find_translated_vp(struct st_context *st,
* the input to the output. We'll need to use similar logic to set
* up the extra vertex_element input for edgeflags.
*/
- key.passthrough_edgeflags = (ctx->Polygon.FrontMode != GL_FILL ||
- ctx->Polygon.BackMode != GL_FILL);
+ key.passthrough_edgeflags = (st->ctx->Polygon.FrontMode != GL_FILL ||
+ st->ctx->Polygon.BackMode != GL_FILL);
/* Do we need to throw away old translations after a change in the
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 9fd670cac23..72bd17bf41d 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -738,11 +738,11 @@ emit_face_var( struct st_translate *t,
*
* \return array of translated tokens, caller's responsibility to free
*/
-const struct tgsi_token *
+enum pipe_error
st_translate_mesa_program(
GLcontext *ctx,
- struct ureg_program *ureg;
uint procType,
+ struct ureg_program *ureg,
const struct gl_program *program,
GLuint numInputs,
const GLuint inputMapping[],
@@ -755,7 +755,6 @@ st_translate_mesa_program(
const ubyte outputSemanticIndex[] )
{
struct st_translate translate, *t;
- const struct tgsi_token *tokens = NULL;
unsigned i;
t = &translate;
@@ -904,16 +903,15 @@ out:
if (t->error) {
debug_printf("%s: translate error flag set\n", __FUNCTION__);
- FREE((void *)tokens);
- tokens = NULL;
}
+/* ???
if (!tokens) {
debug_printf("%s: failed to translate Mesa program:\n", __FUNCTION__);
_mesa_print_program(program);
debug_assert(0);
}
-
+*/
return PIPE_ERROR_OUT_OF_MEMORY;
}
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h
index dc0362fe790..9dae373edef 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -30,6 +30,7 @@
#define ST_MESA_TO_TGSI_H
#include "main/mtypes.h"
+#include "tgsi/tgsi_ureg.h"
#if defined __cplusplus
@@ -39,10 +40,11 @@ extern "C" {
struct tgsi_token;
struct gl_program;
-const struct tgsi_token *
+enum pipe_error
st_translate_mesa_program(
GLcontext *ctx,
uint procType,
+ struct ureg_program *ureg,
const struct gl_program *program,
GLuint numInputs,
const GLuint inputMapping[],
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 876d92539e9..24f2387429e 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -193,6 +193,7 @@ st_translate_vertex_program(struct st_context *st,
struct st_vp_varient *vpv = CALLOC_STRUCT(st_vp_varient);
struct pipe_context *pipe = st->pipe;
struct ureg_program *ureg;
+ enum pipe_error error;
ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
if (ureg == NULL)
@@ -215,18 +216,18 @@ st_translate_vertex_program(struct st_context *st,
stvp->output_semantic_name,
stvp->output_semantic_index );
- if (ret)
+ if (error)
goto fail;
/* Edgeflags will be the last input:
*/
- if (key.passthrough_edgeflags) {
+ if (key->passthrough_edgeflags) {
ureg_MOV( ureg,
ureg_DECL_output( ureg, TGSI_SEMANTIC_EDGEFLAG, 0 ),
ureg_DECL_next_vs_input(ureg));
}
- tokens = ureg_get_tokens( ureg, NULL );
+ vpv->state.tokens = ureg_get_tokens( ureg, NULL );
ureg_destroy( ureg );
vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->state);
@@ -266,6 +267,7 @@ st_translate_fragment_program(struct st_context *st,
GLuint defaultInputMapping[FRAG_ATTRIB_MAX];
GLuint interpMode[16]; /* XXX size? */
GLuint attr;
+ enum pipe_error error;
const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
struct ureg_program *ureg;
GLuint vslot = 0;
@@ -404,12 +406,13 @@ st_translate_fragment_program(struct st_context *st,
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
if (ureg == NULL)
- return NULL;
+ return;
- stfp->state.tokens =
+ error =
st_translate_mesa_program(st->ctx,
TGSI_PROCESSOR_FRAGMENT,
+ ureg,
&stfp->Base.Base,
/* inputs */
fs_num_inputs,
@@ -423,6 +426,8 @@ st_translate_fragment_program(struct st_context *st,
fs_output_semantic_name,
fs_output_semantic_index );
+ stfp->state.tokens = ureg_get_tokens( ureg, NULL );
+ ureg_destroy( ureg );
stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->state);
if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {