summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/builtin_types.h6
-rw-r--r--src/glsl/builtins/profiles/OES_texture_3D.frag7
-rw-r--r--src/glsl/builtins/profiles/OES_texture_3D.vert7
-rw-r--r--src/glsl/glsl_parser_extras.cpp5
-rw-r--r--src/glsl/glsl_parser_extras.h2
-rw-r--r--src/glsl/glsl_types.cpp12
-rw-r--r--src/glsl/glsl_types.h2
7 files changed, 39 insertions, 2 deletions
diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h
index 8ccbf6e312..58b9a81273 100644
--- a/src/glsl/builtin_types.h
+++ b/src/glsl/builtin_types.h
@@ -27,6 +27,10 @@ const glsl_type glsl_type::_error_type =
const glsl_type glsl_type::_void_type =
glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void");
+const glsl_type glsl_type::_sampler3D_type =
+ glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT,
+ "sampler3D");
+
const glsl_type *const glsl_type::error_type = & glsl_type::_error_type;
const glsl_type *const glsl_type::void_type = & glsl_type::_void_type;
@@ -181,8 +185,6 @@ const glsl_type glsl_type::builtin_110_types[] = {
"sampler1DShadow"),
glsl_type(GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT,
"sampler2DShadow"),
- glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT,
- "sampler3D"),
};
/*@}*/
diff --git a/src/glsl/builtins/profiles/OES_texture_3D.frag b/src/glsl/builtins/profiles/OES_texture_3D.frag
new file mode 100644
index 0000000000..b6ebd6a311
--- /dev/null
+++ b/src/glsl/builtins/profiles/OES_texture_3D.frag
@@ -0,0 +1,7 @@
+#version 100
+#extension GL_OES_texture_3D : enable
+
+vec4 texture3D (sampler3D sampler, vec3 coord);
+vec4 texture3DProj (sampler3D sampler, vec4 coord);
+vec4 texture3D (sampler3D sampler, vec3 coord, float bias);
+vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias);
diff --git a/src/glsl/builtins/profiles/OES_texture_3D.vert b/src/glsl/builtins/profiles/OES_texture_3D.vert
new file mode 100644
index 0000000000..81d12f51e9
--- /dev/null
+++ b/src/glsl/builtins/profiles/OES_texture_3D.vert
@@ -0,0 +1,7 @@
+#version 100
+#extension GL_OES_texture_3D : enable
+
+vec4 texture3D (sampler3D sampler, vec3 coord);
+vec4 texture3DProj (sampler3D sampler, vec4 coord);
+vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod);
+vec4 texture3DProjLod (sampler3D sampler, vec4 coord, float lod);
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index d7a37aef46..e8c60936fb 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -256,6 +256,11 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
state->AMD_conservative_depth_enable = (ext_mode != extension_disable);
state->AMD_conservative_depth_warn = (ext_mode == extension_warn);
unsupported = !state->extensions->AMD_conservative_depth;
+ } else if (strcmp(name, "GL_OES_texture_3D") == 0 && state->es_shader) {
+ state->OES_texture_3D_enable = (ext_mode != extension_disable);
+ state->OES_texture_3D_warn = (ext_mode == extension_warn);
+
+ unsupported = !state->extensions->EXT_texture3D;
} else {
unsupported = true;
}
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 10cb673c69..b5c016fb39 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -172,6 +172,8 @@ struct _mesa_glsl_parse_state {
unsigned ARB_shader_stencil_export_warn:1;
unsigned AMD_conservative_depth_enable:1;
unsigned AMD_conservative_depth_warn:1;
+ unsigned OES_texture_3D_enable:1;
+ unsigned OES_texture_3D_warn:1;
/*@}*/
/** Extensions supported by the OpenGL implementation. */
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 76b4f3e4cb..78d10bd938 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -131,6 +131,7 @@ glsl_type::generate_110_types(glsl_symbol_table *symtab)
add_types_to_symbol_table(symtab, builtin_110_types,
Elements(builtin_110_types),
false);
+ add_types_to_symbol_table(symtab, &_sampler3D_type, 1, false);
add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types,
Elements(builtin_110_deprecated_structure_types),
false);
@@ -179,6 +180,13 @@ glsl_type::generate_EXT_texture_array_types(glsl_symbol_table *symtab,
void
+glsl_type::generate_OES_texture_3D_types(glsl_symbol_table *symtab, bool warn)
+{
+ add_types_to_symbol_table(symtab, &_sampler3D_type, 1, warn);
+}
+
+
+void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
{
switch (state->language_version) {
@@ -204,6 +212,10 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
glsl_type::generate_ARB_texture_rectangle_types(state->symbols,
state->ARB_texture_rectangle_warn);
}
+ if (state->OES_texture_3D_enable && state->language_version == 100) {
+ glsl_type::generate_OES_texture_3D_types(state->symbols,
+ state->OES_texture_3D_warn);
+ }
if (state->EXT_texture_array_enable && state->language_version < 130) {
// These are already included in 130; don't create twice.
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 61bf5e0cfd..3c2672c01a 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -427,6 +427,7 @@ private:
/*@{*/
static const glsl_type _error_type;
static const glsl_type _void_type;
+ static const glsl_type _sampler3D_type;
static const glsl_type builtin_core_types[];
static const glsl_type builtin_structure_types[];
static const glsl_type builtin_110_deprecated_structure_types[];
@@ -453,6 +454,7 @@ private:
static void generate_130_types(glsl_symbol_table *);
static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
+ static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);
/*@}*/
/**