diff options
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/Makefile | 2 | ||||
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 8 | ||||
-rw-r--r-- | src/glsl/builtin_types.h | 6 | ||||
-rw-r--r-- | src/glsl/builtins/profiles/130.frag | 4 | ||||
-rw-r--r-- | src/glsl/builtins/profiles/130.vert | 4 | ||||
-rw-r--r-- | src/glsl/builtins/profiles/OES_texture_3D.frag | 7 | ||||
-rw-r--r-- | src/glsl/builtins/profiles/OES_texture_3D.vert | 7 | ||||
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 5 | ||||
-rw-r--r-- | src/glsl/glsl_parser_extras.h | 2 | ||||
-rw-r--r-- | src/glsl/glsl_types.cpp | 12 | ||||
-rw-r--r-- | src/glsl/glsl_types.h | 2 |
11 files changed, 47 insertions, 12 deletions
diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 876f0dfc2a5..df031d2d548 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -208,6 +208,6 @@ builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler @echo Regenerating builtin_function.cpp... - $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp + $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp -include depend diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index bef099cca3b..fd1f0b49f42 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3445,11 +3445,9 @@ ast_struct_specifier::hir(exec_list *instructions, if (!state->symbols->add_type(name, t)) { _mesa_glsl_error(& loc, state, "struct `%s' previously defined", name); } else { - - const glsl_type **s = (const glsl_type **) - realloc(state->user_structures, - sizeof(state->user_structures[0]) * - (state->num_user_structures + 1)); + const glsl_type **s = reralloc(state, state->user_structures, + const glsl_type *, + state->num_user_structures + 1); if (s != NULL) { s[state->num_user_structures] = t; state->user_structures = s; diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index 8ccbf6e312f..58b9a81273a 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/130.frag b/src/glsl/builtins/profiles/130.frag index 43653a906f8..0e3c7ac4199 100644 --- a/src/glsl/builtins/profiles/130.frag +++ b/src/glsl/builtins/profiles/130.frag @@ -491,8 +491,8 @@ ivec2 textureSize( sampler1DArray sampler, int lod); ivec2 textureSize(isampler1DArray sampler, int lod); ivec2 textureSize(usampler1DArray sampler, int lod); ivec3 textureSize( sampler2DArray sampler, int lod); -ivec2 textureSize(isampler2DArray sampler, int lod); -ivec2 textureSize(usampler2DArray sampler, int lod); +ivec3 textureSize(isampler2DArray sampler, int lod); +ivec3 textureSize(usampler2DArray sampler, int lod); ivec2 textureSize(sampler1DArrayShadow sampler, int lod); ivec3 textureSize(sampler2DArrayShadow sampler, int lod); diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert index 742dec6e6d5..f85b27f8f8c 100644 --- a/src/glsl/builtins/profiles/130.vert +++ b/src/glsl/builtins/profiles/130.vert @@ -493,8 +493,8 @@ ivec2 textureSize( sampler1DArray sampler, int lod); ivec2 textureSize(isampler1DArray sampler, int lod); ivec2 textureSize(usampler1DArray sampler, int lod); ivec3 textureSize( sampler2DArray sampler, int lod); -ivec2 textureSize(isampler2DArray sampler, int lod); -ivec2 textureSize(usampler2DArray sampler, int lod); +ivec3 textureSize(isampler2DArray sampler, int lod); +ivec3 textureSize(usampler2DArray sampler, int lod); ivec2 textureSize(sampler1DArrayShadow sampler, int lod); ivec3 textureSize(sampler2DArrayShadow sampler, int lod); 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 00000000000..b6ebd6a311f --- /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 00000000000..81d12f51e9f --- /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 d7a37aef46d..e8c60936fb6 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 10cb673c694..b5c016fb399 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 76b4f3e4cb0..78d10bd9380 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 61bf5e0cfd2..3c2672c01a0 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); /*@}*/ /** |