*/
#include "main/imports.h"
+#include "main/extensions.h"
#include "glsl_symbol_table.h"
#include "glsl_parser_extras.h"
#include "ast.h"
else
var->interpolation = ir_var_smooth;
- /* FINISHME: Apply the fragment coord convetion layout qualifiers.
- */
+ var->pixel_center_integer = qual->pixel_center_integer;
+ var->origin_upper_left = qual->origin_upper_left;
if ((qual->origin_upper_left || qual->pixel_center_integer)
&& (strcmp(var->name, "gl_FragCoord") != 0)) {
const char *const qual_string = (qual->origin_upper_left)
earlier->type = var->type;
delete var;
var = NULL;
+ } else if (state->extensions->ARB_fragment_coord_conventions &&
+ (earlier != NULL) &&
+ (strcmp(var->name, "gl_FragCoord") == 0) &&
+ earlier->type == var->type &&
+ earlier->mode == var->mode) {
+ /* Allow redeclaration of gl_FragCoord for ARB_fcc layout
+ * qualifiers.
+ */
+ earlier->origin_upper_left = var->origin_upper_left;
+ earlier->pixel_center_integer = var->pixel_center_integer;
} else {
YYLTYPE loc = this->get_location();
*/
unsigned array_lvalue:1;
+ /* ARB_fragment_coord_conventions */
+ unsigned origin_upper_left:1;
+ unsigned pixel_center_integer:1;
+
/**
* Storage location of the base of this variable
*
var->array_lvalue = this->array_lvalue;
var->location = this->location;
var->warn_extension = this->warn_extension;
+ var->origin_upper_left = this->origin_upper_left;
+ var->pixel_center_integer = this->pixel_center_integer;
if (this->constant_value)
var->constant_value = this->constant_value->clone(ht);
void
ir_to_mesa_visitor::visit(ir_variable *ir)
{
- (void)ir;
+ if (strcmp(ir->name, "gl_FragCoord") == 0) {
+ struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
+
+ fp->OriginUpperLeft = ir->origin_upper_left;
+ fp->PixelCenterInteger = ir->pixel_center_integer;
+ }
}
void