summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-06-04 09:06:22 -0400
committerKristian Høgsberg <[email protected]>2010-06-04 09:06:34 -0400
commita663a6371850da64cab33ed8dc5892e3bff06294 (patch)
treef6be3e9c69c58fa19896277819fc7c0411db6b38 /src/glsl
parentbe5a514d4e526070ff58f12fc3d161b992ff205c (diff)
glsl: Recject rect samplers when GL_ARB_texture_rectangle is disabled
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/cl/sl_cl_parse.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/glsl/cl/sl_cl_parse.c b/src/glsl/cl/sl_cl_parse.c
index 771bdfd0825..663436dde99 100644
--- a/src/glsl/cl/sl_cl_parse.c
+++ b/src/glsl/cl/sl_cl_parse.c
@@ -338,6 +338,7 @@ struct parse_dict {
int all;
int _GL_ARB_fragment_coord_conventions;
+ int _GL_ARB_texture_rectangle;
};
@@ -357,6 +358,7 @@ struct parse_context {
unsigned int parsing_builtin;
unsigned int fragment_coord_conventions:1;
+ unsigned int texture_rectangle:1;
char error[256];
int process_error;
@@ -1035,8 +1037,18 @@ _parse_type_specifier_nonarray(struct parse_context *ctx,
} else if (id == ctx->dict.sampler2DShadow) {
_update(ctx, e, TYPE_SPECIFIER_SAMPLER2DSHADOW);
} else if (id == ctx->dict.sampler2DRect) {
+ if (!ctx->texture_rectangle) {
+ _error(ctx, "GL_ARB_texture_rectangle extension must be enabled "
+ "in order to use a rect sampler");
+ return -1;
+ }
_update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECT);
} else if (id == ctx->dict.sampler2DRectShadow) {
+ if (!ctx->texture_rectangle) {
+ _error(ctx, "GL_ARB_texture_rectangle extension must be enabled "
+ "in order to use a rect sampler");
+ return -1;
+ }
_update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECTSHADOW);
} else if (id == ctx->dict.sampler1DArray) {
_update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY);
@@ -1960,8 +1972,18 @@ _parse_prectype(struct parse_context *ctx,
} else if (id == ctx->dict.sampler2DShadow) {
type = TYPE_SPECIFIER_SAMPLER2DSHADOW;
} else if (id == ctx->dict.sampler2DRect) {
+ if (!ctx->texture_rectangle) {
+ _error(ctx, "GL_ARB_texture_rectangle extension must be enabled "
+ "in order to use a rect sampler");
+ return -1;
+ }
type = TYPE_SPECIFIER_SAMPLER2DRECT;
} else if (id == ctx->dict.sampler2DRectShadow) {
+ if (!ctx->texture_rectangle) {
+ _error(ctx, "GL_ARB_texture_rectangle extension must be enabled "
+ "in order to use a rect sampler");
+ return -1;
+ }
type = TYPE_SPECIFIER_SAMPLER2DRECTSHADOW;
} else if (id == ctx->dict.sampler1DArray) {
type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY;
@@ -2827,6 +2849,9 @@ _parse_extensions(struct parse_context *ctx,
else if (input->data.extension == ctx->dict._GL_ARB_fragment_coord_conventions) {
ctx->fragment_coord_conventions = enable;
}
+ else if (input->data.extension == ctx->dict._GL_ARB_texture_rectangle) {
+ ctx->texture_rectangle = enable;
+ }
}
}
@@ -2964,6 +2989,7 @@ sl_cl_compile(struct sl_pp_context *context,
ADD_NAME(ctx, all);
ADD_NAME_STR(ctx, _GL_ARB_fragment_coord_conventions, "GL_ARB_fragment_coord_conventions");
+ ADD_NAME_STR(ctx, _GL_ARB_texture_rectangle, "GL_ARB_texture_rectangle");
ctx.out_buf = NULL;
ctx.out_cap = 0;
@@ -2972,6 +2998,7 @@ sl_cl_compile(struct sl_pp_context *context,
ctx.parsing_builtin = 1;
ctx.fragment_coord_conventions = 0;
+ ctx.texture_rectangle = 1;
ctx.error[0] = '\0';
ctx.process_error = 0;