mesa: support for GL_ARB_fragment_coord_conventions
authorLuca Barbieri <luca@luca-barbieri.com>
Thu, 21 Jan 2010 06:38:39 +0000 (22:38 -0800)
committerBrian Paul <brianp@vmware.com>
Thu, 21 Jan 2010 16:41:28 +0000 (09:41 -0700)
Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/main/extensions.c
src/mesa/main/mtypes.h
src/mesa/shader/arbprogparse.c
src/mesa/shader/program_parse_extra.c
src/mesa/shader/program_parser.h

index 00427aa5806de7039aeb721173be77eace9de8ad..ac7ff26b50f926727174a17fe53256f32d6d8f01 100644 (file)
@@ -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) },
index 7eff5cadd0dc133427a615b456c57b2b77ff33d8..919ddd7a29839af79d491afb98a4b9ecb0f1d86b 100644 (file)
@@ -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;
index a09be71020ea90bcec8629347669c9ad3755236b..3e22a8a3057a5525f6af8eb7a9e3bdfaf104edf2 100644 (file)
@@ -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;
 
index 0656c5eaa8e2122fb0ee7ceeb672979c97a5e0d3..ae98b782b70523cb237aea3b05ec85d62759f3bf 100644 (file)
@@ -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;
index 69396ca2c0f48ccc358426bf15587f0fe4714b7d..730466c30f5c142c4080d397e29e27674d9c00bf 100644 (file)
@@ -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 {