glsl: Enable GL_OES_texture_3D extension for ES2.

This commit is contained in:
Kenneth Graunke 2011-02-25 23:11:20 -08:00
parent eb639349e2
commit 0a163cf56d
8 changed files with 40 additions and 4 deletions

View File

@ -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"),
};
/*@}*/

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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. */

View File

@ -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);
@ -178,6 +179,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)
{
@ -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.

View File

@ -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);
/*@}*/
/**

View File

@ -241,8 +241,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_stencil4", o(dummy_false), DISABLE },
{ "GL_OES_stencil8", o(EXT_framebuffer_object), ES1 | ES2 },
{ "GL_OES_stencil_wrap", o(EXT_stencil_wrap), ES1 },
/* GL_OES_texture_3D is disabled due to missing GLSL support. */
{ "GL_OES_texture_3D", o(EXT_texture3D), DISABLE },
{ "GL_OES_texture_3D", o(EXT_texture3D), ES2 },
{ "GL_OES_texture_cube_map", o(ARB_texture_cube_map), ES1 },
{ "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1 },
{ "GL_OES_texture_mirrored_repeat", o(ARB_texture_mirrored_repeat), ES1 },