aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_program.c
diff options
context:
space:
mode:
authorMiklós Máté <[email protected]>2016-03-24 01:12:57 +0100
committerMarek Olšák <[email protected]>2016-03-27 19:58:33 +0200
commitdee274477fb36aebc0ebf3eb1a9c58d875ad7a6f (patch)
tree59259ff1c40a7aa405256b19a9102429c236f7a6 /src/mesa/state_tracker/st_cb_program.c
parentd71c1e9e54d379ff312dca7eb4d717e3f20e4099 (diff)
st/mesa: implement GL_ATI_fragment_shader
v2: fix arithmetic for special opcodes, fix fog state, cleanup v3: simplify handling of special opcodes, fix rebinding with different textargets or fog equation, lots of formatting fixes v4: adapt to the compile early, fix later architecture, formatting fixes Signed-off-by: Miklós Máté <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_program.c')
-rw-r--r--src/mesa/state_tracker/st_cb_program.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 27cc0f3d154..d79cfe239e4 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -46,6 +46,7 @@
#include "st_mesa_to_tgsi.h"
#include "st_cb_program.h"
#include "st_glsl_to_tgsi.h"
+#include "st_atifs_to_tgsi.h"
@@ -302,6 +303,22 @@ st_program_string_notify( struct gl_context *ctx,
if (st->cp == stcp)
st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM;
}
+ else if (target == GL_FRAGMENT_SHADER_ATI) {
+ assert(prog);
+
+ struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
+ assert(stfp->ati_fs);
+ assert(stfp->ati_fs->Program == prog);
+
+ st_init_atifs_prog(ctx, prog);
+
+ st_release_fp_variants(st, stfp);
+ if (!st_translate_fragment_program(st, stfp))
+ return false;
+
+ if (st->fp == stfp)
+ st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ }
if (ST_DEBUG & DEBUG_PRECOMPILE ||
st->shader_has_one_variant[stage])
@@ -310,6 +327,19 @@ st_program_string_notify( struct gl_context *ctx,
return GL_TRUE;
}
+/**
+ * Called via ctx->Driver.NewATIfs()
+ * Called in glEndFragmentShaderATI()
+ */
+static struct gl_program *
+st_new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg)
+{
+ struct gl_program *prog = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
+ curProg->Id);
+ struct st_fragment_program *stfp = (struct st_fragment_program *)prog;
+ stfp->ati_fs = curProg;
+ return prog;
+}
/**
* Plug in the program and shader-related device driver functions.
@@ -322,6 +352,7 @@ st_init_program_functions(struct dd_function_table *functions)
functions->NewProgram = st_new_program;
functions->DeleteProgram = st_delete_program;
functions->ProgramStringNotify = st_program_string_notify;
+ functions->NewATIfs = st_new_ati_fs;
functions->LinkShader = st_link_shader;
}