summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-01-20 22:38:39 -0800
committerBrian Paul <brianp@vmware.com>2010-01-21 09:41:28 -0700
commite59353f592ef587d34279f0735f06053e289a7b4 (patch)
treea7c79166431453e19a7dee0bb17c5e19d2a4146b /src/mesa
parent1ca22855119508457b2cbd9a0a3b840e47a61eff (diff)
mesa: support for GL_ARB_fragment_coord_conventions
Signed-off-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/extensions.c1
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/shader/arbprogparse.c2
-rw-r--r--src/mesa/shader/program_parse_extra.c12
-rw-r--r--src/mesa/shader/program_parser.h2
5 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 00427aa580..ac7ff26b50 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -50,6 +50,7 @@ static const struct {
{ OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) },
{ ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
{ OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) },
+ { OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) },
{ OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
{ OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7eff5cadd0..919ddd7a29 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1762,6 +1762,8 @@ struct gl_fragment_program
struct gl_program Base; /**< base class */
GLenum FogOption;
GLboolean UsesKill; /**< shader uses KIL instruction */
+ GLboolean OriginUpperLeft;
+ GLboolean PixelCenterInteger;
};
@@ -2395,6 +2397,7 @@ struct gl_extensions
GLboolean ARB_depth_clamp;
GLboolean ARB_draw_buffers;
GLboolean ARB_draw_elements_base_vertex;
+ GLboolean ARB_fragment_coord_conventions;
GLboolean ARB_fragment_program;
GLboolean ARB_fragment_program_shadow;
GLboolean ARB_fragment_shader;
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index a09be71020..3e22a8a305 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -123,6 +123,8 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
case OPTION_FOG_LINEAR: program->FogOption = GL_LINEAR; break;
default: program->FogOption = GL_NONE; break;
}
+ program->OriginUpperLeft = state.option.OriginUpperLeft;
+ program->PixelCenterInteger = state.option.PixelCenterInteger;
program->UsesKill = state.fragment.UsesKill;
diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/shader/program_parse_extra.c
index 0656c5eaa8..ae98b782b7 100644
--- a/src/mesa/shader/program_parse_extra.c
+++ b/src/mesa/shader/program_parse_extra.c
@@ -216,6 +216,18 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option)
state->option.Shadow = 1;
return 1;
}
+ } else if (strncmp(option, "fragment_coord_", 15) == 0) {
+ option += 15;
+ if (state->ctx->Extensions.ARB_fragment_coord_conventions) {
+ if (strcmp(option, "origin_upper_left") == 0) {
+ state->option.OriginUpperLeft = 1;
+ return 1;
+ }
+ else if (strcmp(option, "pixel_center_integer") == 0) {
+ state->option.PixelCenterInteger = 1;
+ return 1;
+ }
+ }
}
} else if (strncmp(option, "NV_fragment_program", 19) == 0) {
option += 19;
diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h
index 69396ca2c0..730466c30f 100644
--- a/src/mesa/shader/program_parser.h
+++ b/src/mesa/shader/program_parser.h
@@ -209,6 +209,8 @@ struct asm_parser_state {
unsigned TexRect:1;
unsigned TexArray:1;
unsigned NV_fragment:1;
+ unsigned OriginUpperLeft:1;
+ unsigned PixelCenterInteger:1;
} option;
struct {